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.
@@ -1,2 +1,5 @@
1
- import Cloudflare from 'cloudflare';
2
- export type Auth = Cloudflare.AuthObject;
1
+ export type Auth = {
2
+ email?: string | undefined;
3
+ key?: string | undefined;
4
+ token?: string | undefined;
5
+ };
@@ -1,2 +1,3 @@
1
- import Cloudflare from 'cloudflare';
2
- export type MultiSyncCallback = (syncResult: Cloudflare.DNS.DNSRecord[]) => void;
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
+ };
@@ -1,2 +1,11 @@
1
- import { Cloudflare } from 'cloudflare';
2
- export type Record = Cloudflare.DNS.DNSRecord;
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 RecordData = {
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;
@@ -1,4 +1,7 @@
1
- export * from './CloudflareOptions.js';
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';
@@ -1,4 +1,7 @@
1
- export * from './CloudflareOptions.js';
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-beta.2",
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
- "build": "tsc",
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": "3.0.0",
33
- "node-cron": "3.0.3",
34
- "parse-domain": "8.0.2",
35
- "public-ip": "6.0.2"
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": "4.3.14",
39
- "@types/cloudflare": "^2.7.14",
40
+ "@types/chai": "5.2.3",
40
41
  "@types/minimist": "1.2.5",
41
- "@types/mocha": "10.0.6",
42
- "@types/node": "20.12.7",
43
- "@types/node-cron": "3.0.11",
44
- "c8": "9.1.0",
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": "10.4.0",
48
- "prettier": "^3.2.5",
49
- "typescript": "5.4.5"
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
  }
@@ -1,2 +0,0 @@
1
- import { ClientOptions } from 'cloudflare';
2
- export type Auth = ClientOptions;
File without changes