@sylphx/management 0.2.3 → 0.4.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.
Files changed (63) hide show
  1. package/CHANGELOG.md +22 -4
  2. package/README.md +11 -9
  3. package/dist/adminBranchDatabases.d.ts +13 -0
  4. package/dist/adminBranchDatabases.d.ts.map +1 -0
  5. package/dist/adminBranchDatabases.js +17 -0
  6. package/dist/adminProjectCredentials.d.ts +6 -5
  7. package/dist/adminProjectCredentials.d.ts.map +1 -1
  8. package/dist/adminProjectCredentials.js +3 -2
  9. package/dist/billing.d.ts +10 -7
  10. package/dist/billing.d.ts.map +1 -1
  11. package/dist/billing.js +23 -7
  12. package/dist/databases.js +5 -5
  13. package/dist/deployments.d.ts +16 -10
  14. package/dist/deployments.d.ts.map +1 -1
  15. package/dist/deployments.js +49 -8
  16. package/dist/domains.d.ts +11 -8
  17. package/dist/domains.d.ts.map +1 -1
  18. package/dist/domains.js +17 -9
  19. package/dist/envVars.d.ts +7 -4
  20. package/dist/envVars.d.ts.map +1 -1
  21. package/dist/envVars.js +11 -5
  22. package/dist/environments.d.ts +10 -7
  23. package/dist/environments.d.ts.map +1 -1
  24. package/dist/environments.js +22 -11
  25. package/dist/http.d.ts +5 -0
  26. package/dist/http.d.ts.map +1 -1
  27. package/dist/http.js +12 -2
  28. package/dist/index.d.ts +3 -3
  29. package/dist/index.d.ts.map +1 -1
  30. package/dist/index.js +1 -2
  31. package/dist/logs.d.ts +9 -1
  32. package/dist/logs.d.ts.map +1 -1
  33. package/dist/logs.js +13 -0
  34. package/dist/projects.d.ts +4 -1
  35. package/dist/projects.d.ts.map +1 -1
  36. package/dist/projects.js +7 -2
  37. package/dist/remoteConfig.d.ts +7 -4
  38. package/dist/remoteConfig.d.ts.map +1 -1
  39. package/dist/remoteConfig.js +17 -13
  40. package/dist/resourceBindings.d.ts +3 -3
  41. package/dist/resourceBindings.d.ts.map +1 -1
  42. package/dist/resourceBindings.js +10 -4
  43. package/dist/resources.d.ts +3 -3
  44. package/dist/resources.d.ts.map +1 -1
  45. package/dist/sandboxes.d.ts +5 -2
  46. package/dist/sandboxes.d.ts.map +1 -1
  47. package/dist/sandboxes.js +9 -3
  48. package/dist/services.d.ts +19 -5
  49. package/dist/services.d.ts.map +1 -1
  50. package/dist/services.js +15 -8
  51. package/dist/tasks.d.ts +8 -5
  52. package/dist/tasks.d.ts.map +1 -1
  53. package/dist/tasks.js +15 -12
  54. package/dist/types.d.ts +20 -44
  55. package/dist/types.d.ts.map +1 -1
  56. package/dist/types.js +2 -3
  57. package/package.json +2 -6
  58. package/dist/edgeDeployments.d.ts +0 -43
  59. package/dist/edgeDeployments.d.ts.map +0 -1
  60. package/dist/edgeDeployments.js +0 -32
  61. package/dist/functions.d.ts +0 -39
  62. package/dist/functions.d.ts.map +0 -1
  63. package/dist/functions.js +0 -40
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # @sylphx/management
2
2
 
