@theholocron/holocron-plugin-cloudflare 5.0.0-alpha.275 → 5.0.0-alpha.277
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 +6 -1
- package/dist/index.mjs +20 -0
- package/package.json +6 -6
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AuthError, DeployScriptConfig, DeployScriptResult, Deployment, DeploymentProject, DeploymentProjectSettings, DeploymentRecord, DeploymentTarget, DeploymentTrigger, Dns, DnsRecord, DnsRecordRequest, PluginToken, ResolveTokenInput, VerifyTokenFailure, VerifyTokenResult, VerifyTokenResult as VerifyTokenResult$1, VerifyTokenSuccess, WikiProxyConfig, Workers } from "@theholocron/cli";
|
|
1
|
+
import { AuthError, DeployScriptConfig, DeployScriptResult, Deployment, DeploymentProject, DeploymentProjectSettings, DeploymentRecord, DeploymentTarget, DeploymentTrigger, Dns, DnsRecord, DnsRecordRequest, PluginToken, ResolveTokenInput, VerifyTokenFailure, VerifyTokenResult, VerifyTokenResult as VerifyTokenResult$1, VerifyTokenSuccess, WikiProxyConfig, WorkerScriptState, Workers } from "@theholocron/cli";
|
|
2
2
|
import { CloudflareClient, CloudflareClient as CloudflareClient$1, CloudflareClientOptions, createCloudflareClient } from "@theholocron/cloudflare-client";
|
|
3
3
|
export declare const resolveToken: import("@theholocron/cli").TokenResolver;
|
|
4
4
|
/** Every token this plugin takes, for `holocron doctor tokens`. */
|
|
@@ -69,6 +69,11 @@ export declare class CloudflareWorkers implements Workers {
|
|
|
69
69
|
deployScript(name: string, config: DeployScriptConfig): Promise<DeployScriptResult>;
|
|
70
70
|
setSecret(script: string, name: string, value: string): Promise<void>;
|
|
71
71
|
secretNames(script: string): Promise<string[]>;
|
|
72
|
+
/**
|
|
73
|
+
* Whether the script exists, which routes in the zone of `host` point at it, and the names of its secrets. Reads
|
|
74
|
+
* only, and asks Cloudflare for names, so no value is ever fetched.
|
|
75
|
+
*/
|
|
76
|
+
inspectScript(name: string, host: string): Promise<WorkerScriptState>;
|
|
72
77
|
/** Idempotent create-or-update for one route pattern — shared by both public methods. */
|
|
73
78
|
private upsertRoute;
|
|
74
79
|
private resolveZone;
|
package/dist/index.mjs
CHANGED
|
@@ -230,6 +230,26 @@ var CloudflareWorkers = class {
|
|
|
230
230
|
async secretNames(script) {
|
|
231
231
|
return (await this.client().workers.listSecrets(this.accountId, script)).map((secret) => secret.name);
|
|
232
232
|
}
|
|
233
|
+
/**
|
|
234
|
+
* Whether the script exists, which routes in the zone of `host` point at it, and the names of its secrets. Reads
|
|
235
|
+
* only, and asks Cloudflare for names, so no value is ever fetched.
|
|
236
|
+
*/
|
|
237
|
+
async inspectScript(name, host) {
|
|
238
|
+
const client = this.client();
|
|
239
|
+
if (!(await client.workers.listScripts(this.accountId)).some((s) => s.id === name)) return {
|
|
240
|
+
exists: false,
|
|
241
|
+
routes: [],
|
|
242
|
+
bindingNames: []
|
|
243
|
+
};
|
|
244
|
+
const zoneId = await this.resolveZone(host);
|
|
245
|
+
const routes = await client.workers.listRoutes(zoneId);
|
|
246
|
+
const secrets = await client.workers.listSecrets(this.accountId, name);
|
|
247
|
+
return {
|
|
248
|
+
exists: true,
|
|
249
|
+
routes: routes.filter((r) => r.script === name).map((r) => r.pattern),
|
|
250
|
+
bindingNames: secrets.map((secret) => secret.name)
|
|
251
|
+
};
|
|
252
|
+
}
|
|
233
253
|
/** Idempotent create-or-update for one route pattern — shared by both public methods. */
|
|
234
254
|
async upsertRoute(pattern, scriptName) {
|
|
235
255
|
const hostname = pattern.split("/")[0];
|
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.277",
|
|
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",
|
|
@@ -41,19 +41,19 @@
|
|
|
41
41
|
"tsx": "4.23.15",
|
|
42
42
|
"typescript": "^5.9.3",
|
|
43
43
|
"vitest": "^5.0.5",
|
|
44
|
-
"@theholocron/cli": "5.0.0-alpha.275",
|
|
45
44
|
"@theholocron/eslint-config": "^8.9.0-alpha.3",
|
|
46
|
-
"@theholocron/
|
|
45
|
+
"@theholocron/cli": "5.0.0-alpha.277",
|
|
47
46
|
"@theholocron/cloudflare-client": "^1.58.0-alpha.3",
|
|
48
|
-
"@theholocron/
|
|
47
|
+
"@theholocron/misc-utils": "^1.16.1-alpha.2",
|
|
48
|
+
"@theholocron/http-client": "^1.58.0-alpha.3",
|
|
49
49
|
"@theholocron/tsconfig": "^8.9.0-alpha.3",
|
|
50
|
-
"@theholocron/
|
|
50
|
+
"@theholocron/tsdown-config": "^8.9.0-alpha.3",
|
|
51
51
|
"@theholocron/vitest-config": "^8.9.0-alpha.3"
|
|
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.277"
|
|
57
57
|
},
|
|
58
58
|
"peerDependenciesMeta": {
|
|
59
59
|
"@theholocron/cloudflare-client": {}
|