fix(core): update
This commit is contained in:
@ -41,7 +41,7 @@ export class CloudflareAccount {
|
||||
getZoneId: async (domainName: string) => {
|
||||
const domain = new plugins.smartstring.Domain(domainName);
|
||||
const zoneArray = await this.convenience.listZones(domain.zoneName);
|
||||
const filteredResponse = zoneArray.filter(zoneArg => {
|
||||
const filteredResponse = zoneArray.filter((zoneArg) => {
|
||||
return zoneArg.name === domainName;
|
||||
});
|
||||
if (filteredResponse.length >= 1) {
|
||||
@ -62,7 +62,7 @@ export class CloudflareAccount {
|
||||
): Promise<interfaces.ICflareRecord> => {
|
||||
const domain = new plugins.smartstring.Domain(domainNameArg);
|
||||
const recordArrayArg = await this.convenience.listRecords(domain.zoneName);
|
||||
const filteredResponse = recordArrayArg.filter(recordArg => {
|
||||
const filteredResponse = recordArrayArg.filter((recordArg) => {
|
||||
return recordArg.type === typeArg && recordArg.name === domainNameArg;
|
||||
});
|
||||
return filteredResponse[0];
|
||||
@ -82,7 +82,7 @@ export class CloudflareAccount {
|
||||
name: domain.fullName,
|
||||
type: typeArg,
|
||||
content: contentArg,
|
||||
ttl: ttlArg
|
||||
ttl: ttlArg,
|
||||
};
|
||||
const response = await this.request(
|
||||
'POST',
|
||||
@ -168,7 +168,7 @@ export class CloudflareAccount {
|
||||
const domainId = await this.convenience.getZoneId(domain.zoneName);
|
||||
const requestUrl = `/zones/${domainId}/purge_cache`;
|
||||
const payload = {
|
||||
purge_everything: true
|
||||
purge_everything: true,
|
||||
};
|
||||
const respone = await this.request('DELETE', requestUrl, payload);
|
||||
},
|
||||
@ -179,7 +179,7 @@ export class CloudflareAccount {
|
||||
},
|
||||
acmeRemoveDnsChallenge: async (dnsChallenge: plugins.tsclass.network.IDnsChallenge) => {
|
||||
await this.convenience.removeRecord(dnsChallenge.hostName, 'TXT');
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
public async request(
|
||||
@ -194,9 +194,9 @@ export class CloudflareAccount {
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `Bearer ${this.authToken}`,
|
||||
'Content-Length': Buffer.byteLength(JSON.stringify(dataArg)),
|
||||
...requestHeadersArg
|
||||
...requestHeadersArg,
|
||||
},
|
||||
requestBody: dataArg
|
||||
requestBody: dataArg,
|
||||
};
|
||||
|
||||
// route analysis
|
||||
|
@ -78,14 +78,14 @@ export class CloudflareWorker {
|
||||
const requestRoute = `/zones/${zoneId}/workers/routes`;
|
||||
await this.workerManager.cfAccount.request('POST', requestRoute, {
|
||||
pattern: newRoute.pattern,
|
||||
script: this.id
|
||||
script: this.id,
|
||||
});
|
||||
} else if (routeStatus === 'needsUpdate') {
|
||||
const zoneId = await this.workerManager.cfAccount.convenience.getZoneId(newRoute.zoneName);
|
||||
const requestRoute = `/zones/${zoneId}/workers/routes/${routeIdForUpdate}`;
|
||||
await this.workerManager.cfAccount.request('PUT', requestRoute, {
|
||||
pattern: newRoute.pattern,
|
||||
script: this.id
|
||||
script: this.id,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ export class WorkerManager {
|
||||
const route = `/accounts/${accountIdentifier}/workers/scripts/${workerName}`;
|
||||
const responseBody = await this.cfAccount.request('PUT', route, workerScript, {
|
||||
'Content-Type': 'application/javascript',
|
||||
'Content-Length': Buffer.byteLength(workerScript)
|
||||
'Content-Length': Buffer.byteLength(workerScript),
|
||||
});
|
||||
return CloudflareWorker.fromApiObject(this, responseBody.result);
|
||||
}
|
||||
|
Reference in New Issue
Block a user