3
+ ## 0.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#586](https://github.com/SylphxAI/platform/pull/586) [`2e55a61`](https://github.com/SylphxAI/platform/commit/2e55a6194628c5ca3ca78290cbf62610231ccee6) Thanks [@shtse8](https://github.com/shtse8)! - Expose authenticated build detail through the deployments contract, Management SDK, and `sylphx deployments build` so failed builds return structured, redacted diagnostics.
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [[`2e55a61`](https://github.com/SylphxAI/platform/commit/2e55a6194628c5ca3ca78290cbf62610231ccee6)]:
12
+ - @sylphx/contract@0.5.0
13
+
14
+ ## 0.3.0
15
+
16
+ ### Minor Changes
17
+
18
+ - [#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.
19
+
20
+ 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.
21
+
3
22
  ## 0.2.3
4
23
 
5
24
  ### Patch Changes
@@ -33,7 +52,7 @@ Management SDK now covers every public `apps/api/src/server/platform/routes/`
33
52
  namespace (35/35 non-excluded, 6 internal-only exclusions with written
34
53
  rationale).
35
54
 
36
- ### New namespaces (14)
55
+ ### New namespaces (13)
37
56
 
38
57
  - `admin` — operator org / user / credit / audit administration
39
58
  - `auth` (alias of `authSettings`) — OAuth providers + project auth policy + stats
@@ -41,7 +60,6 @@ rationale).
41
60
  - `billingSettings` — business info, spending caps, invoice prefs
42
61
  - `branchDatabases` — per-branch Neon/CNPG database bindings (ADR-070)
43
62
  - `ciSettings` — org + repo CI configuration (runners, secrets, policy)
44
- - `edgeDeployments` — Vercel-edge / Workers-style function releases
45
63
  - `github` — GitHub App installation + repo discovery
46
64
  - `kv` — KV admin (operator dashboard; distinct from BaaS `kv` in `@sylphx/sdk`)
47
65
  - `management` — self-hosted runtime database backups / PITR restore (ADR-070)
@@ -76,9 +94,9 @@ rationale).
76
94
  ### Changes
77
95
 
78
96
  - **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.
79
- - **46 capability namespaces** (in-flight; count may change before stable) covering the full Management plane: `projects`, `deployments`, `environments`, `envVars`, `domains`, `databases`, `services`, `volumes`, `storage`, `secrets`, `tasks`, `resourceBindings`, `organizations`, `users`, `sandboxes`, `functions`, `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`.
97
+ - **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/*`.
80
98
  - **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.
81
- - **Bearer-token auth.** `createClient({ token })` accepts both user session tokens (`slx_...`) and service tokens (`sk_...`). The same SDK works for CLI / CI / backend integrations on the Management plane (`api.sylphx.com/v1`).
99
+ - **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`).
82
100
  - **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.
83
101
  - **ESM-only.** `"type": "module"`, Node ≥ 20, uses the built-in `fetch`. No classes, no polyfills, no peer framework required.
84
102
 
package/README.md CHANGED
@@ -4,8 +4,7 @@
4
4
  [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](./LICENSE)
5
5
 
6
6
  Pure-FP Promise client for the [Sylphx Platform](https://sylphx.com)
7
- Management API — **46 capability namespaces, contract-first types, zero
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 (`slx_...` user / `sk_...`
21
- > service). For app-runtime data-plane operations (auth, KV, transactional
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
- - **User session token** (`slx_...`) — sign in at `sylphx.com` and run `sylphx auth token`
34
- - **Service token** (`sk_...`) — for CI / server-side automation, created under project Tokens
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
- 46 namespaces. Every module exports free functions that take `client` as
82
- the first argument. Key namespaces:
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
- * `sk_*` into the environment-level `SYLPHX_SECRET_KEY` app secret so the
6
- * reconciler updates deployed workloads through the normal desired-state path.
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 `SYLPHX_SECRET_KEY` and queue reconciliation. */
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 `SYLPHX_SECRET_KEY` and queue reconciliation. */
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;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAGzC,MAAM,WAAW,iCAAiC;IACjD,kDAAkD;IAClD,Q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;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
- * `sk_*` into the environment-level `SYLPHX_SECRET_KEY` app secret so the
6
- * reconciler updates deployed workloads through the normal desired-state path.
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
@@ -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,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AAE,MAAM,CAAA;IACvB,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAA;IAC/B,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IAC9B,QAAQ,CAAC,SAAS,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
- 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', {
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 } = databasesEndpoints.list;
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 } = databasesEndpoints.create;
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 } = databasesEndpoints.get;
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 } = databasesEndpoints.delete;
25
+ const { method, path } = resourcesEndpoints.delete;
26
26
  return request(client, method, interpolatePath(path, { id }));
