@shipstatic/types 2.5.0-beta.8 → 2.5.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/dist/index.d.ts CHANGED
@@ -12,6 +12,28 @@ export declare const DeploymentStatus: {
12
12
  readonly DELETING: "deleting";
13
13
  };
14
14
  export type DeploymentStatusType = (typeof DeploymentStatus)[keyof typeof DeploymentStatus];
15
+ /**
16
+ * Which client made a deployment — the origin-tracking vocabulary.
17
+ *
18
+ * A closed set with many authors: the CLI, the SDK, the dashboard, both MCP
19
+ * transports, the GitHub Action, the n8n node and the VS Code extension each
20
+ * name themselves here. It lived in the API's config until 2026-08-06, where
21
+ * being server-side made it unenforceable in the one direction that matters —
22
+ * every client wrote a bare string, and a value outside the set was **silently
23
+ * dropped** by the server, so a typo did not fail anywhere. It stopped
24
+ * recording where deploys came from and said nothing.
25
+ */
26
+ export declare const DeploymentVia: {
27
+ readonly WEB: "web";
28
+ readonly SDK: "sdk";
29
+ readonly CLI: "cli";
30
+ readonly MCP: "mcp";
31
+ readonly GIT: "git";
32
+ readonly N8N: "n8n";
33
+ readonly GPT: "gpt";
34
+ readonly VSC: "vsc";
35
+ };
36
+ export type DeploymentViaType = (typeof DeploymentVia)[keyof typeof DeploymentVia];
15
37
  /**
16
38
  * Core deployment object - used in both API responses and SDK
17
39
  */
