@ankhorage/infra-supabase 0.0.0-stage → 0.5.15

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.
Files changed (115) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +39 -2
  3. package/dist/constants/infra.d.ts +11 -0
  4. package/dist/constants/infra.d.ts.map +1 -0
  5. package/dist/constants/infra.js +4 -0
  6. package/dist/constants/infra.js.map +1 -0
  7. package/dist/features/platform-infrastructure/adapters/outbound/createFetchSupabaseControlPlane.d.ts +9 -0
  8. package/dist/features/platform-infrastructure/adapters/outbound/createFetchSupabaseControlPlane.d.ts.map +1 -0
  9. package/dist/features/platform-infrastructure/adapters/outbound/createFetchSupabaseControlPlane.js +89 -0
  10. package/dist/features/platform-infrastructure/adapters/outbound/createFetchSupabaseControlPlane.js.map +1 -0
  11. package/dist/features/platform-infrastructure/application/use-cases/destroySupabaseAsync.d.ts +5 -0
  12. package/dist/features/platform-infrastructure/application/use-cases/destroySupabaseAsync.d.ts.map +1 -0
  13. package/dist/features/platform-infrastructure/application/use-cases/destroySupabaseAsync.js +64 -0
  14. package/dist/features/platform-infrastructure/application/use-cases/destroySupabaseAsync.js.map +1 -0
  15. package/dist/features/platform-infrastructure/application/use-cases/getSupabaseStatusAsync.d.ts +5 -0
  16. package/dist/features/platform-infrastructure/application/use-cases/getSupabaseStatusAsync.d.ts.map +1 -0
  17. package/dist/features/platform-infrastructure/application/use-cases/getSupabaseStatusAsync.js +59 -0
  18. package/dist/features/platform-infrastructure/application/use-cases/getSupabaseStatusAsync.js.map +1 -0
  19. package/dist/features/platform-infrastructure/application/use-cases/planSupabase.d.ts +4 -0
  20. package/dist/features/platform-infrastructure/application/use-cases/planSupabase.d.ts.map +1 -0
  21. package/dist/features/platform-infrastructure/application/use-cases/planSupabase.js +37 -0
  22. package/dist/features/platform-infrastructure/application/use-cases/planSupabase.js.map +1 -0
  23. package/dist/features/platform-infrastructure/application/use-cases/prepareSupabaseBootstrapCredentialsAsync.d.ts +4 -0
  24. package/dist/features/platform-infrastructure/application/use-cases/prepareSupabaseBootstrapCredentialsAsync.d.ts.map +1 -0
  25. package/dist/features/platform-infrastructure/application/use-cases/prepareSupabaseBootstrapCredentialsAsync.js +63 -0
  26. package/dist/features/platform-infrastructure/application/use-cases/prepareSupabaseBootstrapCredentialsAsync.js.map +1 -0
  27. package/dist/features/platform-infrastructure/application/use-cases/reconcileSupabaseAsync.d.ts +5 -0
  28. package/dist/features/platform-infrastructure/application/use-cases/reconcileSupabaseAsync.d.ts.map +1 -0
  29. package/dist/features/platform-infrastructure/application/use-cases/reconcileSupabaseAsync.js +66 -0
  30. package/dist/features/platform-infrastructure/application/use-cases/reconcileSupabaseAsync.js.map +1 -0
  31. package/dist/features/platform-infrastructure/application/use-cases/resolveSupabaseBootstrapCredentialsAsync.d.ts +5 -0
  32. package/dist/features/platform-infrastructure/application/use-cases/resolveSupabaseBootstrapCredentialsAsync.d.ts.map +1 -0
  33. package/dist/features/platform-infrastructure/application/use-cases/resolveSupabaseBootstrapCredentialsAsync.js +8 -0
  34. package/dist/features/platform-infrastructure/application/use-cases/resolveSupabaseBootstrapCredentialsAsync.js.map +1 -0
  35. package/dist/features/platform-infrastructure/application/use-cases/validateSupabaseAsync.d.ts +4 -0
  36. package/dist/features/platform-infrastructure/application/use-cases/validateSupabaseAsync.d.ts.map +1 -0
  37. package/dist/features/platform-infrastructure/application/use-cases/validateSupabaseAsync.js +26 -0
  38. package/dist/features/platform-infrastructure/application/use-cases/validateSupabaseAsync.js.map +1 -0
  39. package/dist/features/platform-infrastructure/application/use-cases/validateSupabasePersistenceCredentialsAsync.d.ts +4 -0
  40. package/dist/features/platform-infrastructure/application/use-cases/validateSupabasePersistenceCredentialsAsync.d.ts.map +1 -0
  41. package/dist/features/platform-infrastructure/application/use-cases/validateSupabasePersistenceCredentialsAsync.js +42 -0
  42. package/dist/features/platform-infrastructure/application/use-cases/validateSupabasePersistenceCredentialsAsync.js.map +1 -0
  43. package/dist/features/platform-infrastructure/composition/createInfraAdapter.d.ts +12 -0
  44. package/dist/features/platform-infrastructure/composition/createInfraAdapter.d.ts.map +1 -0
  45. package/dist/features/platform-infrastructure/composition/createInfraAdapter.js +37 -0
  46. package/dist/features/platform-infrastructure/composition/createInfraAdapter.js.map +1 -0
  47. package/dist/features/platform-infrastructure/constants/databaseBootstrap.d.ts +5 -0
  48. package/dist/features/platform-infrastructure/constants/databaseBootstrap.d.ts.map +1 -0
  49. package/dist/features/platform-infrastructure/constants/databaseBootstrap.js +233 -0
  50. package/dist/features/platform-infrastructure/constants/databaseBootstrap.js.map +1 -0
  51. package/dist/features/platform-infrastructure/constants/recovery.d.ts +4 -0
  52. package/dist/features/platform-infrastructure/constants/recovery.d.ts.map +1 -0
  53. package/dist/features/platform-infrastructure/constants/recovery.js +4 -0
  54. package/dist/features/platform-infrastructure/constants/recovery.js.map +1 -0
  55. package/dist/features/platform-infrastructure/constants/supabase.d.ts +18 -0
  56. package/dist/features/platform-infrastructure/constants/supabase.d.ts.map +1 -0
  57. package/dist/features/platform-infrastructure/constants/supabase.js +103 -0
  58. package/dist/features/platform-infrastructure/constants/supabase.js.map +1 -0
  59. package/dist/features/platform-infrastructure/domain/createSupabaseAuthWorkload.d.ts +4 -0
  60. package/dist/features/platform-infrastructure/domain/createSupabaseAuthWorkload.d.ts.map +1 -0
  61. package/dist/features/platform-infrastructure/domain/createSupabaseAuthWorkload.js +53 -0
  62. package/dist/features/platform-infrastructure/domain/createSupabaseAuthWorkload.js.map +1 -0
  63. package/dist/features/platform-infrastructure/domain/createSupabaseDatabaseBackupWorkload.d.ts +4 -0
  64. package/dist/features/platform-infrastructure/domain/createSupabaseDatabaseBackupWorkload.d.ts.map +1 -0
  65. package/dist/features/platform-infrastructure/domain/createSupabaseDatabaseBackupWorkload.js +212 -0
  66. package/dist/features/platform-infrastructure/domain/createSupabaseDatabaseBackupWorkload.js.map +1 -0
  67. package/dist/features/platform-infrastructure/domain/createSupabaseDatabaseDataRestoreWorkload.d.ts +4 -0
  68. package/dist/features/platform-infrastructure/domain/createSupabaseDatabaseDataRestoreWorkload.d.ts.map +1 -0
  69. package/dist/features/platform-infrastructure/domain/createSupabaseDatabaseDataRestoreWorkload.js +111 -0
  70. package/dist/features/platform-infrastructure/domain/createSupabaseDatabaseDataRestoreWorkload.js.map +1 -0
  71. package/dist/features/platform-infrastructure/domain/createSupabaseDatabasePersistence.d.ts +4 -0
  72. package/dist/features/platform-infrastructure/domain/createSupabaseDatabasePersistence.d.ts.map +1 -0
  73. package/dist/features/platform-infrastructure/domain/createSupabaseDatabasePersistence.js +19 -0
  74. package/dist/features/platform-infrastructure/domain/createSupabaseDatabasePersistence.js.map +1 -0
  75. package/dist/features/platform-infrastructure/domain/createSupabaseDatabaseRestore.d.ts +13 -0
  76. package/dist/features/platform-infrastructure/domain/createSupabaseDatabaseRestore.d.ts.map +1 -0
  77. package/dist/features/platform-infrastructure/domain/createSupabaseDatabaseRestore.js +147 -0
  78. package/dist/features/platform-infrastructure/domain/createSupabaseDatabaseRestore.js.map +1 -0
  79. package/dist/features/platform-infrastructure/domain/createSupabaseOperationalWorkloads.d.ts +4 -0
  80. package/dist/features/platform-infrastructure/domain/createSupabaseOperationalWorkloads.d.ts.map +1 -0
  81. package/dist/features/platform-infrastructure/domain/createSupabaseOperationalWorkloads.js +103 -0
  82. package/dist/features/platform-infrastructure/domain/createSupabaseOperationalWorkloads.js.map +1 -0
  83. package/dist/features/platform-infrastructure/domain/createSupabaseS3Values.d.ts +14 -0
  84. package/dist/features/platform-infrastructure/domain/createSupabaseS3Values.d.ts.map +1 -0
  85. package/dist/features/platform-infrastructure/domain/createSupabaseS3Values.js +30 -0
  86. package/dist/features/platform-infrastructure/domain/createSupabaseS3Values.js.map +1 -0
  87. package/dist/features/platform-infrastructure/domain/createSupabaseStorageWorkload.d.ts +4 -0
  88. package/dist/features/platform-infrastructure/domain/createSupabaseStorageWorkload.d.ts.map +1 -0
  89. package/dist/features/platform-infrastructure/domain/createSupabaseStorageWorkload.js +100 -0
  90. package/dist/features/platform-infrastructure/domain/createSupabaseStorageWorkload.js.map +1 -0
  91. package/dist/features/platform-infrastructure/domain/createSupabaseWorkloads.d.ts +4 -0
  92. package/dist/features/platform-infrastructure/domain/createSupabaseWorkloads.d.ts.map +1 -0
  93. package/dist/features/platform-infrastructure/domain/createSupabaseWorkloads.js +234 -0
  94. package/dist/features/platform-infrastructure/domain/createSupabaseWorkloads.js.map +1 -0
  95. package/dist/features/platform-infrastructure/domain/resolveSupabaseDesiredState.d.ts +5 -0
  96. package/dist/features/platform-infrastructure/domain/resolveSupabaseDesiredState.d.ts.map +1 -0
  97. package/dist/features/platform-infrastructure/domain/resolveSupabaseDesiredState.js +88 -0
  98. package/dist/features/platform-infrastructure/domain/resolveSupabaseDesiredState.js.map +1 -0
  99. package/dist/features/platform-infrastructure/utils/resolveSupabaseControlPlaneUrl.d.ts +4 -0
  100. package/dist/features/platform-infrastructure/utils/resolveSupabaseControlPlaneUrl.d.ts.map +1 -0
  101. package/dist/features/platform-infrastructure/utils/resolveSupabaseControlPlaneUrl.js +45 -0
  102. package/dist/features/platform-infrastructure/utils/resolveSupabaseControlPlaneUrl.js.map +1 -0
  103. package/dist/features/platform-infrastructure/utils/validateSupabaseBootstrapCredentials.d.ts +5 -0
  104. package/dist/features/platform-infrastructure/utils/validateSupabaseBootstrapCredentials.d.ts.map +1 -0
  105. package/dist/features/platform-infrastructure/utils/validateSupabaseBootstrapCredentials.js +66 -0
  106. package/dist/features/platform-infrastructure/utils/validateSupabaseBootstrapCredentials.js.map +1 -0
  107. package/dist/index.d.ts +6 -0
  108. package/dist/index.d.ts.map +1 -0
  109. package/dist/index.js +5 -0
  110. package/dist/index.js.map +1 -0
  111. package/dist/types/supabase.d.ts +34 -0
  112. package/dist/types/supabase.d.ts.map +1 -0
  113. package/dist/types/supabase.js +2 -0
  114. package/dist/types/supabase.js.map +1 -0
  115. package/package.json +67 -4
