anhedral 0.13.0 → 0.16.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 +23 -229
- package/assets/patches/audit-deps.mjs +12 -2
- 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/LICENSE.shadcn +21 -0
- package/assets/ui/UPSTREAM.json +39 -0
- package/assets/ui/catalog.json +891 -0
- package/assets/ui/extensions/registry.json +6 -0
- package/assets/ui/native/_controls.tsx +521 -0
- package/assets/ui/native/_core.tsx +118 -0
- package/assets/ui/native/_data.tsx +200 -0
- package/assets/ui/native/_display.tsx +453 -0
- package/assets/ui/native/_feedback.tsx +242 -0
- package/assets/ui/native/_legacy-dialog.tsx +38 -0
- package/assets/ui/native/_motion.tsx +520 -0
- package/assets/ui/native/_overlay.tsx +402 -0
- package/assets/ui/native/_selection.tsx +366 -0
- package/assets/ui/native/accordion.tsx +1 -0
- package/assets/ui/native/alert-dialog.tsx +11 -0
- package/assets/ui/native/alert.tsx +1 -0
- package/assets/ui/native/aspect-ratio.tsx +1 -0
- package/assets/ui/native/attachment.tsx +8 -0
- package/assets/ui/native/avatar.tsx +8 -0
- package/assets/ui/native/badge.tsx +1 -0
- package/assets/ui/native/breadcrumb.tsx +9 -0
- package/assets/ui/native/bubble.tsx +1 -0
- package/assets/ui/native/button-group.tsx +1 -0
- package/assets/ui/native/button.tsx +86 -0
- package/assets/ui/native/calendar.tsx +170 -0
- package/assets/ui/native/card.tsx +44 -0
- package/assets/ui/native/carousel.tsx +1 -0
- package/assets/ui/native/chart.tsx +193 -0
- package/assets/ui/native/checkbox.tsx +1 -0
- package/assets/ui/native/code-block.tsx +137 -0
- package/assets/ui/native/collapsible.tsx +1 -0
- package/assets/ui/native/combobox.tsx +1 -0
- package/assets/ui/native/command.tsx +11 -0
- package/assets/ui/native/context-menu.tsx +16 -0
- package/assets/ui/native/data-table.tsx +1 -0
- package/assets/ui/native/date-picker.tsx +43 -0
- package/assets/ui/native/dialog.tsx +15 -0
- package/assets/ui/native/direction.tsx +1 -0
- package/assets/ui/native/drawer.tsx +10 -0
- package/assets/ui/native/dropdown-menu.tsx +16 -0
- package/assets/ui/native/empty.tsx +8 -0
- package/assets/ui/native/field.tsx +13 -0
- package/assets/ui/native/hover-card.tsx +1 -0
- package/assets/ui/native/input-group.tsx +8 -0
- package/assets/ui/native/input-otp.tsx +1 -0
- package/assets/ui/native/input.tsx +28 -0
- package/assets/ui/native/item.tsx +12 -0
- package/assets/ui/native/kbd.tsx +1 -0
- package/assets/ui/native/label.tsx +4 -0
- package/assets/ui/native/layout.tsx +26 -0
- package/assets/ui/native/marker.tsx +1 -0
- package/assets/ui/native/menubar.tsx +17 -0
- package/assets/ui/native/message-scroller.tsx +6 -0
- package/assets/ui/native/message.tsx +10 -0
- package/assets/ui/native/native-select.tsx +1 -0
- package/assets/ui/native/navigation-menu.tsx +10 -0
- package/assets/ui/native/pagination.tsx +9 -0
- package/assets/ui/native/popover.tsx +1 -0
- package/assets/ui/native/progress.tsx +1 -0
- package/assets/ui/native/questionnaire.tsx +130 -0
- package/assets/ui/native/radio-group.tsx +1 -0
- package/assets/ui/native/registry.json +1103 -0
- package/assets/ui/native/resizable.tsx +1 -0
- package/assets/ui/native/scroll-area.tsx +1 -0
- package/assets/ui/native/select.tsx +11 -0
- package/assets/ui/native/separator.tsx +1 -0
- package/assets/ui/native/sheet.tsx +10 -0
- package/assets/ui/native/sidebar.tsx +22 -0
- package/assets/ui/native/skeleton.tsx +1 -0
- package/assets/ui/native/slider.tsx +1 -0
- package/assets/ui/native/spinner.tsx +1 -0
- package/assets/ui/native/switch.tsx +1 -0
- package/assets/ui/native/table.tsx +10 -0
- package/assets/ui/native/tabs.tsx +1 -0
- package/assets/ui/native/text.tsx +20 -0
- package/assets/ui/native/textarea.tsx +1 -0
- package/assets/ui/native/theme-switcher.tsx +22 -0
- package/assets/ui/native/toast.tsx +11 -0
- package/assets/ui/native/toggle-group.tsx +1 -0
- package/assets/ui/native/toggle.tsx +1 -0
- package/assets/ui/native/tooltip.tsx +1 -0
- package/assets/ui/native/trace.tsx +20 -0
- package/assets/ui/native/typography.tsx +15 -0
- package/assets/ui/theme-storage.ts +25 -0
- package/assets/ui/theme.tsx +66 -0
- package/assets/ui/web/button.tsx +59 -0
- package/assets/ui/web/input.tsx +21 -0
- package/assets/ui/web/label.tsx +19 -0
- package/dist/bin.js +7 -12
- package/dist/capabilities.d.ts +4 -33
- package/dist/capabilities.js +2 -84
- 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 +40 -374
- package/dist/dependencies.d.ts +34 -62
- package/dist/dependencies.js +112 -199
- package/dist/index.d.ts +1 -45
- package/dist/index.js +1 -30
- package/dist/platforms/mobile.js +29 -139
- package/dist/platforms/web.d.ts +3 -0
- package/dist/platforms/web.js +251 -0
- package/dist/project-config.d.ts +2 -13
- package/dist/project-config.js +10 -83
- package/dist/registry/context.js +0 -1
- package/dist/registry/options.js +6 -40
- package/dist/registry/resolve.d.ts +3 -4
- package/dist/registry/resolve.js +18 -108
- package/dist/registry/types.d.ts +1 -7
- package/dist/registry/usage.js +3 -9
- package/dist/runtime-policy.d.ts +0 -2
- package/dist/runtime-policy.js +0 -16
- package/dist/scaffold/backend.d.ts +0 -4
- package/dist/scaffold/backend.js +1 -189
- package/dist/scaffold/bootstrap.d.ts +2 -3
- package/dist/scaffold/bootstrap.js +37 -43
- package/dist/scaffold/compose.js +2 -14
- package/dist/scaffold/database.d.ts +1 -1
- package/dist/scaffold/database.js +19 -126
- package/dist/scaffold/documentation.d.ts +0 -1
- package/dist/scaffold/documentation.js +82 -84
- package/dist/scaffold/expo-runtime.d.ts +2 -2
- package/dist/scaffold/expo-runtime.js +9 -101
- package/dist/scaffold/native-ui.d.ts +2 -0
- package/dist/scaffold/native-ui.js +74 -0
- package/dist/scaffold/stack-documentation.d.ts +0 -1
- package/dist/scaffold/stack-documentation.js +3 -49
- package/dist/scaffold/storage.d.ts +2 -0
- package/dist/scaffold/storage.js +21 -0
- package/dist/scaffold/styling.d.ts +1 -1
- package/dist/scaffold/styling.js +20 -28
- package/dist/scaffold/workspace.js +63 -199
- package/dist/stack-registry.d.ts +2 -58
- package/dist/stack-registry.js +22 -446
- package/dist/standard.js +7 -24
- 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 +4 -119
- package/docs/capabilities.md +110 -0
- package/docs/native-ui.md +102 -0
- package/docs/software-factory.md +16 -577
- package/docs/stack-standard.md +11 -307
- package/docs/ui.md +33 -0
- package/docs/verification.md +511 -0
- package/package.json +26 -27
- 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 -168
- 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 -172
- 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 -186
- package/dist/delivery.d.ts +0 -88
- package/dist/delivery.js +0 -570
- package/dist/inspector-model.d.ts +0 -123
- package/dist/inspector-model.js +0 -1
- package/dist/integration-service-readers.d.ts +0 -13
- package/dist/integration-service-readers.js +0 -173
- 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 -366
- package/dist/neon-service-data.d.ts +0 -8
- package/dist/neon-service-data.js +0 -117
- package/dist/platforms/desktop.d.ts +0 -2
- package/dist/platforms/desktop.js +0 -415
- package/dist/platforms/extension.d.ts +0 -2
- package/dist/platforms/extension.js +0 -328
- 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 -702
- package/dist/project-lifecycle.d.ts +0 -25
- package/dist/project-lifecycle.js +0 -57
- package/dist/project-state.d.ts +0 -49
- package/dist/project-state.js +0 -563
- package/dist/provider-auth.d.ts +0 -41
- package/dist/provider-auth.js +0 -215
- package/dist/provider-readiness.d.ts +0 -30
- package/dist/provider-readiness.js +0 -104
- package/dist/providers/adapters.d.ts +0 -17
- package/dist/providers/adapters.js +0 -278
- 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 -182
- package/dist/providers/definitions.d.ts +0 -318
- package/dist/providers/definitions.js +0 -127
- 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 -66
- package/dist/providers/recovery-verification.d.ts +0 -7
- package/dist/providers/recovery-verification.js +0 -112
- 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 -265
- 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 -289
- package/dist/provision.d.ts +0 -55
- package/dist/provision.js +0 -284
- 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 -122
- package/dist/registry/add.d.ts +0 -24
- package/dist/registry/add.js +0 -270
- package/dist/registry/bootstrap.d.ts +0 -2
- package/dist/registry/bootstrap.js +0 -14
- package/dist/registry/commands.d.ts +0 -3
- package/dist/registry/commands.js +0 -85
- package/dist/registry/presets.d.ts +0 -4
- package/dist/registry/presets.js +0 -41
- 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 -3
- package/dist/scaffold/auth.js +0 -151
- 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 -216
- package/dist/scaffold/cloudflare-services.d.ts +0 -8
- package/dist/scaffold/cloudflare-services.js +0 -198
- package/dist/scaffold/expo-auth.d.ts +0 -3
- package/dist/scaffold/expo-auth.js +0 -192
- package/dist/scaffold/expo-billing.d.ts +0 -3
- package/dist/scaffold/expo-billing.js +0 -292
- package/dist/scaffold/integrations.d.ts +0 -4
- package/dist/scaffold/integrations.js +0 -12
- package/dist/scaffold/lint.d.ts +0 -4
- package/dist/scaffold/lint.js +0 -56
- package/dist/scaffold/neon-realtime.d.ts +0 -2
- package/dist/scaffold/neon-realtime.js +0 -97
- package/dist/scaffold/services.d.ts +0 -5
- package/dist/scaffold/services.js +0 -108
- package/dist/scaffold/stream.d.ts +0 -2
- package/dist/scaffold/stream.js +0 -114
- package/dist/scaffold/void.d.ts +0 -4
- package/dist/scaffold/void.js +0 -264
- package/dist/scaffold/web.d.ts +0 -2
- package/dist/scaffold/web.js +0 -130
- 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 -78
- 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 -78
- package/dist/service-readers.d.ts +0 -8
- package/dist/service-readers.js +0 -247
- package/dist/services-command.d.ts +0 -39
- package/dist/services-command.js +0 -102
- package/dist/ship.d.ts +0 -348
- package/dist/ship.js +0 -239
- package/dist/vercel-project.d.ts +0 -101
- package/dist/vercel-project.js +0 -305
- package/dist/vercel.d.ts +0 -67
- package/dist/vercel.js +0 -581
- package/dist/vinext.d.ts +0 -2
- package/dist/vinext.js +0 -86
- package/dist/void-execution.d.ts +0 -10
- package/dist/void-execution.js +0 -94
- package/dist/void-migrations.d.ts +0 -6
- package/dist/void-migrations.js +0 -110
- package/dist/void-state.d.ts +0 -16
- package/dist/void-state.js +0 -65
- package/dist/void.d.ts +0 -3
- package/dist/void.js +0 -5
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
import { createHash } from 'node:crypto';
|
|
2
|
-
import { existsSync, readFileSync } from 'node:fs';
|
|
3
|
-
import path from 'node:path';
|
|
4
|
-
import { projectConfigPath } from './project-config.js';
|
|
5
|
-
import { cloudflareRequest } from './cloudflare.js';
|
|
6
|
-
import { configurationFile, usesVoid, defaultRunner, environment, readApplication, readConfig, targetDirectory, } from './project-state.js';
|
|
7
|
-
const stateDirectory = '.anhedral';
|
|
8
|
-
export function history(root, project) {
|
|
9
|
-
const file = path.join(root, stateDirectory, 'releases.json');
|
|
10
|
-
if (!existsSync(file))
|
|
11
|
-
return { schemaVersion: 1, projectId: project.id, releases: [] };
|
|
12
|
-
const value = JSON.parse(readFileSync(file, 'utf8'));
|
|
13
|
-
if (value.schemaVersion !== 1 || value.projectId !== project.id || !Array.isArray(value.releases))
|
|
14
|
-
throw new Error('Release history belongs to a different or unsupported project.');
|
|
15
|
-
return value;
|
|
16
|
-
}
|
|
17
|
-
export function checkTargets(root, project, allowResourcePlaceholders = false) {
|
|
18
|
-
if (!project.targets.length)
|
|
19
|
-
throw new Error('No Cloudflare targets; native applications require their platform delivery tools.');
|
|
20
|
-
for (const target of project.targets) {
|
|
21
|
-
const directory = targetDirectory(root, target);
|
|
22
|
-
const config = readConfig(directory);
|
|
23
|
-
if (config.name !== target.workerName ||
|
|
24
|
-
(config.env && Object.keys(config.env).length))
|
|
25
|
-
throw new Error('Worker name or environment changed; reconcile the application manifest before shipping.');
|
|
26
|
-
if (config.account_id && config.account_id !== project.accountId)
|
|
27
|
-
throw new Error('Wrangler configuration account conflicts with the registered account.');
|
|
28
|
-
const pending = structuredClone(config);
|
|
29
|
-
if (allowResourcePlaceholders) {
|
|
30
|
-
for (const [field, id] of [
|
|
31
|
-
['d1_databases', 'database_id'],
|
|
32
|
-
['kv_namespaces', 'id'],
|
|
33
|
-
['pipelines', 'stream'],
|
|
34
|
-
]) {
|
|
35
|
-
const entries = pending[field];
|
|
36
|
-
if (Array.isArray(entries))
|
|
37
|
-
for (const entry of entries) {
|
|
38
|
-
if (entry && typeof entry[id] === 'string' && entry[id].startsWith('REPLACE_WITH_'))
|
|
39
|
-
entry[id] = 'pending-resource';
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
if (/REPLACE_WITH_|YOUR_[A-Z_]+/.test(allowResourcePlaceholders || usesVoid(project)
|
|
44
|
-
? JSON.stringify(pending)
|
|
45
|
-
: readFileSync(configurationFile(directory), 'utf8')))
|
|
46
|
-
throw new Error('Configure selected resources before shipping; placeholder bindings remain.');
|
|
47
|
-
const pkg = JSON.parse(readFileSync(path.join(directory, 'package.json'), 'utf8'));
|
|
48
|
-
if (typeof pkg.scripts?.deploy !== 'string')
|
|
49
|
-
throw new Error('Deployment target has no deploy script.');
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
export function configurationFingerprint(root, project) {
|
|
53
|
-
const hash = createHash('sha256').update(readFileSync(projectConfigPath(root)));
|
|
54
|
-
for (const target of project.targets) {
|
|
55
|
-
const directory = targetDirectory(root, target);
|
|
56
|
-
hash.update(readFileSync(configurationFile(directory)));
|
|
57
|
-
if (usesVoid(project))
|
|
58
|
-
for (const name of ['void.config.ts', 'env.ts']) {
|
|
59
|
-
const file = path.join(directory, name);
|
|
60
|
-
hash.update(name).update(existsSync(file) ? readFileSync(file) : '<absent>');
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
return hash.digest('hex');
|
|
64
|
-
}
|
|
65
|
-
export function planDelivery(root, allowResourcePlaceholders = false) {
|
|
66
|
-
const project = readApplication(root);
|
|
67
|
-
checkTargets(root, project, allowResourcePlaceholders);
|
|
68
|
-
if (usesVoid(project)) {
|
|
69
|
-
const owners = project.targets.filter((target) => {
|
|
70
|
-
// Ownership is authored. Void may add a conventional migrations_dir to
|
|
71
|
-
// resolved consumer locks; those consumers must not become migration owners.
|
|
72
|
-
const config = JSON.parse(readFileSync(configurationFile(targetDirectory(root, target)), 'utf8'));
|
|
73
|
-
return (Array.isArray(config.d1_databases) &&
|
|
74
|
-
config.d1_databases.some((database) => database?.migrations_dir));
|
|
75
|
-
});
|
|
76
|
-
if (owners.length > 1)
|
|
77
|
-
throw new Error('Void delivery requires one D1 migration owner; other server targets must consume the shared database without deployment migrations.');
|
|
78
|
-
}
|
|
79
|
-
return {
|
|
80
|
-
project,
|
|
81
|
-
checks: [['pnpm', 'run', 'check']],
|
|
82
|
-
deployments: project.targets.map((target) => ({
|
|
83
|
-
target: target.id,
|
|
84
|
-
directory: target.directory,
|
|
85
|
-
command: usesVoid(project)
|
|
86
|
-
? ['pnpm', 'exec', 'void', 'deploy', '--platform', 'cloudflare']
|
|
87
|
-
: ['pnpm', 'run', 'deploy'],
|
|
88
|
-
})),
|
|
89
|
-
resourcesProvisioned: false,
|
|
90
|
-
audience: project.audience,
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
export function parseDeploymentOutput(source, target) {
|
|
94
|
-
const entries = source
|
|
95
|
-
.split('\n')
|
|
96
|
-
.filter((line) => line.trim())
|
|
97
|
-
.map((line) => JSON.parse(line));
|
|
98
|
-
const deploy = entries.findLast((entry) => entry.type === 'deploy' && entry.version === 1 && entry.worker_name === target.workerName);
|
|
99
|
-
if (!deploy || typeof deploy.version_id !== 'string' || !deploy.version_id)
|
|
100
|
-
throw new Error('No matching structured Wrangler deployment receipt. Deployment may have occurred; inspect provider status before retrying.');
|
|
101
|
-
const urls = Array.isArray(deploy.targets)
|
|
102
|
-
? deploy.targets.filter((url) => {
|
|
103
|
-
if (typeof url !== 'string')
|
|
104
|
-
return false;
|
|
105
|
-
try {
|
|
106
|
-
const value = new URL(url);
|
|
107
|
-
return value.protocol === 'https:' && !value.username && !value.password;
|
|
108
|
-
}
|
|
109
|
-
catch {
|
|
110
|
-
return false;
|
|
111
|
-
}
|
|
112
|
-
})
|
|
113
|
-
: [];
|
|
114
|
-
return { target: target.id, versionId: deploy.version_id, urls, providerConfirmed: false };
|
|
115
|
-
}
|
|
116
|
-
export function activeVersions(value) {
|
|
117
|
-
if (!value || typeof value !== 'object')
|
|
118
|
-
return [];
|
|
119
|
-
const record = value;
|
|
120
|
-
// Read only the active deployment's versions, never arbitrary historical IDs.
|
|
121
|
-
if (!Array.isArray(record.versions))
|
|
122
|
-
throw new Error('Unsupported provider deployment status; active versions are missing.');
|
|
123
|
-
const versions = record.versions
|
|
124
|
-
.map((entry) => {
|
|
125
|
-
if (!entry || typeof entry !== 'object')
|
|
126
|
-
throw new Error('Invalid provider version.');
|
|
127
|
-
const item = entry;
|
|
128
|
-
if (typeof item.version_id !== 'string' ||
|
|
129
|
-
!item.version_id ||
|
|
130
|
-
typeof item.percentage !== 'number' ||
|
|
131
|
-
!Number.isFinite(item.percentage) ||
|
|
132
|
-
item.percentage < 0 ||
|
|
133
|
-
item.percentage > 100)
|
|
134
|
-
throw new Error('Invalid provider traffic allocation.');
|
|
135
|
-
return { versionId: item.version_id, percentage: item.percentage };
|
|
136
|
-
})
|
|
137
|
-
.filter((entry) => entry.percentage > 0);
|
|
138
|
-
if (new Set(versions.map((entry) => entry.versionId)).size !== versions.length ||
|
|
139
|
-
Math.abs(versions.reduce((sum, entry) => sum + entry.percentage, 0) - 100) > 0.001)
|
|
140
|
-
throw new Error('Invalid provider traffic allocation.');
|
|
141
|
-
return versions;
|
|
142
|
-
}
|
|
143
|
-
export async function providerStatus(root, project, target, run, request) {
|
|
144
|
-
if (!usesVoid(project))
|
|
145
|
-
return JSON.parse(await run('pnpm', ['exec', 'wrangler', 'deployments', 'status', '--json'], targetDirectory(root, target), environment(project)));
|
|
146
|
-
const api = request ??
|
|
147
|
-
(await cloudflareRequest(project, targetDirectory(root, target), run, environment(project)));
|
|
148
|
-
const result = (await api('GET', `/workers/scripts/${encodeURIComponent(target.workerName)}/deployments`)).result;
|
|
149
|
-
if (!Array.isArray(result?.deployments) || !result.deployments.length)
|
|
150
|
-
throw new Error('No active Cloudflare deployment evidence.');
|
|
151
|
-
return result.deployments[0];
|
|
152
|
-
}
|
|
153
|
-
export function fullyActive(versions, versionId) {
|
|
154
|
-
return (versions.length === 1 && versions[0].versionId === versionId && versions[0].percentage === 100);
|
|
155
|
-
}
|
|
156
|
-
export function describeArchitecture(root, project) {
|
|
157
|
-
return project.targets.map((target) => {
|
|
158
|
-
const config = readConfig(targetDirectory(root, target));
|
|
159
|
-
const bindings = [];
|
|
160
|
-
for (const kind of [
|
|
161
|
-
'd1_databases',
|
|
162
|
-
'r2_buckets',
|
|
163
|
-
'kv_namespaces',
|
|
164
|
-
'hyperdrive',
|
|
165
|
-
'services',
|
|
166
|
-
'workflows',
|
|
167
|
-
]) {
|
|
168
|
-
const entries = config[kind];
|
|
169
|
-
if (Array.isArray(entries))
|
|
170
|
-
for (const entry of entries)
|
|
171
|
-
if (typeof entry?.binding === 'string')
|
|
172
|
-
bindings.push({ kind, binding: entry.binding });
|
|
173
|
-
}
|
|
174
|
-
return {
|
|
175
|
-
target: target.id,
|
|
176
|
-
workerName: target.workerName,
|
|
177
|
-
directory: target.directory,
|
|
178
|
-
bindings,
|
|
179
|
-
scheduled: typeof config.triggers === 'object' &&
|
|
180
|
-
config.triggers !== null &&
|
|
181
|
-
Array.isArray(config.triggers.crons)
|
|
182
|
-
? config.triggers.crons.filter((cron) => typeof cron === 'string')
|
|
183
|
-
: [],
|
|
184
|
-
};
|
|
185
|
-
});
|
|
186
|
-
}
|
package/dist/delivery.d.ts
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import { type Release, type ActiveVersion } from './delivery-evidence.js';
|
|
2
|
-
export { planDelivery, parseDeploymentOutput } from './delivery-evidence.js';
|
|
3
|
-
export type { Release } from './delivery-evidence.js';
|
|
4
|
-
import { type CloudflareRequest } from './cloudflare.js';
|
|
5
|
-
import { type ApplicationProject } from './project-state.js';
|
|
6
|
-
export { registerApplication, readApplication, defaultRunner, environment, targetDirectory, } from './project-state.js';
|
|
7
|
-
export type { ApplicationProject, DeploymentTarget, DeliveryRunner } from './project-state.js';
|
|
8
|
-
export declare function connectApplication(root: string, accountId: string | undefined, audience: 'public' | 'private' | undefined, run?: import("./project-state.js").DeliveryRunner, emails?: string[]): Promise<ApplicationProject>;
|
|
9
|
-
export declare function shipApplication(root: string, run?: import("./project-state.js").DeliveryRunner, suppliedRequest?: CloudflareRequest, options?: {
|
|
10
|
-
voidLogsDirectory?: string;
|
|
11
|
-
}): Promise<{
|
|
12
|
-
management: string;
|
|
13
|
-
state?: "configuration-required" | undefined;
|
|
14
|
-
deployed?: false | undefined;
|
|
15
|
-
activated?: true | undefined;
|
|
16
|
-
nextAction?: string | undefined;
|
|
17
|
-
projectId: string;
|
|
18
|
-
release: Release;
|
|
19
|
-
managementFile: string;
|
|
20
|
-
productVerification: string;
|
|
21
|
-
}>;
|
|
22
|
-
export declare function applicationStatus(root: string, refresh?: boolean, run?: import("./project-state.js").DeliveryRunner): Promise<{
|
|
23
|
-
project: ApplicationProject;
|
|
24
|
-
access: import("./access.js").AccessReceipt[] | undefined;
|
|
25
|
-
architecture: {
|
|
26
|
-
target: string;
|
|
27
|
-
workerName: string;
|
|
28
|
-
directory: string;
|
|
29
|
-
bindings: {
|
|
30
|
-
kind: string;
|
|
31
|
-
binding: string;
|
|
32
|
-
}[];
|
|
33
|
-
scheduled: string[];
|
|
34
|
-
}[];
|
|
35
|
-
releases: Release[];
|
|
36
|
-
provider: {
|
|
37
|
-
target: string;
|
|
38
|
-
activeRecordedVersion: boolean;
|
|
39
|
-
versions: ActiveVersion[];
|
|
40
|
-
}[];
|
|
41
|
-
evidence: string;
|
|
42
|
-
productVerification: string;
|
|
43
|
-
management: string | null;
|
|
44
|
-
}>;
|
|
45
|
-
export declare function verifyApplication(root: string, run?: import("./project-state.js").DeliveryRunner): Promise<{
|
|
46
|
-
projectId: string;
|
|
47
|
-
releaseId: string;
|
|
48
|
-
verification: {
|
|
49
|
-
state: "passed" | "failed";
|
|
50
|
-
checkedAt: string;
|
|
51
|
-
command: "pnpm run test:live";
|
|
52
|
-
};
|
|
53
|
-
managementFile: string;
|
|
54
|
-
}>;
|
|
55
|
-
export declare function rollbackApplication(root: string, releaseId: string, dataCompatible: boolean, run?: import("./project-state.js").DeliveryRunner, suppliedRequest?: CloudflareRequest): Promise<{
|
|
56
|
-
projectId: string;
|
|
57
|
-
release: Release;
|
|
58
|
-
managementFile: string;
|
|
59
|
-
productVerification: string;
|
|
60
|
-
dataRestored: boolean;
|
|
61
|
-
}>;
|
|
62
|
-
/** Recover current provider evidence, never fabricate a historical release or source-to-version mapping. */
|
|
63
|
-
export declare function recoverApplication(root: string, run?: import("./project-state.js").DeliveryRunner, suppliedRequest?: CloudflareRequest): Promise<{
|
|
64
|
-
schemaVersion: number;
|
|
65
|
-
projectId: string;
|
|
66
|
-
accountId: string | null;
|
|
67
|
-
checkedAt: string;
|
|
68
|
-
evidence: string;
|
|
69
|
-
localCommit: string;
|
|
70
|
-
sourceProvenance: string;
|
|
71
|
-
replayableReleaseId: string | null;
|
|
72
|
-
productVerification: string;
|
|
73
|
-
provider: {
|
|
74
|
-
target: string;
|
|
75
|
-
versions: ActiveVersion[];
|
|
76
|
-
bindingsConfirmed: boolean;
|
|
77
|
-
}[];
|
|
78
|
-
resources: {
|
|
79
|
-
kind: string;
|
|
80
|
-
name: string;
|
|
81
|
-
id: string;
|
|
82
|
-
target: string;
|
|
83
|
-
}[];
|
|
84
|
-
access: import("./access.js").AccessReceipt[] | undefined;
|
|
85
|
-
audience: "public" | "private";
|
|
86
|
-
audienceEvidence: string;
|
|
87
|
-
limitations: string[];
|
|
88
|
-
}>;
|