@@ -32,7 +54,15 @@ export interface Deployment {
32
54
  readonly password: boolean;
33
55
  /** Labels for categorization and filtering (lowercase, alphanumeric with separators). Always present, empty array when none. */
34
56
  labels: string[];
35
- /** The client/tool used to create this deployment (e.g., 'web', 'sdk', 'cli'), null if unknown */
57
+ /**
58
+ * The client/tool that created this deployment, null if unknown.
59
+ *
60
+ * Deliberately wider than {@link DeploymentViaType}: this is stored data,
61
+ * and rows predate the vocabulary being closed. Narrowing the ENTITY would
62
+ * be a claim about every row already in the database; narrowing the
63
+ * REQUEST option ({@link DeploymentUploadOptions.via}) is a claim about
64
+ * what a client may send, which is ours to make.
65
+ */
36
66
  readonly via: string | null;
37
67
  /** Unix timestamp (seconds) when deployment was created */
38
68
  readonly created: number;
@@ -49,14 +79,88 @@ export interface DeploymentCreateResponse extends Deployment {
49
79
  /** Claim URL for public deployments. Present when deployed without credentials. */
50
80
  readonly claim?: string;
51
81
  }
82
+ /**
83
+ * The half of a list response that is identical on every list.
84
+ *
85
+ * `GET /<collection>` answers exactly two fields — the collection under its
86
+ * own plural noun, and this cursor — so the cursor is declared once here and
87
+ * each response below adds only its noun. `cursor: null` means last page and
88
+ * is the ENTIRE has-more signal, which is why there is no `has_more`.
89
+ *
90
+ * There is deliberately no `total`. A count is an aggregate over a
91
+ * collection, not a property of a page; producing one would cost a COUNT
92
+ * beside every page read, which is precisely what keyset pagination exists
93
+ * to avoid. Counts live on the resource that summarises the collection —
94
+ * `GET /account`'s `usage` for one caller, `GET /admin/stats` platform-wide.
95
+ */
96
+ export interface ListResponse {
97
+ /** Opaque cursor from this page; `null` on the last page. */
98
+ cursor: string | null;
99
+ }
100
+ /**
101
+ * Pagination options for every list endpoint. The response's `cursor` feeds
102
+ * the next request; a `null` cursor means the last page. Omitting both
103
+ * returns the server's default first page.
104
+ *
105
+ * A list answers `{ <collection>, cursor }` and nothing else — `cursor`
106
+ * carries the entire has-more signal, so no redundant boolean, and no
107
+ * `total`. **A count is an aggregate over a collection, not a property of a
108
+ * page:** including one makes every read pay for a full scan it did not ask
109
+ * for, which is precisely the cost keyset pagination exists to avoid.
110
+ *
111
+ * Counts therefore live on the summary resource that owns them —
112
+ * `GET /account` (`usage`) for a caller's own totals, `GET /admin/stats` for
113
+ * platform-wide ones. Ask for a count when you want a count; ask for a page
114
+ * when you want a page.
115
+ */
116
+ export interface ListOptions {
117
+ /** Maximum number of items to return in one page. */
118
+ limit?: number;
119
+ /** Opaque cursor from the previous page's response. */
120
+ cursor?: string;
121
+ }
52
122
  /**
53
123
  * Response for listing deployments
54
124
  */
55
- export interface DeploymentListResponse {
125
+ export interface DeploymentListResponse extends ListResponse {
56
126
  /** Array of deployments */
57
127
  deployments: Deployment[];
58
- /** Cursor for pagination, null if no more pages */
59
- cursor: string | null;
128
+ }
129
+ /**
130
+ * Acknowledgement of `DELETE /deployments/:deployment` — and the shape every
131
+ * mutation with no entity left to return follows.
132
+ *
133
+ * **The law:** a mutation answers with the resource it affected. If the
134
+ * resource still exists, that means the entity itself (`Deployment`,
135
+ * `Domain`, …). Otherwise it means this: the resource noun carrying the
136
+ * item's canonical key, plus the resource's own state field — and ONLY when
137
+ * the resource survived in a transitional state, as an async deletion's does.
138
+ * Where the resource is simply gone, the key alone is the whole answer
139
+ * ({@link DomainDeleteResponse}, {@link TokenDeleteResponse}).
140
+ *
141
+ * Put positively: **an acknowledgement is a projection of the resource** —
142
+ * its key, plus its own state field where the state changed. That is the
143
+ * test to apply, and it is sharper than "no constant", which this shape
144
+ * would fail on its own terms: `status` here is the literal `'deleting'` on
145
+ * every success, exactly as fixed as a `changed: true` would be.
146
+ *
147
+ * The difference is not how predictable the value is, it is what the field
148
+ * IS. `status` is the deployment's own field — the same one `GET
149
+ * /deployments/:deployment` returns — so this response is `Deployment`
150
+ * narrowed to two members, and a client renders it with the code it already
151
+ * has. `changed: true`, `queued: true` and `success: true` are not fields of
152
+ * any entity; they exist only to assert that the call worked, which the
153
+ * status code already said. Sync versus accepted is likewise the status
154
+ * code's job — 200 versus 202 — not a boolean's.
155
+ *
156
+ * No prose either (`message`): an acknowledgement is data, and each surface
157
+ * composes its own copy.
158
+ */
159
+ export interface DeploymentDeleteResponse {
160
+ /** The deployment hostname that was marked for removal */
161
+ readonly deployment: string;
162
+ /** The state the deployment is in while background cleanup runs */
163
+ readonly status: DeploymentStatusType;
60
164
  }
61
165
  /**
62
166
  * Domain status constants
@@ -89,7 +193,7 @@ export interface Domain {
89
193
  labels: string[];
90
194
  /** Unix timestamp (seconds) when domain was created */
91
195
  readonly created: number;
92
- /** When deployment was last linked (Unix timestamp), null if never linked */
196
+ /** Unix timestamp (seconds) when deployment was last linked, null if never linked */
93
197
  linked: number | null;
94
198
  /** Total deployment links */
95
199
  links: number;
@@ -111,11 +215,28 @@ export interface DomainSetResult extends Domain {
111
215
  /**
112
216
  * Response for listing domains
113
217
  */
114
- export interface DomainListResponse {
218
+ export interface DomainListResponse extends ListResponse {
115
219
  /** Array of domains */
116
220
  domains: Domain[];
117
- /** Cursor for pagination, null if no more pages */
118
- cursor: string | null;
221
+ }
222
+ /**
223
+ * Acknowledgement of `DELETE /domains/:domain`. The row is gone, so there is
224
+ * no state to state — the canonical domain name is the whole answer. See
225
+ * {@link DeploymentDeleteResponse} for the law.
226
+ */
227
+ export interface DomainDeleteResponse {
228
+ /** The domain name that was removed, normalized */
229
+ readonly domain: string;
230
+ }
231
+ /**
232
+ * Acknowledgement of `POST /domains/:domain/verify` (202). The DNS check is
233
+ * queued, not performed — the accepted status code says so, and the domain's
234
+ * own status is unchanged until the check runs, which is why none is stated
235
+ * here. See {@link DeploymentDeleteResponse} for the law.
236
+ */
237
+ export interface DomainVerifyResponse {
238
+ /** The domain whose DNS verification was queued, normalized */
239
+ readonly domain: string;
119
240
  }
120
241
  /**
121
242
  * DNS record types supported for domain configuration
@@ -142,16 +263,46 @@ export interface DnsProvider {
142
263
  /**
143
264
  * Response for domain DNS provider lookup
144
265
  */
266
+ /**
267
+ * What a DNS lookup found for a domain. An envelope rather than a bare
268
+ * {@link DnsProvider} because a lookup can succeed and learn more than the
269
+ * provider later; the shape is named so a consumer can hold one.
270
+ */
271
+ export interface DnsLookup {
272
+ /** The provider serving this domain's DNS, absent when unidentified */
273
+ provider?: DnsProvider;
274
+ }
275
+ /**
276
+ * A report: it answers a question and carries only the answer (`CLAUDE.md`,
277
+ * "A report answers a question").
278
+ */
145
279
  export interface DomainDnsResponse {
146
280
  /** The domain name */
147
281
  domain: string;
148
282
  /** DNS provider information, null if not yet looked up */
149
- dns: {
150
- provider?: DnsProvider;
151
- } | null;
283
+ dns: DnsLookup | null;
284
+ }
285
+ /**
286
+ * Response for `GET /domains/:domain/share` — the domain plus the salted
287
+ * hash that lets someone else complete its DNS setup without an account.
288
+ *
289
+ * `/admin/domains/:domain/share` answers the same shape, which is the admin
290
+ * law working: the operator surface is the public grammar with a prefix.
291
+ *
292
+ * A report: it answers a question and carries only the answer (`CLAUDE.md`,
293
+ * "A report answers a question").
294
+ */
295
+ export interface DomainShareResponse {
296
+ /** The domain the setup link is for */
297
+ readonly domain: string;
298
+ /** The salted setup hash that authorizes the share */
299
+ readonly hash: string;
152
300
  }
153
301
  /**
154
302
  * Response for domain DNS records
303
+ *
304
+ * A report: it answers a question and carries only the answer (`CLAUDE.md`,
305
+ * "A report answers a question").
155
306
  */
156
307
  export interface DomainRecordsResponse {
157
308
  /** The domain name */
@@ -162,7 +313,92 @@ export interface DomainRecordsResponse {
162
313
  records: DnsRecord[];
163
314
  }
164
315
  /**
165
- * Response for domain validation
316
+ * The envelope an `Idempotency-Key` must fit, and how long a replay lasts.
317
+ *
318
+ * Format lives here rather than on the server alone by the format-vs-policy
319
+ * rule: a client can decide offline whether a key is well-formed, and the
320
+ * API would reject the same value the same way.
321
+ */
322
+ export declare const IDEMPOTENCY_KEY_CONSTRAINTS: {
323
+ /**
324
+ * HTTP header name. Here for the same reason {@link CALLER.HEADER} is: a
325
+ * wire header has two ends, and the package that owns the value's format
326
+ * is the only place both ends can read its name from.
327
+ */
328
+ readonly HEADER: "Idempotency-Key";
329
+ readonly MAX_LENGTH: 256;
330
+ /** How long a stored 201 stays replayable. */
331
+ readonly WINDOW_SECONDS: number;
332
+ };
333
+ /**
334
+ * Normalize a `via` value from any transport — trimmed, lowercased, and a
335
+ * member of {@link DeploymentVia}, or `undefined`.
336
+ *
337
+ * A format rule by this package's own test: a client can decide offline
338
+ * whether a value is well-formed, and the API reaches the same verdict on the
339
+ * same input. It lived server-side until 2026-08-06, which meant clients could
340
+ * only learn their label was unusable by noticing analytics had gone quiet.
341
+ *
342
+ * **Not knowing your `via` is not an error** — an unrecognized value yields
343
+ * `undefined` rather than throwing, because origin tracking is telemetry and a
344
+ * deploy must never fail over it. A caller that has an honest default should
345
+ * prefer it (`normalizeVia(process.env.SHIP_VIA) ?? DeploymentVia.CLI`): the
346
+ * deploy really did come from the CLI, so recording that beats recording
347
+ * nothing.
348
+ */
349
+ export declare function normalizeVia(value: unknown): DeploymentViaType | undefined;
350
+ /**
351
+ * Validate an idempotency key, returning the trimmed value or `undefined`
352
+ * when none was supplied. Throws {@link ShipError.validation} when the value
353
+ * cannot be sent — the same verdict the API would reach, reached earlier.
354
+ */
355
+ export declare function validateIdempotencyKey(value: unknown): string | undefined;
356
+ /**
357
+ * Response for `GET /labels` — every label in use across the caller's
358
+ * deployments, domains and tokens, grouped and ordered by last use.
359
+ *
360
+ * The one plural noun outside the list contract, deliberately: labels have
361
+ * no identity, no row and no `created`, so there is nothing for a keyset
362
+ * cursor to resume after, and its consumer is an autocomplete that wants the
363
+ * whole set. Bounded by `PAGINATION.GLOBAL_LIMIT` rather than paginated.
364
+ *
365
+ * A report: it answers a question and carries only the answer (`CLAUDE.md`,
366
+ * "A report answers a question").
367
+ */
368
+ export interface LabelsResponse {
369
+ readonly labels: string[];
370
+ }
371
+ /**
372
+ * Response for `POST /setup` — the DNS instructions for one domain, written
373
+ * for a human to follow at their registrar.
374
+ *
375
+ * `custom` is the provider-specific walkthrough when the provider is known;
376
+ * `generic` always answers, so a caller never has nothing to show.
377
+ *
378
+ * A report: it answers a question and carries only the answer (`CLAUDE.md`,
379
+ * "A report answers a question").
380
+ */
381
+ export interface SetupInstructionsResponse {
382
+ /** The domain the instructions are for — a report names its subject */
383
+ readonly domain: string;
384
+ /** One-line summary of what to do */
385
+ readonly tldr: string;
386
+ /** Provider-specific instructions, null when the provider is unknown */
387
+ readonly custom: string | null;
388
+ /** Provider-agnostic instructions — always present */
389
+ readonly generic: string;
390
+ /** The identified DNS provider, null when unknown */
391
+ readonly provider: string | null;
392
+ }
393
+ /**
394
+ * `POST /domains/validate` — a report answering "is this name usable, and if
395
+ * not, why".
396
+ *
397
+ * An unusable name is a legitimate ANSWER, not a failure, so this is a 200 and
398
+ * the verdict rides the body. `reason` was named `error` until 2026-07-29,
399
+ * which collided with {@link ErrorResponse}'s reserved key — there `error` is
400
+ * an `ErrorType` a client branches on, here it is prose a client displays, and
401
+ * one key cannot mean both. See {@link DeploymentDeleteResponse} for the law.
166
402
  */
167
403
  export interface DomainValidateResponse {
168
404
  /** Whether the domain is valid */
@@ -171,15 +407,17 @@ export interface DomainValidateResponse {
171
407
  normalized: string | null;
172
408
  /** Whether the domain is available, null when invalid */
173
409
  available: boolean | null;
174
- /** Error message, null when valid */
175
- error: string | null;
410
+ /** Why the name is unusable, null when valid — displayed verbatim. */
411
+ reason: string | null;
176
412
  }
177
413
  /**
178
- * Token as returned by the list endpoint.
179
- * The secret is shown once at creation and never again — listings carry
180
- * only the management identifier and lifecycle metadata.
414
+ * Core deploy token object - used in both API responses and SDK.
415
+ *
416
+ * The secret is never here: it is shown once at creation
417
+ * ({@link TokenCreateResponse.secret}) and never again, so an entity read
418
+ * carries only the management identifier and lifecycle metadata.
181
419
  */
182
- export interface TokenListItem {
420
+ export interface Token {
183
421
  /** 7-char management identifier (e.g., "a1b2c3d") */
184
422
  readonly token: string;
185
423
  /** Labels for categorization and filtering. Always present, empty array when none. */
@@ -194,24 +432,28 @@ export interface TokenListItem {
194
432
  /**
195
433
  * Response for listing tokens
196
434
  */
197
- export interface TokenListResponse {
198
- /** Array of tokens (security-redacted for list display) */
199
- tokens: TokenListItem[];
200
- /** Cursor for pagination, null if no more pages */
201
- cursor: string | null;
435
+ export interface TokenListResponse extends ListResponse {
436
+ /** Array of tokens (the secret is never among them) */
437
+ tokens: Token[];
202
438
  }
203
439
  /**
204
- * Response for token creation
440
+ * Response from token creation. Extends Token with the one field that
441
+ * exists only on creation — the same shape as
442
+ * {@link DeploymentCreateResponse}, because a 201 returns the resource it
443
+ * created plus whatever is knowable only once.
205
444
  */
206
- export interface TokenCreateResponse {
207
- /** 7-char management identifier */
208
- token: string;
445
+ export interface TokenCreateResponse extends Token {
209
446
  /** The raw credential value (shown once at creation, then never again) */
210
- secret: string;
211
- /** Labels for categorization and filtering. Always present, empty array when none. */
212
- labels: string[];
213
- /** Unix timestamp (seconds) when token expires, null for never */
214
- expires: number | null;
447
+ readonly secret: string;
448
+ }
449
+ /**
450
+ * Acknowledgement of `DELETE /tokens/:token`. The credential is revoked and
451
+ * its row is gone, so the management identifier is the whole answer. See
452
+ * {@link DeploymentDeleteResponse} for the law.
453
+ */
454
+ export interface TokenDeleteResponse {
455
+ /** The 7-char management identifier that was revoked */
456
+ readonly token: string;
215
457
  }
216
458
  /**
217
459
  * Account plan constants
@@ -302,6 +544,35 @@ export interface AccountGetResponse extends Account {
302
544
  /** Present only during read-only admin impersonation: the operator's account id. */
303
545
  readonly impersonatedBy?: string;
304
546
  }
547
+ /**
548
+ * Acknowledgement of `DELETE /account` (202). Termination is asynchronous —
549
+ * a cleanup consumer finishes the job — so the account survives long enough
550
+ * to state the plan it is transitioning through. `plan` is the account's
551
+ * state field, the way `status` is a deployment's. See
552
+ * {@link DeploymentDeleteResponse} for the law.
553
+ */
554
+ export interface AccountDeleteResponse {
555
+ /** The account that was marked for termination */
556
+ readonly account: string;
557
+ /** The plan the account is in while cleanup runs */
558
+ readonly plan: AccountPlanType;
559
+ }
560
+ /**
561
+ * Response from `PUT /account/key` — the account's single API key, minted in
562
+ * place of whatever was there before.
563
+ *
564
+ * There is no entity to return: only the key's last-4 `hint` is durable
565
+ * (`Account.hint`), and the plaintext exists exactly once, in this response.
566
+ * The raw credential is `secret` on every surface that mints one — the same
567
+ * field `TokenCreateResponse` carries — because one concept gets one name.
568
+ *
569
+ * A report: it answers a question and carries only the answer (`CLAUDE.md`,
570
+ * "A report answers a question").
571
+ */
572
+ export interface AccountKeyResponse {
573
+ /** The raw API key (shown once at mint, then never again) */
574
+ readonly secret: string;
575
+ }
305
576
  /**
306
577
  * Account-specific configuration overrides
307
578
  * Allows per-account customization of limits without changing plan
@@ -318,6 +589,97 @@ export interface AccountOverrides {
318
589
  /** Override for maximum total deployment size in bytes */
319
590
  totalSize?: number;
320
591
  }
592
+ /**
593
+ * Every path the public API answers on, declared once.
594
+ *
595
+ * The URL surface was written out in four places — the API's mounts, the
596
+ * SDK's client, the dashboard's client, and the post-deploy smoke — so a
597
+ * rename meant finding all four. The first three now read this table.
598
+ *
599
+ * The smoke (`cloudflare/api/smoke.mjs`) deliberately still spells its own:
600
+ * five of its nine paths are `/admin/*`, which this table excludes by
601
+ * design, and splitting one list between a registry and literals reads worse
602
+ * than keeping it uniform.
603
+ *
604
+ * **What this guarantees, exactly.** Collection paths are mounted from here,
605
+ * so producer and consumer cannot diverge. Item paths are declared here and
606
+ * consumed by clients, but the API spells them relative to their mount
607
+ * (`/:deployment/config`), so the table does not *generate* them — it is
608
+ * held to them by `api/tests/architecture/api-paths.test.ts`, which fails if
609
+ * any entry names a path no route answers. Some entries have no client yet
610
+ * (`DEPLOYMENT_CONFIG`, `DOMAIN_PROPAGATION` — endpoints the SDK
611
+ * deliberately does not reach); the fence is what keeps those honest rather
612
+ * than merely asserted.
613
+ *
614
+ * **The operator surface is deliberately absent.** `/admin/*` paths belong
615
+ * to `web/my`, for the same reason its row types do: this package is
616
+ * published, and the operator surface is not public (see `CLAUDE.md`, "Admin
617
+ * types"). A path here is a promise to every npm consumer; `/admin` is a
618
+ * promise to one dashboard.
619
+ *
620
+ * Item paths are functions rather than templates so the key is interpolated
621
+ * in one place, encoded the same way by every caller.
622
+ */
623
+ export declare const API_PATHS: {
624
+ readonly DEPLOYMENTS: "/deployments";
625
+ readonly DEPLOYMENT: (deployment: string) => string;
626
+ readonly DEPLOYMENT_CONFIG: (deployment: string) => string;
627
+ readonly DOMAINS: "/domains";
628
+ readonly DOMAIN: (domain: string) => string;
629
+ readonly DOMAIN_VERIFY: (domain: string) => string;
630
+ readonly DOMAIN_DNS: (domain: string) => string;
631
+ readonly DOMAIN_RECORDS: (domain: string) => string;
632
+ readonly DOMAIN_SHARE: (domain: string) => string;
633
+ readonly DOMAIN_PROPAGATION: (domain: string) => string;
634
+ readonly DOMAINS_VALIDATE: "/domains/validate";
635
+ readonly TOKENS: "/tokens";
636
+ readonly TOKEN: (token: string) => string;
637
+ readonly ACCOUNT: "/account";
638
+ readonly ACCOUNT_KEY: "/account/key";
639
+ readonly ACCOUNT_CLAIM: "/account/claim";
640
+ readonly ACTIVITIES: "/activities";
641
+ readonly LABELS: "/labels";
642
+ readonly LIMITS: "/limits";
643
+ readonly PING: "/ping";
644
+ readonly SETUP: "/setup";
645
+ readonly SPA_CHECK: "/spa-check";
646
+ readonly UPLOAD: "/upload";
647
+ };
648
+ /**
649
+ * The deploy request's multipart field names — the other half of the wire
650
+ * surface beside {@link API_PATHS}. `POST /deployments` (and the first-party
651
+ * `/upload`) is multipart/form-data, and these are the names the API reads.
652
+ *
653
+ * Declared once because the body has three independent WRITERS — the SDK's
654
+ * Node and browser body builders, and the n8n community node's hand-rolled
655
+ * client (which cannot import this under n8n Cloud's zero-dependency rule,
656
+ * and fences its restated copy instead) — and until this export every writer
657
+ * restated the strings the API parses, with nothing comparing them.
658
+ *
659
+ * `FILES` carries one entry per file (the API reads it with `getAll`); every
660
+ * other field is single. The `@internal` flags are serialized as the literal
661
+ * string `'true'` and belong to first-party surfaces only.
662
+ */
663
+ export declare const DEPLOY_FIELDS: {
664
+ /** One entry per file — read with `getAll`. */
665
+ readonly FILES: "files[]";
666
+ /** JSON array of MD5 hex digests, index-aligned with `FILES`. */
667
+ readonly CHECKSUMS: "checksums";
668
+ /** JSON array of label strings. */
669
+ readonly LABELS: "labels";
670
+ /** The deploying surface's {@link DeploymentVia} member. */
671
+ readonly VIA: "via";
672
+ /** Plaintext password — the API hashes it server-side. */
673
+ readonly PASSWORD: "password";
674
+ /** @internal Server-processing flag — first-party `/upload` only. */
675
+ readonly BUILD: "build";
676
+ /** @internal Server-processing flag — first-party `/upload` only. */
677
+ readonly PRERENDER: "prerender";
678
+ /** @internal Server-processing flag — first-party `/upload` only. */
679
+ readonly SPA: "spa";
680
+ /** @internal reCAPTCHA proof — `web/www`'s public uploader only. */
681
+ readonly CAPTCHA: "captcha";
682
+ };
321
683
  /**
322
684
  * All possible error types in the ShipStatic platform.
323
685
  *
@@ -328,7 +690,15 @@ export interface AccountOverrides {
328
690
  * (`DeploymentStatus`, `DomainStatus`, `AccountPlan`, `AuthMethod`) follow.
329
691
  */
330
692
  export declare const ErrorType: {
331
- /** Validation failed (400). Input shape is wrong. */
693
+ /**
694
+ * Validation failed. Input shape is wrong.
695
+ *
696
+ * Carries 400 when an API judged it — including a client-side pre-check of a
697
+ * rule the server enforces too, which keeps the error identical wherever it
698
+ * was caught. **Statusless** when a client rejects something no API judges,
699
+ * such as a CLI's own command grammar: `status` is documented "(API
700
+ * contexts)" on `ErrorResponse`, so there is none to report.
701
+ */
332
702
  readonly Validation: "validation_failed";
333
703
  /** Resource not found (404). */
334
704
  readonly NotFound: "not_found";
@@ -342,6 +712,17 @@ export declare const ErrorType: {
342
712
  readonly Business: "business_logic_error";
343
713
  /** API server error (500). Generic server-side fault. */
344
714
  readonly Api: "internal_server_error";
715
+ /**
716
+ * The platform is closed for maintenance (503). A deliberate operator
717
+ * state, not a fault — nothing errored; the API is refusing work on
718
+ * purpose, and deployed sites keep serving throughout.
719
+ *
720
+ * Distinct from `Api` at 503, which the platform already uses for a
721
+ * dependency that failed (moderation unavailable). A consumer has to tell
722
+ * "we closed the door" from "something broke": the two get opposite words
723
+ * and opposite retry behaviour.
724
+ */
725
+ readonly Maintenance: "maintenance";
345
726
  /** Network/connection error. Client-side only — set by HTTP clients on fetch failure; never produced server-side. */
346
727
  readonly Network: "network_error";
347
728
  /** Operation was cancelled. Client-side only — set on `AbortSignal` abort; never produced server-side. */
@@ -408,7 +789,8 @@ export declare class ShipError extends Error {
408
789
  * Routing:
409
790
  * - Already a `ShipError` → returned as-is (caller's intent preserved)
410
791
  * - `AbortError` → `ShipError.cancelled(...)`
411
- * - `TypeError` whose message mentions "fetch" → `ShipError.network(...)`
792
+ * - A transport failure → `ShipError.network(...)` — see `isTransportFailure`
793
+ * for what each runtime offers as evidence
412
794
  * - Any other `Error` → `ShipError(Api, ...)` (no HTTP status — fetch never reached the server)
413
795
  * - Anything else (string, undefined, etc.) → `ShipError(Api, ...)`
414
796
  *
@@ -441,6 +823,16 @@ export declare class ShipError extends Error {
441
823
  static file(message: string, details?: unknown): ShipError;
442
824
  static config(message: string, details?: unknown): ShipError;
443
825
  static api(message: string, status?: number, details?: unknown): ShipError;
826
+ /**
827
+ * The platform is closed for maintenance (503).
828
+ *
829
+ * `message` is REQUIRED and has no default here. The API is the only
830
+ * producer of that sentence, and a default in this file would be a second
831
+ * owner of one fact — see CLAUDE.md, "The Constellation Law" (stopping
832
+ * rule). It is also the one factory whose status is fixed rather than
833
+ * defaulted: a maintenance refusal is 503 or it is not this error.
834
+ */
835
+ static maintenance(message: string, details?: unknown): ShipError;
444
836
  /**
445
837
  * The caller is at fault — by HTTP's own definition of a 4xx, or by a type
446
838
  * that is client-attributable without ever having a status (`Config`,
@@ -479,6 +871,9 @@ export declare function isShipError(error: unknown): error is ShipError;
479
871
  *
480
872
  * These are the *platform's* posted caps for the current account — server
481
873
  * truth delivered at runtime, never hard-coded on the client.
874
+ *
875
+ * A report: it answers a question and carries only the answer (`CLAUDE.md`,
876
+ * "A report answers a question").
482
877
  */
483
878
  export interface PlatformLimits {
484
879
  /** Maximum size in bytes for a single file. */
@@ -512,6 +907,28 @@ export declare const BLOCKED_EXTENSIONS: ReadonlySet<string>;
512
907
  * isBlockedExtension('README') // false
513
908
  */
514
909
  export declare function isBlockedExtension(filename: string): boolean;
910
+ /**
911
+ * The `accept` attribute value for a browser file picker offering web files.
912
+ *
913
+ * **This is a hint, never a rule.** `BLOCKED_EXTENSIONS` is the platform's
914
+ * gate and the only thing that decides what may be hosted; this constant
915
+ * decides what a *file dialog* shows first. The two are not two halves of one
916
+ * policy, and this one must never be consulted to accept or reject a file.
917
+ *
918
+ * The distinction is structural, not stylistic. `accept` can express only an
919
+ * allowlist, while the platform's rule is a blocklist — so this list is
920
+ * necessarily *narrower* than what the platform hosts, and reading it as
921
+ * authority would reject files the platform serves happily. It is also not
922
+ * enforcement in the browser's own terms: every file dialog offers an
923
+ * all-files escape, and **drag-and-drop ignores `accept` entirely**. The
924
+ * dropzone and the picker must reach the same verdict on the same files, and
925
+ * they do — because the verdict is `validateFiles`, downstream of both.
926
+ *
927
+ * Kept beside `BLOCKED_EXTENSIONS` so one file holds both, which is what lets
928
+ * `tests/validation-constants.test.ts` fence the invariant that matters: the
929
+ * picker must never offer a file the platform will refuse.
930
+ */
931
+ export declare const WEB_FILE_ACCEPT: string;
515
932
  /**
516
933
  * Characters that are unsafe in filenames for static hosting.
517
934
  *
@@ -549,13 +966,20 @@ export declare const UNBUILT_PROJECT_MARKERS: ReadonlySet<string>;
549
966
  */
550
967
  export declare function hasUnbuiltMarker(filePath: string): boolean;
551
968
  /**
552
- * Simple ping response for health checks
969
+ * `GET /ping` a report of the server clock.
970
+ *
971
+ * Liveness is the STATUS CODE's answer, not a field's: a 200 means reachable,
972
+ * and any other outcome throws before a body is read. So the body carries the
973
+ * one thing a status code cannot — the server's own clock, which is what lets a
974
+ * client detect skew against a token expiry. It read `{ success: true,
975
+ * timestamp? }` until 2026-07-29, where `success` was a literal constant in the
976
+ * route (zero bits, and the platform's own named anti-pattern) while the field
977
+ * that IS the payload was optional. See {@link DeploymentDeleteResponse} for
978
+ * the law, and `tests/response-shapes.test.ts` for the fence that holds it.
553
979
  */
554
980
  export interface PingResponse {
555
- /** Always true if service is healthy */
556
- success: boolean;
557
981
  /** Server time in unix seconds — the one wire unit for timestamps. */
558
- timestamp?: number;
982
+ readonly timestamp: number;
559
983
  }
560
984
  /**
561
985
  * Where human identity is mounted on the API host. The API mounts Better
@@ -677,6 +1101,26 @@ export declare const SPA_DEFAULT_CONFIG: {
677
1101
  readonly destination: "/index.html";
678
1102
  }];
679
1103
  };
1104
+ /**
1105
+ * The `/spa-check` pre-flight's client-side envelope: which file is the
1106
+ * check's subject, and how large it may be before a client skips the call.
1107
+ *
1108
+ * One fact with three holders until this export — the API's config declared
1109
+ * the cap, the SDK's `checkSPA` hardcoded `100 * 1024`, and prose restated
1110
+ * "100KB". `INDEX_FILE` is the selection rule (the file whose content rides
1111
+ * `SPACheckRequest.index`), restated by every client that builds the request.
1112
+ *
1113
+ * Neither member is a validation boundary: a client over the cap simply
1114
+ * skips the pre-flight, because the server answers an oversized index
1115
+ * `isSPA: false` anyway. A consumer that cannot import this (n8n) needs no
1116
+ * size copy at all — outcome parity is the server's, not the client's.
1117
+ */
1118
+ export declare const SPA_CHECK_CONSTRAINTS: {
1119
+ /** The file whose content is the check's subject. */
1120
+ readonly INDEX_FILE: "index.html";
1121
+ /** Skip the pre-flight above this size — the server would answer false. */
1122
+ readonly MAX_INDEX_BYTES: number;
1123
+ };
680
1124
  /**
681
1125
  * Assert that a ship.json file is *syntactically* loadable. Syntax only —
682
1126
  * never schema.
@@ -749,16 +1193,26 @@ export interface SPACheckRequest {
749
1193
  /**
750
1194
  * Response from SPA check endpoint
751
1195
  */
1196
+ /**
1197
+ * Which of the classifier's tiers reached the verdict, and why. Named rather
1198
+ * than inline so the API's own `checkSPA` can return `SPACheckResponse`
1199
+ * instead of restating its shape.
1200
+ */
1201
+ export interface SPACheckDebug {
1202
+ /** Which tier made the detection */
1203
+ tier: 'exclusions' | 'inclusions' | 'scoring' | 'ai' | 'fallback';
1204
+ /** The reason for the detection result */
1205
+ reason: string;
1206
+ }
1207
+ /**
1208
+ * A report: it answers a question and carries only the answer (`CLAUDE.md`,
1209
+ * "A report answers a question").
1210
+ */
752
1211
  export interface SPACheckResponse {
753
1212
  /** Whether the project is detected as a Single Page Application */
754
1213
  isSPA: boolean;
755
1214
  /** Debugging information about detection */
756
- debug: {
757
- /** Which tier made the detection: 'exclusions', 'inclusions', 'scoring', 'ai', or 'fallback' */
758
- tier: 'exclusions' | 'inclusions' | 'scoring' | 'ai' | 'fallback';
759
- /** The reason for the detection result */
760
- reason: string;
761
- };
1215
+ debug: SPACheckDebug;
762
1216
  }
763
1217
  /**
764
1218
  * Represents a file that has been processed and is ready for deploy.
@@ -791,6 +1245,50 @@ export interface StaticFile {
791
1245
  }
792
1246
  /** Default API URL if not otherwise configured. */
793
1247
  export declare const DEFAULT_API = "https://api.shipstatic.com";
1248
+ /**
1249
+ * The Node SDK's ambient configuration pair — the ONLY environment variables
1250
+ * the SDK reads, and therefore the COMPLETE list an embedding host must
1251
+ * scrub (per `npm/ship`'s strict-isolation contract, scrubbing is the host's
1252
+ * job, not the SDK's). A host that derives its scrub from this object's
1253
+ * values — as the VS Code extension's child-process env block does — picks
1254
+ * up a grown contract at the next pin bump instead of by remembered prose.
1255
+ *
1256
+ * Browser builds read no environment at all, and the CLI-only variables
1257
+ * (`SHIP_PASSWORD`, `SHIP_VIA`) are deliberately NOT here: they are the
1258
+ * CLI's operational levers, not the SDK's ambient contract — see
1259
+ * `npm/ship/CLAUDE.md`, "CLI-only env vars".
1260
+ */
1261
+ export declare const SHIP_ENV: {
1262
+ /** The one credential slot — any platform token. */
1263
+ readonly TOKEN: "SHIP_TOKEN";
1264
+ /** The API endpoint override. */
1265
+ readonly API_URL: "SHIP_API_URL";
1266
+ };
1267
+ /**
1268
+ * Where a human creates an API key — the console deep link quoted by every
1269
+ * surface that teaches authentication (the CLI's config wizard, the VS Code
1270
+ * and n8n listings, the n8n rate-limit hint and credential copy). Written
1271
+ * out in five files across three repos until this export.
1272
+ *
1273
+ * Production-branded by design: published artifacts name the product, never
1274
+ * an environment (root `CLAUDE.md`, "Environment-Aware URLs").
1275
+ */
1276
+ export declare const MY_API_KEY_URL = "https://my.shipstatic.com/api-key";
1277
+ /**
1278
+ * How long an anonymous deployment lives before it expires.
1279
+ *
1280
+ * The lifetime of the public tier, and one fact with several readers. The API
1281
+ * stamps a deployment's `expires` from it and gives a claim code exactly the
1282
+ * same window — a live site with a dead claim link is a coherence bug, so the
1283
+ * two are one constant rather than two that agree. Both MCP transports quote
1284
+ * the duration in prose an agent reads, and derive it from here rather than
1285
+ * writing it out, which they did in eight places until this export existed.
1286
+ *
1287
+ * Seconds, spelled in the name: this platform has both second- and
1288
+ * millisecond-valued durations, and the pair is only safe when each says which
1289
+ * it is.
1290
+ */
1291
+ export declare const PUBLIC_DEPLOYMENT_TTL_SECONDS: number;
794
1292
  /**
795
1293
  * Universal deploy input — the union of every shape the SDK accepts.
796
1294
  *
@@ -809,8 +1307,12 @@ export type DeployInput = File[] | string | string[];
809
1307
  export interface DeploymentUploadOptions {
810
1308
  /** Optional labels for categorization and filtering */
811
1309
  labels?: string[];
812
- /** Client identifier (e.g., 'cli', 'sdk', 'web') */
813
- via?: string;
1310
+ /**
1311
+ * Which client is making this deploy. Closed, because the server silently
1312
+ * ignores anything outside the set — so an unchecked string turned a typo
1313
+ * into missing analytics rather than an error. See {@link DeploymentVia}.
1314
+ */
1315
+ via?: DeploymentViaType;
814
1316
  /**
815
1317
  * Optional password that protects this deployment.
816
1318
  *
@@ -830,28 +1332,52 @@ export interface DeploymentUploadOptions {
830
1332
  spa?: boolean;
831
1333
  /** @internal reCAPTCHA proof for the anonymous human deploy channel. Only available via /upload endpoint. */
832
1334
  captcha?: string;
1335
+ /**
1336
+ * Makes this deploy replayable instead of repeatable.
1337
+ *
1338
+ * A deploy is not naturally idempotent: a client-side timeout on a slow
1339
+ * one leaves the caller unable to tell "it never landed" from "it landed
1340
+ * and the response was lost", and retrying produces a second deployment.
1341
+ * Send the same key on the retry and the platform replays the original
1342
+ * 201 verbatim rather than creating anything
1343
+ * ({@link IDEMPOTENCY_KEY_CONSTRAINTS.WINDOW_SECONDS}).
1344
+ *
1345
+ * **Agents are the audience.** A human notices a duplicate; an automated
1346
+ * retry does not. Pick a key that identifies the ATTEMPT — a run id, a
1347
+ * commit sha, a uuid minted before the first try — never one minted fresh
1348
+ * on each retry, which would defeat the point.
1349
+ *
1350
+ * The replay is per-caller, and it stores successes only: a failed deploy
1351
+ * retries fresh under the same key.
1352
+ */
1353
+ idempotencyKey?: string;
833
1354
  }
834
1355
  /**
835
- * Pagination options for every list endpoint. The response's `cursor` feeds
836
- * the next request; a `null` cursor means the last page. Omitting both
837
- * returns the server's default first page.
1356
+ * What a caller may change on an existing deployment.
838
1357
  *
839
- * A list answers `{ <collection>, cursor }` and nothing else `cursor`
840
- * carries the entire has-more signal, so no redundant boolean, and no
841
- * `total`. **A count is an aggregate over a collection, not a property of a
842
- * page:** including one makes every read pay for a full scan it did not ask
843
- * for, which is precisely the cost keyset pagination exists to avoid.
1358
+ * Labels and nothing else: a deployment's content is immutable by design, so
1359
+ * this is the whole mutable surface rather than a subset someone chose.
1360
+ */
1361
+ export interface DeploymentSetOptions {
1362
+ labels: string[];
1363
+ }
1364
+ /**
1365
+ * What `domains.set()` may create or change. Every field is optional because
1366
+ * the call is a natural-key upsert: omitting `deployment` reserves the
1367
+ * domain, naming one links or re-points it, and labels travel either way.
844
1368
  *
845
- * Counts therefore live on the summary resource that owns them —
846
- * `GET /account` (`usage`) for a caller's own totals, `GET /admin/stats` for
847
- * platform-wide ones. Ask for a count when you want a count; ask for a page
848
- * when you want a page.
1369
+ * `deployment` is deliberately not nullable unlinking is refused (400).
1370
+ * See `npm/ship/CLAUDE.md`, "Domain Write Semantics".
849
1371
  */
850
- export interface ListOptions {
851
- /** Maximum number of items to return in one page. */
852
- limit?: number;
853
- /** Opaque cursor from the previous page's response. */
854
- cursor?: string;
1372
+ export interface DomainSetOptions {
1373
+ deployment?: string;
1374
+ labels?: string[];
1375
+ }
1376
+ /** What a caller may set when minting a deploy token. */
1377
+ export interface TokenCreateOptions {
1378
+ /** Seconds until expiry; omit for a token that never expires. */
1379
+ ttl?: number;
1380
+ labels?: string[];
855
1381
  }
856
1382
  /**
857
1383
  * Deployment resource interface - the contract all implementations must follow.
@@ -865,32 +1391,22 @@ export interface DeploymentResource<UploadOptions extends DeploymentUploadOption
865
1391
  upload: (input: DeployInput, options?: UploadOptions) => Promise<DeploymentCreateResponse>;
866
1392
  list: (options?: ListOptions) => Promise<DeploymentListResponse>;
867
1393
  get: (id: string) => Promise<Deployment>;
868
- set: (id: string, options: {
869
- labels: string[];
870
- }) => Promise<Deployment>;
871
- remove: (id: string) => Promise<void>;
1394
+ set: (id: string, options: DeploymentSetOptions) => Promise<Deployment>;
1395
+ delete: (id: string) => Promise<DeploymentDeleteResponse>;
872
1396
  }
873
1397
  /**
874
1398
  * Domain resource interface - the contract all implementations must follow
875
1399
  */
876
1400
  export interface DomainResource {
877
- set: (name: string, options?: {
878
- deployment?: string;
879
- labels?: string[];
880
- }) => Promise<DomainSetResult>;
1401
+ set: (name: string, options?: DomainSetOptions) => Promise<DomainSetResult>;
881
1402
  list: (options?: ListOptions) => Promise<DomainListResponse>;
882
1403
  get: (name: string) => Promise<Domain>;
883
- remove: (name: string) => Promise<void>;
884
- verify: (name: string) => Promise<{
885
- message: string;
886
- }>;
1404
+ delete: (name: string) => Promise<DomainDeleteResponse>;
1405
+ verify: (name: string) => Promise<DomainVerifyResponse>;
887
1406
  validate: (name: string) => Promise<DomainValidateResponse>;
888
1407
  dns: (name: string) => Promise<DomainDnsResponse>;
889
1408
  records: (name: string) => Promise<DomainRecordsResponse>;
890
- share: (name: string) => Promise<{
891
- domain: string;
892
- hash: string;
893
- }>;
1409
+ share: (name: string) => Promise<DomainShareResponse>;
894
1410
  }
895
1411
  /**
896
1412
  * Account resource interface - the contract all implementations must follow
@@ -902,12 +1418,10 @@ export interface AccountResource {
902
1418
  * Token resource interface - the contract all implementations must follow
903
1419
  */
904
1420
  export interface TokenResource {
905
- create: (options?: {
906
- ttl?: number;
907
- labels?: string[];
908
- }) => Promise<TokenCreateResponse>;
1421
+ create: (options?: TokenCreateOptions) => Promise<TokenCreateResponse>;
909
1422
  list: (options?: ListOptions) => Promise<TokenListResponse>;
910
- remove: (token: string) => Promise<void>;
1423
+ get: (token: string) => Promise<Token>;
1424
+ delete: (token: string) => Promise<TokenDeleteResponse>;
911
1425
  }
912
1426
  /**
913
1427
  * Billing status response from GET /billing/status
@@ -927,6 +1441,25 @@ export interface BillingStatus {
927
1441
  /** Link to Creem customer portal for billing management, null if unavailable */
928
1442
  portal: string | null;
929
1443
  }
1444
+ /**
1445
+ * Acknowledgement of `POST /billing/cancel`.
1446
+ *
1447
+ * Cancelling leaves no billing entity to return, so it answers with the
1448
+ * account and the one field of the account the call changed — the plan it
1449
+ * landed on. See {@link DeploymentDeleteResponse} for the law.
1450
+ *
1451
+ * This read `{ success: true, message: 'Subscription canceled successfully…' }`
1452
+ * until 2026-07-29, an anonymous shape that `web/my` redeclared inline and
1453
+ * whose prose no surface ever displayed: both callers await the promise and
1454
+ * discard the body, then compose their own toast. The message was written,
1455
+ * serialized, and thrown away on every cancellation.
1456
+ */
1457
+ export interface BillingCancelResponse {
1458
+ /** The account whose subscription was cancelled */
1459
+ readonly account: string;
1460
+ /** The plan the account now holds — `free` on a successful cancellation */
1461
+ readonly plan: AccountPlanType;
1462
+ }
930
1463
  /**
931
1464
  * Checkout session response from POST /billing/checkout
932
1465
  */
@@ -1001,11 +1534,9 @@ export interface ActivityMeta {
1001
1534
  /**
1002
1535
  * Response from GET /activities endpoint
1003
1536
  */
1004
- export interface ActivityListResponse {
1537
+ export interface ActivityListResponse extends ListResponse {
1005
1538
  /** Array of activities */
1006
1539
  activities: Activity[];
1007
- /** Cursor for pagination, null if no more pages */
1008
- cursor: string | null;
1009
1540
  }
1010
1541
  /**
1011
1542
  * File status constants for validation state tracking