@@ -0,0 +1,234 @@
1
+ import { SUPABASE_VAULT_MIGRATION_SQL } from '@ankhorage/supabase-vault/migrations';
2
+ import { SUPABASE_DATABASE_JWT_SQL, SUPABASE_DATABASE_REALTIME_SQL, SUPABASE_DATABASE_ROLES_SQL, SUPABASE_DATABASE_WEBHOOKS_SQL, } from '../constants/databaseBootstrap';
3
+ import { SUPABASE_DATA_RESTORE_WORKLOAD_ID } from '../constants/recovery';
4
+ import { SUPABASE_BOOTSTRAP_CREDENTIAL, SUPABASE_ENVOY_CONFIG, SUPABASE_ENVOY_CONFIG_WITHOUT_STORAGE, SUPABASE_IMAGES, } from '../constants/supabase';
5
+ import { createSupabaseAuthWorkload } from './createSupabaseAuthWorkload';
6
+ import { createSupabaseDatabaseBackupWorkload } from './createSupabaseDatabaseBackupWorkload';
7
+ import { createSupabaseDatabaseDataRestoreWorkload } from './createSupabaseDatabaseDataRestoreWorkload';
8
+ import { createSupabaseDatabasePersistence } from './createSupabaseDatabasePersistence';
9
+ import { createSupabaseDatabaseRestore } from './createSupabaseDatabaseRestore';
10
+ import { createSupabaseOperationalWorkloads } from './createSupabaseOperationalWorkloads';
11
+ import { createSupabaseStorageWorkload } from './createSupabaseStorageWorkload';
12
+ /*** Project the selected Supabase platform into one ordered runtime-neutral workload graph. */
13
+ export function createSupabaseWorkloads(context) {
14
+ const baseUrl = context.desired.networking?.publicBaseUrl ?? '';
15
+ const [imgproxy, meta, studio] = createSupabaseOperationalWorkloads(context, baseUrl);
16
+ const ownsObjectStorage = context.desired.objectStorage?.provider === 'supabase';
17
+ const dataRestore = createSupabaseDatabaseDataRestoreWorkload(context, ownsObjectStorage);
18
+ const backup = createSupabaseDatabaseBackupWorkload(context);
19
+ return [
20
+ createDatabaseWorkload(context),
21
+ createSupabaseAuthWorkload(context, baseUrl),
22
+ createRestWorkload(),
23
+ createRealtimeWorkload(),
24
+ ...(ownsObjectStorage ? [imgproxy, createSupabaseStorageWorkload(context, baseUrl)] : []),
25
+ ...(dataRestore === undefined ? [] : [dataRestore]),
26
+ ...(backup === undefined ? [] : [backup]),
27
+ meta,
28
+ studio,
29
+ createGatewayWorkload(context, baseUrl, ownsObjectStorage, dataRestore !== undefined),
30
+ ];
31
+ }
32
+ const SUPABASE_DATABASE_ARGUMENTS = [
33
+ 'postgres',
34
+ '-c',
35
+ 'config_file=/etc/postgresql/postgresql.conf',
36
+ '-c',
37
+ 'log_min_messages=fatal',
38
+ ];
39
+ /*** Create persistent Postgres 17 data and custom configuration for safe runtime recreation. */
40
+ function createDatabaseWorkload(context) {
41
+ const prod = isSupabaseProductionTier(context);
42
+ const restore = createSupabaseDatabaseRestore(context);
43
+ return {
44
+ id: 'supabase-db',
45
+ artifact: { kind: 'image', image: SUPABASE_IMAGES.database },
46
+ ...(restore.entrypoint === undefined ? {} : { command: restore.entrypoint.command }),
47
+ args: [...(restore.entrypoint?.args ?? []), ...SUPABASE_DATABASE_ARGUMENTS],
48
+ ports: { postgres: { port: 5432 } },
49
+ environment: {
50
+ POSTGRES_DB: literal('postgres'),
51
+ POSTGRES_HOST: literal('/var/run/postgresql'),
52
+ POSTGRES_PORT: literal('5432'),
53
+ PGPORT: literal('5432'),
54
+ PGDATABASE: literal('postgres'),
55
+ POSTGRES_PASSWORD: credential('postgresPassword'),
56
+ PGPASSWORD: credential('postgresPassword'),
57
+ JWT_SECRET: credential('jwtSecret'),
58
+ JWT_EXP: literal('3600'),
59
+ ...restore.environment,
60
+ },
61
+ files: createDatabaseBootstrapFiles(context, restore.files),
62
+ health: createDatabaseHealth(Object.keys(restore.files).length > 0),
63
+ persistence: createSupabaseDatabasePersistence(prod),
64
+ exposure: 'internal',
65
+ replicas: 1,
66
+ };
67
+ }
68
+ /*** Compose database bootstrap SQL, including selected provider-owned migrations. */
69
+ function createDatabaseBootstrapFiles(context, restoreFiles) {
70
+ return {
71
+ '/docker-entrypoint-initdb.d/init-scripts/98-webhooks.sql': literal(SUPABASE_DATABASE_WEBHOOKS_SQL),
72
+ '/docker-entrypoint-initdb.d/init-scripts/99-roles.sql': literal(SUPABASE_DATABASE_ROLES_SQL),
73
+ '/docker-entrypoint-initdb.d/init-scripts/99-jwt.sql': literal(SUPABASE_DATABASE_JWT_SQL),
74
+ '/docker-entrypoint-initdb.d/migrations/99-realtime.sql': literal(SUPABASE_DATABASE_REALTIME_SQL),
75
+ ...(context.desired.secretStore?.provider === 'supabase-vault'
76
+ ? {
77
+ '/docker-entrypoint-initdb.d/migrations/99-ankhorage-supabase-vault.sql': literal(SUPABASE_VAULT_MIGRATION_SQL),
78
+ }
79
+ : {}),
80
+ ...restoreFiles,
81
+ };
82
+ }
83
+ /*** Keep the database alive while a configured first-boot restore waits for off-host backup data. */
84
+ function createDatabaseHealth(restoreEnabled) {
85
+ return {
86
+ kind: 'command',
87
+ command: ['pg_isready', '-U', 'postgres', '-h', 'localhost'],
88
+ intervalSeconds: 10,
89
+ timeoutSeconds: 5,
90
+ failureThreshold: restoreEnabled ? 60 : 3,
91
+ };
92
+ }
93
+ /*** Create the PostgREST Data API workload. */
94
+ function createRestWorkload() {
95
+ return {
96
+ id: 'supabase-rest',
97
+ artifact: { kind: 'image', image: SUPABASE_IMAGES.rest },
98
+ command: ['postgrest'],
99
+ ports: { http: { port: 3000 } },
100
+ environment: {
101
+ PGRST_DB_URI: databaseUrl('authenticator'),
102
+ PGRST_DB_SCHEMAS: literal('public,storage,graphql_public'),
103
+ PGRST_DB_MAX_ROWS: literal('1000'),
104
+ PGRST_DB_EXTRA_SEARCH_PATH: literal('public'),
105
+ PGRST_DB_ANON_ROLE: literal('anon'),
106
+ PGRST_ADMIN_SERVER_PORT: literal('3001'),
107
+ PGRST_ADMIN_SERVER_HOST: literal('localhost'),
108
+ PGRST_JWT_SECRET: credential('jwtSecret'),
109
+ PGRST_DB_USE_LEGACY_GUCS: literal('false'),
110
+ PGRST_APP_SETTINGS_JWT_SECRET: credential('jwtSecret'),
111
+ PGRST_APP_SETTINGS_JWT_EXP: literal('3600'),
112
+ },
113
+ health: { kind: 'command', command: ['postgrest', '--ready'] },
114
+ exposure: 'internal',
115
+ replicas: 1,
116
+ dependsOn: { 'supabase-db': true },
117
+ };
118
+ }
119
+ /*** Create the Realtime workload without runtime-specific networking assumptions. */
120
+ function createRealtimeWorkload() {
121
+ return {
122
+ id: 'supabase-realtime',
123
+ artifact: { kind: 'image', image: SUPABASE_IMAGES.realtime },
124
+ ports: { http: { port: 4000 } },
125
+ environment: {
126
+ PORT: literal('4000'),
127
+ DB_HOST: literal('supabase-db'),
128
+ DB_PORT: literal('5432'),
129
+ DB_USER: literal('supabase_admin'),
130
+ DB_PASSWORD: credential('postgresPassword'),
131
+ DB_NAME: literal('postgres'),
132
+ DB_AFTER_CONNECT_QUERY: literal('SET search_path TO _realtime'),
133
+ DB_ENC_KEY: credential('realtimeDatabaseEncryptionKey'),
134
+ API_JWT_SECRET: credential('jwtSecret'),
135
+ ANON_KEY: credential('anonKey'),
136
+ SECRET_KEY_BASE: credential('realtimeSecretKeyBase'),
137
+ METRICS_JWT_SECRET: credential('jwtSecret'),
138
+ ERL_AFLAGS: literal('-proto_dist inet_tcp'),
139
+ DNS_NODES: literal("''"),
140
+ RLIMIT_NOFILE: literal('10000'),
141
+ APP_NAME: literal('realtime'),
142
+ SEED_SELF_HOST: literal('true'),
143
+ RUN_JANITOR: literal('true'),
144
+ DISABLE_HEALTHCHECK_LOGGING: literal('true'),
145
+ },
146
+ health: {
147
+ kind: 'command',
148
+ command: [
149
+ 'sh',
150
+ '-c',
151
+ 'curl -sSfL --head -o /dev/null -H "Authorization: Bearer `printenv ANON_KEY`" http://localhost:4000/api/tenants/realtime-dev/health',
152
+ ],
153
+ intervalSeconds: 30,
154
+ timeoutSeconds: 5,
155
+ failureThreshold: 3,
156
+ },
157
+ exposure: 'internal',
158
+ replicas: 1,
159
+ dependsOn: { 'supabase-db': true },
160
+ };
161
+ }
162
+ /*** Create the current Envoy gateway with portable service-DNS routes. */
163
+ function createGatewayWorkload(context, baseUrl, ownsObjectStorage, recoveryEnabled) {
164
+ const publishedPort = resolveLocalPublishedPort(context, baseUrl);
165
+ return {
166
+ id: 'supabase-gateway',
167
+ artifact: { kind: 'image', image: SUPABASE_IMAGES.gateway },
168
+ command: ['envoy'],
169
+ args: ['-c', '/etc/envoy/envoy.yaml'],
170
+ ports: {
171
+ http: {
172
+ port: 8000,
173
+ ...(publishedPort === undefined ? {} : { publishedPort }),
174
+ },
175
+ },
176
+ files: {
177
+ '/etc/envoy/envoy.yaml': literal(ownsObjectStorage ? SUPABASE_ENVOY_CONFIG : SUPABASE_ENVOY_CONFIG_WITHOUT_STORAGE),
178
+ },
179
+ health: {
180
+ kind: 'command',
181
+ command: ['timeout', '1', 'bash', '-c', '</dev/tcp/127.0.0.1/8000'],
182
+ intervalSeconds: 10,
183
+ timeoutSeconds: 5,
184
+ failureThreshold: 3,
185
+ },
186
+ exposure: 'public',
187
+ replicas: 1,
188
+ dependsOn: {
189
+ 'supabase-auth': true,
190
+ 'supabase-rest': true,
191
+ 'supabase-realtime': true,
192
+ ...(ownsObjectStorage ? { 'supabase-storage': true } : {}),
193
+ ...(recoveryEnabled ? { [SUPABASE_DATA_RESTORE_WORKLOAD_ID]: true } : {}),
194
+ },
195
+ };
196
+ }
197
+ /*** Decide whether the selected Supabase database tier requires production persistence policy. */
198
+ function isSupabaseProductionTier(context) {
199
+ return (context.desired.database?.provider === 'supabase' && context.desired.database.tier === 'prod');
200
+ }
201
+ /*** Resolve an exact plain-HTTP listener only for the local runtime boundary. */
202
+ function resolveLocalPublishedPort(context, baseUrl) {
203
+ if (context.environment !== 'local')
204
+ return undefined;
205
+ try {
206
+ const url = new URL(baseUrl);
207
+ if (url.protocol !== 'http:')
208
+ return undefined;
209
+ return url.port === '' ? 80 : Number(url.port);
210
+ }
211
+ catch {
212
+ return undefined;
213
+ }
214
+ }
215
+ /*** Create one literal workload value. */
216
+ function literal(value) {
217
+ return { kind: 'literal', value };
218
+ }
219
+ /*** Create one execution-only control-plane credential field reference. */
220
+ function credential(key) {
221
+ return { kind: 'credential', reference: SUPABASE_BOOTSTRAP_CREDENTIAL, key };
222
+ }
223
+ /*** Create one password-bearing Postgres URL materialized only by the selected runtime. */
224
+ function databaseUrl(user) {
225
+ return {
226
+ kind: 'template',
227
+ segments: [
228
+ literal(`postgres://${user}:`),
229
+ credential('postgresPassword'),
230
+ literal('@supabase-db:5432/postgres'),
231
+ ],
232
+ };
233
+ }
234
+ //# sourceMappingURL=createSupabaseWorkloads.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createSupabaseWorkloads.js","sourceRoot":"","sources":["../../../../src/features/platform-infrastructure/domain/createSupabaseWorkloads.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,4BAA4B,EAAE,MAAM,sCAAsC,CAAC;AAEpF,OAAO,EACL,yBAAyB,EACzB,8BAA8B,EAC9B,2BAA2B,EAC3B,8BAA8B,GAC/B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,iCAAiC,EAAE,MAAM,uBAAuB,CAAC;AAC1E,OAAO,EACL,6BAA6B,EAC7B,qBAAqB,EACrB,qCAAqC,EACrC,eAAe,GAChB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAE,oCAAoC,EAAE,MAAM,wCAAwC,CAAC;AAC9F,OAAO,EAAE,yCAAyC,EAAE,MAAM,6CAA6C,CAAC;AACxG,OAAO,EAAE,iCAAiC,EAAE,MAAM,qCAAqC,CAAC;AACxF,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAChF,OAAO,EAAE,kCAAkC,EAAE,MAAM,sCAAsC,CAAC;AAC1F,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAEhF,+FAA+F;AAC/F,MAAM,UAAU,uBAAuB,CACrC,OAA8B;IAE9B,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,UAAU,EAAE,aAAa,IAAI,EAAE,CAAC;IAChE,MAAM,CAAC,QAA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CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACjD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC;AAED,0CAA0C;AAC1C,SAAS,OAAO,CAAC,KAAa;IAC5B,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;AACpC,CAAC;AAED,2EAA2E;AAC3E,SAAS,UAAU,CAAC,GAAW;IAC7B,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,SAAS,EAAE,6BAA6B,EAAE,GAAG,EAAE,CAAC;AAC/E,CAAC;AAED,2FAA2F;AAC3F,SAAS,WAAW,CAAC,IAAY;IAC/B,OAAO;QACL,IAAI,EAAE,UAAU;QAChB,QAAQ,EAAE;YACR,OAAO,CAAC,cAAc,IAAI,GAAG,CAAC;YAC9B,UAAU,CAAC,kBAAkB,CAAC;YAC9B,OAAO,CAAC,4BAA4B,CAAC;SACtC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import type {\n InfraExecutionContext,\n InfraWorkloadScalarValue,\n InfraWorkloadSpec,\n InfraWorkloadValue,\n} from '@ankhorage/contracts/infra';\nimport { SUPABASE_VAULT_MIGRATION_SQL } from '@ankhorage/supabase-vault/migrations';\n\nimport {\n SUPABASE_DATABASE_JWT_SQL,\n SUPABASE_DATABASE_REALTIME_SQL,\n SUPABASE_DATABASE_ROLES_SQL,\n SUPABASE_DATABASE_WEBHOOKS_SQL,\n} from '../constants/databaseBootstrap';\nimport { SUPABASE_DATA_RESTORE_WORKLOAD_ID } from '../constants/recovery';\nimport {\n SUPABASE_BOOTSTRAP_CREDENTIAL,\n SUPABASE_ENVOY_CONFIG,\n SUPABASE_ENVOY_CONFIG_WITHOUT_STORAGE,\n SUPABASE_IMAGES,\n} from '../constants/supabase';\nimport { createSupabaseAuthWorkload } from './createSupabaseAuthWorkload';\nimport { createSupabaseDatabaseBackupWorkload } from './createSupabaseDatabaseBackupWorkload';\nimport { createSupabaseDatabaseDataRestoreWorkload } from './createSupabaseDatabaseDataRestoreWorkload';\nimport { createSupabaseDatabasePersistence } from './createSupabaseDatabasePersistence';\nimport { createSupabaseDatabaseRestore } from './createSupabaseDatabaseRestore';\nimport { createSupabaseOperationalWorkloads } from './createSupabaseOperationalWorkloads';\nimport { createSupabaseStorageWorkload } from './createSupabaseStorageWorkload';\n\n/*** Project the selected Supabase platform into one ordered runtime-neutral workload graph. */\nexport function createSupabaseWorkloads(\n context: InfraExecutionContext,\n): readonly InfraWorkloadSpec[] {\n const baseUrl = context.desired.networking?.publicBaseUrl ?? '';\n const [imgproxy, meta, studio] = createSupabaseOperationalWorkloads(context, baseUrl);\n const ownsObjectStorage = context.desired.objectStorage?.provider === 'supabase';\n const dataRestore = createSupabaseDatabaseDataRestoreWorkload(context, ownsObjectStorage);\n const backup = createSupabaseDatabaseBackupWorkload(context);\n return [\n createDatabaseWorkload(context),\n createSupabaseAuthWorkload(context, baseUrl),\n createRestWorkload(),\n createRealtimeWorkload(),\n ...(ownsObjectStorage ? [imgproxy, createSupabaseStorageWorkload(context, baseUrl)] : []),\n ...(dataRestore === undefined ? [] : [dataRestore]),\n ...(backup === undefined ? [] : [backup]),\n meta,\n studio,\n createGatewayWorkload(context, baseUrl, ownsObjectStorage, dataRestore !== undefined),\n ];\n}\n\nconst SUPABASE_DATABASE_ARGUMENTS = [\n 'postgres',\n '-c',\n 'config_file=/etc/postgresql/postgresql.conf',\n '-c',\n 'log_min_messages=fatal',\n] as const;\n\n/*** Create persistent Postgres 17 data and custom configuration for safe runtime recreation. */\nfunction createDatabaseWorkload(context: InfraExecutionContext): InfraWorkloadSpec {\n const prod = isSupabaseProductionTier(context);\n const restore = createSupabaseDatabaseRestore(context);\n return {\n id: 'supabase-db',\n artifact: { kind: 'image', image: SUPABASE_IMAGES.database },\n ...(restore.entrypoint === undefined ? {} : { command: restore.entrypoint.command }),\n args: [...(restore.entrypoint?.args ?? []), ...SUPABASE_DATABASE_ARGUMENTS],\n ports: { postgres: { port: 5432 } },\n environment: {\n POSTGRES_DB: literal('postgres'),\n POSTGRES_HOST: literal('/var/run/postgresql'),\n POSTGRES_PORT: literal('5432'),\n PGPORT: literal('5432'),\n PGDATABASE: literal('postgres'),\n POSTGRES_PASSWORD: credential('postgresPassword'),\n PGPASSWORD: credential('postgresPassword'),\n JWT_SECRET: credential('jwtSecret'),\n JWT_EXP: literal('3600'),\n ...restore.environment,\n },\n files: createDatabaseBootstrapFiles(context, restore.files),\n health: createDatabaseHealth(Object.keys(restore.files).length > 0),\n persistence: createSupabaseDatabasePersistence(prod),\n exposure: 'internal',\n replicas: 1,\n };\n}\n\n/*** Compose database bootstrap SQL, including selected provider-owned migrations. */\nfunction createDatabaseBootstrapFiles(\n context: InfraExecutionContext,\n restoreFiles: NonNullable<InfraWorkloadSpec['files']>,\n): NonNullable<InfraWorkloadSpec['files']> {\n return {\n '/docker-entrypoint-initdb.d/init-scripts/98-webhooks.sql': literal(\n SUPABASE_DATABASE_WEBHOOKS_SQL,\n ),\n '/docker-entrypoint-initdb.d/init-scripts/99-roles.sql': literal(SUPABASE_DATABASE_ROLES_SQL),\n '/docker-entrypoint-initdb.d/init-scripts/99-jwt.sql': literal(SUPABASE_DATABASE_JWT_SQL),\n '/docker-entrypoint-initdb.d/migrations/99-realtime.sql': literal(\n SUPABASE_DATABASE_REALTIME_SQL,\n ),\n ...(context.desired.secretStore?.provider === 'supabase-vault'\n ? {\n '/docker-entrypoint-initdb.d/migrations/99-ankhorage-supabase-vault.sql': literal(\n SUPABASE_VAULT_MIGRATION_SQL,\n ),\n }\n : {}),\n ...restoreFiles,\n };\n}\n\n/*** Keep the database alive while a configured first-boot restore waits for off-host backup data. */\nfunction createDatabaseHealth(restoreEnabled: boolean): NonNullable<InfraWorkloadSpec['health']> {\n return {\n kind: 'command',\n command: ['pg_isready', '-U', 'postgres', '-h', 'localhost'],\n intervalSeconds: 10,\n timeoutSeconds: 5,\n failureThreshold: restoreEnabled ? 60 : 3,\n };\n}\n\n/*** Create the PostgREST Data API workload. */\nfunction createRestWorkload(): InfraWorkloadSpec {\n return {\n id: 'supabase-rest',\n artifact: { kind: 'image', image: SUPABASE_IMAGES.rest },\n command: ['postgrest'],\n ports: { http: { port: 3000 } },\n environment: {\n PGRST_DB_URI: databaseUrl('authenticator'),\n PGRST_DB_SCHEMAS: literal('public,storage,graphql_public'),\n PGRST_DB_MAX_ROWS: literal('1000'),\n PGRST_DB_EXTRA_SEARCH_PATH: literal('public'),\n PGRST_DB_ANON_ROLE: literal('anon'),\n PGRST_ADMIN_SERVER_PORT: literal('3001'),\n PGRST_ADMIN_SERVER_HOST: literal('localhost'),\n PGRST_JWT_SECRET: credential('jwtSecret'),\n PGRST_DB_USE_LEGACY_GUCS: literal('false'),\n PGRST_APP_SETTINGS_JWT_SECRET: credential('jwtSecret'),\n PGRST_APP_SETTINGS_JWT_EXP: literal('3600'),\n },\n health: { kind: 'command', command: ['postgrest', '--ready'] },\n exposure: 'internal',\n replicas: 1,\n dependsOn: { 'supabase-db': true },\n };\n}\n\n/*** Create the Realtime workload without runtime-specific networking assumptions. */\nfunction createRealtimeWorkload(): InfraWorkloadSpec {\n return {\n id: 'supabase-realtime',\n artifact: { kind: 'image', image: SUPABASE_IMAGES.realtime },\n ports: { http: { port: 4000 } },\n environment: {\n PORT: literal('4000'),\n DB_HOST: literal('supabase-db'),\n DB_PORT: literal('5432'),\n DB_USER: literal('supabase_admin'),\n DB_PASSWORD: credential('postgresPassword'),\n DB_NAME: literal('postgres'),\n DB_AFTER_CONNECT_QUERY: literal('SET search_path TO _realtime'),\n DB_ENC_KEY: credential('realtimeDatabaseEncryptionKey'),\n API_JWT_SECRET: credential('jwtSecret'),\n ANON_KEY: credential('anonKey'),\n SECRET_KEY_BASE: credential('realtimeSecretKeyBase'),\n METRICS_JWT_SECRET: credential('jwtSecret'),\n ERL_AFLAGS: literal('-proto_dist inet_tcp'),\n DNS_NODES: literal(\"''\"),\n RLIMIT_NOFILE: literal('10000'),\n APP_NAME: literal('realtime'),\n SEED_SELF_HOST: literal('true'),\n RUN_JANITOR: literal('true'),\n DISABLE_HEALTHCHECK_LOGGING: literal('true'),\n },\n health: {\n kind: 'command',\n command: [\n 'sh',\n '-c',\n 'curl -sSfL --head -o /dev/null -H \"Authorization: Bearer `printenv ANON_KEY`\" http://localhost:4000/api/tenants/realtime-dev/health',\n ],\n intervalSeconds: 30,\n timeoutSeconds: 5,\n failureThreshold: 3,\n },\n exposure: 'internal',\n replicas: 1,\n dependsOn: { 'supabase-db': true },\n };\n}\n\n/*** Create the current Envoy gateway with portable service-DNS routes. */\nfunction createGatewayWorkload(\n context: InfraExecutionContext,\n baseUrl: string,\n ownsObjectStorage: boolean,\n recoveryEnabled: boolean,\n): InfraWorkloadSpec {\n const publishedPort = resolveLocalPublishedPort(context, baseUrl);\n return {\n id: 'supabase-gateway',\n artifact: { kind: 'image', image: SUPABASE_IMAGES.gateway },\n command: ['envoy'],\n args: ['-c', '/etc/envoy/envoy.yaml'],\n ports: {\n http: {\n port: 8000,\n ...(publishedPort === undefined ? {} : { publishedPort }),\n },\n },\n files: {\n '/etc/envoy/envoy.yaml': literal(\n ownsObjectStorage ? SUPABASE_ENVOY_CONFIG : SUPABASE_ENVOY_CONFIG_WITHOUT_STORAGE,\n ),\n },\n health: {\n kind: 'command',\n command: ['timeout', '1', 'bash', '-c', '</dev/tcp/127.0.0.1/8000'],\n intervalSeconds: 10,\n timeoutSeconds: 5,\n failureThreshold: 3,\n },\n exposure: 'public',\n replicas: 1,\n dependsOn: {\n 'supabase-auth': true,\n 'supabase-rest': true,\n 'supabase-realtime': true,\n ...(ownsObjectStorage ? { 'supabase-storage': true } : {}),\n ...(recoveryEnabled ? { [SUPABASE_DATA_RESTORE_WORKLOAD_ID]: true } : {}),\n },\n };\n}\n\n/*** Decide whether the selected Supabase database tier requires production persistence policy. */\nfunction isSupabaseProductionTier(context: InfraExecutionContext): boolean {\n return (\n context.desired.database?.provider === 'supabase' && context.desired.database.tier === 'prod'\n );\n}\n\n/*** Resolve an exact plain-HTTP listener only for the local runtime boundary. */\nfunction resolveLocalPublishedPort(\n context: InfraExecutionContext,\n baseUrl: string,\n): number | undefined {\n if (context.environment !== 'local') return undefined;\n try {\n const url = new URL(baseUrl);\n if (url.protocol !== 'http:') return undefined;\n return url.port === '' ? 80 : Number(url.port);\n } catch {\n return undefined;\n }\n}\n\n/*** Create one literal workload value. */\nfunction literal(value: string): InfraWorkloadScalarValue {\n return { kind: 'literal', value };\n}\n\n/*** Create one execution-only control-plane credential field reference. */\nfunction credential(key: string): InfraWorkloadScalarValue {\n return { kind: 'credential', reference: SUPABASE_BOOTSTRAP_CREDENTIAL, key };\n}\n\n/*** Create one password-bearing Postgres URL materialized only by the selected runtime. */\nfunction databaseUrl(user: string): InfraWorkloadValue {\n return {\n kind: 'template',\n segments: [\n literal(`postgres://${user}:`),\n credential('postgresPassword'),\n literal('@supabase-db:5432/postgres'),\n ],\n };\n}\n"]}
@@ -0,0 +1,5 @@
1
+ import type { InfraExecutionContext, InfraResult } from '@ankhorage/contracts/infra';
2
+ import type { SupabaseDesiredState } from '../../../types/supabase';
3
+ /*** Resolve the deduplicated Supabase platform, stable ownership and persistent buckets. */
4
+ export declare function resolveSupabaseDesiredState(context: InfraExecutionContext): InfraResult<SupabaseDesiredState>;
5
+ //# sourceMappingURL=resolveSupabaseDesiredState.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolveSupabaseDesiredState.d.ts","sourceRoot":"","sources":["../../../../src/features/platform-infrastructure/domain/resolveSupabaseDesiredState.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EAErB,WAAW,EACZ,MAAM,4BAA4B,CAAC;AAEpC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAEpE,4FAA4F;AAC5F,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,qBAAqB,GAC7B,WAAW,CAAC,oBAAoB,CAAC,CAoBnC"}
@@ -0,0 +1,88 @@
1
+ /*** Resolve the deduplicated Supabase platform, stable ownership and persistent buckets. */
2
+ export function resolveSupabaseDesiredState(context) {
3
+ if (!isSelected(context))
4
+ return invalidSelection();
5
+ const baseUrl = context.desired.networking?.publicBaseUrl;
6
+ if (baseUrl === undefined)
7
+ return missingPublicBaseUrl();
8
+ const bucketNames = context.desired.objectStorage?.provider === 'supabase'
9
+ ? Object.keys(context.desired.objectStorage.buckets ?? {}).sort()
10
+ : [];
11
+ const invalidBucket = bucketNames.find((bucket) => !isBucketName(bucket));
12
+ if (invalidBucket !== undefined)
13
+ return invalidBucketName(invalidBucket);
14
+ const platform = createPlatformOwner(context);
15
+ return {
16
+ ok: true,
17
+ value: {
18
+ baseUrl,
19
+ platform,
20
+ buckets: bucketNames.map((bucket) => createBucketOwner(context, platform, bucket)),
21
+ },
22
+ diagnostics: [],
23
+ };
24
+ }
25
+ /*** Check whether at least one Supabase-owned sibling capability is selected. */
26
+ function isSelected(context) {
27
+ return (context.desired.database?.provider === 'supabase' ||
28
+ context.desired.auth?.provider === 'supabase' ||
29
+ context.desired.objectStorage?.provider === 'supabase');
30
+ }
31
+ /*** Create the logical owner for one deduplicated platform instance. */
32
+ function createPlatformOwner(context) {
33
+ return {
34
+ identity: {
35
+ projectId: context.projectId,
36
+ environment: context.environment,
37
+ adapter: 'supabase',
38
+ resourceId: 'platform',
39
+ },
40
+ externalId: `${context.projectId}-${context.environment}-supabase`,
41
+ persistent: false,
42
+ retention: 'delete-on-destroy',
43
+ dependsOn: [
44
+ {
45
+ projectId: context.projectId,
46
+ environment: context.environment,
47
+ adapter: context.desired.deployment.runtime.provider,
48
+ resourceId: 'workload:supabase-gateway',
49
+ },
50
+ ],
51
+ };
52
+ }
53
+ /*** Create persistent ownership for one Storage bucket. */
54
+ function createBucketOwner(context, platform, bucket) {
55
+ return {
56
+ identity: {
57
+ projectId: context.projectId,
58
+ environment: context.environment,
59
+ adapter: 'supabase',
60
+ resourceId: `bucket/${bucket}`,
61
+ },
62
+ externalId: bucket,
63
+ persistent: true,
64
+ retention: 'retain',
65
+ dependsOn: [platform.identity],
66
+ };
67
+ }
68
+ /*** Validate one portable Supabase Storage bucket name. */
69
+ function isBucketName(value) {
70
+ return /^[a-z0-9](?:[a-z0-9._-]{0,61}[a-z0-9])?$/u.test(value);
71
+ }
72
+ /*** Reject invocation when no Supabase-owned capability is selected. */
73
+ function invalidSelection() {
74
+ return failure('supabase-selection-invalid', 'Supabase lifecycle requires a Supabase database, auth or object-storage selection.');
75
+ }
76
+ /*** Require one explicit external origin for Auth and public platform outputs. */
77
+ function missingPublicBaseUrl() {
78
+ return failure('supabase-public-base-url-missing', 'Supabase lifecycle requires networking.publicBaseUrl.');
79
+ }
80
+ /*** Reject one invalid desired Storage bucket name. */
81
+ function invalidBucketName(bucket) {
82
+ return failure('supabase-bucket-name-invalid', `Supabase bucket name "${bucket}" is invalid.`);
83
+ }
84
+ /*** Create one sanitized desired-state failure. */
85
+ function failure(code, message) {
86
+ return { ok: false, diagnostics: [{ severity: 'error', code, message }] };
87
+ }
88
+ //# sourceMappingURL=resolveSupabaseDesiredState.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolveSupabaseDesiredState.js","sourceRoot":"","sources":["../../../../src/features/platform-infrastructure/domain/resolveSupabaseDesiredState.ts"],"names":[],"mappings":"AAQA,4FAA4F;AAC5F,MAAM,UAAU,2BAA2B,CACzC,OAA8B;IAE9B,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC;QAAE,OAAO,gBAAgB,EAAE,CAAC;IACpD,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,UAAU,EAAE,aAAa,CAAC;IAC1D,IAAI,OAAO,KAAK,SAAS;QAAE,OAAO,oBAAoB,EAAE,CAAC;IACzD,MAAM,WAAW,GACf,OAAO,CAAC,OAAO,CAAC,aAAa,EAAE,QAAQ,KAAK,UAAU;QACpD,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CA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E,CAAC;AAC5E,CAAC","sourcesContent":["import type {\n InfraExecutionContext,\n InfraOwnedResource,\n InfraResult,\n} from '@ankhorage/contracts/infra';\n\nimport type { SupabaseDesiredState } from '../../../types/supabase';\n\n/*** Resolve the deduplicated Supabase platform, stable ownership and persistent buckets. */\nexport function resolveSupabaseDesiredState(\n context: InfraExecutionContext,\n): InfraResult<SupabaseDesiredState> {\n if (!isSelected(context)) return invalidSelection();\n const baseUrl = context.desired.networking?.publicBaseUrl;\n if (baseUrl === undefined) return missingPublicBaseUrl();\n const bucketNames =\n context.desired.objectStorage?.provider === 'supabase'\n ? Object.keys(context.desired.objectStorage.buckets ?? {}).sort()\n : [];\n const invalidBucket = bucketNames.find((bucket) => !isBucketName(bucket));\n if (invalidBucket !== undefined) return invalidBucketName(invalidBucket);\n const platform = createPlatformOwner(context);\n return {\n ok: true,\n value: {\n baseUrl,\n platform,\n buckets: bucketNames.map((bucket) => createBucketOwner(context, platform, bucket)),\n },\n diagnostics: [],\n };\n}\n\n/*** Check whether at least one Supabase-owned sibling capability is selected. */\nfunction isSelected(context: InfraExecutionContext): boolean {\n return (\n context.desired.database?.provider === 'supabase' ||\n context.desired.auth?.provider === 'supabase' ||\n context.desired.objectStorage?.provider === 'supabase'\n );\n}\n\n/*** Create the logical owner for one deduplicated platform instance. */\nfunction createPlatformOwner(context: InfraExecutionContext): InfraOwnedResource {\n return {\n identity: {\n projectId: context.projectId,\n environment: context.environment,\n adapter: 'supabase',\n resourceId: 'platform',\n },\n externalId: `${context.projectId}-${context.environment}-supabase`,\n persistent: false,\n retention: 'delete-on-destroy',\n dependsOn: [\n {\n projectId: context.projectId,\n environment: context.environment,\n adapter: context.desired.deployment.runtime.provider,\n resourceId: 'workload:supabase-gateway',\n },\n ],\n };\n}\n\n/*** Create persistent ownership for one Storage bucket. */\nfunction createBucketOwner(\n context: InfraExecutionContext,\n platform: InfraOwnedResource,\n bucket: string,\n): InfraOwnedResource {\n return {\n identity: {\n projectId: context.projectId,\n environment: context.environment,\n adapter: 'supabase',\n resourceId: `bucket/${bucket}`,\n },\n externalId: bucket,\n persistent: true,\n retention: 'retain',\n dependsOn: [platform.identity],\n };\n}\n\n/*** Validate one portable Supabase Storage bucket name. */\nfunction isBucketName(value: string): boolean {\n return /^[a-z0-9](?:[a-z0-9._-]{0,61}[a-z0-9])?$/u.test(value);\n}\n\n/*** Reject invocation when no Supabase-owned capability is selected. */\nfunction invalidSelection(): InfraResult<never> {\n return failure(\n 'supabase-selection-invalid',\n 'Supabase lifecycle requires a Supabase database, auth or object-storage selection.',\n );\n}\n\n/*** Require one explicit external origin for Auth and public platform outputs. */\nfunction missingPublicBaseUrl(): InfraResult<never> {\n return failure(\n 'supabase-public-base-url-missing',\n 'Supabase lifecycle requires networking.publicBaseUrl.',\n );\n}\n\n/*** Reject one invalid desired Storage bucket name. */\nfunction invalidBucketName(bucket: string): InfraResult<never> {\n return failure('supabase-bucket-name-invalid', `Supabase bucket name \"${bucket}\" is invalid.`);\n}\n\n/*** Create one sanitized desired-state failure. */\nfunction failure(code: string, message: string): InfraResult<never> {\n return { ok: false, diagnostics: [{ severity: 'error', code, message }] };\n}\n"]}
@@ -0,0 +1,4 @@
1
+ import type { InfraExecutionContext, InfraOutput, InfraResult } from '@ankhorage/contracts/infra';
2
+ /*** Resolve the reachable runtime endpoint used for local Supabase control-plane operations. */
3
+ export declare function resolveSupabaseControlPlaneUrl(context: InfraExecutionContext, publicBaseUrl: string, runtimeOutputs: readonly InfraOutput[]): InfraResult<string>;
4
+ //# sourceMappingURL=resolveSupabaseControlPlaneUrl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolveSupabaseControlPlaneUrl.d.ts","sourceRoot":"","sources":["../../../../src/features/platform-infrastructure/utils/resolveSupabaseControlPlaneUrl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAElG,gGAAgG;AAChG,wBAAgB,8BAA8B,CAC5C,OAAO,EAAE,qBAAqB,EAC9B,aAAa,EAAE,MAAM,EACrB,cAAc,EAAE,SAAS,WAAW,EAAE,GACrC,WAAW,CAAC,MAAM,CAAC,CAkBrB"}
@@ -0,0 +1,45 @@
1
+ /*** Resolve the reachable runtime endpoint used for local Supabase control-plane operations. */
2
+ export function resolveSupabaseControlPlaneUrl(context, publicBaseUrl, runtimeOutputs) {
3
+ if (context.environment !== 'local') {
4
+ return { ok: true, value: publicBaseUrl, diagnostics: [] };
5
+ }
6
+ const endpoint = runtimeOutputs.find((output) => output.owner.projectId === context.projectId &&
7
+ output.owner.environment === context.environment &&
8
+ output.owner.adapter === context.desired.deployment.runtime.provider &&
9
+ isGatewayEndpoint(output));
10
+ const origin = endpoint?.visibility === 'public' && typeof endpoint.value === 'string'
11
+ ? parseHttpOrigin(endpoint.value)
12
+ : undefined;
13
+ return origin === undefined
14
+ ? missingRuntimeEndpoint()
15
+ : { ok: true, value: origin, diagnostics: [] };
16
+ }
17
+ /*** Match the selected runtime's public output for the Supabase gateway workload. */
18
+ function isGatewayEndpoint(output) {
19
+ return ((output.owner.resourceId === 'endpoint:supabase-gateway' && output.name === 'localUrl') ||
20
+ (output.owner.resourceId === 'service:supabase-gateway' && output.name === 'endpoint'));
21
+ }
22
+ /*** Normalize one trusted HTTP endpoint to its origin. */
23
+ function parseHttpOrigin(value) {
24
+ try {
25
+ const url = new URL(value);
26
+ return url.protocol === 'http:' || url.protocol === 'https:' ? url.origin : undefined;
27
+ }
28
+ catch {
29
+ return undefined;
30
+ }
31
+ }
32
+ /*** Refuse local control-plane mutation until the runtime proves a reachable gateway endpoint. */
33
+ function missingRuntimeEndpoint() {
34
+ return {
35
+ ok: false,
36
+ diagnostics: [
37
+ {
38
+ severity: 'error',
39
+ code: 'supabase-runtime-endpoint-missing',
40
+ message: 'The selected local runtime did not report a reachable Supabase gateway endpoint.',
41
+ },
42
+ ],
43
+ };
44
+ }
45
+ //# sourceMappingURL=resolveSupabaseControlPlaneUrl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolveSupabaseControlPlaneUrl.js","sourceRoot":"","sources":["../../../../src/features/platform-infrastructure/utils/resolveSupabaseControlPlaneUrl.ts"],"names":[],"mappings":"AAEA,gGAAgG;AAChG,MAAM,UAAU,8BAA8B,CAC5C,OAA8B,EAC9B,aAAqB,EACrB,cAAsC;IAEtC,IAAI,OAAO,CAAC,WAAW,KAAK,OAAO,EAAE,CAAC;QACpC,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC;IAC7D,CAAC;IACD,MAAM,QAAQ,GAAG,cAAc,CAAC,IAAI,CAClC,CAAC,MAAM,EAAE,EAAE,CACT,MAAM,CAAC,KAAK,CAAC,SAAS,KAAK,OAAO,CAAC,SAAS;QAC5C,MAAM,CAAC,KAAK,CAAC,WAAW,KAAK,OAAO,CAAC,WAAW;QAChD,MAAM,CAAC,KAAK,CAAC,OAAO,KAAK,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,QAAQ;QACpE,iBAAiB,CAAC,MAAM,CAAC,CAC5B,CAAC;IACF,MAAM,MAAM,GACV,QAAQ,EAAE,UAAU,KAAK,QAAQ,IAAI,OAAO,QAAQ,CAAC,KAAK,KAAK,QAAQ;QACrE,CAAC,CAAC,eAAe,CAAC,QAAQ,CAAC,KAAK,CAAC;QACjC,CAAC,CAAC,SAAS,CAAC;IAChB,OAAO,MAAM,KAAK,SAAS;QACzB,CAAC,CAAC,sBAAsB,EAAE;QAC1B,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC;AACnD,CAAC;AAED,qFAAqF;AACrF,SAAS,iBAAiB,CAAC,MAAmB;IAC5C,OAAO,CACL,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,KAAK,2BAA2B,IAAI,MAAM,CAAC,IAAI,KAAK,UAAU,CAAC;QACvF,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,KAAK,0BAA0B,IAAI,MAAM,CAAC,IAAI,KAAK,UAAU,CAAC,CACvF,CAAC;AACJ,CAAC;AAED,0DAA0D;AAC1D,SAAS,eAAe,CAAC,KAAa;IACpC,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC;QAC3B,OAAO,GAAG,CAAC,QAAQ,KAAK,OAAO,IAAI,GAAG,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;IACxF,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC;AAED,kGAAkG;AAClG,SAAS,sBAAsB;IAC7B,OAAO;QACL,EAAE,EAAE,KAAK;QACT,WAAW,EAAE;YACX;gBACE,QAAQ,EAAE,OAAO;gBACjB,IAAI,EAAE,mCAAmC;gBACzC,OAAO,EAAE,kFAAkF;aAC5F;SACF;KACF,CAAC;AACJ,CAAC","sourcesContent":["import type { InfraExecutionContext, InfraOutput, InfraResult } from '@ankhorage/contracts/infra';\n\n/*** Resolve the reachable runtime endpoint used for local Supabase control-plane operations. */\nexport function resolveSupabaseControlPlaneUrl(\n context: InfraExecutionContext,\n publicBaseUrl: string,\n runtimeOutputs: readonly InfraOutput[],\n): InfraResult<string> {\n if (context.environment !== 'local') {\n return { ok: true, value: publicBaseUrl, diagnostics: [] };\n }\n const endpoint = runtimeOutputs.find(\n (output) =>\n output.owner.projectId === context.projectId &&\n output.owner.environment === context.environment &&\n output.owner.adapter === context.desired.deployment.runtime.provider &&\n isGatewayEndpoint(output),\n );\n const origin =\n endpoint?.visibility === 'public' && typeof endpoint.value === 'string'\n ? parseHttpOrigin(endpoint.value)\n : undefined;\n return origin === undefined\n ? missingRuntimeEndpoint()\n : { ok: true, value: origin, diagnostics: [] };\n}\n\n/*** Match the selected runtime's public output for the Supabase gateway workload. */\nfunction isGatewayEndpoint(output: InfraOutput): boolean {\n return (\n (output.owner.resourceId === 'endpoint:supabase-gateway' && output.name === 'localUrl') ||\n (output.owner.resourceId === 'service:supabase-gateway' && output.name === 'endpoint')\n );\n}\n\n/*** Normalize one trusted HTTP endpoint to its origin. */\nfunction parseHttpOrigin(value: string): string | undefined {\n try {\n const url = new URL(value);\n return url.protocol === 'http:' || url.protocol === 'https:' ? url.origin : undefined;\n } catch {\n return undefined;\n }\n}\n\n/*** Refuse local control-plane mutation until the runtime proves a reachable gateway endpoint. */\nfunction missingRuntimeEndpoint(): InfraResult<never> {\n return {\n ok: false,\n diagnostics: [\n {\n severity: 'error',\n code: 'supabase-runtime-endpoint-missing',\n message: 'The selected local runtime did not report a reachable Supabase gateway endpoint.',\n },\n ],\n };\n}\n"]}
@@ -0,0 +1,5 @@
1
+ import type { InfraResult } from '@ankhorage/contracts/infra';
2
+ import type { SupabaseBootstrapCredentials } from '../../../types/supabase';
3
+ /*** Validate the provider-owned Supabase bootstrap bundle without exposing privileged values. */
4
+ export declare function validateSupabaseBootstrapCredentials(values: Readonly<Record<string, string>>): InfraResult<SupabaseBootstrapCredentials>;
5
+ //# sourceMappingURL=validateSupabaseBootstrapCredentials.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validateSupabaseBootstrapCredentials.d.ts","sourceRoot":"","sources":["../../../../src/features/platform-infrastructure/utils/validateSupabaseBootstrapCredentials.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAE9D,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,yBAAyB,CAAC;AAE5E,iGAAiG;AACjG,wBAAgB,oCAAoC,CAClD,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GACvC,WAAW,CAAC,4BAA4B,CAAC,CAY3C"}
@@ -0,0 +1,66 @@
1
+ /*** Validate the provider-owned Supabase bootstrap bundle without exposing privileged values. */
2
+ export function validateSupabaseBootstrapCredentials(values) {
3
+ const credentials = readCredentials(values);
4
+ if (!credentials.ok)
5
+ return credentials;
6
+ if (credentials.value.jwtSecret.length < 32)
7
+ return weakCredential('jwtSecret', 32);
8
+ if (credentials.value.realtimeSecretKeyBase.length < 64) {
9
+ return weakCredential('realtimeSecretKeyBase', 64);
10
+ }
11
+ if (credentials.value.realtimeDatabaseEncryptionKey.length !== 16) {
12
+ return exactLengthCredential('realtimeDatabaseEncryptionKey', 16);
13
+ }
14
+ if (credentials.value.pgMetaCryptoKey.length < 32)
15
+ return weakCredential('pgMetaCryptoKey', 32);
16
+ return credentials;
17
+ }
18
+ /*** Read every required field without using dynamic access to privileged values. */
19
+ function readCredentials(values) {
20
+ const { postgresPassword, jwtSecret, anonKey, serviceRoleKey, realtimeSecretKeyBase, realtimeDatabaseEncryptionKey, pgMetaCryptoKey, } = values;
21
+ if (!postgresPassword)
22
+ return missingCredential('postgresPassword');
23
+ if (!jwtSecret)
24
+ return missingCredential('jwtSecret');
25
+ if (!anonKey)
26
+ return missingCredential('anonKey');
27
+ if (!serviceRoleKey)
28
+ return missingCredential('serviceRoleKey');
29
+ if (!realtimeSecretKeyBase)
30
+ return missingCredential('realtimeSecretKeyBase');
31
+ if (!realtimeDatabaseEncryptionKey) {
32
+ return missingCredential('realtimeDatabaseEncryptionKey');
33
+ }
34
+ if (!pgMetaCryptoKey)
35
+ return missingCredential('pgMetaCryptoKey');
36
+ return {
37
+ ok: true,
38
+ value: {
39
+ postgresPassword,
40
+ jwtSecret,
41
+ anonKey,
42
+ serviceRoleKey,
43
+ realtimeSecretKeyBase,
44
+ realtimeDatabaseEncryptionKey,
45
+ pgMetaCryptoKey,
46
+ },
47
+ diagnostics: [],
48
+ };
49
+ }
50
+ /*** Report one missing credential field without exposing any credential values. */
51
+ function missingCredential(key) {
52
+ return failure('supabase-credential-missing', `Supabase bootstrap credential field ${key} is required.`);
53
+ }
54
+ /*** Report one credential whose minimum length is not satisfied. */
55
+ function weakCredential(key, minimum) {
56
+ return failure('supabase-credential-invalid', `Supabase bootstrap credential field ${key} must contain at least ${minimum} characters.`);
57
+ }
58
+ /*** Report one credential whose exact length is not satisfied. */
59
+ function exactLengthCredential(key, length) {
60
+ return failure('supabase-credential-invalid', `Supabase bootstrap credential field ${key} must contain exactly ${length} characters.`);
61
+ }
62
+ /*** Create one sanitized bootstrap-credential failure. */
63
+ function failure(code, message) {
64
+ return { ok: false, diagnostics: [{ severity: 'error', code, message }] };
65
+ }
66
+ //# sourceMappingURL=validateSupabaseBootstrapCredentials.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validateSupabaseBootstrapCredentials.js","sourceRoot":"","sources":["../../../../src/features/platform-infrastructure/utils/validateSupabaseBootstrapCredentials.ts"],"names":[],"mappings":"AAIA,iGAAiG;AACjG,MAAM,UAAU,oCAAoC,CAClD,MAAwC;IAExC,MAAM,WAAW,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;IAC5C,IAAI,CAAC,WAAW,CAAC,EAAE;QAAE,OAAO,WAAW,CAAC;IACxC,IAAI,WAAW,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,GAAG,EAAE;QAAE,OAAO,cAAc,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;IACpF,IAAI,WAAW,CAAC,KAAK,CAAC,qBAAqB,CAAC,MAAM,GAAG,EAAE,EAAE,CAAC;QACxD,OAAO,cAAc,CAAC,uBAAuB,EAAE,EAAE,CAAC,CAAC;IACrD,CAAC;IACD,IAAI,WAAW,CAAC,KAAK,CAAC,6BAA6B,CAAC,MAAM,KAAK,EAAE,EAAE,CAAC;QAClE,OAAO,qBAAqB,CAAC,+BAA+B,EAAE,EAAE,CAAC,CAAC;IACpE,CAAC;IACD,IAAI,WAAW,CAAC,KAAK,CAAC,eAAe,CAAC,MAAM,GAAG,EAAE;QAAE,OAAO,cAAc,CAAC,iBAAiB,EAA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,kEAAkE;AAClE,SAAS,qBAAqB,CAAC,GAAW,EAAE,MAAc;IACxD,OAAO,OAAO,CACZ,6BAA6B,EAC7B,uCAAuC,GAAG,yBAAyB,MAAM,cAAc,CACxF,CAAC;AACJ,CAAC;AAED,0DAA0D;AAC1D,SAAS,OAAO,CAAC,IAAY,EAAE,OAAe;IAC5C,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;AAC5E,CAAC","sourcesContent":["import type { InfraResult } from '@ankhorage/contracts/infra';\n\nimport type { SupabaseBootstrapCredentials } from '../../../types/supabase';\n\n/*** Validate the provider-owned Supabase bootstrap bundle without exposing privileged values. */\nexport function validateSupabaseBootstrapCredentials(\n values: Readonly<Record<string, string>>,\n): InfraResult<SupabaseBootstrapCredentials> {\n const credentials = readCredentials(values);\n if (!credentials.ok) return credentials;\n if (credentials.value.jwtSecret.length < 32) return weakCredential('jwtSecret', 32);\n if (credentials.value.realtimeSecretKeyBase.length < 64) {\n return weakCredential('realtimeSecretKeyBase', 64);\n }\n if (credentials.value.realtimeDatabaseEncryptionKey.length !== 16) {\n return exactLengthCredential('realtimeDatabaseEncryptionKey', 16);\n }\n if (credentials.value.pgMetaCryptoKey.length < 32) return weakCredential('pgMetaCryptoKey', 32);\n return credentials;\n}\n\n/*** Read every required field without using dynamic access to privileged values. */\nfunction readCredentials(\n values: Readonly<Record<string, string>>,\n): InfraResult<SupabaseBootstrapCredentials> {\n const {\n postgresPassword,\n jwtSecret,\n anonKey,\n serviceRoleKey,\n realtimeSecretKeyBase,\n realtimeDatabaseEncryptionKey,\n pgMetaCryptoKey,\n } = values;\n if (!postgresPassword) return missingCredential('postgresPassword');\n if (!jwtSecret) return missingCredential('jwtSecret');\n if (!anonKey) return missingCredential('anonKey');\n if (!serviceRoleKey) return missingCredential('serviceRoleKey');\n if (!realtimeSecretKeyBase) return missingCredential('realtimeSecretKeyBase');\n if (!realtimeDatabaseEncryptionKey) {\n return missingCredential('realtimeDatabaseEncryptionKey');\n }\n if (!pgMetaCryptoKey) return missingCredential('pgMetaCryptoKey');\n return {\n ok: true,\n value: {\n postgresPassword,\n jwtSecret,\n anonKey,\n serviceRoleKey,\n realtimeSecretKeyBase,\n realtimeDatabaseEncryptionKey,\n pgMetaCryptoKey,\n },\n diagnostics: [],\n };\n}\n\n/*** Report one missing credential field without exposing any credential values. */\nfunction missingCredential(key: string): InfraResult<never> {\n return failure(\n 'supabase-credential-missing',\n `Supabase bootstrap credential field ${key} is required.`,\n );\n}\n\n/*** Report one credential whose minimum length is not satisfied. */\nfunction weakCredential(key: string, minimum: number): InfraResult<never> {\n return failure(\n 'supabase-credential-invalid',\n `Supabase bootstrap credential field ${key} must contain at least ${minimum} characters.`,\n );\n}\n\n/*** Report one credential whose exact length is not satisfied. */\nfunction exactLengthCredential(key: string, length: number): InfraResult<never> {\n return failure(\n 'supabase-credential-invalid',\n `Supabase bootstrap credential field ${key} must contain exactly ${length} characters.`,\n );\n}\n\n/*** Create one sanitized bootstrap-credential failure. */\nfunction failure(code: string, message: string): InfraResult<never> {\n return { ok: false, diagnostics: [{ severity: 'error', code, message }] };\n}\n"]}
@@ -0,0 +1,6 @@
1
+ /** Public Supabase platform adapter package boundary. */
2
+ export { infraAdapterDescriptor } from './constants/infra';
3
+ export { createFetchSupabaseControlPlane } from './features/platform-infrastructure/adapters/outbound/createFetchSupabaseControlPlane';
4
+ export { createInfraAdapter } from './features/platform-infrastructure/composition/createInfraAdapter';
5
+ export type { SupabaseAdapterOptions, SupabaseControlPlane, SupabaseControlPlaneRequest, } from './types/supabase';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,+BAA+B,EAAE,MAAM,sFAAsF,CAAC;AACvI,OAAO,EAAE,kBAAkB,EAAE,MAAM,mEAAmE,CAAC;AACvG,YAAY,EACV,sBAAsB,EACtB,oBAAoB,EACpB,2BAA2B,GAC5B,MAAM,kBAAkB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,5 @@
1
+ /** Public Supabase platform adapter package boundary. */
2
+ export { infraAdapterDescriptor } from './constants/infra';
3
+ export { createFetchSupabaseControlPlane } from './features/platform-infrastructure/adapters/outbound/createFetchSupabaseControlPlane';
4
+ export { createInfraAdapter } from './features/platform-infrastructure/composition/createInfraAdapter';
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,+BAA+B,EAAE,MAAM,sFAAsF,CAAC;AACvI,OAAO,EAAE,kBAAkB,EAAE,MAAM,mEAAmE,CAAC","sourcesContent":["/** Public Supabase platform adapter package boundary. */\nexport { infraAdapterDescriptor } from './constants/infra';\nexport { createFetchSupabaseControlPlane } from './features/platform-infrastructure/adapters/outbound/createFetchSupabaseControlPlane';\nexport { createInfraAdapter } from './features/platform-infrastructure/composition/createInfraAdapter';\nexport type {\n SupabaseAdapterOptions,\n SupabaseControlPlane,\n SupabaseControlPlaneRequest,\n} from './types/supabase';\n"]}
@@ -0,0 +1,34 @@
1
+ import type { InfraOwnedResource, InfraResult } from '@ankhorage/contracts/infra';
2
+ export interface SupabaseControlPlaneRequest {
3
+ readonly baseUrl: string;
4
+ readonly serviceRoleKey: string;
5
+ readonly signal?: AbortSignal;
6
+ }
7
+ export interface SupabaseControlPlane {
8
+ healthAsync(request: SupabaseControlPlaneRequest): Promise<InfraResult<null>>;
9
+ listBucketsAsync(request: SupabaseControlPlaneRequest): Promise<InfraResult<readonly string[]>>;
10
+ createBucketAsync(request: SupabaseControlPlaneRequest & {
11
+ readonly bucket: string;
12
+ }): Promise<InfraResult<null>>;
13
+ deleteBucketAsync(request: SupabaseControlPlaneRequest & {
14
+ readonly bucket: string;
15
+ }): Promise<InfraResult<null>>;
16
+ }
17
+ export interface SupabaseAdapterOptions {
18
+ readonly controlPlane?: SupabaseControlPlane;
19
+ }
20
+ export interface SupabaseBootstrapCredentials {
21
+ readonly postgresPassword: string;
22
+ readonly jwtSecret: string;
23
+ readonly anonKey: string;
24
+ readonly serviceRoleKey: string;
25
+ readonly realtimeSecretKeyBase: string;
26
+ readonly realtimeDatabaseEncryptionKey: string;
27
+ readonly pgMetaCryptoKey: string;
28
+ }
29
+ export interface SupabaseDesiredState {
30
+ readonly baseUrl: string;
31
+ readonly platform: InfraOwnedResource;
32
+ readonly buckets: readonly InfraOwnedResource[];
33
+ }
34
+ //# sourceMappingURL=supabase.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"supabase.d.ts","sourceRoot":"","sources":["../../src/types/supabase.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAElF,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;CAC/B;AAED,MAAM,WAAW,oBAAoB;IACnC,WAAW,CAAC,OAAO,EAAE,2BAA2B,GAAG,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC;IAC9E,gBAAgB,CAAC,OAAO,EAAE,2BAA2B,GAAG,OAAO,CAAC,WAAW,CAAC,SAAS,MAAM,EAAE,CAAC,CAAC,CAAC;IAChG,iBAAiB,CACf,OAAO,EAAE,2BAA2B,GAAG;QAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GACjE,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC;IAC9B,iBAAiB,CACf,OAAO,EAAE,2BAA2B,GAAG;QAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GACjE,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC;CAC/B;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,YAAY,CAAC,EAAE,oBAAoB,CAAC;CAC9C;AAED,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,qBAAqB,EAAE,MAAM,CAAC;IACvC,QAAQ,CAAC,6BAA6B,EAAE,MAAM,CAAC;IAC/C,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;CAClC;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,kBAAkB,CAAC;IACtC,QAAQ,CAAC,OAAO,EAAE,SAAS,kBAAkB,EAAE,CAAC;CACjD"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=supabase.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"supabase.js","sourceRoot":"","sources":["../../src/types/supabase.ts"],"names":[],"mappings":"","sourcesContent":["import type { InfraOwnedResource, InfraResult } from '@ankhorage/contracts/infra';\n\nexport interface SupabaseControlPlaneRequest {\n readonly baseUrl: string;\n readonly serviceRoleKey: string;\n readonly signal?: AbortSignal;\n}\n\nexport interface SupabaseControlPlane {\n healthAsync(request: SupabaseControlPlaneRequest): Promise<InfraResult<null>>;\n listBucketsAsync(request: SupabaseControlPlaneRequest): Promise<InfraResult<readonly string[]>>;\n createBucketAsync(\n request: SupabaseControlPlaneRequest & { readonly bucket: string },\n ): Promise<InfraResult<null>>;\n deleteBucketAsync(\n request: SupabaseControlPlaneRequest & { readonly bucket: string },\n ): Promise<InfraResult<null>>;\n}\n\nexport interface SupabaseAdapterOptions {\n readonly controlPlane?: SupabaseControlPlane;\n}\n\nexport interface SupabaseBootstrapCredentials {\n readonly postgresPassword: string;\n readonly jwtSecret: string;\n readonly anonKey: string;\n readonly serviceRoleKey: string;\n readonly realtimeSecretKeyBase: string;\n readonly realtimeDatabaseEncryptionKey: string;\n readonly pgMetaCryptoKey: string;\n}\n\nexport interface SupabaseDesiredState {\n readonly baseUrl: string;\n readonly platform: InfraOwnedResource;\n readonly buckets: readonly InfraOwnedResource[];\n}\n"]}