@sylphx/management 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +88 -0
- package/LICENSE +21 -0
- package/README.md +157 -101
- package/dist/admin.d.ts +141 -0
- package/dist/admin.d.ts.map +1 -0
- package/dist/admin.js +96 -0
- package/dist/adminBootstrap.d.ts +46 -0
- package/dist/adminBootstrap.d.ts.map +1 -0
- package/dist/adminBootstrap.js +33 -0
- package/dist/adminBuilds.d.ts +72 -0
- package/dist/adminBuilds.d.ts.map +1 -0
- package/dist/adminBuilds.js +29 -0
- package/dist/adminEnvServices.d.ts +41 -0
- package/dist/adminEnvServices.d.ts.map +1 -0
- package/dist/adminEnvServices.js +22 -0
- package/dist/adminRateLimits.d.ts +61 -0
- package/dist/adminRateLimits.d.ts.map +1 -0
- package/dist/adminRateLimits.js +44 -0
- package/dist/adminReconcile.d.ts +45 -0
- package/dist/adminReconcile.d.ts.map +1 -0
- package/dist/adminReconcile.js +20 -0
- package/dist/adminResources.d.ts +97 -0
- package/dist/adminResources.d.ts.map +1 -0
- package/dist/adminResources.js +40 -0
- package/dist/adminSecrets.d.ts +60 -0
- package/dist/adminSecrets.d.ts.map +1 -0
- package/dist/adminSecrets.js +43 -0
- package/dist/adminTenants.d.ts +41 -0
- package/dist/adminTenants.d.ts.map +1 -0
- package/dist/adminTenants.js +29 -0
- package/dist/ai.d.ts +148 -0
- package/dist/ai.d.ts.map +1 -0
- package/dist/ai.js +29 -0
- package/dist/analytics.d.ts +49 -0
- package/dist/analytics.d.ts.map +1 -0
- package/dist/analytics.js +23 -0
- package/dist/auth.d.ts +39 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.js +27 -0
- package/dist/authSettings.d.ts +71 -0
- package/dist/authSettings.d.ts.map +1 -0
- package/dist/authSettings.js +39 -0
- package/dist/backups.d.ts +66 -0
- package/dist/backups.d.ts.map +1 -0
- package/dist/backups.js +32 -0
- package/dist/billing.d.ts +105 -0
- package/dist/billing.d.ts.map +1 -0
- package/dist/billing.js +42 -0
- package/dist/billingSettings.d.ts +78 -0
- package/dist/billingSettings.d.ts.map +1 -0
- package/dist/billingSettings.js +54 -0
- package/dist/branchDatabases.d.ts +53 -0
- package/dist/branchDatabases.d.ts.map +1 -0
- package/dist/branchDatabases.js +38 -0
- package/dist/certs.d.ts +63 -0
- package/dist/certs.d.ts.map +1 -0
- package/dist/certs.js +28 -0
- package/dist/ciSettings.d.ts +77 -0
- package/dist/ciSettings.d.ts.map +1 -0
- package/dist/ciSettings.js +41 -0
- package/dist/client.d.ts +36 -38
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +32 -90
- package/dist/consent.d.ts +111 -0
- package/dist/consent.d.ts.map +1 -0
- package/dist/consent.js +35 -0
- package/dist/databases.d.ts +17 -0
- package/dist/databases.d.ts.map +1 -0
- package/dist/databases.js +32 -0
- package/dist/deployments.d.ts +22 -0
- package/dist/deployments.d.ts.map +1 -0
- package/dist/deployments.js +39 -0
- package/dist/domains.d.ts +26 -0
- package/dist/domains.d.ts.map +1 -0
- package/dist/domains.js +39 -0
- package/dist/edgeDeployments.d.ts +43 -0
- package/dist/edgeDeployments.d.ts.map +1 -0
- package/dist/edgeDeployments.js +32 -0
- package/dist/email.d.ts +45 -0
- package/dist/email.d.ts.map +1 -0
- package/dist/email.js +21 -0
- package/dist/engagement.d.ts +100 -0
- package/dist/engagement.d.ts.map +1 -0
- package/dist/engagement.js +28 -0
- package/dist/envVars.d.ts +17 -0
- package/dist/envVars.d.ts.map +1 -0
- package/dist/envVars.js +34 -0
- package/dist/environments.d.ts +41 -0
- package/dist/environments.d.ts.map +1 -0
- package/dist/environments.js +54 -0
- package/dist/errors.d.ts +8 -3
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +8 -2
- package/dist/experiments.d.ts +80 -0
- package/dist/experiments.d.ts.map +1 -0
- package/dist/experiments.js +23 -0
- package/dist/flags.d.ts +85 -0
- package/dist/flags.d.ts.map +1 -0
- package/dist/flags.js +25 -0
- package/dist/functions.d.ts +39 -0
- package/dist/functions.d.ts.map +1 -0
- package/dist/functions.js +40 -0
- package/dist/github.d.ts +33 -0
- package/dist/github.d.ts.map +1 -0
- package/dist/github.js +22 -0
- package/dist/http.d.ts +28 -0
- package/dist/http.d.ts.map +1 -0
- package/dist/http.js +71 -0
- package/dist/index.d.ts +85 -20
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +86 -20
- package/dist/kv.d.ts +66 -0
- package/dist/kv.d.ts.map +1 -0
- package/dist/kv.js +36 -0
- package/dist/logs.d.ts +14 -0
- package/dist/logs.d.ts.map +1 -0
- package/dist/logs.js +17 -0
- package/dist/management.d.ts +55 -0
- package/dist/management.d.ts.map +1 -0
- package/dist/management.js +31 -0
- package/dist/monitoring.d.ts +65 -0
- package/dist/monitoring.d.ts.map +1 -0
- package/dist/monitoring.js +29 -0
- package/dist/newsletter.d.ts +279 -0
- package/dist/newsletter.d.ts.map +1 -0
- package/dist/newsletter.js +98 -0
- package/dist/notifications.d.ts +30 -0
- package/dist/notifications.d.ts.map +1 -0
- package/dist/notifications.js +19 -0
- package/dist/oidc.d.ts +46 -0
- package/dist/oidc.d.ts.map +1 -0
- package/dist/oidc.js +25 -0
- package/dist/organizations.d.ts +24 -0
- package/dist/organizations.d.ts.map +1 -0
- package/dist/organizations.js +42 -0
- package/dist/plans.d.ts +66 -0
- package/dist/plans.d.ts.map +1 -0
- package/dist/plans.js +42 -0
- package/dist/privacy.d.ts +138 -0
- package/dist/privacy.d.ts.map +1 -0
- package/dist/privacy.js +41 -0
- package/dist/projects.d.ts +14 -0
- package/dist/projects.d.ts.map +1 -0
- package/dist/projects.js +22 -0
- package/dist/realtime.d.ts +33 -0
- package/dist/realtime.d.ts.map +1 -0
- package/dist/realtime.js +19 -0
- package/dist/referrals.d.ts +100 -0
- package/dist/referrals.d.ts.map +1 -0
- package/dist/referrals.js +33 -0
- package/dist/refresh.d.ts +44 -0
- package/dist/refresh.d.ts.map +1 -0
- package/dist/refresh.js +33 -0
- package/dist/remoteConfig.d.ts +15 -0
- package/dist/remoteConfig.d.ts.map +1 -0
- package/dist/remoteConfig.js +35 -0
- package/dist/resourceBindings.d.ts +19 -0
- package/dist/resourceBindings.d.ts.map +1 -0
- package/dist/resourceBindings.js +24 -0
- package/dist/runners.d.ts +60 -0
- package/dist/runners.d.ts.map +1 -0
- package/dist/runners.js +17 -0
- package/dist/saml.d.ts +44 -0
- package/dist/saml.d.ts.map +1 -0
- package/dist/saml.js +77 -0
- package/dist/sandboxes.d.ts +15 -0
- package/dist/sandboxes.d.ts.map +1 -0
- package/dist/sandboxes.js +18 -0
- package/dist/search.d.ts +66 -0
- package/dist/search.d.ts.map +1 -0
- package/dist/search.js +29 -0
- package/dist/secrets.d.ts +50 -0
- package/dist/secrets.d.ts.map +1 -0
- package/dist/secrets.js +61 -0
- package/dist/security.d.ts +58 -0
- package/dist/security.d.ts.map +1 -0
- package/dist/security.js +49 -0
- package/dist/serviceTokenRequests.d.ts +71 -0
- package/dist/serviceTokenRequests.d.ts.map +1 -0
- package/dist/serviceTokenRequests.js +43 -0
- package/dist/serviceTokens.d.ts +65 -0
- package/dist/serviceTokens.d.ts.map +1 -0
- package/dist/serviceTokens.js +22 -0
- package/dist/services.d.ts +10 -0
- package/dist/services.d.ts.map +1 -0
- package/dist/services.js +15 -0
- package/dist/sessionReplay.d.ts +116 -0
- package/dist/sessionReplay.d.ts.map +1 -0
- package/dist/sessionReplay.js +29 -0
- package/dist/storage.d.ts +12 -0
- package/dist/storage.d.ts.map +1 -0
- package/dist/storage.js +10 -0
- package/dist/tasks.d.ts +29 -0
- package/dist/tasks.d.ts.map +1 -0
- package/dist/tasks.js +29 -0
- package/dist/types.d.ts +59 -155
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +17 -3
- package/dist/user.d.ts +99 -0
- package/dist/user.d.ts.map +1 -0
- package/dist/user.js +58 -0
- package/dist/users.d.ts +9 -0
- package/dist/users.d.ts.map +1 -0
- package/dist/users.js +11 -0
- package/dist/volumes.d.ts +16 -0
- package/dist/volumes.d.ts.map +1 -0
- package/dist/volumes.js +9 -0
- package/dist/webhooks.d.ts +77 -0
- package/dist/webhooks.d.ts.map +1 -0
- package/dist/webhooks.js +27 -0
- package/package.json +194 -5
- package/dist/request.d.ts +0 -5
- package/dist/request.d.ts.map +0 -1
- package/dist/request.js +0 -1
- package/dist/resources/config.d.ts +0 -30
- package/dist/resources/config.d.ts.map +0 -1
- package/dist/resources/config.js +0 -62
- package/dist/resources/databases.d.ts +0 -26
- package/dist/resources/databases.d.ts.map +0 -1
- package/dist/resources/databases.js +0 -29
- package/dist/resources/deployments.d.ts +0 -24
- package/dist/resources/deployments.d.ts.map +0 -1
- package/dist/resources/deployments.js +0 -30
- package/dist/resources/domains.d.ts +0 -30
- package/dist/resources/domains.d.ts.map +0 -1
- package/dist/resources/domains.js +0 -46
- package/dist/resources/env-vars.d.ts +0 -19
- package/dist/resources/env-vars.d.ts.map +0 -1
- package/dist/resources/env-vars.js +0 -30
- package/dist/resources/environments.d.ts +0 -16
- package/dist/resources/environments.d.ts.map +0 -1
- package/dist/resources/environments.js +0 -24
- package/dist/resources/logs.d.ts +0 -13
- package/dist/resources/logs.d.ts.map +0 -1
- package/dist/resources/logs.js +0 -20
- package/dist/resources/org.d.ts +0 -15
- package/dist/resources/org.d.ts.map +0 -1
- package/dist/resources/org.js +0 -25
- package/dist/resources/projects.d.ts +0 -19
- package/dist/resources/projects.d.ts.map +0 -1
- package/dist/resources/projects.js +0 -19
- package/dist/resources/resources.d.ts +0 -26
- package/dist/resources/resources.d.ts.map +0 -1
- package/dist/resources/resources.js +0 -32
- package/dist/resources/services.d.ts +0 -21
- package/dist/resources/services.d.ts.map +0 -1
- package/dist/resources/services.js +0 -30
- package/dist/resources/storage.d.ts +0 -21
- package/dist/resources/storage.d.ts.map +0 -1
- package/dist/resources/storage.js +0 -25
- package/dist/resources/tasks.d.ts +0 -42
- package/dist/resources/tasks.d.ts.map +0 -1
- package/dist/resources/tasks.js +0 -49
- package/dist/resources/user.d.ts +0 -9
- package/dist/resources/user.d.ts.map +0 -1
- package/dist/resources/user.js +0 -10
- package/dist/resources/volumes.d.ts +0 -20
- package/dist/resources/volumes.d.ts.map +0 -1
- package/dist/resources/volumes.js +0 -19
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Platform-admin auth settings — OAuth provider configuration, auth
|
|
3
|
+
* policy settings, auth stats. Distinct from `@sylphx/sdk.auth.*` (end-
|
|
4
|
+
* user credentials on the BaaS plane) and from session / password /
|
|
5
|
+
* device endpoints (which are Management but operator-self-service).
|
|
6
|
+
*
|
|
7
|
+
* Mirrors the `authAdminEndpoints` portion of
|
|
8
|
+
* `apps/api/src/server/platform/routes/auth.ts`.
|
|
9
|
+
*/
|
|
10
|
+
import { authAdminEndpoints } from '@sylphx/contract';
|
|
11
|
+
import { request } from './http.js';
|
|
12
|
+
export const getOAuthProviders = (client) => {
|
|
13
|
+
const { method, path } = authAdminEndpoints.getOAuthProviders;
|
|
14
|
+
return request(client, method, path);
|
|
15
|
+
};
|
|
16
|
+
export const updateOAuthProviders = (client, body) => {
|
|
17
|
+
const { method, path } = authAdminEndpoints.updateOAuthProviders;
|
|
18
|
+
return request(client, method, path, { body });
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Rotate a single OAuth provider's client secret without touching the
|
|
22
|
+
* rest of the provider list. Convenience wrapper over
|
|
23
|
+
* `updateOAuthProviders` — Phase 4b SOTA addition (ADR-089 Matrix 2 gap).
|
|
24
|
+
*/
|
|
25
|
+
export const rotateOAuthSecret = (client, provider, newClientSecret) => updateOAuthProviders(client, {
|
|
26
|
+
providers: [{ provider, enabled: true, clientSecret: newClientSecret }],
|
|
27
|
+
});
|
|
28
|
+
export const getAuthSettings = (client) => {
|
|
29
|
+
const { method, path } = authAdminEndpoints.getAuthSettings;
|
|
30
|
+
return request(client, method, path);
|
|
31
|
+
};
|
|
32
|
+
export const updateAuthSettings = (client, body) => {
|
|
33
|
+
const { method, path } = authAdminEndpoints.updateAuthSettings;
|
|
34
|
+
return request(client, method, path, { body });
|
|
35
|
+
};
|
|
36
|
+
export const getAuthStats = (client) => {
|
|
37
|
+
const { method, path } = authAdminEndpoints.getAuthStats;
|
|
38
|
+
return request(client, method, path);
|
|
39
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Database / storage backups — list / trigger / restore / delete.
|
|
3
|
+
*
|
|
4
|
+
* GET /backups?projectId=&envId=
|
|
5
|
+
* POST /backups/trigger — schedule a fresh backup
|
|
6
|
+
* POST /backups/:id/restore — restore into same or alternate DB
|
|
7
|
+
* DELETE /backups/:id
|
|
8
|
+
*
|
|
9
|
+
* Routes live under the Platform API (`/api/v1/backups/*`). Previously
|
|
10
|
+
* accessed via `authedFetch` in the CLI; promoted to a first-class SDK
|
|
11
|
+
* module per ADR-077 trio-completeness.
|
|
12
|
+
*/
|
|
13
|
+
import type { Client } from './client.js';
|
|
14
|
+
export type BackupStatus = 'completed' | 'in_progress' | 'failed';
|
|
15
|
+
export interface Backup {
|
|
16
|
+
readonly id: string;
|
|
17
|
+
readonly projectId: string;
|
|
18
|
+
readonly envId: string;
|
|
19
|
+
readonly key: string;
|
|
20
|
+
readonly timestamp: string;
|
|
21
|
+
readonly sizeBytes: number;
|
|
22
|
+
readonly status: BackupStatus;
|
|
23
|
+
}
|
|
24
|
+
export interface ListResult {
|
|
25
|
+
readonly backups: readonly Backup[];
|
|
26
|
+
readonly total: number;
|
|
27
|
+
}
|
|
28
|
+
export declare const list: (client: Client, projectId: string, envId?: string) => Promise<ListResult>;
|
|
29
|
+
export declare const trigger: (client: Client, projectId: string, envId: string) => Promise<{
|
|
30
|
+
backup: Backup;
|
|
31
|
+
}>;
|
|
32
|
+
export declare const restore: (client: Client, backupId: string, targetDatabaseUrl?: string) => Promise<{
|
|
33
|
+
success: boolean;
|
|
34
|
+
message: string;
|
|
35
|
+
}>;
|
|
36
|
+
/**
|
|
37
|
+
* Point-in-time recovery. Targets a specific timestamp between the most
|
|
38
|
+
* recent base backup and current time; the platform walks WAL to land
|
|
39
|
+
* exactly there. Phase 4b Matrix-2 gap closure.
|
|
40
|
+
*/
|
|
41
|
+
export declare const restorePointInTime: (client: Client, databaseId: string, body: {
|
|
42
|
+
/** RFC-3339 timestamp to restore to (must lie within WAL retention window). */
|
|
43
|
+
readonly pointInTime: string;
|
|
44
|
+
/** When true, restore into the same DB in place (destructive). Otherwise a new branch DB is created. */
|
|
45
|
+
readonly inPlace?: boolean;
|
|
46
|
+
/** Optional explicit target database URL for restore-to-external. */
|
|
47
|
+
readonly targetDatabaseUrl?: string;
|
|
48
|
+
}) => Promise<{
|
|
49
|
+
success: boolean;
|
|
50
|
+
message: string;
|
|
51
|
+
restoredToTimestamp: string;
|
|
52
|
+
}>;
|
|
53
|
+
/**
|
|
54
|
+
* In-place restore from a known backup — overwrites the source DB
|
|
55
|
+
* without a new branch. Destructive; requires the caller to hold a
|
|
56
|
+
* maintenance window.
|
|
57
|
+
*/
|
|
58
|
+
export declare const restoreInPlace: (client: Client, backupId: string) => Promise<{
|
|
59
|
+
success: boolean;
|
|
60
|
+
message: string;
|
|
61
|
+
}>;
|
|
62
|
+
declare const _delete: (client: Client, backupId: string) => Promise<{
|
|
63
|
+
success: boolean;
|
|
64
|
+
}>;
|
|
65
|
+
export { _delete as delete };
|
|
66
|
+
//# sourceMappingURL=backups.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"backups.d.ts","sourceRoot":"","sources":["../src/backups.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAGzC,MAAM,MAAM,YAAY,GAAG,WAAW,GAAG,aAAa,GAAG,QAAQ,CAAA;AAEjE,MAAM,WAAW,MAAM;IACtB,QAAQ,CAAC,E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mBAAmB,EAAE,MAAM,CAAA;CAAE,CACkB,CAAA;AAE/F;;;;GAIG;AACH,eAAO,MAAM,cAAc,GAC1B,QAAQ,MAAM,EACd,UAAU,MAAM,KACd,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CACqC,CAAA;AAErF,QAAA,MAAM,OAAO,GAAI,QAAQ,MAAM,EAAE,UAAU,MAAM,KAAG,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,CACV,CAAA;AACtE,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,CAAA"}
|
package/dist/backups.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Database / storage backups — list / trigger / restore / delete.
|
|
3
|
+
*
|
|
4
|
+
* GET /backups?projectId=&envId=
|
|
5
|
+
* POST /backups/trigger — schedule a fresh backup
|
|
6
|
+
* POST /backups/:id/restore — restore into same or alternate DB
|
|
7
|
+
* DELETE /backups/:id
|
|
8
|
+
*
|
|
9
|
+
* Routes live under the Platform API (`/api/v1/backups/*`). Previously
|
|
10
|
+
* accessed via `authedFetch` in the CLI; promoted to a first-class SDK
|
|
11
|
+
* module per ADR-077 trio-completeness.
|
|
12
|
+
*/
|
|
13
|
+
import { request } from './http.js';
|
|
14
|
+
export const list = (client, projectId, envId) => request(client, 'GET', '/backups', { query: { projectId, envId } });
|
|
15
|
+
export const trigger = (client, projectId, envId) => request(client, 'POST', '/backups/trigger', { body: { projectId, envId } });
|
|
16
|
+
export const restore = (client, backupId, targetDatabaseUrl) => request(client, 'POST', `/backups/${encodeURIComponent(backupId)}/restore`, {
|
|
17
|
+
body: targetDatabaseUrl ? { targetDatabaseUrl } : {},
|
|
18
|
+
});
|
|
19
|
+
/**
|
|
20
|
+
* Point-in-time recovery. Targets a specific timestamp between the most
|
|
21
|
+
* recent base backup and current time; the platform walks WAL to land
|
|
22
|
+
* exactly there. Phase 4b Matrix-2 gap closure.
|
|
23
|
+
*/
|
|
24
|
+
export const restorePointInTime = (client, databaseId, body) => request(client, 'POST', `/backups/databases/${encodeURIComponent(databaseId)}/pitr`, { body });
|
|
25
|
+
/**
|
|
26
|
+
* In-place restore from a known backup — overwrites the source DB
|
|
27
|
+
* without a new branch. Destructive; requires the caller to hold a
|
|
28
|
+
* maintenance window.
|
|
29
|
+
*/
|
|
30
|
+
export const restoreInPlace = (client, backupId) => request(client, 'POST', `/backups/${encodeURIComponent(backupId)}/restore-in-place`);
|
|
31
|
+
const _delete = (client, backupId) => request(client, 'DELETE', `/backups/${encodeURIComponent(backupId)}`);
|
|
32
|
+
export { _delete as delete };
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Billing — subscription + plan catalogue.
|
|
3
|
+
*
|
|
4
|
+
* GET /billing/subscription/me?projectId= — caller's active plan (or null)
|
|
5
|
+
* GET /billing/plans?projectId= — catalogue available to this project
|
|
6
|
+
* POST /billing/subscription/update — switch plan / interval
|
|
7
|
+
*
|
|
8
|
+
* Plan switches are synchronous on the Stripe side — the API returns once
|
|
9
|
+
* Stripe has accepted the update, so callers see the new tier immediately.
|
|
10
|
+
*/
|
|
11
|
+
import type { Client } from './client.js';
|
|
12
|
+
export interface CurrentPlan {
|
|
13
|
+
readonly id: string;
|
|
14
|
+
readonly planSlug: string;
|
|
15
|
+
readonly status: string;
|
|
16
|
+
readonly interval: string | null;
|
|
17
|
+
readonly currentPeriodStart: string | null;
|
|
18
|
+
readonly currentPeriodEnd: string | null;
|
|
19
|
+
readonly cancelAtPeriodEnd?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export declare const getCurrentPlan: (client: Client, projectId: string) => Promise<CurrentPlan | null>;
|
|
22
|
+
export interface PlanListing {
|
|
23
|
+
readonly id: string;
|
|
24
|
+
readonly slug: string;
|
|
25
|
+
readonly name: string;
|
|
26
|
+
readonly description: string | null;
|
|
27
|
+
readonly features: unknown;
|
|
28
|
+
readonly priceMonthly: number | null;
|
|
29
|
+
readonly priceAnnual: number | null;
|
|
30
|
+
readonly priceLifetime: number | null;
|
|
31
|
+
}
|
|
32
|
+
export declare const listPlans: (client: Client, projectId: string) => Promise<{
|
|
33
|
+
plans: readonly PlanListing[];
|
|
34
|
+
}>;
|
|
35
|
+
export type PlanInterval = 'monthly' | 'annual' | 'lifetime';
|
|
36
|
+
export interface UpgradeResult {
|
|
37
|
+
readonly success: boolean;
|
|
38
|
+
readonly subscription?: {
|
|
39
|
+
readonly id: string;
|
|
40
|
+
readonly planSlug: string;
|
|
41
|
+
readonly interval: string;
|
|
42
|
+
readonly currentPeriodEnd: string;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
export declare const upgrade: (client: Client, projectId: string, userId: string, newPlanSlug: string, newInterval?: PlanInterval) => Promise<UpgradeResult>;
|
|
46
|
+
export interface UsageMetric {
|
|
47
|
+
readonly used: number;
|
|
48
|
+
readonly unit: string;
|
|
49
|
+
readonly costFormatted?: string;
|
|
50
|
+
}
|
|
51
|
+
export interface UsageServiceCost {
|
|
52
|
+
readonly cost?: number;
|
|
53
|
+
readonly costFormatted?: string;
|
|
54
|
+
}
|
|
55
|
+
export interface UsageSummary {
|
|
56
|
+
readonly projectId: string;
|
|
57
|
+
readonly month: string;
|
|
58
|
+
readonly metrics?: Readonly<Record<string, UsageMetric>>;
|
|
59
|
+
readonly services?: Readonly<Record<string, UsageServiceCost>>;
|
|
60
|
+
}
|
|
61
|
+
export declare const usageSummary: (client: Client, projectId: string, options?: {
|
|
62
|
+
month?: string;
|
|
63
|
+
}) => Promise<UsageSummary>;
|
|
64
|
+
export interface Balance {
|
|
65
|
+
readonly balanceFormatted?: string;
|
|
66
|
+
readonly balanceMicrodollars?: number;
|
|
67
|
+
readonly status?: string;
|
|
68
|
+
readonly nextInvoiceAt?: string | null;
|
|
69
|
+
readonly nextInvoicePreview?: {
|
|
70
|
+
readonly totalFormatted?: string;
|
|
71
|
+
} | null;
|
|
72
|
+
}
|
|
73
|
+
export declare const balance: (client: Client, projectId: string) => Promise<Balance>;
|
|
74
|
+
export interface CreditPackage {
|
|
75
|
+
readonly id: string;
|
|
76
|
+
readonly label: string;
|
|
77
|
+
readonly amountFormatted: string;
|
|
78
|
+
readonly bonusFormatted?: string;
|
|
79
|
+
}
|
|
80
|
+
export declare const creditPackages: (client: Client) => Promise<{
|
|
81
|
+
packages: readonly CreditPackage[];
|
|
82
|
+
}>;
|
|
83
|
+
export interface Invoice {
|
|
84
|
+
readonly id: string;
|
|
85
|
+
readonly invoiceNumber: string;
|
|
86
|
+
readonly billingMonth: string;
|
|
87
|
+
readonly status: string;
|
|
88
|
+
readonly totalFormatted: string;
|
|
89
|
+
readonly dueAt: string | null;
|
|
90
|
+
readonly paidAt: string | null;
|
|
91
|
+
readonly createdAt: string;
|
|
92
|
+
}
|
|
93
|
+
export declare const listInvoices: (client: Client, projectId: string, options?: {
|
|
94
|
+
limit?: number;
|
|
95
|
+
}) => Promise<{
|
|
96
|
+
invoices: readonly Invoice[];
|
|
97
|
+
}>;
|
|
98
|
+
/**
|
|
99
|
+
* Fetch structured invoice detail. Returns the raw server document —
|
|
100
|
+
* today JSON, tomorrow potentially a PDF link field when the render
|
|
101
|
+
* pipeline lands. Callers that persist this to disk should remain
|
|
102
|
+
* type-agnostic (`unknown`) rather than latching onto the current shape.
|
|
103
|
+
*/
|
|
104
|
+
export declare const invoiceDetail: (client: Client, projectId: string, invoiceId: string) => Promise<unknown>;
|
|
105
|
+
//# sourceMappingURL=billing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"billing.d.ts","sourceRoot":"","sources":["../src/billing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAGzC,MAAM,WAAW,WAAW;IAC3B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CA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,WAAW,MAAM,EACjB,WAAW,MAAM,KACf,OAAO,CAAC,OAAO,CAGf,CAAA"}
|
package/dist/billing.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Billing — subscription + plan catalogue.
|
|
3
|
+
*
|
|
4
|
+
* GET /billing/subscription/me?projectId= — caller's active plan (or null)
|
|
5
|
+
* GET /billing/plans?projectId= — catalogue available to this project
|
|
6
|
+
* POST /billing/subscription/update — switch plan / interval
|
|
7
|
+
*
|
|
8
|
+
* Plan switches are synchronous on the Stripe side — the API returns once
|
|
9
|
+
* Stripe has accepted the update, so callers see the new tier immediately.
|
|
10
|
+
*/
|
|
11
|
+
import { request } from './http.js';
|
|
12
|
+
export const getCurrentPlan = (client, projectId) => request(client, 'GET', '/billing/subscription/me', { query: { projectId } });
|
|
13
|
+
export const listPlans = (client, projectId) => request(client, 'GET', '/billing/plans', { query: { projectId } });
|
|
14
|
+
export const upgrade = (client, projectId, userId, newPlanSlug, newInterval) => request(client, 'POST', '/billing/subscription/update', {
|
|
15
|
+
body: {
|
|
16
|
+
projectId,
|
|
17
|
+
userId,
|
|
18
|
+
newPlanSlug,
|
|
19
|
+
...(newInterval ? { newInterval } : {}),
|
|
20
|
+
prorationBehavior: 'create_prorations',
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
export const usageSummary = (client, projectId, options) => request(client, 'GET', '/billing/usage/summary', {
|
|
24
|
+
query: { projectId, month: options?.month },
|
|
25
|
+
});
|
|
26
|
+
export const balance = (client, projectId) => request(client, 'GET', '/billing/balance', { query: { projectId } });
|
|
27
|
+
export const creditPackages = (client) => request(client, 'GET', '/billing/credits/packages');
|
|
28
|
+
export const listInvoices = (client, projectId, options) => request(client, 'GET', '/billing/invoices', {
|
|
29
|
+
query: {
|
|
30
|
+
projectId,
|
|
31
|
+
limit: options?.limit !== undefined ? String(options.limit) : undefined,
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
/**
|
|
35
|
+
* Fetch structured invoice detail. Returns the raw server document —
|
|
36
|
+
* today JSON, tomorrow potentially a PDF link field when the render
|
|
37
|
+
* pipeline lands. Callers that persist this to disk should remain
|
|
38
|
+
* type-agnostic (`unknown`) rather than latching onto the current shape.
|
|
39
|
+
*/
|
|
40
|
+
export const invoiceDetail = (client, projectId, invoiceId) => request(client, 'GET', '/billing/invoices/detail', {
|
|
41
|
+
query: { projectId, invoiceId },
|
|
42
|
+
});
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Billing settings — business info, tax IDs, payment methods, spending
|
|
3
|
+
* caps, postpaid/prepaid enrolment. Sits alongside `billing` (usage /
|
|
4
|
+
* invoices / credits) to cover the settings surface.
|
|
5
|
+
*
|
|
6
|
+
* Mirrors `apps/api/src/server/platform/routes/billing-settings.ts` —
|
|
7
|
+
* paths sourced from `@sylphx/contract`.
|
|
8
|
+
*/
|
|
9
|
+
import type { Client } from './client.js';
|
|
10
|
+
export interface BillingSettings {
|
|
11
|
+
readonly orgId: string;
|
|
12
|
+
readonly businessName: string | null;
|
|
13
|
+
readonly businessEmail: string | null;
|
|
14
|
+
readonly businessAddress: Record<string, string | null> | null;
|
|
15
|
+
readonly taxIds: readonly {
|
|
16
|
+
readonly type: string;
|
|
17
|
+
readonly value: string;
|
|
18
|
+
}[];
|
|
19
|
+
readonly spendingCap: number | null;
|
|
20
|
+
readonly plan: 'postpaid' | 'prepaid';
|
|
21
|
+
readonly currency: string;
|
|
22
|
+
}
|
|
23
|
+
export declare const getSettings: (client: Client) => Promise<{
|
|
24
|
+
settings: BillingSettings;
|
|
25
|
+
}>;
|
|
26
|
+
export interface BusinessInfoInput {
|
|
27
|
+
readonly businessName?: string;
|
|
28
|
+
readonly businessEmail?: string;
|
|
29
|
+
readonly businessAddress?: Record<string, string>;
|
|
30
|
+
}
|
|
31
|
+
export declare const updateBusinessInfo: (client: Client, body: BusinessInfoInput) => Promise<{
|
|
32
|
+
settings: BillingSettings;
|
|
33
|
+
}>;
|
|
34
|
+
export declare const setTaxId: (client: Client, body: {
|
|
35
|
+
readonly type: string;
|
|
36
|
+
readonly value: string;
|
|
37
|
+
}) => Promise<{
|
|
38
|
+
settings: BillingSettings;
|
|
39
|
+
}>;
|
|
40
|
+
export declare const removeTaxId: (client: Client) => Promise<{
|
|
41
|
+
settings: BillingSettings;
|
|
42
|
+
}>;
|
|
43
|
+
export interface PaymentMethod {
|
|
44
|
+
readonly id: string;
|
|
45
|
+
readonly type: 'card' | 'bank';
|
|
46
|
+
readonly brand: string | null;
|
|
47
|
+
readonly last4: string | null;
|
|
48
|
+
readonly expMonth: number | null;
|
|
49
|
+
readonly expYear: number | null;
|
|
50
|
+
readonly isDefault: boolean;
|
|
51
|
+
}
|
|
52
|
+
export declare const getPaymentMethods: (client: Client) => Promise<{
|
|
53
|
+
paymentMethods: readonly PaymentMethod[];
|
|
54
|
+
}>;
|
|
55
|
+
export declare const createSetupIntent: (client: Client) => Promise<{
|
|
56
|
+
clientSecret: string;
|
|
57
|
+
setupIntentId: string;
|
|
58
|
+
}>;
|
|
59
|
+
export declare const setDefaultPaymentMethod: (client: Client, paymentMethodId: string) => Promise<{
|
|
60
|
+
success: boolean;
|
|
61
|
+
}>;
|
|
62
|
+
export declare const removePaymentMethod: (client: Client, paymentMethodId: string) => Promise<{
|
|
63
|
+
success: boolean;
|
|
64
|
+
}>;
|
|
65
|
+
export declare const setSpendingCap: (client: Client, body: {
|
|
66
|
+
readonly cap: number | null;
|
|
67
|
+
}) => Promise<{
|
|
68
|
+
settings: BillingSettings;
|
|
69
|
+
}>;
|
|
70
|
+
export declare const enablePostpaid: (client: Client) => Promise<{
|
|
71
|
+
settings: BillingSettings;
|
|
72
|
+
}>;
|
|
73
|
+
export declare const enablePrepaid: (client: Client, body: {
|
|
74
|
+
readonly initialCreditUsdCents: number;
|
|
75
|
+
}) => Promise<{
|
|
76
|
+
settings: BillingSettings;
|
|
77
|
+
}>;
|
|
78
|
+
//# sourceMappingURL=billingS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CAAA;CAAE,CAG9B,CAAA;AAED,eAAO,MAAM,cAAc,GAC1B,QAAQ,MAAM,EACd,MAAM;IAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,KACnC,OAAO,CAAC;IAAE,QAAQ,EAAE,eAAe,CAAA;CAAE,CAGvC,CAAA;AAED,eAAO,MAAM,cAAc,GAAI,QAAQ,MAAM,KAAG,OAAO,CAAC;IAAE,QAAQ,EAAE,eAAe,CAAA;CAAE,CAGpF,CAAA;AAED,eAAO,MAAM,aAAa,GACzB,QAAQ,MAAM,EACd,MAAM;IAAE,QAAQ,CAAC,qBAAqB,EAAE,MAAM,CAAA;CAAE,KAC9C,OAAO,CAAC;IAAE,QAAQ,EAAE,eAAe,CAAA;CAAE,CAGvC,CAAA"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Billing settings — business info, tax IDs, payment methods, spending
|
|
3
|
+
* caps, postpaid/prepaid enrolment. Sits alongside `billing` (usage /
|
|
4
|
+
* invoices / credits) to cover the settings surface.
|
|
5
|
+
*
|
|
6
|
+
* Mirrors `apps/api/src/server/platform/routes/billing-settings.ts` —
|
|
7
|
+
* paths sourced from `@sylphx/contract`.
|
|
8
|
+
*/
|
|
9
|
+
import { billingSettingsEndpoints } from '@sylphx/contract';
|
|
10
|
+
import { interpolatePath, request } from './http.js';
|
|
11
|
+
export const getSettings = (client) => {
|
|
12
|
+
const { method, path } = billingSettingsEndpoints.getSettings;
|
|
13
|
+
return request(client, method, path);
|
|
14
|
+
};
|
|
15
|
+
export const updateBusinessInfo = (client, body) => {
|
|
16
|
+
const { method, path } = billingSettingsEndpoints.updateBusinessInfo;
|
|
17
|
+
return request(client, method, path, { body });
|
|
18
|
+
};
|
|
19
|
+
export const setTaxId = (client, body) => {
|
|
20
|
+
const { method, path } = billingSettingsEndpoints.setTaxId;
|
|
21
|
+
return request(client, method, path, { body });
|
|
22
|
+
};
|
|
23
|
+
export const removeTaxId = (client) => {
|
|
24
|
+
const { method, path } = billingSettingsEndpoints.removeTaxId;
|
|
25
|
+
return request(client, method, path);
|
|
26
|
+
};
|
|
27
|
+
export const getPaymentMethods = (client) => {
|
|
28
|
+
const { method, path } = billingSettingsEndpoints.getPaymentMethods;
|
|
29
|
+
return request(client, method, path);
|
|
30
|
+
};
|
|
31
|
+
export const createSetupIntent = (client) => {
|
|
32
|
+
const { method, path } = billingSettingsEndpoints.createSetupIntent;
|
|
33
|
+
return request(client, method, path);
|
|
34
|
+
};
|
|
35
|
+
export const setDefaultPaymentMethod = (client, paymentMethodId) => {
|
|
36
|
+
const { method, path } = billingSettingsEndpoints.setDefaultPaymentMethod;
|
|
37
|
+
return request(client, method, interpolatePath(path, { paymentMethodId }));
|
|
38
|
+
};
|
|
39
|
+
export const removePaymentMethod = (client, paymentMethodId) => {
|
|
40
|
+
const { method, path } = billingSettingsEndpoints.removePaymentMethod;
|
|
41
|
+
return request(client, method, interpolatePath(path, { paymentMethodId }));
|
|
42
|
+
};
|
|
43
|
+
export const setSpendingCap = (client, body) => {
|
|
44
|
+
const { method, path } = billingSettingsEndpoints.setSpendingCap;
|
|
45
|
+
return request(client, method, path, { body });
|
|
46
|
+
};
|
|
47
|
+
export const enablePostpaid = (client) => {
|
|
48
|
+
const { method, path } = billingSettingsEndpoints.enablePostpaid;
|
|
49
|
+
return request(client, method, path);
|
|
50
|
+
};
|
|
51
|
+
export const enablePrepaid = (client, body) => {
|
|
52
|
+
const { method, path } = billingSettingsEndpoints.enablePrepaid;
|
|
53
|
+
return request(client, method, path, { body });
|
|
54
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Branch databases — per-preview-environment ephemeral database branches.
|
|
3
|
+
*
|
|
4
|
+
* GET /projects/:id/preview-envs/branch-dbs — list across envs
|
|
5
|
+
* POST /projects/:id/preview-envs/:envId/branch-db — create branch DB
|
|
6
|
+
* GET /projects/:id/preview-envs/:envId/branch-db — get branch DB
|
|
7
|
+
* DELETE /projects/:id/preview-envs/:envId/branch-db — drop branch DB
|
|
8
|
+
*
|
|
9
|
+
* Mirrors `apps/api/src/server/platform/routes/branch-databases.ts`.
|
|
10
|
+
* Route paths sourced from `@sylphx/contract` (ADR-084).
|
|
11
|
+
*/
|
|
12
|
+
import type { Client } from './client.js';
|
|
13
|
+
export interface BranchDatabase {
|
|
14
|
+
readonly id: string;
|
|
15
|
+
readonly projectId: string;
|
|
16
|
+
readonly envId: string;
|
|
17
|
+
readonly parentDatabaseId: string;
|
|
18
|
+
readonly branchName: string;
|
|
19
|
+
readonly connectionUrl: string | null;
|
|
20
|
+
readonly createdAt: string;
|
|
21
|
+
readonly status: 'ready' | 'provisioning' | 'failed' | 'deleting';
|
|
22
|
+
}
|
|
23
|
+
export interface CreateBranchDatabaseInput {
|
|
24
|
+
readonly parentDatabaseId?: string;
|
|
25
|
+
readonly branchName?: string;
|
|
26
|
+
}
|
|
27
|
+
export declare const list: (client: Client, projectId: string) => Promise<{
|
|
28
|
+
branches: readonly BranchDatabase[];
|
|
29
|
+
}>;
|
|
30
|
+
export declare const create: (client: Client, projectId: string, envId: string, body?: CreateBranchDatabaseInput) => Promise<{
|
|
31
|
+
branch: BranchDatabase;
|
|
32
|
+
}>;
|
|
33
|
+
export declare const get: (client: Client, projectId: string, envId: string) => Promise<{
|
|
34
|
+
branch: BranchDatabase;
|
|
35
|
+
}>;
|
|
36
|
+
declare const _delete: (client: Client, projectId: string, envId: string) => Promise<{
|
|
37
|
+
success: boolean;
|
|
38
|
+
}>;
|
|
39
|
+
export { _delete as delete };
|
|
40
|
+
/**
|
|
41
|
+
* Merge a branch database back into its parent. ADR-089 Phase 4b adds
|
|
42
|
+
* the Management SDK surface; the underlying platform endpoint is wired
|
|
43
|
+
* via the contract's `merge` key (Expand-and-contract safe: no-op if the
|
|
44
|
+
* server hasn't shipped the route yet — it returns 404 which ApiError
|
|
45
|
+
* propagates to the caller).
|
|
46
|
+
*/
|
|
47
|
+
export declare const merge: (client: Client, projectId: string, envId: string, body?: {
|
|
48
|
+
readonly strategy?: "fast-forward" | "squash" | "rebase";
|
|
49
|
+
}) => Promise<{
|
|
50
|
+
success: boolean;
|
|
51
|
+
mergedAt: string;
|
|
52
|
+
}>;
|
|
53
|
+
//# sourceMappingURL=branchDatabases.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"branchDatabases.d.ts","sourceRoot":"","sources":["../src/branchDatabases.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAGzC,MAAM,WAAW,cAAc;IAC9B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAA;IACjC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAA;IACrC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,MAAM,EAAE,OAAO,GAAG,cAAc,GAAG,QAAQ,GAAG,UAAU,CAAA;CACjE;AAED,MAAM,WAAW,yBAAyB;IACzC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAA;IAClC,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAC5B;AAED,eAAO,MAAM,IAAI,GAChB,QAAQ,MAAM,EACd,WAAW,MAAM,KACf,OAAO,CAAC;IAAE,QAAQ,EAAE,SAAS,cAAc,EAAE,CAAA;CAAE,CAGjD,CAAA;AAED,eAAO,MAAM,MAAM,GAClB,QAAQ,MAAM,EACd,WAAW,MAAM,EACjB,OAAO,MAAM,EACb,OAAM,yBAA8B,KAClC,OAAO,CAAC;IAAE,MAAM,EAAE,cAAc,CAAA;CAAE,CAGpC,CAAA;AAED,eAAO,MAAM,GAAG,GACf,QAAQ,MAAM,EACd,WAAW,MAAM,EACjB,OAAO,MAAM,KACX,OAAO,CAAC;IAAE,MAAM,EAAE,cAAc,CAAA;CAAE,CAGpC,CAAA;AAED,QAAA,MAAM,OAAO,GACZ,QAAQ,MAAM,EACd,WAAW,MAAM,EACjB,OAAO,MAAM,KACX,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,CAG9B,CAAA;AACD,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,CAAA;AAE5B;;;;;;GAMG;AACH,eAAO,MAAM,KAAK,GACjB,QAAQ,MAAM,EACd,WAAW,MAAM,EACjB,OAAO,MAAM,EACb,OAAM;IAAE,QAAQ,CAAC,QAAQ,CAAC,EAAE,cAAc,GAAG,QAAQ,GAAG,QAAQ,CAAA;CAAO,KACrE,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAM/C,CAAA"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Branch databases — per-preview-environment ephemeral database branches.
|
|
3
|
+
*
|
|
4
|
+
* GET /projects/:id/preview-envs/branch-dbs — list across envs
|
|
5
|
+
* POST /projects/:id/preview-envs/:envId/branch-db — create branch DB
|
|
6
|
+
* GET /projects/:id/preview-envs/:envId/branch-db — get branch DB
|
|
7
|
+
* DELETE /projects/:id/preview-envs/:envId/branch-db — drop branch DB
|
|
8
|
+
*
|
|
9
|
+
* Mirrors `apps/api/src/server/platform/routes/branch-databases.ts`.
|
|
10
|
+
* Route paths sourced from `@sylphx/contract` (ADR-084).
|
|
11
|
+
*/
|
|
12
|
+
import { branchDatabasesEndpoints } from '@sylphx/contract';
|
|
13
|
+
import { interpolatePath, request } from './http.js';
|
|
14
|
+
export const list = (client, projectId) => {
|
|
15
|
+
const { method, path } = branchDatabasesEndpoints.list;
|
|
16
|
+
return request(client, method, interpolatePath(path, { id: projectId }));
|
|
17
|
+
};
|
|
18
|
+
export const create = (client, projectId, envId, body = {}) => {
|
|
19
|
+
const { method, path } = branchDatabasesEndpoints.create;
|
|
20
|
+
return request(client, method, interpolatePath(path, { id: projectId, envId }), { body });
|
|
21
|
+
};
|
|
22
|
+
export const get = (client, projectId, envId) => {
|
|
23
|
+
const { method, path } = branchDatabasesEndpoints.get;
|
|
24
|
+
return request(client, method, interpolatePath(path, { id: projectId, envId }));
|
|
25
|
+
};
|
|
26
|
+
const _delete = (client, projectId, envId) => {
|
|
27
|
+
const { method, path } = branchDatabasesEndpoints.destroy;
|
|
28
|
+
return request(client, method, interpolatePath(path, { id: projectId, envId }));
|
|
29
|
+
};
|
|
30
|
+
export { _delete as delete };
|
|
31
|
+
/**
|
|
32
|
+
* Merge a branch database back into its parent. ADR-089 Phase 4b adds
|
|
33
|
+
* the Management SDK surface; the underlying platform endpoint is wired
|
|
34
|
+
* via the contract's `merge` key (Expand-and-contract safe: no-op if the
|
|
35
|
+
* server hasn't shipped the route yet — it returns 404 which ApiError
|
|
36
|
+
* propagates to the caller).
|
|
37
|
+
*/
|
|
38
|
+
export const merge = (client, projectId, envId, body = {}) => request(client, 'POST', `/projects/${encodeURIComponent(projectId)}/preview-envs/${encodeURIComponent(envId)}/branch-db/merge`, { body });
|
package/dist/certs.d.ts
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom TLS certificates — bring-your-own cert for apex or wildcard
|
|
3
|
+
* hostnames. Private keys never leave the server after upload; `verify`
|
|
4
|
+
* performs offline chain / expiry validation against the stored cert.
|
|
5
|
+
*
|
|
6
|
+
* GET /projects/:id/certs
|
|
7
|
+
* POST /projects/:id/certs
|
|
8
|
+
* DELETE /projects/:id/certs/:domain
|
|
9
|
+
* POST /projects/:id/certs/:domain/verify
|
|
10
|
+
*/
|
|
11
|
+
import type { Client } from './client.js';
|
|
12
|
+
export interface CustomCert {
|
|
13
|
+
readonly id: string;
|
|
14
|
+
readonly domain: string;
|
|
15
|
+
readonly issuer: string | null;
|
|
16
|
+
readonly expiresAt: string | null;
|
|
17
|
+
readonly status: string;
|
|
18
|
+
readonly projectId: string | null;
|
|
19
|
+
}
|
|
20
|
+
export declare const list: (client: Client, projectId: string) => Promise<{
|
|
21
|
+
certs: readonly CustomCert[];
|
|
22
|
+
}>;
|
|
23
|
+
export interface AddInput {
|
|
24
|
+
readonly domain: string;
|
|
25
|
+
readonly certPem: string;
|
|
26
|
+
readonly keyPem: string;
|
|
27
|
+
}
|
|
28
|
+
export declare const add: (client: Client, projectId: string, input: AddInput) => Promise<{
|
|
29
|
+
id: string;
|
|
30
|
+
}>;
|
|
31
|
+
declare const _remove: (client: Client, projectId: string, domain: string) => Promise<void>;
|
|
32
|
+
export { _remove as remove };
|
|
33
|
+
export interface VerifyResult {
|
|
34
|
+
readonly domain: string;
|
|
35
|
+
readonly matches: boolean;
|
|
36
|
+
readonly chainValid: boolean;
|
|
37
|
+
readonly notExpired: boolean;
|
|
38
|
+
readonly notes: readonly string[];
|
|
39
|
+
}
|
|
40
|
+
export declare const verify: (client: Client, projectId: string, domain: string) => Promise<VerifyResult>;
|
|
41
|
+
/**
|
|
42
|
+
* Auto-provision a cert for `domain` via ACME (Let's Encrypt).
|
|
43
|
+
* Platform performs HTTP-01 or DNS-01 challenge then installs the
|
|
44
|
+
* resulting cert. Phase 4b Matrix-2 gap closure.
|
|
45
|
+
*/
|
|
46
|
+
export declare const autoProvision: (client: Client, projectId: string, body: {
|
|
47
|
+
readonly domain: string;
|
|
48
|
+
readonly challenge?: "http-01" | "dns-01";
|
|
49
|
+
}) => Promise<{
|
|
50
|
+
jobId: string;
|
|
51
|
+
domain: string;
|
|
52
|
+
status: "pending" | "issued" | "failed";
|
|
53
|
+
}>;
|
|
54
|
+
/**
|
|
55
|
+
* Query auto-provision job status.
|
|
56
|
+
*/
|
|
57
|
+
export declare const getAutoProvisionStatus: (client: Client, projectId: string, jobId: string) => Promise<{
|
|
58
|
+
jobId: string;
|
|
59
|
+
domain: string;
|
|
60
|
+
status: "pending" | "issued" | "failed";
|
|
61
|
+
error?: string;
|
|
62
|
+
}>;
|
|
63
|
+
//# sourceMappingURL=certs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"certs.d.ts","sourceRoot":"","sources":["../src/certs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAGzC,MAAM,WAAW,UAAU;IAC1B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IAC9B,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACjC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;CACjC;AAED,eAAO,MAAM,IAAI,GAChB,QAAQ,MAAM,EACd,WAAW,MAAM,KACf,OAAO,CAAC;IAAE,KAAK,EAAE,SAAS,UAAU,EAAE,CAAA;CAAE,CACgC,CAAA;AAE3E,MAAM,WAAW,QAAQ;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CACvB;AAED,eAAO,MAAM,GAAG,GAAI,QAAQ,MAAM,EAAE,WAAW,MAAM,EAAE,OAAO,QAAQ,KAAG,OAAO,CAAC;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,CACF,CAAA;AAE7F,QAAA,MAAM,OAAO,GAAI,QAAQ,MAAM,EAAE,WAAW,MAAM,EAAE,QAAQ,MAAM,KAAG,OAAO,CAAC,IAAI,CAK/E,CAAA;AACF,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,CAAA;AAE5B,MAAM,WAAW,YAAY;IAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;IACzB,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAA;IAC5B,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAA;IAC5B,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAA;CACjC;AAED,eAAO,MAAM,MAAM,GAAI,QAAQ,MAAM,EAAE,WAAW,MAAM,EAAE,QAAQ,MAAM,KAAG,OAAO,CAAC,YAAY,CAK7F,CAAA;AAEF;;;;GAIG;AACH,eAAO,MAAM,aAAa,GACzB,QAAQ,MAAM,EACd,WAAW,MAAM,EACjB,MAAM;IAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAA;CAAE,KAC1E,OAAO,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,SAAS,GAAG,QAAQ,GAAG,QAAQ,CAAA;CAAE,CAGlF,CAAA;AAEH;;GAEG;AACH,eAAO,MAAM,sBAAsB,GAClC,QAAQ,MAAM,EACd,WAAW,MAAM,EACjB,OAAO,MAAM,KACX,OAAO,CAAC;IACV,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,SAAS,GAAG,QAAQ,GAAG,QAAQ,CAAA;IACvC,KAAK,CAAC,EAAE,MAAM,CAAA;CACd,CAKC,CAAA"}
|
package/dist/certs.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom TLS certificates — bring-your-own cert for apex or wildcard
|
|
3
|
+
* hostnames. Private keys never leave the server after upload; `verify`
|
|
4
|
+
* performs offline chain / expiry validation against the stored cert.
|
|
5
|
+
*
|
|
6
|
+
* GET /projects/:id/certs
|
|
7
|
+
* POST /projects/:id/certs
|
|
8
|
+
* DELETE /projects/:id/certs/:domain
|
|
9
|
+
* POST /projects/:id/certs/:domain/verify
|
|
10
|
+
*/
|
|
11
|
+
import { request } from './http.js';
|
|
12
|
+
export const list = (client, projectId) => request(client, 'GET', `/projects/${encodeURIComponent(projectId)}/certs`);
|
|
13
|
+
export const add = (client, projectId, input) => request(client, 'POST', `/projects/${encodeURIComponent(projectId)}/certs`, { body: input });
|
|
14
|
+
const _remove = (client, projectId, domain) => request(client, 'DELETE', `/projects/${encodeURIComponent(projectId)}/certs/${encodeURIComponent(domain)}`);
|
|
15
|
+
export { _remove as remove };
|
|
16
|
+
export const verify = (client, projectId, domain) => request(client, 'POST', `/projects/${encodeURIComponent(projectId)}/certs/${encodeURIComponent(domain)}/verify`);
|
|
17
|
+
/**
|
|
18
|
+
* Auto-provision a cert for `domain` via ACME (Let's Encrypt).
|
|
19
|
+
* Platform performs HTTP-01 or DNS-01 challenge then installs the
|
|
20
|
+
* resulting cert. Phase 4b Matrix-2 gap closure.
|
|
21
|
+
*/
|
|
22
|
+
export const autoProvision = (client, projectId, body) => request(client, 'POST', `/projects/${encodeURIComponent(projectId)}/certs/auto-provision`, {
|
|
23
|
+
body,
|
|
24
|
+
});
|
|
25
|
+
/**
|
|
26
|
+
* Query auto-provision job status.
|
|
27
|
+
*/
|
|
28
|
+
export const getAutoProvisionStatus = (client, projectId, jobId) => request(client, 'GET', `/projects/${encodeURIComponent(projectId)}/certs/auto-provision/${encodeURIComponent(jobId)}`);
|