@shipstatic/ship 2.3.5 → 2.5.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.
527
545
  *
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.
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.
533
549
  *
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.
550
+ * Every cap carries a number on every plan — never `null`, never
551
+ * "unlimited"so no consumer needs an "is it bounded?" branch.
552
+ *
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,17 @@ 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 act
618
+ * on. It carries STRIPE'S OWN WORD (`past_due` → `pastDue`) rather than a
619
+ * synonym, so no reader has to hold a translation; the full status string is
620
+ * mirrored on the account row for the operator surface.
621
+ */
622
+ readonly pastDue: boolean;
586
623
  }
587
624
  /**
588
625
  * Account as returned by `GET /account` — the entity plus how the request
@@ -606,10 +643,10 @@ interface AccountGetResponse extends Account {
606
643
  * {@link DeploymentDeleteResponse} for the law.
607
644
  */
608
645
  interface AccountDeleteResponse {
609
- /** The account that was marked for termination */
646
+ /** The account whose deletion was accepted */
610
647
  readonly account: string;
611
- /** The plan the account is in while cleanup runs */
612
- readonly plan: AccountPlanType;
648
+ /** Unix timestamp (seconds) the deletion was requested; cleanup completes it */
649
+ readonly deleted: number;
613
650
  }
614
651
  /**
615
652
  * Response from `PUT /account/key` — the account's single API key, minted in
@@ -627,22 +664,6 @@ interface AccountKeyResponse {
627
664
  /** The raw API key (shown once at mint, then never again) */
628
665
  readonly secret: string;
629
666
  }
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
667
  /**
647
668
  * Every path the public API answers on, declared once.
648
669
  *
@@ -694,6 +715,7 @@ declare const API_PATHS: {
694
715
  readonly ACTIVITIES: "/activities";
695
716
  readonly LABELS: "/labels";
696
717
  readonly LIMITS: "/limits";
718
+ readonly PLANS: "/plans";
697
719
  readonly PING: "/ping";
698
720
  readonly SETUP: "/setup";
699
721
  readonly SPA_CHECK: "/spa-check";
@@ -1726,54 +1748,96 @@ interface TokenResource {
1726
1748
  delete: (token: string) => Promise<TokenDeleteResponse>;
1727
1749
  }
1728
1750
  /**
1729
- * Billing status response from GET /billing/status
1751
+ * How often a subscription renews. The platform sells one plan at two
1752
+ * intervals, so this is the only thing a buyer chooses at checkout.
1730
1753
  *
1731
- * Note: The user's `plan` comes from Account, not here.
1732
- * This endpoint only returns billing-specific data (usage, portal, etc.)
1754
+ * It never branches business logic monthly and yearly confer identical
1755
+ * caps. It exists to be displayed and to pick a price at checkout.
1756
+ */
1757
+ type BillingInterval = 'month' | 'year';
1758
+ /**
1759
+ * One row of the plan menu, answered by `GET /plans`.
1733
1760
  *
1734
- * If `billing` is null, the user has no active billing.
1761
+ * **Vocabulary here, values from the server.** The shape is a wire contract
1762
+ * every surface agrees on; the numbers in it are policy the API owns and may
1763
+ * change on a deploy (`CLAUDE.md`, "Validation: format vs policy"). That is
1764
+ * why the public site and the console both READ this endpoint instead of
1765
+ * carrying their own copy of the price list — a hand-copied plan table was
1766
+ * the platform's longest-lived restatement.
1735
1767
  */
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;
1768
+ interface Plan {
1769
+ /** Which plan this row describes. */
1770
+ readonly plan: AccountPlanType;
1771
+ /** Display name, as the marketing site and the console should print it. */
1772
+ readonly name: string;
1773
+ /**
1774
+ * What it costs. A union rather than a nullable number, so "free" and
1775
+ * "talk to us" are two different answers instead of two readings of the
1776
+ * same `null`. Amounts are integer CENTS in USD, as the API's plan table
1777
+ * states them and as Stripe's Prices are provisioned from it — the wire
1778
+ * never carries a formatted price, because formatting is the reader's job.
1779
+ */
1780
+ readonly price: 'free' | 'contact' | {
1781
+ readonly month: number;
1782
+ readonly year: number;
1783
+ };
1784
+ /**
1785
+ * The caps this plan publishes, or `null` where the menu deliberately says
1786
+ * nothing (a plan sold by conversation publishes no numbers).
1787
+ */
1788
+ readonly caps: Caps | null;
1745
1789
  }
1746
1790
  /**
1747
- * Acknowledgement of `POST /billing/cancel`.
1791
+ * Response for `GET /plans` — the whole public menu, in display order.
1748
1792
  *
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.
1793
+ * Public, unauthenticated and cacheable: it describes the product, not the
1794
+ * caller. Plans the operator only ever grants by hand are absenta menu
1795
+ * lists what can be ordered.
1752
1796
  *
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.
1797
+ * An aggregate rather than a list: the registry is the bound, so there is no
1798
+ * cursor (the {@link LabelsResponse} shape).
1758
1799
  */
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;
1800
+ interface PlansResponse {
1801
+ readonly plans: readonly Plan[];
1764
1802
  }
1765
1803
  /**
1766
- * Checkout session response from POST /billing/checkout
1804
+ * The answer of `POST /billing/checkout` — Stripe's `Checkout.Session`,
1805
+ * projected to the one field a client needs.
1806
+ *
1807
+ * There is nothing else to return: the outcome arrives later, as a Stripe
1808
+ * webhook. It is its own type rather than a shape shared with
1809
+ * {@link BillingPortalSession} because Stripe has two distinct objects here,
1810
+ * and naming one of them for both would be the reader's translation to make.
1767
1811
  */
1768
1812
  interface CheckoutSession {
1769
- /** URL to redirect user to Creem checkout page */
1770
- url: string;
1813
+ /** Absolute URL to redirect the browser to. Single use, short-lived. */
1814
+ readonly url: string;
1815
+ }
1816
+ /**
1817
+ * The answer of `POST /billing/portal` — Stripe's `BillingPortal.Session`,
1818
+ * projected the same way. Identical in shape to {@link CheckoutSession} and
1819
+ * deliberately not merged with it: they are two Stripe objects, and either may
1820
+ * gain a field the other never has.
1821
+ */
1822
+ interface BillingPortalSession {
1823
+ /** Absolute URL to redirect the browser to. Single use, short-lived. */
1824
+ readonly url: string;
1825
+ }
1826
+ /**
1827
+ * The answer of `POST /billing/sync` — the account's plan after the platform
1828
+ * re-read Stripe. The success page calls it once on arrival from Checkout,
1829
+ * instead of polling for the webhook: a card payment is settled by the time
1830
+ * Stripe redirects, so one read makes the plan current before anything
1831
+ * renders.
1832
+ */
1833
+ interface BillingSyncResponse {
1834
+ readonly plan: AccountPlanType;
1771
1835
  }
1772
1836
  /**
1773
1837
  * All activity event types logged in the system.
1774
1838
  * Uses dot notation consistently: {resource}.{action}
1775
1839
  */
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';
1840
+ 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
1841
  /**
1778
1842
  * Activity events visible to users in the dashboard
1779
1843
  */
@@ -2956,6 +3020,6 @@ declare class Ship extends Ship$1 {
2956
3020
  }
2957
3021
 
2958
3022
  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 };
3023
+ 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, BillingPortalSession, BillingSyncResponse, CALLER, Caps, 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, 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, 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
3024
  }
2961
3025
  export = Ship;