@shipstatic/ship 2.3.5 → 2.4.0-beta.1

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
@@ -510,48 +510,64 @@ interface TokenDeleteResponse {
510
510
  readonly token: string;
511
511
  }
512
512
  /**
513
- * Account plan constants
513
+ * Every plan an account can hold — the platform's whole plan vocabulary, in
514
+ * one place, and nothing about what a plan is WORTH.
515
+ *
516
+ * A plan is a TIER and nothing else. Whether an account may act is a separate
517
+ * fact (`Account.suspended`; deletion ends the session outright), so an
518
+ * account keeps its tier through suspension and into deletion.
519
+ *
520
+ * - **Free** — `free`.
521
+ * - **Billed** — `pro`. The one plan a customer can buy; the only plan Stripe
522
+ * knows about, and the only one the platform never sets by hand — it is
523
+ * derived from the Stripe subscription.
524
+ * - **Granted** — `scale`, `sponsored`. Paid plans the operator confers by
525
+ * hand; no Stripe subscription, no Checkout, no Stripe object at all.
526
+ *
527
+ * The numbers each plan confers — caps, sizes — are POLICY and are delivered
528
+ * by the API (`GET /plans`, `GET /account`, `GET /limits`), never published
529
+ * here: a price or a cap in a published package is pinned to whatever version
530
+ * a client installed (`CLAUDE.md`, "Validation: format vs policy").
514
531
  */
515
532
  declare const AccountPlan: {
516
533
  readonly FREE: "free";
517
- readonly STANDARD: "standard";
534
+ readonly PRO: "pro";
535
+ readonly SCALE: "scale";
518
536
  readonly SPONSORED: "sponsored";
519
- readonly ENTERPRISE: "enterprise";
520
- readonly SUSPENDED: "suspended";
521
- readonly TERMINATING: "terminating";
522
- readonly TERMINATED: "terminated";
523
537
  };
524
538
  type AccountPlanType = (typeof AccountPlan)[keyof typeof AccountPlan];
525
539
  /**
526
- * Account usage metrics always available regardless of billing provider.
540
+ * The two things an account ACCUMULATES, and therefore the two things a plan
541
+ * caps. One word for the count and for the ceiling: `Account.usage` and
542
+ * `Account.caps` are the same shape, so a surface renders "2 of 3" by
543
+ * dividing one by the other and can never divide by a different denominator
544
+ * than the 403 uses.
545
+ *
546
+ * Both are counts paid plans SELL. A platform subdomain (`x.shipstatic.com`)
547
+ * is not among them: the platform owns the name, it costs nothing, and no
548
+ * plan bounds how many an account may hold.
527
549
  *
528
- * This is where a caller's own totals live. Lists answer pages and carry no
529
- * `total` (see {@link ListOptions}); a count is an aggregate over a
530
- * collection, so it belongs to the summary resource that owns the
531
- * collection. `GET /account` is that resource for one caller, `GET
532
- * /admin/stats` for the platform.
550
+ * Every cap carries a number on every plan never `null`, never
551
+ * "unlimited" so no consumer needs an "is it bounded?" branch.
533
552
  *
534
- * The counted dimensions are the ones the plan caps deployments and
535
- * domains (`PlatformLimits`) plus the billable custom-domain subset, so a
536
- * surface can render "3 of 10" without a second request.
553
+ * A count is an aggregate over a collection, so it lives on the summary
554
+ * resource that owns the collection: `GET /account` for one caller, `GET
555
+ * /admin/stats` platform-wide. Lists answer pages and carry no `total` (see
556
+ * {@link ListOptions}).
537
557
  */
