@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.
- package/LICENSE +21 -0
- package/README.md +39 -2
- package/dist/constants/infra.d.ts +11 -0
- package/dist/constants/infra.d.ts.map +1 -0
- package/dist/constants/infra.js +4 -0
- package/dist/constants/infra.js.map +1 -0
- package/dist/features/platform-infrastructure/adapters/outbound/createFetchSupabaseControlPlane.d.ts +9 -0
- package/dist/features/platform-infrastructure/adapters/outbound/createFetchSupabaseControlPlane.d.ts.map +1 -0
- package/dist/features/platform-infrastructure/adapters/outbound/createFetchSupabaseControlPlane.js +89 -0
- package/dist/features/platform-infrastructure/adapters/outbound/createFetchSupabaseControlPlane.js.map +1 -0
- package/dist/features/platform-infrastructure/application/use-cases/destroySupabaseAsync.d.ts +5 -0
- package/dist/features/platform-infrastructure/application/use-cases/destroySupabaseAsync.d.ts.map +1 -0
- package/dist/features/platform-infrastructure/application/use-cases/destroySupabaseAsync.js +64 -0
- package/dist/features/platform-infrastructure/application/use-cases/destroySupabaseAsync.js.map +1 -0
- package/dist/features/platform-infrastructure/application/use-cases/getSupabaseStatusAsync.d.ts +5 -0
- package/dist/features/platform-infrastructure/application/use-cases/getSupabaseStatusAsync.d.ts.map +1 -0
- package/dist/features/platform-infrastructure/application/use-cases/getSupabaseStatusAsync.js +59 -0
- package/dist/features/platform-infrastructure/application/use-cases/getSupabaseStatusAsync.js.map +1 -0
- package/dist/features/platform-infrastructure/application/use-cases/planSupabase.d.ts +4 -0
- package/dist/features/platform-infrastructure/application/use-cases/planSupabase.d.ts.map +1 -0
- package/dist/features/platform-infrastructure/application/use-cases/planSupabase.js +37 -0
- package/dist/features/platform-infrastructure/application/use-cases/planSupabase.js.map +1 -0
- package/dist/features/platform-infrastructure/application/use-cases/prepareSupabaseBootstrapCredentialsAsync.d.ts +4 -0
- package/dist/features/platform-infrastructure/application/use-cases/prepareSupabaseBootstrapCredentialsAsync.d.ts.map +1 -0
- package/dist/features/platform-infrastructure/application/use-cases/prepareSupabaseBootstrapCredentialsAsync.js +63 -0
- package/dist/features/platform-infrastructure/application/use-cases/prepareSupabaseBootstrapCredentialsAsync.js.map +1 -0
- package/dist/features/platform-infrastructure/application/use-cases/reconcileSupabaseAsync.d.ts +5 -0
- package/dist/features/platform-infrastructure/application/use-cases/reconcileSupabaseAsync.d.ts.map +1 -0
- package/dist/features/platform-infrastructure/application/use-cases/reconcileSupabaseAsync.js +66 -0
- package/dist/features/platform-infrastructure/application/use-cases/reconcileSupabaseAsync.js.map +1 -0
- package/dist/features/platform-infrastructure/application/use-cases/resolveSupabaseBootstrapCredentialsAsync.d.ts +5 -0
- package/dist/features/platform-infrastructure/application/use-cases/resolveSupabaseBootstrapCredentialsAsync.d.ts.map +1 -0
- package/dist/features/platform-infrastructure/application/use-cases/resolveSupabaseBootstrapCredentialsAsync.js +8 -0
- package/dist/features/platform-infrastructure/application/use-cases/resolveSupabaseBootstrapCredentialsAsync.js.map +1 -0
- package/dist/features/platform-infrastructure/application/use-cases/validateSupabaseAsync.d.ts +4 -0
- package/dist/features/platform-infrastructure/application/use-cases/validateSupabaseAsync.d.ts.map +1 -0
- package/dist/features/platform-infrastructure/application/use-cases/validateSupabaseAsync.js +26 -0
- package/dist/features/platform-infrastructure/application/use-cases/validateSupabaseAsync.js.map +1 -0
- package/dist/features/platform-infrastructure/application/use-cases/validateSupabasePersistenceCredentialsAsync.d.ts +4 -0
- package/dist/features/platform-infrastructure/application/use-cases/validateSupabasePersistenceCredentialsAsync.d.ts.map +1 -0
- package/dist/features/platform-infrastructure/application/use-cases/validateSupabasePersistenceCredentialsAsync.js +42 -0
- package/dist/features/platform-infrastructure/application/use-cases/validateSupabasePersistenceCredentialsAsync.js.map +1 -0
- package/dist/features/platform-infrastructure/composition/createInfraAdapter.d.ts +12 -0
- package/dist/features/platform-infrastructure/composition/createInfraAdapter.d.ts.map +1 -0
- package/dist/features/platform-infrastructure/composition/createInfraAdapter.js +37 -0
- package/dist/features/platform-infrastructure/composition/createInfraAdapter.js.map +1 -0
- package/dist/features/platform-infrastructure/constants/databaseBootstrap.d.ts +5 -0
- package/dist/features/platform-infrastructure/constants/databaseBootstrap.d.ts.map +1 -0
- package/dist/features/platform-infrastructure/constants/databaseBootstrap.js +233 -0
- package/dist/features/platform-infrastructure/constants/databaseBootstrap.js.map +1 -0
- package/dist/features/platform-infrastructure/constants/recovery.d.ts +4 -0
- package/dist/features/platform-infrastructure/constants/recovery.d.ts.map +1 -0
- package/dist/features/platform-infrastructure/constants/recovery.js +4 -0
- package/dist/features/platform-infrastructure/constants/recovery.js.map +1 -0
- package/dist/features/platform-infrastructure/constants/supabase.d.ts +18 -0
- package/dist/features/platform-infrastructure/constants/supabase.d.ts.map +1 -0
- package/dist/features/platform-infrastructure/constants/supabase.js +103 -0
- package/dist/features/platform-infrastructure/constants/supabase.js.map +1 -0
- package/dist/features/platform-infrastructure/domain/createSupabaseAuthWorkload.d.ts +4 -0
- package/dist/features/platform-infrastructure/domain/createSupabaseAuthWorkload.d.ts.map +1 -0
- package/dist/features/platform-infrastructure/domain/createSupabaseAuthWorkload.js +53 -0
- package/dist/features/platform-infrastructure/domain/createSupabaseAuthWorkload.js.map +1 -0
- package/dist/features/platform-infrastructure/domain/createSupabaseDatabaseBackupWorkload.d.ts +4 -0
- package/dist/features/platform-infrastructure/domain/createSupabaseDatabaseBackupWorkload.d.ts.map +1 -0
- package/dist/features/platform-infrastructure/domain/createSupabaseDatabaseBackupWorkload.js +212 -0
- package/dist/features/platform-infrastructure/domain/createSupabaseDatabaseBackupWorkload.js.map +1 -0
- package/dist/features/platform-infrastructure/domain/createSupabaseDatabaseDataRestoreWorkload.d.ts +4 -0
- package/dist/features/platform-infrastructure/domain/createSupabaseDatabaseDataRestoreWorkload.d.ts.map +1 -0
- package/dist/features/platform-infrastructure/domain/createSupabaseDatabaseDataRestoreWorkload.js +111 -0
- package/dist/features/platform-infrastructure/domain/createSupabaseDatabaseDataRestoreWorkload.js.map +1 -0
- package/dist/features/platform-infrastructure/domain/createSupabaseDatabasePersistence.d.ts +4 -0
- package/dist/features/platform-infrastructure/domain/createSupabaseDatabasePersistence.d.ts.map +1 -0
- package/dist/features/platform-infrastructure/domain/createSupabaseDatabasePersistence.js +19 -0
- package/dist/features/platform-infrastructure/domain/createSupabaseDatabasePersistence.js.map +1 -0
- package/dist/features/platform-infrastructure/domain/createSupabaseDatabaseRestore.d.ts +13 -0
- package/dist/features/platform-infrastructure/domain/createSupabaseDatabaseRestore.d.ts.map +1 -0
- package/dist/features/platform-infrastructure/domain/createSupabaseDatabaseRestore.js +147 -0
- package/dist/features/platform-infrastructure/domain/createSupabaseDatabaseRestore.js.map +1 -0
- package/dist/features/platform-infrastructure/domain/createSupabaseOperationalWorkloads.d.ts +4 -0
- package/dist/features/platform-infrastructure/domain/createSupabaseOperationalWorkloads.d.ts.map +1 -0
- package/dist/features/platform-infrastructure/domain/createSupabaseOperationalWorkloads.js +103 -0
- package/dist/features/platform-infrastructure/domain/createSupabaseOperationalWorkloads.js.map +1 -0
- package/dist/features/platform-infrastructure/domain/createSupabaseS3Values.d.ts +14 -0
- package/dist/features/platform-infrastructure/domain/createSupabaseS3Values.d.ts.map +1 -0
- package/dist/features/platform-infrastructure/domain/createSupabaseS3Values.js +30 -0
- package/dist/features/platform-infrastructure/domain/createSupabaseS3Values.js.map +1 -0
- package/dist/features/platform-infrastructure/domain/createSupabaseStorageWorkload.d.ts +4 -0
- package/dist/features/platform-infrastructure/domain/createSupabaseStorageWorkload.d.ts.map +1 -0
- package/dist/features/platform-infrastructure/domain/createSupabaseStorageWorkload.js +100 -0
- package/dist/features/platform-infrastructure/domain/createSupabaseStorageWorkload.js.map +1 -0
- package/dist/features/platform-infrastructure/domain/createSupabaseWorkloads.d.ts +4 -0
- package/dist/features/platform-infrastructure/domain/createSupabaseWorkloads.d.ts.map +1 -0
- package/dist/features/platform-infrastructure/domain/createSupabaseWorkloads.js +234 -0
- package/dist/features/platform-infrastructure/domain/createSupabaseWorkloads.js.map +1 -0
- package/dist/features/platform-infrastructure/domain/resolveSupabaseDesiredState.d.ts +5 -0
- package/dist/features/platform-infrastructure/domain/resolveSupabaseDesiredState.d.ts.map +1 -0
- package/dist/features/platform-infrastructure/domain/resolveSupabaseDesiredState.js +88 -0
- package/dist/features/platform-infrastructure/domain/resolveSupabaseDesiredState.js.map +1 -0
- package/dist/features/platform-infrastructure/utils/resolveSupabaseControlPlaneUrl.d.ts +4 -0
- package/dist/features/platform-infrastructure/utils/resolveSupabaseControlPlaneUrl.d.ts.map +1 -0
- package/dist/features/platform-infrastructure/utils/resolveSupabaseControlPlaneUrl.js +45 -0
- package/dist/features/platform-infrastructure/utils/resolveSupabaseControlPlaneUrl.js.map +1 -0
- package/dist/features/platform-infrastructure/utils/validateSupabaseBootstrapCredentials.d.ts +5 -0
- package/dist/features/platform-infrastructure/utils/validateSupabaseBootstrapCredentials.d.ts.map +1 -0
- package/dist/features/platform-infrastructure/utils/validateSupabaseBootstrapCredentials.js +66 -0
- package/dist/features/platform-infrastructure/utils/validateSupabaseBootstrapCredentials.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/types/supabase.d.ts +34 -0
- package/dist/types/supabase.d.ts.map +1 -0
- package/dist/types/supabase.js +2 -0
- package/dist/types/supabase.js.map +1 -0
- package/package.json +67 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Ankhorage
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,40 @@
|
|
|
1
|
-
|
|
1
|
+
<!-- markdownlint-disable MD013 MD033 -->
|
|
2
|
+
<!-- This file is generated by Paradox. Do not edit manually. -->
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
# @ankhorage/supabase
|
|
5
|
+
|
|
6
|
+
        
