Compare commits
40 Commits
Author | SHA1 | Date | |
---|---|---|---|
1d2e0974b2 | |||
801f86fede | |||
42feb09b4f | |||
d72bb28cf9 | |||
b9f0b798c9 | |||
9b5f42ef9b | |||
4e3355dc43 | |||
fc0a27f5b6 | |||
0248d52548 | |||
c3984819cc | |||
045b87a4a2 | |||
48ca9fdbb9 | |||
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 |
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
|
126
.gitlab-ci.yml
126
.gitlab-ci.yml
@ -1,126 +0,0 @@
|
|||||||
# gitzone ci_default
|
|
||||||
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
|
||||||
|
|
||||||
cache:
|
|
||||||
paths:
|
|
||||||
- .npmci_cache/
|
|
||||||
key: '$CI_BUILD_STAGE'
|
|
||||||
|
|
||||||
stages:
|
|
||||||
- security
|
|
||||||
- test
|
|
||||||
- release
|
|
||||||
- metadata
|
|
||||||
|
|
||||||
# ====================
|
|
||||||
# security stage
|
|
||||||
# ====================
|
|
||||||
mirror:
|
|
||||||
stage: security
|
|
||||||
script:
|
|
||||||
- npmci git mirror
|
|
||||||
tags:
|
|
||||||
- lossless
|
|
||||||
- docker
|
|
||||||
- notpriv
|
|
||||||
|
|
||||||
snyk:
|
|
||||||
image: registry.gitlab.com/hosttoday/ht-docker-node:snyk
|
|
||||||
stage: security
|
|
||||||
script:
|
|
||||||
- npmci npm prepare
|
|
||||||
- npmci command npm install --ignore-scripts
|
|
||||||
- npmci command snyk test
|
|
||||||
tags:
|
|
||||||
- lossless
|
|
||||||
- docker
|
|
||||||
- notpriv
|
|
||||||
|
|
||||||
# ====================
|
|
||||||
# test stage
|
|
||||||
# ====================
|
|
||||||
|
|
||||||
testStable:
|
|
||||||
stage: test
|
|
||||||
script:
|
|
||||||
- npmci npm prepare
|
|
||||||
- npmci node install stable
|
|
||||||
- npmci npm install
|
|
||||||
- npmci npm test
|
|
||||||
coverage: /\d+.?\d+?\%\s*coverage/
|
|
||||||
tags:
|
|
||||||
- lossless
|
|
||||||
- docker
|
|
||||||
- priv
|
|
||||||
|
|
||||||
testBuild:
|
|
||||||
stage: test
|
|
||||||
script:
|
|
||||||
- npmci npm prepare
|
|
||||||
- npmci node install stable
|
|
||||||
- npmci npm install
|
|
||||||
- npmci command npm run build
|
|
||||||
coverage: /\d+.?\d+?\%\s*coverage/
|
|
||||||
tags:
|
|
||||||
- lossless
|
|
||||||
- docker
|
|
||||||
- notpriv
|
|
||||||
|
|
||||||
release:
|
|
||||||
stage: release
|
|
||||||
script:
|
|
||||||
- npmci node install stable
|
|
||||||
- npmci npm publish
|
|
||||||
only:
|
|
||||||
- tags
|
|
||||||
tags:
|
|
||||||
- lossless
|
|
||||||
- docker
|
|
||||||
- notpriv
|
|
||||||
|
|
||||||
# ====================
|
|
||||||
# metadata stage
|
|
||||||
# ====================
|
|
||||||
codequality:
|
|
||||||
stage: metadata
|
|
||||||
allow_failure: true
|
|
||||||
script:
|
|
||||||
- npmci command npm install -g tslint typescript
|
|
||||||
- npmci npm prepare
|
|
||||||
- npmci npm install
|
|
||||||
- npmci command "tslint -c tslint.json ./ts/**/*.ts"
|
|
||||||
tags:
|
|
||||||
- lossless
|
|
||||||
- docker
|
|
||||||
- priv
|
|
||||||
|
|
||||||
trigger:
|
|
||||||
stage: metadata
|
|
||||||
script:
|
|
||||||
- npmci trigger
|
|
||||||
only:
|
|
||||||
- tags
|
|
||||||
tags:
|
|
||||||
- lossless
|
|
||||||
- docker
|
|
||||||
- notpriv
|
|
||||||
|
|
||||||
pages:
|
|
||||||
stage: metadata
|
|
||||||
script:
|
|
||||||
- npmci node install lts
|
|
||||||
- npmci command npm install -g @gitzone/tsdoc
|
|
||||||
- npmci npm prepare
|
|
||||||
- npmci npm install
|
|
||||||
- npmci command tsdoc
|
|
||||||
tags:
|
|
||||||
- lossless
|
|
||||||
- docker
|
|
||||||
- notpriv
|
|
||||||
only:
|
|
||||||
- tags
|
|
||||||
artifacts:
|
|
||||||
expire_in: 1 week
|
|
||||||
paths:
|
|
||||||
- public
|
|
||||||
allow_failure: true
|
|
24
.vscode/launch.json
vendored
24
.vscode/launch.json
vendored
@ -2,28 +2,10 @@
|
|||||||
"version": "0.2.0",
|
"version": "0.2.0",
|
||||||
"configurations": [
|
"configurations": [
|
||||||
{
|
{
|
||||||
"name": "current file",
|
"command": "npm test",
|
||||||
"type": "node",
|
"name": "Run npm test",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"args": [
|
"type": "node-terminal"
|
||||||
"${relativeFile}"
|
|
||||||
],
|
|
||||||
"runtimeArgs": ["-r", "@gitzone/tsrun"],
|
|
||||||
"cwd": "${workspaceRoot}",
|
|
||||||
"protocol": "inspector",
|
|
||||||
"internalConsoleOptions": "openOnSessionStart"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "test.ts",
|
|
||||||
"type": "node",
|
|
||||||
"request": "launch",
|
|
||||||
"args": [
|
|
||||||
"test/test.ts"
|
|
||||||
],
|
|
||||||
"runtimeArgs": ["-r", "@gitzone/tsrun"],
|
|
||||||
"cwd": "${workspaceRoot}",
|
|
||||||
"protocol": "inspector",
|
|
||||||
"internalConsoleOptions": "openOnSessionStart"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
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"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,8 +9,8 @@
|
|||||||
"githost": "gitlab.com",
|
"githost": "gitlab.com",
|
||||||
"gitscope": "mojoio",
|
"gitscope": "mojoio",
|
||||||
"gitrepo": "cloudflare",
|
"gitrepo": "cloudflare",
|
||||||
"shortDescription": "easy cloudflare management",
|
"description": "easy cloudflare management",
|
||||||
"npmPackagename": "@mojoio/cloudflare",
|
"npmPackagename": "@apiclient.xyz/cloudflare",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
1695
package-lock.json
generated
1695
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
46
package.json
46
package.json
@ -1,13 +1,16 @@
|
|||||||
{
|
{
|
||||||
"name": "@mojoio/cloudflare",
|
"name": "@apiclient.xyz/cloudflare",
|
||||||
"version": "4.0.1",
|
"version": "6.0.4",
|
||||||
"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",
|
||||||
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "(tstest test/)",
|
"test": "(tstest test/)",
|
||||||
"build": "(tsbuild)"
|
"build": "(tsbuild --web --allowimplicitany)",
|
||||||
|
"buildDocs": "tsdoc",
|
||||||
|
"updateOpenapi": "openapi-typescript https://raw.githubusercontent.com/cloudflare/api-schemas/main/openapi.yaml --output ts/openapi.spec.ts"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@ -24,32 +27,35 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://gitlab.com/pushrocks/cflare#readme",
|
"homepage": "https://gitlab.com/pushrocks/cflare#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@pushrocks/smartdelay": "^2.0.6",
|
"@push.rocks/smartdelay": "^3.0.1",
|
||||||
"@pushrocks/smartlog": "^2.0.21",
|
"@push.rocks/smartlog": "^3.0.2",
|
||||||
"@pushrocks/smartpromise": "^3.0.6",
|
"@push.rocks/smartpromise": "^4.0.2",
|
||||||
"@pushrocks/smartrequest": "^1.1.47",
|
"@push.rocks/smartrequest": "^2.0.15",
|
||||||
"@pushrocks/smartstring": "^3.0.18",
|
"@push.rocks/smartstring": "^4.0.5",
|
||||||
"@tsclass/tsclass": "^3.0.4"
|
"@tsclass/tsclass": "^4.0.42"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@gitzone/tsbuild": "^2.1.17",
|
"@git.zone/tsbuild": "^2.1.66",
|
||||||
"@gitzone/tsrun": "^1.2.8",
|
"@git.zone/tsrun": "^1.2.42",
|
||||||
"@gitzone/tstest": "^1.0.28",
|
"@git.zone/tstest": "^1.0.74",
|
||||||
"@pushrocks/qenv": "^4.0.6",
|
"@push.rocks/qenv": "^6.0.5",
|
||||||
"@pushrocks/tapbundle": "^3.2.0",
|
"@push.rocks/tapbundle": "^5.0.4",
|
||||||
"@types/node": "^13.7.0",
|
"@types/node": "^20.3.1",
|
||||||
"tslint": "^6.0.0",
|
"openapi-typescript": "^6.7.6"
|
||||||
"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"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
6795
pnpm-lock.yaml
generated
Normal file
6795
pnpm-lock.yaml
generated
Normal file
File diff suppressed because it is too large
Load Diff
33
readme.md
33
readme.md
@ -1,33 +1,36 @@
|
|||||||
# @mojoio/cloudflare
|
# @apiclient.xyz/cloudflare
|
||||||
easy cloudflare management
|
easy cloudflare management
|
||||||
|
|
||||||
## Availabililty and Links
|
## Availabililty and Links
|
||||||
* [npmjs.org (npm package)](https://www.npmjs.com/package/@mojoio/cloudflare)
|
* [npmjs.org (npm package)](https://www.npmjs.com/package/@apiclient.xyz/cloudflare)
|
||||||
* [gitlab.com (source)](https://gitlab.com/mojoio/cloudflare)
|
* [gitlab.com (source)](https://gitlab.com/mojoio/cloudflare)
|
||||||
* [github.com (source mirror)](https://github.com/mojoio/cloudflare)
|
* [github.com (source mirror)](https://github.com/mojoio/cloudflare)
|
||||||
* [docs (typedoc)](https://mojoio.gitlab.io/cloudflare/)
|
* [docs (typedoc)](https://mojoio.gitlab.io/cloudflare/)
|
||||||
|
|
||||||
## Status for master
|
## Status for master
|
||||||
[](https://gitlab.com/mojoio/cloudflare/commits/master)
|
|
||||||
[](https://gitlab.com/mojoio/cloudflare/commits/master)
|
Status Category | Status Badge
|
||||||
[](https://www.npmjs.com/package/@mojoio/cloudflare)
|
-- | --
|
||||||
[](https://snyk.io/test/npm/@mojoio/cloudflare)
|
GitLab Pipelines | [](https://lossless.cloud)
|
||||||
[](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
GitLab Pipline Test Coverage | [](https://lossless.cloud)
|
||||||
[](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
npm | [](https://lossless.cloud)
|
||||||
[](https://prettier.io/)
|
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
|
## Usage
|
||||||
|
|
||||||
Use TypeScript for best in class instellisense.
|
Use TypeScript for best in class instellisense.
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
import * as cflare from '@mojoio/cloudflare';
|
import * as cflare from '@apiclient.xyz/cloudflare';
|
||||||
|
|
||||||
const myCflareAccount = new cflare.CflareAccount();
|
const myCflareAccount = new cflare.CflareAccount('mySuperAwesomeAccountToken');
|
||||||
testCflareAccount.auth({
|
|
||||||
email: 'someuser@example.com',
|
|
||||||
key: 'someLongApiKey'
|
|
||||||
});
|
|
||||||
|
|
||||||
const myAsyncCflareManagement = async () => {
|
const myAsyncCflareManagement = async () => {
|
||||||
// get things
|
// get things
|
||||||
|
38
test/test.ts
38
test/test.ts
@ -1,9 +1,9 @@
|
|||||||
// tslint:disable-next-line: no-implicit-dependencies
|
// tslint:disable-next-line: no-implicit-dependencies
|
||||||
import { expect, tap } from '@pushrocks/tapbundle';
|
import { expect, tap } from '@push.rocks/tapbundle';
|
||||||
// tslint:disable-next-line: no-implicit-dependencies
|
// tslint:disable-next-line: no-implicit-dependencies
|
||||||
import { Qenv } from '@pushrocks/qenv';
|
import { Qenv } from '@push.rocks/qenv';
|
||||||
|
|
||||||
import cloudflare = require('../ts/index');
|
import * as cloudflare from '../ts/index.js';
|
||||||
|
|
||||||
const testQenv = new Qenv(process.cwd(), process.cwd() + '/.nogit');
|
const testQenv = new Qenv(process.cwd(), process.cwd() + '/.nogit');
|
||||||
|
|
||||||
@ -11,13 +11,10 @@ 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(await 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.convenience.listZones();
|
const result = await testCloudflareAccount.convenience.listZones();
|
||||||
console.log(result);
|
console.log(result);
|
||||||
@ -25,45 +22,46 @@ tap.test('.listZones() -> should display an entire account', async tools => {
|
|||||||
|
|
||||||
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.convenience.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.convenience.createRecord(
|
await testCloudflareAccount.convenience.createRecord(
|
||||||
`${randomPrefix}subdomain.bleu.de`,
|
`${randomPrefix}subdomain.bleu.de`,
|
||||||
'A',
|
'A',
|
||||||
'127.0.0.1'
|
'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.convenience
|
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.convenience
|
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);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -81,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);
|
||||||
});
|
});
|
||||||
|
8
ts/00_commitinfo_data.ts
Normal file
8
ts/00_commitinfo_data.ts
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
/**
|
||||||
|
* autocreated commitinfo by @pushrocks/commitinfo
|
||||||
|
*/
|
||||||
|
export const commitinfo = {
|
||||||
|
name: '@apiclient.xyz/cloudflare',
|
||||||
|
version: '6.0.4',
|
||||||
|
description: 'easy cloudflare management'
|
||||||
|
}
|
@ -1,13 +1,13 @@
|
|||||||
import plugins = require('./cloudflare.plugins');
|
import * as plugins from './cloudflare.plugins.js';
|
||||||
import * as interfaces from './interfaces';
|
import { logger } from './cloudflare.logger.js';
|
||||||
|
import * as interfaces from './interfaces/index.js';
|
||||||
|
|
||||||
// interfaces
|
// interfaces
|
||||||
import { WorkerManager } from './cloudflare.classes.workermanager';
|
import { WorkerManager } from './cloudflare.classes.workermanager.js';
|
||||||
import { ZoneManager } from './cloudflare.classes.zonemanager';
|
import { ZoneManager } from './cloudflare.classes.zonemanager.js';
|
||||||
|
|
||||||
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,9 +17,8 @@ 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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -34,28 +33,24 @@ export class CloudflareAccount {
|
|||||||
return this.accountIdentifier;
|
return this.accountIdentifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public convenience = {
|
||||||
/**
|
/**
|
||||||
* gets a zone id of a domain from cloudflare
|
* gets a zone id of a domain from cloudflare
|
||||||
* @param domainName
|
* @param domainName
|
||||||
*/
|
*/
|
||||||
public async getZoneId(domainName: string) {
|
getZoneId: async (domainName: string) => {
|
||||||
const domain = new plugins.smartstring.Domain(domainName);
|
const domain = new plugins.smartstring.Domain(domainName);
|
||||||
const zoneArray = await this.convenience.listZones(domain.zoneName);
|
const zoneArray = await this.convenience.listZones(domain.zoneName);
|
||||||
const filteredResponse = zoneArray.filter(zoneArg => {
|
const filteredResponse = zoneArray.filter((zoneArg) => {
|
||||||
return zoneArg.name === domainName;
|
return zoneArg.name === domainName;
|
||||||
});
|
});
|
||||||
if (filteredResponse.length >= 1) {
|
if (filteredResponse.length >= 1) {
|
||||||
return filteredResponse[0].id;
|
return filteredResponse[0].id;
|
||||||
} else {
|
} else {
|
||||||
plugins.smartlog.defaultLogger.log(
|
logger.log('error', `the domain ${domainName} does not appear to be in this account!`);
|
||||||
'error',
|
|
||||||
`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!`);
|
throw new Error(`the domain ${domainName} does not appear to be in this account!`);
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
|
||||||
public convenience = {
|
|
||||||
/**
|
/**
|
||||||
* gets a record
|
* gets a record
|
||||||
* @param domainNameArg
|
* @param domainNameArg
|
||||||
@ -63,11 +58,11 @@ export class CloudflareAccount {
|
|||||||
*/
|
*/
|
||||||
getRecord: async (
|
getRecord: async (
|
||||||
domainNameArg: string,
|
domainNameArg: string,
|
||||||
typeArg: plugins.tsclass.network.TDnsRecord
|
typeArg: plugins.tsclass.network.TDnsRecordType
|
||||||
): Promise<interfaces.ICflareRecord> => {
|
): Promise<interfaces.ICflareRecord> => {
|
||||||
const domain = new plugins.smartstring.Domain(domainNameArg);
|
const domain = new plugins.smartstring.Domain(domainNameArg);
|
||||||
const recordArrayArg = await this.convenience.listRecords(domain.zoneName);
|
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 recordArg.type === typeArg && recordArg.name === domainNameArg;
|
||||||
});
|
});
|
||||||
return filteredResponse[0];
|
return filteredResponse[0];
|
||||||
@ -77,15 +72,17 @@ export class CloudflareAccount {
|
|||||||
*/
|
*/
|
||||||
createRecord: async (
|
createRecord: async (
|
||||||
domainNameArg: string,
|
domainNameArg: string,
|
||||||
typeArg: plugins.tsclass.network.TDnsRecord,
|
typeArg: plugins.tsclass.network.TDnsRecordType,
|
||||||
contentArg: string
|
contentArg: string,
|
||||||
|
ttlArg = 1
|
||||||
): Promise<any> => {
|
): Promise<any> => {
|
||||||
const domain = new plugins.smartstring.Domain(domainNameArg);
|
const domain = new plugins.smartstring.Domain(domainNameArg);
|
||||||
const domainIdArg = await this.getZoneId(domain.zoneName);
|
const domainIdArg = await this.convenience.getZoneId(domain.zoneName);
|
||||||
const dataObject = {
|
const dataObject = {
|
||||||
name: domain.fullName,
|
name: domain.fullName,
|
||||||
type: typeArg,
|
type: typeArg,
|
||||||
content: contentArg
|
content: contentArg,
|
||||||
|
ttl: ttlArg,
|
||||||
};
|
};
|
||||||
const response = await this.request(
|
const response = await this.request(
|
||||||
'POST',
|
'POST',
|
||||||
@ -101,7 +98,7 @@ export class CloudflareAccount {
|
|||||||
*/
|
*/
|
||||||
removeRecord: async (
|
removeRecord: async (
|
||||||
domainNameArg: string,
|
domainNameArg: string,
|
||||||
typeArg: plugins.tsclass.network.TDnsRecord
|
typeArg: plugins.tsclass.network.TDnsRecordType
|
||||||
): Promise<any> => {
|
): Promise<any> => {
|
||||||
const domain = new plugins.smartstring.Domain(domainNameArg);
|
const domain = new plugins.smartstring.Domain(domainNameArg);
|
||||||
const cflareRecord = await this.convenience.getRecord(domain.fullName, typeArg);
|
const cflareRecord = await this.convenience.getRecord(domain.fullName, typeArg);
|
||||||
@ -115,13 +112,20 @@ export class CloudflareAccount {
|
|||||||
/**
|
/**
|
||||||
* cleanrecord allows the cleaning of any previous records to avoid unwanted sideeffects
|
* 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
|
* updates a record
|
||||||
* @param domainNameArg
|
* @param domainNameArg
|
||||||
* @param typeArg
|
* @param typeArg
|
||||||
* @param valueArg
|
* @param valueArg
|
||||||
*/
|
*/
|
||||||
updateRecord: async (domainNameArg: string, typeArg: string, valueArg) => {
|
updateRecord: async (
|
||||||
|
domainNameArg: string,
|
||||||
|
typeArg: plugins.tsclass.network.TDnsRecordType,
|
||||||
|
valueArg
|
||||||
|
) => {
|
||||||
// TODO: implement
|
// TODO: implement
|
||||||
const domain = new plugins.smartstring.Domain(domainNameArg);
|
const domain = new plugins.smartstring.Domain(domainNameArg);
|
||||||
},
|
},
|
||||||
@ -131,7 +135,7 @@ export class CloudflareAccount {
|
|||||||
*/
|
*/
|
||||||
listRecords: async (domainNameArg: string): Promise<interfaces.ICflareRecord[]> => {
|
listRecords: async (domainNameArg: string): Promise<interfaces.ICflareRecord[]> => {
|
||||||
const domain = new plugins.smartstring.Domain(domainNameArg);
|
const domain = new plugins.smartstring.Domain(domainNameArg);
|
||||||
const domainId = await this.getZoneId(domain.zoneName);
|
const domainId = await this.convenience.getZoneId(domain.zoneName);
|
||||||
const responseArg: any = await this.request(
|
const responseArg: any = await this.request(
|
||||||
'GET',
|
'GET',
|
||||||
'/zones/' + domainId + '/dns_records?per_page=100'
|
'/zones/' + domainId + '/dns_records?per_page=100'
|
||||||
@ -161,64 +165,111 @@ export class CloudflareAccount {
|
|||||||
*/
|
*/
|
||||||
purgeZone: async (domainName: string): Promise<void> => {
|
purgeZone: async (domainName: string): Promise<void> => {
|
||||||
const domain = new plugins.smartstring.Domain(domainName);
|
const domain = new plugins.smartstring.Domain(domainName);
|
||||||
const domainId = await this.getZoneId(domain.zoneName);
|
const domainId = await this.convenience.getZoneId(domain.zoneName);
|
||||||
const requestUrl = `/zones/${domainId}/purge_cache`;
|
const requestUrl = `/zones/${domainId}/purge_cache`;
|
||||||
const payload = {
|
const payload = {
|
||||||
purge_everything: true
|
purge_everything: true,
|
||||||
};
|
};
|
||||||
const respone = await this.request('DELETE', requestUrl, payload);
|
const respone = await this.request('DELETE', requestUrl, payload);
|
||||||
},
|
},
|
||||||
// acme convenience functions
|
// acme convenience functions
|
||||||
acmeSetDnsChallenge: async (dnsChallenge: plugins.tsclass.network.IDnsChallenge) => {
|
acmeSetDnsChallenge: async (dnsChallenge: plugins.tsclass.network.IDnsChallenge) => {
|
||||||
await this.convenience.removeRecord(dnsChallenge.hostName, 'TXT');
|
await this.convenience.cleanRecord(dnsChallenge.hostName, 'TXT');
|
||||||
await this.convenience.createRecord(dnsChallenge.hostName, 'TXT', dnsChallenge.challenge);
|
await this.convenience.createRecord(
|
||||||
|
dnsChallenge.hostName,
|
||||||
|
'TXT',
|
||||||
|
dnsChallenge.challenge,
|
||||||
|
120
|
||||||
|
);
|
||||||
},
|
},
|
||||||
acmeRemoveDnsChallenge: async (dnsChallenge: plugins.tsclass.network.IDnsChallenge) => {
|
acmeRemoveDnsChallenge: async (dnsChallenge: plugins.tsclass.network.IDnsChallenge) => {
|
||||||
await this.convenience.removeRecord(dnsChallenge.hostName, 'TXT');
|
await this.convenience.removeRecord(dnsChallenge.hostName, 'TXT');
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
public request(
|
public async 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)
|
||||||
) => {
|
) => {
|
||||||
@ -229,11 +280,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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,3 @@
|
|||||||
|
import * as plugins from './cloudflare.plugins.js';
|
||||||
|
|
||||||
|
export class CloudflareRecord {}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import * as plugins from './cloudflare.plugins';
|
import * as plugins from './cloudflare.plugins.js';
|
||||||
import * as interfaces from './interfaces';
|
import * as interfaces from './interfaces/index.js';
|
||||||
import { WorkerManager } from './cloudflare.classes.workermanager';
|
import { WorkerManager } from './cloudflare.classes.workermanager.js';
|
||||||
|
import { logger } from './cloudflare.logger.js';
|
||||||
|
|
||||||
export interface IWorkerRoute extends interfaces.ICflareWorkerRoute {
|
export interface IWorkerRoute extends interfaces.ICflareWorkerRoute {
|
||||||
zoneName: string;
|
zoneName: string;
|
||||||
@ -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,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import * as plugins from './cloudflare.plugins';
|
import * as plugins from './cloudflare.plugins.js';
|
||||||
import { CloudflareAccount } from './cloudflare.classes.account';
|
import { CloudflareAccount } from './cloudflare.classes.account.js';
|
||||||
import { CloudflareWorker } from './cloudflare.classes.worker';
|
import { CloudflareWorker } from './cloudflare.classes.worker.js';
|
||||||
|
|
||||||
export class WorkerManager {
|
export class WorkerManager {
|
||||||
public cfAccount: CloudflareAccount;
|
public cfAccount: CloudflareAccount;
|
||||||
@ -14,7 +14,7 @@ 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.result);
|
return CloudflareWorker.fromApiObject(this, responseBody.result);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,50 @@
|
|||||||
import * as plugins from './cloudflare.plugins';
|
import * as plugins from './cloudflare.plugins.js';
|
||||||
import * as interfaces from './interfaces';
|
import * as interfaces from './interfaces/index.js';
|
||||||
|
|
||||||
export class CloudflareZone {
|
export class CloudflareZone implements interfaces.ICflareZone {
|
||||||
public static async createFromApiObject() {}
|
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.js';
|
||||||
import { CloudflareAccount } from './cloudflare.classes.account';
|
import * as interfaces from './interfaces/index.js';
|
||||||
|
import { CloudflareAccount } from './cloudflare.classes.account.js';
|
||||||
|
import { CloudflareZone } from './cloudflare.classes.zone.js';
|
||||||
|
|
||||||
export class ZoneManager {
|
export class ZoneManager {
|
||||||
public cfAccount: CloudflareAccount;
|
public cfAccount: CloudflareAccount;
|
||||||
@ -9,5 +11,22 @@ export class ZoneManager {
|
|||||||
this.cfAccount = cfAccountArg;
|
this.cfAccount = cfAccountArg;
|
||||||
}
|
}
|
||||||
|
|
||||||
public getZones() {}
|
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.js';
|
||||||
|
|
||||||
|
export const logger = new plugins.smartlog.ConsoleLog();
|
@ -1,8 +1,8 @@
|
|||||||
import * as smartlog from '@pushrocks/smartlog';
|
import * as smartlog from '@push.rocks/smartlog';
|
||||||
import * as smartpromise from '@pushrocks/smartpromise';
|
import * as smartpromise from '@push.rocks/smartpromise';
|
||||||
import * as smartdelay from '@pushrocks/smartdelay';
|
import * as smartdelay from '@push.rocks/smartdelay';
|
||||||
import * as smartrequest from '@pushrocks/smartrequest';
|
import * as smartrequest from '@push.rocks/smartrequest';
|
||||||
import * as smartstring from '@pushrocks/smartstring';
|
import * as smartstring from '@push.rocks/smartstring';
|
||||||
import * as tsclass from '@tsclass/tsclass';
|
import * as tsclass from '@tsclass/tsclass';
|
||||||
|
|
||||||
export { smartlog, smartpromise, smartdelay, smartrequest, smartstring, tsclass };
|
export { smartlog, smartpromise, smartdelay, smartrequest, smartstring, tsclass };
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
export { CloudflareAccount } from './cloudflare.classes.account';
|
export { CloudflareAccount } from './cloudflare.classes.account.js';
|
||||||
export { CloudflareWorker } from './cloudflare.classes.worker';
|
export { CloudflareWorker } from './cloudflare.classes.worker.js';
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
export * from './cloudflare.api.record';
|
export * from './cloudflare.api.record.js';
|
||||||
export * from './cloudflare.api.zone';
|
export * from './cloudflare.api.zone.js';
|
||||||
export * from './cloudflare.api.workerroute';
|
export * from './cloudflare.api.workerroute.js';
|
||||||
|
11
tsconfig.json
Normal file
11
tsconfig.json
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"experimentalDecorators": true,
|
||||||
|
"useDefineForClassFields": false,
|
||||||
|
"target": "ES2022",
|
||||||
|
"module": "ES2022",
|
||||||
|
"moduleResolution": "nodenext",
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"verbatimModuleSyntax": true,
|
||||||
|
}
|
||||||
|
}
|
17
tslint.json
17
tslint.json
@ -1,17 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": ["tslint:latest", "tslint-config-prettier"],
|
|
||||||
"rules": {
|
|
||||||
"semicolon": [true, "always"],
|
|
||||||
"no-console": false,
|
|
||||||
"ordered-imports": false,
|
|
||||||
"object-literal-sort-keys": false,
|
|
||||||
"member-ordering": {
|
|
||||||
"options":{
|
|
||||||
"order": [
|
|
||||||
"static-method"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"defaultSeverity": "warning"
|
|
||||||
}
|
|
Reference in New Issue
Block a user