538
- interface AccountUsage {
539
- /** Number of active custom domains (excludes paused) */
540
- customDomains: number;
558
+ interface Caps {
541
559
  /**
542
- * Deployments counted against the plan's deployment cap every row
543
- * whatever its status, because that is what the cap counts, so a surface
544
- * renders "3 of 10" against the denominator the 403 divides by. (`GET
545
- * /deployments` lists successful ones only; that is a different question
546
- * asked of a different resource.) Optional by the additive-evolution law:
547
- * an API predating this field omits it.
560
+ * Deployments every row whatever its status, because that is what the cap
561
+ * counts. (`GET /deployments` lists successful ones only; that is a
562
+ * different question asked of a different resource.)
548
563
  */
549
- deployments?: number;
564
+ readonly deployments: number;
550
565
  /**
551
- * Domains counted against the plan's domain cap — every domain, platform
552
- * and custom alike, unlike `customDomains`. Optional for the same reason.
566
+ * Hostnames the customer owns — every row, paused ones included. A paused
567
+ * domain still occupies its slot, so deleting one is what frees capacity.
568
+ * A downgraded account therefore reads honestly as "3 of 0".
553
569
  */
554
- domains?: number;
570
+ readonly customDomains: number;
555
571
  }
556
572
  /**
557
573
  * Core account object - used in both API responses and SDK
@@ -564,10 +580,22 @@ interface Account {
564
580
  readonly name: string | null;
565
581
  /** User profile picture URL, null if not set */
566
582
  readonly picture: string | null;
567
- /** Account plan status */
583
+ /** The account's tier. */
568
584
  readonly plan: AccountPlanType;
569
- /** Account usage metrics (custom domains, etc.) */
570
- readonly usage: AccountUsage;
585
+ /**
586
+ * True while the operator has suspended the account: reads and deletes
587
+ * still work, every write is refused. The plan is unchanged underneath.
588
+ */
589
+ readonly suspended: boolean;
590
+ /** What the account currently holds — see {@link Caps}. */
591
+ readonly usage: Caps;
592
+ /**
593
+ * What the account is allowed to hold — the same three keys as
594
+ * {@link usage}, so the pair divides. These are the account's EFFECTIVE
595
+ * caps: its plan's numbers, plus whatever the operator granted it
596
+ * individually.
597
+ */
598
+ readonly caps: Caps;
571
599
  /** Unix timestamp (seconds) when account was created */
572
600
  readonly created: number;
573
601
  /** Unix timestamp (seconds) when account was activated (first deployment), null if not yet activated */
@@ -581,8 +609,16 @@ interface Account {
581
609
  * when present rather than forcing a lockstep SDK release.
582
610
  */
583
611
  readonly used?: number | null;
584
- /** Grace period expiration (unix seconds), null if no grace period active */
585
- readonly grace: number | null;
612
+ /**
613
+ * True while the Stripe subscription's status is `past_due` and Stripe is
614
+ * still retrying the card. The plan is unchanged — the account keeps
615
+ * everything it has — so this is a banner, not a gate.
616
+ *
617
+ * A BOOLEAN rather than the status string: one fact for the console to
618
+ * act on. Stripe's own status word is mirrored on the account row for the
619
+ * operator surface.
620
+ */
621
+ readonly overdue: boolean;
586
622
  }
587
623
  /**
588
624
  * Account as returned by `GET /account` — the entity plus how the request
@@ -606,10 +642,10 @@ interface AccountGetResponse extends Account {
606
642
  * {@link DeploymentDeleteResponse} for the law.
607
643
  */
608
644
  interface AccountDeleteResponse {
609
- /** The account that was marked for termination */
645
+ /** The account whose deletion was accepted */
610
646
  readonly account: string;
611
- /** The plan the account is in while cleanup runs */
612
- readonly plan: AccountPlanType;
647
+ /** Unix timestamp (seconds) the deletion was requested; cleanup completes it */
648
+ readonly deleted: number;
613
649
  }
614
650
  /**
615
651
  * Response from `PUT /account/key` — the account's single API key, minted in
@@ -627,22 +663,6 @@ interface AccountKeyResponse {
627
663
  /** The raw API key (shown once at mint, then never again) */
628
664
  readonly secret: string;
629
665
  }