27
27
  };
28
28
  export { _delete as delete };
@@ -3,20 +3,26 @@
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 { BuildDetail, CancelBuildResult, DeploymentDetail, DeploymentHistoryItem, DeploymentStatus, DeployResult, RollbackDeploymentInput, RollbackResult } from '@sylphx/contract';
7
7
  import type { Client } from './client.js';
8
- export declare const status: (client: Client, projectId: string) => Promise<DeploymentStatus>;
9
- export declare const get: (client: Client, deploymentId: string) => Promise<DeploymentDetail>;
10
- export declare const trigger: (client: Client, projectId: string, envType: string) => Promise<DeployResult>;
11
- export declare const history: (client: Client, projectId: string, envType: string) => Promise<DeployResult[]>;
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 getBuild: (client: Client, buildId: string, options?: OrgScopedRequestOptions) => Promise<BuildDetail>;
18
+ export declare const trigger: (client: Client, projectId: string, envType: string, options?: OrgScopedRequestOptions) => Promise<DeployResult>;
19
+ export declare const history: (client: Client, projectId: string, envType: string, options?: OrgScopedRequestOptions) => Promise<DeploymentHistoryRow[]>;
12
20
  export type RollbackBody = RollbackDeploymentInput;
13
- export declare const rollback: (client: Client, projectId: string, body: RollbackBody) => Promise<DeployResult>;
21
+ export declare const rollback: (client: Client, projectId: string, body: RollbackBody, options?: OrgScopedRequestOptions) => Promise<RollbackResult>;
14
22
  /**
15
23
  * Cancel an in-flight build. Terminal builds (`ready` / `error` /
16
24
  * `cancelled`) return 409. Phase 4b closure for ADR-089 Matrix 2.
17
25
  */
18
- export declare const cancel: (client: Client, buildId: string) => Promise<{
19
- success: boolean;
20
- }>;
21
- export type { DeploymentDetail } from '@sylphx/contract';
26
+ export declare const cancel: (client: Client, buildId: string) => Promise<CancelBuildResult>;
27
+ export type { BuildDetail, DeploymentDetail, DeploymentHistoryItem, DeploymentHistoryResult, RollbackResult, } from '@sylphx/contract';
22
28
  //# 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,uBAAuB,EACvB,MAAM,kBAAkB,CAAA;AAEzB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAGzC,eAAO,MAAM,MAAM,GAAI,QAAQ,MAAM,EAAE,WAAW,MAAM,KAAG,OAAO,CAAC,gBAAgB,CAGlF,CAAA;AAED,eA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eAAO,MAAM,MAAM,GAClB,QAAQ,MAAM,EACd,WAAW,MAAM,EACjB,UAAS,uBAA4B,KACnC,OAAO,CAAC,gBAAgB,CAK1B,CAAA;AAED,eAAO,MAAM,GAAG,GACf,QAAQ,MAAM,EACd,cAAc,MAAM,EACpB,UAAS,uBAA4B,KACnC,OAAO,CAAC,gBAAgB,CAK1B,CAAA;AAED,eAAO,MAAM,QAAQ,GACpB,QAAQ,MAAM,EACd,SAAS,MAAM,EACf,UAAS,uBAA4B,KACnC,OAAO,CAAC,WAAW,CAKrB,CAAA;AAED,eAAO,MAAM,OAAO,GACnB,QAAQ,MAAM,EACd,WAAW,MAAM,EACjB,SAAS,MAAM,EACf,UAAS,uBAA4B,KACnC,OAAO,CAAC,YAAY,CAMtB,CAAA;AAED,eAAO,MAAM,OAAO,GACnB,QAAQ,MAAM,EACd,WAAW,MAAM,EACjB,SAAS,MAAM,EACf,UAAS,uBAA4B,KACnC,OAAO,CAAC,oBAAoB,EAAE,CAShC,CAAA;AAED,MAAM,MAAM,YAAY,GAAG,uBAAuB,CAAA;AAElD,eAAO,MAAM,QAAQ,GACpB,QAAQ,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,iBAAiB,CAGjF,CAAA;AAID,YAAY,EACX,WAAW,EACX,gBAAgB,EAChB,qBAAqB,EACrB,uBAAuB,EACvB,cAAc,GACd,MAAM,kBAAkB,CAAA"}
