@theholocron/holocron-plugin-cloudflare 5.0.0-alpha.427 → 5.0.0-alpha.428
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.mjs +8 -7
- package/package.json +5 -5
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AuthError, ProviderApiError, connectionProbe, createResolveToken, resolveValue } from "@theholocron/cli";
|
|
1
|
+
import { AuthError, ProviderApiError, connectionProbe, createResolveToken, resolveValue, tokenExpectations } from "@theholocron/cli";
|
|
2
2
|
import { PREFIX } from "@theholocron/env-utils/lookup";
|
|
3
3
|
import { errorMessage } from "@theholocron/misc-utils";
|
|
4
4
|
import { createCloudflareClient } from "@theholocron/cloudflare-client";
|
|
@@ -15,9 +15,10 @@ const EVERYTHING = {
|
|
|
15
15
|
* What each layer's Cloudflare token is meant to carry, the same as "What each Cloudflare token needs" in
|
|
16
16
|
* `docs/src/content/docs/tokens.mdx`: a laptop (`local` inherits `dev`) runs everything, CI only deploys Pages, so a
|
|
17
17
|
* leak from CI cannot change DNS, Workers or a tunnel. A layer not listed (`prod`) has no declared expectations and its
|
|
18
|
-
* token is only reported.
|
|
18
|
+
* token is only reported. This is the plugin's `tokens` declaration, read through `tokenExpectations()`; change it and
|
|
19
|
+
* that table together.
|
|
19
20
|
*/
|
|
20
|
-
const
|
|
21
|
+
const EXPECTED = { permissions: {
|
|
21
22
|
local: EVERYTHING,
|
|
22
23
|
dev: EVERYTHING,
|
|
23
24
|
ci: {
|
|
@@ -28,7 +29,7 @@ const EXPECTED_BY_LAYER = {
|
|
|
28
29
|
pages: "required",
|
|
29
30
|
tunnels: "absent"
|
|
30
31
|
}
|
|
31
|
-
};
|
|
32
|
+
} };
|
|
32
33
|
// src/auth.ts
|
|
33
34
|
/** Resolves the Cloudflare API token from `--token`, `HOLOCRON_CLOUDFLARE_TOKEN`, `CLOUDFLARE_API_TOKEN` or the keyring, and throws an `AuthError` when none is set. */
|
|
34
35
|
const resolveToken = createResolveToken({
|
|
@@ -40,7 +41,7 @@ const resolveToken = createResolveToken({
|
|
|
40
41
|
/** Every token this plugin takes, for `holocron doctor tokens`, with what each layer's token must and must not be able to do. */
|
|
41
42
|
const tokens = [{
|
|
42
43
|
...resolveToken.token,
|
|
43
|
-
expect:
|
|
44
|
+
expect: EXPECTED
|
|
44
45
|
}];
|
|
45
46
|
// src/capabilities/deployment.ts
|
|
46
47
|
/** The Cloudflare implementation of the `deployment` capability, backed by Cloudflare Pages projects in one account. */
|
|
@@ -492,7 +493,7 @@ function rowFor({ label, outcome }, rule) {
|
|
|
492
493
|
* `--token cloudflare=<token>` or `--environment <layer>` checks another one; the account id is the plugin's own.
|
|
493
494
|
*
|
|
494
495
|
* A token with no layer is only described. When the CLI passes `--layer` (because `--environment` named `ci`, `dev` or
|
|
495
|
-
* `local`), the results are judged against what that layer's token is meant to carry (`
|
|
496
|
+
* `local`), the results are judged against what that layer's token is meant to carry (the plugin's `tokens` declaration, read with `tokenExpectations()`) and shown in
|
|
496
497
|
* two groups, what it should have and what it should not, where a missing or extra permission fails. The other words
|
|
497
498
|
* limit the zone checks to those zones; otherwise up to five are read. How the token is chosen is in `holocron probe --help`.
|
|
498
499
|
*/
|
|
@@ -506,7 +507,7 @@ function tokenProbe(ctx) {
|
|
|
506
507
|
probe.secret(token);
|
|
507
508
|
const client = ctx.client();
|
|
508
509
|
const { layer, zones: wanted } = parseTokenArgs(probe.args ?? []);
|
|
509
|
-
const rules = layer ?
|
|
510
|
+
const rules = layer ? tokenExpectations(tokens, { layer })[0]?.rules : void 0;
|
|
510
511
|
if (layer && !rules) probe.say({
|
|
511
512
|
status: "info",
|
|
512
513
|
label: layer,
|
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.428",
|
|
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",
|
|
@@ -45,19 +45,19 @@
|
|
|
45
45
|
"typescript": "^5.9.3",
|
|
46
46
|
"vitest": "^5.1.0",
|
|
47
47
|
"@theholocron/cloudflare-client": "^1.58.0-alpha.29",
|
|
48
|
-
"@theholocron/cli": "5.0.0-alpha.427",
|
|
49
48
|
"@theholocron/eslint-config": "^8.9.0-alpha.17",
|
|
50
49
|
"@theholocron/http-client": "^1.58.0-alpha.29",
|
|
51
|
-
"@theholocron/kyber": "5.0.0-alpha.
|
|
50
|
+
"@theholocron/kyber": "5.0.0-alpha.428",
|
|
52
51
|
"@theholocron/tsconfig": "^8.9.0-alpha.17",
|
|
52
|
+
"@theholocron/misc-utils": "^1.17.0-alpha.4",
|
|
53
53
|
"@theholocron/vitest-config": "^8.9.0-alpha.17",
|
|
54
54
|
"@theholocron/tsdown-config": "^8.9.0-alpha.17",
|
|
55
|
-
"@theholocron/
|
|
55
|
+
"@theholocron/cli": "5.0.0-alpha.428"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
58
58
|
"@theholocron/cloudflare-client": "^1.53.1",
|
|
59
59
|
"@theholocron/misc-utils": "^1.16.0",
|
|
60
|
-
"@theholocron/cli": "5.0.0-alpha.
|
|
60
|
+
"@theholocron/cli": "5.0.0-alpha.428"
|
|
61
61
|
},
|
|
62
62
|
"peerDependenciesMeta": {
|
|
63
63
|
"@theholocron/cloudflare-client": {}
|