|
|
7
|
+
|
|
8
|
+
Supabase platform service adapter for provider-neutral Ankhorage infrastructure.
|
|
9
|
+
|
|
10
|
+
## Generated documentation
|
|
11
|
+
|
|
12
|
+
- [Interactive documentation app](././paradox/index.html)
|
|
13
|
+
- [Public API reference](././paradox/exports.md)
|
|
14
|
+
- [Component registry](././paradox/components.md)
|
|
15
|
+
- [Architecture overview](././paradox/diagrams/architecture-overview.mmd)
|
|
16
|
+
- [Module relationships](././paradox/diagrams/module-relationships.mmd)
|
|
17
|
+
- [Export graph](././paradox/diagrams/export-graph.mmd)
|
|
18
|
+
- [createInfraAdapter sequence](././paradox/diagrams/sequences/create-infra-adapter.mmd)
|
|
19
|
+
|
|
20
|
+
## Public API
|
|
21
|
+
|
|
22
|
+
### Utilities
|
|
23
|
+
|
|
24
|
+
<details>
|
|
25
|
+
<summary>createInfraAdapter</summary>
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
createInfraAdapter(options?: SupabaseAdapterOptions) => InfraServiceAdapter
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Create the canonical runtime-neutral Supabase platform adapter.
|
|
32
|
+
|
|
33
|
+
The provider contributes portable workloads and reconciles Supabase-owned API resources after
|
|
34
|
+
the selected runtime is ready. Resolved bootstrap secrets never cross the execution boundary.
|
|
35
|
+
|
|
36
|
+
Module: `src/features/platform-infrastructure/composition/createInfraAdapter.ts`
|
|
37
|
+
Source: `src/features/platform-infrastructure/composition/createInfraAdapter.ts:23:1`
|
|
38
|
+
Related symbols: `SupabaseAdapterOptions`
|
|
39
|
+
|
|
40
|
+
</details>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** Canonical Contracts-backed identity used for adapter discovery and conformance. */
|
|
2
|
+
export declare const infraAdapterDescriptor: {
|
|
3
|
+
readonly id: "supabase";
|
|
4
|
+
readonly package: "@ankhorage/supabase";
|
|
5
|
+
readonly kind: "service";
|
|
6
|
+
readonly configVersion: 1;
|
|
7
|
+
readonly capabilities: readonly ["database", "auth", "objectStorage"];
|
|
8
|
+
readonly targets: readonly [];
|
|
9
|
+
readonly dependencies: readonly ["workloads"];
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=infra.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"infra.d.ts","sourceRoot":"","sources":["../../src/constants/infra.ts"],"names":[],"mappings":"AAGA,sFAAsF;AACtF,eAAO,MAAM,sBAAsB;;;;;;;;CAC0C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"infra.js","sourceRoot":"","sources":["../../src/constants/infra.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAEnE,sFAAsF;AACtF,MAAM,CAAC,MAAM,sBAAsB,GACjC,qBAAqB,CAAC,QAAqD,CAAC","sourcesContent":["import type { InfraAdapterDescriptor } from '@ankhorage/contracts/infra';\nimport { INFRA_ADAPTER_CATALOG } from '@ankhorage/contracts/infra';\n\n/** Canonical Contracts-backed identity used for adapter discovery and conformance. */\nexport const infraAdapterDescriptor =\n INFRA_ADAPTER_CATALOG.supabase satisfies InfraAdapterDescriptor<'supabase'>;\n"]}
|
package/dist/features/platform-infrastructure/adapters/outbound/createFetchSupabaseControlPlane.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { SupabaseControlPlane } from '../../../../types/supabase';
|
|
2
|
+
interface FetchSupabaseControlPlaneOptions {
|
|
3
|
+
readonly fetcher?: FetchLike;
|
|
4
|
+
}
|
|
5
|
+
type FetchLike = (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
|
|
6
|
+
/*** Create a sanitized HTTP adapter for self-hosted Supabase health and bucket lifecycle. */
|
|
7
|
+
export declare function createFetchSupabaseControlPlane(options?: FetchSupabaseControlPlaneOptions): SupabaseControlPlane;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=createFetchSupabaseControlPlane.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createFetchSupabaseControlPlane.d.ts","sourceRoot":"","sources":["../../../../../src/features/platform-infrastructure/adapters/outbound/createFetchSupabaseControlPlane.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAA+B,MAAM,4BAA4B,CAAC;AAEpG,UAAU,gCAAgC;IACxC,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,CAAC;CAC9B;AAED,KAAK,SAAS,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,GAAG,GAAG,OAAO,EAAE,IAAI,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;AAE1F,6FAA6F;AAC7F,wBAAgB,+BAA+B,CAC7C,OAAO,GAAE,gCAAqC,GAC7C,oBAAoB,CAmBtB"}
|
package/dist/features/platform-infrastructure/adapters/outbound/createFetchSupabaseControlPlane.js
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/*** Create a sanitized HTTP adapter for self-hosted Supabase health and bucket lifecycle. */
|
|
2
|
+
export function createFetchSupabaseControlPlane(options = {}) {
|
|
3
|
+
const fetcher = options.fetcher ?? fetch;
|
|
4
|
+
return {
|
|
5
|
+
healthAsync: (request) => requestEmptyAsync(fetcher, request, '/auth/v1/health', 'GET'),
|
|
6
|
+
listBucketsAsync: (request) => listBucketsAsync(fetcher, request),
|
|
7
|
+
createBucketAsync: (request) => requestEmptyAsync(fetcher, request, '/storage/v1/bucket', 'POST', {
|
|
8
|
+
id: request.bucket,
|
|
9
|
+
name: request.bucket,
|
|
10
|
+
public: false,
|
|
11
|
+
}),
|
|
12
|
+
deleteBucketAsync: (request) => requestEmptyAsync(fetcher, request, `/storage/v1/bucket/${encodeURIComponent(request.bucket)}`, 'DELETE'),
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
/*** List storage buckets without returning privileged request metadata. */
|
|
16
|
+
async function listBucketsAsync(fetcher, request) {
|
|
17
|
+
const response = await requestAsync(fetcher, request, '/storage/v1/bucket', 'GET');
|
|
18
|
+
if (!response.ok)
|
|
19
|
+
return response;
|
|
20
|
+
try {
|
|
21
|
+
const payload = await response.value.json();
|
|
22
|
+
if (!Array.isArray(payload))
|
|
23
|
+
return invalidResponse();
|
|
24
|
+
const names = payload.flatMap((value) => (isNamedBucket(value) ? [value.name] : []));
|
|
25
|
+
return names.length === payload.length
|
|
26
|
+
? { ok: true, value: names.sort(), diagnostics: [] }
|
|
27
|
+
: invalidResponse();
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
return invalidResponse();
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/*** Narrow one untrusted storage response item to its public bucket name. */
|
|
34
|
+
function isNamedBucket(value) {
|
|
35
|
+
if (typeof value !== 'object' || value === null || !('name' in value))
|
|
36
|
+
return false;
|
|
37
|
+
return typeof value.name === 'string';
|
|
38
|
+
}
|
|
39
|
+
/*** Execute one response-body-free control-plane request. */
|
|
40
|
+
async function requestEmptyAsync(fetcher, request, path, method, body) {
|
|
41
|
+
const response = await requestAsync(fetcher, request, path, method, body);
|
|
42
|
+
return response.ok ? { ok: true, value: null, diagnostics: [] } : response;
|
|
43
|
+
}
|
|
44
|
+
/*** Execute one authenticated request and expose only the trusted Response boundary. */
|
|
45
|
+
async function requestAsync(fetcher, request, path, method, body) {
|
|
46
|
+
try {
|
|
47
|
+
const response = await fetcher(`${request.baseUrl}${path}`, {
|
|
48
|
+
method,
|
|
49
|
+
headers: {
|
|
50
|
+
apikey: request.serviceRoleKey,
|
|
51
|
+
authorization: `Bearer ${request.serviceRoleKey}`,
|
|
52
|
+
...(body === undefined ? {} : { 'content-type': 'application/json' }),
|
|
53
|
+
},
|
|
54
|
+
...(body === undefined ? {} : { body: JSON.stringify(body) }),
|
|
55
|
+
...(request.signal === undefined ? {} : { signal: request.signal }),
|
|
56
|
+
});
|
|
57
|
+
return response.ok ? { ok: true, value: response, diagnostics: [] } : requestFailure();
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
return requestFailure();
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
/*** Reject a failed HTTP request without leaking response or credential detail. */
|
|
64
|
+
function requestFailure() {
|
|
65
|
+
return {
|
|
66
|
+
ok: false,
|
|
67
|
+
diagnostics: [
|
|
68
|
+
{
|
|
69
|
+
severity: 'error',
|
|
70
|
+
code: 'supabase-control-plane-unavailable',
|
|
71
|
+
message: 'The Supabase control plane request failed.',
|
|
72
|
+
},
|
|
73
|
+
],
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
/*** Reject a malformed storage response without exposing its body. */
|
|
77
|
+
function invalidResponse() {
|
|
78
|
+
return {
|
|
79
|
+
ok: false,
|
|
80
|
+
diagnostics: [
|
|
81
|
+
{
|
|
82
|
+
severity: 'error',
|
|
83
|
+
code: 'supabase-control-plane-response-invalid',
|
|
84
|
+
message: 'The Supabase control plane returned an invalid bucket response.',
|
|
85
|
+
},
|
|
86
|
+
],
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=createFetchSupabaseControlPlane.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createFetchSupabaseControlPlane.js","sourceRoot":"","sources":["../../../../../src/features/platform-infrastructure/adapters/outbound/createFetchSupabaseControlPlane.ts"],"names":[],"mappings":"AAUA,6FAA6F;AAC7F,MAAM,UAAU,+BAA+B,CAC7C,UAA4C,EAAE;IAE9C,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,KAAK,CAAC;IACzC,OAAO;QACL,WAAW,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,iBAAiB,CAAC,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,KAAK,CAAC;QACvF,gBAAgB,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC;QACjE,iBAAiB,EAAE,CAAC,OAAO,EAAE,EAAE,CAC7B,iBAAiB,CAAC,OAAO,EAAE,OAAO,EAAE,oBAAoB,EAAE,MAAM,EAAE;YAChE,EAAE,EAAE,OAAO,CAAC,MAAM;YAClB,IAAI,EAAE,OAAO,CAAC,MAAM;YACpB,MAAM,EAAE,KAAK;SACd,CAAC;QACJ,iBAAiB,EAAE,CAAC,OAAO,EAAE,EAAE,CAC7B,iBAAiB,CACf,OAAO,EACP,OAAO,EACP,sBAAsB,kBAAkB,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,EAC1D,QAAQ,CACT;KACJ,CAAC;AACJ,CAAC;AAED,2EAA2E;AAC3E,KAAK,UAAU,gBAAgB,CAC7B,OAAkB,EAClB,OAAoC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mF;AACnF,SAAS,cAAc;IACrB,OAAO;QACL,EAAE,EAAE,KAAK;QACT,WAAW,EAAE;YACX;gBACE,QAAQ,EAAE,OAAO;gBACjB,IAAI,EAAE,oCAAoC;gBAC1C,OAAO,EAAE,4CAA4C;aACtD;SACF;KACF,CAAC;AACJ,CAAC;AAED,sEAAsE;AACtE,SAAS,eAAe;IACtB,OAAO;QACL,EAAE,EAAE,KAAK;QACT,WAAW,EAAE;YACX;gBACE,QAAQ,EAAE,OAAO;gBACjB,IAAI,EAAE,yCAAyC;gBAC/C,OAAO,EAAE,iEAAiE;aAC3E;SACF;KACF,CAAC;AACJ,CAAC","sourcesContent":["import type { InfraResult } from '@ankhorage/contracts/infra';\n\nimport type { SupabaseControlPlane, SupabaseControlPlaneRequest } from '../../../../types/supabase';\n\ninterface FetchSupabaseControlPlaneOptions {\n readonly fetcher?: FetchLike;\n}\n\ntype FetchLike = (input: string | URL | Request, init?: RequestInit) => Promise<Response>;\n\n/*** Create a sanitized HTTP adapter for self-hosted Supabase health and bucket lifecycle. */\nexport function createFetchSupabaseControlPlane(\n options: FetchSupabaseControlPlaneOptions = {},\n): SupabaseControlPlane {\n const fetcher = options.fetcher ?? fetch;\n return {\n healthAsync: (request) => requestEmptyAsync(fetcher, request, '/auth/v1/health', 'GET'),\n listBucketsAsync: (request) => listBucketsAsync(fetcher, request),\n createBucketAsync: (request) =>\n requestEmptyAsync(fetcher, request, '/storage/v1/bucket', 'POST', {\n id: request.bucket,\n name: request.bucket,\n public: false,\n }),\n deleteBucketAsync: (request) =>\n requestEmptyAsync(\n fetcher,\n request,\n `/storage/v1/bucket/${encodeURIComponent(request.bucket)}`,\n 'DELETE',\n ),\n };\n}\n\n/*** List storage buckets without returning privileged request metadata. */\nasync function listBucketsAsync(\n fetcher: FetchLike,\n request: SupabaseControlPlaneRequest,\n): Promise<InfraResult<readonly string[]>> {\n const response = await requestAsync(fetcher, request, '/storage/v1/bucket', 'GET');\n if (!response.ok) return response;\n try {\n const payload: unknown = await response.value.json();\n if (!Array.isArray(payload)) return invalidResponse();\n const names = payload.flatMap((value: unknown) => (isNamedBucket(value) ? [value.name] : []));\n return names.length === payload.length\n ? { ok: true, value: names.sort(), diagnostics: [] }\n : invalidResponse();\n } catch {\n return invalidResponse();\n }\n}\n\n/*** Narrow one untrusted storage response item to its public bucket name. */\nfunction isNamedBucket(value: unknown): value is { readonly name: string } {\n if (typeof value !== 'object' || value === null || !('name' in value)) return false;\n return typeof value.name === 'string';\n}\n\n/*** Execute one response-body-free control-plane request. */\nasync function requestEmptyAsync(\n fetcher: FetchLike,\n request: SupabaseControlPlaneRequest,\n path: string,\n method: 'GET' | 'POST' | 'DELETE',\n body?: Readonly<Record<string, unknown>>,\n): Promise<InfraResult<null>> {\n const response = await requestAsync(fetcher, request, path, method, body);\n return response.ok ? { ok: true, value: null, diagnostics: [] } : response;\n}\n\n/*** Execute one authenticated request and expose only the trusted Response boundary. */\nasync function requestAsync(\n fetcher: FetchLike,\n request: SupabaseControlPlaneRequest,\n path: string,\n method: 'GET' | 'POST' | 'DELETE',\n body?: Readonly<Record<string, unknown>>,\n): Promise<InfraResult<Response>> {\n try {\n const response = await fetcher(`${request.baseUrl}${path}`, {\n method,\n headers: {\n apikey: request.serviceRoleKey,\n authorization: `Bearer ${request.serviceRoleKey}`,\n ...(body === undefined ? {} : { 'content-type': 'application/json' }),\n },\n ...(body === undefined ? {} : { body: JSON.stringify(body) }),\n ...(request.signal === undefined ? {} : { signal: request.signal }),\n });\n return response.ok ? { ok: true, value: response, diagnostics: [] } : requestFailure();\n } catch {\n return requestFailure();\n }\n}\n\n/*** Reject a failed HTTP request without leaking response or credential detail. */\nfunction requestFailure(): InfraResult<never> {\n return {\n ok: false,\n diagnostics: [\n {\n severity: 'error',\n code: 'supabase-control-plane-unavailable',\n message: 'The Supabase control plane request failed.',\n },\n ],\n };\n}\n\n/*** Reject a malformed storage response without exposing its body. */\nfunction invalidResponse(): InfraResult<never> {\n return {\n ok: false,\n diagnostics: [\n {\n severity: 'error',\n code: 'supabase-control-plane-response-invalid',\n message: 'The Supabase control plane returned an invalid bucket response.',\n },\n ],\n };\n}\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { InfraDestroyRequest, InfraExecutionContext, InfraReconcileResult, InfraResult } from '@ankhorage/contracts/infra';
|
|
2
|
+
import type { SupabaseControlPlane } from '../../../../types/supabase';
|
|
3
|
+
/*** Remove only explicitly confirmed persistent buckets and retain all other provider data. */
|
|
4
|
+
export declare function destroySupabaseAsync(controlPlane: SupabaseControlPlane, context: InfraExecutionContext, request: InfraDestroyRequest): Promise<InfraResult<InfraReconcileResult>>;
|
|
5
|
+
//# sourceMappingURL=destroySupabaseAsync.d.ts.map
|
package/dist/features/platform-infrastructure/application/use-cases/destroySupabaseAsync.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"destroySupabaseAsync.d.ts","sourceRoot":"","sources":["../../../../../src/features/platform-infrastructure/application/use-cases/destroySupabaseAsync.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,qBAAqB,EACrB,oBAAoB,EAEpB,WAAW,EACZ,MAAM,4BAA4B,CAAC;AAEpC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAKvE,+FAA+F;AAC/F,wBAAsB,oBAAoB,CACxC,YAAY,EAAE,oBAAoB,EAClC,OAAO,EAAE,qBAAqB,EAC9B,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAAC,WAAW,CAAC,oBAAoB,CAAC,CAAC,CAmC5C"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { resolveSupabaseDesiredState } from '../../domain/resolveSupabaseDesiredState';
|
|
2
|
+
import { resolveSupabaseControlPlaneUrl } from '../../utils/resolveSupabaseControlPlaneUrl';
|
|
3
|
+
import { resolveSupabaseBootstrapCredentialsAsync } from './resolveSupabaseBootstrapCredentialsAsync';
|
|
4
|
+
/*** Remove only explicitly confirmed persistent buckets and retain all other provider data. */
|
|
5
|
+
export async function destroySupabaseAsync(controlPlane, context, request) {
|
|
6
|
+
if (!isConfirmed(context, request))
|
|
7
|
+
return unconfirmedDestroy();
|
|
8
|
+
const desired = resolveSupabaseDesiredState(context);
|
|
9
|
+
if (!desired.ok)
|
|
10
|
+
return desired;
|
|
11
|
+
const confirmed = request.persistence.policy === 'delete' ? request.persistence.confirmedResources : [];
|
|
12
|
+
const removed = desired.value.buckets.filter((bucket) => confirmed.some((identity) => isSameIdentity(identity, bucket.identity)));
|
|
13
|
+
if (removed.length > 0) {
|
|
14
|
+
const controlPlaneUrl = resolveSupabaseControlPlaneUrl(context, desired.value.baseUrl, context.previous?.outputs ?? []);
|
|
15
|
+
if (!controlPlaneUrl.ok)
|
|
16
|
+
return controlPlaneUrl;
|
|
17
|
+
const credentials = await resolveSupabaseBootstrapCredentialsAsync(context);
|
|
18
|
+
if (!credentials.ok)
|
|
19
|
+
return credentials;
|
|
20
|
+
const controlRequest = {
|
|
21
|
+
baseUrl: controlPlaneUrl.value,
|
|
22
|
+
serviceRoleKey: credentials.value.serviceRoleKey,
|
|
23
|
+
...(context.signal === undefined ? {} : { signal: context.signal }),
|
|
24
|
+
};
|
|
25
|
+
for (const bucket of removed) {
|
|
26
|
+
const deletion = await controlPlane.deleteBucketAsync({
|
|
27
|
+
...controlRequest,
|
|
28
|
+
bucket: bucket.externalId ?? '',
|
|
29
|
+
});
|
|
30
|
+
if (!deletion.ok)
|
|
31
|
+
return deletion;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
const resources = desired.value.buckets.filter((bucket) => !removed.some(({ identity }) => isSameIdentity(identity, bucket.identity)));
|
|
35
|
+
return { ok: true, value: { resources, outputs: [] }, diagnostics: [] };
|
|
36
|
+
}
|
|
37
|
+
/*** Require exact project and environment confirmation for every destroy. */
|
|
38
|
+
function isConfirmed(context, request) {
|
|
39
|
+
return (request.projectId === context.projectId &&
|
|
40
|
+
request.environment === context.environment &&
|
|
41
|
+
request.confirmation.projectId === context.projectId &&
|
|
42
|
+
request.confirmation.environment === context.environment);
|
|
43
|
+
}
|
|
44
|
+
/*** Compare full stable resource identities before destructive work. */
|
|
45
|
+
function isSameIdentity(left, right) {
|
|
46
|
+
return (left.projectId === right.projectId &&
|
|
47
|
+
left.environment === right.environment &&
|
|
48
|
+
left.adapter === right.adapter &&
|
|
49
|
+
left.resourceId === right.resourceId);
|
|
50
|
+
}
|
|
51
|
+
/*** Reject destructive work without exact confirmation. */
|
|
52
|
+
function unconfirmedDestroy() {
|
|
53
|
+
return {
|
|
54
|
+
ok: false,
|
|
55
|
+
diagnostics: [
|
|
56
|
+
{
|
|
57
|
+
severity: 'error',
|
|
58
|
+
code: 'supabase-destroy-unconfirmed',
|
|
59
|
+
message: 'Supabase destroy requires exact project and environment confirmation.',
|
|
60
|
+
},
|
|
61
|
+
],
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=destroySupabaseAsync.js.map
|
package/dist/features/platform-infrastructure/application/use-cases/destroySupabaseAsync.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"destroySupabaseAsync.js","sourceRoot":"","sources":["../../../../../src/features/platform-infrastructure/application/use-cases/destroySupabaseAsync.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,2BAA2B,EAAE,MAAM,0CAA0C,CAAC;AACvF,OAAO,EAAE,8BAA8B,EAAE,MAAM,4CAA4C,CAAC;AAC5F,OAAO,EAAE,wCAAwC,EAAE,MAAM,4CAA4C,CAAC;AAEtG,+FAA+F;AAC/F,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,YAAkC,EAClC,OAA8B,EAC9B,OAA4B;IAE5B,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,OAAO,CAAC;QAAE,OAAO,kBAAkB,EAAE,CAAC;IAChE,MAAM,OAAO,GAAG,2BAA2B,CAAC,OAAO,CAAC,CAAC;IACrD,IAAI,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A8B;gBACpC,OAAO,EAAE,uEAAuE;aACjF;SACF;KACF,CAAC;AACJ,CAAC","sourcesContent":["import type {\n InfraDestroyRequest,\n InfraExecutionContext,\n InfraReconcileResult,\n InfraResourceIdentity,\n InfraResult,\n} from '@ankhorage/contracts/infra';\n\nimport type { SupabaseControlPlane } from '../../../../types/supabase';\nimport { resolveSupabaseDesiredState } from '../../domain/resolveSupabaseDesiredState';\nimport { resolveSupabaseControlPlaneUrl } from '../../utils/resolveSupabaseControlPlaneUrl';\nimport { resolveSupabaseBootstrapCredentialsAsync } from './resolveSupabaseBootstrapCredentialsAsync';\n\n/*** Remove only explicitly confirmed persistent buckets and retain all other provider data. */\nexport async function destroySupabaseAsync(\n controlPlane: SupabaseControlPlane,\n context: InfraExecutionContext,\n request: InfraDestroyRequest,\n): Promise<InfraResult<InfraReconcileResult>> {\n if (!isConfirmed(context, request)) return unconfirmedDestroy();\n const desired = resolveSupabaseDesiredState(context);\n if (!desired.ok) return desired;\n const confirmed =\n request.persistence.policy === 'delete' ? request.persistence.confirmedResources : [];\n const removed = desired.value.buckets.filter((bucket) =>\n confirmed.some((identity) => isSameIdentity(identity, bucket.identity)),\n );\n if (removed.length > 0) {\n const controlPlaneUrl = resolveSupabaseControlPlaneUrl(\n context,\n desired.value.baseUrl,\n context.previous?.outputs ?? [],\n );\n if (!controlPlaneUrl.ok) return controlPlaneUrl;\n const credentials = await resolveSupabaseBootstrapCredentialsAsync(context);\n if (!credentials.ok) return credentials;\n const controlRequest = {\n baseUrl: controlPlaneUrl.value,\n serviceRoleKey: credentials.value.serviceRoleKey,\n ...(context.signal === undefined ? {} : { signal: context.signal }),\n };\n for (const bucket of removed) {\n const deletion = await controlPlane.deleteBucketAsync({\n ...controlRequest,\n bucket: bucket.externalId ?? '',\n });\n if (!deletion.ok) return deletion;\n }\n }\n const resources = desired.value.buckets.filter(\n (bucket) => !removed.some(({ identity }) => isSameIdentity(identity, bucket.identity)),\n );\n return { ok: true, value: { resources, outputs: [] }, diagnostics: [] };\n}\n\n/*** Require exact project and environment confirmation for every destroy. */\nfunction isConfirmed(context: InfraExecutionContext, request: InfraDestroyRequest): boolean {\n return (\n request.projectId === context.projectId &&\n request.environment === context.environment &&\n request.confirmation.projectId === context.projectId &&\n request.confirmation.environment === context.environment\n );\n}\n\n/*** Compare full stable resource identities before destructive work. */\nfunction isSameIdentity(left: InfraResourceIdentity, right: InfraResourceIdentity): boolean {\n return (\n left.projectId === right.projectId &&\n left.environment === right.environment &&\n left.adapter === right.adapter &&\n left.resourceId === right.resourceId\n );\n}\n\n/*** Reject destructive work without exact confirmation. */\nfunction unconfirmedDestroy(): InfraResult<never> {\n return {\n ok: false,\n diagnostics: [\n {\n severity: 'error',\n code: 'supabase-destroy-unconfirmed',\n message: 'Supabase destroy requires exact project and environment confirmation.',\n },\n ],\n };\n}\n"]}
|
package/dist/features/platform-infrastructure/application/use-cases/getSupabaseStatusAsync.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { InfraExecutionContext, InfraResourceStatus, InfraResult } from '@ankhorage/contracts/infra';
|
|
2
|
+
import type { SupabaseControlPlane } from '../../../../types/supabase';
|
|
3
|
+
/*** Read platform health and bucket presence through the provider control plane. */
|
|
4
|
+
export declare function getSupabaseStatusAsync(controlPlane: SupabaseControlPlane, context: InfraExecutionContext): Promise<InfraResult<readonly InfraResourceStatus[]>>;
|
|
5
|
+
//# sourceMappingURL=getSupabaseStatusAsync.d.ts.map
|
package/dist/features/platform-infrastructure/application/use-cases/getSupabaseStatusAsync.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getSupabaseStatusAsync.d.ts","sourceRoot":"","sources":["../../../../../src/features/platform-infrastructure/application/use-cases/getSupabaseStatusAsync.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,mBAAmB,EACnB,WAAW,EACZ,MAAM,4BAA4B,CAAC;AAEpC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAKvE,oFAAoF;AACpF,wBAAsB,sBAAsB,CAC1C,YAAY,EAAE,oBAAoB,EAClC,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,WAAW,CAAC,SAAS,mBAAmB,EAAE,CAAC,CAAC,CA6CtD"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { resolveSupabaseDesiredState } from '../../domain/resolveSupabaseDesiredState';
|
|
2
|
+
import { resolveSupabaseControlPlaneUrl } from '../../utils/resolveSupabaseControlPlaneUrl';
|
|
3
|
+
import { resolveSupabaseBootstrapCredentialsAsync } from './resolveSupabaseBootstrapCredentialsAsync';
|
|
4
|
+
/*** Read platform health and bucket presence through the provider control plane. */
|
|
5
|
+
export async function getSupabaseStatusAsync(controlPlane, context) {
|
|
6
|
+
const desired = resolveSupabaseDesiredState(context);
|
|
7
|
+
if (!desired.ok)
|
|
8
|
+
return desired;
|
|
9
|
+
if (!wasPreviouslyOwned(context, 'platform')) {
|
|
10
|
+
return {
|
|
11
|
+
ok: true,
|
|
12
|
+
value: [
|
|
13
|
+
{ owner: desired.value.platform.identity, state: 'absent' },
|
|
14
|
+
...desired.value.buckets.map((bucket) => ({
|
|
15
|
+
owner: bucket.identity,
|
|
16
|
+
state: 'absent',
|
|
17
|
+
})),
|
|
18
|
+
],
|
|
19
|
+
diagnostics: [],
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
const controlPlaneUrl = resolveSupabaseControlPlaneUrl(context, desired.value.baseUrl, context.previous?.outputs ?? []);
|
|
23
|
+
if (!controlPlaneUrl.ok)
|
|
24
|
+
return controlPlaneUrl;
|
|
25
|
+
const credentials = await resolveSupabaseBootstrapCredentialsAsync(context);
|
|
26
|
+
if (!credentials.ok)
|
|
27
|
+
return credentials;
|
|
28
|
+
const request = {
|
|
29
|
+
baseUrl: controlPlaneUrl.value,
|
|
30
|
+
serviceRoleKey: credentials.value.serviceRoleKey,
|
|
31
|
+
...(context.signal === undefined ? {} : { signal: context.signal }),
|
|
32
|
+
};
|
|
33
|
+
const health = await controlPlane.healthAsync(request);
|
|
34
|
+
if (!health.ok)
|
|
35
|
+
return health;
|
|
36
|
+
const buckets = await controlPlane.listBucketsAsync(request);
|
|
37
|
+
if (!buckets.ok)
|
|
38
|
+
return buckets;
|
|
39
|
+
const existing = new Set(buckets.value);
|
|
40
|
+
return {
|
|
41
|
+
ok: true,
|
|
42
|
+
value: [
|
|
43
|
+
{ owner: desired.value.platform.identity, state: 'ready' },
|
|
44
|
+
...desired.value.buckets.map((bucket) => ({
|
|
45
|
+
owner: bucket.identity,
|
|
46
|
+
state: existing.has(bucket.externalId ?? '') ? 'ready' : 'absent',
|
|
47
|
+
})),
|
|
48
|
+
],
|
|
49
|
+
diagnostics: [],
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
/*** Check exact prior-ledger ownership before probing a platform. */
|
|
53
|
+
function wasPreviouslyOwned(context, resourceId) {
|
|
54
|
+
return (context.previous?.resources.some(({ identity }) => identity.projectId === context.projectId &&
|
|
55
|
+
identity.environment === context.environment &&
|
|
56
|
+
identity.adapter === 'supabase' &&
|
|
57
|
+
identity.resourceId === resourceId) === true);
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=getSupabaseStatusAsync.js.map
|
package/dist/features/platform-infrastructure/application/use-cases/getSupabaseStatusAsync.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getSupabaseStatusAsync.js","sourceRoot":"","sources":["../../../../../src/features/platform-infrastructure/application/use-cases/getSupabaseStatusAsync.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,2BAA2B,EAAE,MAAM,0CAA0C,CAAC;AACvF,OAAO,EAAE,8BAA8B,EAAE,MAAM,4CAA4C,CAAC;AAC5F,OAAO,EAAE,wCAAwC,EAAE,MAAM,4CAA4C,CAAC;AAEtG,oFAAoF;AACpF,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAC1C,YAAkC,E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upabaseControlPlane } from '../../../../types/supabase';\nimport { resolveSupabaseDesiredState } from '../../domain/resolveSupabaseDesiredState';\nimport { resolveSupabaseControlPlaneUrl } from '../../utils/resolveSupabaseControlPlaneUrl';\nimport { resolveSupabaseBootstrapCredentialsAsync } from './resolveSupabaseBootstrapCredentialsAsync';\n\n/*** Read platform health and bucket presence through the provider control plane. */\nexport async function getSupabaseStatusAsync(\n controlPlane: SupabaseControlPlane,\n context: InfraExecutionContext,\n): Promise<InfraResult<readonly InfraResourceStatus[]>> {\n const desired = resolveSupabaseDesiredState(context);\n if (!desired.ok) return desired;\n if (!wasPreviouslyOwned(context, 'platform')) {\n return {\n ok: true,\n value: [\n { owner: desired.value.platform.identity, state: 'absent' },\n ...desired.value.buckets.map((bucket) => ({\n owner: bucket.identity,\n state: 'absent' as const,\n })),\n ],\n diagnostics: [],\n };\n }\n const controlPlaneUrl = resolveSupabaseControlPlaneUrl(\n context,\n desired.value.baseUrl,\n context.previous?.outputs ?? [],\n );\n if (!controlPlaneUrl.ok) return controlPlaneUrl;\n const credentials = await resolveSupabaseBootstrapCredentialsAsync(context);\n if (!credentials.ok) return credentials;\n const request = {\n baseUrl: controlPlaneUrl.value,\n serviceRoleKey: credentials.value.serviceRoleKey,\n ...(context.signal === undefined ? {} : { signal: context.signal }),\n };\n const health = await controlPlane.healthAsync(request);\n if (!health.ok) return health;\n const buckets = await controlPlane.listBucketsAsync(request);\n if (!buckets.ok) return buckets;\n const existing = new Set(buckets.value);\n return {\n ok: true,\n value: [\n { owner: desired.value.platform.identity, state: 'ready' },\n ...desired.value.buckets.map((bucket) => ({\n owner: bucket.identity,\n state: existing.has(bucket.externalId ?? '') ? ('ready' as const) : ('absent' as const),\n })),\n ],\n diagnostics: [],\n };\n}\n\n/*** Check exact prior-ledger ownership before probing a platform. */\nfunction wasPreviouslyOwned(context: InfraExecutionContext, resourceId: string): boolean {\n return (\n context.previous?.resources.some(\n ({ identity }) =>\n identity.projectId === context.projectId &&\n identity.environment === context.environment &&\n identity.adapter === 'supabase' &&\n identity.resourceId === resourceId,\n ) === true\n );\n}\n"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { InfraExecutionContext, InfraPlanAction, InfraResult } from '@ankhorage/contracts/infra';
|
|
2
|
+
/*** Plan the logical platform and persistent bucket state without control-plane mutation. */
|
|
3
|
+
export declare function planSupabase(context: InfraExecutionContext): InfraResult<readonly InfraPlanAction[]>;
|
|
4
|
+
//# sourceMappingURL=planSupabase.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"planSupabase.d.ts","sourceRoot":"","sources":["../../../../../src/features/platform-infrastructure/application/use-cases/planSupabase.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,eAAe,EACf,WAAW,EACZ,MAAM,4BAA4B,CAAC;AAIpC,6FAA6F;AAC7F,wBAAgB,YAAY,CAC1B,OAAO,EAAE,qBAAqB,GAC7B,WAAW,CAAC,SAAS,eAAe,EAAE,CAAC,CA4BzC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { resolveSupabaseDesiredState } from '../../domain/resolveSupabaseDesiredState';
|
|
2
|
+
/*** Plan the logical platform and persistent bucket state without control-plane mutation. */
|
|
3
|
+
export function planSupabase(context) {
|
|
4
|
+
const desired = resolveSupabaseDesiredState(context);
|
|
5
|
+
if (!desired.ok)
|
|
6
|
+
return desired;
|
|
7
|
+
const resources = [desired.value.platform, ...desired.value.buckets];
|
|
8
|
+
const current = resources.map((resource) => ({
|
|
9
|
+
owner: resource.identity,
|
|
10
|
+
operation: wasPreviouslyOwned(context, resource.identity.resourceId) ? 'noop' : 'create',
|
|
11
|
+
impact: 'none',
|
|
12
|
+
detail: `${resource.identity.resourceId}: ${wasPreviouslyOwned(context, resource.identity.resourceId) ? 'noop' : 'create'}.`,
|
|
13
|
+
dependsOn: resource.dependsOn,
|
|
14
|
+
}));
|
|
15
|
+
const desiredIds = new Set(resources.map(({ identity }) => identity.resourceId));
|
|
16
|
+
const stale = (context.previous?.resources ?? [])
|
|
17
|
+
.filter(({ identity }) => identity.projectId === context.projectId &&
|
|
18
|
+
identity.environment === context.environment &&
|
|
19
|
+
identity.adapter === 'supabase' &&
|
|
20
|
+
!desiredIds.has(identity.resourceId))
|
|
21
|
+
.map((resource) => ({
|
|
22
|
+
owner: resource.identity,
|
|
23
|
+
operation: resource.persistent ? 'retain' : 'delete',
|
|
24
|
+
impact: 'none',
|
|
25
|
+
detail: `${resource.persistent ? 'Retain' : 'Delete'} stale Supabase resource ${resource.identity.resourceId}.`,
|
|
26
|
+
dependsOn: resource.dependsOn,
|
|
27
|
+
}));
|
|
28
|
+
return { ok: true, value: [...current, ...stale], diagnostics: [] };
|
|
29
|
+
}
|
|
30
|
+
/*** Check exact prior-ledger ownership for one logical resource. */
|
|
31
|
+
function wasPreviouslyOwned(context, resourceId) {
|
|
32
|
+
return (context.previous?.resources.some(({ identity }) => identity.projectId === context.projectId &&
|
|
33
|
+
identity.environment === context.environment &&
|
|
34
|
+
identity.adapter === 'supabase' &&
|
|
35
|
+
identity.resourceId === resourceId) === true);
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=planSupabase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"planSupabase.js","sourceRoot":"","sources":["../../../../../src/features/platform-infrastructure/application/use-cases/planSupabase.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,2BAA2B,EAAE,MAAM,0CAA0C,CAAC;AAEvF,6FAA6F;AAC7F,MAAM,UAAU,YAAY,CAC1B,OAA8B;IAE9B,MAAM,OAAO,GAAG,2BAA2B,CAAC,OAAO,CAAC,CAAC;IACrD,IAAI,CAAC,OAAO,CAAC,EAAE;QAAE,OAAO,OAAO,CAAC;IAChC,MAAM,SAAS,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,EAAE,GAAG,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACrE,MAA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,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,4BAA4B,QAAQ,CAAC,QAAQ,CAAC,UAAU,GAAG;QAC/G,SAAS,EAAE,QAAQ,CAAC,SAAS;KAC9B,CAAC,CAAC,CAAC;IACN,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,GAAG,OAAO,EAAE,GAAG,KAAK,CAAC,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC;AACtE,CAAC;AAED,oEAAoE;AACpE,SAAS,kBAAkB,CAAC,OAA8B,EAAE,UAAkB;IAC5E,OAAO,CACL,OAAO,CAAC,QAAQ,EAAE,SAAS,CAAC,IAAI,CAC9B,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CACf,QAAQ,CAAC,SAAS,KAAK,OAAO,CAAC,SAAS;QACxC,QAAQ,CAAC,WAAW,KAAK,OAAO,CAAC,WAAW;QAC5C,QAAQ,CAAC,OAAO,KAAK,UAAU;QAC/B,QAAQ,CAAC,UAAU,KAAK,UAAU,CACrC,KAAK,IAAI,CACX,CAAC;AACJ,CAAC","sourcesContent":["import type {\n InfraExecutionContext,\n InfraPlanAction,\n InfraResult,\n} from '@ankhorage/contracts/infra';\n\nimport { resolveSupabaseDesiredState } from '../../domain/resolveSupabaseDesiredState';\n\n/*** Plan the logical platform and persistent bucket state without control-plane mutation. */\nexport function planSupabase(\n context: InfraExecutionContext,\n): InfraResult<readonly InfraPlanAction[]> {\n const desired = resolveSupabaseDesiredState(context);\n if (!desired.ok) return desired;\n const resources = [desired.value.platform, ...desired.value.buckets];\n const current = resources.map<InfraPlanAction>((resource) => ({\n owner: resource.identity,\n operation: wasPreviouslyOwned(context, resource.identity.resourceId) ? 'noop' : 'create',\n impact: 'none',\n detail: `${resource.identity.resourceId}: ${wasPreviouslyOwned(context, resource.identity.resourceId) ? 'noop' : 'create'}.`,\n dependsOn: resource.dependsOn,\n }));\n const desiredIds = new Set(resources.map(({ identity }) => identity.resourceId));\n const stale = (context.previous?.resources ?? [])\n .filter(\n ({ identity }) =>\n identity.projectId === context.projectId &&\n identity.environment === context.environment &&\n identity.adapter === 'supabase' &&\n !desiredIds.has(identity.resourceId),\n )\n .map<InfraPlanAction>((resource) => ({\n owner: resource.identity,\n operation: resource.persistent ? 'retain' : 'delete',\n impact: 'none',\n detail: `${resource.persistent ? 'Retain' : 'Delete'} stale Supabase resource ${resource.identity.resourceId}.`,\n dependsOn: resource.dependsOn,\n }));\n return { ok: true, value: [...current, ...stale], diagnostics: [] };\n}\n\n/*** Check exact prior-ledger ownership for one logical resource. */\nfunction wasPreviouslyOwned(context: InfraExecutionContext, resourceId: string): boolean {\n return (\n context.previous?.resources.some(\n ({ identity }) =>\n identity.projectId === context.projectId &&\n identity.environment === context.environment &&\n identity.adapter === 'supabase' &&\n identity.resourceId === resourceId,\n ) === true\n );\n}\n"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { InfraExecutionContext, InfraResult } from '@ankhorage/contracts/infra';
|
|
2
|
+
/*** Provision one missing local bootstrap bundle while reusing every valid existing credential. */
|
|
3
|
+
export declare function prepareSupabaseBootstrapCredentialsAsync(context: InfraExecutionContext): Promise<InfraResult<null>>;
|
|
4
|
+
//# sourceMappingURL=prepareSupabaseBootstrapCredentialsAsync.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prepareSupabaseBootstrapCredentialsAsync.d.ts","sourceRoot":"","sources":["../../../../../src/features/platform-infrastructure/application/use-cases/prepareSupabaseBootstrapCredentialsAsync.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AASrF,mGAAmG;AACnG,wBAAsB,wCAAwC,CAC5D,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAkB5B"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { createHmac, randomBytes } from 'node:crypto';
|
|
2
|
+
import { SUPABASE_BOOTSTRAP_CREDENTIAL } from '../../constants/supabase';
|
|
3
|
+
import { validateSupabaseBootstrapCredentials } from '../../utils/validateSupabaseBootstrapCredentials';
|
|
4
|
+
import { resolveSupabaseBootstrapCredentialsAsync } from './resolveSupabaseBootstrapCredentialsAsync';
|
|
5
|
+
const SUPABASE_JWT_LIFETIME_SECONDS = 5 * 365 * 24 * 60 * 60;
|
|
6
|
+
/*** Provision one missing local bootstrap bundle while reusing every valid existing credential. */
|
|
7
|
+
export async function prepareSupabaseBootstrapCredentialsAsync(context) {
|
|
8
|
+
const found = await context.credentials.findAsync(SUPABASE_BOOTSTRAP_CREDENTIAL);
|
|
9
|
+
if (!found.ok)
|
|
10
|
+
return found;
|
|
11
|
+
if (found.value !== null) {
|
|
12
|
+
const validated = validateSupabaseBootstrapCredentials(found.value);
|
|
13
|
+
return validated.ok ? success() : validated;
|
|
14
|
+
}
|
|
15
|
+
if (context.environment !== 'local') {
|
|
16
|
+
const required = await resolveSupabaseBootstrapCredentialsAsync(context);
|
|
17
|
+
return required.ok ? success() : required;
|
|
18
|
+
}
|
|
19
|
+
const generated = generateSupabaseBootstrapCredentials();
|
|
20
|
+
const persisted = await context.credentials.persistAsync(SUPABASE_BOOTSTRAP_CREDENTIAL, {
|
|
21
|
+
...generated,
|
|
22
|
+
});
|
|
23
|
+
if (!persisted.ok)
|
|
24
|
+
return persisted;
|
|
25
|
+
const resolved = await resolveSupabaseBootstrapCredentialsAsync(context);
|
|
26
|
+
return resolved.ok ? success() : resolved;
|
|
27
|
+
}
|
|
28
|
+
/*** Generate one cryptographically random provider-owned Supabase bootstrap bundle. */
|
|
29
|
+
function generateSupabaseBootstrapCredentials() {
|
|
30
|
+
const issuedAt = Math.floor(Date.now() / 1000);
|
|
31
|
+
const jwtSecret = randomBytes(30).toString('base64');
|
|
32
|
+
return {
|
|
33
|
+
postgresPassword: randomBytes(24).toString('hex'),
|
|
34
|
+
jwtSecret,
|
|
35
|
+
anonKey: signSupabaseJwt(jwtSecret, 'anon', issuedAt),
|
|
36
|
+
serviceRoleKey: signSupabaseJwt(jwtSecret, 'service_role', issuedAt),
|
|
37
|
+
realtimeSecretKeyBase: randomBytes(48).toString('base64'),
|
|
38
|
+
realtimeDatabaseEncryptionKey: randomBytes(8).toString('hex'),
|
|
39
|
+
pgMetaCryptoKey: randomBytes(24).toString('base64'),
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
/*** Sign one legacy Supabase HS256 API token from the generated JWT secret. */
|
|
43
|
+
function signSupabaseJwt(secret, role, issuedAt) {
|
|
44
|
+
const header = encodeJwtPart({ alg: 'HS256', typ: 'JWT' });
|
|
45
|
+
const payload = encodeJwtPart({
|
|
46
|
+
role,
|
|
47
|
+
iss: 'supabase',
|
|
48
|
+
iat: issuedAt,
|
|
49
|
+
exp: issuedAt + SUPABASE_JWT_LIFETIME_SECONDS,
|
|
50
|
+
});
|
|
51
|
+
const signingInput = `${header}.${payload}`;
|
|
52
|
+
const signature = createHmac('sha256', secret).update(signingInput).digest('base64url');
|
|
53
|
+
return `${signingInput}.${signature}`;
|
|
54
|
+
}
|
|
55
|
+
/*** Serialize one JWT object using unpadded base64url encoding. */
|
|
56
|
+
function encodeJwtPart(value) {
|
|
57
|
+
return Buffer.from(JSON.stringify(value), 'utf8').toString('base64url');
|
|
58
|
+
}
|
|
59
|
+
/*** Return one successful preparation result without exposing credential values. */
|
|
60
|
+
function success() {
|
|
61
|
+
return { ok: true, value: null, diagnostics: [] };
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=prepareSupabaseBootstrapCredentialsAsync.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prepareSupabaseBootstrapCredentialsAsync.js","sourceRoot":"","sources":["../../../../../src/features/platform-infrastructure/application/use-cases/prepareSupabaseBootstrapCredentialsAsync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAA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,QAAQ,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IACxF,OAAO,GAAG,YAAY,IAAI,SAAS,EAAE,CAAC;AACxC,CAAC;AAED,mEAAmE;AACnE,SAAS,aAAa,CAAC,KAAgD;IACrE,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;AAC1E,CAAC;AAED,oFAAoF;AACpF,SAAS,OAAO;IACd,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC;AACpD,CAAC","sourcesContent":["import { createHmac, randomBytes } from 'node:crypto';\n\nimport type { InfraExecutionContext, InfraResult } from '@ankhorage/contracts/infra';\n\nimport type { SupabaseBootstrapCredentials } from '../../../../types/supabase';\nimport { SUPABASE_BOOTSTRAP_CREDENTIAL } from '../../constants/supabase';\nimport { validateSupabaseBootstrapCredentials } from '../../utils/validateSupabaseBootstrapCredentials';\nimport { resolveSupabaseBootstrapCredentialsAsync } from './resolveSupabaseBootstrapCredentialsAsync';\n\nconst SUPABASE_JWT_LIFETIME_SECONDS = 5 * 365 * 24 * 60 * 60;\n\n/*** Provision one missing local bootstrap bundle while reusing every valid existing credential. */\nexport async function prepareSupabaseBootstrapCredentialsAsync(\n context: InfraExecutionContext,\n): Promise<InfraResult<null>> {\n const found = await context.credentials.findAsync(SUPABASE_BOOTSTRAP_CREDENTIAL);\n if (!found.ok) return found;\n if (found.value !== null) {\n const validated = validateSupabaseBootstrapCredentials(found.value);\n return validated.ok ? success() : validated;\n }\n if (context.environment !== 'local') {\n const required = await resolveSupabaseBootstrapCredentialsAsync(context);\n return required.ok ? success() : required;\n }\n const generated = generateSupabaseBootstrapCredentials();\n const persisted = await context.credentials.persistAsync(SUPABASE_BOOTSTRAP_CREDENTIAL, {\n ...generated,\n });\n if (!persisted.ok) return persisted;\n const resolved = await resolveSupabaseBootstrapCredentialsAsync(context);\n return resolved.ok ? success() : resolved;\n}\n\n/*** Generate one cryptographically random provider-owned Supabase bootstrap bundle. */\nfunction generateSupabaseBootstrapCredentials(): SupabaseBootstrapCredentials {\n const issuedAt = Math.floor(Date.now() / 1000);\n const jwtSecret = randomBytes(30).toString('base64');\n return {\n postgresPassword: randomBytes(24).toString('hex'),\n jwtSecret,\n anonKey: signSupabaseJwt(jwtSecret, 'anon', issuedAt),\n serviceRoleKey: signSupabaseJwt(jwtSecret, 'service_role', issuedAt),\n realtimeSecretKeyBase: randomBytes(48).toString('base64'),\n realtimeDatabaseEncryptionKey: randomBytes(8).toString('hex'),\n pgMetaCryptoKey: randomBytes(24).toString('base64'),\n };\n}\n\n/*** Sign one legacy Supabase HS256 API token from the generated JWT secret. */\nfunction signSupabaseJwt(secret: string, role: 'anon' | 'service_role', issuedAt: number): string {\n const header = encodeJwtPart({ alg: 'HS256', typ: 'JWT' });\n const payload = encodeJwtPart({\n role,\n iss: 'supabase',\n iat: issuedAt,\n exp: issuedAt + SUPABASE_JWT_LIFETIME_SECONDS,\n });\n const signingInput = `${header}.${payload}`;\n const signature = createHmac('sha256', secret).update(signingInput).digest('base64url');\n return `${signingInput}.${signature}`;\n}\n\n/*** Serialize one JWT object using unpadded base64url encoding. */\nfunction encodeJwtPart(value: Readonly<Record<string, string | number>>): string {\n return Buffer.from(JSON.stringify(value), 'utf8').toString('base64url');\n}\n\n/*** Return one successful preparation result without exposing credential values. */\nfunction success(): InfraResult<null> {\n return { ok: true, value: null, diagnostics: [] };\n}\n"]}
|
package/dist/features/platform-infrastructure/application/use-cases/reconcileSupabaseAsync.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { InfraExecutionContext, InfraOutput, InfraReconcileResult, InfraResult } from '@ankhorage/contracts/infra';
|
|
2
|
+
import type { SupabaseControlPlane } from '../../../../types/supabase';
|
|
3
|
+
/*** Reconcile desired Storage buckets and return only safe platform outputs and ownership. */
|
|
4
|
+
export declare function reconcileSupabaseAsync(controlPlane: SupabaseControlPlane, context: InfraExecutionContext, runtimeOutputs: readonly InfraOutput[]): Promise<InfraResult<InfraReconcileResult>>;
|
|
5
|
+
//# sourceMappingURL=reconcileSupabaseAsync.d.ts.map
|
package/dist/features/platform-infrastructure/application/use-cases/reconcileSupabaseAsync.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reconcileSupabaseAsync.d.ts","sourceRoot":"","sources":["../../../../../src/features/platform-infrastructure/application/use-cases/reconcileSupabaseAsync.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,WAAW,EACX,oBAAoB,EACpB,WAAW,EACZ,MAAM,4BAA4B,CAAC;AAEpC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAKvE,8FAA8F;AAC9F,wBAAsB,sBAAsB,CAC1C,YAAY,EAAE,oBAAoB,EAClC,OAAO,EAAE,qBAAqB,EAC9B,cAAc,EAAE,SAAS,WAAW,EAAE,GACrC,OAAO,CAAC,WAAW,CAAC,oBAAoB,CAAC,CAAC,CAsC5C"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { resolveSupabaseDesiredState } from '../../domain/resolveSupabaseDesiredState';
|
|
2
|
+
import { resolveSupabaseControlPlaneUrl } from '../../utils/resolveSupabaseControlPlaneUrl';
|
|
3
|
+
import { resolveSupabaseBootstrapCredentialsAsync } from './resolveSupabaseBootstrapCredentialsAsync';
|
|
4
|
+
/*** Reconcile desired Storage buckets and return only safe platform outputs and ownership. */
|
|
5
|
+
export async function reconcileSupabaseAsync(controlPlane, context, runtimeOutputs) {
|
|
6
|
+
const desired = resolveSupabaseDesiredState(context);
|
|
7
|
+
if (!desired.ok)
|
|
8
|
+
return desired;
|
|
9
|
+
const controlPlaneUrl = resolveSupabaseControlPlaneUrl(context, desired.value.baseUrl, runtimeOutputs);
|
|
10
|
+
if (!controlPlaneUrl.ok)
|
|
11
|
+
return controlPlaneUrl;
|
|
12
|
+
const credentials = await resolveSupabaseBootstrapCredentialsAsync(context);
|
|
13
|
+
if (!credentials.ok)
|
|
14
|
+
return credentials;
|
|
15
|
+
const request = {
|
|
16
|
+
baseUrl: controlPlaneUrl.value,
|
|
17
|
+
serviceRoleKey: credentials.value.serviceRoleKey,
|
|
18
|
+
...(context.signal === undefined ? {} : { signal: context.signal }),
|
|
19
|
+
};
|
|
20
|
+
const existing = await controlPlane.listBucketsAsync(request);
|
|
21
|
+
if (!existing.ok)
|
|
22
|
+
return existing;
|
|
23
|
+
const existingNames = new Set(existing.value);
|
|
24
|
+
for (const bucket of desired.value.buckets) {
|
|
25
|
+
const name = bucket.externalId ?? '';
|
|
26
|
+
if (existingNames.has(name))
|
|
27
|
+
continue;
|
|
28
|
+
const created = await controlPlane.createBucketAsync({ ...request, bucket: name });
|
|
29
|
+
if (!created.ok)
|
|
30
|
+
return created;
|
|
31
|
+
}
|
|
32
|
+
return {
|
|
33
|
+
ok: true,
|
|
34
|
+
value: {
|
|
35
|
+
resources: [desired.value.platform, ...desired.value.buckets],
|
|
36
|
+
outputs: createOutputs(desired.value.platform.identity, desired.value.baseUrl, credentials.value.anonKey, desired.value.buckets),
|
|
37
|
+
},
|
|
38
|
+
diagnostics: [],
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
/*** Create public client configuration and non-secret bucket identifiers. */
|
|
42
|
+
function createOutputs(platformOwner, baseUrl, anonKey, buckets) {
|
|
43
|
+
return [
|
|
44
|
+
{
|
|
45
|
+
owner: platformOwner,
|
|
46
|
+
name: 'url',
|
|
47
|
+
visibility: 'public',
|
|
48
|
+
value: baseUrl,
|
|
49
|
+
environmentVariable: 'EXPO_PUBLIC_SUPABASE_URL',
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
owner: platformOwner,
|
|
53
|
+
name: 'anonKey',
|
|
54
|
+
visibility: 'public',
|
|
55
|
+
value: anonKey,
|
|
56
|
+
environmentVariable: 'EXPO_PUBLIC_SUPABASE_ANON_KEY',
|
|
57
|
+
},
|
|
58
|
+
...buckets.map((bucket) => ({
|
|
59
|
+
owner: bucket.identity,
|
|
60
|
+
name: 'bucket',
|
|
61
|
+
visibility: 'public',
|
|
62
|
+
value: bucket.externalId ?? '',
|
|
63
|
+
})),
|
|
64
|
+
];
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=reconcileSupabaseAsync.js.map
|