630
- /**
631
- * Account-specific configuration overrides
632
- * Allows per-account customization of limits without changing plan
633
- */
634
- interface AccountOverrides {
635
- /** Override for maximum number of domains */
636
- domains?: number;
637
- /** Override for maximum number of deployments */
638
- deployments?: number;
639
- /** Override for maximum individual file size in bytes */
640
- fileSize?: number;
641
- /** Override for maximum number of files per deployment */
642
- filesCount?: number;
643
- /** Override for maximum total deployment size in bytes */
644
- totalSize?: number;
645
- }
646
666
  /**
647
667
  * Every path the public API answers on, declared once.
648
668
  *
@@ -694,6 +714,7 @@ declare const API_PATHS: {
694
714
  readonly ACTIVITIES: "/activities";
695
715
  readonly LABELS: "/labels";
696
716
  readonly LIMITS: "/limits";
717
+ readonly PLANS: "/plans";
697
718
  readonly PING: "/ping";
698
719
  readonly SETUP: "/setup";
699
720
  readonly SPA_CHECK: "/spa-check";
@@ -1726,54 +1747,85 @@ interface TokenResource {
1726
1747
  delete: (token: string) => Promise<TokenDeleteResponse>;
1727
1748
  }
1728
1749
  /**
1729
- * Billing status response from GET /billing/status
1750
+ * How often a subscription renews. The platform sells one plan at two
1751
+ * intervals, so this is the only thing a buyer chooses at checkout.
1730
1752
  *
1731
- * Note: The user's `plan` comes from Account, not here.
1732
- * This endpoint only returns billing-specific data (usage, portal, etc.)
1753
+ * It never branches business logic monthly and yearly confer identical
1754
+ * caps. It exists to be displayed and to pick a price at checkout.
1755
+ */
1756
+ type BillingInterval = 'month' | 'year';
1757
+ /**
1758
+ * One row of the plan menu, answered by `GET /plans`.
1733
1759
  *
1734
- * If `billing` is null, the user has no active billing.
1760
+ * **Vocabulary here, values from the server.** The shape is a wire contract
1761
+ * every surface agrees on; the numbers in it are policy the API owns and may
1762
+ * change on a deploy (`CLAUDE.md`, "Validation: format vs policy"). That is
1763
+ * why the public site and the console both READ this endpoint instead of
1764
+ * carrying their own copy of the price list — a hand-copied plan table was
1765
+ * the platform's longest-lived restatement.
1735
1766
  */