@@ -5,29 +5,47 @@
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 getBuild = (client, buildId, options = {}) => {
21
+ const { method, path } = deploymentsEndpoints.envScopedBuildDetail;
22
+ return request(client, method, interpolatePath(path, { buildId }), {
23
+ headers: { 'x-preferred-org-id': options.orgId },
24
+ });
25
+ };
26
+ export const trigger = (client, projectId, envType, options = {}) => {
17
27
  const { method, path } = deploymentsEndpoints.trigger;
18
28
  return request(client, method, interpolatePath(path, { id: projectId }), {
19
29
  body: { envType },
30
+ headers: { 'x-preferred-org-id': options.orgId },
20
31
  });
21
32
  };
22
- export const history = (client, projectId, envType) => {
33
+ export const history = (client, projectId, envType, options = {}) => {
23
34
  const { method, path } = deploymentsEndpoints.history;
24
35
  return request(client, method, interpolatePath(path, { id: projectId }), {
25
36
  query: { envType },
37
+ headers: { 'x-preferred-org-id': options.orgId },
38
+ }).then((response) => {
39
+ const rows = isHistoryEnvelope(response) ? response.data : response;
40
+ return rows.map(normalizeHistoryRow);
26
41
  });
27
42
  };
28
- export const rollback = (client, projectId, body) => {
43
+ export const rollback = (client, projectId, body, options = {}) => {
29
44
  const { method, path } = deploymentsEndpoints.rollback;
30
- return request(client, method, interpolatePath(path, { id: projectId }), { body });
45
+ return request(client, method, interpolatePath(path, { id: projectId }), {
46
+ body,
47
+ headers: { 'x-preferred-org-id': options.orgId },
48
+ });
31
49
  };
32
50
  /**
33
51
  * Cancel an in-flight build. Terminal builds (`ready` / `error` /
@@ -37,3 +55,26 @@ export const cancel = (client, buildId) => {
37
55
  const { method, path } = deploymentsEndpoints.envScopedCancelBuild;
38
56
  return request(client, method, interpolatePath(path, { buildId }));
39
57
  };
58
+ function normalizeHistoryRow(row) {
59
+ const record = row;
60
+ const id = typeof record.id === 'string'
61
+ ? record.id
62
+ : typeof record.deploymentId === 'string'
63
+ ? record.deploymentId
64
+ : '';
65
+ const envType = typeof record.envType === 'string' ? record.envType : null;
66
+ const environment = typeof record.environment === 'string'
67
+ ? record.environment
68
+ : envType === null
69
+ ? undefined
70
+ : envType;
71
+ const normalized = {
72
+ ...row,
73
+ id: id,
74
+ deploymentId: id,
75
+ };
76
+ return environment === undefined ? normalized : { ...normalized, environment };
77
+ }
78
+ function isHistoryEnvelope(response) {
79
+ return !Array.isArray(response);
80
+ }
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 declare const list: (client: Client, projectId: string, envType?: string) => Promise<DomainResult[]>;
12
- export declare const create: (client: Client, projectId: string, apexDomain: string, envType?: string) => Promise<DomainResult>;
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
@@ -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,KACpB,OAAO,CAAC,YAAY,EAAE,CAKxB,CAAA;AAED,eAAO,MAAM,MAAM,GAClB,QAAQ,MAAM,EACd,WAAW,MAAM,EACjB,YAAY,MAAM,EAClB,gBAAsB,KACpB,OAAO,CAAC,YAAY,CAKtB,CAAA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,UAAU,MAAM,EAChB,OAAO,eAAe,EACtB,UAAS,uBAA4B,KACnC,OAAO,CAAC,kBAAkB,CAM3B,CAAA;AAEF,eAAO,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
- export const list = (client, projectId, envType = 'production') => {
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) });