@shipstatic/ship 2.0.0-beta.2 → 2.0.0-beta.3

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.cts CHANGED
@@ -258,6 +258,13 @@ interface Account {
258
258
  readonly activated: number | null;
259
259
  /** Last 4 characters of the API key for identification, null when no key generated */
260
260
  readonly hint: string | null;
261
+ /**
262
+ * Unix timestamp (seconds) of the API key's last use, null when never
263
+ * used or no key generated. Optional on the type by the additive-evolution
264
+ * law: published SDK versions may predate the field, so consumers read it
265
+ * when present rather than forcing a lockstep SDK release.
266
+ */
267
+ readonly used?: number | null;
261
268
  /** Grace period expiration (unix seconds), null if no grace period active */
262
269
  readonly grace: number | null;
263
270
  }
@@ -515,9 +522,17 @@ declare function hasUnbuiltMarker(filePath: string): boolean;
515
522
  interface PingResponse {
516
523
  /** Always true if service is healthy */
517
524
  success: boolean;
518
- /** Optional timestamp */
525
+ /** Server time in unix seconds — the one wire unit for timestamps. */
519
526
  timestamp?: number;
520
527
  }
528
+ /**
529
+ * Where human identity is mounted on the API host. The API mounts Better
530
+ * Auth at this path (sign-in, sign-out, session reads, admin impersonation)
531
+ * and the web console's auth client posts to it — shared here so the two
532
+ * halves of the auth pair agree by construction, the same way both sides
533
+ * already share the credential prefixes below.
534
+ */
535
+ declare const AUTH_BASE_PATH = "/auth";
521
536
  /**
522
537
  * How a request (or recorded activity) was authorized.
523
538
  *
@@ -712,20 +727,6 @@ interface StaticFile {
712
727
  /** The size of the file in bytes. */
713
728
  size: number;
714
729
  }
715
- /**
716
- * Progress information for deploy/upload operations.
717
- * Provides consistent percentage-based progress with byte-level details.
718
- */
719
- interface ProgressInfo {
720
- /** Progress percentage (0-100) */
721
- percent: number;
722
- /** Number of bytes loaded so far */
723
- loaded: number;
724
- /** Total number of bytes to load. May be 0 if unknown initially */
725
- total: number;
726
- /** Current file being processed (optional) */
727
- file?: string;
728
- }
729
730
  /** Default API URL if not otherwise configured. */
730
731
  declare const DEFAULT_API = "https://api.shipstatic.com";
731
732
  /**
@@ -769,11 +770,28 @@ interface DeploymentUploadOptions {
769
770
  captcha?: string;
770
771
  }
771
772
  /**
772
- * Deployment resource interface - the contract all implementations must follow
773
+ * Pagination options for the paginated list endpoints (`GET /deployments`,
774
+ * `GET /domains`). The response's `cursor` feeds the next request; a `null`
775
+ * cursor on the response means the last page. Omitting both returns the
776
+ * server's default first page.
773
777
  */
