@theholocron/holocron-plugin-cloudflare 5.0.0-alpha.246 → 5.0.0-alpha.247
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/dist/index.d.mts +14 -26
- package/dist/index.mjs +6 -12
- package/package.json +6 -6
package/dist/index.d.mts
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import { AuthError, DeployScriptConfig, DeployScriptResult, Deployment, DeploymentProject, DeploymentProjectSettings, DeploymentRecord, DeploymentTarget, DeploymentTrigger, Dns, DnsRecord, DnsRecordRequest, ResolveTokenInput, VerifyTokenFailure, VerifyTokenResult, VerifyTokenResult as VerifyTokenResult$1, VerifyTokenSuccess, WikiProxyConfig, Workers } from "@theholocron/cli";
|
|
2
2
|
import { CloudflareClient, CloudflareClient as CloudflareClient$1, CloudflareClientOptions, createCloudflareClient } from "@theholocron/cloudflare-client";
|
|
3
|
-
|
|
4
|
-
declare
|
|
5
|
-
//#endregion
|
|
6
|
-
//#region src/capabilities/deployment.d.ts
|
|
7
|
-
declare class CloudflareDeployment implements Deployment {
|
|
3
|
+
export declare const resolveToken: (input?: ResolveTokenInput) => string;
|
|
4
|
+
export declare class CloudflareDeployment implements Deployment {
|
|
8
5
|
private readonly client;
|
|
9
6
|
private readonly accountId;
|
|
10
7
|
readonly key: "deployment";
|
|
@@ -31,9 +28,7 @@ declare class CloudflareDeployment implements Deployment {
|
|
|
31
28
|
ensureCustomDomain(projectId: string, hostname: string): Promise<DnsRecordRequest | null>;
|
|
32
29
|
private getProjectByName;
|
|
33
30
|
}
|
|
34
|
-
|
|
35
|
-
//#region src/capabilities/dns.d.ts
|
|
36
|
-
declare class CloudflareDns implements Dns {
|
|
31
|
+
export declare class CloudflareDns implements Dns {
|
|
37
32
|
private readonly client;
|
|
38
33
|
readonly key: "dns";
|
|
39
34
|
readonly providerName = "cloudflare";
|
|
@@ -56,9 +51,7 @@ declare class CloudflareDns implements Dns {
|
|
|
56
51
|
*/
|
|
57
52
|
private resolveZone;
|
|
58
53
|
}
|
|
59
|
-
|
|
60
|
-
//#region src/capabilities/workers.d.ts
|
|
61
|
-
declare class CloudflareWorkers implements Workers {
|
|
54
|
+
export declare class CloudflareWorkers implements Workers {
|
|
62
55
|
private readonly client;
|
|
63
56
|
private readonly accountId;
|
|
64
57
|
readonly key: "workers";
|
|
@@ -78,16 +71,12 @@ declare class CloudflareWorkers implements Workers {
|
|
|
78
71
|
private upsertRoute;
|
|
79
72
|
private resolveZone;
|
|
80
73
|
}
|
|
81
|
-
//#endregion
|
|
82
|
-
//#region src/verify-token.d.ts
|
|
83
74
|
interface VerifyTokenOptions {
|
|
84
75
|
baseUrl?: string;
|
|
85
76
|
fetch?: typeof fetch;
|
|
86
77
|
}
|
|
87
|
-
declare function verifyToken(token: string, opts?: VerifyTokenOptions): Promise<VerifyTokenResult$1>;
|
|
88
|
-
|
|
89
|
-
//#region src/index.d.ts
|
|
90
|
-
interface CloudflarePluginOptions extends ResolveTokenInput {
|
|
78
|
+
export declare function verifyToken(token: string, opts?: VerifyTokenOptions): Promise<VerifyTokenResult$1>;
|
|
79
|
+
export interface CloudflarePluginOptions extends ResolveTokenInput {
|
|
91
80
|
/**
|
|
92
81
|
* Cloudflare account ID. Required for Pages (deployment) operations;
|
|
93
82
|
* optional for DNS-only use.
|
|
@@ -97,18 +86,18 @@ interface CloudflarePluginOptions extends ResolveTokenInput {
|
|
|
97
86
|
baseUrl?: string;
|
|
98
87
|
fetch?: typeof fetch;
|
|
99
88
|
}
|
|
100
|
-
interface PluginContext {
|
|
89
|
+
export interface PluginContext {
|
|
101
90
|
options: CloudflarePluginOptions;
|
|
102
91
|
/** Memoized client — the token is resolved on first use, not at plugin load. */
|
|
103
92
|
client: () => CloudflareClient;
|
|
104
93
|
/** Memoized token resolver — shared by the client and the Workers capability. */
|
|
105
94
|
token: () => string;
|
|
106
95
|
}
|
|
107
|
-
declare function createContext(options?: CloudflarePluginOptions): PluginContext;
|
|
108
|
-
declare function dns(ctx: PluginContext): Dns;
|
|
109
|
-
declare function deployment(ctx: PluginContext): Deployment;
|
|
110
|
-
declare function workersCapability(ctx: PluginContext): Workers;
|
|
111
|
-
declare function createPlugin(options?: CloudflarePluginOptions): {
|
|
96
|
+
export declare function createContext(options?: CloudflarePluginOptions): PluginContext;
|
|
97
|
+
export declare function dns(ctx: PluginContext): Dns;
|
|
98
|
+
export declare function deployment(ctx: PluginContext): Deployment;
|
|
99
|
+
export declare function workersCapability(ctx: PluginContext): Workers;
|
|
100
|
+
export declare function createPlugin(options?: CloudflarePluginOptions): {
|
|
112
101
|
name: string;
|
|
113
102
|
probes: {
|
|
114
103
|
connection: import("@theholocron/cli").Probe;
|
|
@@ -119,6 +108,5 @@ declare function createPlugin(options?: CloudflarePluginOptions): {
|
|
|
119
108
|
dns: () => Dns;
|
|
120
109
|
};
|
|
121
110
|
};
|
|
122
|
-
declare const AUTH_HINT: string;
|
|
123
|
-
|
|
124
|
-
export { AUTH_HINT, AuthError, type CloudflareClient, type CloudflareClientOptions, CloudflareDeployment, CloudflareDns, CloudflarePluginOptions, CloudflareWorkers, PluginContext, type ResolveTokenInput, type VerifyTokenFailure, type VerifyTokenResult, type VerifyTokenSuccess, createCloudflareClient, createContext, createPlugin, deployment, dns, resolveToken, verifyToken, workersCapability };
|
|
111
|
+
export declare const AUTH_HINT: string;
|
|
112
|
+
export { AuthError, type CloudflareClient, type CloudflareClientOptions, type ResolveTokenInput, type VerifyTokenFailure, type VerifyTokenResult, type VerifyTokenSuccess, createCloudflareClient };
|
package/dist/index.mjs
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { AuthError, ProviderApiError, connectionProbe, createResolveToken } from "@theholocron/cli";
|
|
2
2
|
import { createCloudflareClient } from "@theholocron/cloudflare-client";
|
|
3
3
|
import { errorMessage } from "@theholocron/misc-utils";
|
|
4
|
-
|
|
4
|
+
// src/auth.ts
|
|
5
5
|
const resolveToken = createResolveToken({
|
|
6
6
|
envName: "HOLOCRON_CLOUDFLARE_TOKEN",
|
|
7
7
|
vendorEnvName: "CLOUDFLARE_API_TOKEN",
|
|
8
8
|
keyringService: "cloudflare",
|
|
9
9
|
errorMessage: "no Cloudflare API token found. Pass --token <TOKEN>, set HOLOCRON_CLOUDFLARE_TOKEN / CLOUDFLARE_API_TOKEN, or run: holocron auth set cloudflare <TOKEN>"
|
|
10
10
|
});
|
|
11
|
-
|
|
12
|
-
//#region src/capabilities/deployment.ts
|
|
11
|
+
// src/capabilities/deployment.ts
|
|
13
12
|
var CloudflareDeployment = class {
|
|
14
13
|
client;
|
|
15
14
|
accountId;
|
|
@@ -115,8 +114,7 @@ function normalizeStatus(status) {
|
|
|
115
114
|
default: return "error";
|
|
116
115
|
}
|
|
117
116
|
}
|
|
118
|
-
|
|
119
|
-
//#region src/capabilities/dns.ts
|
|
117
|
+
// src/capabilities/dns.ts
|
|
120
118
|
var CloudflareDns = class {
|
|
121
119
|
client;
|
|
122
120
|
key = "dns";
|
|
@@ -193,8 +191,7 @@ function mapRecord(raw) {
|
|
|
193
191
|
ttl: raw.ttl
|
|
194
192
|
};
|
|
195
193
|
}
|
|
196
|
-
|
|
197
|
-
//#region src/capabilities/workers.ts
|
|
194
|
+
// src/capabilities/workers.ts
|
|
198
195
|
var CloudflareWorkers = class {
|
|
199
196
|
client;
|
|
200
197
|
accountId;
|
|
@@ -272,8 +269,7 @@ function generateProxyScript(config) {
|
|
|
272
269
|
`};`
|
|
273
270
|
].join("\n");
|
|
274
271
|
}
|
|
275
|
-
|
|
276
|
-
//#region src/verify-token.ts
|
|
272
|
+
// src/verify-token.ts
|
|
277
273
|
async function verifyToken(token, opts = {}) {
|
|
278
274
|
const client = createCloudflareClient({
|
|
279
275
|
token,
|
|
@@ -304,8 +300,7 @@ async function verifyToken(token, opts = {}) {
|
|
|
304
300
|
};
|
|
305
301
|
}
|
|
306
302
|
}
|
|
307
|
-
|
|
308
|
-
//#region src/index.ts
|
|
303
|
+
// src/index.ts
|
|
309
304
|
function createContext(options = {}) {
|
|
310
305
|
const accountId = options.accountId ?? process.env.CLOUDFLARE_ACCOUNT_ID;
|
|
311
306
|
const opts = {
|
|
@@ -360,5 +355,4 @@ function createPlugin(options = {}) {
|
|
|
360
355
|
};
|
|
361
356
|
}
|
|
362
357
|
const AUTH_HINT = "create an API token at https://dash.cloudflare.com/profile/api-tokens with Zone:Read, DNS:Edit, Cloudflare Pages:Edit, Workers Scripts:Edit (account-level), and Workers Routes:Edit (zone-level) permissions, then run: holocron auth set cloudflare <TOKEN>";
|
|
363
|
-
//#endregion
|
|
364
358
|
export { AUTH_HINT, AuthError, CloudflareDeployment, CloudflareDns, CloudflareWorkers, createCloudflareClient, createContext, createPlugin, deployment, dns, resolveToken, verifyToken, workersCapability };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theholocron/holocron-plugin-cloudflare",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.247",
|
|
4
4
|
"description": "Holocron plugin for Cloudflare. Implements the dns capability against Cloudflare's REST API — zone resolution, DNS record management.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cloudflare",
|
|
@@ -38,22 +38,22 @@
|
|
|
38
38
|
"@theholocron/tsdown-config": "^8.8.2",
|
|
39
39
|
"@theholocron/vitest-config": "^8.8.2",
|
|
40
40
|
"@types/node": "^26",
|
|
41
|
-
"@vitest/coverage-v8": "^
|
|
41
|
+
"@vitest/coverage-v8": "^5.0.5",
|
|
42
42
|
"@vitest/eslint-plugin": "^1.6.27",
|
|
43
43
|
"chalk": "^6.0.0",
|
|
44
44
|
"eslint": "^10.8.1",
|
|
45
45
|
"eslint-plugin-n": "^18.3.0",
|
|
46
46
|
"globals": "^17.11.0",
|
|
47
|
-
"tsdown": "^0.
|
|
47
|
+
"tsdown": "^0.23.3",
|
|
48
48
|
"tsx": "4.23.15",
|
|
49
49
|
"typescript": "^5.9.3",
|
|
50
|
-
"vitest": "^
|
|
51
|
-
"@theholocron/cli": "5.0.0-alpha.
|
|
50
|
+
"vitest": "^5.0.5",
|
|
51
|
+
"@theholocron/cli": "5.0.0-alpha.247"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
54
|
"@theholocron/cloudflare-client": "^1.53.1",
|
|
55
55
|
"@theholocron/misc-utils": "^1.16.0",
|
|
56
|
-
"@theholocron/cli": "5.0.0-alpha.
|
|
56
|
+
"@theholocron/cli": "5.0.0-alpha.247"
|
|
57
57
|
},
|
|
58
58
|
"peerDependenciesMeta": {
|
|
59
59
|
"@theholocron/cloudflare-client": {}
|