@theholocron/holocron-plugin-cloudflare 5.0.0-alpha.567 → 5.0.0-alpha.569

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 CHANGED
@@ -180,6 +180,7 @@ export declare function createPlugin(options?: CloudflarePluginOptions): {
180
180
  whoami: import("@theholocron/cli").ProviderAction;
181
181
  mintToken: (input: MintTokenInput) => Promise<import("@theholocron/cli").MintTokenResult>;
182
182
  revokeToken: (input: RevokeTokenInput) => Promise<import("@theholocron/cli").RevokeTokenResult>;
183
+ readTokenId: () => Promise<string | undefined>;
183
184
  capabilities: {
184
185
  deployment?: (() => Deployment) | undefined;
185
186
  workers?: (() => Workers) | undefined;
package/dist/index.mjs CHANGED
@@ -893,6 +893,21 @@ function tokenProbe(ctx) {
893
893
  }
894
894
  };
895
895
  }
896
+ // src/read-token-id/read-token-id.ts
897
+ /**
898
+ * The id of the Cloudflare token this plugin was built with, from `GET /user/tokens/verify` (`result.id`), the id
899
+ * `provider cloudflare revoke` takes. A token with `User: API Tokens Read` can ask; an account or zone token is refused
900
+ * with a 401 or 403, which is `undefined` ("Cloudflare cannot say"), not a failure. Any other failure is thrown. No
901
+ * token value is read or returned.
902
+ */
903
+ async function readCloudflareTokenId(ctx) {
904
+ try {
905
+ return (await ctx.client().tokens.verify()).id || void 0;
906
+ } catch (err) {
907
+ if (err instanceof ProviderApiError && (err.status === 401 || err.status === 403)) return void 0;
908
+ throw err;
909
+ }
910
+ }
896
911
  // src/revoke-token/revoke-token.ts
897
912
  const AFTER = "anything still using the token stops working; make sure its replacement is in place (`holocron sync secrets --env <layer>`)";
898
913
  /**
@@ -1042,6 +1057,7 @@ function createPlugin(options = {}) {
1042
1057
  }),
1043
1058
  mintToken: (input) => mintCloudflareToken(ctx, input),
1044
1059
  revokeToken: (input) => revokeCloudflareToken(ctx, input),
1060
+ readTokenId: () => readCloudflareTokenId(ctx),
1045
1061
  capabilities: {
1046
1062
  dns: () => dns(ctx),
1047
1063
  ...ctx.options.accountId ? {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theholocron/holocron-plugin-cloudflare",
3
- "version": "5.0.0-alpha.567",
3
+ "version": "5.0.0-alpha.569",
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",
@@ -30,7 +30,7 @@
30
30
  "dist"
31
31
  ],
32
32
  "dependencies": {
33
- "@theholocron/env-utils": "^1.17.0-alpha.8"
33
+ "@theholocron/env-utils": "^1.17.0-alpha.9"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@types/node": "^26",
@@ -44,20 +44,20 @@
44
44
  "tsx": "4.23.15",
45
45
  "typescript": "^6.0.3",
46
46
  "vitest": "^5.1.1",
47
- "@theholocron/cli": "5.0.0-alpha.567",
48
- "@theholocron/cloudflare-client": "^1.58.0-alpha.65",
47
+ "@theholocron/cli": "5.0.0-alpha.569",
48
+ "@theholocron/cloudflare-client": "^1.58.0-alpha.66",
49
49
  "@theholocron/eslint-config": "^8.9.0-alpha.24",
50
- "@theholocron/http-client": "^1.58.0-alpha.65",
51
- "@theholocron/kyber": "5.0.0-alpha.567",
52
- "@theholocron/misc-utils": "^1.17.0-alpha.8",
50
+ "@theholocron/http-client": "^1.58.0-alpha.66",
51
+ "@theholocron/kyber": "5.0.0-alpha.569",
52
+ "@theholocron/misc-utils": "^1.17.0-alpha.9",
53
53
  "@theholocron/tsconfig": "^8.9.0-alpha.24",
54
54
  "@theholocron/tsdown-config": "^8.9.0-alpha.24",
55
55
  "@theholocron/vitest-config": "^8.9.0-alpha.24"
56
56
  },
57
57
  "peerDependencies": {
58
- "@theholocron/cloudflare-client": "^1.53.1",
58
+ "@theholocron/cloudflare-client": "^1.58.0",
59
59
  "@theholocron/misc-utils": "^1.16.0",
60
- "@theholocron/cli": "5.0.0-alpha.567"
60
+ "@theholocron/cli": "5.0.0-alpha.569"
61
61
  },
62
62
  "peerDependenciesMeta": {
63
63
  "@theholocron/cloudflare-client": {}