1736
- interface BillingStatus {
1737
- /** Creem billing ID, or null if no active billing */
1738
- billing: string | null;
1739
- /** Number of billing units (1 unit = 1 custom domain), null if no billing */
1740
- units: number | null;
1741
- /** Billing status from Creem (active, trialing, canceled, etc.), null if no billing */
1742
- status: string | null;
1743
- /** Link to Creem customer portal for billing management, null if unavailable */
1744
- portal: string | null;
1767
+ interface Plan {
1768
+ /** Which plan this row describes. */
1769
+ readonly plan: AccountPlanType;
1770
+ /** Display name, as the marketing site and the console should print it. */
1771
+ readonly name: string;
1772
+ /**
1773
+ * What it costs. A union rather than a nullable number, so "free" and
1774
+ * "talk to us" are two different answers instead of two readings of the
1775
+ * same `null`. Amounts are integer CENTS in USD, as the API's plan table
1776
+ * states them and as Stripe's Prices are provisioned from it — the wire
1777
+ * never carries a formatted price, because formatting is the reader's job.
1778
+ */
1779
+ readonly price: 'free' | 'contact' | {
1780
+ readonly month: number;
1781
+ readonly year: number;
1782
+ };
1783
+ /**
1784
+ * The caps this plan publishes, or `null` where the menu deliberately says
1785
+ * nothing (a plan sold by conversation publishes no numbers).
1786
+ */
1787
+ readonly caps: Caps | null;
1745
1788
  }
1746
1789
  /**
1747
- * Acknowledgement of `POST /billing/cancel`.
1790
+ * Response for `GET /plans` — the whole public menu, in display order.
1748
1791
  *
1749
- * Cancelling leaves no billing entity to return, so it answers with the
1750
- * account and the one field of the account the call changedthe plan it
1751
- * landed on. See {@link DeploymentDeleteResponse} for the law.
1792
+ * Public, unauthenticated and cacheable: it describes the product, not the
1793
+ * caller. Plans the operator only ever grants by hand are absenta menu
1794
+ * lists what can be ordered.
1752
1795
  *
1753
- * This read `{ success: true, message: 'Subscription canceled successfully…' }`
1754
- * until 2026-07-29, an anonymous shape that `web/my` redeclared inline and
1755
- * whose prose no surface ever displayed: both callers await the promise and
1756
- * discard the body, then compose their own toast. The message was written,
1757
- * serialized, and thrown away on every cancellation.
1796
+ * An aggregate rather than a list: the registry is the bound, so there is no
1797
+ * cursor (the {@link LabelsResponse} shape).
1758
1798
  */
1759
- interface BillingCancelResponse {
1760
- /** The account whose subscription was cancelled */
1761
- readonly account: string;
1762
- /** The plan the account now holds — `free` on a successful cancellation */
1763
- readonly plan: AccountPlanType;
1799
+ interface PlansResponse {
1800
+ readonly plans: readonly Plan[];
1764
1801
  }
1765
1802
  /**
1766
- * Checkout session response from POST /billing/checkout
1803
+ * A page Stripe hosts — a Checkout Session or a Customer Portal session — the
1804
+ * answer of `POST /billing/checkout` and `POST /billing/portal` alike.
1805
+ *
1806
+ * One shape for both because both say the same thing: the platform is not
1807
+ * where this happens, go here. There is nothing else to return — the
1808
+ * outcome arrives later, as a Stripe webhook.
1767
1809
  */
1768
- interface CheckoutSession {
1769
- /** URL to redirect user to Creem checkout page */
1770
- url: string;
1810
+ interface StripeSession {
1811
+ /** Absolute URL to redirect the browser to. Single use, short-lived. */
1812
+ readonly url: string;
1813
+ }
1814
+ /**
1815
+ * The answer of `POST /billing/sync` — the account's plan after the platform
1816
+ * re-read Stripe. The success page calls it once on arrival from Checkout,
1817
+ * instead of polling for the webhook: a card payment is settled by the time
1818
+ * Stripe redirects, so one read makes the plan current before anything
1819
+ * renders.
1820
+ */
1821
+ interface BillingSyncResponse {
1822
+ readonly plan: AccountPlanType;
1771
1823
  }
1772
1824
  /**
1773
1825
  * All activity event types logged in the system.
1774
1826
  * Uses dot notation consistently: {resource}.{action}
1775
1827
  */
1776
- 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' | 'deployment.open' | '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';
1828
+ type ActivityEvent = 'account.create' | 'account.update' | 'account.delete' | 'account.key.generate' | 'account.plan.paid' | 'account.plan.transition' | 'deployment.create' | 'deployment.update' | 'deployment.delete' | 'deployment.claim' | 'deployment.flagged' | 'deployment.open' | 'domain.create' | 'domain.update' | 'domain.delete' | 'domain.verify' | 'token.create' | 'token.consume' | 'token.delete' | 'admin.account.plan.update' | 'admin.account.suspended.update' | 'admin.account.ref.update' | 'admin.account.labels.update' | 'admin.deployment.delete' | 'admin.domain.delete' | 'admin.impersonate';
1777
1829
  /**
1778
1830
  * Activity events visible to users in the dashboard
1779
1831
  */
@@ -2956,6 +3008,6 @@ declare class Ship extends Ship$1 {
2956
3008
  }
2957
3009
 
2958
3010
  declare namespace Ship {
2959
- export { API_KEY, API_PATHS, AUTH_BASE_PATH, Account, AccountDeleteResponse, AccountGetResponse, AccountKeyResponse, AccountOverrides, AccountPlan, AccountPlanType, AccountResource, AccountUsage, Activity, ActivityEvent, ActivityListResponse, ActivityMeta, ApiDeployOptions, ApiHttp, ApiHttpOptions, AuthMethod, AuthMethodType, BillingCancelResponse, BillingStatus, CALLER, CheckoutSession, DEFAULT_API, DEPLOYMENT_CONFIG_FILENAME, DEPLOY_FIELDS, DEPLOY_TOKEN, DeployBodyContext, DeployFile, DeployInput, DeployTransport, Deployment, DeploymentCreateResponse, DeploymentDeleteResponse, DeploymentListResponse, DeploymentOptions, DeploymentResource, DeploymentResourceContext, DeploymentSetOptions, DeploymentStatus, DeploymentStatusType, DeploymentUploadOptions, DeploymentVia, DeploymentViaType, DnsLookup, DnsProvider, DnsRecord, DnsRecordType, Domain, DomainDeleteResponse, DomainDnsResponse, DomainListResponse, DomainRecordsResponse, DomainResource, DomainSetOptions, DomainSetResult, DomainShareResponse, DomainStatus, DomainStatusType, DomainValidateResponse, DomainVerifyResponse, ErrorResponse, ErrorType, ExecutionEnvironment, FileValidationStatus as FILE_VALIDATION_STATUS, Fetch, FileValidationResult, FileValidationStatus, FileValidationStatusType, IDEMPOTENCY_KEY_CONSTRAINTS, JUNK_DIRECTORIES, LABEL_CONSTRAINTS, LABEL_PATTERN, LabelsResponse, ListOptions, ListResponse, MD5Result, MY_API_KEY_URL, OAUTH_TOKEN, OAuthScope, OAuthScopeType, PASSWORD_CONSTRAINTS, PUBLIC_DEPLOYMENT_TTL_SECONDS, PingResponse, PlatformLimits, RequestResult, ResourceContext, SHIP_ENV, SIGN_IN_RETURN_PARAM, SPACheckDebug, SPACheckRequest, SPACheckResponse, SPA_CHECK_CONSTRAINTS, SPA_DEFAULT_CONFIG, SetupInstructionsResponse, ShipClientOptions, ShipError, ShipEvents, ShipRequestInit, StaticFile, TTL_CONSTRAINTS, Token, TokenCreateOptions, TokenCreateResponse, TokenDeleteResponse, TokenKind, TokenKindType, TokenListResponse, TokenProvider, TokenResource, Transport, UNBUILT_PROJECT_MARKERS, UNSAFE_FILENAME_CHARS, UploadedFile, UserVisibleActivityEvent, ValidatableFile, ValidationIssue, WEB_FILE_ACCEPT, __setTestEnvironment, allValidFilesReady, assertShipJsonSyntax, calculateMD5, classifyToken, createAccountResource, createDeploymentResource, createDomainResource, createTokenResource, deserializeLabels, extractSubdomain, filterJunk, formatFileSize, generateDeploymentUrl, generateDomainUrl, getENV, getValidFiles, hasUnbuiltMarker, hasUnsafeChars, isBlockedExtension, isCustomDomain, isDeployment, isPlatformDomain, isShipError, normalizeVia, optimizeDeployPaths, pluralize, processFilesForNode, readBearerValue, serializeLabels, validateApiKey, validateApiUrl, validateCaller, validateDeployFile, validateDeployPath, validateDeployToken, validateFileName, validateFiles, validateIdempotencyKey, validateOAuthToken, validatePassword, validateToken, validateTtl };
3011
+ export { API_KEY, API_PATHS, AUTH_BASE_PATH, Account, AccountDeleteResponse, AccountGetResponse, AccountKeyResponse, AccountPlan, AccountPlanType, AccountResource, Activity, ActivityEvent, ActivityListResponse, ActivityMeta, ApiDeployOptions, ApiHttp, ApiHttpOptions, AuthMethod, AuthMethodType, BillingInterval, BillingSyncResponse, CALLER, Caps, DEFAULT_API, DEPLOYMENT_CONFIG_FILENAME, DEPLOY_FIELDS, DEPLOY_TOKEN, DeployBodyContext, DeployFile, DeployInput, DeployTransport, Deployment, DeploymentCreateResponse, DeploymentDeleteResponse, DeploymentListResponse, DeploymentOptions, DeploymentResource, DeploymentResourceContext, DeploymentSetOptions, DeploymentStatus, DeploymentStatusType, DeploymentUploadOptions, DeploymentVia, DeploymentViaType, DnsLookup, DnsProvider, DnsRecord, DnsRecordType, Domain, DomainDeleteResponse, DomainDnsResponse, DomainListResponse, DomainRecordsResponse, DomainResource, DomainSetOptions, DomainSetResult, DomainShareResponse, DomainStatus, DomainStatusType, DomainValidateResponse, DomainVerifyResponse, ErrorResponse, ErrorType, ExecutionEnvironment, FileValidationStatus as FILE_VALIDATION_STATUS, Fetch, FileValidationResult, FileValidationStatus, FileValidationStatusType, IDEMPOTENCY_KEY_CONSTRAINTS, JUNK_DIRECTORIES, LABEL_CONSTRAINTS, LABEL_PATTERN, LabelsResponse, ListOptions, ListResponse, MD5Result, MY_API_KEY_URL, OAUTH_TOKEN, OAuthScope, OAuthScopeType, PASSWORD_CONSTRAINTS, PUBLIC_DEPLOYMENT_TTL_SECONDS, PingResponse, Plan, PlansResponse, PlatformLimits, RequestResult, ResourceContext, SHIP_ENV, SIGN_IN_RETURN_PARAM, SPACheckDebug, SPACheckRequest, SPACheckResponse, SPA_CHECK_CONSTRAINTS, SPA_DEFAULT_CONFIG, SetupInstructionsResponse, ShipClientOptions, ShipError, ShipEvents, ShipRequestInit, StaticFile, StripeSession, TTL_CONSTRAINTS, Token, TokenCreateOptions, TokenCreateResponse, TokenDeleteResponse, TokenKind, TokenKindType, TokenListResponse, TokenProvider, TokenResource, Transport, UNBUILT_PROJECT_MARKERS, UNSAFE_FILENAME_CHARS, UploadedFile, UserVisibleActivityEvent, ValidatableFile, ValidationIssue, WEB_FILE_ACCEPT, __setTestEnvironment, allValidFilesReady, assertShipJsonSyntax, calculateMD5, classifyToken, createAccountResource, createDeploymentResource, createDomainResource, createTokenResource, deserializeLabels, extractSubdomain, filterJunk, formatFileSize, generateDeploymentUrl, generateDomainUrl, getENV, getValidFiles, hasUnbuiltMarker, hasUnsafeChars, isBlockedExtension, isCustomDomain, isDeployment, isPlatformDomain, isShipError, normalizeVia, optimizeDeployPaths, pluralize, processFilesForNode, readBearerValue, serializeLabels, validateApiKey, validateApiUrl, validateCaller, validateDeployFile, validateDeployPath, validateDeployToken, validateFileName, validateFiles, validateIdempotencyKey, validateOAuthToken, validatePassword, validateToken, validateTtl };
2960
3012
  }
2961
3013
  export = Ship;