cloudflare-ddns-sync 2.0.6 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/README.md +27 -20
- package/dist/index.d.ts +3 -3
- package/dist/index.js +13 -33
- package/dist/lib/cloudflare-client.d.ts +3 -2
- package/dist/lib/cloudflare-client.js +62 -70
- package/dist/lib/cron.js +4 -11
- package/dist/lib/ip-utils.d.ts +1 -1
- package/dist/lib/ip-utils.js +8 -44
- package/dist/types/Auth.d.ts +2 -0
- package/dist/types/Auth.js +1 -0
- package/dist/{contracts → types}/Callbacks.d.ts +1 -1
- package/dist/types/Callbacks.js +1 -0
- package/dist/{contracts → types}/DomainRecordList.d.ts +1 -1
- package/dist/types/DomainRecordList.js +1 -0
- package/dist/types/Record.d.ts +10 -0
- package/dist/types/Record.js +1 -0
- package/dist/types/ZoneMap.js +1 -0
- package/dist/{contracts → types}/cloudflare/RecordData.d.ts +2 -1
- package/dist/types/cloudflare/RecordData.js +1 -0
- package/dist/types/cloudflare/ZoneData.js +1 -0
- package/dist/types/cloudflare/index.d.ts +2 -0
- package/dist/types/cloudflare/index.js +2 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/index.js +6 -0
- package/package.json +19 -19
- package/.eslintrc.json +0 -229
- package/dist/contracts/Callbacks.js +0 -2
- package/dist/contracts/DomainRecordList.js +0 -2
- package/dist/contracts/Record.d.ts +0 -8
- package/dist/contracts/Record.js +0 -2
- package/dist/contracts/ZoneMap.js +0 -2
- package/dist/contracts/cloudflare/RecordData.js +0 -2
- package/dist/contracts/cloudflare/ZoneData.js +0 -2
- package/dist/contracts/cloudflare/index.d.ts +0 -2
- package/dist/contracts/cloudflare/index.js +0 -18
- package/dist/contracts/index.d.ts +0 -5
- package/dist/contracts/index.js +0 -21
- /package/dist/{contracts → types}/ZoneMap.d.ts +0 -0
- /package/dist/{contracts → types}/cloudflare/ZoneData.d.ts +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## v3
|
|
4
|
+
|
|
5
|
+
### v3.0.1
|
|
6
|
+
|
|
7
|
+
- ⬆️ Update dependencies
|
|
8
|
+
|
|
9
|
+
### v3.0.0
|
|
10
|
+
|
|
11
|
+
**This package will now be released as native ECMAScript module.**
|
|
12
|
+
|
|
13
|
+
- ✨ **Add possibility to use Cloudflare API Token**
|
|
14
|
+
- ♻️ Reduce request if many DNS Records exist for one Zone
|
|
15
|
+
- ⬆️ Update dependencies
|
|
16
|
+
|
|
3
17
|
## v2
|
|
4
18
|
|
|
5
19
|
### v2.0.6
|
package/README.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# Cloudflare-DDNS-Sync
|
|
2
2
|
|
|
3
|
-