774
- interface DeploymentResource {
775
- upload: (input: DeployInput, options?: DeploymentUploadOptions) => Promise<DeploymentCreateResponse>;
776
- list: () => Promise<DeploymentListResponse>;
778
+ interface ListOptions {
779
+ /** Maximum number of items to return in one page. */
780
+ limit?: number;
781
+ /** Opaque cursor from the previous page's response. */
782
+ cursor?: string;
783
+ }
784
+ /**
785
+ * Deployment resource interface - the contract all implementations must follow.
786
+ *
787
+ * The interface defines the minimal wire contract; SDK implementations may
788
+ * extend the upload options with runtime concerns (timeout, signal, progress
789
+ * callbacks) by parameterizing: `DeploymentResource<MyUploadOptions>`. The
790
+ * default keeps plain `DeploymentResource` valid for wire-only consumers.
791
+ */
792
+ interface DeploymentResource<UploadOptions extends DeploymentUploadOptions = DeploymentUploadOptions> {
793
+ upload: (input: DeployInput, options?: UploadOptions) => Promise<DeploymentCreateResponse>;
794
+ list: (options?: ListOptions) => Promise<DeploymentListResponse>;
777
795
  get: (id: string) => Promise<Deployment>;
778
796
  set: (id: string, options: {
779
797
  labels: string[];
@@ -788,7 +806,7 @@ interface DomainResource {
788
806
  deployment?: string;
789
807
  labels?: string[];
790
808
  }) => Promise<DomainSetResult>;
791
- list: () => Promise<DomainListResponse>;
809
+ list: (options?: ListOptions) => Promise<DomainListResponse>;
792
810
  get: (name: string) => Promise<Domain>;
793
811
  remove: (name: string) => Promise<void>;
794
812
  verify: (name: string) => Promise<{
@@ -848,11 +866,11 @@ interface CheckoutSession {
848
866
  * All activity event types logged in the system.
849
867
  * Uses dot notation consistently: {resource}.{action}
850
868
  */
851
- type ActivityEvent = 'account.create' | 'account.update' | 'account.delete' | 'account.key.generate' | 'account.plan.paid' | 'account.plan.transition' | 'account.suspended' | 'deployment.create' | 'deployment.update' | 'deployment.delete' | 'deployment.claim' | 'deployment.flagged' | 'domain.create' | 'domain.update' | 'domain.delete' | 'domain.verify' | 'token.create' | 'token.consume' | 'admin.account.plan.update' | 'admin.account.ref.update' | 'admin.account.billing.update' | 'admin.account.labels.update' | 'admin.deployment.delete' | 'admin.domain.delete' | 'admin.billing.sync' | 'admin.billing.terminated' | 'admin.impersonate' | 'billing.active' | 'billing.canceled' | 'billing.paused' | 'billing.expired' | 'billing.paid' | 'billing.trialing' | 'billing.scheduled_cancel' | 'billing.unpaid' | 'billing.update' | 'billing.past_due' | 'refund.created' | 'dispute.created' | 'billing.sync' | 'billing.stale' | 'billing.race';
869
+ type ActivityEvent = 'account.create' | 'account.update' | 'account.delete' | 'account.key.generate' | 'account.plan.paid' | 'account.plan.transition' | 'account.suspended' | 'deployment.create' | 'deployment.update' | 'deployment.delete' | 'deployment.claim' | 'deployment.flagged' | 'domain.create' | 'domain.update' | 'domain.delete' | 'domain.verify' | 'token.create' | 'token.consume' | 'token.delete' | 'admin.account.plan.update' | 'admin.account.ref.update' | 'admin.account.billing.update' | 'admin.account.labels.update' | 'admin.deployment.delete' | 'admin.domain.delete' | 'admin.billing.sync' | 'admin.billing.terminated' | 'admin.impersonate' | 'billing.active' | 'billing.canceled' | 'billing.paused' | 'billing.expired' | 'billing.paid' | 'billing.trialing' | 'billing.scheduled_cancel' | 'billing.unpaid' | 'billing.update' | 'billing.past_due' | 'refund.created' | 'dispute.created' | 'billing.sync' | 'billing.stale' | 'billing.race';
852
870
  /**
853
871
  * Activity events visible to users in the dashboard
854
872
  */
855
- type UserVisibleActivityEvent = 'account.create' | 'account.update' | 'account.delete' | 'account.key.generate' | 'account.plan.transition' | 'deployment.create' | 'deployment.update' | 'deployment.delete' | 'deployment.claim' | 'domain.create' | 'domain.update' | 'domain.delete' | 'domain.verify' | 'token.create' | 'token.consume';
873
+ type UserVisibleActivityEvent = 'account.create' | 'account.update' | 'account.delete' | 'account.key.generate' | 'account.plan.transition' | 'deployment.create' | 'deployment.update' | 'deployment.delete' | 'deployment.claim' | 'domain.create' | 'domain.update' | 'domain.delete' | 'domain.verify' | 'token.create' | 'token.consume' | 'token.delete';
856
874
  /**
857
875
  * Activity record returned from the API
858
876
  */
@@ -871,6 +889,12 @@ interface Activity {
871
889
  /**
872
890
  * Parsed activity metadata.
873
891
  * Different events populate different fields.
892
+ *
893
+ * Naming convention: meta booleans are event-scoped predicates and carry
894
+ * their prefix (`isUpdate`, `wasVerified`, `hasConfig`, `hasPassword`),
895
+ * while entity booleans are bare nouns (`Deployment.config`,
896
+ * `Deployment.password`). Two vocabularies, each internally consistent —
897
+ * deliberate, not drift.
874
898
  */
875
899
  interface ActivityMeta {
876
900
  /** Number of files in deployment */
@@ -1109,20 +1133,17 @@ declare function validatePassword(value: unknown): string | undefined;
1109
1133
  * Extends the API contract (DeploymentUploadOptions) with SDK-specific options.
1110
1134
  */
1111
1135
  interface DeploymentOptions extends DeploymentUploadOptions {
1112
- /** An AbortSignal to allow cancellation of the deploy operation. */
1136
+ /**
1137
+ * An AbortSignal to allow cancellation of the deploy operation. The one
1138
+ * cancellation mechanism — abort the signal and the request rejects with
1139
+ * a typed `Cancelled` error. Request timeouts are a client concern
1140
+ * (`ShipClientOptions.timeout`), not a per-deploy one.
1141
+ */
1113
1142
  signal?: AbortSignal;
1114
- /** Callback invoked if the deploy is cancelled via the AbortSignal. */
1115
- onCancel?: () => void;
1116
- /** Maximum number of concurrent operations. */
1117
- maxConcurrency?: number;
1118
- /** Timeout in milliseconds for the deploy request. */
1119
- timeout?: number;
1120
1143
  /** Whether to auto-detect and optimize file paths by flattening common directories. Defaults to true. */
1121
1144
  pathDetect?: boolean;
1122
1145
  /** Whether to auto-detect SPAs and generate ship.json configuration. Defaults to true. */
1123
1146
  spaDetect?: boolean;
1124
- /** Callback for deploy progress with detailed statistics. */
1125
- onProgress?: (info: ProgressInfo) => void;
1126
1147
  }
1127
1148
  type ApiDeployOptions = Omit<DeploymentOptions, 'pathDetect'>;
1128
1149
  /**
@@ -1177,7 +1198,7 @@ type Fetch = typeof fetch;
1177
1198
  type TokenProvider = () => string | Promise<string>;
1178
1199
  /**
1179
1200
  * Options for configuring a `Ship` instance.
1180
- * Sets default API host, the client credential, progress callbacks, concurrency, and timeouts for the client.
1201
+ * Sets the API host, the client credential, the request timeout, and the transport.
1181
1202
  */
1182
1203
  interface ShipClientOptions {
1183
1204
  /** Default API URL for the client instance. */
@@ -1198,19 +1219,8 @@ interface ShipClientOptions {
1198
1219
  */
1199
1220
  token?: string | TokenProvider | undefined;
1200
1221
  /**
1201
- * Default callback for deploy progress for deploys made with this client.
1202
- * @param info - Progress information including percentage and byte counts.
1203
- */
1204
- onProgress?: ((info: ProgressInfo) => void) | undefined;
1205
- /**
1206
- * Default for maximum concurrent deploys.
1207
- * Used if an deploy operation doesn't specify its own `maxConcurrency`.
1208
- * Defaults to 4 if not set here or in the specific deploy call.
1209
- */
1210
- maxConcurrency?: number | undefined;
1211
- /**
1212
- * Default timeout in milliseconds for API requests made by this client instance.
1213
- * Used if an deploy operation doesn't specify its own timeout.
1222
+ * Timeout in milliseconds for every API request made by this client
1223
+ * instance. Defaults to 30 seconds.
1214
1224
  */
1215
1225
  timeout?: number | undefined;
1216
1226
  /**
@@ -1277,7 +1287,19 @@ interface ShipEvents {
1277
1287
  request: [url: string, init: RequestInit];
1278
1288
  /** Emitted after successful API response */
1279
1289
  response: [response: Response, url: string];
1280
- /** Emitted when API request fails */
1290
+ /**
1291
+ * Emitted when something fails. TWO populations arrive here, which is why
1292
+ * the type is `Error` and not `ShipError`:
1293
+ *
1294
+ * - a failed request — always a `ShipError` (`executeRequest` normalizes
1295
+ * every failure through `ShipError.fromFetchError` before emitting), so
1296
+ * `isShipError(error)` narrows and `.type` / `.status` are readable;
1297
+ * - a THROWING HANDLER of yours — `SimpleEvents.emit` evicts it and
1298
+ * re-emits the raw failure here, which is a plain `Error`.
1299
+ *
1300
+ * Narrowing this to `ShipError` was tried on 2026-07-27 and reverted: it
1301
+ * made the second population a lie.
1302
+ */
1281
1303
  error: [error: Error, url: string];
1282
1304
  }
1283
1305
 
@@ -1352,12 +1374,12 @@ declare class ApiHttp extends SimpleEvents {
1352
1374
  private safeClone;
1353
1375
  private parseResponse;
1354
1376
  deploy(files: StaticFile[], options?: ApiDeployOptions): Promise<DeploymentCreateResponse>;
1355
- listDeployments(): Promise<DeploymentListResponse>;
1377
+ listDeployments(options?: ListOptions): Promise<DeploymentListResponse>;
1356
1378
  getDeployment(id: string): Promise<Deployment>;
1357
1379
  updateDeploymentLabels(id: string, labels: string[]): Promise<Deployment>;
1358
1380
  removeDeployment(id: string): Promise<void>;
1359
1381
  setDomain(name: string, deployment?: string, labels?: string[]): Promise<DomainSetResult>;
1360
- listDomains(): Promise<DomainListResponse>;
1382
+ listDomains(options?: ListOptions): Promise<DomainListResponse>;
1361
1383
  getDomain(name: string): Promise<Domain>;
1362
1384
  removeDomain(name: string): Promise<void>;
1363
1385
  verifyDomain(name: string): Promise<{
@@ -1395,7 +1417,6 @@ interface ResourceContext {
1395
1417
  */
1396
1418
  interface DeploymentResourceContext extends ResourceContext {
1397
1419
  processInput: (input: DeployInput, options: DeploymentOptions) => Promise<StaticFile[]>;
1398
- clientDefaults?: ShipClientOptions;
1399
1420
  }
1400
1421
  /**
1401
1422
  * Upload deployment resource with all CRUD operations.
@@ -1405,7 +1426,7 @@ interface DeploymentResourceContext extends ResourceContext {
1405
1426
  * public-account agent identity per request (claim URL + expiry on the
1406
1427
  * response). The SDK stays a transparent pipe either way.
1407
1428
  */
1408
- declare function createDeploymentResource(ctx: DeploymentResourceContext): DeploymentResource;
1429
+ declare function createDeploymentResource(ctx: DeploymentResourceContext): DeploymentResource<DeploymentOptions>;
1409
1430
  /**
1410
1431
  * Create domain resource with all CRUD operations.
1411
1432
  *
@@ -1427,7 +1448,7 @@ declare function createTokenResource(ctx: ResourceContext): TokenResource;
1427
1448
  * Abstract base class for Ship SDK implementations.
1428
1449
  */
1429
1450
  declare abstract class Ship$1 {
1430
- readonly deployments: DeploymentResource;
1451
+ readonly deployments: DeploymentResource<DeploymentOptions>;
1431
1452
  readonly domains: DomainResource;
1432
1453
  readonly account: AccountResource;
1433
1454
  readonly tokens: TokenResource;
@@ -1452,7 +1473,7 @@ declare abstract class Ship$1 {
1452
1473
  /**
1453
1474
  * Deploy project (convenience shortcut to `ship.deployments.upload()`).
1454
1475
  */
1455
- deploy(input: DeployInput, options?: DeploymentOptions): Promise<Deployment>;
1476
+ deploy(input: DeployInput, options?: DeploymentOptions): Promise<DeploymentCreateResponse>;
1456
1477
  /**
1457
1478
  * Get current account information (convenience shortcut to `ship.account.get()`).
1458
1479
  */
@@ -1494,30 +1515,6 @@ declare abstract class Ship$1 {
1494
1515
  private getAuthHeaders;
1495
1516
  }
1496
1517
 
1497
- /**
1498
- * @file Cross-platform configuration helpers.
1499
- *
1500
- * One pure helper used by the deployment resource:
1501
- *
1502
- * - `mergeDeployOptions(perCallOptions, clientDefaults)` — overlays
1503
- * instance-level defaults under per-call overrides for a single deploy.
1504
- *
1505
- * Deploy options are pure deploy concerns (progress, timeout, concurrency).
1506
- * Credentials, the API URL, and the caller identifier are client identity —
1507
- * they live on the instance, never per call: one client is one principal
1508
- * speaking for one end user against one API. Callers that need a different
1509
- * identity construct another Ship.
1510
- */
1511
-
1512
- /**
1513
- * Overlay client-level defaults under per-call deploy options.
1514
- *
1515
- * Per-call options always win — they're the explicit override for a single
1516
- * `deployments.upload()`. Defaults fill in only when the per-call option is
1517
- * `undefined` (an explicit `null` / empty value passes through).
1518
- */
1519
- declare function mergeDeployOptions(options: DeploymentOptions, clientDefaults: ShipClientOptions): DeploymentOptions;
1520
-
1521
1518
  /**
1522
1519
  * @file Deploy path optimization - the core logic that makes Ship deployments clean and intuitive.
1523
1520
  * Automatically strips common parent directories to create clean deployment URLs.
@@ -1775,7 +1772,7 @@ declare function pluralize(count: number, singular: string, plural: string, incl
1775
1772
  * @param paths - File or directory paths to scan and process.
1776
1773
  * @param options - Processing options (pathDetect, etc.).
1777
1774
  * @param platformLimits - Per-instance platform limits (file-size / count /
1778
- * total-size caps) from the originating Ship's `GET /config` fetch. Passed
1775
+ * total-size caps) from the originating Ship's `GET /limits` fetch. Passed
1779
1776
  * in rather than read from a module global so concurrent Ships against
1780
1777
  * different API URLs cannot clobber each other's caps.
1781
1778
  * @returns Promise resolving to an array of StaticFile objects.
@@ -1827,9 +1824,12 @@ declare class Ship extends Ship$1 {
1827
1824
  * intentional: the convenience shortcut narrows; the resource-layer
1828
1825
  * contract stays platform-neutral.
1829
1826
  */
1830
- deploy(input: string | string[], options?: DeploymentOptions): Promise<Deployment>;
1827
+ deploy(input: string | string[], options?: DeploymentOptions): Promise<DeploymentCreateResponse>;
1831
1828
  protected processInput(input: DeployInput, options: DeploymentOptions): Promise<StaticFile[]>;
1832
1829
  protected getDeployBodyCreator(): DeployBodyCreator;
1833
1830
  }
1834
1831
 
1835
- export { API_KEY, type Account, type AccountGetResponse, type AccountOverrides, AccountPlan, type AccountPlanType, type AccountResource, type AccountUsage, type Activity, type ActivityEvent, type ActivityListResponse, type ActivityMeta, type ApiDeployOptions, ApiHttp, type ApiHttpOptions, AuthMethod, type AuthMethodType, BLOCKED_EXTENSIONS, type BillingStatus, CALLER, type CheckoutSession, DEFAULT_API, DEPLOYMENT_CONFIG_FILENAME, DEPLOY_TOKEN, type DeployBody, type DeployBodyContext, type DeployBodyCreator, type DeployFile, type DeployInput, type Deployment, type DeploymentCreateResponse, type DeploymentListResponse, type DeploymentOptions, type DeploymentResource, type DeploymentResourceContext, DeploymentStatus, type DeploymentStatusType, type DeploymentUploadOptions, type DnsProvider, type DnsRecord, type DnsRecordType, type Domain, type DomainDnsResponse, type DomainListResponse, type DomainRecordsResponse, type DomainResource, type DomainSetResult, DomainStatus, type DomainStatusType, type DomainValidateResponse, type ErrorResponse, ErrorType, type ExecutionEnvironment, FileValidationStatus as FILE_VALIDATION_STATUS, type Fetch, type FileValidationResult, FileValidationStatus, type FileValidationStatusType, JUNK_DIRECTORIES, LABEL_CONSTRAINTS, LABEL_PATTERN, type MD5Result, OAuthScope, type OAuthScopeType, PASSWORD_CONSTRAINTS, type PingResponse, type PlatformLimits, type ProgressInfo, type ResourceContext, type SPACheckRequest, type SPACheckResponse, SPA_DEFAULT_CONFIG, Ship, type ShipClientOptions, ShipError, type ShipEvents, type StaticFile, type TokenCreateResponse, TokenKind, type TokenKindType, type TokenListItem, type TokenListResponse, type TokenProvider, type TokenResource, UNBUILT_PROJECT_MARKERS, UNSAFE_FILENAME_CHARS, type UploadedFile, type UserVisibleActivityEvent, type ValidatableFile, type ValidationIssue, __setTestEnvironment, allValidFilesReady, calculateMD5, classifyToken, createAccountResource, createDeploymentResource, createDomainResource, createTokenResource, Ship as default, deserializeLabels, extractSubdomain, filterJunk, formatFileSize, generateDeploymentUrl, generateDomainUrl, getENV, getValidFiles, hasUnbuiltMarker, hasUnsafeChars, isBlockedExtension, isCustomDomain, isDeployment, isPlatformDomain, isShipError, mergeDeployOptions, optimizeDeployPaths, pluralize, processFilesForNode, serializeLabels, validateApiKey, validateApiUrl, validateCaller, validateDeployFile, validateDeployPath, validateDeployToken, validateFileName, validateFiles, validatePassword, validateToken };
1832
+ declare namespace Ship {
1833
+ export { API_KEY, AUTH_BASE_PATH, Account, AccountGetResponse, AccountOverrides, AccountPlan, AccountPlanType, AccountResource, AccountUsage, Activity, ActivityEvent, ActivityListResponse, ActivityMeta, ApiDeployOptions, ApiHttp, ApiHttpOptions, AuthMethod, AuthMethodType, BLOCKED_EXTENSIONS, BillingStatus, CALLER, CheckoutSession, DEFAULT_API, DEPLOYMENT_CONFIG_FILENAME, DEPLOY_TOKEN, DeployBody, DeployBodyContext, DeployBodyCreator, DeployFile, DeployInput, Deployment, DeploymentCreateResponse, DeploymentListResponse, DeploymentOptions, DeploymentResource, DeploymentResourceContext, DeploymentStatus, DeploymentStatusType, DeploymentUploadOptions, DnsProvider, DnsRecord, DnsRecordType, Domain, DomainDnsResponse, DomainListResponse, DomainRecordsResponse, DomainResource, DomainSetResult, DomainStatus, DomainStatusType, DomainValidateResponse, ErrorResponse, ErrorType, ExecutionEnvironment, FileValidationStatus as FILE_VALIDATION_STATUS, Fetch, FileValidationResult, FileValidationStatus, FileValidationStatusType, JUNK_DIRECTORIES, LABEL_CONSTRAINTS, LABEL_PATTERN, ListOptions, MD5Result, OAuthScope, OAuthScopeType, PASSWORD_CONSTRAINTS, PingResponse, PlatformLimits, ResourceContext, SPACheckRequest, SPACheckResponse, SPA_DEFAULT_CONFIG, ShipClientOptions, ShipError, ShipEvents, StaticFile, TokenCreateResponse, TokenKind, TokenKindType, TokenListItem, TokenListResponse, TokenProvider, TokenResource, UNBUILT_PROJECT_MARKERS, UNSAFE_FILENAME_CHARS, UploadedFile, UserVisibleActivityEvent, ValidatableFile, ValidationIssue, __setTestEnvironment, allValidFilesReady, calculateMD5, classifyToken, createAccountResource, createDeploymentResource, createDomainResource, createTokenResource, deserializeLabels, extractSubdomain, filterJunk, formatFileSize, generateDeploymentUrl, generateDomainUrl, getENV, getValidFiles, hasUnbuiltMarker, hasUnsafeChars, isBlockedExtension, isCustomDomain, isDeployment, isPlatformDomain, isShipError, optimizeDeployPaths, pluralize, processFilesForNode, serializeLabels, validateApiKey, validateApiUrl, validateCaller, validateDeployFile, validateDeployPath, validateDeployToken, validateFileName, validateFiles, validatePassword, validateToken };
1834
+ }
1835
+ export = Ship;
package/dist/index.d.ts CHANGED
@@ -258,6 +258,13 @@ interface Account {
258
258
  readonly activated: number | null;
259
259
  /** Last 4 characters of the API key for identification, null when no key generated */
260
260
  readonly hint: string | null;
261
+ /**
262
+ * Unix timestamp (seconds) of the API key's last use, null when never
263
+ * used or no key generated. Optional on the type by the additive-evolution
264
+ * law: published SDK versions may predate the field, so consumers read it
265
+ * when present rather than forcing a lockstep SDK release.
266
+ */
267
+ readonly used?: number | null;
261
268
  /** Grace period expiration (unix seconds), null if no grace period active */
262
269
  readonly grace: number | null;
263
270
  }
@@ -515,9 +522,17 @@ declare function hasUnbuiltMarker(filePath: string): boolean;
515
522
  interface PingResponse {
516
523
  /** Always true if service is healthy */
517
524
  success: boolean;
518
- /** Optional timestamp */
525
+ /** Server time in unix seconds — the one wire unit for timestamps. */
519
526
  timestamp?: number;
520
527
  }
528
+ /**
529
+ * Where human identity is mounted on the API host. The API mounts Better
530
+ * Auth at this path (sign-in, sign-out, session reads, admin impersonation)
531
+ * and the web console's auth client posts to it — shared here so the two
532
+ * halves of the auth pair agree by construction, the same way both sides
533
+ * already share the credential prefixes below.
534
+ */
535
+ declare const AUTH_BASE_PATH = "/auth";
521
536
  /**
522
537
  * How a request (or recorded activity) was authorized.
523
538
  *
@@ -712,20 +727,6 @@ interface StaticFile {
712
727
  /** The size of the file in bytes. */
713
728
  size: number;
714
729
  }
715
- /**
716
- * Progress information for deploy/upload operations.
717
- * Provides consistent percentage-based progress with byte-level details.
718
- */
719
- interface ProgressInfo {
720
- /** Progress percentage (0-100) */
721
- percent: number;
722
- /** Number of bytes loaded so far */
723
- loaded: number;
724
- /** Total number of bytes to load. May be 0 if unknown initially */
725
- total: number;
726
- /** Current file being processed (optional) */
727
- file?: string;
728
- }
729
730
  /** Default API URL if not otherwise configured. */
730
731
  declare const DEFAULT_API = "https://api.shipstatic.com";
731
732
  /**
@@ -769,11 +770,28 @@ interface DeploymentUploadOptions {
769
770
  captcha?: string;
770
771
  }
771
772
  /**
772
- * Deployment resource interface - the contract all implementations must follow
773
+ * Pagination options for the paginated list endpoints (`GET /deployments`,
774
+ * `GET /domains`). The response's `cursor` feeds the next request; a `null`
775
+ * cursor on the response means the last page. Omitting both returns the
776
+ * server's default first page.
773
777
  */
774
- interface DeploymentResource {
775
- upload: (input: DeployInput, options?: DeploymentUploadOptions) => Promise<DeploymentCreateResponse>;
776
- list: () => Promise<DeploymentListResponse>;
778
+ interface ListOptions {
779
+ /** Maximum number of items to return in one page. */
780
+ limit?: number;
781
+ /** Opaque cursor from the previous page's response. */
782
+ cursor?: string;
783
+ }
784
+ /**
785
+ * Deployment resource interface - the contract all implementations must follow.
786
+ *
787
+ * The interface defines the minimal wire contract; SDK implementations may
788
+ * extend the upload options with runtime concerns (timeout, signal, progress
789
+ * callbacks) by parameterizing: `DeploymentResource<MyUploadOptions>`. The
790
+ * default keeps plain `DeploymentResource` valid for wire-only consumers.
791
+ */
792
+ interface DeploymentResource<UploadOptions extends DeploymentUploadOptions = DeploymentUploadOptions> {
793
+ upload: (input: DeployInput, options?: UploadOptions) => Promise<DeploymentCreateResponse>;
794
+ list: (options?: ListOptions) => Promise<DeploymentListResponse>;
777
795
  get: (id: string) => Promise<Deployment>;
778
796
  set: (id: string, options: {
779
797
  labels: string[];
@@ -788,7 +806,7 @@ interface DomainResource {
788
806
  deployment?: string;
789
807
  labels?: string[];
790
808
  }) => Promise<DomainSetResult>;
791
- list: () => Promise<DomainListResponse>;
809
+ list: (options?: ListOptions) => Promise<DomainListResponse>;
792
810
  get: (name: string) => Promise<Domain>;
793
811
  remove: (name: string) => Promise<void>;
794
812
  verify: (name: string) => Promise<{
@@ -848,11 +866,11 @@ interface CheckoutSession {
848
866
  * All activity event types logged in the system.
849
867
  * Uses dot notation consistently: {resource}.{action}
850
868
  */
851
- type ActivityEvent = 'account.create' | 'account.update' | 'account.delete' | 'account.key.generate' | 'account.plan.paid' | 'account.plan.transition' | 'account.suspended' | 'deployment.create' | 'deployment.update' | 'deployment.delete' | 'deployment.claim' | 'deployment.flagged' | 'domain.create' | 'domain.update' | 'domain.delete' | 'domain.verify' | 'token.create' | 'token.consume' | 'admin.account.plan.update' | 'admin.account.ref.update' | 'admin.account.billing.update' | 'admin.account.labels.update' | 'admin.deployment.delete' | 'admin.domain.delete' | 'admin.billing.sync' | 'admin.billing.terminated' | 'admin.impersonate' | 'billing.active' | 'billing.canceled' | 'billing.paused' | 'billing.expired' | 'billing.paid' | 'billing.trialing' | 'billing.scheduled_cancel' | 'billing.unpaid' | 'billing.update' | 'billing.past_due' | 'refund.created' | 'dispute.created' | 'billing.sync' | 'billing.stale' | 'billing.race';
869
+ type ActivityEvent = 'account.create' | 'account.update' | 'account.delete' | 'account.key.generate' | 'account.plan.paid' | 'account.plan.transition' | 'account.suspended' | 'deployment.create' | 'deployment.update' | 'deployment.delete' | 'deployment.claim' | 'deployment.flagged' | 'domain.create' | 'domain.update' | 'domain.delete' | 'domain.verify' | 'token.create' | 'token.consume' | 'token.delete' | 'admin.account.plan.update' | 'admin.account.ref.update' | 'admin.account.billing.update' | 'admin.account.labels.update' | 'admin.deployment.delete' | 'admin.domain.delete' | 'admin.billing.sync' | 'admin.billing.terminated' | 'admin.impersonate' | 'billing.active' | 'billing.canceled' | 'billing.paused' | 'billing.expired' | 'billing.paid' | 'billing.trialing' | 'billing.scheduled_cancel' | 'billing.unpaid' | 'billing.update' | 'billing.past_due' | 'refund.created' | 'dispute.created' | 'billing.sync' | 'billing.stale' | 'billing.race';
852
870
  /**
853
871
  * Activity events visible to users in the dashboard
854
872
  */
855
- type UserVisibleActivityEvent = 'account.create' | 'account.update' | 'account.delete' | 'account.key.generate' | 'account.plan.transition' | 'deployment.create' | 'deployment.update' | 'deployment.delete' | 'deployment.claim' | 'domain.create' | 'domain.update' | 'domain.delete' | 'domain.verify' | 'token.create' | 'token.consume';
873
+ type UserVisibleActivityEvent = 'account.create' | 'account.update' | 'account.delete' | 'account.key.generate' | 'account.plan.transition' | 'deployment.create' | 'deployment.update' | 'deployment.delete' | 'deployment.claim' | 'domain.create' | 'domain.update' | 'domain.delete' | 'domain.verify' | 'token.create' | 'token.consume' | 'token.delete';
856
874
  /**
857
875
  * Activity record returned from the API
858
876
  */
@@ -871,6 +889,12 @@ interface Activity {
871
889
  /**
872
890
  * Parsed activity metadata.
873
891
  * Different events populate different fields.
892
+ *
893
+ * Naming convention: meta booleans are event-scoped predicates and carry
894
+ * their prefix (`isUpdate`, `wasVerified`, `hasConfig`, `hasPassword`),
895
+ * while entity booleans are bare nouns (`Deployment.config`,
896
+ * `Deployment.password`). Two vocabularies, each internally consistent —
897
+ * deliberate, not drift.
874
898
  */
875
899
  interface ActivityMeta {
876
900
  /** Number of files in deployment */
@@ -1109,20 +1133,17 @@ declare function validatePassword(value: unknown): string | undefined;
1109
1133
  * Extends the API contract (DeploymentUploadOptions) with SDK-specific options.
1110
1134
  */
1111
1135
  interface DeploymentOptions extends DeploymentUploadOptions {
1112
- /** An AbortSignal to allow cancellation of the deploy operation. */
1136
+ /**
1137
+ * An AbortSignal to allow cancellation of the deploy operation. The one
1138
+ * cancellation mechanism — abort the signal and the request rejects with
1139
+ * a typed `Cancelled` error. Request timeouts are a client concern
1140
+ * (`ShipClientOptions.timeout`), not a per-deploy one.
1141
+ */
1113
1142
  signal?: AbortSignal;
1114
- /** Callback invoked if the deploy is cancelled via the AbortSignal. */
1115
- onCancel?: () => void;
1116
- /** Maximum number of concurrent operations. */
1117
- maxConcurrency?: number;
1118
- /** Timeout in milliseconds for the deploy request. */
1119
- timeout?: number;
1120
1143
  /** Whether to auto-detect and optimize file paths by flattening common directories. Defaults to true. */
1121
1144
  pathDetect?: boolean;
1122
1145
  /** Whether to auto-detect SPAs and generate ship.json configuration. Defaults to true. */
1123
1146
  spaDetect?: boolean;
1124
- /** Callback for deploy progress with detailed statistics. */
1125
- onProgress?: (info: ProgressInfo) => void;
1126
1147
  }
1127
1148
  type ApiDeployOptions = Omit<DeploymentOptions, 'pathDetect'>;
1128
1149
  /**
@@ -1177,7 +1198,7 @@ type Fetch = typeof fetch;
1177
1198
  type TokenProvider = () => string | Promise<string>;
1178
1199
  /**
1179
1200
  * Options for configuring a `Ship` instance.
1180
- * Sets default API host, the client credential, progress callbacks, concurrency, and timeouts for the client.
1201
+ * Sets the API host, the client credential, the request timeout, and the transport.
1181
1202
  */
1182
1203
  interface ShipClientOptions {
1183
1204
  /** Default API URL for the client instance. */
@@ -1198,19 +1219,8 @@ interface ShipClientOptions {
1198
1219
  */
1199
1220
  token?: string | TokenProvider | undefined;
1200
1221
  /**
1201
- * Default callback for deploy progress for deploys made with this client.
1202
- * @param info - Progress information including percentage and byte counts.
1203
- */
1204
- onProgress?: ((info: ProgressInfo) => void) | undefined;
1205
- /**
1206
- * Default for maximum concurrent deploys.
1207
- * Used if an deploy operation doesn't specify its own `maxConcurrency`.
1208
- * Defaults to 4 if not set here or in the specific deploy call.
1209
- */
1210
- maxConcurrency?: number | undefined;
1211
- /**
1212
- * Default timeout in milliseconds for API requests made by this client instance.
1213
- * Used if an deploy operation doesn't specify its own timeout.
1222
+ * Timeout in milliseconds for every API request made by this client
1223
+ * instance. Defaults to 30 seconds.
1214
1224
  */
1215
1225
  timeout?: number | undefined;
1216
1226
  /**
@@ -1277,7 +1287,19 @@ interface ShipEvents {
1277
1287
  request: [url: string, init: RequestInit];
1278
1288
  /** Emitted after successful API response */
1279
1289
  response: [response: Response, url: string];
1280
- /** Emitted when API request fails */
1290
+ /**
1291
+ * Emitted when something fails. TWO populations arrive here, which is why
1292
+ * the type is `Error` and not `ShipError`:
1293
+ *
1294
+ * - a failed request — always a `ShipError` (`executeRequest` normalizes
1295
+ * every failure through `ShipError.fromFetchError` before emitting), so
1296
+ * `isShipError(error)` narrows and `.type` / `.status` are readable;
1297
+ * - a THROWING HANDLER of yours — `SimpleEvents.emit` evicts it and
1298
+ * re-emits the raw failure here, which is a plain `Error`.
1299
+ *
1300
+ * Narrowing this to `ShipError` was tried on 2026-07-27 and reverted: it
1301
+ * made the second population a lie.
1302
+ */
1281
1303
  error: [error: Error, url: string];
1282
1304
  }
1283
1305
 
@@ -1352,12 +1374,12 @@ declare class ApiHttp extends SimpleEvents {
1352
1374
  private safeClone;
1353
1375
  private parseResponse;
1354
1376
  deploy(files: StaticFile[], options?: ApiDeployOptions): Promise<DeploymentCreateResponse>;
1355
- listDeployments(): Promise<DeploymentListResponse>;
1377
+ listDeployments(options?: ListOptions): Promise<DeploymentListResponse>;
1356
1378
  getDeployment(id: string): Promise<Deployment>;
1357
1379
  updateDeploymentLabels(id: string, labels: string[]): Promise<Deployment>;
1358
1380
  removeDeployment(id: string): Promise<void>;
1359
1381
  setDomain(name: string, deployment?: string, labels?: string[]): Promise<DomainSetResult>;
1360
- listDomains(): Promise<DomainListResponse>;
1382
+ listDomains(options?: ListOptions): Promise<DomainListResponse>;
1361
1383
  getDomain(name: string): Promise<Domain>;
1362
1384
  removeDomain(name: string): Promise<void>;
1363
1385
  verifyDomain(name: string): Promise<{
@@ -1395,7 +1417,6 @@ interface ResourceContext {
1395
1417
  */
1396
1418
  interface DeploymentResourceContext extends ResourceContext {
1397
1419
  processInput: (input: DeployInput, options: DeploymentOptions) => Promise<StaticFile[]>;
1398
- clientDefaults?: ShipClientOptions;
1399
1420
  }
1400
1421
  /**
1401
1422
  * Upload deployment resource with all CRUD operations.
@@ -1405,7 +1426,7 @@ interface DeploymentResourceContext extends ResourceContext {
1405
1426
  * public-account agent identity per request (claim URL + expiry on the
1406
1427
  * response). The SDK stays a transparent pipe either way.
1407
1428
  */
1408
- declare function createDeploymentResource(ctx: DeploymentResourceContext): DeploymentResource;
1429
+ declare function createDeploymentResource(ctx: DeploymentResourceContext): DeploymentResource<DeploymentOptions>;
1409
1430
  /**
1410
1431
  * Create domain resource with all CRUD operations.
1411
1432
  *
@@ -1427,7 +1448,7 @@ declare function createTokenResource(ctx: ResourceContext): TokenResource;
1427
1448
  * Abstract base class for Ship SDK implementations.
1428
1449
  */
1429
1450
  declare abstract class Ship$1 {
1430
- readonly deployments: DeploymentResource;
1451
+ readonly deployments: DeploymentResource<DeploymentOptions>;
1431
1452
  readonly domains: DomainResource;
1432
1453
  readonly account: AccountResource;
1433
1454
  readonly tokens: TokenResource;
@@ -1452,7 +1473,7 @@ declare abstract class Ship$1 {
1452
1473
  /**
1453
1474
  * Deploy project (convenience shortcut to `ship.deployments.upload()`).
1454
1475
  */
1455
- deploy(input: DeployInput, options?: DeploymentOptions): Promise<Deployment>;
1476
+ deploy(input: DeployInput, options?: DeploymentOptions): Promise<DeploymentCreateResponse>;
1456
1477
  /**
1457
1478
  * Get current account information (convenience shortcut to `ship.account.get()`).
1458
1479
  */
@@ -1494,30 +1515,6 @@ declare abstract class Ship$1 {
1494
1515
  private getAuthHeaders;
1495
1516
  }
1496
1517
 
1497
- /**
1498
- * @file Cross-platform configuration helpers.
1499
- *
1500
- * One pure helper used by the deployment resource:
1501
- *
1502
- * - `mergeDeployOptions(perCallOptions, clientDefaults)` — overlays
1503
- * instance-level defaults under per-call overrides for a single deploy.
1504
- *
1505
- * Deploy options are pure deploy concerns (progress, timeout, concurrency).
1506
- * Credentials, the API URL, and the caller identifier are client identity —
1507
- * they live on the instance, never per call: one client is one principal
1508
- * speaking for one end user against one API. Callers that need a different
1509
- * identity construct another Ship.
1510
- */
1511
-
1512
- /**
1513
- * Overlay client-level defaults under per-call deploy options.
1514
- *
1515
- * Per-call options always win — they're the explicit override for a single
1516
- * `deployments.upload()`. Defaults fill in only when the per-call option is
1517
- * `undefined` (an explicit `null` / empty value passes through).
1518
- */
1519
- declare function mergeDeployOptions(options: DeploymentOptions, clientDefaults: ShipClientOptions): DeploymentOptions;
1520
-
1521
1518
  /**
1522
1519
  * @file Deploy path optimization - the core logic that makes Ship deployments clean and intuitive.
1523
1520
  * Automatically strips common parent directories to create clean deployment URLs.
@@ -1775,7 +1772,7 @@ declare function pluralize(count: number, singular: string, plural: string, incl
1775
1772
  * @param paths - File or directory paths to scan and process.
1776
1773
  * @param options - Processing options (pathDetect, etc.).
1777
1774
  * @param platformLimits - Per-instance platform limits (file-size / count /
1778
- * total-size caps) from the originating Ship's `GET /config` fetch. Passed
1775
+ * total-size caps) from the originating Ship's `GET /limits` fetch. Passed
1779
1776
  * in rather than read from a module global so concurrent Ships against
1780
1777
  * different API URLs cannot clobber each other's caps.
1781
1778
  * @returns Promise resolving to an array of StaticFile objects.
@@ -1827,9 +1824,9 @@ declare class Ship extends Ship$1 {
1827
1824
  * intentional: the convenience shortcut narrows; the resource-layer
1828
1825
  * contract stays platform-neutral.
1829
1826
  */
1830
- deploy(input: string | string[], options?: DeploymentOptions): Promise<Deployment>;
1827
+ deploy(input: string | string[], options?: DeploymentOptions): Promise<DeploymentCreateResponse>;
1831
1828
  protected processInput(input: DeployInput, options: DeploymentOptions): Promise<StaticFile[]>;
1832
1829
  protected getDeployBodyCreator(): DeployBodyCreator;
1833
1830
  }
1834
1831
 
1835
- export { API_KEY, type Account, type AccountGetResponse, type AccountOverrides, AccountPlan, type AccountPlanType, type AccountResource, type AccountUsage, type Activity, type ActivityEvent, type ActivityListResponse, type ActivityMeta, type ApiDeployOptions, ApiHttp, type ApiHttpOptions, AuthMethod, type AuthMethodType, BLOCKED_EXTENSIONS, type BillingStatus, CALLER, type CheckoutSession, DEFAULT_API, DEPLOYMENT_CONFIG_FILENAME, DEPLOY_TOKEN, type DeployBody, type DeployBodyContext, type DeployBodyCreator, type DeployFile, type DeployInput, type Deployment, type DeploymentCreateResponse, type DeploymentListResponse, type DeploymentOptions, type DeploymentResource, type DeploymentResourceContext, DeploymentStatus, type DeploymentStatusType, type DeploymentUploadOptions, type DnsProvider, type DnsRecord, type DnsRecordType, type Domain, type DomainDnsResponse, type DomainListResponse, type DomainRecordsResponse, type DomainResource, type DomainSetResult, DomainStatus, type DomainStatusType, type DomainValidateResponse, type ErrorResponse, ErrorType, type ExecutionEnvironment, FileValidationStatus as FILE_VALIDATION_STATUS, type Fetch, type FileValidationResult, FileValidationStatus, type FileValidationStatusType, JUNK_DIRECTORIES, LABEL_CONSTRAINTS, LABEL_PATTERN, type MD5Result, OAuthScope, type OAuthScopeType, PASSWORD_CONSTRAINTS, type PingResponse, type PlatformLimits, type ProgressInfo, type ResourceContext, type SPACheckRequest, type SPACheckResponse, SPA_DEFAULT_CONFIG, Ship, type ShipClientOptions, ShipError, type ShipEvents, type StaticFile, type TokenCreateResponse, TokenKind, type TokenKindType, type TokenListItem, type TokenListResponse, type TokenProvider, type TokenResource, UNBUILT_PROJECT_MARKERS, UNSAFE_FILENAME_CHARS, type UploadedFile, type UserVisibleActivityEvent, type ValidatableFile, type ValidationIssue, __setTestEnvironment, allValidFilesReady, calculateMD5, classifyToken, createAccountResource, createDeploymentResource, createDomainResource, createTokenResource, Ship as default, deserializeLabels, extractSubdomain, filterJunk, formatFileSize, generateDeploymentUrl, generateDomainUrl, getENV, getValidFiles, hasUnbuiltMarker, hasUnsafeChars, isBlockedExtension, isCustomDomain, isDeployment, isPlatformDomain, isShipError, mergeDeployOptions, optimizeDeployPaths, pluralize, processFilesForNode, serializeLabels, validateApiKey, validateApiUrl, validateCaller, validateDeployFile, validateDeployPath, validateDeployToken, validateFileName, validateFiles, validatePassword, validateToken };
1832
+ export { API_KEY, AUTH_BASE_PATH, type Account, type AccountGetResponse, type AccountOverrides, AccountPlan, type AccountPlanType, type AccountResource, type AccountUsage, type Activity, type ActivityEvent, type ActivityListResponse, type ActivityMeta, type ApiDeployOptions, ApiHttp, type ApiHttpOptions, AuthMethod, type AuthMethodType, BLOCKED_EXTENSIONS, type BillingStatus, CALLER, type CheckoutSession, DEFAULT_API, DEPLOYMENT_CONFIG_FILENAME, DEPLOY_TOKEN, type DeployBody, type DeployBodyContext, type DeployBodyCreator, type DeployFile, type DeployInput, type Deployment, type DeploymentCreateResponse, type DeploymentListResponse, type DeploymentOptions, type DeploymentResource, type DeploymentResourceContext, DeploymentStatus, type DeploymentStatusType, type DeploymentUploadOptions, type DnsProvider, type DnsRecord, type DnsRecordType, type Domain, type DomainDnsResponse, type DomainListResponse, type DomainRecordsResponse, type DomainResource, type DomainSetResult, DomainStatus, type DomainStatusType, type DomainValidateResponse, type ErrorResponse, ErrorType, type ExecutionEnvironment, FileValidationStatus as FILE_VALIDATION_STATUS, type Fetch, type FileValidationResult, FileValidationStatus, type FileValidationStatusType, JUNK_DIRECTORIES, LABEL_CONSTRAINTS, LABEL_PATTERN, type ListOptions, type MD5Result, OAuthScope, type OAuthScopeType, PASSWORD_CONSTRAINTS, type PingResponse, type PlatformLimits, type ResourceContext, type SPACheckRequest, type SPACheckResponse, SPA_DEFAULT_CONFIG, Ship, type ShipClientOptions, ShipError, type ShipEvents, type StaticFile, type TokenCreateResponse, TokenKind, type TokenKindType, type TokenListItem, type TokenListResponse, type TokenProvider, type TokenResource, UNBUILT_PROJECT_MARKERS, UNSAFE_FILENAME_CHARS, type UploadedFile, type UserVisibleActivityEvent, type ValidatableFile, type ValidationIssue, __setTestEnvironment, allValidFilesReady, calculateMD5, classifyToken, createAccountResource, createDeploymentResource, createDomainResource, createTokenResource, Ship as default, deserializeLabels, extractSubdomain, filterJunk, formatFileSize, generateDeploymentUrl, generateDomainUrl, getENV, getValidFiles, hasUnbuiltMarker, hasUnsafeChars, isBlockedExtension, isCustomDomain, isDeployment, isPlatformDomain, isShipError, optimizeDeployPaths, pluralize, processFilesForNode, serializeLabels, validateApiKey, validateApiUrl, validateCaller, validateDeployFile, validateDeployPath, validateDeployToken, validateFileName, validateFiles, validatePassword, validateToken };