anhedral 0.15.0 → 0.17.0
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/README.md +82 -34
- package/assets/stack/ai-schema.ts.txt +5 -0
- package/assets/stack/ai.ts.txt +30 -0
- package/assets/stack/api-index.ts.txt +15 -0
- package/assets/stack/auth-features.ts.txt +4 -0
- package/assets/stack/auth-journal.json.txt +13 -0
- package/assets/stack/auth-migration.sql.txt +53 -0
- package/assets/stack/auth-routes.ts.txt +11 -0
- package/assets/stack/auth-schema.ts.txt +64 -0
- package/assets/stack/auth-snapshot.json.txt +346 -0
- package/assets/stack/auth.ts.txt +32 -0
- package/assets/stack/billing-mode.ts.txt +8 -0
- package/assets/stack/billing-schema.ts.txt +11 -0
- package/assets/stack/desktop.rs.txt +21 -0
- package/assets/stack/entitlement-guard.ts.txt +32 -0
- package/assets/stack/entitlements.ts.txt +8 -0
- package/assets/stack/events-schema.ts.txt +12 -0
- package/assets/stack/events.ts.txt +59 -0
- package/assets/stack/mobile-auth.ts.txt +25 -0
- package/assets/stack/mobile-billing.tsx.txt +63 -0
- package/assets/stack/mobile-session.tsx.txt +83 -0
- package/assets/stack/native-button.tsx.txt +108 -0
- package/assets/stack/native-global.css.txt +4 -0
- package/assets/stack/native-lib-utils.ts.txt +5 -0
- package/assets/stack/native-metro.config.js.txt +6 -0
- package/assets/stack/native-nativewind-env.d.ts.txt +1 -0
- package/assets/stack/native-tailwind.config.js.txt +73 -0
- package/assets/stack/native-text.tsx.txt +89 -0
- package/assets/stack/purchases.ts.txt +65 -0
- package/assets/stack/revenuecat.ts.txt +88 -0
- package/assets/stack/rtc-schema.ts.txt +10 -0
- package/assets/stack/rtc.ts.txt +122 -0
- package/assets/stack/security.ts.txt +31 -0
- package/assets/stack/storage.ts.txt +36 -0
- package/assets/stack/stripe.ts.txt +126 -0
- package/assets/stack/web-sign-in.tsx.txt +51 -0
- package/assets/ui/LICENSE.react-native-reusables +21 -0
- package/assets/ui/UPSTREAM.json +0 -11
- package/assets/ui/catalog.json +891 -0
- package/assets/ui/extensions/registry.json +6 -0
- package/dist/bin.js +7 -12
- package/dist/capabilities.d.ts +4 -33
- package/dist/capabilities.js +2 -66
- package/dist/capability-catalog.d.ts +83 -0
- package/dist/capability-catalog.js +121 -0
- package/dist/capability-command.d.ts +3 -0
- package/dist/capability-command.js +188 -0
- package/dist/capability-editor.d.ts +17 -0
- package/dist/capability-editor.js +97 -0
- package/dist/capability-recipes.d.ts +4 -0
- package/dist/capability-recipes.js +520 -0
- package/dist/capability-references.d.ts +4 -0
- package/dist/capability-references.js +7 -0
- package/dist/cli-commands.d.ts +1 -2
- package/dist/cli-commands.js +10 -104
- package/dist/cli-output.d.ts +1 -2
- package/dist/cli-output.js +6 -251
- package/dist/command-schema.js +39 -322
- package/dist/dependencies.d.ts +29 -9
- package/dist/dependencies.js +57 -64
- package/dist/index.d.ts +1 -42
- package/dist/index.js +1 -27
- package/dist/platforms/web.d.ts +1 -1
- package/dist/platforms/web.js +27 -75
- package/dist/project-config.d.ts +2 -13
- package/dist/project-config.js +10 -82
- package/dist/registry/options.js +1 -5
- package/dist/registry/resolve.d.ts +1 -1
- package/dist/registry/resolve.js +4 -10
- package/dist/registry/usage.js +3 -9
- package/dist/scaffold/backend.js +0 -3
- package/dist/scaffold/database.js +2 -1
- package/dist/scaffold/documentation.js +56 -25
- package/dist/scaffold/stack-documentation.js +1 -1
- package/dist/scaffold/storage.d.ts +2 -0
- package/dist/scaffold/storage.js +21 -0
- package/dist/scaffold/workspace.js +21 -22
- package/dist/stack-registry.d.ts +2 -10
- package/dist/stack-registry.js +12 -98
- package/dist/standard.js +1 -11
- package/dist/ui-catalog.d.ts +26 -0
- package/dist/ui-catalog.js +31 -0
- package/dist/ui-command.d.ts +3 -0
- package/dist/ui-command.js +219 -0
- package/dist/ui-project.d.ts +22 -0
- package/dist/ui-project.js +110 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/docs/anhedral-stack.md +12 -23
- package/docs/assets/anhedral-stack-light.png +0 -0
- package/docs/assets/anhedral-stack.png +0 -0
- package/docs/capabilities.md +110 -0
- package/docs/native-ui.md +47 -0
- package/docs/software-factory.md +35 -50
- package/docs/stack-standard.md +19 -70
- package/docs/ui.md +33 -0
- package/docs/verification.md +6 -876
- package/package.json +21 -16
- package/assets/ui/native/button.tsx +0 -85
- package/assets/ui/native/card.tsx +0 -33
- package/assets/ui/native/dialog.tsx +0 -75
- package/assets/ui/native/input.tsx +0 -27
- package/assets/ui/native/label.tsx +0 -4
- package/assets/ui/native/layout.tsx +0 -26
- package/assets/ui/native/text.tsx +0 -20
- package/assets/ui/native/theme-switcher.tsx +0 -22
- package/assets/ui/theme-storage.ts +0 -25
- package/assets/ui/theme.tsx +0 -66
- package/dist/access.d.ts +0 -10
- package/dist/access.js +0 -93
- package/dist/auth-schema-snapshot.d.ts +0 -346
- package/dist/auth-schema-snapshot.js +0 -347
- package/dist/auth-schema.d.ts +0 -1
- package/dist/auth-schema.js +0 -57
- package/dist/capability-contract.d.ts +0 -47
- package/dist/capability-contract.js +0 -129
- package/dist/catalog-model.d.ts +0 -24
- package/dist/catalog-model.js +0 -1
- package/dist/catalog-registration.d.ts +0 -16
- package/dist/catalog-registration.js +0 -22
- package/dist/catalog-snapshot.d.ts +0 -5
- package/dist/catalog-snapshot.js +0 -97
- package/dist/cli-delivery.d.ts +0 -3
- package/dist/cli-delivery.js +0 -112
- package/dist/cloudflare.d.ts +0 -25
- package/dist/cloudflare.js +0 -226
- package/dist/delivery-evidence.d.ts +0 -62
- package/dist/delivery-evidence.js +0 -157
- package/dist/delivery.d.ts +0 -82
- package/dist/delivery.js +0 -489
- package/dist/inspector-model.d.ts +0 -123
- package/dist/inspector-model.js +0 -1
- package/dist/integration-service-readers.d.ts +0 -12
- package/dist/integration-service-readers.js +0 -92
- package/dist/lifecycle-model.d.ts +0 -15
- package/dist/lifecycle-model.js +0 -20
- package/dist/lifecycle.d.ts +0 -11
- package/dist/lifecycle.js +0 -91
- package/dist/management.d.ts +0 -3
- package/dist/management.js +0 -47
- package/dist/mobile-delivery.d.ts +0 -77
- package/dist/mobile-delivery.js +0 -370
- package/dist/platforms/mobile.d.ts +0 -2
- package/dist/platforms/mobile.js +0 -156
- package/dist/project-catalog.d.ts +0 -41
- package/dist/project-catalog.js +0 -288
- package/dist/project-inspector.d.ts +0 -4
- package/dist/project-inspector.js +0 -671
- package/dist/project-lifecycle.d.ts +0 -25
- package/dist/project-lifecycle.js +0 -57
- package/dist/project-state.d.ts +0 -47
- package/dist/project-state.js +0 -480
- package/dist/provider-auth.d.ts +0 -41
- package/dist/provider-auth.js +0 -180
- package/dist/provider-readiness.d.ts +0 -30
- package/dist/provider-readiness.js +0 -85
- package/dist/providers/adapters.d.ts +0 -17
- package/dist/providers/adapters.js +0 -103
- package/dist/providers/api.d.ts +0 -29
- package/dist/providers/api.js +0 -253
- package/dist/providers/config.d.ts +0 -15
- package/dist/providers/config.js +0 -136
- package/dist/providers/definitions.d.ts +0 -115
- package/dist/providers/definitions.js +0 -42
- package/dist/providers/provision.d.ts +0 -24
- package/dist/providers/provision.js +0 -76
- package/dist/providers/receipts.d.ts +0 -20
- package/dist/providers/receipts.js +0 -56
- package/dist/providers/recovery-verification.d.ts +0 -7
- package/dist/providers/recovery-verification.js +0 -52
- package/dist/providers/recovery.d.ts +0 -30
- package/dist/providers/recovery.js +0 -34
- package/dist/providers/runtime.d.ts +0 -10
- package/dist/providers/runtime.js +0 -234
- package/dist/providers/schema.d.ts +0 -28
- package/dist/providers/schema.js +0 -49
- package/dist/providers/state.d.ts +0 -55
- package/dist/providers/state.js +0 -283
- package/dist/provision.d.ts +0 -47
- package/dist/provision.js +0 -208
- package/dist/r2-service-data.d.ts +0 -2
- package/dist/r2-service-data.js +0 -136
- package/dist/readiness.d.ts +0 -23
- package/dist/readiness.js +0 -117
- package/dist/registry/add.d.ts +0 -24
- package/dist/registry/add.js +0 -210
- package/dist/registry/bootstrap.d.ts +0 -3
- package/dist/registry/bootstrap.js +0 -5
- package/dist/registry/commands.d.ts +0 -3
- package/dist/registry/commands.js +0 -83
- package/dist/registry/preview.d.ts +0 -11
- package/dist/registry/preview.js +0 -91
- package/dist/registry/receipt.d.ts +0 -3
- package/dist/registry/receipt.js +0 -68
- package/dist/repository.d.ts +0 -24
- package/dist/repository.js +0 -96
- package/dist/scaffold/auth.d.ts +0 -2
- package/dist/scaffold/auth.js +0 -76
- package/dist/scaffold/billing-config.d.ts +0 -1
- package/dist/scaffold/billing-config.js +0 -73
- package/dist/scaffold/billing-contracts.d.ts +0 -2
- package/dist/scaffold/billing-contracts.js +0 -48
- package/dist/scaffold/billing-providers.d.ts +0 -1
- package/dist/scaffold/billing-providers.js +0 -249
- package/dist/scaffold/billing-schema.d.ts +0 -1
- package/dist/scaffold/billing-schema.js +0 -34
- package/dist/scaffold/billing-security.d.ts +0 -1
- package/dist/scaffold/billing-security.js +0 -46
- package/dist/scaffold/billing-server.d.ts +0 -1
- package/dist/scaffold/billing-server.js +0 -139
- package/dist/scaffold/billing-store.d.ts +0 -1
- package/dist/scaffold/billing-store.js +0 -72
- package/dist/scaffold/billing.d.ts +0 -2
- package/dist/scaffold/billing.js +0 -208
- package/dist/scaffold/expo-auth.d.ts +0 -3
- package/dist/scaffold/expo-auth.js +0 -203
- package/dist/scaffold/expo-billing.d.ts +0 -3
- package/dist/scaffold/expo-billing.js +0 -257
- package/dist/scaffold/expo-runtime.d.ts +0 -3
- package/dist/scaffold/expo-runtime.js +0 -43
- package/dist/scaffold/integrations.d.ts +0 -2
- package/dist/scaffold/integrations.js +0 -11
- package/dist/scaffold/managed-email.d.ts +0 -3
- package/dist/scaffold/managed-email.js +0 -47
- package/dist/scaffold/native-ui.d.ts +0 -2
- package/dist/scaffold/native-ui.js +0 -69
- package/dist/scaffold/password-reset.d.ts +0 -1
- package/dist/scaffold/password-reset.js +0 -99
- package/dist/scaffold/private-files.d.ts +0 -2
- package/dist/scaffold/private-files.js +0 -78
- package/dist/scaffold/web-billing.d.ts +0 -2
- package/dist/scaffold/web-billing.js +0 -48
- package/dist/service-deletion.d.ts +0 -29
- package/dist/service-deletion.js +0 -195
- package/dist/service-descriptor.d.ts +0 -10
- package/dist/service-descriptor.js +0 -71
- package/dist/service-model.d.ts +0 -49
- package/dist/service-model.js +0 -8
- package/dist/service-operations.d.ts +0 -29
- package/dist/service-operations.js +0 -48
- package/dist/service-readers.d.ts +0 -8
- package/dist/service-readers.js +0 -216
- package/dist/services-command.d.ts +0 -39
- package/dist/services-command.js +0 -96
- package/dist/ship.d.ts +0 -35
- package/dist/ship.js +0 -107
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { ProjectInspection } from './inspector-model.js';
|
|
2
|
-
export interface ProjectLifecycle {
|
|
3
|
-
supportedConfiguration: boolean;
|
|
4
|
-
init: {
|
|
5
|
-
state: 'configured' | 'needs-attention' | 'unavailable';
|
|
6
|
-
message: string;
|
|
7
|
-
};
|
|
8
|
-
auth: {
|
|
9
|
-
state: 'not-checked';
|
|
10
|
-
providers: string[];
|
|
11
|
-
accounts: {
|
|
12
|
-
provider: string;
|
|
13
|
-
reference: string;
|
|
14
|
-
}[];
|
|
15
|
-
message: string;
|
|
16
|
-
};
|
|
17
|
-
ship: {
|
|
18
|
-
state: 'not-recorded' | 'recorded' | 'needs-attention';
|
|
19
|
-
successfulTargets: number;
|
|
20
|
-
totalTargets: number;
|
|
21
|
-
message: string;
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
/** Derive lifecycle evidence from the CLI inspector. Never infer authentication or live health. */
|
|
25
|
-
export declare function projectLifecycle(inspection: ProjectInspection): ProjectLifecycle;
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
/** Derive lifecycle evidence from the CLI inspector. Never infer authentication or live health. */
|
|
2
|
-
export function projectLifecycle(inspection) {
|
|
3
|
-
const supportedConfiguration = inspection.selection.state === 'available' &&
|
|
4
|
-
Boolean(inspection.selection.data.cliVersion) &&
|
|
5
|
-
inspection.selection.data.products.length > 0;
|
|
6
|
-
const targets = inspection.targets.state === 'available' ? inspection.targets.data : [];
|
|
7
|
-
const successfulTargets = targets.filter((target) => target.lastSuccessful).length;
|
|
8
|
-
const accounts = targets
|
|
9
|
-
.flatMap((target) => target.accountReference
|
|
10
|
-
? [{ provider: target.provider, reference: target.accountReference }]
|
|
11
|
-
: [])
|
|
12
|
-
.filter((account, index, values) => values.findIndex((value) => value.provider === account.provider && value.reference === account.reference) === index);
|
|
13
|
-
const blocked = inspection.targets.state === 'unavailable' ||
|
|
14
|
-
inspection.serviceDeletions?.state === 'unavailable' ||
|
|
15
|
-
Boolean(inspection.serviceDeletions?.data.length) ||
|
|
16
|
-
inspection.operation.state === 'unavailable' ||
|
|
17
|
-
Boolean(inspection.operation.data && inspection.operation.data.state !== 'completed') ||
|
|
18
|
-
targets.some((target) => target.error ||
|
|
19
|
-
target.delivery === 'scaffold-only' ||
|
|
20
|
-
(target.latestAttempt && target.latestAttempt.id !== target.lastSuccessful?.id));
|
|
21
|
-
const shipState = blocked
|
|
22
|
-
? 'needs-attention'
|
|
23
|
-
: targets.length && successfulTargets === targets.length
|
|
24
|
-
? 'recorded'
|
|
25
|
-
: 'not-recorded';
|
|
26
|
-
return {
|
|
27
|
-
supportedConfiguration,
|
|
28
|
-
init: {
|
|
29
|
-
state: !supportedConfiguration
|
|
30
|
-
? 'unavailable'
|
|
31
|
-
: inspection.readiness.state === 'available' && inspection.readiness.data.localReady
|
|
32
|
-
? 'configured'
|
|
33
|
-
: 'needs-attention',
|
|
34
|
-
message: !supportedConfiguration
|
|
35
|
-
? 'No supported Anhedral stack configuration found. Registering a folder does not adopt its application.'
|
|
36
|
-
: 'Anhedral stack configuration recorded. Local checks describe source structure, not feature completeness.',
|
|
37
|
-
},
|
|
38
|
-
auth: {
|
|
39
|
-
state: 'not-checked',
|
|
40
|
-
providers: inspection.setupProviders.state === 'available'
|
|
41
|
-
? inspection.setupProviders.data.map((provider) => provider.id)
|
|
42
|
-
: [],
|
|
43
|
-
accounts,
|
|
44
|
-
message: 'Account references are recorded selections. Provider sessions, permissions and billing eligibility require an explicit access check.',
|
|
45
|
-
},
|
|
46
|
-
ship: {
|
|
47
|
-
state: shipState,
|
|
48
|
-
successfulTargets,
|
|
49
|
-
totalTargets: targets.length,
|
|
50
|
-
message: blocked
|
|
51
|
-
? 'Review incomplete, conflicting or deletion evidence before shipping. Prior successes remain history.'
|
|
52
|
-
: shipState === 'recorded'
|
|
53
|
-
? 'Success receipts exist for the recorded targets. Current source, live health and product behavior require separate verification.'
|
|
54
|
-
: 'No complete set of successful target receipts is recorded. Review the delivery plan before provisioning or deploying.',
|
|
55
|
-
},
|
|
56
|
-
};
|
|
57
|
-
}
|
package/dist/project-state.d.ts
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
export interface DeploymentTarget {
|
|
2
|
-
id: string;
|
|
3
|
-
directory: string;
|
|
4
|
-
workerName: string;
|
|
5
|
-
}
|
|
6
|
-
export interface ApplicationProject {
|
|
7
|
-
schemaVersion: 1;
|
|
8
|
-
id: string;
|
|
9
|
-
name: string;
|
|
10
|
-
ownership: 'customer';
|
|
11
|
-
provider: 'cloudflare';
|
|
12
|
-
deliveryEngine: 'wrangler';
|
|
13
|
-
accountId: string | null;
|
|
14
|
-
audience: 'unconfigured' | 'public' | 'private';
|
|
15
|
-
access?: {
|
|
16
|
-
emails: string[];
|
|
17
|
-
};
|
|
18
|
-
targets: DeploymentTarget[];
|
|
19
|
-
}
|
|
20
|
-
export type DeliveryRunner = (command: string, args: string[], cwd: string, env: NodeJS.ProcessEnv, input?: string) => Promise<string>;
|
|
21
|
-
export declare function atomicJson(file: string, value: unknown): void;
|
|
22
|
-
export declare function configurationFile(directory: string): string;
|
|
23
|
-
export declare function readConfig(directory: string): Record<string, unknown>;
|
|
24
|
-
export declare function targetDirectory(root: string, target: DeploymentTarget): string;
|
|
25
|
-
export declare function registerApplication(root: string, extendTargets?: boolean): ApplicationProject;
|
|
26
|
-
export declare function readApplication(root: string): ApplicationProject;
|
|
27
|
-
export declare const defaultRunner: DeliveryRunner;
|
|
28
|
-
export declare function environment(project: ApplicationProject): NodeJS.ProcessEnv;
|
|
29
|
-
export declare function authenticate(root: string, project: ApplicationProject, run: DeliveryRunner): Promise<void>;
|
|
30
|
-
/** Explicit local cleanup only. A dead same-host PID is required; live, foreign,
|
|
31
|
-
* malformed and legacy locks remain intact. Provider operations are never replayed. */
|
|
32
|
-
export declare function recoverDeliveryLock(root: string): {
|
|
33
|
-
schemaVersion: number;
|
|
34
|
-
state: string;
|
|
35
|
-
recovered: boolean;
|
|
36
|
-
mutation: string;
|
|
37
|
-
providerReplay: boolean;
|
|
38
|
-
nextAction?: undefined;
|
|
39
|
-
} | {
|
|
40
|
-
schemaVersion: number;
|
|
41
|
-
state: string;
|
|
42
|
-
recovered: boolean;
|
|
43
|
-
mutation: string;
|
|
44
|
-
providerReplay: boolean;
|
|
45
|
-
nextAction: string;
|
|
46
|
-
};
|
|
47
|
-
export declare function withApplicationLock<T>(root: string, operation: () => Promise<T>): Promise<T>;
|
package/dist/project-state.js
DELETED
|
@@ -1,480 +0,0 @@
|
|
|
1
|
-
import { hasProjectSection, readProjectSection, writeProjectSection } from './project-config.js';
|
|
2
|
-
import { randomUUID } from 'node:crypto';
|
|
3
|
-
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
4
|
-
import { existsSync, lstatSync, fstatSync, openSync, closeSync, unlinkSync, rmdirSync, mkdirSync, readFileSync, readdirSync, realpathSync, renameSync, rmSync, writeFileSync, } from 'node:fs';
|
|
5
|
-
import { spawn } from 'node:child_process';
|
|
6
|
-
import path from 'node:path';
|
|
7
|
-
import { hostname } from 'node:os';
|
|
8
|
-
import { readBoundedFile } from './bounded-file.js';
|
|
9
|
-
import { validateSetupPlan } from './readiness.js';
|
|
10
|
-
import { parse } from 'jsonc-parser';
|
|
11
|
-
import { resolveCommand } from './command.js';
|
|
12
|
-
const stateDirectory = '.anhedral';
|
|
13
|
-
const accountPattern = /^[a-f0-9]{32}$/i;
|
|
14
|
-
const workerPattern = /^[a-z0-9][a-z0-9-]{0,62}$/;
|
|
15
|
-
export function atomicJson(file, value) {
|
|
16
|
-
const temporary = `${file}.${randomUUID()}.tmp`;
|
|
17
|
-
try {
|
|
18
|
-
writeFileSync(temporary, JSON.stringify(value, null, 2) + '\n', { mode: 0o600 });
|
|
19
|
-
renameSync(temporary, file);
|
|
20
|
-
}
|
|
21
|
-
finally {
|
|
22
|
-
rmSync(temporary, { force: true });
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
export function configurationFile(directory) {
|
|
26
|
-
const canonical = path.join(directory, 'anhedral.cloudflare.json');
|
|
27
|
-
return existsSync(canonical) ? canonical : path.join(directory, 'wrangler.jsonc');
|
|
28
|
-
}
|
|
29
|
-
export function readConfig(directory) {
|
|
30
|
-
const errors = [];
|
|
31
|
-
const value = parse(readFileSync(configurationFile(directory), 'utf8'), errors);
|
|
32
|
-
if (errors.length || !value || typeof value !== 'object' || Array.isArray(value))
|
|
33
|
-
throw new Error('Invalid Wrangler JSONC configuration.');
|
|
34
|
-
return value;
|
|
35
|
-
}
|
|
36
|
-
export function targetDirectory(root, target) {
|
|
37
|
-
if (!/^apps\/[a-z0-9-]+$/.test(target.directory))
|
|
38
|
-
throw new Error('Deployment targets must be direct apps/* directories.');
|
|
39
|
-
const directory = realpathSync(path.join(root, target.directory));
|
|
40
|
-
if (!directory.startsWith(realpathSync(root) + path.sep))
|
|
41
|
-
throw new Error('Deployment target escapes the project.');
|
|
42
|
-
return directory;
|
|
43
|
-
}
|
|
44
|
-
export function registerApplication(root, extendTargets = false) {
|
|
45
|
-
root = realpathSync(root);
|
|
46
|
-
const existing = hasProjectSection(root, 'cloudflare') ? readApplication(root) : undefined;
|
|
47
|
-
if (existing && !extendTargets)
|
|
48
|
-
return existing;
|
|
49
|
-
const setup = readProjectSection(root, 'setup');
|
|
50
|
-
validateSetupPlan(setup);
|
|
51
|
-
const targets = readdirSync(path.join(root, 'apps'), { withFileTypes: true })
|
|
52
|
-
.filter((entry) => entry.isDirectory())
|
|
53
|
-
.filter((entry) => existsSync(configurationFile(path.join(root, 'apps', entry.name))))
|
|
54
|
-
.map((entry) => {
|
|
55
|
-
const workerName = readConfig(path.join(root, 'apps', entry.name)).name;
|
|
56
|
-
if (typeof workerName !== 'string' || !workerPattern.test(workerName))
|
|
57
|
-
throw new Error('Invalid Worker name.');
|
|
58
|
-
return { id: entry.name, directory: `apps/${entry.name}`, workerName };
|
|
59
|
-
})
|
|
60
|
-
.sort((a, b) => {
|
|
61
|
-
const rank = (id) => (id === 'web' ? 2 : id === 'mobile' ? 1 : 0);
|
|
62
|
-
return rank(a.id) - rank(b.id) || a.id.localeCompare(b.id);
|
|
63
|
-
});
|
|
64
|
-
const selectedEngine = 'wrangler';
|
|
65
|
-
if (existing) {
|
|
66
|
-
if (existing.targets.some((target) => !targets.some((candidate) => candidate.id === target.id &&
|
|
67
|
-
candidate.directory === target.directory &&
|
|
68
|
-
candidate.workerName === target.workerName)))
|
|
69
|
-
throw new Error('Addition cannot replace existing delivery targets.');
|
|
70
|
-
const extended = {
|
|
71
|
-
...existing,
|
|
72
|
-
// A native-only registration has no Cloudflare runtime to preserve.
|
|
73
|
-
// Select the first actual targets' engine while keeping project identity.
|
|
74
|
-
deliveryEngine: existing.targets.length ? existing.deliveryEngine : selectedEngine,
|
|
75
|
-
targets,
|
|
76
|
-
};
|
|
77
|
-
writeProjectSection(root, 'cloudflare', extended);
|
|
78
|
-
return extended;
|
|
79
|
-
}
|
|
80
|
-
const project = {
|
|
81
|
-
schemaVersion: 1,
|
|
82
|
-
id: randomUUID(),
|
|
83
|
-
name: JSON.parse(readFileSync(path.join(root, 'package.json'), 'utf8')).name ?? path.basename(root),
|
|
84
|
-
ownership: 'customer',
|
|
85
|
-
provider: 'cloudflare',
|
|
86
|
-
deliveryEngine: selectedEngine,
|
|
87
|
-
accountId: null,
|
|
88
|
-
audience: 'unconfigured',
|
|
89
|
-
targets,
|
|
90
|
-
};
|
|
91
|
-
const ignoreFile = path.join(root, '.gitignore');
|
|
92
|
-
const ignored = existsSync(ignoreFile) ? readFileSync(ignoreFile, 'utf8') : '';
|
|
93
|
-
if (!ignored.split(/\r?\n/).includes('.anhedral/'))
|
|
94
|
-
writeFileSync(ignoreFile, ignored + (ignored.endsWith('\n') || !ignored ? '' : '\n') + '.anhedral/\n');
|
|
95
|
-
writeProjectSection(root, 'cloudflare', project);
|
|
96
|
-
return project;
|
|
97
|
-
}
|
|
98
|
-
export function readApplication(root) {
|
|
99
|
-
const project = readProjectSection(root, 'cloudflare');
|
|
100
|
-
if (project.schemaVersion !== 1 ||
|
|
101
|
-
typeof project.id !== 'string' ||
|
|
102
|
-
!/^[a-f0-9-]{36}$/i.test(project.id) ||
|
|
103
|
-
project.ownership !== 'customer' ||
|
|
104
|
-
project.provider !== 'cloudflare' ||
|
|
105
|
-
project.deliveryEngine !== 'wrangler' ||
|
|
106
|
-
!(project.accountId === null || accountPattern.test(project.accountId)) ||
|
|
107
|
-
!['unconfigured', 'public', 'private'].includes(project.audience) ||
|
|
108
|
-
!Array.isArray(project.targets))
|
|
109
|
-
throw new Error('Invalid application manifest.');
|
|
110
|
-
if (project.access &&
|
|
111
|
-
(!Array.isArray(project.access.emails) ||
|
|
112
|
-
project.access.emails.some((email) => typeof email !== 'string')))
|
|
113
|
-
throw new Error('Invalid private audience configuration.');
|
|
114
|
-
if (project.audience === 'private' && !project.access?.emails.length)
|
|
115
|
-
throw new Error('Private delivery requires explicit allowed members.');
|
|
116
|
-
const ids = new Set();
|
|
117
|
-
const workers = new Set();
|
|
118
|
-
for (const target of project.targets) {
|
|
119
|
-
if (!target ||
|
|
120
|
-
typeof target.id !== 'string' ||
|
|
121
|
-
typeof target.workerName !== 'string' ||
|
|
122
|
-
!/^[a-z0-9-]+$/.test(target.id) ||
|
|
123
|
-
ids.has(target.id) ||
|
|
124
|
-
workers.has(target.workerName) ||
|
|
125
|
-
!workerPattern.test(target.workerName))
|
|
126
|
-
throw new Error('Invalid or duplicate deployment target.');
|
|
127
|
-
ids.add(target.id);
|
|
128
|
-
workers.add(target.workerName);
|
|
129
|
-
targetDirectory(root, target);
|
|
130
|
-
}
|
|
131
|
-
return project;
|
|
132
|
-
}
|
|
133
|
-
export const defaultRunner = (command, args, cwd, env, input) => new Promise((resolve, reject) => {
|
|
134
|
-
const invocation = resolveCommand(command, args);
|
|
135
|
-
const child = spawn(invocation.command, invocation.args, {
|
|
136
|
-
cwd,
|
|
137
|
-
env,
|
|
138
|
-
detached: process.platform !== 'win32',
|
|
139
|
-
stdio: [input === undefined ? 'ignore' : 'pipe', 'pipe', 'pipe'],
|
|
140
|
-
});
|
|
141
|
-
if (input !== undefined) {
|
|
142
|
-
child.stdin?.on('error', () => { });
|
|
143
|
-
child.stdin?.end(input);
|
|
144
|
-
}
|
|
145
|
-
let output = '';
|
|
146
|
-
let oversized = false;
|
|
147
|
-
let interrupted = false;
|
|
148
|
-
let timedOut = false;
|
|
149
|
-
let forceTimer;
|
|
150
|
-
const kill = (signal) => {
|
|
151
|
-
if (!child.pid)
|
|
152
|
-
return;
|
|
153
|
-
if (process.platform === 'win32')
|
|
154
|
-
spawn('taskkill', ['/pid', String(child.pid), '/t', '/f'], { stdio: 'ignore' });
|
|
155
|
-
else {
|
|
156
|
-
try {
|
|
157
|
-
process.kill(-child.pid, signal);
|
|
158
|
-
}
|
|
159
|
-
catch {
|
|
160
|
-
/* The process group already exited. */
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
};
|
|
164
|
-
const stop = () => {
|
|
165
|
-
kill('SIGTERM');
|
|
166
|
-
forceTimer ??= setTimeout(() => kill('SIGKILL'), 2000);
|
|
167
|
-
forceTimer.unref();
|
|
168
|
-
};
|
|
169
|
-
const interrupt = () => {
|
|
170
|
-
interrupted = true;
|
|
171
|
-
stop();
|
|
172
|
-
};
|
|
173
|
-
process.once('SIGINT', interrupt);
|
|
174
|
-
process.once('SIGTERM', interrupt);
|
|
175
|
-
child.stdout?.on('data', (chunk) => {
|
|
176
|
-
if (!oversized)
|
|
177
|
-
output += chunk.toString();
|
|
178
|
-
if (output.length > 8 * 1024 * 1024) {
|
|
179
|
-
oversized = true;
|
|
180
|
-
stop();
|
|
181
|
-
}
|
|
182
|
-
});
|
|
183
|
-
// Do not persist raw build/provider output: it can contain credentials or customer data.
|
|
184
|
-
child.stderr?.resume();
|
|
185
|
-
const requestedDeadline = Number(env.ANHEDRAL_COMMAND_TIMEOUT_MS);
|
|
186
|
-
const commandDeadline = Number.isInteger(requestedDeadline) &&
|
|
187
|
-
requestedDeadline >= 1 &&
|
|
188
|
-
requestedDeadline <= 20 * 60 * 1000
|
|
189
|
-
? requestedDeadline
|
|
190
|
-
: 20 * 60 * 1000;
|
|
191
|
-
const timer = setTimeout(() => {
|
|
192
|
-
timedOut = true;
|
|
193
|
-
stop();
|
|
194
|
-
}, commandDeadline);
|
|
195
|
-
const clean = () => {
|
|
196
|
-
clearTimeout(timer);
|
|
197
|
-
if (forceTimer)
|
|
198
|
-
clearTimeout(forceTimer);
|
|
199
|
-
process.removeListener('SIGINT', interrupt);
|
|
200
|
-
process.removeListener('SIGTERM', interrupt);
|
|
201
|
-
};
|
|
202
|
-
child.on('error', () => {
|
|
203
|
-
clean();
|
|
204
|
-
reject(new Error(`Cannot run ${command}; check local tooling.`));
|
|
205
|
-
});
|
|
206
|
-
child.on('close', (code) => {
|
|
207
|
-
clean();
|
|
208
|
-
if (code === 0 && !oversized && !interrupted && !timedOut)
|
|
209
|
-
resolve(output);
|
|
210
|
-
else
|
|
211
|
-
reject(new Error(`${command} ${args.slice(0, 3).join(' ')} ${interrupted ? 'was interrupted' : timedOut ? 'timed out' : 'failed'}; inspect the project command locally.`));
|
|
212
|
-
});
|
|
213
|
-
});
|
|
214
|
-
export function environment(project) {
|
|
215
|
-
if (!project.accountId)
|
|
216
|
-
throw new Error('Connect the intended Cloudflare account first.');
|
|
217
|
-
if (process.env.CLOUDFLARE_ACCOUNT_ID && process.env.CLOUDFLARE_ACCOUNT_ID !== project.accountId)
|
|
218
|
-
throw new Error('Cloudflare environment account conflicts with the registered account.');
|
|
219
|
-
if (process.env.CLOUDFLARE_ENV)
|
|
220
|
-
throw new Error('Register a separate project configuration for the intended environment; CLOUDFLARE_ENV overrides are unsupported.');
|
|
221
|
-
return {
|
|
222
|
-
...process.env,
|
|
223
|
-
CLOUDFLARE_ACCOUNT_ID: project.accountId,
|
|
224
|
-
CI: 'true',
|
|
225
|
-
NO_COLOR: '1',
|
|
226
|
-
FORCE_COLOR: '0',
|
|
227
|
-
};
|
|
228
|
-
}
|
|
229
|
-
export async function authenticate(root, project, run) {
|
|
230
|
-
const identity = JSON.parse(await run('pnpm', ['exec', 'wrangler', 'whoami', '--json'], targetDirectory(root, project.targets[0]), environment(project)));
|
|
231
|
-
if (identity.loggedIn !== true ||
|
|
232
|
-
!Array.isArray(identity.accounts) ||
|
|
233
|
-
!identity.accounts.some((account) => account.id === project.accountId))
|
|
234
|
-
throw new Error('Wrangler cannot access the registered Cloudflare account. Run wrangler login or configure scoped credentials.');
|
|
235
|
-
}
|
|
236
|
-
const applicationLocks = new AsyncLocalStorage();
|
|
237
|
-
const lockBusy = () => new Error('Another delivery is running or was interrupted. Inspect provider status and use anhedral recover --lock only after reviewing the recorded operation.');
|
|
238
|
-
const ownerChanged = () => new Error('Delivery lock ownership changed or is invalid. Preserve the lock and inspect local operation evidence before retrying.');
|
|
239
|
-
function privateState(root) {
|
|
240
|
-
const state = path.join(root, stateDirectory);
|
|
241
|
-
try {
|
|
242
|
-
mkdirSync(state, { recursive: true, mode: 0o700 });
|
|
243
|
-
const stat = lstatSync(state);
|
|
244
|
-
if (!stat.isDirectory() ||
|
|
245
|
-
stat.isSymbolicLink() ||
|
|
246
|
-
realpathSync(state) !== state ||
|
|
247
|
-
(process.platform !== 'win32' && stat.mode & 0o022))
|
|
248
|
-
throw new Error();
|
|
249
|
-
return state;
|
|
250
|
-
}
|
|
251
|
-
catch {
|
|
252
|
-
throw new Error('Delivery state must be a regular directory without shared write permissions.');
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
function lockOwner() {
|
|
256
|
-
return {
|
|
257
|
-
schemaVersion: 1,
|
|
258
|
-
pid: process.pid,
|
|
259
|
-
host: hostname(),
|
|
260
|
-
token: randomUUID(),
|
|
261
|
-
createdAt: new Date().toISOString(),
|
|
262
|
-
};
|
|
263
|
-
}
|
|
264
|
-
function privateOwner(file) {
|
|
265
|
-
try {
|
|
266
|
-
const stat = lstatSync(file);
|
|
267
|
-
if (!stat.isFile() ||
|
|
268
|
-
stat.isSymbolicLink() ||
|
|
269
|
-
(process.platform !== 'win32' && (stat.mode & 0o077 || stat.uid !== process.getuid?.())))
|
|
270
|
-
throw new Error();
|
|
271
|
-
const value = JSON.parse(readBoundedFile(file, 4096).toString('utf8'));
|
|
272
|
-
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
273
|
-
throw new Error();
|
|
274
|
-
const owner = value;
|
|
275
|
-
if (Object.keys(owner).some((key) => !['schemaVersion', 'pid', 'host', 'token', 'createdAt'].includes(key)) ||
|
|
276
|
-
owner.schemaVersion !== 1 ||
|
|
277
|
-
!Number.isSafeInteger(owner.pid) ||
|
|
278
|
-
owner.pid < 1 ||
|
|
279
|
-
owner.pid > 2147483647 ||
|
|
280
|
-
typeof owner.host !== 'string' ||
|
|
281
|
-
!owner.host ||
|
|
282
|
-
owner.host.length > 255 ||
|
|
283
|
-
/[\x00-\x1f\x7f]/.test(owner.host) ||
|
|
284
|
-
typeof owner.token !== 'string' ||
|
|
285
|
-
!/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/.test(owner.token) ||
|
|
286
|
-
typeof owner.createdAt !== 'string' ||
|
|
287
|
-
!/^\d{4}-\d{2}-\d{2}T/.test(owner.createdAt) ||
|
|
288
|
-
!Number.isFinite(Date.parse(owner.createdAt)))
|
|
289
|
-
throw new Error();
|
|
290
|
-
return owner;
|
|
291
|
-
}
|
|
292
|
-
catch {
|
|
293
|
-
throw ownerChanged();
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
function snapshotLock(lock) {
|
|
297
|
-
try {
|
|
298
|
-
const stat = lstatSync(lock);
|
|
299
|
-
if (!stat.isDirectory() ||
|
|
300
|
-
stat.isSymbolicLink() ||
|
|
301
|
-
(process.platform !== 'win32' && (stat.mode & 0o077 || stat.uid !== process.getuid?.())) ||
|
|
302
|
-
readdirSync(lock).join(',') !== 'owner.json')
|
|
303
|
-
throw new Error();
|
|
304
|
-
const file = path.join(lock, 'owner.json');
|
|
305
|
-
const owner = privateOwner(file);
|
|
306
|
-
const ownerStat = lstatSync(file);
|
|
307
|
-
return {
|
|
308
|
-
identity: {
|
|
309
|
-
device: stat.dev,
|
|
310
|
-
inode: stat.ino,
|
|
311
|
-
ownerDevice: ownerStat.dev,
|
|
312
|
-
ownerInode: ownerStat.ino,
|
|
313
|
-
owner,
|
|
314
|
-
},
|
|
315
|
-
owner,
|
|
316
|
-
};
|
|
317
|
-
}
|
|
318
|
-
catch {
|
|
319
|
-
throw ownerChanged();
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
function sameOwner(left, right) {
|
|
323
|
-
return (left.pid === right.pid &&
|
|
324
|
-
left.host === right.host &&
|
|
325
|
-
left.token === right.token &&
|
|
326
|
-
left.createdAt === right.createdAt);
|
|
327
|
-
}
|
|
328
|
-
function sameIdentity(left, right) {
|
|
329
|
-
return (left.device === right.device &&
|
|
330
|
-
left.inode === right.inode &&
|
|
331
|
-
left.ownerDevice === right.ownerDevice &&
|
|
332
|
-
left.ownerInode === right.ownerInode &&
|
|
333
|
-
sameOwner(left.owner, right.owner));
|
|
334
|
-
}
|
|
335
|
-
class DeliveryGuardBusyError extends Error {
|
|
336
|
-
constructor() {
|
|
337
|
-
super('Delivery lock acquisition or recovery is busy. Inspect .anhedral/ship.guard before retrying.');
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
/** This synchronous guard covers only filesystem transitions. An uncertain guard
|
|
341
|
-
* after process termination is preserved for operator inspection, never auto-unlinked. */
|
|
342
|
-
function withLockGuard(state, operation) {
|
|
343
|
-
try {
|
|
344
|
-
const stat = lstatSync(state);
|
|
345
|
-
if (!stat.isDirectory() ||
|
|
346
|
-
stat.isSymbolicLink() ||
|
|
347
|
-
realpathSync(state) !== state ||
|
|
348
|
-
(process.platform !== 'win32' && stat.mode & 0o022))
|
|
349
|
-
throw new Error();
|
|
350
|
-
}
|
|
351
|
-
catch {
|
|
352
|
-
throw ownerChanged();
|
|
353
|
-
}
|
|
354
|
-
const file = path.join(state, 'ship.guard');
|
|
355
|
-
let descriptor;
|
|
356
|
-
try {
|
|
357
|
-
descriptor = openSync(file, 'wx', 0o600);
|
|
358
|
-
}
|
|
359
|
-
catch {
|
|
360
|
-
throw new DeliveryGuardBusyError();
|
|
361
|
-
}
|
|
362
|
-
const stat = fstatSync(descriptor);
|
|
363
|
-
const owner = lockOwner();
|
|
364
|
-
try {
|
|
365
|
-
writeFileSync(descriptor, JSON.stringify(owner) + '\n');
|
|
366
|
-
return operation();
|
|
367
|
-
}
|
|
368
|
-
finally {
|
|
369
|
-
closeSync(descriptor);
|
|
370
|
-
// Another process must never lose its guard because this invocation finishes.
|
|
371
|
-
let current;
|
|
372
|
-
try {
|
|
373
|
-
current = lstatSync(file);
|
|
374
|
-
}
|
|
375
|
-
catch {
|
|
376
|
-
throw ownerChanged();
|
|
377
|
-
}
|
|
378
|
-
if (current.isSymbolicLink() ||
|
|
379
|
-
current.dev !== stat.dev ||
|
|
380
|
-
current.ino !== stat.ino ||
|
|
381
|
-
!sameOwner(privateOwner(file), owner))
|
|
382
|
-
throw ownerChanged();
|
|
383
|
-
unlinkSync(file);
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
function removeOwnedLock(lock, identity) {
|
|
387
|
-
if (!sameIdentity(snapshotLock(lock).identity, identity))
|
|
388
|
-
throw ownerChanged();
|
|
389
|
-
// Never recursively remove a lock: unknown additional files are evidence.
|
|
390
|
-
unlinkSync(path.join(lock, 'owner.json'));
|
|
391
|
-
rmdirSync(lock);
|
|
392
|
-
}
|
|
393
|
-
async function releaseApplicationLock(state, lock, identity) {
|
|
394
|
-
// A simultaneous operator inspection may briefly hold the guard. Preserve our
|
|
395
|
-
// lock while waiting; never bypass a guard or reinterpret uncertain ownership.
|
|
396
|
-
for (let attempt = 0;; attempt++) {
|
|
397
|
-
try {
|
|
398
|
-
withLockGuard(state, () => removeOwnedLock(lock, identity));
|
|
399
|
-
return;
|
|
400
|
-
}
|
|
401
|
-
catch (error) {
|
|
402
|
-
if (!(error instanceof DeliveryGuardBusyError) || attempt >= 4)
|
|
403
|
-
throw error;
|
|
404
|
-
await new Promise((resolve) => setTimeout(resolve, 25));
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
/** Explicit local cleanup only. A dead same-host PID is required; live, foreign,
|
|
409
|
-
* malformed and legacy locks remain intact. Provider operations are never replayed. */
|
|
410
|
-
export function recoverDeliveryLock(root) {
|
|
411
|
-
root = realpathSync(root);
|
|
412
|
-
const state = privateState(root);
|
|
413
|
-
return withLockGuard(state, () => {
|
|
414
|
-
const lock = path.join(state, 'ship.lock');
|
|
415
|
-
if (!lstatSync(lock, { throwIfNoEntry: false }))
|
|
416
|
-
return {
|
|
417
|
-
schemaVersion: 1,
|
|
418
|
-
state: 'unlocked',
|
|
419
|
-
recovered: false,
|
|
420
|
-
mutation: 'local-lock-only',
|
|
421
|
-
providerReplay: false,
|
|
422
|
-
};
|
|
423
|
-
const snapshot = snapshotLock(lock);
|
|
424
|
-
if (snapshot.owner.host !== hostname())
|
|
425
|
-
throw new Error('Delivery lock belongs to another host; preserve it and inspect operation evidence.');
|
|
426
|
-
let dead = false;
|
|
427
|
-
try {
|
|
428
|
-
process.kill(snapshot.owner.pid, 0);
|
|
429
|
-
}
|
|
430
|
-
catch (error) {
|
|
431
|
-
if (error.code === 'ESRCH')
|
|
432
|
-
dead = true;
|
|
433
|
-
else
|
|
434
|
-
throw new Error('Cannot prove the delivery lock owner exited; preserve the lock.');
|
|
435
|
-
}
|
|
436
|
-
if (!dead)
|
|
437
|
-
throw new Error('Delivery lock owner is still running; no lock or provider state was changed.');
|
|
438
|
-
removeOwnedLock(lock, snapshot.identity);
|
|
439
|
-
return {
|
|
440
|
-
schemaVersion: 1,
|
|
441
|
-
state: 'lock-recovered',
|
|
442
|
-
recovered: true,
|
|
443
|
-
mutation: 'local-lock-only',
|
|
444
|
-
providerReplay: false,
|
|
445
|
-
nextAction: 'Inspect provider status and recorded receipts before retrying ship. No provider operation was replayed.',
|
|
446
|
-
};
|
|
447
|
-
});
|
|
448
|
-
}
|
|
449
|
-
export async function withApplicationLock(root, operation) {
|
|
450
|
-
root = realpathSync(root);
|
|
451
|
-
const held = applicationLocks.getStore();
|
|
452
|
-
const state = privateState(root);
|
|
453
|
-
const lock = path.join(state, 'ship.lock');
|
|
454
|
-
if (held?.active && held.root === root) {
|
|
455
|
-
if (!sameIdentity(snapshotLock(lock).identity, held.identity))
|
|
456
|
-
throw ownerChanged();
|
|
457
|
-
return operation();
|
|
458
|
-
}
|
|
459
|
-
const identity = withLockGuard(state, () => {
|
|
460
|
-
try {
|
|
461
|
-
mkdirSync(lock, { mode: 0o700 });
|
|
462
|
-
}
|
|
463
|
-
catch {
|
|
464
|
-
throw lockBusy();
|
|
465
|
-
}
|
|
466
|
-
writeFileSync(path.join(lock, 'owner.json'), JSON.stringify(lockOwner()) + '\n', {
|
|
467
|
-
flag: 'wx',
|
|
468
|
-
mode: 0o600,
|
|
469
|
-
});
|
|
470
|
-
return snapshotLock(lock).identity;
|
|
471
|
-
});
|
|
472
|
-
const context = { root, active: true, identity };
|
|
473
|
-
try {
|
|
474
|
-
return await applicationLocks.run(context, operation);
|
|
475
|
-
}
|
|
476
|
-
finally {
|
|
477
|
-
context.active = false;
|
|
478
|
-
await releaseApplicationLock(state, lock, identity);
|
|
479
|
-
}
|
|
480
|
-
}
|
package/dist/provider-auth.d.ts
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import type { StandardProduct } from './stack-registry.js';
|
|
2
|
-
import { type DeliveryRunner } from './project-state.js';
|
|
3
|
-
export interface ProviderAuth {
|
|
4
|
-
id: string;
|
|
5
|
-
products: readonly StandardProduct[];
|
|
6
|
-
login?: readonly string[];
|
|
7
|
-
identity?: readonly string[];
|
|
8
|
-
credential?: string;
|
|
9
|
-
endpoint?: string;
|
|
10
|
-
runtime?: {
|
|
11
|
-
credential: string;
|
|
12
|
-
endpoint: string;
|
|
13
|
-
};
|
|
14
|
-
regionalEndpoints?: Readonly<Record<string, string>>;
|
|
15
|
-
setup: string;
|
|
16
|
-
}
|
|
17
|
-
/** Deployment access is separate from application-user authentication. */
|
|
18
|
-
export declare const PROVIDER_AUTH: readonly ProviderAuth[];
|
|
19
|
-
export declare function requiredProviders(root: string): ProviderAuth[];
|
|
20
|
-
export type AuthState = 'verified' | 'missing' | 'insufficient-permissions' | 'unverified';
|
|
21
|
-
export interface AuthCheck {
|
|
22
|
-
provider: string;
|
|
23
|
-
state: AuthState;
|
|
24
|
-
evidence: 'cli-session' | 'api-access' | 'none';
|
|
25
|
-
access: 'session' | 'management' | 'runtime' | 'none';
|
|
26
|
-
nextAction: string;
|
|
27
|
-
}
|
|
28
|
-
export interface AuthOptions {
|
|
29
|
-
provider?: string;
|
|
30
|
-
status?: boolean;
|
|
31
|
-
interactive?: boolean;
|
|
32
|
-
}
|
|
33
|
-
export type LoginRunner = (command: readonly string[], root: string) => Promise<void>;
|
|
34
|
-
/** Never return provider output, tokens, user addresses or response bodies. */
|
|
35
|
-
export declare function authenticateProviders(root: string, options?: AuthOptions, run?: DeliveryRunner, send?: typeof fetch, startLogin?: LoginRunner, environment?: NodeJS.ProcessEnv): Promise<{
|
|
36
|
-
schemaVersion: number;
|
|
37
|
-
checks: AuthCheck[];
|
|
38
|
-
authenticated: boolean;
|
|
39
|
-
provisioningReady: boolean;
|
|
40
|
-
note: string;
|
|
41
|
-
}>;
|