|
|
4
|
+
[](https://www.npmjs.com/package/cloudflare-ddns-sync)
|
|
5
|
+
[](https://www.npmjs.com/package/cloudflare-ddns-sync)
|
|
6
|
+
[](https://www.npmjs.com/package/cloudflare-ddns-sync-cli)
|
|
7
7
|
|
|
8
8
|
## Overview
|
|
9
9
|
|
|
@@ -17,7 +17,7 @@ You may also have a look at the **official** [CLI version](https://www.npmjs.com
|
|
|
17
17
|
|
|
18
18
|
### Prerequisites
|
|
19
19
|
|
|
20
|
-
- Node
|
|
20
|
+
- Node
|
|
21
21
|
- Cloudflare Account
|
|
22
22
|
|
|
23
23
|
### Installation
|
|
@@ -38,21 +38,26 @@ in your project folder.
|
|
|
38
38
|
### Javascript Example
|
|
39
39
|
|
|
40
40
|
```javascript
|
|
41
|
-
const Cddnss = require(
|
|
41
|
+
const Cddnss = require('cloudflare-ddns-sync').default;
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
// either email and key or token
|
|
44
|
+
const cddnss = new Cddnss({
|
|
45
|
+
email: 'your@email.com',
|
|
46
|
+
key: '<your-cloudflare-api-key>',
|
|
47
|
+
token: '<your-cloudflare-api-token>',
|
|
48
|
+
});
|
|
44
49
|
|
|
45
50
|
const records = [
|
|
46
51
|
{
|
|
47
|
-
name:
|
|
48
|
-
type:
|
|
52
|
+
name: 'test-1.domain.com',
|
|
53
|
+
type: 'A', // optional
|
|
49
54
|
proxied: true, // optional
|
|
50
55
|
ttl: 1, // optional
|
|
51
56
|
priority: 0, // optional
|
|
52
|
-
content:
|
|
57
|
+
content: '1.2.3.4', // optional
|
|
53
58
|
},
|
|
54
59
|
{
|
|
55
|
-
name:
|
|
60
|
+
name: 'test-2.domain.com',
|
|
56
61
|
},
|
|
57
62
|
];
|
|
58
63
|
|
|
@@ -64,24 +69,26 @@ cddnss.syncRecords(records).then((result) => {
|
|
|
64
69
|
### Typescript Example
|
|
65
70
|
|
|
66
71
|
```typescript
|
|
67
|
-
import Cddnss, {
|
|
72
|
+
import Cddnss, {Record, RecordData} from 'cloudflare-ddns-sync';
|
|
68
73
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
74
|
+
// either email and key or token
|
|
75
|
+
const cddnss = new Cddnss({
|
|
76
|
+
email: 'your@email.com',
|
|
77
|
+
key: '<your-cloudflare-api-key>',
|
|
78
|
+
token: '<your-cloudflare-api-token>',
|
|
79
|
+
});
|
|
73
80
|
|
|
74
81
|
const records: Array<Record> = [
|
|
75
82
|
{
|
|
76
|
-
name:
|
|
77
|
-
type:
|
|
83
|
+
name: 'test-1.yourdomain.com',
|
|
84
|
+
type: 'A', // optional
|
|
78
85
|
proxied: true, // optional
|
|
79
86
|
ttl: 1, // optional
|
|
80
87
|
priority: 0, // optional
|
|
81
|
-
content:
|
|
88
|
+
content: '1.2.3.4', // optional
|
|
82
89
|
},
|
|
83
90
|
{
|
|
84
|
-
name:
|
|
91
|
+
name: 'test-2.yourdomain.com',
|
|
85
92
|
},
|
|
86
93
|
];
|
|
87
94
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ScheduledTask } from 'node-cron';
|
|
2
|
-
import { DomainRecordList, MultiSyncCallback, Record, RecordData } from './
|
|
2
|
+
import { Auth, DomainRecordList, MultiSyncCallback, Record, RecordData } from './types/index.js';
|
|
3
3
|
export default class CloudflareDDNSSync {
|
|
4
4
|
private cloudflareClient;
|
|
5
|
-
constructor(
|
|
5
|
+
constructor(auth: Auth);
|
|
6
6
|
getIp(): Promise<string>;
|
|
7
7
|
getIpv6(): Promise<string>;
|
|
8
8
|
getRecordDataForDomain(domain: string): Promise<Array<RecordData>>;
|
|
@@ -16,4 +16,4 @@ export default class CloudflareDDNSSync {
|
|
|
16
16
|
syncRecord(record: Record, ip?: string): Promise<RecordData>;
|
|
17
17
|
syncRecords(records: Array<Record>, ip?: string): Promise<Array<RecordData>>;
|
|
18
18
|
}
|
|
19
|
-
export * from './
|
|
19
|
+
export * from './types/index.js';
|
package/dist/index.js
CHANGED
|
@@ -1,35 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
-
};
|
|
19
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
const cloudflare_client_1 = __importDefault(require("./lib/cloudflare-client"));
|
|
21
|
-
const cron_1 = __importDefault(require("./lib/cron"));
|
|
22
|
-
const ip_utils_1 = __importDefault(require("./lib/ip-utils"));
|
|
23
|
-
class CloudflareDDNSSync {
|
|
1
|
+
import CloudflareClient from './lib/cloudflare-client.js';
|
|
2
|
+
import Cron from './lib/cron.js';
|
|
3
|
+
import ipUtils from './lib/ip-utils.js';
|
|
4
|
+
export default class CloudflareDDNSSync {
|
|
24
5
|
cloudflareClient;
|
|
25
|
-
constructor(
|
|
26
|
-
this.cloudflareClient = new
|
|
6
|
+
constructor(auth) {
|
|
7
|
+
this.cloudflareClient = new CloudflareClient(auth);
|
|
27
8
|
}
|
|
28
9
|
getIp() {
|
|
29
|
-
return
|
|
10
|
+
return ipUtils.getIpv4();
|
|
30
11
|
}
|
|
31
12
|
getIpv6() {
|
|
32
|
-
return
|
|
13
|
+
return ipUtils.getIpv6();
|
|
33
14
|
}
|
|
34
15
|
getRecordDataForDomain(domain) {
|
|
35
16
|
return this.cloudflareClient.getRecordDataForDomain(domain);
|
|
@@ -47,21 +28,21 @@ class CloudflareDDNSSync {
|
|
|
47
28
|
return this.cloudflareClient.removeRecordByNameAndType(recordName, recordType);
|
|
48
29
|
}
|
|
49
30
|
stopSyncOnIpChange(changeListenerId) {
|
|
50
|
-
|
|
31
|
+
ipUtils.removeIpChangeListener(changeListenerId);
|
|
51
32
|
}
|
|
52
33
|
syncByCronTime(cronExpression, records, callback, ip) {
|
|
53
|
-
return
|
|
34
|
+
return Cron.createCronJob(cronExpression, async () => {
|
|
54
35
|
const result = await this.syncRecords(records, ip);
|
|
55
36
|
callback(result);
|
|
56
37
|
});
|
|
57
38
|
}
|
|
58
39
|
async syncOnIpChange(records, callback) {
|
|
59
|
-
const changeListenerId = await
|
|
40
|
+
const changeListenerId = await ipUtils.addIpChangeListener(async (ip) => {
|
|
60
41
|
const result = await this.syncRecords(records, ip);
|
|
61
42
|
callback(result);
|
|
62
43
|
});
|
|
63
44
|
// Sync records to make sure the current ip is already set.
|
|
64
|
-
const currentIp = await
|
|
45
|
+
const currentIp = await ipUtils.getIpv4();
|
|
65
46
|
this.syncRecords(records, currentIp).then((syncedRecords) => {
|
|
66
47
|
callback(syncedRecords);
|
|
67
48
|
});
|
|
@@ -74,5 +55,4 @@ class CloudflareDDNSSync {
|
|
|
74
55
|
return this.cloudflareClient.syncRecords(records, ip);
|
|
75
56
|
}
|
|
76
57
|
}
|
|
77
|
-
|
|
78
|
-
__exportStar(require("./contracts/index"), exports);
|
|
58
|
+
export * from './types/index.js';
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Cloudflare from 'cloudflare';
|
|
2
|
+
import { DomainRecordList, Record, RecordData } from '../types/index.js';
|
|
2
3
|
export default class CloudflareClient {
|
|
3
4
|
private cloudflare;
|
|
4
5
|
private zoneMap;
|
|
5
|
-
constructor(
|
|
6
|
+
constructor(auth: Cloudflare.AuthObject);
|
|
6
7
|
syncRecord(record: Record, ip?: string): Promise<RecordData>;
|
|
7
8
|
syncRecords(records: Array<Record>, ip?: string): Promise<Array<RecordData>>;
|
|
8
9
|
removeRecordByNameAndType(recordName: string, recordType?: string): Promise<void>;
|
|
@@ -1,27 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const parse_domain_1 = require("parse-domain");
|
|
7
|
-
const cloudflare_1 = __importDefault(require("cloudflare"));
|
|
8
|
-
const ip_utils_1 = __importDefault(require("./ip-utils"));
|
|
1
|
+
import { ParseResultType, fromUrl, parseDomain } from 'parse-domain';
|
|
2
|
+
import Cloudflare from 'cloudflare';
|
|
3
|
+
import IPUtils from './ip-utils.js';
|
|
9
4
|
const ipv4Regex = /^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/u;
|
|
10
|
-
// eslint-disable-next-line max-len
|
|
11
5
|
const ipv6Regex = /^(?:(?:(?:(?:(?:(?:(?:[0-9a-fA-F]{1,4})):){6})(?:(?:(?:(?:(?:[0-9a-fA-F]{1,4})):(?:(?:[0-9a-fA-F]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:::(?:(?:(?:[0-9a-fA-F]{1,4})):){5})(?:(?:(?:(?:(?:[0-9a-fA-F]{1,4})):(?:(?:[0-9a-fA-F]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:[0-9a-fA-F]{1,4})))?::(?:(?:(?:[0-9a-fA-F]{1,4})):){4})(?:(?:(?:(?:(?:[0-9a-fA-F]{1,4})):(?:(?:[0-9a-fA-F]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-fA-F]{1,4})):){0,1}(?:(?:[0-9a-fA-F]{1,4})))?::(?:(?:(?:[0-9a-fA-F]{1,4})):){3})(?:(?:(?:(?:(?:[0-9a-fA-F]{1,4})):(?:(?:[0-9a-fA-F]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-fA-F]{1,4})):){0,2}(?:(?:[0-9a-fA-F]{1,4})))?::(?:(?:(?:[0-9a-fA-F]{1,4})):){2})(?:(?:(?:(?:(?:[0-9a-fA-F]{1,4})):(?:(?:[0-9a-fA-F]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-fA-F]{1,4})):){0,3}(?:(?:[0-9a-fA-F]{1,4})))?::(?:(?:[0-9a-fA-F]{1,4})):)(?:(?:(?:(?:(?:[0-9a-fA-F]{1,4})):(?:(?:[0-9a-fA-F]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-fA-F]{1,4})):){0,4}(?:(?:[0-9a-fA-F]{1,4})))?::)(?:(?:(?:(?:(?:[0-9a-fA-F]{1,4})):(?:(?:[0-9a-fA-F]{1,4})))|(?:(?:(?:(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9]))\.){3}(?:(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])))))))|(?:(?:(?:(?:(?:(?:[0-9a-fA-F]{1,4})):){0,5}(?:(?:[0-9a-fA-F]{1,4})))?::)(?:(?:[0-9a-fA-F]{1,4})))|(?:(?:(?:(?:(?:(?:[0-9a-fA-F]{1,4})):){0,6}(?:(?:[0-9a-fA-F]{1,4})))?::))))$/u;
|
|
12
|
-
class CloudflareClient {
|
|
6
|
+
export default class CloudflareClient {
|
|
13
7
|
cloudflare;
|
|
14
8
|
zoneMap = new Map();
|
|
15
|
-
constructor(
|
|
16
|
-
this.cloudflare = new
|
|
17
|
-
email: email,
|
|
18
|
-
key: authKey,
|
|
19
|
-
});
|
|
9
|
+
constructor(auth) {
|
|
10
|
+
this.cloudflare = new Cloudflare(auth);
|
|
20
11
|
this.updateZoneMap();
|
|
21
12
|
}
|
|
22
13
|
async syncRecord(record, ip) {
|
|
23
14
|
const recordIds = await this.getRecordIdsForRecords([record]);
|
|
24
|
-
const ipToUse = ip ? ip : await
|
|
15
|
+
const ipToUse = ip ? ip : await IPUtils.getIpv4();
|
|
25
16
|
const zoneId = await this.getZoneIdByRecordName(record.name);
|
|
26
17
|
const recordId = recordIds.get(this.getRecordIdMapKey(record));
|
|
27
18
|
const recordExists = recordId !== undefined;
|
|
@@ -34,7 +25,7 @@ class CloudflareClient {
|
|
|
34
25
|
}
|
|
35
26
|
async syncRecords(records, ip) {
|
|
36
27
|
const recordIds = await this.getRecordIdsForRecords(records);
|
|
37
|
-
const ipToUse = ip ? ip : await
|
|
28
|
+
const ipToUse = ip ? ip : await IPUtils.getIpv4();
|
|
38
29
|
const resultPromises = records.map(async (record) => {
|
|
39
30
|
const zoneId = await this.getZoneIdByRecordName(record.name);
|
|
40
31
|
const recordId = recordIds.get(this.getRecordIdMapKey(record));
|
|
@@ -53,7 +44,7 @@ class CloudflareClient {
|
|
|
53
44
|
const recordTypeToUse = recordType ? recordType : 'A';
|
|
54
45
|
const zoneId = await this.getZoneIdByRecordName(recordName);
|
|
55
46
|
const recordId = await this.getRecordIdByNameAndType(recordName, recordTypeToUse);
|
|
56
|
-
|
|
47
|
+
await this.cloudflare.dnsRecords.del(zoneId, recordId);
|
|
57
48
|
}
|
|
58
49
|
async getRecordDataForRecord(record) {
|
|
59
50
|
const domain = this.getDomainByRecordName(record.name);
|
|
@@ -65,9 +56,7 @@ class CloudflareClient {
|
|
|
65
56
|
const domains = this.getDomainsFromRecords(records);
|
|
66
57
|
const recordDataPromises = domains.map(async (domain) => {
|
|
67
58
|
const recordDataForDomain = await this.getRecordsByDomain(domain);
|
|
68
|
-
const recordDataForDomainFilteredByRecords = recordDataForDomain
|
|
69
|
-
.filter((singleRecordData) => records
|
|
70
|
-
.some((record) => record.name.toLowerCase() === singleRecordData.name.toLowerCase()));
|
|
59
|
+
const recordDataForDomainFilteredByRecords = recordDataForDomain.filter((singleRecordData) => records.some((record) => record.name.toLowerCase() === singleRecordData.name.toLowerCase()));
|
|
71
60
|
return recordDataForDomainFilteredByRecords;
|
|
72
61
|
});
|
|
73
62
|
const recordDataForDomains = await Promise.all(recordDataPromises);
|
|
@@ -88,61 +77,67 @@ class CloudflareClient {
|
|
|
88
77
|
return recordData;
|
|
89
78
|
}
|
|
90
79
|
async createRecord(zoneId, record, ip) {
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}
|
|
98
|
-
if (
|
|
99
|
-
|
|
100
|
-
|
|
80
|
+
const dnsRecord = {
|
|
81
|
+
...record,
|
|
82
|
+
name: record.name.toLowerCase(),
|
|
83
|
+
content: record.content ? record.content : ip,
|
|
84
|
+
type: record.type ? record.type : 'A',
|
|
85
|
+
ttl: record.ttl ? record.ttl : 1,
|
|
86
|
+
};
|
|
87
|
+
if (!dnsRecord.content) {
|
|
88
|
+
throw Error(`Could not create Record "${dnsRecord.name}": Content is missing!`);
|
|
89
|
+
}
|
|
90
|
+
if (dnsRecord.type === 'A') {
|
|
91
|
+
if (!dnsRecord.content.match(ipv4Regex)) {
|
|
92
|
+
throw Error(`Could not create Record "${dnsRecord.name}": '${dnsRecord.content}' is not a valid ipv4!`);
|
|
101
93
|
}
|
|
102
94
|
}
|
|
103
|
-
else if (
|
|
104
|
-
if (!
|
|
105
|
-
throw Error(`Could not create Record "${
|
|
95
|
+
else if (dnsRecord.type === 'AAAA') {
|
|
96
|
+
if (!dnsRecord.content.match(ipv6Regex)) {
|
|
97
|
+
throw Error(`Could not create Record "${dnsRecord.name}": '${dnsRecord.content}' is not a valid ipv6!`);
|
|
106
98
|
}
|
|
107
99
|
}
|
|
108
|
-
else if (
|
|
109
|
-
const parsedDomain =
|
|
110
|
-
if (parsedDomain.type !==
|
|
111
|
-
throw Error(`Could not create Record "${
|
|
100
|
+
else if (dnsRecord.type === 'CNAME') {
|
|
101
|
+
const parsedDomain = parseDomain(fromUrl(dnsRecord.content));
|
|
102
|
+
if (parsedDomain.type !== ParseResultType.Listed || !parsedDomain.domain) {
|
|
103
|
+
throw Error(`Could not create Record "${dnsRecord.name}": '${dnsRecord.content}' is not a valid domain name!`);
|
|
112
104
|
}
|
|
113
105
|
}
|
|
114
|
-
const response = await this.cloudflare.dnsRecords.add(zoneId,
|
|
106
|
+
const response = (await this.cloudflare.dnsRecords.add(zoneId, dnsRecord));
|
|
115
107
|
return response.result;
|
|
116
108
|
}
|
|
117
109
|
async updateRecord(zoneId, recordId, record, ip) {
|
|
118
|
-
const
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
}
|
|
125
|
-
if (
|
|
126
|
-
|
|
127
|
-
|
|
110
|
+
const dnsRecord = {
|
|
111
|
+
...record,
|
|
112
|
+
name: record.name.toLowerCase(),
|
|
113
|
+
content: record.content ? record.content : ip,
|
|
114
|
+
type: record.type ? record.type : 'A',
|
|
115
|
+
ttl: record.ttl ? record.ttl : 1,
|
|
116
|
+
};
|
|
117
|
+
if (!dnsRecord.content) {
|
|
118
|
+
throw Error(`Could not update Record "${dnsRecord.name}": Content is missing!`);
|
|
119
|
+
}
|
|
120
|
+
if (dnsRecord.type === 'A') {
|
|
121
|
+
if (!dnsRecord.content.match(ipv4Regex)) {
|
|
122
|
+
throw Error(`Could not update Record "${dnsRecord.name}": '${dnsRecord.content}' is not a valid ipv4!`);
|
|
128
123
|
}
|
|
129
124
|
}
|
|
130
|
-
else if (
|
|
131
|
-
if (!
|
|
132
|
-
throw Error(`Could not update Record "${
|
|
125
|
+
else if (dnsRecord.type === 'AAAA') {
|
|
126
|
+
if (!dnsRecord.content.match(ipv6Regex)) {
|
|
127
|
+
throw Error(`Could not update Record "${dnsRecord.name}": '${dnsRecord.content}' is not a valid ipv6!`);
|
|
133
128
|
}
|
|
134
129
|
}
|
|
135
|
-
else if (
|
|
136
|
-
const parsedDomain =
|
|
137
|
-
if (parsedDomain.type !==
|
|
138
|
-
throw Error(`Could not update Record "${
|
|
130
|
+
else if (dnsRecord.type === 'CNAME') {
|
|
131
|
+
const parsedDomain = parseDomain(fromUrl(dnsRecord.content));
|
|
132
|
+
if (parsedDomain.type !== ParseResultType.Listed || !parsedDomain.domain) {
|
|
133
|
+
throw Error(`Could not update Record "${dnsRecord.name}": '${dnsRecord.content}' is not a valid domain name!`);
|
|
139
134
|
}
|
|
140
135
|
}
|
|
141
|
-
const response = await this.cloudflare.dnsRecords.edit(zoneId, recordId,
|
|
136
|
+
const response = (await this.cloudflare.dnsRecords.edit(zoneId, recordId, dnsRecord));
|
|
142
137
|
return response.result;
|
|
143
138
|
}
|
|
144
139
|
async updateZoneMap() {
|
|
145
|
-
const response = await this.cloudflare.zones.browse();
|
|
140
|
+
const response = (await this.cloudflare.zones.browse());
|
|
146
141
|
const zones = response.result;
|
|
147
142
|
this.zoneMap = new Map();
|
|
148
143
|
for (const zone of zones) {
|
|
@@ -160,8 +155,7 @@ class CloudflareClient {
|
|
|
160
155
|
async getRecordByNameAndType(recordName, recordType) {
|
|
161
156
|
const domain = this.getDomainByRecordName(recordName);
|
|
162
157
|
const records = await this.getRecordsByDomain(domain);
|
|
163
|
-
const record = records.find((currentRecord) => currentRecord.name.toLowerCase() === recordName.toLowerCase()
|
|
164
|
-
&& currentRecord.type.toLowerCase() === recordType.toLowerCase());
|
|
158
|
+
const record = records.find((currentRecord) => currentRecord.name.toLowerCase() === recordName.toLowerCase() && currentRecord.type.toLowerCase() === recordType.toLowerCase());
|
|
165
159
|
const recordNotFound = record === undefined;
|
|
166
160
|
if (recordNotFound) {
|
|
167
161
|
throw new Error(`Record '${recordName}' not found.`);
|
|
@@ -186,13 +180,14 @@ class CloudflareClient {
|
|
|
186
180
|
const records = [];
|
|
187
181
|
let pageIndex = 1;
|
|
188
182
|
let allRecordsFound = false;
|
|
183
|
+
const recordsPerPage = 5000;
|
|
189
184
|
while (!allRecordsFound) {
|
|
190
|
-
const response = await this.cloudflare.dnsRecords.browse(zoneId, {
|
|
185
|
+
const response = (await this.cloudflare.dnsRecords.browse(zoneId, {
|
|
191
186
|
page: pageIndex,
|
|
192
|
-
per_page:
|
|
193
|
-
});
|
|
187
|
+
per_page: recordsPerPage,
|
|
188
|
+
}));
|
|
194
189
|
records.push(...response.result);
|
|
195
|
-
allRecordsFound = response.result.length <
|
|
190
|
+
allRecordsFound = response.result.length < recordsPerPage;
|
|
196
191
|
pageIndex++;
|
|
197
192
|
}
|
|
198
193
|
return records;
|
|
@@ -210,14 +205,12 @@ class CloudflareClient {
|
|
|
210
205
|
return zoneId;
|
|
211
206
|
}
|
|
212
207
|
getDomainsFromRecords(records) {
|
|
213
|
-
const domains = records
|
|
214
|
-
.map((record) => this.getDomainByRecordName(record.name))
|
|
215
|
-
.filter((domain, index, domainList) => domainList.indexOf(domain.toLowerCase()) === index);
|
|
208
|
+
const domains = records.map((record) => this.getDomainByRecordName(record.name)).filter((domain, index, domainList) => domainList.indexOf(domain.toLowerCase()) === index);
|
|
216
209
|
return domains;
|
|
217
210
|
}
|
|
218
211
|
getDomainByRecordName(recordName) {
|
|
219
|
-
const parsedDomain =
|
|
220
|
-
if (parsedDomain.type !==
|
|
212
|
+
const parsedDomain = parseDomain(fromUrl(recordName));
|
|
213
|
+
if (parsedDomain.type !== ParseResultType.Listed || !parsedDomain.domain) {
|
|
221
214
|
throw new Error(`Could not parse domain. '${JSON.stringify(recordName)}' is not a valid record name.`);
|
|
222
215
|
}
|
|
223
216
|
let domain = '';
|
|
@@ -228,4 +221,3 @@ class CloudflareClient {
|
|
|
228
221
|
return domain.toLowerCase();
|
|
229
222
|
}
|
|
230
223
|
}
|
|
231
|
-
exports.default = CloudflareClient;
|
package/dist/lib/cron.js
CHANGED
|
@@ -1,22 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const node_cron_1 = __importDefault(require("node-cron"));
|
|
7
|
-
class Cron {
|
|
1
|
+
import cron from 'node-cron';
|
|
2
|
+
export default class Cron {
|
|
8
3
|
static createCronJob(cronExpression, callback) {
|
|
9
4
|
const cronExpressionIsInvalid = !this.isValid(cronExpression);
|
|
10
5
|
if (cronExpressionIsInvalid) {
|
|
11
|
-
// eslint-disable-next-line max-len
|
|
12
6
|
throw new Error(`'${cronExpression}' is not a valid cron expression.\nHere you can see how cron expressions work: https://cddnss.knaup.pw/cron-expression-syntax`);
|
|
13
7
|
}
|
|
14
|
-
return
|
|
8
|
+
return cron.schedule(cronExpression, () => {
|
|
15
9
|
callback();
|
|
16
10
|
}, undefined);
|
|
17
11
|
}
|
|
18
12
|
static isValid(cronExpression) {
|
|
19
|
-
return
|
|
13
|
+
return cron.validate(cronExpression);
|
|
20
14
|
}
|
|
21
15
|
}
|
|
22
|
-
exports.default = Cron;
|
package/dist/lib/ip-utils.d.ts
CHANGED
package/dist/lib/ip-utils.js
CHANGED
|
@@ -1,40 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
const wimIp = __importStar(require("what-is-my-ip-address"));
|
|
30
|
-
const public_ip_1 = __importDefault(require("public-ip"));
|
|
31
|
-
class IPUtils {
|
|
1
|
+
import * as wimIp from 'what-is-my-ip-address';
|
|
2
|
+
import { publicIpv4, publicIpv6 } from 'public-ip';
|
|
3
|
+
export default class IPUtils {
|
|
32
4
|
static ipPollingDelay = 10 * 1000;
|
|
33
5
|
static ipChangeEventListeners = new Map();
|
|
34
6
|
static async getIpv4() {
|
|
35
7
|
/* c8 ignore start*/
|
|
36
8
|
try {
|
|
37
|
-
return await
|
|
9
|
+
return await publicIpv4();
|
|
38
10
|
}
|
|
39
11
|
catch (error) {
|
|
40
12
|
return wimIp.v4();
|
|
@@ -44,7 +16,7 @@ class IPUtils {
|
|
|
44
16
|
static async getIpv6() {
|
|
45
17
|
/* c8 ignore start */
|
|
46
18
|
try {
|
|
47
|
-
return await
|
|
19
|
+
return await publicIpv6();
|
|
48
20
|
}
|
|
49
21
|
catch (error) {
|
|
50
22
|
return wimIp.v6();
|
|
@@ -52,7 +24,7 @@ class IPUtils {
|
|
|
52
24
|
/* c8 ignore stop*/
|
|
53
25
|
}
|
|
54
26
|
static async addIpChangeListener(callback) {
|
|
55
|
-
const eventListenerId = this.
|
|
27
|
+
const eventListenerId = this.getId();
|
|
56
28
|
let previousIp = await this.getIpv4();
|
|
57
29
|
/* c8 ignore start */
|
|
58
30
|
const intervalId = setInterval(async () => {
|
|
@@ -72,15 +44,7 @@ class IPUtils {
|
|
|
72
44
|
clearInterval(eventListenerIntervalId);
|
|
73
45
|
IPUtils.ipChangeEventListeners.delete(eventListenerId);
|
|
74
46
|
}
|
|
75
|
-
static
|
|
76
|
-
|
|
77
|
-
.substr(2);
|
|
78
|
-
const currentDateAsString = new Date().valueOf()
|
|
79
|
-
.toString(36);
|
|
80
|
-
const endingRandomString = Math.random().toString(36)
|
|
81
|
-
.substr(2);
|
|
82
|
-
const randomString = beginningRandomString + currentDateAsString + endingRandomString;
|
|
83
|
-
return randomString;
|
|
47
|
+
static getId() {
|
|
48
|
+
return Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
|
|
84
49
|
}
|
|
85
50
|
}
|
|
86
|
-
exports.default = IPUtils;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { RecordTypes as CloudflareRecordTypes } from 'cloudflare';
|
|
2
|
+
export type RecordTypes = Exclude<CloudflareRecordTypes, 'MX' | 'SRV' | 'URI'>;
|
|
3
|
+
export type Record = {
|
|
4
|
+
name: string;
|
|
5
|
+
type?: RecordTypes;
|
|
6
|
+
proxied?: boolean;
|
|
7
|
+
ttl?: number;
|
|
8
|
+
priority?: number;
|
|
9
|
+
content?: string;
|
|
10
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cloudflare-ddns-sync",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"description": "A simple module to update DNS records on Cloudflare whenever you want",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"author": "Steffen Knaup <SteffenKnaup@hotmail.de>",
|
|
7
7
|
"license": "ISC",
|
|
8
|
+
"type": "module",
|
|
8
9
|
"keywords": [
|
|
9
10
|
"cloudflare",
|
|
10
11
|
"cddnss",
|
|
@@ -20,8 +21,8 @@
|
|
|
20
21
|
},
|
|
21
22
|
"scripts": {
|
|
22
23
|
"build": "tsc",
|
|
23
|
-
"lint": "
|
|
24
|
-
"lint:fix": "
|
|
24
|
+
"lint": "prettier -c ./src",
|
|
25
|
+
"lint:fix": "prettier -w ./src",
|
|
25
26
|
"test": "c8 mocha dist/tests/*.js --timeout 15000 --exit",
|
|
26
27
|
"test:coverage": "npm run test:coverage-check && npm run test:coverage-report",
|
|
27
28
|
"test:coverage-check": "c8 check-coverage --lines 70 --functions 70 --branches 70",
|
|
@@ -29,24 +30,23 @@
|
|
|
29
30
|
},
|
|
30
31
|
"dependencies": {
|
|
31
32
|
"cloudflare": "2.9.1",
|
|
32
|
-
"node-cron": "3.0.
|
|
33
|
-
"parse-domain": "
|
|
34
|
-
"public-ip": "
|
|
33
|
+
"node-cron": "3.0.3",
|
|
34
|
+
"parse-domain": "8.0.1",
|
|
35
|
+
"public-ip": "6.0.1",
|
|
35
36
|
"what-is-my-ip-address": "1.0.3"
|
|
36
37
|
},
|
|
37
38
|
"devDependencies": {
|
|
38
|
-
"@types/chai": "4.3.
|
|
39
|
-
"@types/
|
|
40
|
-
"@types/
|
|
41
|
-
"@types/
|
|
42
|
-
"@types/node
|
|
43
|
-
"@
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"typescript": "4.9.4"
|
|
39
|
+
"@types/chai": "4.3.11",
|
|
40
|
+
"@types/cloudflare": "^2.7.13",
|
|
41
|
+
"@types/minimist": "1.2.5",
|
|
42
|
+
"@types/mocha": "10.0.6",
|
|
43
|
+
"@types/node": "20.10.7",
|
|
44
|
+
"@types/node-cron": "3.0.11",
|
|
45
|
+
"c8": "9.0.0",
|
|
46
|
+
"chai": "5.0.0",
|
|
47
|
+
"minimist": "1.2.8",
|
|
48
|
+
"mocha": "10.2.0",
|
|
49
|
+
"prettier": "^3.1.1",
|
|
50
|
+
"typescript": "5.3.3"
|
|
51
51
|
}
|
|
52
52
|
}
|
package/.eslintrc.json
DELETED
|
@@ -1,229 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"env": {
|
|
3
|
-
"es2021": true,
|
|
4
|
-
"node": true
|
|
5
|
-
},
|
|
6
|
-
"extends": [
|
|
7
|
-
"eslint:recommended",
|
|
8
|
-
"plugin:@typescript-eslint/recommended"
|
|
9
|
-
],
|
|
10
|
-
"parser": "@typescript-eslint/parser",
|
|
11
|
-
"parserOptions": {
|
|
12
|
-
"ecmaVersion": "latest",
|
|
13
|
-
"sourceType": "module"
|
|
14
|
-
},
|
|
15
|
-
"plugins": [
|
|
16
|
-
"@typescript-eslint"
|
|
17
|
-
],
|
|
18
|
-
"rules": {
|
|
19
|
-
"@typescript-eslint/ban-types": "off",
|
|
20
|
-
"@typescript-eslint/indent": ["error", 2],
|
|
21
|
-
"@typescript-eslint/no-shadow": "error",
|
|
22
|
-
"accessor-pairs": "error",
|
|
23
|
-
"array-bracket-newline": "error",
|
|
24
|
-
"array-bracket-spacing": "error",
|
|
25
|
-
"array-callback-return": "error",
|
|
26
|
-
"array-element-newline": "error",
|
|
27
|
-
"arrow-body-style": "error",
|
|
28
|
-
"arrow-parens": "error",
|
|
29
|
-
"arrow-spacing": "error",
|
|
30
|
-
"block-scoped-var": "error",
|
|
31
|
-
"block-spacing": "error",
|
|
32
|
-
"brace-style": "error",
|
|
33
|
-
"camelcase": "warn",
|
|
34
|
-
"capitalized-comments": "off",
|
|
35
|
-
"class-methods-use-this": "off",
|
|
36
|
-
"comma-dangle": ["error", "always-multiline"],
|
|
37
|
-
"comma-spacing": "error",
|
|
38
|
-
"comma-style": "error",
|
|
39
|
-
"complexity": "error",
|
|
40
|
-
"computed-property-spacing": "error",
|
|
41
|
-
"consistent-return": "error",
|
|
42
|
-
"consistent-this": "error",
|
|
43
|
-
"curly": "error",
|
|
44
|
-
"default-case": "error",
|
|
45
|
-
"default-case-last": "error",
|
|
46
|
-
"default-param-last": "error",
|
|
47
|
-
"dot-location": ["error", "property"],
|
|
48
|
-
"dot-notation": "error",
|
|
49
|
-
"eol-last": "error",
|
|
50
|
-
"eqeqeq": "error",
|
|
51
|
-
"func-call-spacing": "error",
|
|
52
|
-
"func-name-matching": "error",
|
|
53
|
-
"func-names": "error",
|
|
54
|
-
"func-style": ["error", "declaration", {
|
|
55
|
-
"allowArrowFunctions": true
|
|
56
|
-
}],
|
|
57
|
-
"function-call-argument-newline": ["error", "consistent"],
|
|
58
|
-
"function-paren-newline": "error",
|
|
59
|
-
"generator-star-spacing": "error",
|
|
60
|
-
"grouped-accessor-pairs": "error",
|
|
61
|
-
"guard-for-in": "error",
|
|
62
|
-
"id-denylist": "error",
|
|
63
|
-
"id-length": "off",
|
|
64
|
-
"id-match": "error",
|
|
65
|
-
"implicit-arrow-linebreak": "error",
|
|
66
|
-
"indent": "off",
|
|
67
|
-
"init-declarations": "off",
|
|
68
|
-
"key-spacing": "error",
|
|
69
|
-
"keyword-spacing": "error",
|
|
70
|
-
"line-comment-position": "error",
|
|
71
|
-
"linebreak-style": "error",
|
|
72
|
-
"lines-around-comment": "off",
|
|
73
|
-
"lines-between-class-members": "off",
|
|
74
|
-
"max-classes-per-file": "error",
|
|
75
|
-
"max-depth": "error",
|
|
76
|
-
"max-len": ["error", 150],
|
|
77
|
-
"max-lines": ["error", 1000],
|
|
78
|
-
"max-lines-per-function": "off",
|
|
79
|
-
"max-nested-callbacks": "error",
|
|
80
|
-
"max-params": ["warn", {"max": 4}],
|
|
81
|
-
"max-statements": "off",
|
|
82
|
-
"max-statements-per-line": "off",
|
|
83
|
-
"multiline-comment-style": "off",
|
|
84
|
-
"multiline-ternary": "off",
|
|
85
|
-
"new-cap": "error",
|
|
86
|
-
"new-parens": "error",
|
|
87
|
-
"newline-per-chained-call": "error",
|
|
88
|
-
"no-alert": "error",
|
|
89
|
-
"no-array-constructor": "error",
|
|
90
|
-
"no-await-in-loop": "off",
|
|
91
|
-
"no-bitwise": "error",
|
|
92
|
-
"no-caller": "error",
|
|
93
|
-
"no-confusing-arrow": "error",
|
|
94
|
-
"no-console": "error",
|
|
95
|
-
"no-constructor-return": "error",
|
|
96
|
-
"no-continue": "error",
|
|
97
|
-
"no-div-regex": "error",
|
|
98
|
-
"no-duplicate-imports": "error",
|
|
99
|
-
"no-else-return": "error",
|
|
100
|
-
"no-empty-function": "error",
|
|
101
|
-
"no-eq-null": "error",
|
|
102
|
-
"no-eval": "error",
|
|
103
|
-
"no-extend-native": "error",
|
|
104
|
-
"no-extra-bind": "error",
|
|
105
|
-
"no-extra-label": "error",
|
|
106
|
-
"no-extra-parens": "off",
|
|
107
|
-
"no-floating-decimal": "error",
|
|
108
|
-
"no-implicit-coercion": "error",
|
|
109
|
-
"no-implicit-globals": "error",
|
|
110
|
-
"no-implied-eval": "error",
|
|
111
|
-
"no-inline-comments": "error",
|
|
112
|
-
"no-invalid-this": "error",
|
|
113
|
-
"no-iterator": "error",
|
|
114
|
-
"no-label-var": "error",
|
|
115
|
-
"no-labels": "error",
|
|
116
|
-
"no-lone-blocks": "error",
|
|
117
|
-
"no-lonely-if": "error",
|
|
118
|
-
"no-loop-func": "error",
|
|
119
|
-
"no-magic-numbers": "off",
|
|
120
|
-
"no-mixed-operators": "error",
|
|
121
|
-
"no-multi-assign": "error",
|
|
122
|
-
"no-multi-spaces": "error",
|
|
123
|
-
"no-multi-str": "error",
|
|
124
|
-
"no-multiple-empty-lines": "error",
|
|
125
|
-
"no-negated-condition": "error",
|
|
126
|
-
"no-nested-ternary": "error",
|
|
127
|
-
"no-new": "error",
|
|
128
|
-
"no-new-func": "error",
|
|
129
|
-
"no-new-object": "error",
|
|
130
|
-
"no-new-wrappers": "error",
|
|
131
|
-
"no-octal-escape": "error",
|
|
132
|
-
"no-param-reassign": "error",
|
|
133
|
-
"no-plusplus": "off",
|
|
134
|
-
"no-promise-executor-return": "error",
|
|
135
|
-
"no-proto": "error",
|
|
136
|
-
"no-restricted-exports": "error",
|
|
137
|
-
"no-restricted-globals": "error",
|
|
138
|
-
"no-restricted-imports": "error",
|
|
139
|
-
"no-restricted-properties": "error",
|
|
140
|
-
"no-restricted-syntax": "error",
|
|
141
|
-
"no-return-assign": "error",
|
|
142
|
-
"no-return-await": "error",
|
|
143
|
-
"no-script-url": "error",
|
|
144
|
-
"no-self-compare": "error",
|
|
145
|
-
"no-sequences": "error",
|
|
146
|
-
"no-shadow": "off",
|
|
147
|
-
"no-tabs": "error",
|
|
148
|
-
"no-template-curly-in-string": "error",
|
|
149
|
-
"no-ternary": "off",
|
|
150
|
-
"no-throw-literal": "error",
|
|
151
|
-
"no-trailing-spaces": "error",
|
|
152
|
-
"no-undef-init": "error",
|
|
153
|
-
"no-undefined": "off",
|
|
154
|
-
"no-underscore-dangle": "error",
|
|
155
|
-
"no-unmodified-loop-condition": "error",
|
|
156
|
-
"no-unneeded-ternary": "error",
|
|
157
|
-
"no-unreachable-loop": "error",
|
|
158
|
-
"no-unused-expressions": "error",
|
|
159
|
-
"no-unused-private-class-members": "error",
|
|
160
|
-
"no-use-before-define": "off",
|
|
161
|
-
"no-useless-call": "error",
|
|
162
|
-
"no-useless-computed-key": "error",
|
|
163
|
-
"no-useless-concat": "error",
|
|
164
|
-
"no-useless-constructor": "error",
|
|
165
|
-
"no-useless-rename": "error",
|
|
166
|
-
"no-useless-return": "error",
|
|
167
|
-
"no-var": "error",
|
|
168
|
-
"no-void": "error",
|
|
169
|
-
"no-warning-comments": "error",
|
|
170
|
-
"no-whitespace-before-property": "error",
|
|
171
|
-
"nonblock-statement-body-position": "error",
|
|
172
|
-
"object-curly-newline": "error",
|
|
173
|
-
"object-curly-spacing": "error",
|
|
174
|
-
"object-property-newline": "error",
|
|
175
|
-
"object-shorthand": ["error", "never"],
|
|
176
|
-
"one-var": ["error", "never"],
|
|
177
|
-
"operator-assignment": "error",
|
|
178
|
-
"operator-linebreak": ["error", "before"],
|
|
179
|
-
"padded-blocks": ["error", "never"],
|
|
180
|
-
"padding-line-between-statements": "error",
|
|
181
|
-
"prefer-arrow-callback": "error",
|
|
182
|
-
"prefer-const": "error",
|
|
183
|
-
"prefer-destructuring": "error",
|
|
184
|
-
"prefer-exponentiation-operator": "error",
|
|
185
|
-
"prefer-named-capture-group": "off",
|
|
186
|
-
"prefer-numeric-literals": "error",
|
|
187
|
-
"prefer-object-spread": "error",
|
|
188
|
-
"prefer-promise-reject-errors": "error",
|
|
189
|
-
"prefer-regex-literals": "error",
|
|
190
|
-
"prefer-rest-params": "error",
|
|
191
|
-
"prefer-spread": "error",
|
|
192
|
-
"prefer-template": "error",
|
|
193
|
-
"quote-props": ["error", "as-needed"],
|
|
194
|
-
"quotes": ["error", "single"],
|
|
195
|
-
"radix": "error",
|
|
196
|
-
"require-atomic-updates": "error",
|
|
197
|
-
"require-await": "error",
|
|
198
|
-
"require-unicode-regexp": "error",
|
|
199
|
-
"rest-spread-spacing": "error",
|
|
200
|
-
"semi": "error",
|
|
201
|
-
"semi-spacing": "error",
|
|
202
|
-
"semi-style": "error",
|
|
203
|
-
"sort-imports": ["error", {
|
|
204
|
-
"ignoreCase": false,
|
|
205
|
-
"ignoreDeclarationSort": false,
|
|
206
|
-
"ignoreMemberSort": false,
|
|
207
|
-
"allowSeparatedGroups": true
|
|
208
|
-
}],
|
|
209
|
-
"sort-keys": "off",
|
|
210
|
-
"sort-vars": "error",
|
|
211
|
-
"space-before-blocks": "error",
|
|
212
|
-
"space-before-function-paren": ["error", "never"],
|
|
213
|
-
"space-in-parens": "error",
|
|
214
|
-
"space-infix-ops": "error",
|
|
215
|
-
"space-unary-ops": "error",
|
|
216
|
-
"spaced-comment": "error",
|
|
217
|
-
"strict": "error",
|
|
218
|
-
"switch-colon-spacing": "error",
|
|
219
|
-
"symbol-description": "error",
|
|
220
|
-
"template-curly-spacing": "error",
|
|
221
|
-
"template-tag-spacing": "error",
|
|
222
|
-
"unicode-bom": "error",
|
|
223
|
-
"vars-on-top": "error",
|
|
224
|
-
"wrap-iife": "error",
|
|
225
|
-
"wrap-regex": "error",
|
|
226
|
-
"yield-star-spacing": "error",
|
|
227
|
-
"yoda": "error"
|
|
228
|
-
}
|
|
229
|
-
}
|
package/dist/contracts/Record.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./RecordData"), exports);
|
|
18
|
-
__exportStar(require("./ZoneData"), exports);
|
package/dist/contracts/index.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./cloudflare/index"), exports);
|
|
18
|
-
__exportStar(require("./Callbacks"), exports);
|
|
19
|
-
__exportStar(require("./DomainRecordList"), exports);
|
|
20
|
-
__exportStar(require("./Record"), exports);
|
|
21
|
-
__exportStar(require("./ZoneMap"), exports);
|
|
File without changes
|
|
File without changes
|