Compare commits
34 Commits
Author | SHA1 | Date | |
---|---|---|---|
e466944c55 | |||
6d8deca9d4 | |||
a4518f3068 | |||
9e338354c6 | |||
9d8c14d187 | |||
5a0b12f6aa | |||
387f00078f | |||
fe2f45e3a9 | |||
90c9bfc906 | |||
4f9e81f612 | |||
a4e280f9f0 | |||
52bd80aebd | |||
15e3cdae83 | |||
c72147b469 | |||
d98c2f89c5 | |||
2b722816f6 | |||
91d58277dd | |||
2458da6754 | |||
d4379d19d3 | |||
b0fdd520f3 | |||
a746577945 | |||
bc4cae3333 | |||
e0614b5956 | |||
f568949085 | |||
bee256416f | |||
afa2679501 | |||
7838642fd5 | |||
7a992badf4 | |||
c65790e2f9 | |||
7ec0fe78fc | |||
12f4456ebd | |||
3e8cf73877 | |||
0032292714 | |||
ead87ceb63 |
4
.gitignore
vendored
4
.gitignore
vendored
@ -15,8 +15,6 @@ node_modules/
|
|||||||
|
|
||||||
# builds
|
# builds
|
||||||
dist/
|
dist/
|
||||||
dist_web/
|
dist_*/
|
||||||
dist_serve/
|
|
||||||
dist_ts_web/
|
|
||||||
|
|
||||||
# custom
|
# custom
|
@ -19,22 +19,35 @@ mirror:
|
|||||||
stage: security
|
stage: security
|
||||||
script:
|
script:
|
||||||
- npmci git mirror
|
- npmci git mirror
|
||||||
|
only:
|
||||||
|
- tags
|
||||||
tags:
|
tags:
|
||||||
- lossless
|
- lossless
|
||||||
- docker
|
- docker
|
||||||
- notpriv
|
- notpriv
|
||||||
|
|
||||||
snyk:
|
auditProductionDependencies:
|
||||||
image: registry.gitlab.com/hosttoday/ht-docker-node:snyk
|
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||||
|
stage: security
|
||||||
|
script:
|
||||||
|
- npmci npm prepare
|
||||||
|
- npmci command npm install --production --ignore-scripts
|
||||||
|
- npmci command npm config set registry https://registry.npmjs.org
|
||||||
|
- npmci command npm audit --audit-level=high --only=prod --production
|
||||||
|
tags:
|
||||||
|
- docker
|
||||||
|
|
||||||
|
auditDevDependencies:
|
||||||
|
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||||
stage: security
|
stage: security
|
||||||
script:
|
script:
|
||||||
- npmci npm prepare
|
- npmci npm prepare
|
||||||
- npmci command npm install --ignore-scripts
|
- npmci command npm install --ignore-scripts
|
||||||
- npmci command snyk test
|
- npmci command npm config set registry https://registry.npmjs.org
|
||||||
|
- npmci command npm audit --audit-level=high --only=dev
|
||||||
tags:
|
tags:
|
||||||
- lossless
|
|
||||||
- docker
|
- docker
|
||||||
- notpriv
|
allow_failure: true
|
||||||
|
|
||||||
# ====================
|
# ====================
|
||||||
# test stage
|
# test stage
|
||||||
@ -49,9 +62,7 @@ testStable:
|
|||||||
- npmci npm test
|
- npmci npm test
|
||||||
coverage: /\d+.?\d+?\%\s*coverage/
|
coverage: /\d+.?\d+?\%\s*coverage/
|
||||||
tags:
|
tags:
|
||||||
- lossless
|
|
||||||
- docker
|
- docker
|
||||||
- priv
|
|
||||||
|
|
||||||
testBuild:
|
testBuild:
|
||||||
stage: test
|
stage: test
|
||||||
@ -62,9 +73,7 @@ testBuild:
|
|||||||
- npmci command npm run build
|
- npmci command npm run build
|
||||||
coverage: /\d+.?\d+?\%\s*coverage/
|
coverage: /\d+.?\d+?\%\s*coverage/
|
||||||
tags:
|
tags:
|
||||||
- lossless
|
|
||||||
- docker
|
- docker
|
||||||
- notpriv
|
|
||||||
|
|
||||||
release:
|
release:
|
||||||
stage: release
|
stage: release
|
||||||
@ -84,6 +93,8 @@ release:
|
|||||||
codequality:
|
codequality:
|
||||||
stage: metadata
|
stage: metadata
|
||||||
allow_failure: true
|
allow_failure: true
|
||||||
|
only:
|
||||||
|
- tags
|
||||||
script:
|
script:
|
||||||
- npmci command npm install -g tslint typescript
|
- npmci command npm install -g tslint typescript
|
||||||
- npmci npm prepare
|
- npmci npm prepare
|
||||||
|
2
.vscode/settings.json
vendored
2
.vscode/settings.json
vendored
@ -15,7 +15,7 @@
|
|||||||
"properties": {
|
"properties": {
|
||||||
"projectType": {
|
"projectType": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"enum": ["website", "element", "service", "npm"]
|
"enum": ["website", "element", "service", "npm", "wcc"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
11247
package-lock.json
generated
11247
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
40
package.json
40
package.json
@ -1,13 +1,13 @@
|
|||||||
{
|
{
|
||||||
"name": "@mojoio/cloudflare",
|
"name": "@mojoio/cloudflare",
|
||||||
"version": "3.0.6",
|
"version": "5.0.9",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "easy cloudflare management",
|
"description": "easy cloudflare management",
|
||||||
"main": "dist/index.js",
|
"main": "dist_ts/index.js",
|
||||||
"typings": "dist/index.d.ts",
|
"typings": "dist_ts/index.d.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "(tstest test/)",
|
"test": "(tstest test/)",
|
||||||
"build": "(tsbuild)"
|
"build": "(tsbuild --web)"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@ -24,32 +24,36 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://gitlab.com/pushrocks/cflare#readme",
|
"homepage": "https://gitlab.com/pushrocks/cflare#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@pushrocks/smartdelay": "^2.0.6",
|
"@pushrocks/smartdelay": "^2.0.10",
|
||||||
"@pushrocks/smartlog": "^2.0.21",
|
"@pushrocks/smartlog": "^2.0.39",
|
||||||
"@pushrocks/smartpromise": "^3.0.6",
|
"@pushrocks/smartpromise": "^3.1.3",
|
||||||
"@pushrocks/smartrequest": "^1.1.47",
|
"@pushrocks/smartrequest": "^1.1.51",
|
||||||
"@pushrocks/smartstring": "^3.0.18",
|
"@pushrocks/smartstring": "^3.0.24",
|
||||||
"@tsclass/tsclass": "^3.0.4"
|
"@tsclass/tsclass": "^3.0.29"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@gitzone/tsbuild": "^2.1.17",
|
"@gitzone/tsbuild": "^2.1.25",
|
||||||
"@gitzone/tsrun": "^1.2.8",
|
"@gitzone/tsrun": "^1.2.12",
|
||||||
"@gitzone/tstest": "^1.0.28",
|
"@gitzone/tstest": "^1.0.52",
|
||||||
"@pushrocks/qenv": "^4.0.6",
|
"@pushrocks/qenv": "^4.0.10",
|
||||||
"@pushrocks/tapbundle": "^3.2.0",
|
"@pushrocks/tapbundle": "^3.2.9",
|
||||||
"@types/node": "^13.7.0",
|
"@types/node": "^14.14.22",
|
||||||
"tslint": "^6.0.0",
|
"tslint": "^6.1.3",
|
||||||
"tslint-config-prettier": "^1.18.0"
|
"tslint-config-prettier": "^1.18.0"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"ts/**/*",
|
"ts/**/*",
|
||||||
"ts_web/**/*",
|
"ts_web/**/*",
|
||||||
"dist/**/*",
|
"dist/**/*",
|
||||||
"dist_web/**/*",
|
"dist_*/**/*",
|
||||||
|
"dist_ts/**/*",
|
||||||
"dist_ts_web/**/*",
|
"dist_ts_web/**/*",
|
||||||
"assets/**/*",
|
"assets/**/*",
|
||||||
"cli.js",
|
"cli.js",
|
||||||
"npmextra.json",
|
"npmextra.json",
|
||||||
"readme.md"
|
"readme.md"
|
||||||
|
],
|
||||||
|
"browserslist": [
|
||||||
|
"last 1 chrome versions"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
52
readme.md
Normal file
52
readme.md
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
# @mojoio/cloudflare
|
||||||
|
easy cloudflare management
|
||||||
|
|
||||||
|
## Availabililty and Links
|
||||||
|
* [npmjs.org (npm package)](https://www.npmjs.com/package/@mojoio/cloudflare)
|
||||||
|
* [gitlab.com (source)](https://gitlab.com/mojoio/cloudflare)
|
||||||
|
* [github.com (source mirror)](https://github.com/mojoio/cloudflare)
|
||||||
|
* [docs (typedoc)](https://mojoio.gitlab.io/cloudflare/)
|
||||||
|
|
||||||
|
## Status for master
|
||||||
|
|
||||||
|
Status Category | Status Badge
|
||||||
|
-- | --
|
||||||
|
GitLab Pipelines | [](https://lossless.cloud)
|
||||||
|
GitLab Pipline Test Coverage | [](https://lossless.cloud)
|
||||||
|
npm | [](https://lossless.cloud)
|
||||||
|
Snyk | [](https://lossless.cloud)
|
||||||
|
TypeScript Support | [](https://lossless.cloud)
|
||||||
|
node Support | [](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
||||||
|
Code Style | [](https://lossless.cloud)
|
||||||
|
PackagePhobia (total standalone install weight) | [](https://lossless.cloud)
|
||||||
|
PackagePhobia (package size on registry) | [](https://lossless.cloud)
|
||||||
|
BundlePhobia (total size when bundled) | [](https://lossless.cloud)
|
||||||
|
Platform support | [](https://lossless.cloud) [](https://lossless.cloud)
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
Use TypeScript for best in class instellisense.
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
import * as cflare from '@mojoio/cloudflare';
|
||||||
|
|
||||||
|
const myCflareAccount = new cflare.CflareAccount('mySuperAwesomeAccountToken');
|
||||||
|
|
||||||
|
const myAsyncCflareManagement = async () => {
|
||||||
|
// get things
|
||||||
|
const myZones = await myCflareAccount.listZones(); // zones are fully typed
|
||||||
|
const myIdForADomain = await myCflareAccount.getZoneId('example.com'); // type number
|
||||||
|
const myRecordsForADomain = await myCflareAccount.listRecords('example.com'); // records are fully typed
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
## Contribution
|
||||||
|
|
||||||
|
We are always happy for code contributions. If you are not the code contributing type that is ok. Still, maintaining Open Source repositories takes considerable time and thought. If you like the quality of what we do and our modules are useful to you we would appreciate a little monthly contribution: You can [contribute one time](https://lossless.link/contribute-onetime) or [contribute monthly](https://lossless.link/contribute). :)
|
||||||
|
|
||||||
|
For further information read the linked docs at the top of this readme.
|
||||||
|
|
||||||
|
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
|
||||||
|
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
|
||||||
|
|
||||||
|
[](https://maintainedby.lossless.com)
|
44
test/test.ts
44
test/test.ts
@ -11,61 +11,63 @@ const randomPrefix = Math.floor(Math.random() * 2000);
|
|||||||
let testCloudflareAccount: cloudflare.CloudflareAccount;
|
let testCloudflareAccount: cloudflare.CloudflareAccount;
|
||||||
|
|
||||||
tap.test('should create a valid instance of CloudflareAccount', async () => {
|
tap.test('should create a valid instance of CloudflareAccount', async () => {
|
||||||
testCloudflareAccount = new cloudflare.CloudflareAccount({
|
testCloudflareAccount = new cloudflare.CloudflareAccount(testQenv.getEnvVarOnDemand('CF_KEY'));
|
||||||
email: testQenv.getEnvVarOnDemand('CF_EMAIL'),
|
|
||||||
key: testQenv.getEnvVarOnDemand('CF_KEY')
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
tap.test('.listZones() -> should display an entire account', async tools => {
|
tap.test('.listZones() -> should display an entire account', async (tools) => {
|
||||||
tools.timeout(600000);
|
tools.timeout(600000);
|
||||||
const result = await testCloudflareAccount.listZones();
|
const result = await testCloudflareAccount.convenience.listZones();
|
||||||
console.log(result);
|
console.log(result);
|
||||||
});
|
});
|
||||||
|
|
||||||
tap.test(
|
tap.test(
|
||||||
'.getZoneId(domainName) -> should get an Cloudflare Id for a domain string',
|
'.getZoneId(domainName) -> should get an Cloudflare Id for a domain string',
|
||||||
async tools => {
|
async (tools) => {
|
||||||
tools.timeout(600000);
|
tools.timeout(600000);
|
||||||
await testCloudflareAccount.getZoneId('bleu.de');
|
await testCloudflareAccount.convenience.getZoneId('bleu.de');
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
tap.test(
|
tap.test(
|
||||||
'.listRecords(domainName) -> should list all records for a specific Domain Name',
|
'.listRecords(domainName) -> should list all records for a specific Domain Name',
|
||||||
async tools => {
|
async (tools) => {
|
||||||
tools.timeout(600000);
|
tools.timeout(600000);
|
||||||
await testCloudflareAccount.listRecords('bleu.de').then(async responseArg => {
|
await testCloudflareAccount.convenience.listRecords('bleu.de').then(async (responseArg) => {
|
||||||
console.log(responseArg);
|
console.log(responseArg);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
tap.test('should create a valid record for a subdomain', async tools => {
|
tap.test('should create a valid record for a subdomain', async (tools) => {
|
||||||
tools.timeout(600000);
|
tools.timeout(600000);
|
||||||
await testCloudflareAccount.createRecord(`${randomPrefix}subdomain.bleu.de`, 'A', '127.0.0.1');
|
await testCloudflareAccount.convenience.createRecord(
|
||||||
|
`${randomPrefix}subdomain.bleu.de`,
|
||||||
|
'A',
|
||||||
|
'127.0.0.1',
|
||||||
|
120
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
tap.test('should get a record from Cloudflare', async tools => {
|
tap.test('should get a record from Cloudflare', async (tools) => {
|
||||||
tools.timeout(600000);
|
tools.timeout(600000);
|
||||||
await testCloudflareAccount
|
await testCloudflareAccount.convenience
|
||||||
.getRecord(`${randomPrefix}subdomain.bleu.de`, 'A')
|
.getRecord(`${randomPrefix}subdomain.bleu.de`, 'A')
|
||||||
.then(responseArg => {
|
.then((responseArg) => {
|
||||||
console.log(responseArg);
|
console.log(responseArg);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
tap.test('should remove a subdomain record from Cloudflare', async tools => {
|
tap.test('should remove a subdomain record from Cloudflare', async (tools) => {
|
||||||
tools.timeout(600000);
|
tools.timeout(600000);
|
||||||
await testCloudflareAccount
|
await testCloudflareAccount.convenience
|
||||||
.removeRecord(`${randomPrefix}subdomain.bleu.de`, 'A')
|
.removeRecord(`${randomPrefix}subdomain.bleu.de`, 'A')
|
||||||
.then(async responseArg => {
|
.then(async (responseArg) => {
|
||||||
console.log(responseArg);
|
console.log(responseArg);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
tap.test('.purge(some.domain) -> should purge everything', async () => {
|
tap.test('.purge(some.domain) -> should purge everything', async () => {
|
||||||
await testCloudflareAccount.purgeZone('bleu.de');
|
await testCloudflareAccount.convenience.purgeZone('bleu.de');
|
||||||
});
|
});
|
||||||
|
|
||||||
// WORKERS
|
// WORKERS
|
||||||
@ -77,8 +79,8 @@ tap.test('should create a worker', async () => {
|
|||||||
await worker.setRoutes([
|
await worker.setRoutes([
|
||||||
{
|
{
|
||||||
zoneName: 'bleu.de',
|
zoneName: 'bleu.de',
|
||||||
pattern: 'https://*bleu.de/hello'
|
pattern: 'https://*bleu.de/hello',
|
||||||
}
|
},
|
||||||
]);
|
]);
|
||||||
console.log(worker);
|
console.log(worker);
|
||||||
});
|
});
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import plugins = require('./cloudflare.plugins');
|
import plugins = require('./cloudflare.plugins');
|
||||||
|
import { logger } from './cloudflare.logger';
|
||||||
import * as interfaces from './interfaces';
|
import * as interfaces from './interfaces';
|
||||||
|
|
||||||
// interfaces
|
// interfaces
|
||||||
@ -6,8 +7,7 @@ import { WorkerManager } from './cloudflare.classes.workermanager';
|
|||||||
import { ZoneManager } from './cloudflare.classes.zonemanager';
|
import { ZoneManager } from './cloudflare.classes.zonemanager';
|
||||||
|
|
||||||
export class CloudflareAccount {
|
export class CloudflareAccount {
|
||||||
private authEmail: string;
|
private authToken: string;
|
||||||
private authKey: string;
|
|
||||||
private accountIdentifier: string;
|
private accountIdentifier: string;
|
||||||
|
|
||||||
public workerManager = new WorkerManager(this);
|
public workerManager = new WorkerManager(this);
|
||||||
@ -17,195 +17,254 @@ export class CloudflareAccount {
|
|||||||
* constructor sets auth information on the CloudflareAccountInstance
|
* constructor sets auth information on the CloudflareAccountInstance
|
||||||
* @param optionsArg
|
* @param optionsArg
|
||||||
*/
|
*/
|
||||||
constructor(optionsArg: { email: string; key: string }) {
|
constructor(authTokenArg: string) {
|
||||||
this.authEmail = optionsArg.email;
|
this.authToken = authTokenArg;
|
||||||
this.authKey = optionsArg.key;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gets you the account identifier
|
||||||
|
*/
|
||||||
public async getAccountIdentifier() {
|
public async getAccountIdentifier() {
|
||||||
if (!this.accountIdentifier) {
|
if (!this.accountIdentifier) {
|
||||||
const route = `/accounts?page=1&per_page=20&direction=desc`;
|
const route = `/accounts?page=1&per_page=20&direction=desc`;
|
||||||
const response: any = await this.request('GET', route);
|
const response: any = await this.request('GET', route);
|
||||||
this.accountIdentifier = response.result[0].id;
|
this.accountIdentifier = response.result[0].id;
|
||||||
// console.log('Account identifier is: ' + this.accountIdentifier);
|
|
||||||
}
|
}
|
||||||
return this.accountIdentifier;
|
return this.accountIdentifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public convenience = {
|
||||||
* gets a zone id of a domain from cloudflare
|
/**
|
||||||
* @param domainName
|
* gets a zone id of a domain from cloudflare
|
||||||
*/
|
* @param domainName
|
||||||
public async getZoneId(domainName: string) {
|
*/
|
||||||
const domain = new plugins.smartstring.Domain(domainName);
|
getZoneId: async (domainName: string) => {
|
||||||
const zoneArray = await this.listZones(domain.zoneName);
|
const domain = new plugins.smartstring.Domain(domainName);
|
||||||
const filteredResponse = zoneArray.filter(zoneArg => {
|
const zoneArray = await this.convenience.listZones(domain.zoneName);
|
||||||
return zoneArg.name === domainName;
|
const filteredResponse = zoneArray.filter((zoneArg) => {
|
||||||
});
|
return zoneArg.name === domainName;
|
||||||
if (filteredResponse.length >= 1) {
|
});
|
||||||
return filteredResponse[0].id;
|
if (filteredResponse.length >= 1) {
|
||||||
} else {
|
return filteredResponse[0].id;
|
||||||
plugins.smartlog.defaultLogger.log(
|
} else {
|
||||||
'error',
|
logger.log('error', `the domain ${domainName} does not appear to be in this account!`);
|
||||||
`the domain ${domainName} does not appear to be in this account!`
|
throw new Error(`the domain ${domainName} does not appear to be in this account!`);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* gets a record
|
||||||
|
* @param domainNameArg
|
||||||
|
* @param typeArg
|
||||||
|
*/
|
||||||
|
getRecord: async (
|
||||||
|
domainNameArg: string,
|
||||||
|
typeArg: plugins.tsclass.network.TDnsRecordType
|
||||||
|
): Promise<interfaces.ICflareRecord> => {
|
||||||
|
const domain = new plugins.smartstring.Domain(domainNameArg);
|
||||||
|
const recordArrayArg = await this.convenience.listRecords(domain.zoneName);
|
||||||
|
const filteredResponse = recordArrayArg.filter((recordArg) => {
|
||||||
|
return recordArg.type === typeArg && recordArg.name === domainNameArg;
|
||||||
|
});
|
||||||
|
return filteredResponse[0];
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* creates a record
|
||||||
|
*/
|
||||||
|
createRecord: async (
|
||||||
|
domainNameArg: string,
|
||||||
|
typeArg: plugins.tsclass.network.TDnsRecordType,
|
||||||
|
contentArg: string,
|
||||||
|
ttlArg = 1
|
||||||
|
): Promise<any> => {
|
||||||
|
const domain = new plugins.smartstring.Domain(domainNameArg);
|
||||||
|
const domainIdArg = await this.convenience.getZoneId(domain.zoneName);
|
||||||
|
const dataObject = {
|
||||||
|
name: domain.fullName,
|
||||||
|
type: typeArg,
|
||||||
|
content: contentArg,
|
||||||
|
ttl: ttlArg,
|
||||||
|
};
|
||||||
|
const response = await this.request(
|
||||||
|
'POST',
|
||||||
|
'/zones/' + domainIdArg + '/dns_records',
|
||||||
|
dataObject
|
||||||
);
|
);
|
||||||
throw new Error(`the domain ${domainName} does not appear to be in this account!`);
|
return response;
|
||||||
}
|
},
|
||||||
}
|
/**
|
||||||
|
* removes a record from Cloudflare
|
||||||
|
* @param domainNameArg
|
||||||
|
* @param typeArg
|
||||||
|
*/
|
||||||
|
removeRecord: async (
|
||||||
|
domainNameArg: string,
|
||||||
|
typeArg: plugins.tsclass.network.TDnsRecordType
|
||||||
|
): Promise<any> => {
|
||||||
|
const domain = new plugins.smartstring.Domain(domainNameArg);
|
||||||
|
const cflareRecord = await this.convenience.getRecord(domain.fullName, typeArg);
|
||||||
|
if (cflareRecord) {
|
||||||
|
const requestRoute: string = `/zones/${cflareRecord.zone_id}/dns_records/${cflareRecord.id}`;
|
||||||
|
return await this.request('DELETE', requestRoute);
|
||||||
|
} else {
|
||||||
|
throw new Error(`could not remove record for ${domainNameArg} with type ${typeArg}`);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* cleanrecord allows the cleaning of any previous records to avoid unwanted sideeffects
|
||||||
|
*/
|
||||||
|
cleanRecord: async (domainNameArg: string, typeArg: plugins.tsclass.network.TDnsRecordType) => {
|
||||||
|
console.log(`cleaning record for ${domainNameArg}`);
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* updates a record
|
||||||
|
* @param domainNameArg
|
||||||
|
* @param typeArg
|
||||||
|
* @param valueArg
|
||||||
|
*/
|
||||||
|
updateRecord: async (
|
||||||
|
domainNameArg: string,
|
||||||
|
typeArg: plugins.tsclass.network.TDnsRecordType,
|
||||||
|
valueArg
|
||||||
|
) => {
|
||||||
|
// TODO: implement
|
||||||
|
const domain = new plugins.smartstring.Domain(domainNameArg);
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* list all records of a specified domain name
|
||||||
|
* @param domainNameArg - the domain name that you want to get the records from
|
||||||
|
*/
|
||||||
|
listRecords: async (domainNameArg: string): Promise<interfaces.ICflareRecord[]> => {
|
||||||
|
const domain = new plugins.smartstring.Domain(domainNameArg);
|
||||||
|
const domainId = await this.convenience.getZoneId(domain.zoneName);
|
||||||
|
const responseArg: any = await this.request(
|
||||||
|
'GET',
|
||||||
|
'/zones/' + domainId + '/dns_records?per_page=100'
|
||||||
|
);
|
||||||
|
const result: interfaces.ICflareRecord[] = responseArg.result;
|
||||||
|
return result;
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* list all zones in the associated authenticated account
|
||||||
|
* @param domainName
|
||||||
|
*/
|
||||||
|
listZones: async (domainName?: string): Promise<interfaces.ICflareZone[]> => {
|
||||||
|
// TODO: handle pagination
|
||||||
|
let requestRoute = `/zones?per_page=50`;
|
||||||
|
|
||||||
/**
|
// may be optionally filtered by domain name
|
||||||
* gets a record
|
if (domainName) {
|
||||||
* @param domainNameArg
|
requestRoute = `${requestRoute}&name=${domainName}`;
|
||||||
* @param typeArg
|
}
|
||||||
*/
|
|
||||||
public async getRecord(
|
|
||||||
domainNameArg: string,
|
|
||||||
typeArg: plugins.tsclass.network.TDnsRecord
|
|
||||||
): Promise<interfaces.ICflareRecord> {
|
|
||||||
const domain = new plugins.smartstring.Domain(domainNameArg);
|
|
||||||
const recordArrayArg = await this.listRecords(domain.zoneName);
|
|
||||||
const filteredResponse = recordArrayArg.filter(recordArg => {
|
|
||||||
return recordArg.type === typeArg && recordArg.name === domainNameArg;
|
|
||||||
});
|
|
||||||
return filteredResponse[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
public async createRecord(
|
const response: any = await this.request('GET', requestRoute);
|
||||||
domainNameArg: string,
|
const result = response.result;
|
||||||
typeArg: plugins.tsclass.network.TDnsRecord,
|
return result;
|
||||||
contentArg: string
|
},
|
||||||
): Promise<any> {
|
/**
|
||||||
const domain = new plugins.smartstring.Domain(domainNameArg);
|
* purges a zone
|
||||||
const domainIdArg = await this.getZoneId(domain.zoneName);
|
*/
|
||||||
const dataObject = {
|
purgeZone: async (domainName: string): Promise<void> => {
|
||||||
name: domain.fullName,
|
const domain = new plugins.smartstring.Domain(domainName);
|
||||||
type: typeArg,
|
const domainId = await this.convenience.getZoneId(domain.zoneName);
|
||||||
content: contentArg
|
const requestUrl = `/zones/${domainId}/purge_cache`;
|
||||||
};
|
const payload = {
|
||||||
const response = await this.request(
|
purge_everything: true,
|
||||||
'POST',
|
};
|
||||||
'/zones/' + domainIdArg + '/dns_records',
|
const respone = await this.request('DELETE', requestUrl, payload);
|
||||||
dataObject
|
},
|
||||||
);
|
// acme convenience functions
|
||||||
return response;
|
acmeSetDnsChallenge: async (dnsChallenge: plugins.tsclass.network.IDnsChallenge) => {
|
||||||
}
|
await this.convenience.cleanRecord(dnsChallenge.hostName, 'TXT');
|
||||||
|
await this.convenience.createRecord(dnsChallenge.hostName, 'TXT', dnsChallenge.challenge, 120);
|
||||||
|
},
|
||||||
|
acmeRemoveDnsChallenge: async (dnsChallenge: plugins.tsclass.network.IDnsChallenge) => {
|
||||||
|
await this.convenience.removeRecord(dnsChallenge.hostName, 'TXT');
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
public async request(
|
||||||
* removes a record from Cloudflare
|
|
||||||
* @param domainNameArg
|
|
||||||
* @param typeArg
|
|
||||||
*/
|
|
||||||
public async removeRecord(
|
|
||||||
domainNameArg: string,
|
|
||||||
typeArg: plugins.tsclass.network.TDnsRecord
|
|
||||||
): Promise<any> {
|
|
||||||
const domain = new plugins.smartstring.Domain(domainNameArg);
|
|
||||||
const cflareRecord = await this.getRecord(domain.fullName, typeArg);
|
|
||||||
if (cflareRecord) {
|
|
||||||
const requestRoute: string = `/zones/${cflareRecord.zone_id}/dns_records/${cflareRecord.id}`;
|
|
||||||
return await this.request('DELETE', requestRoute);
|
|
||||||
} else {
|
|
||||||
throw new Error(`could not remove record for ${domainNameArg} with type ${typeArg}`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* updates a record
|
|
||||||
* @param domainNameArg
|
|
||||||
* @param typeArg
|
|
||||||
* @param valueArg
|
|
||||||
*/
|
|
||||||
public updateRecord(domainNameArg: string, typeArg: string, valueArg) {
|
|
||||||
// TODO: implement
|
|
||||||
const done = plugins.smartpromise.defer();
|
|
||||||
const domain = new plugins.smartstring.Domain(domainNameArg);
|
|
||||||
return done.promise;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* list all records of a specified domain name
|
|
||||||
* @param domainNameArg - the domain name that you want to get the records from
|
|
||||||
*/
|
|
||||||
public async listRecords(domainNameArg: string): Promise<interfaces.ICflareRecord[]> {
|
|
||||||
const domain = new plugins.smartstring.Domain(domainNameArg);
|
|
||||||
const domainId = await this.getZoneId(domain.zoneName);
|
|
||||||
const responseArg: any = await this.request(
|
|
||||||
'GET',
|
|
||||||
'/zones/' + domainId + '/dns_records?per_page=100'
|
|
||||||
);
|
|
||||||
const result: interfaces.ICflareRecord[] = responseArg.result;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* list all zones in the associated authenticated account
|
|
||||||
* @param domainName
|
|
||||||
*/
|
|
||||||
public async listZones(domainName?: string): Promise<interfaces.ICflareZone[]> {
|
|
||||||
// TODO: handle pagination
|
|
||||||
let requestRoute = `/zones?per_page=50`;
|
|
||||||
|
|
||||||
// may be optionally filtered by domain name
|
|
||||||
if (domainName) {
|
|
||||||
requestRoute = `${requestRoute}&name=${domainName}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
const response: any = await this.request('GET', requestRoute);
|
|
||||||
const result = response.result;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public async purgeZone(domainName: string) {
|
|
||||||
const domain = new plugins.smartstring.Domain(domainName);
|
|
||||||
const domainId = await this.getZoneId(domain.zoneName);
|
|
||||||
const requestUrl = `/zones/${domainId}/purge_cache`;
|
|
||||||
const payload = {
|
|
||||||
purge_everything: true
|
|
||||||
};
|
|
||||||
const respone = await this.request('DELETE', requestUrl, payload);
|
|
||||||
}
|
|
||||||
|
|
||||||
public request(
|
|
||||||
methodArg: string,
|
methodArg: string,
|
||||||
routeArg: string,
|
routeArg: string,
|
||||||
dataArg: any = {},
|
dataArg: any = {},
|
||||||
requestHeadersArg = {}
|
requestHeadersArg = {}
|
||||||
): Promise<any> {
|
): Promise<any> {
|
||||||
const done = plugins.smartpromise.defer();
|
|
||||||
const options: plugins.smartrequest.ISmartRequestOptions = {
|
const options: plugins.smartrequest.ISmartRequestOptions = {
|
||||||
method: methodArg,
|
method: methodArg,
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'X-Auth-Email': this.authEmail,
|
Authorization: `Bearer ${this.authToken}`,
|
||||||
'X-Auth-Key': this.authKey,
|
|
||||||
'Content-Length': Buffer.byteLength(JSON.stringify(dataArg)),
|
'Content-Length': Buffer.byteLength(JSON.stringify(dataArg)),
|
||||||
...requestHeadersArg
|
...requestHeadersArg,
|
||||||
},
|
},
|
||||||
requestBody: dataArg
|
requestBody: dataArg,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// route analysis
|
||||||
|
const routeWithoutQuery = routeArg.split('?')[0];
|
||||||
|
let queryParams: string[] = [];
|
||||||
|
if (routeArg.split('?').length > 1) {
|
||||||
|
queryParams = routeArg.split('?')[1].split('&');
|
||||||
|
}
|
||||||
|
|
||||||
// console.log(options);
|
// console.log(options);
|
||||||
|
|
||||||
let retryCount = 0; // count the amount of retries
|
let retryCount = 0; // count the amount of retries
|
||||||
|
let pageCount = 1;
|
||||||
|
|
||||||
const makeRequest = async () => {
|
const getQueryParams = () => {
|
||||||
const response: any = await plugins.smartrequest.request(
|
let result = '';
|
||||||
`https://api.cloudflare.com/client/v4${routeArg}`,
|
if (queryParams.length > 0) {
|
||||||
options
|
result += '?';
|
||||||
);
|
} else {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
let isFirst = true;
|
||||||
|
for (const queryParam of queryParams) {
|
||||||
|
if (!isFirst) {
|
||||||
|
result += '&';
|
||||||
|
}
|
||||||
|
isFirst = false;
|
||||||
|
const queryParamSerialized = queryParam.split('=');
|
||||||
|
if (queryParam === 'page') {
|
||||||
|
result += `page=${pageCount}`;
|
||||||
|
} else {
|
||||||
|
result += queryParam;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
|
||||||
|
const makeRequest = async (): Promise<plugins.smartrequest.IExtendedIncomingMessage> => {
|
||||||
|
const requestUrl = `https://api.cloudflare.com/client/v4${routeWithoutQuery}${getQueryParams()}`;
|
||||||
|
const response = await plugins.smartrequest.request(requestUrl, options);
|
||||||
if (response.statusCode === 200) {
|
if (response.statusCode === 200) {
|
||||||
done.resolve(response.body);
|
if (response.body.result_info) {
|
||||||
|
const rI = response.body.result_info;
|
||||||
|
if (rI.total_count / rI.per_page > pageCount) {
|
||||||
|
pageCount++;
|
||||||
|
const subresponse = await makeRequest();
|
||||||
|
response.body.result = response.body.result.concat(subresponse.body.result);
|
||||||
|
return response;
|
||||||
|
} else {
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return response;
|
||||||
|
}
|
||||||
} else if (response.statusCode === 429) {
|
} else if (response.statusCode === 429) {
|
||||||
console.log('rate limited! Waiting for retry!');
|
console.log('rate limited! Waiting for retry!');
|
||||||
retryRequest();
|
return await retryRequest();
|
||||||
} else if (response.statusCode === 400) {
|
} else if (response.statusCode === 400) {
|
||||||
console.log(`bad request for route ${routeArg}! Going to retry!`);
|
console.log(`bad request for route ${requestUrl}!`);
|
||||||
console.log(response.body);
|
console.log(response.body);
|
||||||
|
throw new Error(`request failed for ${requestUrl}`);
|
||||||
} else {
|
} else {
|
||||||
console.log(response.statusCode);
|
console.log(response.body);
|
||||||
done.reject(new Error('request failed'));
|
throw new Error(`request failed for ${requestUrl} with status${response.statusCode}}`);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const retryRequest = async (
|
const retryRequest = async (
|
||||||
delayTimeArg = Math.floor(Math.random() * (60000 - 8000) + 8000)
|
delayTimeArg = Math.floor(Math.random() * (60000 - 8000) + 8000)
|
||||||
) => {
|
) => {
|
||||||
@ -216,13 +275,11 @@ export class CloudflareAccount {
|
|||||||
return await makeRequest();
|
return await makeRequest();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
makeRequest();
|
const response = await makeRequest();
|
||||||
return done.promise;
|
return response.body;
|
||||||
}
|
}
|
||||||
|
|
||||||
private authCheck() {
|
private authCheck() {
|
||||||
return this.authEmail && this.authKey; // check if auth is available
|
return !!this.authToken; // check if auth is available
|
||||||
}
|
}
|
||||||
|
|
||||||
// acme convenience functions
|
|
||||||
}
|
}
|
||||||
|
3
ts/cloudflare.classes.record.ts
Normal file
3
ts/cloudflare.classes.record.ts
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
import * as plugins from './cloudflare.plugins';
|
||||||
|
|
||||||
|
export class CloudflareRecord {}
|
@ -1,6 +1,7 @@
|
|||||||
import * as plugins from './cloudflare.plugins';
|
import * as plugins from './cloudflare.plugins';
|
||||||
import * as interfaces from './interfaces';
|
import * as interfaces from './interfaces';
|
||||||
import { WorkerManager } from './cloudflare.classes.workermanager';
|
import { WorkerManager } from './cloudflare.classes.workermanager';
|
||||||
|
import { logger } from './cloudflare.logger';
|
||||||
|
|
||||||
export interface IWorkerRoute extends interfaces.ICflareWorkerRoute {
|
export interface IWorkerRoute extends interfaces.ICflareWorkerRoute {
|
||||||
zoneName: string;
|
zoneName: string;
|
||||||
@ -13,7 +14,7 @@ export class CloudflareWorker {
|
|||||||
apiObject
|
apiObject
|
||||||
): Promise<CloudflareWorker> {
|
): Promise<CloudflareWorker> {
|
||||||
const newWorker = new CloudflareWorker(workerManager);
|
const newWorker = new CloudflareWorker(workerManager);
|
||||||
Object.assign(newWorker, apiObject.result);
|
Object.assign(newWorker, apiObject);
|
||||||
await newWorker.getRoutes();
|
await newWorker.getRoutes();
|
||||||
return newWorker;
|
return newWorker;
|
||||||
}
|
}
|
||||||
@ -38,7 +39,7 @@ export class CloudflareWorker {
|
|||||||
* gets all routes for a worker
|
* gets all routes for a worker
|
||||||
*/
|
*/
|
||||||
public async getRoutes() {
|
public async getRoutes() {
|
||||||
const zones = await this.workerManager.cfAccount.listZones();
|
const zones = await this.workerManager.cfAccount.convenience.listZones();
|
||||||
for (const zone of zones) {
|
for (const zone of zones) {
|
||||||
const requestRoute = `/zones/${zone.id}/workers/routes`;
|
const requestRoute = `/zones/${zone.id}/workers/routes`;
|
||||||
const response: {
|
const response: {
|
||||||
@ -66,25 +67,25 @@ export class CloudflareWorker {
|
|||||||
routeIdForUpdate = existingRoute.id;
|
routeIdForUpdate = existingRoute.id;
|
||||||
if (existingRoute.script === this.id) {
|
if (existingRoute.script === this.id) {
|
||||||
routeStatus = 'alreadyUpToDate';
|
routeStatus = 'alreadyUpToDate';
|
||||||
plugins.smartlog.defaultLogger.log('info', `route already exists, no update needed`);
|
logger.log('info', `route already exists, no update needed`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// lets care about actually setting routes
|
// lets care about actually setting routes
|
||||||
if (routeStatus === 'new') {
|
if (routeStatus === 'new') {
|
||||||
const zoneId = await this.workerManager.cfAccount.getZoneId(newRoute.zoneName);
|
const zoneId = await this.workerManager.cfAccount.convenience.getZoneId(newRoute.zoneName);
|
||||||
const requestRoute = `/zones/${zoneId}/workers/routes`;
|
const requestRoute = `/zones/${zoneId}/workers/routes`;
|
||||||
await this.workerManager.cfAccount.request('POST', requestRoute, {
|
await this.workerManager.cfAccount.request('POST', requestRoute, {
|
||||||
pattern: newRoute.pattern,
|
pattern: newRoute.pattern,
|
||||||
script: this.id
|
script: this.id,
|
||||||
});
|
});
|
||||||
} else if (routeStatus === 'needsUpdate') {
|
} else if (routeStatus === 'needsUpdate') {
|
||||||
const zoneId = await this.workerManager.cfAccount.getZoneId(newRoute.zoneName);
|
const zoneId = await this.workerManager.cfAccount.convenience.getZoneId(newRoute.zoneName);
|
||||||
const requestRoute = `/zones/${zoneId}/workers/routes/${routeIdForUpdate}`;
|
const requestRoute = `/zones/${zoneId}/workers/routes/${routeIdForUpdate}`;
|
||||||
await this.workerManager.cfAccount.request('PUT', requestRoute, {
|
await this.workerManager.cfAccount.request('PUT', requestRoute, {
|
||||||
pattern: newRoute.pattern,
|
pattern: newRoute.pattern,
|
||||||
script: this.id
|
script: this.id,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,9 +14,9 @@ export class WorkerManager {
|
|||||||
const route = `/accounts/${accountIdentifier}/workers/scripts/${workerName}`;
|
const route = `/accounts/${accountIdentifier}/workers/scripts/${workerName}`;
|
||||||
const responseBody = await this.cfAccount.request('PUT', route, workerScript, {
|
const responseBody = await this.cfAccount.request('PUT', route, workerScript, {
|
||||||
'Content-Type': 'application/javascript',
|
'Content-Type': 'application/javascript',
|
||||||
'Content-Length': Buffer.byteLength(workerScript)
|
'Content-Length': Buffer.byteLength(workerScript),
|
||||||
});
|
});
|
||||||
return CloudflareWorker.fromApiObject(this, responseBody);
|
return CloudflareWorker.fromApiObject(this, responseBody.result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,6 +1,50 @@
|
|||||||
import * as plugins from './cloudflare.plugins';
|
import * as plugins from './cloudflare.plugins';
|
||||||
import * as interfaces from './interfaces';
|
import * as interfaces from './interfaces';
|
||||||
|
|
||||||
export class CloudflareZone {
|
export class CloudflareZone implements interfaces.ICflareZone {
|
||||||
// TODO
|
public static createFromApiObject(apiObject: interfaces.ICflareZone) {
|
||||||
|
const cloudflareZone = new CloudflareZone();
|
||||||
|
Object.assign(cloudflareZone, apiObject);
|
||||||
|
return cloudflareZone;
|
||||||
|
}
|
||||||
|
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
development_mode: number;
|
||||||
|
original_name_servers: string[];
|
||||||
|
original_registrar: string;
|
||||||
|
original_dnshost: string;
|
||||||
|
created_on: string;
|
||||||
|
modified_on: string;
|
||||||
|
name_servers: string[];
|
||||||
|
owner: {
|
||||||
|
id: string;
|
||||||
|
email: string;
|
||||||
|
owner_type: string;
|
||||||
|
};
|
||||||
|
permissions: string[];
|
||||||
|
plan: {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
price: number;
|
||||||
|
currency: string;
|
||||||
|
frequency: string;
|
||||||
|
legacy_id: string;
|
||||||
|
is_subscribed: boolean;
|
||||||
|
can_subscribe: boolean;
|
||||||
|
};
|
||||||
|
plan_pending: {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
price: number;
|
||||||
|
currency: string;
|
||||||
|
frequency: string;
|
||||||
|
legacy_id: string;
|
||||||
|
is_subscribed: string;
|
||||||
|
can_subscribe: string;
|
||||||
|
};
|
||||||
|
status: string;
|
||||||
|
paused: boolean;
|
||||||
|
type: string;
|
||||||
|
checked_on: string;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
import * as plugins from './cloudflare.plugins';
|
import * as plugins from './cloudflare.plugins';
|
||||||
|
import * as interfaces from './interfaces';
|
||||||
import { CloudflareAccount } from './cloudflare.classes.account';
|
import { CloudflareAccount } from './cloudflare.classes.account';
|
||||||
|
import { CloudflareZone } from './cloudflare.classes.zone';
|
||||||
|
|
||||||
export class ZoneManager {
|
export class ZoneManager {
|
||||||
public cfAccount: CloudflareAccount;
|
public cfAccount: CloudflareAccount;
|
||||||
@ -8,4 +10,23 @@ export class ZoneManager {
|
|||||||
constructor(cfAccountArg: CloudflareAccount) {
|
constructor(cfAccountArg: CloudflareAccount) {
|
||||||
this.cfAccount = cfAccountArg;
|
this.cfAccount = cfAccountArg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async getZones(zoneName: string) {
|
||||||
|
let requestRoute = `/zones?per_page=50`;
|
||||||
|
// may be optionally filtered by domain name
|
||||||
|
|
||||||
|
if (zoneName) {
|
||||||
|
requestRoute = `${requestRoute}&name=${zoneName}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
const response: any = await this.cfAccount.request('GET', requestRoute);
|
||||||
|
const apiObjects: interfaces.ICflareZone[] = response.result;
|
||||||
|
|
||||||
|
const cloudflareZoneArray = [];
|
||||||
|
for (const apiObject of apiObjects) {
|
||||||
|
cloudflareZoneArray.push(CloudflareZone.createFromApiObject(apiObject));
|
||||||
|
}
|
||||||
|
|
||||||
|
return cloudflareZoneArray;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
3
ts/cloudflare.logger.ts
Normal file
3
ts/cloudflare.logger.ts
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
import * as plugins from './cloudflare.plugins';
|
||||||
|
|
||||||
|
export const logger = new plugins.smartlog.ConsoleLog();
|
Reference in New Issue
Block a user