@vigilbase/cli 0.2.0 → 0.2.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.
- package/CLOUDFLARE.md +2 -5
- package/COMMANDS.md +150 -112
- package/LOCAL.md +73 -83
- package/ONE.md +2 -4
- package/README.md +337 -171
- package/SECURITY.md +2 -2
- package/dist/auth/device-auth.d.ts +0 -1
- package/dist/auth/device-auth.js +6 -5
- package/dist/auth/index.d.ts +1 -2
- package/dist/auth/index.js +1 -2
- package/dist/auth/provider.d.ts +1 -1
- package/dist/auth/provider.js +16 -7
- package/dist/auth/refresh.d.ts +23 -4
- package/dist/auth/refresh.js +78 -22
- package/dist/auth/store.d.ts +78 -4
- package/dist/auth/store.js +385 -74
- package/dist/auth/token-metadata.d.ts +0 -1
- package/dist/auth/token-metadata.js +0 -1
- package/dist/auth/types.d.ts +0 -1
- package/dist/auth/types.js +0 -1
- package/dist/bin.d.ts +0 -1
- package/dist/bin.js +0 -1
- package/dist/cli.d.ts +4 -2
- package/dist/cli.js +7 -8
- package/dist/commands/account.d.ts +0 -1
- package/dist/commands/account.js +0 -1
- package/dist/commands/auth.d.ts +0 -1
- package/dist/commands/auth.js +69 -21
- package/dist/commands/billing.d.ts +0 -1
- package/dist/commands/billing.js +0 -1
- package/dist/commands/cloudflare.d.ts +1 -2
- package/dist/commands/cloudflare.js +6 -6
- package/dist/commands/helpers.d.ts +0 -1
- package/dist/commands/helpers.js +0 -1
- package/dist/commands/index.d.ts +0 -1
- package/dist/commands/index.js +0 -1
- package/dist/commands/legacy-validation.d.ts +0 -1
- package/dist/commands/legacy-validation.js +0 -1
- package/dist/commands/local.d.ts +6 -1
- package/dist/commands/local.js +34 -11
- package/dist/commands/one.d.ts +0 -1
- package/dist/commands/one.js +6 -7
- package/dist/commands/public-tools.d.ts +0 -1
- package/dist/commands/public-tools.js +52 -18
- package/dist/commands/runs.d.ts +0 -1
- package/dist/commands/runs.js +0 -1
- package/dist/commands/security.d.ts +1 -2
- package/dist/commands/security.js +1 -2
- package/dist/commands/watchdog.d.ts +0 -1
- package/dist/commands/watchdog.js +0 -1
- package/dist/index.d.ts +2 -3
- package/dist/index.js +1 -2
- package/dist/lib/banner.d.ts +0 -1
- package/dist/lib/banner.js +0 -1
- package/dist/lib/client.d.ts +4 -2
- package/dist/lib/client.js +42 -18
- package/dist/lib/cloudflare-client.d.ts +0 -1
- package/dist/lib/cloudflare-client.js +0 -1
- package/dist/lib/config.d.ts +16 -3
- package/dist/lib/config.js +41 -14
- package/dist/lib/format.d.ts +2 -1
- package/dist/lib/format.js +19 -8
- package/dist/lib/help.d.ts +1 -2
- package/dist/lib/help.js +29 -18
- package/dist/lib/network.d.ts +10 -1
- package/dist/lib/network.js +31 -4
- package/dist/lib/one-client.d.ts +2 -1
- package/dist/lib/one-client.js +3 -1
- package/dist/lib/one-operations.d.ts +0 -1
- package/dist/lib/one-operations.js +0 -1
- package/dist/lib/open-url.d.ts +0 -1
- package/dist/lib/open-url.js +0 -1
- package/dist/lib/platform.d.ts +2 -0
- package/dist/lib/platform.js +4 -0
- package/dist/lib/progress.d.ts +0 -1
- package/dist/lib/progress.js +0 -1
- package/dist/lib/security-client.d.ts +0 -1
- package/dist/lib/security-client.js +0 -1
- package/dist/lib/skill-fetch.d.ts +0 -1
- package/dist/lib/skill-fetch.js +0 -1
- package/dist/lib/system-trust.d.ts +0 -1
- package/dist/lib/system-trust.js +0 -1
- package/dist/lib/tui.d.ts +0 -1
- package/dist/lib/tui.js +0 -1
- package/dist/local/cloudflare-checkup/cf/allowlist.d.ts +0 -1
- package/dist/local/cloudflare-checkup/cf/allowlist.js +0 -1
- package/dist/local/cloudflare-checkup/cf/auth-lifecycle.d.ts +0 -1
- package/dist/local/cloudflare-checkup/cf/auth-lifecycle.js +0 -1
- package/dist/local/cloudflare-checkup/cf/child-env.d.ts +0 -1
- package/dist/local/cloudflare-checkup/cf/child-env.js +0 -1
- package/dist/local/cloudflare-checkup/cf/install.d.ts +0 -1
- package/dist/local/cloudflare-checkup/cf/install.js +0 -1
- package/dist/local/cloudflare-checkup/cf/locate.d.ts +0 -1
- package/dist/local/cloudflare-checkup/cf/locate.js +0 -1
- package/dist/local/cloudflare-checkup/cf/run-cf.d.ts +0 -1
- package/dist/local/cloudflare-checkup/cf/run-cf.js +0 -1
- package/dist/local/cloudflare-checkup/collector.d.ts +0 -1
- package/dist/local/cloudflare-checkup/collector.js +0 -1
- package/dist/local/cloudflare-checkup/contract.d.ts +14 -3
- package/dist/local/cloudflare-checkup/contract.js +9 -3
- package/dist/local/cloudflare-checkup/email-verification.d.ts +0 -1
- package/dist/local/cloudflare-checkup/email-verification.js +0 -1
- package/dist/local/cloudflare-checkup/errors.d.ts +2 -1
- package/dist/local/cloudflare-checkup/errors.js +6 -2
- package/dist/local/cloudflare-checkup/output.d.ts +0 -1
- package/dist/local/cloudflare-checkup/output.js +0 -1
- package/dist/local/cloudflare-checkup/prompts.d.ts +0 -1
- package/dist/local/cloudflare-checkup/prompts.js +0 -1
- package/dist/local/cloudflare-checkup/rate-budget.d.ts +0 -1
- package/dist/local/cloudflare-checkup/rate-budget.js +0 -1
- package/dist/local/cloudflare-checkup/snapshot-file.d.ts +0 -1
- package/dist/local/cloudflare-checkup/snapshot-file.js +0 -1
- package/dist/local/cloudflare-checkup/submit-client.d.ts +19 -5
- package/dist/local/cloudflare-checkup/submit-client.js +63 -17
- package/dist/local/cloudflare-checkup/terminal-ui.d.ts +0 -1
- package/dist/local/cloudflare-checkup/terminal-ui.js +0 -1
- package/dist/types.d.ts +25 -3
- package/dist/types.js +16 -1
- package/dist/version.d.ts +0 -1
- package/dist/version.js +0 -1
- package/package.json +5 -9
- package/dist/auth/device-auth.d.ts.map +0 -1
- package/dist/auth/device-auth.js.map +0 -1
- package/dist/auth/index.d.ts.map +0 -1
- package/dist/auth/index.js.map +0 -1
- package/dist/auth/provider.d.ts.map +0 -1
- package/dist/auth/provider.js.map +0 -1
- package/dist/auth/refresh.d.ts.map +0 -1
- package/dist/auth/refresh.js.map +0 -1
- package/dist/auth/store.d.ts.map +0 -1
- package/dist/auth/store.js.map +0 -1
- package/dist/auth/token-metadata.d.ts.map +0 -1
- package/dist/auth/token-metadata.js.map +0 -1
- package/dist/auth/types.d.ts.map +0 -1
- package/dist/auth/types.js.map +0 -1
- package/dist/bin.d.ts.map +0 -1
- package/dist/bin.js.map +0 -1
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/commands/account.d.ts.map +0 -1
- package/dist/commands/account.js.map +0 -1
- package/dist/commands/auth.d.ts.map +0 -1
- package/dist/commands/auth.js.map +0 -1
- package/dist/commands/billing.d.ts.map +0 -1
- package/dist/commands/billing.js.map +0 -1
- package/dist/commands/cloudflare.d.ts.map +0 -1
- package/dist/commands/cloudflare.js.map +0 -1
- package/dist/commands/helpers.d.ts.map +0 -1
- package/dist/commands/helpers.js.map +0 -1
- package/dist/commands/index.d.ts.map +0 -1
- package/dist/commands/index.js.map +0 -1
- package/dist/commands/legacy-validation.d.ts.map +0 -1
- package/dist/commands/legacy-validation.js.map +0 -1
- package/dist/commands/local.d.ts.map +0 -1
- package/dist/commands/local.js.map +0 -1
- package/dist/commands/one.d.ts.map +0 -1
- package/dist/commands/one.js.map +0 -1
- package/dist/commands/public-tools.d.ts.map +0 -1
- package/dist/commands/public-tools.js.map +0 -1
- package/dist/commands/runs.d.ts.map +0 -1
- package/dist/commands/runs.js.map +0 -1
- package/dist/commands/security.d.ts.map +0 -1
- package/dist/commands/security.js.map +0 -1
- package/dist/commands/watchdog.d.ts.map +0 -1
- package/dist/commands/watchdog.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/lib/banner.d.ts.map +0 -1
- package/dist/lib/banner.js.map +0 -1
- package/dist/lib/client.d.ts.map +0 -1
- package/dist/lib/client.js.map +0 -1
- package/dist/lib/cloudflare-client.d.ts.map +0 -1
- package/dist/lib/cloudflare-client.js.map +0 -1
- package/dist/lib/config.d.ts.map +0 -1
- package/dist/lib/config.js.map +0 -1
- package/dist/lib/format.d.ts.map +0 -1
- package/dist/lib/format.js.map +0 -1
- package/dist/lib/help.d.ts.map +0 -1
- package/dist/lib/help.js.map +0 -1
- package/dist/lib/network.d.ts.map +0 -1
- package/dist/lib/network.js.map +0 -1
- package/dist/lib/one-client.d.ts.map +0 -1
- package/dist/lib/one-client.js.map +0 -1
- package/dist/lib/one-operations.d.ts.map +0 -1
- package/dist/lib/one-operations.js.map +0 -1
- package/dist/lib/open-url.d.ts.map +0 -1
- package/dist/lib/open-url.js.map +0 -1
- package/dist/lib/progress.d.ts.map +0 -1
- package/dist/lib/progress.js.map +0 -1
- package/dist/lib/security-client.d.ts.map +0 -1
- package/dist/lib/security-client.js.map +0 -1
- package/dist/lib/skill-fetch.d.ts.map +0 -1
- package/dist/lib/skill-fetch.js.map +0 -1
- package/dist/lib/system-trust.d.ts.map +0 -1
- package/dist/lib/system-trust.js.map +0 -1
- package/dist/lib/tui.d.ts.map +0 -1
- package/dist/lib/tui.js.map +0 -1
- package/dist/local/cloudflare-checkup/cf/allowlist.d.ts.map +0 -1
- package/dist/local/cloudflare-checkup/cf/allowlist.js.map +0 -1
- package/dist/local/cloudflare-checkup/cf/auth-lifecycle.d.ts.map +0 -1
- package/dist/local/cloudflare-checkup/cf/auth-lifecycle.js.map +0 -1
- package/dist/local/cloudflare-checkup/cf/child-env.d.ts.map +0 -1
- package/dist/local/cloudflare-checkup/cf/child-env.js.map +0 -1
- package/dist/local/cloudflare-checkup/cf/install.d.ts.map +0 -1
- package/dist/local/cloudflare-checkup/cf/install.js.map +0 -1
- package/dist/local/cloudflare-checkup/cf/locate.d.ts.map +0 -1
- package/dist/local/cloudflare-checkup/cf/locate.js.map +0 -1
- package/dist/local/cloudflare-checkup/cf/run-cf.d.ts.map +0 -1
- package/dist/local/cloudflare-checkup/cf/run-cf.js.map +0 -1
- package/dist/local/cloudflare-checkup/collector.d.ts.map +0 -1
- package/dist/local/cloudflare-checkup/collector.js.map +0 -1
- package/dist/local/cloudflare-checkup/contract.d.ts.map +0 -1
- package/dist/local/cloudflare-checkup/contract.js.map +0 -1
- package/dist/local/cloudflare-checkup/email-verification.d.ts.map +0 -1
- package/dist/local/cloudflare-checkup/email-verification.js.map +0 -1
- package/dist/local/cloudflare-checkup/errors.d.ts.map +0 -1
- package/dist/local/cloudflare-checkup/errors.js.map +0 -1
- package/dist/local/cloudflare-checkup/output.d.ts.map +0 -1
- package/dist/local/cloudflare-checkup/output.js.map +0 -1
- package/dist/local/cloudflare-checkup/prompts.d.ts.map +0 -1
- package/dist/local/cloudflare-checkup/prompts.js.map +0 -1
- package/dist/local/cloudflare-checkup/rate-budget.d.ts.map +0 -1
- package/dist/local/cloudflare-checkup/rate-budget.js.map +0 -1
- package/dist/local/cloudflare-checkup/snapshot-file.d.ts.map +0 -1
- package/dist/local/cloudflare-checkup/snapshot-file.js.map +0 -1
- package/dist/local/cloudflare-checkup/submit-client.d.ts.map +0 -1
- package/dist/local/cloudflare-checkup/submit-client.js.map +0 -1
- package/dist/local/cloudflare-checkup/terminal-ui.d.ts.map +0 -1
- package/dist/local/cloudflare-checkup/terminal-ui.js.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js.map +0 -1
- package/dist/version.d.ts.map +0 -1
- package/dist/version.js.map +0 -1
package/dist/lib/one-client.js
CHANGED
|
@@ -84,6 +84,8 @@ export class VigilbaseOneClient {
|
|
|
84
84
|
config;
|
|
85
85
|
accessToken;
|
|
86
86
|
managed;
|
|
87
|
+
/** The userinfo endpoint Identity discovery named for the last getSession, if it used Identity. */
|
|
88
|
+
userinfoEndpoint;
|
|
87
89
|
constructor(config, accessToken, managed = false) {
|
|
88
90
|
this.config = config;
|
|
89
91
|
this.accessToken = accessToken;
|
|
@@ -157,6 +159,7 @@ export class VigilbaseOneClient {
|
|
|
157
159
|
const issuer = this.config.authProvider?.issuer ?? (saved?.version === 2 ? saved.one?.issuer : undefined);
|
|
158
160
|
if (issuer) {
|
|
159
161
|
const provider = await identityProvider(this.config, issuer);
|
|
162
|
+
this.userinfoEndpoint = provider.userinfoEndpoint;
|
|
160
163
|
if (this.managed) {
|
|
161
164
|
const token = await managedAccessToken(this.config);
|
|
162
165
|
if (!token)
|
|
@@ -283,4 +286,3 @@ export class VigilbaseOneClient {
|
|
|
283
286
|
}, { allowStatuses: [422] });
|
|
284
287
|
}
|
|
285
288
|
}
|
|
286
|
-
//# sourceMappingURL=one-client.js.map
|
|
@@ -8,4 +8,3 @@ export interface OneOperation {
|
|
|
8
8
|
export declare function executeOneOperation(client: VigilbaseOneClient, operation: OneOperation): Promise<Record<string, unknown>>;
|
|
9
9
|
/** Render all fields, including pagination and degraded-health metadata. */
|
|
10
10
|
export declare function formatOnePayload(value: unknown, indent?: string): string[];
|
|
11
|
-
//# sourceMappingURL=one-operations.d.ts.map
|
package/dist/lib/open-url.d.ts
CHANGED
package/dist/lib/open-url.js
CHANGED
package/dist/lib/progress.d.ts
CHANGED
|
@@ -17,4 +17,3 @@ export declare function shouldShowProgress(mode: 'text' | 'json', env?: NodeJS.P
|
|
|
17
17
|
}): boolean;
|
|
18
18
|
/** Tiny helper so call sites stay readable. */
|
|
19
19
|
export declare function withProgress<T>(label: string, mode: 'text' | 'json', work: () => Promise<T>, writer?: Writer): Promise<T>;
|
|
20
|
-
//# sourceMappingURL=progress.d.ts.map
|
package/dist/lib/progress.js
CHANGED
|
@@ -4,4 +4,3 @@ export declare function isPublicSkillAddress(address: string): boolean;
|
|
|
4
4
|
export declare function validateSkillUrl(raw: string): URL;
|
|
5
5
|
/** Resolve once, reject mixed private/public DNS, and pin the validated address to TLS. */
|
|
6
6
|
export declare function fetchSkillText(config: CliConfig, raw: string): Promise<string>;
|
|
7
|
-
//# sourceMappingURL=skill-fetch.d.ts.map
|
package/dist/lib/skill-fetch.js
CHANGED
package/dist/lib/system-trust.js
CHANGED
package/dist/lib/tui.d.ts
CHANGED
package/dist/lib/tui.js
CHANGED
|
@@ -29,4 +29,3 @@ export declare function childEnvVariableNames(parent: NodeJS.ProcessEnv, authMod
|
|
|
29
29
|
/** Shown in profile and default modes when the token variable is set in the parent shell. */
|
|
30
30
|
export declare function strippedTokenNotice(authMode: CfAuthMode): string;
|
|
31
31
|
export declare function missingEnvTokenMessage(): string;
|
|
32
|
-
//# sourceMappingURL=child-env.d.ts.map
|
|
@@ -78,4 +78,3 @@ export function strippedTokenNotice(authMode) {
|
|
|
78
78
|
export function missingEnvTokenMessage() {
|
|
79
79
|
return `--cf-auth env requires ${CF_TOKEN_ENV} in this shell. cf reads it itself; the Vigilbase CLI only passes it through by name.`;
|
|
80
80
|
}
|
|
81
|
-
//# sourceMappingURL=child-env.js.map
|
|
@@ -33,6 +33,8 @@ export declare const SESSION_CODE_REGEX: RegExp;
|
|
|
33
33
|
export declare const PRODUCTION_ORIGIN: "https://vigilbase.com";
|
|
34
34
|
export declare const LOCAL_SESSION_PATH: "/api/v1/tools/cloudflare-checkup/local-session";
|
|
35
35
|
export declare const LOCAL_SNAPSHOT_PATH: "/api/v1/tools/cloudflare-checkup/local-session/snapshot";
|
|
36
|
+
/** Before asking for an email, the CLI checks that local checkups are on and what they accept (no auth, no side effects). */
|
|
37
|
+
export declare const LOCAL_AVAILABILITY_PATH: "/api/v1/tools/cloudflare-checkup/local-session/availability";
|
|
36
38
|
/** The CLI asks vigilbase.com to email a verification code (no browser, no Turnstile). */
|
|
37
39
|
export declare const LOCAL_REQUEST_PATH: "/api/v1/tools/cloudflare-checkup/local-session/request";
|
|
38
40
|
/** The CLI trades the verification token and the emailed code for a session code. */
|
|
@@ -2707,6 +2709,15 @@ export declare const LocalSessionResponseSchema: z.ZodObject<{
|
|
|
2707
2709
|
minCliVersion: z.ZodString;
|
|
2708
2710
|
}, z.core.$strip>;
|
|
2709
2711
|
}, z.core.$strip>;
|
|
2712
|
+
export declare const LocalAvailabilityResponseSchema: z.ZodObject<{
|
|
2713
|
+
enabled: z.ZodLiteral<true>;
|
|
2714
|
+
minCliVersion: z.ZodString;
|
|
2715
|
+
accepts: z.ZodObject<{
|
|
2716
|
+
schemaVersions: z.ZodArray<z.ZodString>;
|
|
2717
|
+
maxBytes: z.ZodNumber;
|
|
2718
|
+
maxZones: z.ZodNumber;
|
|
2719
|
+
}, z.core.$strip>;
|
|
2720
|
+
}, z.core.$strip>;
|
|
2710
2721
|
export declare const LocalSnapshotResponseSchema: z.ZodObject<{
|
|
2711
2722
|
success: z.ZodLiteral<true>;
|
|
2712
2723
|
replayed: z.ZodBoolean;
|
|
@@ -2749,6 +2760,8 @@ export declare const LocalErrorResponseSchema: z.ZodObject<{
|
|
|
2749
2760
|
code: z.ZodString;
|
|
2750
2761
|
reason: z.ZodOptional<z.ZodEnum<{
|
|
2751
2762
|
rate_limited: "rate_limited";
|
|
2763
|
+
length_required: "length_required";
|
|
2764
|
+
unsupported_media_type: "unsupported_media_type";
|
|
2752
2765
|
snapshot_invalid: "snapshot_invalid";
|
|
2753
2766
|
snapshot_incomplete: "snapshot_incomplete";
|
|
2754
2767
|
secret_like_value: "secret_like_value";
|
|
@@ -2761,8 +2774,6 @@ export declare const LocalErrorResponseSchema: z.ZodObject<{
|
|
|
2761
2774
|
browser_origin: "browser_origin";
|
|
2762
2775
|
malformed_json: "malformed_json";
|
|
2763
2776
|
digest_mismatch: "digest_mismatch";
|
|
2764
|
-
unsupported_media_type: "unsupported_media_type";
|
|
2765
|
-
length_required: "length_required";
|
|
2766
2777
|
snapshot_too_large: "snapshot_too_large";
|
|
2767
2778
|
account_mismatch: "account_mismatch";
|
|
2768
2779
|
snapshot_stale: "snapshot_stale";
|
|
@@ -2783,6 +2794,7 @@ export declare const LocalErrorResponseSchema: z.ZodObject<{
|
|
|
2783
2794
|
}, z.core.$strip>>>;
|
|
2784
2795
|
}, z.core.$strip>;
|
|
2785
2796
|
export type LocalSessionResponse = z.infer<typeof LocalSessionResponseSchema>;
|
|
2797
|
+
export type LocalAvailabilityResponse = z.infer<typeof LocalAvailabilityResponseSchema>;
|
|
2786
2798
|
export type LocalSnapshotResponse = z.infer<typeof LocalSnapshotResponseSchema>;
|
|
2787
2799
|
export type LocalErrorResponse = z.infer<typeof LocalErrorResponseSchema>;
|
|
2788
2800
|
export type LocalRequestBody = z.infer<typeof LocalRequestBodySchema>;
|
|
@@ -2790,4 +2802,3 @@ export type LocalVerifyBody = z.infer<typeof LocalVerifyBodySchema>;
|
|
|
2790
2802
|
export type LocalRequestResponse = z.infer<typeof LocalRequestResponseSchema>;
|
|
2791
2803
|
export type LocalVerifyResponse = z.infer<typeof LocalVerifyResponseSchema>;
|
|
2792
2804
|
export {};
|
|
2793
|
-
//# sourceMappingURL=contract.d.ts.map
|
|
@@ -37,6 +37,8 @@ export const SESSION_CODE_REGEX = /^vbcs1_[A-Za-z0-9_-]{66}$/;
|
|
|
37
37
|
export const PRODUCTION_ORIGIN = 'https://vigilbase.com';
|
|
38
38
|
export const LOCAL_SESSION_PATH = '/api/v1/tools/cloudflare-checkup/local-session';
|
|
39
39
|
export const LOCAL_SNAPSHOT_PATH = '/api/v1/tools/cloudflare-checkup/local-session/snapshot';
|
|
40
|
+
/** Before asking for an email, the CLI checks that local checkups are on and what they accept (no auth, no side effects). */
|
|
41
|
+
export const LOCAL_AVAILABILITY_PATH = '/api/v1/tools/cloudflare-checkup/local-session/availability';
|
|
40
42
|
/** The CLI asks vigilbase.com to email a verification code (no browser, no Turnstile). */
|
|
41
43
|
export const LOCAL_REQUEST_PATH = '/api/v1/tools/cloudflare-checkup/local-session/request';
|
|
42
44
|
/** The CLI trades the verification token and the emailed code for a session code. */
|
|
@@ -1586,12 +1588,17 @@ export const LOCAL_ERROR_REASONS = ['session_invalid', 'session_expired', 'sessi
|
|
|
1586
1588
|
'collector_unsupported', 'secret_like_value', 'evaluation_failed', 'rate_limited', 'local_mode_disabled', 'storage_unavailable',
|
|
1587
1589
|
'request_invalid', 'email_invalid', 'code_invalid', 'verification_invalid', 'verification_expired'];
|
|
1588
1590
|
export const LOCAL_SESSION_STATES = ['awaiting_upload', 'processing', 'completed'];
|
|
1591
|
+
const LocalAcceptsSchema = z.object({ schemaVersions: z.array(z.string()).min(1), maxBytes: z.number().int().positive(),
|
|
1592
|
+
maxZones: z.number().int().positive() });
|
|
1589
1593
|
// `accountId` is null until an uploaded snapshot binds the run (the CLI chooses the account); runs created
|
|
1590
1594
|
// with an account keep it, and a completed run reports the evaluated account.
|
|
1591
1595
|
export const LocalSessionResponseSchema = z.object({ success: z.literal(true), session: z.object({ accountId: hex32.nullable(),
|
|
1592
1596
|
requester: z.string().max(260), expiresAt: iso, state: z.enum(LOCAL_SESSION_STATES),
|
|
1593
|
-
accepts:
|
|
1594
|
-
|
|
1597
|
+
accepts: LocalAcceptsSchema, minCliVersion: semver }) });
|
|
1598
|
+
// `GET local-session/availability`: local checkups are on, with what a checkup would accept. While they are
|
|
1599
|
+
// off it answers 503 `local_mode_disabled`, like every local-session route.
|
|
1600
|
+
export const LocalAvailabilityResponseSchema = z.object({ enabled: z.literal(true), minCliVersion: semver,
|
|
1601
|
+
accepts: LocalAcceptsSchema });
|
|
1595
1602
|
// `resultsUrl` is the run's results page; the CLI opens it only when it is on the upload origin.
|
|
1596
1603
|
export const LocalSnapshotResponseSchema = z.object({ success: z.literal(true), replayed: z.boolean(),
|
|
1597
1604
|
snapshotSha256: z.string().regex(/^[0-9a-f]{64}$/),
|
|
@@ -1611,4 +1618,3 @@ export const LocalVerifyResponseSchema = z.object({ success: z.literal(true), se
|
|
|
1611
1618
|
export const LocalErrorResponseSchema = z.object({ success: z.literal(false), status: z.number().int(), code: z.string(),
|
|
1612
1619
|
reason: z.enum(LOCAL_ERROR_REASONS).optional(), retryAfterSec: z.number().int().nonnegative().optional(),
|
|
1613
1620
|
issues: z.array(z.object({ path: z.string().max(200), code: z.string().max(64) })).max(20).optional() });
|
|
1614
|
-
//# sourceMappingURL=contract.js.map
|
|
@@ -122,4 +122,3 @@ export declare const SAME_ADDRESS_WAIT = "The same address can get a new code 8
|
|
|
122
122
|
* same address would be refused for 8 minutes.
|
|
123
123
|
*/
|
|
124
124
|
export declare function verifyEmail(options: EmailVerificationOptions): Promise<VerifiedEmail>;
|
|
125
|
-
//# sourceMappingURL=email-verification.d.ts.map
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export declare const LOCAL_ERROR_CODES: readonly ["NODE_UNSUPPORTED", "CF_NOT_FOUND", "CF_WRONG_BINARY", "CF_UNSUPPORTED_VERSION", "CF_ALLOWLIST_MISMATCH", "CF_INSTALL_FAILED", "CF_AUTH_REQUIRED", "CF_PERMISSION_DENIED", "CF_RATE_LIMITED", "CF_ERROR", "ACCOUNT_SELECTION_REQUIRED", "ACCOUNT_NOT_VISIBLE", "ACCOUNT_TOO_LARGE", "ACCOUNT_MISMATCH", "OUTPUT_EXISTS", "SNAPSHOT_INVALID", "SNAPSHOT_TOO_LARGE", "SNAPSHOT_STALE", "SNAPSHOT_SECRET_LIKE_VALUE", "EMAIL_INVALID", "EMAIL_CODE_INVALID", "VERIFICATION_INVALID", "VERIFICATION_EXPIRED", "SESSION_INVALID", "SESSION_EXPIRED", "SESSION_USED", "SESSION_BUSY", "SESSION_CLOSED", "SUBMIT_ORIGIN_UNTRUSTED", "CONFIRMATION_REQUIRED", "CLI_UPGRADE_REQUIRED", "LOCAL_MODE_DISABLED", "VIGILBASE_RATE_LIMITED", "VIGILBASE_CHALLENGED", "SUBMIT_FAILED"];
|
|
2
2
|
export type LocalCheckupErrorCode = (typeof LOCAL_ERROR_CODES)[number];
|
|
3
|
+
/** LOCAL_MODE_DISABLED: the browser checkup on the origin the CLI talks to (vigilbase.com, or a loopback dev server). */
|
|
4
|
+
export declare function browserCheckupHint(origin: string): string;
|
|
3
5
|
/** One fix per code; shown after the error and in `--json` as `hint`. */
|
|
4
6
|
export declare const LOCAL_ERROR_HINTS: Record<LocalCheckupErrorCode, string>;
|
|
5
7
|
/**
|
|
@@ -25,4 +27,3 @@ export declare class LocalCheckupError extends Error {
|
|
|
25
27
|
get isRateLimited(): boolean;
|
|
26
28
|
}
|
|
27
29
|
export declare function isLocalCheckupError(error: unknown): error is LocalCheckupError;
|
|
28
|
-
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
* troubleshooting accordion mirrors the code set.
|
|
9
9
|
*/
|
|
10
10
|
import { CF_TOKEN_ENV } from './cf/child-env.js';
|
|
11
|
+
import { PRODUCTION_ORIGIN } from './contract.js';
|
|
11
12
|
export const LOCAL_ERROR_CODES = [
|
|
12
13
|
// Environment and cf
|
|
13
14
|
'NODE_UNSUPPORTED', 'CF_NOT_FOUND', 'CF_WRONG_BINARY', 'CF_UNSUPPORTED_VERSION', 'CF_ALLOWLIST_MISMATCH',
|
|
@@ -25,6 +26,10 @@ export const LOCAL_ERROR_CODES = [
|
|
|
25
26
|
'VIGILBASE_RATE_LIMITED', 'VIGILBASE_CHALLENGED', 'SUBMIT_FAILED',
|
|
26
27
|
];
|
|
27
28
|
const INSTALL_CF = '`npm install --global cf@1.0.0-beta.13`';
|
|
29
|
+
/** LOCAL_MODE_DISABLED: the browser checkup on the origin the CLI talks to (vigilbase.com, or a loopback dev server). */
|
|
30
|
+
export function browserCheckupHint(origin) {
|
|
31
|
+
return `Run the Cloudflare Checkup in your browser instead: ${origin}/tools/cloudflare-checkup`;
|
|
32
|
+
}
|
|
28
33
|
/** One fix per code; shown after the error and in `--json` as `hint`. */
|
|
29
34
|
export const LOCAL_ERROR_HINTS = {
|
|
30
35
|
NODE_UNSUPPORTED: 'Install Node.js 22.18 or newer from https://nodejs.org (cf runs under the same Node), then run the same command again.',
|
|
@@ -59,7 +64,7 @@ export const LOCAL_ERROR_HINTS = {
|
|
|
59
64
|
SUBMIT_ORIGIN_UNTRUSTED: 'Upload only to https://vigilbase.com (or a loopback origin for local testing).',
|
|
60
65
|
CONFIRMATION_REQUIRED: 'Run the command in a terminal to confirm the upload, or add --yes.',
|
|
61
66
|
CLI_UPGRADE_REQUIRED: 'Run `npx @vigilbase/cli@latest cloudflare-checkup`, or upgrade with `npm install --global @vigilbase/cli@latest`.',
|
|
62
|
-
LOCAL_MODE_DISABLED:
|
|
67
|
+
LOCAL_MODE_DISABLED: browserCheckupHint(PRODUCTION_ORIGIN),
|
|
63
68
|
VIGILBASE_RATE_LIMITED: 'Too many requests to vigilbase.com. Wait as long as the error says (a few minutes if it says nothing), then run the same command again.',
|
|
64
69
|
VIGILBASE_CHALLENGED: 'vigilbase.com asked for a browser challenge. Try another network, or contact help@vigilbase.com.',
|
|
65
70
|
SUBMIT_FAILED: 'Run the same command again in a few minutes. If it persists, contact help@vigilbase.com.',
|
|
@@ -96,4 +101,3 @@ export class LocalCheckupError extends Error {
|
|
|
96
101
|
export function isLocalCheckupError(error) {
|
|
97
102
|
return error instanceof LocalCheckupError;
|
|
98
103
|
}
|
|
99
|
-
//# sourceMappingURL=errors.js.map
|
|
@@ -137,4 +137,3 @@ export async function confirmDefaultYes(io, question) {
|
|
|
137
137
|
function inputEnded(message) {
|
|
138
138
|
return new LocalCheckupError('CONFIRMATION_REQUIRED', message, { hint: 'Run the same command again and answer the question, or add --yes.' });
|
|
139
139
|
}
|
|
140
|
-
//# sourceMappingURL=prompts.js.map
|
|
@@ -39,4 +39,3 @@ export declare class RequestBudget {
|
|
|
39
39
|
}
|
|
40
40
|
/** Seconds a full bucket needs to admit `requests` calls at `limit` per 5 minutes. */
|
|
41
41
|
export declare function estimateBudgetSeconds(limit: number, requests: number, burst?: number): number;
|
|
42
|
-
//# sourceMappingURL=rate-budget.d.ts.map
|
|
@@ -50,4 +50,3 @@ export type DataCategories = {
|
|
|
50
50
|
export declare function dataCategories(snapshot: CloudflareCheckupSnapshotV1): DataCategories;
|
|
51
51
|
export declare function zoneCount(snapshot: CloudflareCheckupSnapshotV1): number;
|
|
52
52
|
export declare function accountName(snapshot: CloudflareCheckupSnapshotV1): string | null;
|
|
53
|
-
//# sourceMappingURL=snapshot-file.d.ts.map
|
|
@@ -183,4 +183,3 @@ export function accountName(snapshot) {
|
|
|
183
183
|
const account = snapshot.entries.find((entry) => entry.kind === 'account');
|
|
184
184
|
return account && account.kind === 'account' && account.result.ok ? account.result.data.name : null;
|
|
185
185
|
}
|
|
186
|
-
//# sourceMappingURL=snapshot-file.js.map
|
|
@@ -1,20 +1,26 @@
|
|
|
1
|
-
import { type LocalRequestBody, type LocalRequestResponse, type LocalSessionResponse, type LocalVerifyBody, type LocalVerifyResponse } from './contract.js';
|
|
1
|
+
import { type LocalAvailabilityResponse, type LocalRequestBody, type LocalRequestResponse, type LocalSessionResponse, type LocalVerifyBody, type LocalVerifyResponse } from './contract.js';
|
|
2
2
|
/**
|
|
3
3
|
* `GET local-session`. The account is chosen in the CLI and bound by the
|
|
4
4
|
* uploaded snapshot, so `accountId` is `null` until then; runs created before
|
|
5
5
|
* that change still carry their bound account.
|
|
6
6
|
*/
|
|
7
7
|
export type LocalSession = LocalSessionResponse['session'];
|
|
8
|
+
/** `GET local-session/availability`: local checkups are on, with the oldest CLI and the snapshots vigilbase.com accepts. */
|
|
9
|
+
export type LocalAvailability = LocalAvailabilityResponse;
|
|
8
10
|
/** `POST local-session/request`: the token naming the run that awaits its emailed code. */
|
|
9
11
|
export type PendingVerification = LocalRequestResponse['verification'];
|
|
10
12
|
/** `POST local-session/verify`: the session code for the upload (kept in memory only). */
|
|
11
13
|
export type VerifiedSession = LocalVerifyResponse['session'];
|
|
12
14
|
export declare const GET_TIMEOUT_MS = 30000;
|
|
15
|
+
/** The availability check is skipped (the run goes on) when vigilbase.com does not answer it within this. */
|
|
16
|
+
export declare const AVAILABILITY_TIMEOUT_MS = 10000;
|
|
13
17
|
export declare const POST_TIMEOUT_MS = 120000;
|
|
14
18
|
export declare const MAX_SUBMIT_RESPONSE_BYTES: number;
|
|
15
19
|
export declare const POST_RETRY_DELAYS_MS: readonly [2000, 5000];
|
|
16
20
|
/** A verify that failed on the network or with a 503 is sent once more, after this pause. */
|
|
17
21
|
export declare const VERIFY_RETRY_DELAYS_MS: readonly [2000];
|
|
22
|
+
/** True for http(s) loopback origins (local development), the only ones besides production that `--base-url` accepts. */
|
|
23
|
+
export declare function isLoopbackOrigin(origin: string): boolean;
|
|
18
24
|
/**
|
|
19
25
|
* The submit origin. Only `https://vigilbase.com` and loopback origins are
|
|
20
26
|
* accepted; there is no `*.vigilbase.com` wildcard (other subdomains are
|
|
@@ -52,7 +58,8 @@ declare abstract class LocalHttpClient {
|
|
|
52
58
|
}>;
|
|
53
59
|
}
|
|
54
60
|
/**
|
|
55
|
-
*
|
|
61
|
+
* The requests before the session code, without a bearer: the availability
|
|
62
|
+
* check and the email verification. A code request is never retried: a
|
|
56
63
|
* repeated request would send a second email. A verify that failed on the
|
|
57
64
|
* network (or timed out) or with a 503 is sent once more, after 2 s, with the
|
|
58
65
|
* same token and code: One counts only wrong codes, and the right code
|
|
@@ -61,6 +68,14 @@ declare abstract class LocalHttpClient {
|
|
|
61
68
|
*/
|
|
62
69
|
export declare class VerificationClient extends LocalHttpClient {
|
|
63
70
|
private postJson;
|
|
71
|
+
/**
|
|
72
|
+
* `GET local-session/availability`, before the email is asked for: what
|
|
73
|
+
* vigilbase.com accepts, or null when it gave no usable answer (a 404 from a
|
|
74
|
+
* server without the route, a network error, a timeout, a challenge or any
|
|
75
|
+
* other response), and the run goes on as before. Throws LOCAL_MODE_DISABLED
|
|
76
|
+
* when it answers that local checkups are switched off. Never retried.
|
|
77
|
+
*/
|
|
78
|
+
availability(): Promise<LocalAvailability | null>;
|
|
64
79
|
/** `POST local-session/request`: vigilbase.com emails a 6-digit code and returns the token for it. */
|
|
65
80
|
requestCode(body: LocalRequestBody): Promise<PendingVerification>;
|
|
66
81
|
/** `POST local-session/verify`: trades the token and the emailed code for a session code (the next one on every call). */
|
|
@@ -87,12 +102,11 @@ export declare class SubmitClient extends LocalHttpClient {
|
|
|
87
102
|
*/
|
|
88
103
|
postSnapshot(bytes: Buffer, sha256: string): Promise<UploadResult>;
|
|
89
104
|
}
|
|
90
|
-
/** Refuse a server that requires a newer CLI, or does not accept this schema version. */
|
|
91
|
-
export declare function
|
|
105
|
+
/** Refuse a server (its session, or its availability answer) that requires a newer CLI, or does not accept this schema version. */
|
|
106
|
+
export declare function assertServerAccepts(server: Pick<LocalSession, 'accepts' | 'minCliVersion'>, cliVersion: string, schemaVersion: string): void;
|
|
92
107
|
/**
|
|
93
108
|
* The masked address as the server masks it (first character, `***`, the
|
|
94
109
|
* domain); any other text from the server is replaced by `fallback`.
|
|
95
110
|
*/
|
|
96
111
|
export declare function displayRequester(requester: string, fallback?: string): string;
|
|
97
112
|
export {};
|
|
98
|
-
//# sourceMappingURL=submit-client.d.ts.map
|