@sylphx/management 0.2.2 → 0.3.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 +18 -4
- package/README.md +11 -9
- package/dist/adminBranchDatabases.d.ts +13 -0
- package/dist/adminBranchDatabases.d.ts.map +1 -0
- package/dist/adminBranchDatabases.js +17 -0
- package/dist/adminProjectCredentials.d.ts +6 -5
- package/dist/adminProjectCredentials.d.ts.map +1 -1
- package/dist/adminProjectCredentials.js +3 -2
- package/dist/billing.d.ts +10 -7
- package/dist/billing.d.ts.map +1 -1
- package/dist/billing.js +23 -7
- package/dist/databases.js +5 -5
- package/dist/deployments.d.ts +14 -7
- package/dist/deployments.d.ts.map +1 -1
- package/dist/deployments.js +43 -8
- package/dist/domains.d.ts +11 -8
- package/dist/domains.d.ts.map +1 -1
- package/dist/domains.js +17 -9
- package/dist/envVars.d.ts +7 -4
- package/dist/envVars.d.ts.map +1 -1
- package/dist/envVars.js +11 -5
- package/dist/environments.d.ts +10 -7
- package/dist/environments.d.ts.map +1 -1
- package/dist/environments.js +22 -11
- package/dist/http.d.ts +5 -0
- package/dist/http.d.ts.map +1 -1
- package/dist/http.js +12 -2
- package/dist/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/logs.d.ts +9 -1
- package/dist/logs.d.ts.map +1 -1
- package/dist/logs.js +13 -0
- package/dist/principal.d.ts +11 -0
- package/dist/principal.d.ts.map +1 -0
- package/dist/principal.js +13 -0
- package/dist/projects.d.ts +4 -1
- package/dist/projects.d.ts.map +1 -1
- package/dist/projects.js +7 -2
- package/dist/remoteConfig.d.ts +7 -4
- package/dist/remoteConfig.d.ts.map +1 -1
- package/dist/remoteConfig.js +17 -13
- package/dist/resourceBindings.d.ts +3 -3
- package/dist/resourceBindings.d.ts.map +1 -1
- package/dist/resourceBindings.js +10 -4
- package/dist/resources.d.ts +3 -3
- package/dist/resources.d.ts.map +1 -1
- package/dist/sandboxes.d.ts +5 -2
- package/dist/sandboxes.d.ts.map +1 -1
- package/dist/sandboxes.js +9 -3
- package/dist/services.d.ts +19 -5
- package/dist/services.d.ts.map +1 -1
- package/dist/services.js +15 -8
- package/dist/tasks.d.ts +8 -5
- package/dist/tasks.d.ts.map +1 -1
- package/dist/tasks.js +15 -12
- package/dist/types.d.ts +20 -44
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +2 -3
- package/package.json +6 -6
- package/dist/edgeDeployments.d.ts +0 -43
- package/dist/edgeDeployments.d.ts.map +0 -1
- package/dist/edgeDeployments.js +0 -32
- package/dist/functions.d.ts +0 -39
- package/dist/functions.d.ts.map +0 -1
- package/dist/functions.js +0 -40
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @sylphx/management
|
|
2
2
|
|
|
3
|
+
## 0.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#531](https://github.com/SylphxAI/platform/pull/531) [`2ff1de4`](https://github.com/SylphxAI/platform/commit/2ff1de40fd1e2a785a7daa764ddad4a56d7b48c8) Thanks [@shtse8](https://github.com/shtse8)! - Restore dogfooded deployment operations by allowing `sylphx deploy`, `sylphx status`, `sylphx logs`, `sylphx tail`, `sylphx open`, `sylphx env`, `sylphx config`, `sylphx secrets`, `sylphx storage`, `sylphx volumes`, `sylphx resources`, `sylphx domains`, `sylphx tasks`, `sylphx sandbox`, `sylphx plan`, `sylphx run-cmd`, `sylphx promote`, `sylphx releases`, `sylphx bisect`, and `sylphx rollback` to target explicit projects from unlinked directories, carrying org scoping through Management SDK calls and SSE log streams, and exposing scoped project/log/environment/service helpers in the Management SDK.
|
|
8
|
+
|
|
9
|
+
Prune scaffold-only surfaces from the published CLI/Management SDK surface (`restart`, task `run`, direct `scale`, `functions`, `edge`, `regions`, and the no-op `deploy --region` flag) until their Management API or infra paths are real.
|
|
10
|
+
|
|
11
|
+
## 0.2.3
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies [[`ba02c04`](https://github.com/SylphxAI/platform/commit/ba02c0412712dc8a5f19d17c16707eb5ae11ec47)]:
|
|
16
|
+
- @sylphx/contract@0.4.0
|
|
17
|
+
|
|
3
18
|
## 0.2.2
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
@@ -26,7 +41,7 @@ Management SDK now covers every public `apps/api/src/server/platform/routes/`
|
|
|
26
41
|
namespace (35/35 non-excluded, 6 internal-only exclusions with written
|
|
27
42
|
rationale).
|
|
28
43
|
|
|
29
|
-
### New namespaces (
|
|
44
|
+
### New namespaces (13)
|
|
30
45
|
|
|
31
46
|
- `admin` — operator org / user / credit / audit administration
|
|
32
47
|
- `auth` (alias of `authSettings`) — OAuth providers + project auth policy + stats
|
|
@@ -34,7 +49,6 @@ rationale).
|
|
|
34
49
|
- `billingSettings` — business info, spending caps, invoice prefs
|
|
35
50
|
- `branchDatabases` — per-branch Neon/CNPG database bindings (ADR-070)
|
|
36
51
|
- `ciSettings` — org + repo CI configuration (runners, secrets, policy)
|
|
37
|
-
- `edgeDeployments` — Vercel-edge / Workers-style function releases
|
|
38
52
|
- `github` — GitHub App installation + repo discovery
|
|
39
53
|
- `kv` — KV admin (operator dashboard; distinct from BaaS `kv` in `@sylphx/sdk`)
|
|
40
54
|
- `management` — self-hosted runtime database backups / PITR restore (ADR-070)
|
|
@@ -69,9 +83,9 @@ rationale).
|
|
|
69
83
|
### Changes
|
|
70
84
|
|
|
71
85
|
- **Beta API surface.** Per [ADR-077](https://github.com/SylphxAI/platform/blob/main/docs/adr/ADR-077-trio-completeness.md), the Promise-based pure-functional interface is the target public contract. No classes, no `this`, no hidden state — `createClient` returns a frozen value, and every capability is a free function that takes `client` as its first argument. Shape is NOT yet frozen; still iterating in 0.x.
|
|
72
|
-
- **
|
|
86
|
+
- **Capability namespaces** (in-flight; count may change before stable) covering the Management plane: `projects`, `deployments`, `environments`, `envVars`, `domains`, `databases`, `services`, `volumes`, `storage`, `secrets`, `tasks`, `resourceBindings`, `organizations`, `users`, `sandboxes`, `logs`, `email` (admin), `notifications` (admin/inbox), `monitoring`, `analytics`, `flags`, `experiments`, `remoteConfig`, `ai`, `webhooks`, `runners`, `backups`, `billing`, `certs`, `consent`, `engagement`, `newsletter`, `oidc`, `privacy`, `realtime`, `referrals`, `saml`, `search`, `serviceTokens`, `sessionReplay`. Function lifecycle is withheld until the Management API owns `/projects/:projectId/functions/*`.
|
|
73
87
|
- **Contract-first types** ([ADR-084](https://github.com/SylphxAI/platform/blob/main/docs/adr/ADR-084-effect-schema-contract.md)). Wire types and endpoint metadata (method + path) are imported from [`@sylphx/contract`](https://www.npmjs.com/package/@sylphx/contract) — the Effect Schema SSOT. Hand-written type shims were removed; the contract package is the only place wire shape is defined.
|
|
74
|
-
- **Bearer-token auth.** `createClient({ token })` accepts
|
|
88
|
+
- **Bearer-token auth.** `createClient({ token })` accepts service tokens (`svc_...`) and OAuth access JWTs. The same SDK works for CLI / CI / backend integrations on the Management plane (`api.sylphx.com/v1`).
|
|
75
89
|
- **Tree-shakable subpath exports.** Every namespace is also reachable as `@sylphx/management/projects`, `@sylphx/management/deployments`, etc. `sideEffects: false` for bundler-friendly dead-code elimination.
|
|
76
90
|
- **ESM-only.** `"type": "module"`, Node ≥ 20, uses the built-in `fetch`. No classes, no polyfills, no peer framework required.
|
|
77
91
|
|
package/README.md
CHANGED
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
[](./LICENSE)
|
|
5
5
|
|
|
6
6
|
Pure-FP Promise client for the [Sylphx Platform](https://sylphx.com)
|
|
7
|
-
Management API — **
|
|
8
|
-
classes**.
|
|
7
|
+
Management API — **contract-first capability namespaces, zero classes**.
|
|
9
8
|
|
|
10
9
|
The SDK is a thin, stateless transport over `api.sylphx.com/v1`. No classes,
|
|
11
10
|
no mutable state, no business logic — consumers create an immutable `Client`
|
|
@@ -17,8 +16,8 @@ Effect Schema single source of truth (ADR-084).
|
|
|
17
16
|
> **Scope: Management plane only** (ADR-083). This SDK covers platform-owner
|
|
18
17
|
> operations (project / deployment / environment / secret / domain / audit
|
|
19
18
|
> / billing / SAML / OIDC / webhooks / privacy / analytics admin, …) on
|
|
20
|
-
> `api.sylphx.com/v1` with Bearer tokens (`
|
|
21
|
-
>
|
|
19
|
+
> `api.sylphx.com/v1` with Bearer tokens (`svc_...` service tokens or
|
|
20
|
+
> OAuth access JWTs). For app-runtime data-plane operations (auth, KV, transactional
|
|
22
21
|
> email, push, realtime, `flags.evaluate`, search, analytics.track, AI,
|
|
23
22
|
> storage uploads, end-user session replay) use
|
|
24
23
|
> [`@sylphx/sdk`](https://www.npmjs.com/package/@sylphx/sdk) — one package,
|
|
@@ -30,8 +29,8 @@ Effect Schema single source of truth (ADR-084).
|
|
|
30
29
|
|
|
31
30
|
- Node.js `>= 20` (uses built-in `fetch`) — or Bun `>= 1.3`
|
|
32
31
|
- A Sylphx API token:
|
|
33
|
-
- **
|
|
34
|
-
- **Service token** (`
|
|
32
|
+
- **OAuth access token** (`eyJ...`) — minted by the OAuth/device flow and suitable for user-scoped automation
|
|
33
|
+
- **Service token** (`svc_...`) — for CI / server-side automation, created through the Management API / CLI token flow
|
|
35
34
|
|
|
36
35
|
## Installation
|
|
37
36
|
|
|
@@ -78,8 +77,8 @@ await projects.list(client)
|
|
|
78
77
|
|
|
79
78
|
## Capabilities
|
|
80
79
|
|
|
81
|
-
|
|
82
|
-
|
|
80
|
+
Every module exports free functions that take `client` as the first
|
|
81
|
+
argument. Key namespaces:
|
|
83
82
|
|
|
84
83
|
| Namespace | Representative functions |
|
|
85
84
|
| -------------------- | ------------------------------------------------------------------------------------------ |
|
|
@@ -99,7 +98,6 @@ the first argument. Key namespaces:
|
|
|
99
98
|
| `resourceBindings` | `list`, `create`, `delete` |
|
|
100
99
|
| `organizations` | `current`, `listMembers`, `inviteMember`, `removeMember` |
|
|
101
100
|
| `sandboxes` | `create`, `list`, `get`, `terminate` |
|
|
102
|
-
| `functions` | `list`, `get`, `deploy`, `delete`, `invoke`, `logs` |
|
|
103
101
|
| `logs` | `stream` (returns `{ url, token }` for SSE) |
|
|
104
102
|
| `email` | `listLogs`, `getSettings`, `updateSettings` (admin only — `send` lives in `@sylphx/sdk`) |
|
|
105
103
|
| `notifications` | `listInbox` (admin only — `send` lives in `@sylphx/sdk`) |
|
|
@@ -124,6 +122,10 @@ the first argument. Key namespaces:
|
|
|
124
122
|
Full, IDE-autocompleted surface is available on the re-exported
|
|
125
123
|
namespaces from the root `@sylphx/management` entry point.
|
|
126
124
|
|
|
125
|
+
Serverless function lifecycle is intentionally absent from the Management SDK
|
|
126
|
+
until the Management API owns `/projects/:projectId/functions/*`. Runtime
|
|
127
|
+
function execution remains on `@sylphx/sdk`.
|
|
128
|
+
|
|
127
129
|
> **Plane discipline (ADR-083).** Runtime BaaS verbs — `kv.*`, `email.send`,
|
|
128
130
|
> `notifications.send`, MFA `challenge.*`, `flags.evaluate`,
|
|
129
131
|
> `analytics.track` — are **not** part of `@sylphx/management`. Deployed
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@sylphx/management/adminBranchDatabases` — operator branch DB recovery.
|
|
3
|
+
*
|
|
4
|
+
* Mirrors `/operator/branch-databases/*`. These functions are for scoped
|
|
5
|
+
* service tokens and incident automation; customer/user branch DB CRUD remains
|
|
6
|
+
* in `branchDatabases.ts`.
|
|
7
|
+
*/
|
|
8
|
+
import type { AdminBranchDatabaseCreateInput, AdminBranchDatabaseDestroyInput, AdminBranchDatabaseMutationResult } from '@sylphx/contract';
|
|
9
|
+
import type { Client } from './client.js';
|
|
10
|
+
export type { AdminBranchDatabaseCreateInput, AdminBranchDatabaseDestroyInput, AdminBranchDatabaseMutationResult, };
|
|
11
|
+
export declare const create: (client: Client, input: AdminBranchDatabaseCreateInput) => Promise<AdminBranchDatabaseMutationResult>;
|
|
12
|
+
export declare const destroy: (client: Client, input: AdminBranchDatabaseDestroyInput) => Promise<AdminBranchDatabaseMutationResult>;
|
|
13
|
+
//# sourceMappingURL=adminBranchDatabases.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adminBranchDatabases.d.ts","sourceRoot":"","sources":["../src/adminBranchDatabases.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EACX,8BAA8B,EAC9B,+BAA+B,EAC/B,iCAAiC,EACjC,MAAM,kBAAkB,CAAA;AAEzB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAGzC,YAAY,EACX,8BAA8B,EAC9B,+BAA+B,EAC/B,iCAAiC,GACjC,CAAA;AAED,eAAO,MAAM,MAAM,GAClB,QAAQ,MAAM,EACd,OAAO,8BAA8B,KACnC,OAAO,CAAC,iCAAiC,CAG3C,CAAA;AAED,eAAO,MAAM,OAAO,GACnB,QAAQ,MAAM,EACd,OAAO,+BAA+B,KACpC,OAAO,CAAC,iCAAiC,CAG3C,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@sylphx/management/adminBranchDatabases` — operator branch DB recovery.
|
|
3
|
+
*
|
|
4
|
+
* Mirrors `/operator/branch-databases/*`. These functions are for scoped
|
|
5
|
+
* service tokens and incident automation; customer/user branch DB CRUD remains
|
|
6
|
+
* in `branchDatabases.ts`.
|
|
7
|
+
*/
|
|
8
|
+
import { adminBranchDatabasesEndpoints } from '@sylphx/contract';
|
|
9
|
+
import { request } from './http.js';
|
|
10
|
+
export const create = (client, input) => {
|
|
11
|
+
const { method, path } = adminBranchDatabasesEndpoints.create;
|
|
12
|
+
return request(client, method, path, { body: input });
|
|
13
|
+
};
|
|
14
|
+
export const destroy = (client, input) => {
|
|
15
|
+
const { method, path } = adminBranchDatabasesEndpoints.destroy;
|
|
16
|
+
return request(client, method, path, { body: input });
|
|
17
|
+
};
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
* `@sylphx/management/adminProjectCredentials` — operator BaaS credential rotation.
|
|
3
3
|
*
|
|
4
4
|
* Rotates an environment's `sk_*` / `pk_*` pair and optionally syncs the new
|
|
5
|
-
*
|
|
6
|
-
* reconciler updates deployed workloads through the normal
|
|
5
|
+
* server connection URL into the environment-level `SYLPHX_SECRET_URL` app
|
|
6
|
+
* secret so the reconciler updates deployed workloads through the normal
|
|
7
|
+
* desired-state path.
|
|
7
8
|
*/
|
|
8
9
|
import type { Client } from './client.js';
|
|
9
10
|
export interface RotateEnvironmentCredentialsInput {
|
|
@@ -11,7 +12,7 @@ export interface RotateEnvironmentCredentialsInput {
|
|
|
11
12
|
readonly environmentId: string;
|
|
12
13
|
/** Audit narrative. Min 3 chars. */
|
|
13
14
|
readonly reason: string;
|
|
14
|
-
/** When true, upsert shared env var `
|
|
15
|
+
/** When true, upsert shared env var `SYLPHX_SECRET_URL` and queue reconciliation. */
|
|
15
16
|
readonly syncDeploymentSecret?: boolean;
|
|
16
17
|
}
|
|
17
18
|
export interface RotateEnvironmentCredentialsBySlugInput {
|
|
@@ -21,12 +22,12 @@ export interface RotateEnvironmentCredentialsBySlugInput {
|
|
|
21
22
|
readonly environmentName: string;
|
|
22
23
|
/** Audit narrative. Min 3 chars. */
|
|
23
24
|
readonly reason: string;
|
|
24
|
-
/** When true, upsert shared env var `
|
|
25
|
+
/** When true, upsert shared env var `SYLPHX_SECRET_URL` and queue reconciliation. */
|
|
25
26
|
readonly syncDeploymentSecret?: boolean;
|
|
26
27
|
}
|
|
27
28
|
export interface RotateEnvironmentCredentialsResult {
|
|
28
29
|
readonly environmentId: string;
|
|
29
|
-
readonly envType: 'development' | 'staging' | 'production';
|
|
30
|
+
readonly envType: 'development' | 'staging' | 'production' | 'preview';
|
|
30
31
|
/** Raw secret key, returned once. Do not log. */
|
|
31
32
|
readonly secretKey: string;
|
|
32
33
|
readonly publicKey: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adminProjectCredentials.d.ts","sourceRoot":"","sources":["../src/adminProjectCredentials.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"adminProjectCredentials.d.ts","sourceRoot":"","sources":["../src/adminProjectCredentials.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAGzC,MAAM,WAAW,iCAAiC;IACjD,kDAAkD;IAClD,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;IAC9B,oCAAoC;IACpC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,qFAAqF;IACrF,QAAQ,CAAC,oBAAoB,CAAC,EAAE,OAAO,CAAA;CACvC;AAED,MAAM,WAAW,uCAAuC;IACvD,6CAA6C;IAC7C,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,mDAAmD;IACnD,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAA;IAChC,oCAAoC;IACpC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,qFAAqF;IACrF,QAAQ,CAAC,oBAAoB,CAAC,EAAE,OAAO,CAAA;CACvC;AAED,MAAM,WAAW,kCAAkC;IAClD,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;IAC9B,QAAQ,CAAC,OAAO,EAAE,aAAa,GAAG,SAAS,GAAG,YAAY,GAAG,SAAS,CAAA;IACtE,iDAAiD;IACjD,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,sBAAsB,EAAE,OAAO,CAAA;IACxC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAA;IACxB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;CAC3B;AAED,eAAO,MAAM,4BAA4B,GACxC,QAAQ,MAAM,EACd,OAAO,iCAAiC,KACtC,OAAO,CAAC,kCAAkC,CAa5C,CAAA;AAED,eAAO,MAAM,kCAAkC,GAC9C,QAAQ,MAAM,EACd,OAAO,uCAAuC,KAC5C,OAAO,CAAC,kCAAkC,CAe5C,CAAA"}
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
* `@sylphx/management/adminProjectCredentials` — operator BaaS credential rotation.
|
|
3
3
|
*
|
|
4
4
|
* Rotates an environment's `sk_*` / `pk_*` pair and optionally syncs the new
|
|
5
|
-
*
|
|
6
|
-
* reconciler updates deployed workloads through the normal
|
|
5
|
+
* server connection URL into the environment-level `SYLPHX_SECRET_URL` app
|
|
6
|
+
* secret so the reconciler updates deployed workloads through the normal
|
|
7
|
+
* desired-state path.
|
|
7
8
|
*/
|
|
8
9
|
import { adminProjectsEndpoints } from '@sylphx/contract';
|
|
9
10
|
import { request } from './http.js';
|
package/dist/billing.d.ts
CHANGED
|
@@ -9,6 +9,9 @@
|
|
|
9
9
|
* Stripe has accepted the update, so callers see the new tier immediately.
|
|
10
10
|
*/
|
|
11
11
|
import type { Client } from './client.js';
|
|
12
|
+
export interface OrgScopedRequestOptions {
|
|
13
|
+
readonly orgId?: string;
|
|
14
|
+
}
|
|
12
15
|
export interface CurrentPlan {
|
|
13
16
|
readonly id: string;
|
|
14
17
|
readonly planSlug: string;
|
|
@@ -18,7 +21,7 @@ export interface CurrentPlan {
|
|
|
18
21
|
readonly currentPeriodEnd: string | null;
|
|
19
22
|
readonly cancelAtPeriodEnd?: boolean;
|
|
20
23
|
}
|
|
21
|
-
export declare const getCurrentPlan: (client: Client, projectId: string) => Promise<CurrentPlan | null>;
|
|
24
|
+
export declare const getCurrentPlan: (client: Client, projectId: string, options?: OrgScopedRequestOptions) => Promise<CurrentPlan | null>;
|
|
22
25
|
export interface PlanListing {
|
|
23
26
|
readonly id: string;
|
|
24
27
|
readonly slug: string;
|
|
@@ -29,7 +32,7 @@ export interface PlanListing {
|
|
|
29
32
|
readonly priceAnnual: number | null;
|
|
30
33
|
readonly priceLifetime: number | null;
|
|
31
34
|
}
|
|
32
|
-
export declare const listPlans: (client: Client, projectId: string) => Promise<{
|
|
35
|
+
export declare const listPlans: (client: Client, projectId: string, options?: OrgScopedRequestOptions) => Promise<{
|
|
33
36
|
plans: readonly PlanListing[];
|
|
34
37
|
}>;
|
|
35
38
|
export type PlanInterval = 'monthly' | 'annual' | 'lifetime';
|
|
@@ -42,7 +45,7 @@ export interface UpgradeResult {
|
|
|
42
45
|
readonly currentPeriodEnd: string;
|
|
43
46
|
};
|
|
44
47
|
}
|
|
45
|
-
export declare const upgrade: (client: Client, projectId: string, userId: string, newPlanSlug: string, newInterval?: PlanInterval) => Promise<UpgradeResult>;
|
|
48
|
+
export declare const upgrade: (client: Client, projectId: string, userId: string, newPlanSlug: string, newInterval?: PlanInterval, options?: OrgScopedRequestOptions) => Promise<UpgradeResult>;
|
|
46
49
|
export interface UsageMetric {
|
|
47
50
|
readonly used: number;
|
|
48
51
|
readonly unit: string;
|
|
@@ -60,7 +63,7 @@ export interface UsageSummary {
|
|
|
60
63
|
}
|
|
61
64
|
export declare const usageSummary: (client: Client, projectId: string, options?: {
|
|
62
65
|
month?: string;
|
|
63
|
-
}) => Promise<UsageSummary>;
|
|
66
|
+
}, requestOptions?: OrgScopedRequestOptions) => Promise<UsageSummary>;
|
|
64
67
|
export interface Balance {
|
|
65
68
|
readonly balanceFormatted?: string;
|
|
66
69
|
readonly balanceMicrodollars?: number;
|
|
@@ -70,7 +73,7 @@ export interface Balance {
|
|
|
70
73
|
readonly totalFormatted?: string;
|
|
71
74
|
} | null;
|
|
72
75
|
}
|
|
73
|
-
export declare const balance: (client: Client, projectId: string) => Promise<Balance>;
|
|
76
|
+
export declare const balance: (client: Client, projectId: string, options?: OrgScopedRequestOptions) => Promise<Balance>;
|
|
74
77
|
export interface CreditPackage {
|
|
75
78
|
readonly id: string;
|
|
76
79
|
readonly label: string;
|
|
@@ -92,7 +95,7 @@ export interface Invoice {
|
|
|
92
95
|
}
|
|
93
96
|
export declare const listInvoices: (client: Client, projectId: string, options?: {
|
|
94
97
|
limit?: number;
|
|
95
|
-
}) => Promise<{
|
|
98
|
+
}, requestOptions?: OrgScopedRequestOptions) => Promise<{
|
|
96
99
|
invoices: readonly Invoice[];
|
|
97
100
|
}>;
|
|
98
101
|
/**
|
|
@@ -101,5 +104,5 @@ export declare const listInvoices: (client: Client, projectId: string, options?:
|
|
|
101
104
|
* pipeline lands. Callers that persist this to disk should remain
|
|
102
105
|
* type-agnostic (`unknown`) rather than latching onto the current shape.
|
|
103
106
|
*/
|
|
104
|
-
export declare const invoiceDetail: (client: Client, projectId: string, invoiceId: string) => Promise<unknown>;
|
|
107
|
+
export declare const invoiceDetail: (client: Client, projectId: string, invoiceId: string, options?: OrgScopedRequestOptions) => Promise<unknown>;
|
|
105
108
|
//# sourceMappingURL=billing.d.ts.map
|
package/dist/billing.d.ts.map
CHANGED
|
@@ -1 +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,CAAA;IACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IAChC,QAAQ,CAAC,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1C,QAAQ,CAAC,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAA;IACxC,QAAQ,CAAC,iBAAiB,CAAC,EAAE,OAAO,CAAA;CACpC;AAED,eAAO,MAAM,cAAc,
|
|
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,W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AS,EAAE,MAAM,CAAA;CAC1B;AAED,eAAO,MAAM,YAAY,GACxB,QAAQ,MAAM,EACd,WAAW,MAAM,EACjB,UAAU;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,EAC5B,iBAAgB,uBAA4B,KAC1C,OAAO,CAAC;IAAE,QAAQ,EAAE,SAAS,OAAO,EAAE,CAAA;CAAE,CAOxC,CAAA;AAEH;;;;;GAKG;AACH,eAAO,MAAM,aAAa,GACzB,QAAQ,MAAM,EACd,WAAW,MAAM,EACjB,WAAW,MAAM,EACjB,UAAS,uBAA4B,KACnC,OAAO,CAAC,OAAO,CAIf,CAAA"}
|
package/dist/billing.js
CHANGED
|
@@ -9,9 +9,18 @@
|
|
|
9
9
|
* Stripe has accepted the update, so callers see the new tier immediately.
|
|
10
10
|
*/
|
|
11
11
|
import { request } from './http.js';
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
const orgHeaders = (options = {}) => ({
|
|
13
|
+
...(options.orgId ? { 'x-preferred-org-id': options.orgId } : {}),
|
|
14
|
+
});
|
|
15
|
+
export const getCurrentPlan = (client, projectId, options = {}) => request(client, 'GET', '/billing/subscription/me', {
|
|
16
|
+
query: { projectId },
|
|
17
|
+
headers: orgHeaders(options),
|
|
18
|
+
});
|
|
19
|
+
export const listPlans = (client, projectId, options = {}) => request(client, 'GET', '/billing/plans', {
|
|
20
|
+
query: { projectId },
|
|
21
|
+
headers: orgHeaders(options),
|
|
22
|
+
});
|
|
23
|
+
export const upgrade = (client, projectId, userId, newPlanSlug, newInterval, options = {}) => request(client, 'POST', '/billing/subscription/update', {
|
|
15
24
|
body: {
|
|
16
25
|
projectId,
|
|
17
26
|
userId,
|
|
@@ -19,17 +28,23 @@ export const upgrade = (client, projectId, userId, newPlanSlug, newInterval) =>
|
|
|
19
28
|
...(newInterval ? { newInterval } : {}),
|
|
20
29
|
prorationBehavior: 'create_prorations',
|
|
21
30
|
},
|
|
31
|
+
headers: orgHeaders(options),
|
|
22
32
|
});
|
|
23
|
-
export const usageSummary = (client, projectId, options) => request(client, 'GET', '/billing/usage/summary', {
|
|
33
|
+
export const usageSummary = (client, projectId, options, requestOptions = {}) => request(client, 'GET', '/billing/usage/summary', {
|
|
24
34
|
query: { projectId, month: options?.month },
|
|
35
|
+
headers: orgHeaders(requestOptions),
|
|
36
|
+
});
|
|
37
|
+
export const balance = (client, projectId, options = {}) => request(client, 'GET', '/billing/balance', {
|
|
38
|
+
query: { projectId },
|
|
39
|
+
headers: orgHeaders(options),
|
|
25
40
|
});
|
|
26
|
-
export const balance = (client, projectId) => request(client, 'GET', '/billing/balance', { query: { projectId } });
|
|
27
41
|
export const creditPackages = (client) => request(client, 'GET', '/billing/credits/packages');
|
|
28
|
-
export const listInvoices = (client, projectId, options) => request(client, 'GET', '/billing/invoices', {
|
|
42
|
+
export const listInvoices = (client, projectId, options, requestOptions = {}) => request(client, 'GET', '/billing/invoices', {
|
|
29
43
|
query: {
|
|
30
44
|
projectId,
|
|
31
45
|
limit: options?.limit !== undefined ? String(options.limit) : undefined,
|
|
32
46
|
},
|
|
47
|
+
headers: orgHeaders(requestOptions),
|
|
33
48
|
});
|
|
34
49
|
/**
|
|
35
50
|
* Fetch structured invoice detail. Returns the raw server document —
|
|
@@ -37,6 +52,7 @@ export const listInvoices = (client, projectId, options) => request(client, 'GET
|
|
|
37
52
|
* pipeline lands. Callers that persist this to disk should remain
|
|
38
53
|
* type-agnostic (`unknown`) rather than latching onto the current shape.
|
|
39
54
|
*/
|
|
40
|
-
export const invoiceDetail = (client, projectId, invoiceId) => request(client, 'GET', '/billing/invoices/detail', {
|
|
55
|
+
export const invoiceDetail = (client, projectId, invoiceId, options = {}) => request(client, 'GET', '/billing/invoices/detail', {
|
|
41
56
|
query: { projectId, invoiceId },
|
|
57
|
+
headers: orgHeaders(options),
|
|
42
58
|
});
|
package/dist/databases.js
CHANGED
|
@@ -4,25 +4,25 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Wire shape sourced from `@sylphx/contract` (ADR-084).
|
|
6
6
|
*/
|
|
7
|
-
import { databasesEndpoints } from '@sylphx/contract';
|
|
7
|
+
import { databasesEndpoints, resourcesEndpoints } from '@sylphx/contract';
|
|
8
8
|
import { interpolatePath, request } from './http.js';
|
|
9
9
|
export const list = async (client) => {
|
|
10
|
-
const { method, path } =
|
|
10
|
+
const { method, path } = resourcesEndpoints.list;
|
|
11
11
|
const res = await request(client, method, path, {
|
|
12
12
|
query: { kind: 'database' },
|
|
13
13
|
});
|
|
14
14
|
return Array.isArray(res) ? res : (res.data ?? []);
|
|
15
15
|
};
|
|
16
16
|
export const create = (client, input) => {
|
|
17
|
-
const { method, path } =
|
|
17
|
+
const { method, path } = resourcesEndpoints.create;
|
|
18
18
|
return request(client, method, path, { body: { ...input, kind: 'database' } });
|
|
19
19
|
};
|
|
20
20
|
export const get = (client, id) => {
|
|
21
|
-
const { method, path } =
|
|
21
|
+
const { method, path } = resourcesEndpoints.get;
|
|
22
22
|
return request(client, method, interpolatePath(path, { id }));
|
|
23
23
|
};
|
|
24
24
|
const _delete = (client, id) => {
|
|
25
|
-
const { method, path } =
|
|
25
|
+
const { method, path } = resourcesEndpoints.delete;
|
|
26
26
|
return request(client, method, interpolatePath(path, { id }));
|
|
27
27
|
};
|
|
28
28
|
export { _delete as delete };
|
package/dist/deployments.d.ts
CHANGED
|
@@ -3,14 +3,21 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Wire shape sourced from `@sylphx/contract` (ADR-084).
|
|
5
5
|
*/
|
|
6
|
-
import type { DeploymentDetail, DeploymentStatus, DeployResult, RollbackDeploymentInput } from '@sylphx/contract';
|
|
6
|
+
import type { DeploymentDetail, DeploymentHistoryItem, DeploymentStatus, DeployResult, RollbackDeploymentInput, RollbackResult } from '@sylphx/contract';
|
|
7
7
|
import type { Client } from './client.js';
|
|
8
|
-
export
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
export type DeploymentHistoryRow = DeploymentHistoryItem & {
|
|
9
|
+
readonly deploymentId: DeploymentHistoryItem['id'];
|
|
10
|
+
readonly environment?: string;
|
|
11
|
+
};
|
|
12
|
+
export interface OrgScopedRequestOptions {
|
|
13
|
+
readonly orgId?: string;
|
|
14
|
+
}
|
|
15
|
+
export declare const status: (client: Client, projectId: string, options?: OrgScopedRequestOptions) => Promise<DeploymentStatus>;
|
|
16
|
+
export declare const get: (client: Client, deploymentId: string, options?: OrgScopedRequestOptions) => Promise<DeploymentDetail>;
|
|
17
|
+
export declare const trigger: (client: Client, projectId: string, envType: string, options?: OrgScopedRequestOptions) => Promise<DeployResult>;
|
|
18
|
+
export declare const history: (client: Client, projectId: string, envType: string, options?: OrgScopedRequestOptions) => Promise<DeploymentHistoryRow[]>;
|
|
12
19
|
export type RollbackBody = RollbackDeploymentInput;
|
|
13
|
-
export declare const rollback: (client: Client, projectId: string, body: RollbackBody) => Promise<
|
|
20
|
+
export declare const rollback: (client: Client, projectId: string, body: RollbackBody, options?: OrgScopedRequestOptions) => Promise<RollbackResult>;
|
|
14
21
|
/**
|
|
15
22
|
* Cancel an in-flight build. Terminal builds (`ready` / `error` /
|
|
16
23
|
* `cancelled`) return 409. Phase 4b closure for ADR-089 Matrix 2.
|
|
@@ -18,5 +25,5 @@ export declare const rollback: (client: Client, projectId: string, body: Rollbac
|
|
|
18
25
|
export declare const cancel: (client: Client, buildId: string) => Promise<{
|
|
19
26
|
success: boolean;
|
|
20
27
|
}>;
|
|
21
|
-
export type { DeploymentDetail } from '@sylphx/contract';
|
|
28
|
+
export type { DeploymentDetail, DeploymentHistoryItem, DeploymentHistoryResult, RollbackResult, } from '@sylphx/contract';
|
|
22
29
|
//# sourceMappingURL=deployments.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deployments.d.ts","sourceRoot":"","sources":["../src/deployments.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EACX,gBAAgB,EAChB,gBAAgB,EAChB,YAAY,EACZ,u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AAQ,MAAM,EACd,WAAW,MAAM,EACjB,MAAM,YAAY,EAClB,UAAS,uBAA4B,KACnC,OAAO,CAAC,cAAc,CAMxB,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,MAAM,GAAI,QAAQ,MAAM,EAAE,SAAS,MAAM,KAAG,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,CAGpF,CAAA;AAID,YAAY,EACX,gBAAgB,EAChB,qBAAqB,EACrB,uBAAuB,EACvB,cAAc,GACd,MAAM,kBAAkB,CAAA"}
|
package/dist/deployments.js
CHANGED
|
@@ -5,29 +5,41 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { deploymentsEndpoints } from '@sylphx/contract';
|
|
7
7
|
import { interpolatePath, request } from './http.js';
|
|
8
|
-
export const status = (client, projectId) => {
|
|
8
|
+
export const status = (client, projectId, options = {}) => {
|
|
9
9
|
const { method, path } = deploymentsEndpoints.status;
|
|
10
|
-
return request(client, method, interpolatePath(path, { id: projectId })
|
|
10
|
+
return request(client, method, interpolatePath(path, { id: projectId }), {
|
|
11
|
+
headers: { 'x-preferred-org-id': options.orgId },
|
|
12
|
+
});
|
|
11
13
|
};
|
|
12
|
-
export const get = (client, deploymentId) => {
|
|
14
|
+
export const get = (client, deploymentId, options = {}) => {
|
|
13
15
|
const { method, path } = deploymentsEndpoints.get;
|
|
14
|
-
return request(client, method, interpolatePath(path, { id: deploymentId })
|
|
16
|
+
return request(client, method, interpolatePath(path, { id: deploymentId }), {
|
|
17
|
+
headers: { 'x-preferred-org-id': options.orgId },
|
|
18
|
+
});
|
|
15
19
|
};
|
|
16
|
-
export const trigger = (client, projectId, envType) => {
|
|
20
|
+
export const trigger = (client, projectId, envType, options = {}) => {
|
|
17
21
|
const { method, path } = deploymentsEndpoints.trigger;
|
|
18
22
|
return request(client, method, interpolatePath(path, { id: projectId }), {
|
|
19
23
|
body: { envType },
|
|
24
|
+
headers: { 'x-preferred-org-id': options.orgId },
|
|
20
25
|
});
|
|
21
26
|
};
|
|
22
|
-
export const history = (client, projectId, envType) => {
|
|
27
|
+
export const history = (client, projectId, envType, options = {}) => {
|
|
23
28
|
const { method, path } = deploymentsEndpoints.history;
|
|
24
29
|
return request(client, method, interpolatePath(path, { id: projectId }), {
|
|
25
30
|
query: { envType },
|
|
31
|
+
headers: { 'x-preferred-org-id': options.orgId },
|
|
32
|
+
}).then((response) => {
|
|
33
|
+
const rows = isHistoryEnvelope(response) ? response.data : response;
|
|
34
|
+
return rows.map(normalizeHistoryRow);
|
|
26
35
|
});
|
|
27
36
|
};
|
|
28
|
-
export const rollback = (client, projectId, body) => {
|
|
37
|
+
export const rollback = (client, projectId, body, options = {}) => {
|
|
29
38
|
const { method, path } = deploymentsEndpoints.rollback;
|
|
30
|
-
return request(client, method, interpolatePath(path, { id: projectId }), {
|
|
39
|
+
return request(client, method, interpolatePath(path, { id: projectId }), {
|
|
40
|
+
body,
|
|
41
|
+
headers: { 'x-preferred-org-id': options.orgId },
|
|
42
|
+
});
|
|
31
43
|
};
|
|
32
44
|
/**
|
|
33
45
|
* Cancel an in-flight build. Terminal builds (`ready` / `error` /
|
|
@@ -37,3 +49,26 @@ export const cancel = (client, buildId) => {
|
|
|
37
49
|
const { method, path } = deploymentsEndpoints.envScopedCancelBuild;
|
|
38
50
|
return request(client, method, interpolatePath(path, { buildId }));
|
|
39
51
|
};
|
|
52
|
+
function normalizeHistoryRow(row) {
|
|
53
|
+
const record = row;
|
|
54
|
+
const id = typeof record.id === 'string'
|
|
55
|
+
? record.id
|
|
56
|
+
: typeof record.deploymentId === 'string'
|
|
57
|
+
? record.deploymentId
|
|
58
|
+
: '';
|
|
59
|
+
const envType = typeof record.envType === 'string' ? record.envType : null;
|
|
60
|
+
const environment = typeof record.environment === 'string'
|
|
61
|
+
? record.environment
|
|
62
|
+
: envType === null
|
|
63
|
+
? undefined
|
|
64
|
+
: envType;
|
|
65
|
+
const normalized = {
|
|
66
|
+
...row,
|
|
67
|
+
id: id,
|
|
68
|
+
deploymentId: id,
|
|
69
|
+
};
|
|
70
|
+
return environment === undefined ? normalized : { ...normalized, environment };
|
|
71
|
+
}
|
|
72
|
+
function isHistoryEnvelope(response) {
|
|
73
|
+
return !Array.isArray(response);
|
|
74
|
+
}
|
package/dist/domains.d.ts
CHANGED
|
@@ -8,19 +8,22 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import type { AddHostnameInput, DomainEmailBinding, DomainHostname, Domain as DomainResult } from '@sylphx/contract';
|
|
10
10
|
import type { Client } from './client.js';
|
|
11
|
-
export
|
|
12
|
-
|
|
11
|
+
export interface OrgScopedRequestOptions {
|
|
12
|
+
readonly orgId?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare const list: (client: Client, projectId: string, envType?: string, options?: OrgScopedRequestOptions) => Promise<DomainResult[]>;
|
|
15
|
+
export declare const create: (client: Client, projectId: string, apexDomain: string, envType?: string, options?: OrgScopedRequestOptions) => Promise<DomainResult>;
|
|
13
16
|
export interface AddHostnameOpts extends Omit<AddHostnameInput, 'hostname'> {
|
|
14
17
|
readonly envType?: string;
|
|
15
18
|
}
|
|
16
|
-
export declare const addHostname: (client: Client, projectId: string, domainId: string, hostname: string, opts?: AddHostnameOpts) => Promise<DomainHostname>;
|
|
17
|
-
export declare const removeHostname: (client: Client, projectId: string, domainId: string, hostnameId: string) => Promise<void>;
|
|
18
|
-
export declare const checkHostname: (client: Client, projectId: string, domainId: string, hostnameId: string) => Promise<DomainHostname>;
|
|
19
|
+
export declare const addHostname: (client: Client, projectId: string, domainId: string, hostname: string, opts?: AddHostnameOpts, options?: OrgScopedRequestOptions) => Promise<DomainHostname>;
|
|
20
|
+
export declare const removeHostname: (client: Client, projectId: string, domainId: string, hostnameId: string, options?: OrgScopedRequestOptions) => Promise<void>;
|
|
21
|
+
export declare const checkHostname: (client: Client, projectId: string, domainId: string, hostnameId: string, options?: OrgScopedRequestOptions) => Promise<DomainHostname>;
|
|
19
22
|
export interface EnableEmailOpts {
|
|
20
23
|
readonly defaultFromEmail?: string;
|
|
21
24
|
readonly defaultFromName?: string;
|
|
22
25
|
}
|
|
23
|
-
export declare const enableEmail: (client: Client, projectId: string, domainId: string, opts?: EnableEmailOpts) => Promise<DomainEmailBinding>;
|
|
24
|
-
export declare const checkEmail: (client: Client, projectId: string, domainId: string) => Promise<DomainEmailBinding>;
|
|
25
|
-
export declare const disableEmail: (client: Client, projectId: string, domainId: string) => Promise<void>;
|
|
26
|
+
export declare const enableEmail: (client: Client, projectId: string, domainId: string, opts?: EnableEmailOpts, options?: OrgScopedRequestOptions) => Promise<DomainEmailBinding>;
|
|
27
|
+
export declare const checkEmail: (client: Client, projectId: string, domainId: string, options?: OrgScopedRequestOptions) => Promise<DomainEmailBinding>;
|
|
28
|
+
export declare const disableEmail: (client: Client, projectId: string, domainId: string, options?: OrgScopedRequestOptions) => Promise<void>;
|
|
26
29
|
//# sourceMappingURL=domains.d.ts.map
|
package/dist/domains.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"domains.d.ts","sourceRoot":"","sources":["../src/domains.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACX,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,EACd,MAAM,IAAI,YAAY,EACtB,MAAM,kBAAkB,CAAA;AAEzB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAGzC,eAAO,MAAM,IAAI,GAChB,QAAQ,MAAM,EACd,WAAW,MAAM,EACjB,gBAAsB,
|
|
1
|
+
{"version":3,"file":"domains.d.ts","sourceRoot":"","sources":["../src/domains.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACX,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,EACd,MAAM,IAAI,YAAY,EACtB,MAAM,kBAAkB,CAAA;AAEzB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAGzC,MAAM,WAAW,uBAAuB;IACvC,QA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AAO,MAAM,UAAU,GACtB,QAAQ,MAAM,EACd,WAAW,MAAM,EACjB,UAAU,MAAM,EAChB,UAAS,uBAA4B,KACnC,OAAO,CAAC,kBAAkB,CAM3B,CAAA;AAEF,eAAO,MAAM,YAAY,GACxB,QAAQ,MAAM,EACd,WAAW,MAAM,EACjB,UAAU,MAAM,EAChB,UAAS,uBAA4B,KACnC,OAAO,CAAC,IAAI,CAMb,CAAA"}
|
package/dist/domains.js
CHANGED
|
@@ -8,32 +8,40 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import { domainsEndpoints } from '@sylphx/contract';
|
|
10
10
|
import { interpolatePath, request } from './http.js';
|
|
11
|
-
|
|
11
|
+
const orgHeaders = (options = {}) => ({
|
|
12
|
+
...(options.orgId ? { 'x-preferred-org-id': options.orgId } : {}),
|
|
13
|
+
});
|
|
14
|
+
export const list = (client, projectId, envType = 'production', options = {}) => {
|
|
12
15
|
const { method, path } = domainsEndpoints.list;
|
|
13
16
|
return request(client, method, interpolatePath(path, { projectId }), {
|
|
14
17
|
query: { envType },
|
|
18
|
+
headers: orgHeaders(options),
|
|
15
19
|
});
|
|
16
20
|
};
|
|
17
|
-
export const create = (client, projectId, apexDomain, envType = 'production') => {
|
|
21
|
+
export const create = (client, projectId, apexDomain, envType = 'production', options = {}) => {
|
|
18
22
|
const { method, path } = domainsEndpoints.create;
|
|
19
23
|
return request(client, method, interpolatePath(path, { projectId }), {
|
|
20
24
|
body: { apexDomain, envType },
|
|
25
|
+
headers: orgHeaders(options),
|
|
21
26
|
});
|
|
22
27
|
};
|
|
23
|
-
export const addHostname = (client, projectId, domainId, hostname, opts) => {
|
|
28
|
+
export const addHostname = (client, projectId, domainId, hostname, opts, options = {}) => {
|
|
24
29
|
const { method, path } = domainsEndpoints.addHostname;
|
|
25
30
|
const { envType = 'production', ...body } = opts ?? {};
|
|
26
31
|
return request(client, method, interpolatePath(path, { projectId, domainId }), {
|
|
27
32
|
query: { envType },
|
|
28
33
|
body: { hostname, ...body },
|
|
34
|
+
headers: orgHeaders(options),
|
|
29
35
|
});
|
|
30
36
|
};
|
|
31
|
-
export const removeHostname = (client, projectId, domainId, hostnameId) => {
|
|
37
|
+
export const removeHostname = (client, projectId, domainId, hostnameId, options = {}) => {
|
|
32
38
|
const { method, path } = domainsEndpoints.removeHostname;
|
|
33
|
-
return request(client, method, interpolatePath(path, { projectId, domainId, hostnameId })
|
|
39
|
+
return request(client, method, interpolatePath(path, { projectId, domainId, hostnameId }), {
|
|
40
|
+
headers: orgHeaders(options),
|
|
41
|
+
});
|
|
34
42
|
};
|
|
35
43
|
// ---- Not yet in @sylphx/contract (future wave) ---------------------------
|
|
36
|
-
export const checkHostname = (client, projectId, domainId, hostnameId) => request(client, 'POST', `/projects/${encodeURIComponent(projectId)}/domains/${encodeURIComponent(domainId)}/hostnames/${encodeURIComponent(hostnameId)}/check
|
|
37
|
-
export const enableEmail = (client, projectId, domainId, opts) => request(client, 'POST', `/projects/${encodeURIComponent(projectId)}/domains/${encodeURIComponent(domainId)}/email`, { body: opts ?? {} });
|
|
38
|
-
export const checkEmail = (client, projectId, domainId) => request(client, 'POST', `/projects/${encodeURIComponent(projectId)}/domains/${encodeURIComponent(domainId)}/email/check
|
|
39
|
-
export const disableEmail = (client, projectId, domainId) => request(client, 'DELETE', `/projects/${encodeURIComponent(projectId)}/domains/${encodeURIComponent(domainId)}/email
|
|
44
|
+
export const checkHostname = (client, projectId, domainId, hostnameId, options = {}) => request(client, 'POST', `/projects/${encodeURIComponent(projectId)}/domains/${encodeURIComponent(domainId)}/hostnames/${encodeURIComponent(hostnameId)}/check`, { headers: orgHeaders(options) });
|
|
45
|
+
export const enableEmail = (client, projectId, domainId, opts, options = {}) => request(client, 'POST', `/projects/${encodeURIComponent(projectId)}/domains/${encodeURIComponent(domainId)}/email`, { body: opts ?? {}, headers: orgHeaders(options) });
|
|
46
|
+
export const checkEmail = (client, projectId, domainId, options = {}) => request(client, 'POST', `/projects/${encodeURIComponent(projectId)}/domains/${encodeURIComponent(domainId)}/email/check`, { headers: orgHeaders(options) });
|
|
47
|
+
export const disableEmail = (client, projectId, domainId, options = {}) => request(client, 'DELETE', `/projects/${encodeURIComponent(projectId)}/domains/${encodeURIComponent(domainId)}/email`, { headers: orgHeaders(options) });
|