cloudflare-ddns-sync 4.0.0-beta.2 → 4.0.0-rc.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 +13 -0
- package/MIGRATION-V4.md +64 -0
- package/README.md +91 -117
- package/dist/index.d.ts +41 -16
- package/dist/index.js +286 -40
- package/dist/lib/cloudflare-client.d.ts +16 -10
- package/dist/lib/cloudflare-client.js +119 -161
- package/dist/lib/cron.d.ts +1 -1
- package/dist/lib/cron.js +1 -3
- package/dist/lib/ip-utils.d.ts +0 -5
- package/dist/lib/ip-utils.js +0 -26
- package/dist/lib/sync-error.d.ts +12 -0
- package/dist/lib/sync-error.js +10 -0
- package/dist/lib/sync-job.d.ts +44 -0
- package/dist/lib/sync-job.js +190 -0
- package/dist/types/Auth.d.ts +5 -2
- package/dist/types/Callbacks.d.ts +3 -2
- package/dist/types/Options.d.ts +48 -0
- package/dist/types/Record.d.ts +11 -2
- package/dist/types/cloudflare/RecordData.d.ts +3 -1
- package/dist/types/index.d.ts +4 -1
- package/dist/types/index.js +4 -1
- package/logo.png +0 -0
- package/package.json +19 -16
- package/dist/types/CloudflareOptions.d.ts +0 -2
- /package/dist/types/{CloudflareOptions.js → Options.js} +0 -0
package/dist/types/Auth.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
export type
|
|
1
|
+
import { RecordData } from './index.js';
|
|
2
|
+
export type SingleSyncCallback = (syncResult: RecordData) => void;
|
|
3
|
+
export type MultiSyncCallback = (syncResult: Array<RecordData>) => void;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Auth } from './Auth.js';
|
|
2
|
+
import { DnsRecord } from './cloudflare/RecordData.js';
|
|
3
|
+
import { RecordInput } from './Record.js';
|
|
4
|
+
export type RecordSelection = RecordInput | Array<RecordInput>;
|
|
5
|
+
export type DdnsOptions = Auth & {
|
|
6
|
+
records?: RecordSelection;
|
|
7
|
+
zone?: string;
|
|
8
|
+
resolveIp?: (family: 4 | 6) => string | Promise<string>;
|
|
9
|
+
};
|
|
10
|
+
export type SyncOptions = {
|
|
11
|
+
ipv4?: string;
|
|
12
|
+
ipv6?: string;
|
|
13
|
+
};
|
|
14
|
+
export type SyncChange = {
|
|
15
|
+
record: RecordInput;
|
|
16
|
+
action: 'create' | 'update' | 'unchanged';
|
|
17
|
+
before?: DnsRecord;
|
|
18
|
+
after: RecordInput;
|
|
19
|
+
};
|
|
20
|
+
export type JobOptions = SyncOptions & {
|
|
21
|
+
records?: RecordSelection;
|
|
22
|
+
onSync?: (records: Array<DnsRecord>) => void | Promise<void>;
|
|
23
|
+
onError?: (error: Error) => void | Promise<void>;
|
|
24
|
+
};
|
|
25
|
+
export type WatchOptions = JobOptions & {
|
|
26
|
+
intervalMs?: number;
|
|
27
|
+
};
|
|
28
|
+
export type RecordListOptions = {
|
|
29
|
+
records?: RecordSelection;
|
|
30
|
+
domains?: never;
|
|
31
|
+
groupBy?: never;
|
|
32
|
+
};
|
|
33
|
+
export type DomainListOptions = {
|
|
34
|
+
records?: never;
|
|
35
|
+
domains?: string | Array<string>;
|
|
36
|
+
groupBy?: never;
|
|
37
|
+
};
|
|
38
|
+
export type GroupedDomainListOptions = {
|
|
39
|
+
records?: never;
|
|
40
|
+
domains: string | Array<string>;
|
|
41
|
+
groupBy: 'domain';
|
|
42
|
+
};
|
|
43
|
+
export type ListOptions = RecordListOptions | DomainListOptions | GroupedDomainListOptions;
|
|
44
|
+
export type SyncJob = {
|
|
45
|
+
run(): Promise<Array<DnsRecord>>;
|
|
46
|
+
start(): Promise<void>;
|
|
47
|
+
stop(): Promise<void>;
|
|
48
|
+
};
|
package/dist/types/Record.d.ts
CHANGED
|
@@ -1,2 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
export type Record =
|
|
1
|
+
export type RecordTypes = 'A' | 'AAAA' | 'CNAME' | 'HTTPS' | 'TXT' | 'LOC' | 'NS' | 'SPF' | 'CERT' | 'DNSKEY' | 'DS' | 'NAPTR' | 'SMIMEA' | 'SSHFP' | 'SVCB' | 'TLSA';
|
|
2
|
+
export type Record = {
|
|
3
|
+
name: string;
|
|
4
|
+
type?: RecordTypes;
|
|
5
|
+
proxied?: boolean;
|
|
6
|
+
ttl?: number;
|
|
7
|
+
priority?: number;
|
|
8
|
+
content?: string;
|
|
9
|
+
};
|
|
10
|
+
/** A hostname or a DNS record with explicit options. */
|
|
11
|
+
export type RecordInput = string | Record;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RecordTypes } from '../index.js';
|
|
2
|
-
export type
|
|
2
|
+
export type DnsRecord = {
|
|
3
3
|
id: string;
|
|
4
4
|
type: RecordTypes;
|
|
5
5
|
name: string;
|
|
@@ -14,6 +14,8 @@ export type RecordData = {
|
|
|
14
14
|
created_on: string;
|
|
15
15
|
meta: RecordMetaData;
|
|
16
16
|
};
|
|
17
|
+
/** @deprecated Use DnsRecord. */
|
|
18
|
+
export type RecordData = DnsRecord;
|
|
17
19
|
export type RecordMetaData = {
|
|
18
20
|
auto_added: boolean;
|
|
19
21
|
managed_by_apps: boolean;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './cloudflare/index.js';
|
|
2
|
+
export * from './Auth.js';
|
|
2
3
|
export * from './Callbacks.js';
|
|
4
|
+
export * from './DomainRecordList.js';
|
|
3
5
|
export * from './Record.js';
|
|
6
|
+
export * from './Options.js';
|
|
4
7
|
export * from './ZoneMap.js';
|
package/dist/types/index.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './cloudflare/index.js';
|
|
2
|
+
export * from './Auth.js';
|
|
2
3
|
export * from './Callbacks.js';
|
|
4
|
+
export * from './DomainRecordList.js';
|
|
3
5
|
export * from './Record.js';
|
|
6
|
+
export * from './Options.js';
|
|
4
7
|
export * from './ZoneMap.js';
|
package/logo.png
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cloudflare-ddns-sync",
|
|
3
|
-
"version": "4.0.0-
|
|
3
|
+
"version": "4.0.0-rc.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>",
|
|
@@ -20,32 +20,35 @@
|
|
|
20
20
|
"url": "git://github.com:Steffen982/cloudflare-ddns-sync.git"
|
|
21
21
|
},
|
|
22
22
|
"scripts": {
|
|
23
|
-
"
|
|
23
|
+
"clean": "rm -rf dist coverage",
|
|
24
|
+
"build": "npm run clean && tsc",
|
|
24
25
|
"lint": "prettier -c ./src",
|
|
25
26
|
"lint:fix": "prettier -w ./src",
|
|
27
|
+
"prepublishOnly": "npm run lint && npm run build",
|
|
26
28
|
"test": "c8 mocha dist/tests/*.js --timeout 15000 --exit",
|
|
27
29
|
"test:coverage": "npm run test:coverage-check && npm run test:coverage-report",
|
|
28
30
|
"test:coverage-check": "c8 check-coverage --lines 70 --functions 70 --branches 70",
|
|
29
31
|
"test:coverage-report": "c8 report"
|
|
30
32
|
},
|
|
31
33
|
"dependencies": {
|
|
32
|
-
"cloudflare": "
|
|
33
|
-
"node-cron": "
|
|
34
|
-
"parse-domain": "8.0
|
|
35
|
-
"public-ip": "
|
|
34
|
+
"cloudflare": "7.1.0",
|
|
35
|
+
"node-cron": "4.6.0",
|
|
36
|
+
"parse-domain": "8.4.0",
|
|
37
|
+
"public-ip": "8.0.0"
|
|
36
38
|
},
|
|
37
39
|
"devDependencies": {
|
|
38
|
-
"@types/chai": "
|
|
39
|
-
"@types/cloudflare": "^2.7.14",
|
|
40
|
+
"@types/chai": "5.2.3",
|
|
40
41
|
"@types/minimist": "1.2.5",
|
|
41
|
-
"@types/mocha": "10.0.
|
|
42
|
-
"@types/node": "
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"chai": "5.1.0",
|
|
42
|
+
"@types/mocha": "10.0.10",
|
|
43
|
+
"@types/node": "26.5.0",
|
|
44
|
+
"c8": "12.0.0",
|
|
45
|
+
"chai": "6.2.2",
|
|
46
46
|
"minimist": "1.2.8",
|
|
47
|
-
"mocha": "
|
|
48
|
-
"prettier": "
|
|
49
|
-
"typescript": "
|
|
47
|
+
"mocha": "12.0.0",
|
|
48
|
+
"prettier": "3.9.6",
|
|
49
|
+
"typescript": "7.0.2"
|
|
50
|
+
},
|
|
51
|
+
"engines": {
|
|
52
|
+
"node": ">=20"
|
|
50
53
|
}
|
|
51
54
|
}
|
|
File without changes
|