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,318 +0,0 @@
|
|
|
1
|
-
import type { StandardProduct } from '../stack-registry.js';
|
|
2
|
-
/** Public provider configuration describes resources, never credentials. Empty strings are
|
|
3
|
-
* permitted for scaffolding; provisioning separately checks the required choices. */
|
|
4
|
-
export interface NeonSettings {
|
|
5
|
-
projectId?: string;
|
|
6
|
-
name?: string;
|
|
7
|
-
organizationId?: string;
|
|
8
|
-
region?: string;
|
|
9
|
-
database?: string;
|
|
10
|
-
role?: string;
|
|
11
|
-
}
|
|
12
|
-
export interface ClerkSettings {
|
|
13
|
-
workspaceId?: string;
|
|
14
|
-
applicationId?: string;
|
|
15
|
-
name?: string;
|
|
16
|
-
environment?: '' | 'development' | 'production';
|
|
17
|
-
}
|
|
18
|
-
export interface ResendSettings {
|
|
19
|
-
domainId?: string;
|
|
20
|
-
domain?: string;
|
|
21
|
-
region?: string;
|
|
22
|
-
}
|
|
23
|
-
export interface StripeSettings {
|
|
24
|
-
accountId?: string;
|
|
25
|
-
mode?: '' | 'test' | 'live';
|
|
26
|
-
webhookUrl?: string;
|
|
27
|
-
webhookEvents?: string[];
|
|
28
|
-
}
|
|
29
|
-
export interface RevenueCatSettings {
|
|
30
|
-
projectId?: string;
|
|
31
|
-
name?: string;
|
|
32
|
-
iosAppId?: string;
|
|
33
|
-
androidAppId?: string;
|
|
34
|
-
webAppId?: string;
|
|
35
|
-
stripeAccountId?: string;
|
|
36
|
-
bundleId?: string;
|
|
37
|
-
packageName?: string;
|
|
38
|
-
}
|
|
39
|
-
export interface SentrySettings {
|
|
40
|
-
organization?: string;
|
|
41
|
-
team?: string;
|
|
42
|
-
project?: string;
|
|
43
|
-
name?: string;
|
|
44
|
-
platform?: string;
|
|
45
|
-
}
|
|
46
|
-
export interface PostHogSettings {
|
|
47
|
-
organizationId?: string;
|
|
48
|
-
projectId?: string;
|
|
49
|
-
name?: string;
|
|
50
|
-
region?: '' | 'us' | 'eu';
|
|
51
|
-
}
|
|
52
|
-
export interface OpenAISettings {
|
|
53
|
-
projectId?: string;
|
|
54
|
-
name?: string;
|
|
55
|
-
serviceAccountName?: string;
|
|
56
|
-
}
|
|
57
|
-
export interface ProviderSettingsById {
|
|
58
|
-
neon: NeonSettings;
|
|
59
|
-
clerk: ClerkSettings;
|
|
60
|
-
resend: ResendSettings;
|
|
61
|
-
stripe: StripeSettings;
|
|
62
|
-
revenuecat: RevenueCatSettings;
|
|
63
|
-
sentry: SentrySettings;
|
|
64
|
-
posthog: PostHogSettings;
|
|
65
|
-
openai: OpenAISettings;
|
|
66
|
-
}
|
|
67
|
-
export type IntegrationProvider = keyof ProviderSettingsById;
|
|
68
|
-
/** Shared adapter access remains bounded to known fields; provider configuration itself
|
|
69
|
-
* uses ProviderSettingsById so fields cannot leak between providers. */
|
|
70
|
-
export type ProviderSettings = Omit<NeonSettings & ClerkSettings & ResendSettings & StripeSettings & RevenueCatSettings & SentrySettings & PostHogSettings & OpenAISettings, 'region'> & {
|
|
71
|
-
region?: string;
|
|
72
|
-
};
|
|
73
|
-
export type ProviderField = keyof ProviderSettings;
|
|
74
|
-
export type FieldKind = 'text' | 'identity' | 'https-url' | 'events';
|
|
75
|
-
export interface ProviderFieldDefinition {
|
|
76
|
-
kind: FieldKind;
|
|
77
|
-
choices?: readonly string[];
|
|
78
|
-
}
|
|
79
|
-
export interface ProviderDefinition {
|
|
80
|
-
credential: string;
|
|
81
|
-
auth: {
|
|
82
|
-
path: string;
|
|
83
|
-
products?: readonly StandardProduct[];
|
|
84
|
-
runtime?: {
|
|
85
|
-
credential: string;
|
|
86
|
-
path: string;
|
|
87
|
-
};
|
|
88
|
-
};
|
|
89
|
-
origin: string;
|
|
90
|
-
regionalOrigins?: Readonly<Record<string, string>>;
|
|
91
|
-
fields: Partial<Record<ProviderField, ProviderFieldDefinition>>;
|
|
92
|
-
/** Describes adapter scope, not account permissions or production readiness. */
|
|
93
|
-
resources: readonly string[];
|
|
94
|
-
ownerSteps: readonly string[];
|
|
95
|
-
}
|
|
96
|
-
export declare const PROVIDER_DEFINITIONS: {
|
|
97
|
-
readonly neon: {
|
|
98
|
-
readonly credential: "NEON_API_KEY";
|
|
99
|
-
readonly auth: {
|
|
100
|
-
readonly path: "/api/v2/projects";
|
|
101
|
-
};
|
|
102
|
-
readonly origin: "https://console.neon.tech";
|
|
103
|
-
readonly fields: {
|
|
104
|
-
readonly projectId: {
|
|
105
|
-
readonly kind: "identity";
|
|
106
|
-
};
|
|
107
|
-
readonly name: {
|
|
108
|
-
readonly kind: "text";
|
|
109
|
-
};
|
|
110
|
-
readonly organizationId: {
|
|
111
|
-
readonly kind: "identity";
|
|
112
|
-
};
|
|
113
|
-
readonly region: {
|
|
114
|
-
readonly kind: "text";
|
|
115
|
-
};
|
|
116
|
-
readonly database: {
|
|
117
|
-
readonly kind: "text";
|
|
118
|
-
};
|
|
119
|
-
readonly role: {
|
|
120
|
-
readonly kind: "text";
|
|
121
|
-
};
|
|
122
|
-
};
|
|
123
|
-
readonly resources: readonly ["project", "database connection"];
|
|
124
|
-
readonly ownerSteps: readonly ["Choose an organization and region; approve any provider billing requirements."];
|
|
125
|
-
};
|
|
126
|
-
readonly clerk: {
|
|
127
|
-
readonly credential: "CLERK_PLATFORM_API_KEY";
|
|
128
|
-
readonly auth: {
|
|
129
|
-
readonly path: "/v1/platform/me";
|
|
130
|
-
readonly runtime: {
|
|
131
|
-
readonly credential: "CLERK_SECRET_KEY";
|
|
132
|
-
readonly path: "/v1/users/count";
|
|
133
|
-
};
|
|
134
|
-
};
|
|
135
|
-
readonly origin: "https://api.clerk.com";
|
|
136
|
-
readonly fields: {
|
|
137
|
-
readonly workspaceId: {
|
|
138
|
-
readonly kind: "identity";
|
|
139
|
-
};
|
|
140
|
-
readonly applicationId: {
|
|
141
|
-
readonly kind: "identity";
|
|
142
|
-
};
|
|
143
|
-
readonly name: {
|
|
144
|
-
readonly kind: "text";
|
|
145
|
-
};
|
|
146
|
-
readonly environment: {
|
|
147
|
-
readonly kind: "text";
|
|
148
|
-
readonly choices: readonly ["", "development", "production"];
|
|
149
|
-
};
|
|
150
|
-
};
|
|
151
|
-
readonly resources: readonly ["application", "environment keys"];
|
|
152
|
-
readonly ownerSteps: readonly ["Obtain Platform API access; configure production domains, DNS, and OAuth credentials."];
|
|
153
|
-
};
|
|
154
|
-
readonly resend: {
|
|
155
|
-
readonly credential: "RESEND_API_KEY";
|
|
156
|
-
readonly auth: {
|
|
157
|
-
readonly path: "/domains";
|
|
158
|
-
};
|
|
159
|
-
readonly origin: "https://api.resend.com";
|
|
160
|
-
readonly fields: {
|
|
161
|
-
readonly domainId: {
|
|
162
|
-
readonly kind: "identity";
|
|
163
|
-
};
|
|
164
|
-
readonly domain: {
|
|
165
|
-
readonly kind: "text";
|
|
166
|
-
};
|
|
167
|
-
readonly region: {
|
|
168
|
-
readonly kind: "text";
|
|
169
|
-
};
|
|
170
|
-
};
|
|
171
|
-
readonly resources: readonly ["domain", "sending key"];
|
|
172
|
-
readonly ownerSteps: readonly ["Publish domain verification DNS records and wait for verification."];
|
|
173
|
-
};
|
|
174
|
-
readonly stripe: {
|
|
175
|
-
readonly credential: "STRIPE_SECRET_KEY";
|
|
176
|
-
readonly auth: {
|
|
177
|
-
readonly path: "/v1/account";
|
|
178
|
-
};
|
|
179
|
-
readonly origin: "https://api.stripe.com";
|
|
180
|
-
readonly fields: {
|
|
181
|
-
readonly accountId: {
|
|
182
|
-
readonly kind: "identity";
|
|
183
|
-
};
|
|
184
|
-
readonly mode: {
|
|
185
|
-
readonly kind: "text";
|
|
186
|
-
readonly choices: readonly ["", "test", "live"];
|
|
187
|
-
};
|
|
188
|
-
readonly webhookUrl: {
|
|
189
|
-
readonly kind: "https-url";
|
|
190
|
-
};
|
|
191
|
-
readonly webhookEvents: {
|
|
192
|
-
readonly kind: "events";
|
|
193
|
-
};
|
|
194
|
-
};
|
|
195
|
-
readonly resources: readonly ["account verification", "webhook"];
|
|
196
|
-
readonly ownerSteps: readonly ["Complete account activation; define products, prices, and purchase behavior."];
|
|
197
|
-
};
|
|
198
|
-
readonly revenuecat: {
|
|
199
|
-
readonly credential: "RC_API_KEY";
|
|
200
|
-
readonly auth: {
|
|
201
|
-
readonly path: "/v2/projects";
|
|
202
|
-
};
|
|
203
|
-
readonly origin: "https://api.revenuecat.com";
|
|
204
|
-
readonly fields: {
|
|
205
|
-
readonly projectId: {
|
|
206
|
-
readonly kind: "identity";
|
|
207
|
-
};
|
|
208
|
-
readonly name: {
|
|
209
|
-
readonly kind: "text";
|
|
210
|
-
};
|
|
211
|
-
readonly iosAppId: {
|
|
212
|
-
readonly kind: "identity";
|
|
213
|
-
};
|
|
214
|
-
readonly androidAppId: {
|
|
215
|
-
readonly kind: "identity";
|
|
216
|
-
};
|
|
217
|
-
readonly webAppId: {
|
|
218
|
-
readonly kind: "identity";
|
|
219
|
-
};
|
|
220
|
-
readonly stripeAccountId: {
|
|
221
|
-
readonly kind: "identity";
|
|
222
|
-
};
|
|
223
|
-
readonly bundleId: {
|
|
224
|
-
readonly kind: "text";
|
|
225
|
-
};
|
|
226
|
-
readonly packageName: {
|
|
227
|
-
readonly kind: "text";
|
|
228
|
-
};
|
|
229
|
-
};
|
|
230
|
-
readonly resources: readonly ["project", "application", "SDK keys"];
|
|
231
|
-
readonly ownerSteps: readonly ["Configure store credentials or Stripe, products, offerings, and entitlements; verify purchases."];
|
|
232
|
-
};
|
|
233
|
-
readonly sentry: {
|
|
234
|
-
readonly credential: "SENTRY_AUTH_TOKEN";
|
|
235
|
-
readonly auth: {
|
|
236
|
-
readonly path: "/api/0/organizations/";
|
|
237
|
-
};
|
|
238
|
-
readonly origin: "https://sentry.io";
|
|
239
|
-
readonly fields: {
|
|
240
|
-
readonly organization: {
|
|
241
|
-
readonly kind: "identity";
|
|
242
|
-
};
|
|
243
|
-
readonly team: {
|
|
244
|
-
readonly kind: "identity";
|
|
245
|
-
};
|
|
246
|
-
readonly project: {
|
|
247
|
-
readonly kind: "identity";
|
|
248
|
-
};
|
|
249
|
-
readonly name: {
|
|
250
|
-
readonly kind: "text";
|
|
251
|
-
};
|
|
252
|
-
readonly platform: {
|
|
253
|
-
readonly kind: "text";
|
|
254
|
-
};
|
|
255
|
-
};
|
|
256
|
-
readonly resources: readonly ["project", "DSN"];
|
|
257
|
-
readonly ownerSteps: readonly ["Choose organization and team access; configure source maps and application instrumentation."];
|
|
258
|
-
};
|
|
259
|
-
readonly posthog: {
|
|
260
|
-
readonly credential: "POSTHOG_PERSONAL_API_KEY";
|
|
261
|
-
readonly auth: {
|
|
262
|
-
readonly path: "/api/organizations/";
|
|
263
|
-
};
|
|
264
|
-
readonly origin: "https://us.posthog.com";
|
|
265
|
-
readonly regionalOrigins: {
|
|
266
|
-
readonly us: "https://us.posthog.com";
|
|
267
|
-
readonly eu: "https://eu.posthog.com";
|
|
268
|
-
};
|
|
269
|
-
readonly fields: {
|
|
270
|
-
readonly organizationId: {
|
|
271
|
-
readonly kind: "identity";
|
|
272
|
-
};
|
|
273
|
-
readonly projectId: {
|
|
274
|
-
readonly kind: "identity";
|
|
275
|
-
};
|
|
276
|
-
readonly name: {
|
|
277
|
-
readonly kind: "text";
|
|
278
|
-
};
|
|
279
|
-
readonly region: {
|
|
280
|
-
readonly kind: "text";
|
|
281
|
-
readonly choices: readonly ["", "us", "eu"];
|
|
282
|
-
};
|
|
283
|
-
};
|
|
284
|
-
readonly resources: readonly ["project", "ingestion configuration"];
|
|
285
|
-
readonly ownerSteps: readonly ["Choose organization and region; define analytics events and consent behavior."];
|
|
286
|
-
};
|
|
287
|
-
readonly openai: {
|
|
288
|
-
readonly credential: "OPENAI_ADMIN_KEY";
|
|
289
|
-
readonly auth: {
|
|
290
|
-
readonly path: "/v1/organization/projects";
|
|
291
|
-
readonly products: readonly ["openai", "ai-sdk"];
|
|
292
|
-
readonly runtime: {
|
|
293
|
-
readonly credential: "OPENAI_API_KEY";
|
|
294
|
-
readonly path: "/v1/models";
|
|
295
|
-
};
|
|
296
|
-
};
|
|
297
|
-
readonly origin: "https://api.openai.com";
|
|
298
|
-
readonly fields: {
|
|
299
|
-
readonly projectId: {
|
|
300
|
-
readonly kind: "identity";
|
|
301
|
-
};
|
|
302
|
-
readonly name: {
|
|
303
|
-
readonly kind: "text";
|
|
304
|
-
};
|
|
305
|
-
readonly serviceAccountName: {
|
|
306
|
-
readonly kind: "text";
|
|
307
|
-
};
|
|
308
|
-
};
|
|
309
|
-
readonly resources: readonly ["project", "service account", "runtime key"];
|
|
310
|
-
readonly ownerSteps: readonly ["Obtain organization administration access; configure billing and application usage limits."];
|
|
311
|
-
};
|
|
312
|
-
};
|
|
313
|
-
export declare const INTEGRATION_PROVIDERS: IntegrationProvider[];
|
|
314
|
-
export declare const PROVIDER_TEXT_PATTERN = "^(?:[a-zA-Z0-9][a-zA-Z0-9_. -]*)?$";
|
|
315
|
-
export declare const PROVIDER_IDENTITY_PATTERN = "^(?:[a-zA-Z0-9][a-zA-Z0-9_-]{0,254})?$";
|
|
316
|
-
export declare const PROVIDER_EVENT_PATTERN = "^[a-z][a-z0-9_.]{0,100}$";
|
|
317
|
-
/** Schema and runtime use the same pattern; URL parsing also verifies normalization. */
|
|
318
|
-
export declare const PROVIDER_WEBHOOK_PATTERN = "^https://[^/?#@\\\\\\s]+(?:/[^?#\\\\\\s]*)?$";
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
const text = { kind: 'text' };
|
|
2
|
-
const identity = { kind: 'identity' };
|
|
3
|
-
export const PROVIDER_DEFINITIONS = {
|
|
4
|
-
neon: {
|
|
5
|
-
credential: 'NEON_API_KEY',
|
|
6
|
-
auth: { path: '/api/v2/projects' },
|
|
7
|
-
origin: 'https://console.neon.tech',
|
|
8
|
-
fields: {
|
|
9
|
-
projectId: identity,
|
|
10
|
-
name: text,
|
|
11
|
-
organizationId: identity,
|
|
12
|
-
region: text,
|
|
13
|
-
database: text,
|
|
14
|
-
role: text,
|
|
15
|
-
},
|
|
16
|
-
resources: ['project', 'database connection'],
|
|
17
|
-
ownerSteps: ['Choose an organization and region; approve any provider billing requirements.'],
|
|
18
|
-
},
|
|
19
|
-
clerk: {
|
|
20
|
-
credential: 'CLERK_PLATFORM_API_KEY',
|
|
21
|
-
auth: {
|
|
22
|
-
path: '/v1/platform/me',
|
|
23
|
-
runtime: { credential: 'CLERK_SECRET_KEY', path: '/v1/users/count' },
|
|
24
|
-
},
|
|
25
|
-
origin: 'https://api.clerk.com',
|
|
26
|
-
fields: {
|
|
27
|
-
workspaceId: identity,
|
|
28
|
-
applicationId: identity,
|
|
29
|
-
name: text,
|
|
30
|
-
environment: { kind: 'text', choices: ['', 'development', 'production'] },
|
|
31
|
-
},
|
|
32
|
-
resources: ['application', 'environment keys'],
|
|
33
|
-
ownerSteps: [
|
|
34
|
-
'Obtain Platform API access; configure production domains, DNS, and OAuth credentials.',
|
|
35
|
-
],
|
|
36
|
-
},
|
|
37
|
-
resend: {
|
|
38
|
-
credential: 'RESEND_API_KEY',
|
|
39
|
-
auth: { path: '/domains' },
|
|
40
|
-
origin: 'https://api.resend.com',
|
|
41
|
-
fields: { domainId: identity, domain: text, region: text },
|
|
42
|
-
resources: ['domain', 'sending key'],
|
|
43
|
-
ownerSteps: ['Publish domain verification DNS records and wait for verification.'],
|
|
44
|
-
},
|
|
45
|
-
stripe: {
|
|
46
|
-
credential: 'STRIPE_SECRET_KEY',
|
|
47
|
-
auth: { path: '/v1/account' },
|
|
48
|
-
origin: 'https://api.stripe.com',
|
|
49
|
-
fields: {
|
|
50
|
-
accountId: identity,
|
|
51
|
-
mode: { kind: 'text', choices: ['', 'test', 'live'] },
|
|
52
|
-
webhookUrl: { kind: 'https-url' },
|
|
53
|
-
webhookEvents: { kind: 'events' },
|
|
54
|
-
},
|
|
55
|
-
resources: ['account verification', 'webhook'],
|
|
56
|
-
ownerSteps: ['Complete account activation; define products, prices, and purchase behavior.'],
|
|
57
|
-
},
|
|
58
|
-
revenuecat: {
|
|
59
|
-
credential: 'RC_API_KEY',
|
|
60
|
-
auth: { path: '/v2/projects' },
|
|
61
|
-
origin: 'https://api.revenuecat.com',
|
|
62
|
-
fields: {
|
|
63
|
-
projectId: identity,
|
|
64
|
-
name: text,
|
|
65
|
-
iosAppId: identity,
|
|
66
|
-
androidAppId: identity,
|
|
67
|
-
webAppId: identity,
|
|
68
|
-
stripeAccountId: identity,
|
|
69
|
-
bundleId: text,
|
|
70
|
-
packageName: text,
|
|
71
|
-
},
|
|
72
|
-
resources: ['project', 'application', 'SDK keys'],
|
|
73
|
-
ownerSteps: [
|
|
74
|
-
'Configure store credentials or Stripe, products, offerings, and entitlements; verify purchases.',
|
|
75
|
-
],
|
|
76
|
-
},
|
|
77
|
-
sentry: {
|
|
78
|
-
credential: 'SENTRY_AUTH_TOKEN',
|
|
79
|
-
auth: { path: '/api/0/organizations/' },
|
|
80
|
-
origin: 'https://sentry.io',
|
|
81
|
-
fields: {
|
|
82
|
-
organization: identity,
|
|
83
|
-
team: identity,
|
|
84
|
-
project: identity,
|
|
85
|
-
name: text,
|
|
86
|
-
platform: text,
|
|
87
|
-
},
|
|
88
|
-
resources: ['project', 'DSN'],
|
|
89
|
-
ownerSteps: [
|
|
90
|
-
'Choose organization and team access; configure source maps and application instrumentation.',
|
|
91
|
-
],
|
|
92
|
-
},
|
|
93
|
-
posthog: {
|
|
94
|
-
credential: 'POSTHOG_PERSONAL_API_KEY',
|
|
95
|
-
auth: { path: '/api/organizations/' },
|
|
96
|
-
origin: 'https://us.posthog.com',
|
|
97
|
-
regionalOrigins: { us: 'https://us.posthog.com', eu: 'https://eu.posthog.com' },
|
|
98
|
-
fields: {
|
|
99
|
-
organizationId: identity,
|
|
100
|
-
projectId: identity,
|
|
101
|
-
name: text,
|
|
102
|
-
region: { kind: 'text', choices: ['', 'us', 'eu'] },
|
|
103
|
-
},
|
|
104
|
-
resources: ['project', 'ingestion configuration'],
|
|
105
|
-
ownerSteps: ['Choose organization and region; define analytics events and consent behavior.'],
|
|
106
|
-
},
|
|
107
|
-
openai: {
|
|
108
|
-
credential: 'OPENAI_ADMIN_KEY',
|
|
109
|
-
auth: {
|
|
110
|
-
path: '/v1/organization/projects',
|
|
111
|
-
products: ['openai', 'ai-sdk'],
|
|
112
|
-
runtime: { credential: 'OPENAI_API_KEY', path: '/v1/models' },
|
|
113
|
-
},
|
|
114
|
-
origin: 'https://api.openai.com',
|
|
115
|
-
fields: { projectId: identity, name: text, serviceAccountName: text },
|
|
116
|
-
resources: ['project', 'service account', 'runtime key'],
|
|
117
|
-
ownerSteps: [
|
|
118
|
-
'Obtain organization administration access; configure billing and application usage limits.',
|
|
119
|
-
],
|
|
120
|
-
},
|
|
121
|
-
};
|
|
122
|
-
export const INTEGRATION_PROVIDERS = Object.keys(PROVIDER_DEFINITIONS);
|
|
123
|
-
export const PROVIDER_TEXT_PATTERN = '^(?:[a-zA-Z0-9][a-zA-Z0-9_. -]*)?$';
|
|
124
|
-
export const PROVIDER_IDENTITY_PATTERN = '^(?:[a-zA-Z0-9][a-zA-Z0-9_-]{0,254})?$';
|
|
125
|
-
export const PROVIDER_EVENT_PATTERN = '^[a-z][a-z0-9_.]{0,100}$';
|
|
126
|
-
/** Schema and runtime use the same pattern; URL parsing also verifies normalization. */
|
|
127
|
-
export const PROVIDER_WEBHOOK_PATTERN = '^https://[^/?#@\\\\\\s]+(?:/[^?#\\\\\\s]*)?$';
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { type DeliveryRunner } from '../project-state.js';
|
|
2
|
-
export declare function planProviderProvisioning(root: string): {
|
|
3
|
-
schemaVersion: number;
|
|
4
|
-
providers: {
|
|
5
|
-
provider: keyof import("./definitions.js").ProviderSettingsById;
|
|
6
|
-
settings: import("./definitions.js").NeonSettings | import("./definitions.js").ClerkSettings | import("./definitions.js").ResendSettings | import("./definitions.js").StripeSettings | import("./definitions.js").RevenueCatSettings | import("./definitions.js").SentrySettings | import("./definitions.js").PostHogSettings | import("./definitions.js").OpenAISettings;
|
|
7
|
-
credential: string;
|
|
8
|
-
missing: string[];
|
|
9
|
-
}[];
|
|
10
|
-
configured: boolean;
|
|
11
|
-
mutation: boolean;
|
|
12
|
-
};
|
|
13
|
-
export declare function provisionSelectedProviders(root: string, dryRun?: boolean, run?: DeliveryRunner, send?: typeof fetch, environment?: NodeJS.ProcessEnv): Promise<{
|
|
14
|
-
schemaVersion: number;
|
|
15
|
-
results: {
|
|
16
|
-
provider: string;
|
|
17
|
-
resources: Record<string, string>;
|
|
18
|
-
ready: boolean;
|
|
19
|
-
nextActions: string[];
|
|
20
|
-
}[];
|
|
21
|
-
ready: boolean;
|
|
22
|
-
configuredFiles: string[];
|
|
23
|
-
mutation: boolean;
|
|
24
|
-
}>;
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { realpathSync } from 'node:fs';
|
|
2
|
-
import { defaultRunner, withApplicationLock } from '../project-state.js';
|
|
3
|
-
import { CREDENTIALS, providerApi, digest } from './api.js';
|
|
4
|
-
import { PROVIDER_ADAPTERS } from './adapters.js';
|
|
5
|
-
import { providerConfiguration, providerRequirements, selectedIntegrations } from './config.js';
|
|
6
|
-
import { privateStateDirectory, ProvisioningState } from './state.js';
|
|
7
|
-
import { configureRuntime } from './runtime.js';
|
|
8
|
-
export function planProviderProvisioning(root) {
|
|
9
|
-
const configuration = providerConfiguration(root);
|
|
10
|
-
const providers = selectedIntegrations(root).map((id) => {
|
|
11
|
-
const settings = configuration.providers[id] ?? {};
|
|
12
|
-
return {
|
|
13
|
-
provider: id,
|
|
14
|
-
settings,
|
|
15
|
-
credential: CREDENTIALS[id],
|
|
16
|
-
missing: providerRequirements(id, settings),
|
|
17
|
-
};
|
|
18
|
-
});
|
|
19
|
-
return {
|
|
20
|
-
schemaVersion: 1,
|
|
21
|
-
providers,
|
|
22
|
-
configured: providers.every((provider) => !provider.missing.length),
|
|
23
|
-
mutation: false,
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
export async function provisionSelectedProviders(root, dryRun = false, run = defaultRunner, send = fetch, environment = process.env) {
|
|
27
|
-
root = realpathSync(root);
|
|
28
|
-
const plan = planProviderProvisioning(root);
|
|
29
|
-
const fingerprint = digest(providerConfiguration(root));
|
|
30
|
-
const assertConfiguration = () => {
|
|
31
|
-
if (digest(providerConfiguration(root)) !== fingerprint)
|
|
32
|
-
throw new Error('Provider configuration changed during provisioning; inspect recorded resources before retrying.');
|
|
33
|
-
};
|
|
34
|
-
if (dryRun || !plan.providers.length)
|
|
35
|
-
return { ...plan, ready: plan.configured, results: [], configuredFiles: [] };
|
|
36
|
-
for (const provider of plan.providers) {
|
|
37
|
-
if (provider.missing.length)
|
|
38
|
-
throw new Error(`${provider.provider}: complete anhedral.json providers configuration (${provider.missing.join(', ')}).`);
|
|
39
|
-
if (!environment[provider.credential])
|
|
40
|
-
throw new Error(`${provider.provider}: supply ${provider.credential} before provisioning.`);
|
|
41
|
-
}
|
|
42
|
-
const directory = await privateStateDirectory(root, run);
|
|
43
|
-
return withApplicationLock(root, async () => {
|
|
44
|
-
const state = new ProvisioningState(directory);
|
|
45
|
-
for (const provider of plan.providers)
|
|
46
|
-
state.context(provider.provider, provider.settings);
|
|
47
|
-
const results = [];
|
|
48
|
-
const values = {};
|
|
49
|
-
for (const provider of plan.providers) {
|
|
50
|
-
assertConfiguration();
|
|
51
|
-
const response = await PROVIDER_ADAPTERS[provider.provider]({
|
|
52
|
-
id: provider.provider,
|
|
53
|
-
settings: provider.settings,
|
|
54
|
-
state,
|
|
55
|
-
environment,
|
|
56
|
-
api: providerApi(provider.provider, provider.settings, environment, send),
|
|
57
|
-
});
|
|
58
|
-
Object.assign(values, response.runtime);
|
|
59
|
-
results.push({
|
|
60
|
-
provider: provider.provider,
|
|
61
|
-
resources: response.resources,
|
|
62
|
-
ready: response.ready,
|
|
63
|
-
nextActions: response.nextActions,
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
assertConfiguration();
|
|
67
|
-
const configuredFiles = await configureRuntime(root, values, run);
|
|
68
|
-
return {
|
|
69
|
-
schemaVersion: 1,
|
|
70
|
-
results,
|
|
71
|
-
ready: results.every((result) => result.ready),
|
|
72
|
-
configuredFiles,
|
|
73
|
-
mutation: true,
|
|
74
|
-
};
|
|
75
|
-
});
|
|
76
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { type ApiObject } from './api.js';
|
|
2
|
-
import type { IntegrationProvider } from './config.js';
|
|
3
|
-
export type CredentialField = 'token' | 'secret' | 'api_key';
|
|
4
|
-
export type OperationCredentials = Partial<Record<CredentialField, string>>;
|
|
5
|
-
export interface MinimalReceipt {
|
|
6
|
-
id?: string | number;
|
|
7
|
-
application_id?: string | number;
|
|
8
|
-
project?: {
|
|
9
|
-
id: string | number;
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
/** Keep only identities required for adapter retries and separately retain supported
|
|
13
|
-
* one-time credentials. Provider responses often include unrelated secrets or metadata. */
|
|
14
|
-
export declare function splitReceipt(id: IntegrationProvider, value: unknown): {
|
|
15
|
-
receipt: MinimalReceipt;
|
|
16
|
-
credentials: Partial<Record<CredentialField, string>>;
|
|
17
|
-
};
|
|
18
|
-
export declare function validReceipt(id: IntegrationProvider, value: unknown): value is MinimalReceipt;
|
|
19
|
-
export declare function validCredentials(id: IntegrationProvider, value: unknown): value is OperationCredentials;
|
|
20
|
-
export declare function restoreReceipt(receipt: MinimalReceipt, credentials: OperationCredentials): ApiObject;
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { object, resourceId, text } from './api.js';
|
|
2
|
-
const allowedCredentials = {
|
|
3
|
-
resend: 'token',
|
|
4
|
-
stripe: 'secret',
|
|
5
|
-
openai: 'api_key',
|
|
6
|
-
};
|
|
7
|
-
function identity(value) {
|
|
8
|
-
resourceId(value);
|
|
9
|
-
return value;
|
|
10
|
-
}
|
|
11
|
-
/** Keep only identities required for adapter retries and separately retain supported
|
|
12
|
-
* one-time credentials. Provider responses often include unrelated secrets or metadata. */
|
|
13
|
-
export function splitReceipt(id, value) {
|
|
14
|
-
const response = object(value);
|
|
15
|
-
const receipt = {};
|
|
16
|
-
if (Object.hasOwn(response, 'id'))
|
|
17
|
-
receipt.id = identity(response.id);
|
|
18
|
-
if (id === 'neon' && Object.hasOwn(response, 'project'))
|
|
19
|
-
receipt.project = { id: identity(object(response.project).id) };
|
|
20
|
-
if (id === 'clerk' && Object.hasOwn(response, 'application_id'))
|
|
21
|
-
receipt.application_id = identity(response.application_id);
|
|
22
|
-
if (!Object.keys(receipt).length)
|
|
23
|
-
throw new Error('Provider returned no creation identity.');
|
|
24
|
-
const credentials = {};
|
|
25
|
-
const field = allowedCredentials[id];
|
|
26
|
-
if (field && Object.hasOwn(response, field))
|
|
27
|
-
credentials[field] = text(field === 'api_key' ? object(response.api_key).value : response[field]);
|
|
28
|
-
return { receipt, credentials };
|
|
29
|
-
}
|
|
30
|
-
export function validReceipt(id, value) {
|
|
31
|
-
try {
|
|
32
|
-
const response = object(value);
|
|
33
|
-
const allowed = [
|
|
34
|
-
'id',
|
|
35
|
-
...(id === 'neon' ? ['project'] : []),
|
|
36
|
-
...(id === 'clerk' ? ['application_id'] : []),
|
|
37
|
-
];
|
|
38
|
-
if (Object.keys(response).some((key) => !allowed.includes(key)))
|
|
39
|
-
return false;
|
|
40
|
-
if (response.project && Object.keys(object(response.project)).some((key) => key !== 'id'))
|
|
41
|
-
return false;
|
|
42
|
-
splitReceipt(id, response);
|
|
43
|
-
return true;
|
|
44
|
-
}
|
|
45
|
-
catch {
|
|
46
|
-
return false;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
export function validCredentials(id, value) {
|
|
50
|
-
try {
|
|
51
|
-
const credentials = object(value);
|
|
52
|
-
const allowed = allowedCredentials[id];
|
|
53
|
-
return Object.entries(credentials).every(([field, value]) => field === allowed && text(value) === value);
|
|
54
|
-
}
|
|
55
|
-
catch {
|
|
56
|
-
return false;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
export function restoreReceipt(receipt, credentials) {
|
|
60
|
-
return {
|
|
61
|
-
...receipt,
|
|
62
|
-
...(credentials.token ? { token: credentials.token } : {}),
|
|
63
|
-
...(credentials.secret ? { secret: credentials.secret } : {}),
|
|
64
|
-
...(credentials.api_key ? { api_key: { value: credentials.api_key } } : {}),
|
|
65
|
-
};
|
|
66
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { type ApiRequest } from './api.js';
|
|
2
|
-
import { type IntegrationProvider, type ProviderSettings } from './config.js';
|
|
3
|
-
import type { OperationDescriptor } from './state.js';
|
|
4
|
-
import type { MinimalReceipt } from './receipts.js';
|
|
5
|
-
/** Only verified identities may finish a pending journal operation. Every request is
|
|
6
|
-
* GET; key creation cannot be recovered by inventing a one-time credential. */
|
|
7
|
-
export declare function verifyRecoveredResource(provider: IntegrationProvider, descriptor: OperationDescriptor, requested: string, settings: ProviderSettings, api: ApiRequest): Promise<MinimalReceipt>;
|