@shipstatic/types 2.12.0 → 2.14.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/README.md +5 -5
- package/dist/index.d.ts +147 -83
- package/dist/index.js +21 -6
- package/package.json +1 -1
- package/src/index.ts +153 -105
package/README.md
CHANGED
|
@@ -24,7 +24,7 @@ import type {
|
|
|
24
24
|
Deployment, DeploymentListResponse, DeploymentDeleteResponse, DeploymentSetOptions,
|
|
25
25
|
Domain, DomainSetResult, DomainSetOptions, DomainListResponse, DnsRecord, DnsLookup, DomainDnsResponse, DomainRecordsResponse, DomainShareResponse, DomainValidateResponse, DomainDeleteResponse, DomainVerifyResponse,
|
|
26
26
|
Token, TokenListResponse, TokenCreateResponse, TokenCreateOptions, TokenDeleteResponse,
|
|
27
|
-
Account,
|
|
27
|
+
Account, Caps, AccountDeleteResponse, AccountKeyResponse,
|
|
28
28
|
LabelsResponse, SetupInstructionsResponse,
|
|
29
29
|
StaticFile
|
|
30
30
|
} from '@shipstatic/types';
|
|
@@ -90,7 +90,7 @@ Both helpers accept an optional operation-name string for contextual messages (`
|
|
|
90
90
|
import {
|
|
91
91
|
DeploymentStatus, // pending | success | failed | deleting
|
|
92
92
|
DomainStatus, // pending | partial | success | paused
|
|
93
|
-
AccountPlan, // free |
|
|
93
|
+
AccountPlan, // free | pro | scale | sponsored — tiers only; suspension and deletion are account facts
|
|
94
94
|
FileValidationStatus, // pending | processing_error | excluded | validation_failed | ready
|
|
95
95
|
AuthMethod, // session | apiKey | token | agent | oauth | webhook | system
|
|
96
96
|
} from '@shipstatic/types';
|
|
@@ -100,9 +100,9 @@ import {
|
|
|
100
100
|
|
|
101
101
|
```typescript
|
|
102
102
|
import type {
|
|
103
|
-
PlatformLimits, //
|
|
104
|
-
|
|
105
|
-
|
|
103
|
+
PlatformLimits, // per-request size limits from /limits (file size, file count, total size)
|
|
104
|
+
Plan, PlansResponse, // the public plan menu from /plans
|
|
105
|
+
BillingInterval, StripeSession,
|
|
106
106
|
ActivityListResponse,
|
|
107
107
|
PingResponse,
|
|
108
108
|
} from '@shipstatic/types';
|
package/dist/index.d.ts
CHANGED
|
@@ -510,48 +510,64 @@ export interface TokenDeleteResponse {
|
|
|
510
510
|
readonly token: string;
|
|
511
511
|
}
|
|
512
512
|
/**
|
|
513
|
-
*
|
|
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
|
export declare const AccountPlan: {
|
|
516
533
|
readonly FREE: "free";
|
|
517
|
-
readonly
|
|
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
|
export type AccountPlanType = (typeof AccountPlan)[keyof typeof AccountPlan];
|
|
525
539
|
/**
|
|
526
|
-
*
|
|
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
|
-
*
|
|
529
|
-
*
|
|
530
|
-
*
|
|
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
|
-
*
|
|
535
|
-
*
|
|
536
|
-
*
|
|
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
|
-
export interface
|
|
539
|
-
/** Number of active custom domains (excludes paused) */
|
|
540
|
-
customDomains: number;
|
|
558
|
+
export interface Caps {
|
|
541
559
|
/**
|
|
542
|
-
* Deployments
|
|
543
|
-
*
|
|
544
|
-
*
|
|
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
|
|
564
|
+
readonly deployments: number;
|
|
550
565
|
/**
|
|
551
|
-
*
|
|
552
|
-
*
|
|
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
|
-
|
|
570
|
+
readonly customDomains: number;
|
|
555
571
|
}
|
|
556
572
|
/**
|
|
557
573
|
* Core account object - used in both API responses and SDK
|
|
@@ -564,10 +580,22 @@ export 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
|
-
/**
|
|
583
|
+
/** The account's tier. */
|
|
568
584
|
readonly plan: AccountPlanType;
|
|
569
|
-
/**
|
|
570
|
-
|
|
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 @@ export interface Account {
|
|
|
581
609
|
* when present rather than forcing a lockstep SDK release.
|
|
582
610
|
*/
|
|
583
611
|
readonly used?: number | null;
|
|
584
|
-
/**
|
|
585
|
-
|
|
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 @@ export interface AccountGetResponse extends Account {
|
|
|
606
643
|
* {@link DeploymentDeleteResponse} for the law.
|
|
607
644
|
*/
|
|
608
645
|
export interface AccountDeleteResponse {
|
|
609
|
-
/** The account
|
|
646
|
+
/** The account whose deletion was accepted */
|
|
610
647
|
readonly account: string;
|
|
611
|
-
/**
|
|
612
|
-
readonly
|
|
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 @@ export 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
|
-
export 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 @@ export 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 @@ export interface TokenResource {
|
|
|
1726
1748
|
delete: (token: string) => Promise<TokenDeleteResponse>;
|
|
1727
1749
|
}
|
|
1728
1750
|
/**
|
|
1729
|
-
*
|
|
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
|
-
*
|
|
1732
|
-
*
|
|
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
|
+
export type BillingInterval = 'month' | 'year';
|
|
1758
|
+
/**
|
|
1759
|
+
* One row of the plan menu, answered by `GET /plans`.
|
|
1733
1760
|
*
|
|
1734
|
-
*
|
|
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
|
-
export interface
|
|
1737
|
-
/**
|
|
1738
|
-
|
|
1739
|
-
/**
|
|
1740
|
-
|
|
1741
|
-
/**
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1768
|
+
export 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
|
-
*
|
|
1791
|
+
* Response for `GET /plans` — the whole public menu, in display order.
|
|
1748
1792
|
*
|
|
1749
|
-
*
|
|
1750
|
-
*
|
|
1751
|
-
*
|
|
1793
|
+
* Public, unauthenticated and cacheable: it describes the product, not the
|
|
1794
|
+
* caller. Plans the operator only ever grants by hand are absent — a menu
|
|
1795
|
+
* lists what can be ordered.
|
|
1752
1796
|
*
|
|
1753
|
-
*
|
|
1754
|
-
*
|
|
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
|
-
export interface
|
|
1760
|
-
|
|
1761
|
-
readonly account: string;
|
|
1762
|
-
/** The plan the account now holds — `free` on a successful cancellation */
|
|
1763
|
-
readonly plan: AccountPlanType;
|
|
1800
|
+
export interface PlansResponse {
|
|
1801
|
+
readonly plans: readonly Plan[];
|
|
1764
1802
|
}
|
|
1765
1803
|
/**
|
|
1766
|
-
*
|
|
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
|
export interface CheckoutSession {
|
|
1769
|
-
/** URL to redirect
|
|
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
|
+
export 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
|
+
export 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
|
-
export type ActivityEvent = 'account.create' | 'account.update' | 'account.delete' | 'account.key.generate' | 'account.plan.paid' | 'account.plan.transition' | '
|
|
1840
|
+
export 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
|
*/
|
package/dist/index.js
CHANGED
|
@@ -169,16 +169,30 @@ export function validateIdempotencyKey(value) {
|
|
|
169
169
|
// ACCOUNT TYPES
|
|
170
170
|
// =============================================================================
|
|
171
171
|
/**
|
|
172
|
-
*
|
|
172
|
+
* Every plan an account can hold — the platform's whole plan vocabulary, in
|
|
173
|
+
* one place, and nothing about what a plan is WORTH.
|
|
174
|
+
*
|
|
175
|
+
* A plan is a TIER and nothing else. Whether an account may act is a separate
|
|
176
|
+
* fact (`Account.suspended`; deletion ends the session outright), so an
|
|
177
|
+
* account keeps its tier through suspension and into deletion.
|
|
178
|
+
*
|
|
179
|
+
* - **Free** — `free`.
|
|
180
|
+
* - **Billed** — `pro`. The one plan a customer can buy; the only plan Stripe
|
|
181
|
+
* knows about, and the only one the platform never sets by hand — it is
|
|
182
|
+
* derived from the Stripe subscription.
|
|
183
|
+
* - **Granted** — `scale`, `sponsored`. Paid plans the operator confers by
|
|
184
|
+
* hand; no Stripe subscription, no Checkout, no Stripe object at all.
|
|
185
|
+
*
|
|
186
|
+
* The numbers each plan confers — caps, sizes — are POLICY and are delivered
|
|
187
|
+
* by the API (`GET /plans`, `GET /account`, `GET /limits`), never published
|
|
188
|
+
* here: a price or a cap in a published package is pinned to whatever version
|
|
189
|
+
* a client installed (`CLAUDE.md`, "Validation: format vs policy").
|
|
173
190
|
*/
|
|
174
191
|
export const AccountPlan = {
|
|
175
192
|
FREE: 'free',
|
|
176
|
-
|
|
193
|
+
PRO: 'pro',
|
|
194
|
+
SCALE: 'scale',
|
|
177
195
|
SPONSORED: 'sponsored',
|
|
178
|
-
ENTERPRISE: 'enterprise',
|
|
179
|
-
SUSPENDED: 'suspended',
|
|
180
|
-
TERMINATING: 'terminating',
|
|
181
|
-
TERMINATED: 'terminated',
|
|
182
196
|
};
|
|
183
197
|
// =============================================================================
|
|
184
198
|
// WIRE SURFACE
|
|
@@ -234,6 +248,7 @@ export const API_PATHS = {
|
|
|
234
248
|
ACTIVITIES: '/activities',
|
|
235
249
|
LABELS: '/labels',
|
|
236
250
|
LIMITS: '/limits',
|
|
251
|
+
PLANS: '/plans',
|
|
237
252
|
PING: '/ping',
|
|
238
253
|
SETUP: '/setup',
|
|
239
254
|
SPA_CHECK: '/spa-check',
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -582,50 +582,66 @@ export interface TokenDeleteResponse {
|
|
|
582
582
|
// =============================================================================
|
|
583
583
|
|
|
584
584
|
/**
|
|
585
|
-
*
|
|
585
|
+
* Every plan an account can hold — the platform's whole plan vocabulary, in
|
|
586
|
+
* one place, and nothing about what a plan is WORTH.
|
|
587
|
+
*
|
|
588
|
+
* A plan is a TIER and nothing else. Whether an account may act is a separate
|
|
589
|
+
* fact (`Account.suspended`; deletion ends the session outright), so an
|
|
590
|
+
* account keeps its tier through suspension and into deletion.
|
|
591
|
+
*
|
|
592
|
+
* - **Free** — `free`.
|
|
593
|
+
* - **Billed** — `pro`. The one plan a customer can buy; the only plan Stripe
|
|
594
|
+
* knows about, and the only one the platform never sets by hand — it is
|
|
595
|
+
* derived from the Stripe subscription.
|
|
596
|
+
* - **Granted** — `scale`, `sponsored`. Paid plans the operator confers by
|
|
597
|
+
* hand; no Stripe subscription, no Checkout, no Stripe object at all.
|
|
598
|
+
*
|
|
599
|
+
* The numbers each plan confers — caps, sizes — are POLICY and are delivered
|
|
600
|
+
* by the API (`GET /plans`, `GET /account`, `GET /limits`), never published
|
|
601
|
+
* here: a price or a cap in a published package is pinned to whatever version
|
|
602
|
+
* a client installed (`CLAUDE.md`, "Validation: format vs policy").
|
|
586
603
|
*/
|
|
587
604
|
export const AccountPlan = {
|
|
588
605
|
FREE: 'free',
|
|
589
|
-
|
|
606
|
+
PRO: 'pro',
|
|
607
|
+
SCALE: 'scale',
|
|
590
608
|
SPONSORED: 'sponsored',
|
|
591
|
-
ENTERPRISE: 'enterprise',
|
|
592
|
-
SUSPENDED: 'suspended',
|
|
593
|
-
TERMINATING: 'terminating',
|
|
594
|
-
TERMINATED: 'terminated',
|
|
595
609
|
} as const;
|
|
596
610
|
|
|
597
611
|
export type AccountPlanType = (typeof AccountPlan)[keyof typeof AccountPlan];
|
|
598
612
|
|
|
599
613
|
/**
|
|
600
|
-
*
|
|
614
|
+
* The two things an account ACCUMULATES, and therefore the two things a plan
|
|
615
|
+
* caps. One word for the count and for the ceiling: `Account.usage` and
|
|
616
|
+
* `Account.caps` are the same shape, so a surface renders "2 of 3" by
|
|
617
|
+
* dividing one by the other and can never divide by a different denominator
|
|
618
|
+
* than the 403 uses.
|
|
601
619
|
*
|
|
602
|
-
*
|
|
603
|
-
*
|
|
604
|
-
*
|
|
605
|
-
* collection. `GET /account` is that resource for one caller, `GET
|
|
606
|
-
* /admin/stats` for the platform.
|
|
620
|
+
* Both are counts paid plans SELL. A platform subdomain (`x.shipstatic.com`)
|
|
621
|
+
* is not among them: the platform owns the name, it costs nothing, and no
|
|
622
|
+
* plan bounds how many an account may hold.
|
|
607
623
|
*
|
|
608
|
-
*
|
|
609
|
-
*
|
|
610
|
-
*
|
|
624
|
+
* Every cap carries a number on every plan — never `null`, never
|
|
625
|
+
* "unlimited" — so no consumer needs an "is it bounded?" branch.
|
|
626
|
+
*
|
|
627
|
+
* A count is an aggregate over a collection, so it lives on the summary
|
|
628
|
+
* resource that owns the collection: `GET /account` for one caller, `GET
|
|
629
|
+
* /admin/stats` platform-wide. Lists answer pages and carry no `total` (see
|
|
630
|
+
* {@link ListOptions}).
|
|
611
631
|
*/
|
|
612
|
-
export interface
|
|
613
|
-
/** Number of active custom domains (excludes paused) */
|
|
614
|
-
customDomains: number;
|
|
632
|
+
export interface Caps {
|
|
615
633
|
/**
|
|
616
|
-
* Deployments
|
|
617
|
-
*
|
|
618
|
-
*
|
|
619
|
-
* /deployments` lists successful ones only; that is a different question
|
|
620
|
-
* asked of a different resource.) Optional by the additive-evolution law:
|
|
621
|
-
* an API predating this field omits it.
|
|
634
|
+
* Deployments — every row whatever its status, because that is what the cap
|
|
635
|
+
* counts. (`GET /deployments` lists successful ones only; that is a
|
|
636
|
+
* different question asked of a different resource.)
|
|
622
637
|
*/
|
|
623
|
-
deployments
|
|
638
|
+
readonly deployments: number;
|
|
624
639
|
/**
|
|
625
|
-
*
|
|
626
|
-
*
|
|
640
|
+
* Hostnames the customer owns — every row, paused ones included. A paused
|
|
641
|
+
* domain still occupies its slot, so deleting one is what frees capacity.
|
|
642
|
+
* A downgraded account therefore reads honestly as "3 of 0".
|
|
627
643
|
*/
|
|
628
|
-
|
|
644
|
+
readonly customDomains: number;
|
|
629
645
|
}
|
|
630
646
|
|
|
631
647
|
/**
|
|
@@ -639,10 +655,22 @@ export interface Account {
|
|
|
639
655
|
readonly name: string | null;
|
|
640
656
|
/** User profile picture URL, null if not set */
|
|
641
657
|
readonly picture: string | null;
|
|
642
|
-
/**
|
|
658
|
+
/** The account's tier. */
|
|
643
659
|
readonly plan: AccountPlanType;
|
|
644
|
-
/**
|
|
645
|
-
|
|
660
|
+
/**
|
|
661
|
+
* True while the operator has suspended the account: reads and deletes
|
|
662
|
+
* still work, every write is refused. The plan is unchanged underneath.
|
|
663
|
+
*/
|
|
664
|
+
readonly suspended: boolean;
|
|
665
|
+
/** What the account currently holds — see {@link Caps}. */
|
|
666
|
+
readonly usage: Caps;
|
|
667
|
+
/**
|
|
668
|
+
* What the account is allowed to hold — the same three keys as
|
|
669
|
+
* {@link usage}, so the pair divides. These are the account's EFFECTIVE
|
|
670
|
+
* caps: its plan's numbers, plus whatever the operator granted it
|
|
671
|
+
* individually.
|
|
672
|
+
*/
|
|
673
|
+
readonly caps: Caps;
|
|
646
674
|
/** Unix timestamp (seconds) when account was created */
|
|
647
675
|
readonly created: number;
|
|
648
676
|
/** Unix timestamp (seconds) when account was activated (first deployment), null if not yet activated */
|
|
@@ -656,8 +684,17 @@ export interface Account {
|
|
|
656
684
|
* when present rather than forcing a lockstep SDK release.
|
|
657
685
|
*/
|
|
658
686
|
readonly used?: number | null;
|
|
659
|
-
/**
|
|
660
|
-
|
|
687
|
+
/**
|
|
688
|
+
* True while the Stripe Subscription's status is `past_due` and Stripe is
|
|
689
|
+
* still retrying the card. The plan is unchanged — the account keeps
|
|
690
|
+
* everything it has — so this is a banner, not a gate.
|
|
691
|
+
*
|
|
692
|
+
* A BOOLEAN rather than the status string: one fact for the console to act
|
|
693
|
+
* on. It carries STRIPE'S OWN WORD (`past_due` → `pastDue`) rather than a
|
|
694
|
+
* synonym, so no reader has to hold a translation; the full status string is
|
|
695
|
+
* mirrored on the account row for the operator surface.
|
|
696
|
+
*/
|
|
697
|
+
readonly pastDue: boolean;
|
|
661
698
|
}
|
|
662
699
|
|
|
663
700
|
/**
|
|
@@ -683,10 +720,10 @@ export interface AccountGetResponse extends Account {
|
|
|
683
720
|
* {@link DeploymentDeleteResponse} for the law.
|
|
684
721
|
*/
|
|
685
722
|
export interface AccountDeleteResponse {
|
|
686
|
-
/** The account
|
|
723
|
+
/** The account whose deletion was accepted */
|
|
687
724
|
readonly account: string;
|
|
688
|
-
/**
|
|
689
|
-
readonly
|
|
725
|
+
/** Unix timestamp (seconds) the deletion was requested; cleanup completes it */
|
|
726
|
+
readonly deleted: number;
|
|
690
727
|
}
|
|
691
728
|
|
|
692
729
|
/**
|
|
@@ -706,23 +743,6 @@ export interface AccountKeyResponse {
|
|
|
706
743
|
readonly secret: string;
|
|
707
744
|
}
|
|
708
745
|
|
|
709
|
-
/**
|
|
710
|
-
* Account-specific configuration overrides
|
|
711
|
-
* Allows per-account customization of limits without changing plan
|
|
712
|
-
*/
|
|
713
|
-
export interface AccountOverrides {
|
|
714
|
-
/** Override for maximum number of domains */
|
|
715
|
-
domains?: number;
|
|
716
|
-
/** Override for maximum number of deployments */
|
|
717
|
-
deployments?: number;
|
|
718
|
-
/** Override for maximum individual file size in bytes */
|
|
719
|
-
fileSize?: number;
|
|
720
|
-
/** Override for maximum number of files per deployment */
|
|
721
|
-
filesCount?: number;
|
|
722
|
-
/** Override for maximum total deployment size in bytes */
|
|
723
|
-
totalSize?: number;
|
|
724
|
-
}
|
|
725
|
-
|
|
726
746
|
// =============================================================================
|
|
727
747
|
// WIRE SURFACE
|
|
728
748
|
// =============================================================================
|
|
@@ -778,6 +798,7 @@ export const API_PATHS = {
|
|
|
778
798
|
ACTIVITIES: '/activities',
|
|
779
799
|
LABELS: '/labels',
|
|
780
800
|
LIMITS: '/limits',
|
|
801
|
+
PLANS: '/plans',
|
|
781
802
|
PING: '/ping',
|
|
782
803
|
SETUP: '/setup',
|
|
783
804
|
SPA_CHECK: '/spa-check',
|
|
@@ -2590,50 +2611,92 @@ export interface TokenResource {
|
|
|
2590
2611
|
// =============================================================================
|
|
2591
2612
|
|
|
2592
2613
|
/**
|
|
2593
|
-
*
|
|
2614
|
+
* How often a subscription renews. The platform sells one plan at two
|
|
2615
|
+
* intervals, so this is the only thing a buyer chooses at checkout.
|
|
2594
2616
|
*
|
|
2595
|
-
*
|
|
2596
|
-
*
|
|
2617
|
+
* It never branches business logic — monthly and yearly confer identical
|
|
2618
|
+
* caps. It exists to be displayed and to pick a price at checkout.
|
|
2619
|
+
*/
|
|
2620
|
+
export type BillingInterval = 'month' | 'year';
|
|
2621
|
+
|
|
2622
|
+
/**
|
|
2623
|
+
* One row of the plan menu, answered by `GET /plans`.
|
|
2597
2624
|
*
|
|
2598
|
-
*
|
|
2625
|
+
* **Vocabulary here, values from the server.** The shape is a wire contract
|
|
2626
|
+
* every surface agrees on; the numbers in it are policy the API owns and may
|
|
2627
|
+
* change on a deploy (`CLAUDE.md`, "Validation: format vs policy"). That is
|
|
2628
|
+
* why the public site and the console both READ this endpoint instead of
|
|
2629
|
+
* carrying their own copy of the price list — a hand-copied plan table was
|
|
2630
|
+
* the platform's longest-lived restatement.
|
|
2599
2631
|
*/
|
|
2600
|
-
export interface
|
|
2601
|
-
/**
|
|
2602
|
-
|
|
2603
|
-
/**
|
|
2604
|
-
|
|
2605
|
-
/**
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2632
|
+
export interface Plan {
|
|
2633
|
+
/** Which plan this row describes. */
|
|
2634
|
+
readonly plan: AccountPlanType;
|
|
2635
|
+
/** Display name, as the marketing site and the console should print it. */
|
|
2636
|
+
readonly name: string;
|
|
2637
|
+
/**
|
|
2638
|
+
* What it costs. A union rather than a nullable number, so "free" and
|
|
2639
|
+
* "talk to us" are two different answers instead of two readings of the
|
|
2640
|
+
* same `null`. Amounts are integer CENTS in USD, as the API's plan table
|
|
2641
|
+
* states them and as Stripe's Prices are provisioned from it — the wire
|
|
2642
|
+
* never carries a formatted price, because formatting is the reader's job.
|
|
2643
|
+
*/
|
|
2644
|
+
readonly price: 'free' | 'contact' | { readonly month: number; readonly year: number };
|
|
2645
|
+
/**
|
|
2646
|
+
* The caps this plan publishes, or `null` where the menu deliberately says
|
|
2647
|
+
* nothing (a plan sold by conversation publishes no numbers).
|
|
2648
|
+
*/
|
|
2649
|
+
readonly caps: Caps | null;
|
|
2609
2650
|
}
|
|
2610
2651
|
|
|
2611
2652
|
/**
|
|
2612
|
-
*
|
|
2653
|
+
* Response for `GET /plans` — the whole public menu, in display order.
|
|
2613
2654
|
*
|
|
2614
|
-
*
|
|
2615
|
-
*
|
|
2616
|
-
*
|
|
2655
|
+
* Public, unauthenticated and cacheable: it describes the product, not the
|
|
2656
|
+
* caller. Plans the operator only ever grants by hand are absent — a menu
|
|
2657
|
+
* lists what can be ordered.
|
|
2617
2658
|
*
|
|
2618
|
-
*
|
|
2619
|
-
*
|
|
2620
|
-
* whose prose no surface ever displayed: both callers await the promise and
|
|
2621
|
-
* discard the body, then compose their own toast. The message was written,
|
|
2622
|
-
* serialized, and thrown away on every cancellation.
|
|
2659
|
+
* An aggregate rather than a list: the registry is the bound, so there is no
|
|
2660
|
+
* cursor (the {@link LabelsResponse} shape).
|
|
2623
2661
|
*/
|
|
2624
|
-
export interface
|
|
2625
|
-
|
|
2626
|
-
readonly account: string;
|
|
2627
|
-
/** The plan the account now holds — `free` on a successful cancellation */
|
|
2628
|
-
readonly plan: AccountPlanType;
|
|
2662
|
+
export interface PlansResponse {
|
|
2663
|
+
readonly plans: readonly Plan[];
|
|
2629
2664
|
}
|
|
2630
2665
|
|
|
2631
2666
|
/**
|
|
2632
|
-
*
|
|
2667
|
+
* The answer of `POST /billing/checkout` — Stripe's `Checkout.Session`,
|
|
2668
|
+
* projected to the one field a client needs.
|
|
2669
|
+
*
|
|
2670
|
+
* There is nothing else to return: the outcome arrives later, as a Stripe
|
|
2671
|
+
* webhook. It is its own type rather than a shape shared with
|
|
2672
|
+
* {@link BillingPortalSession} because Stripe has two distinct objects here,
|
|
2673
|
+
* and naming one of them for both would be the reader's translation to make.
|
|
2633
2674
|
*/
|
|
2634
2675
|
export interface CheckoutSession {
|
|
2635
|
-
/** URL to redirect
|
|
2636
|
-
url: string;
|
|
2676
|
+
/** Absolute URL to redirect the browser to. Single use, short-lived. */
|
|
2677
|
+
readonly url: string;
|
|
2678
|
+
}
|
|
2679
|
+
|
|
2680
|
+
/**
|
|
2681
|
+
* The answer of `POST /billing/portal` — Stripe's `BillingPortal.Session`,
|
|
2682
|
+
* projected the same way. Identical in shape to {@link CheckoutSession} and
|
|
2683
|
+
* deliberately not merged with it: they are two Stripe objects, and either may
|
|
2684
|
+
* gain a field the other never has.
|
|
2685
|
+
*/
|
|
2686
|
+
export interface BillingPortalSession {
|
|
2687
|
+
/** Absolute URL to redirect the browser to. Single use, short-lived. */
|
|
2688
|
+
readonly url: string;
|
|
2689
|
+
}
|
|
2690
|
+
|
|
2691
|
+
/**
|
|
2692
|
+
* The answer of `POST /billing/sync` — the account's plan after the platform
|
|
2693
|
+
* re-read Stripe. The success page calls it once on arrival from Checkout,
|
|
2694
|
+
* instead of polling for the webhook: a card payment is settled by the time
|
|
2695
|
+
* Stripe redirects, so one read makes the plan current before anything
|
|
2696
|
+
* renders.
|
|
2697
|
+
*/
|
|
2698
|
+
export interface BillingSyncResponse {
|
|
2699
|
+
readonly plan: AccountPlanType;
|
|
2637
2700
|
}
|
|
2638
2701
|
|
|
2639
2702
|
// =============================================================================
|
|
@@ -2652,7 +2715,6 @@ export type ActivityEvent =
|
|
|
2652
2715
|
| 'account.key.generate'
|
|
2653
2716
|
| 'account.plan.paid'
|
|
2654
2717
|
| 'account.plan.transition'
|
|
2655
|
-
| 'account.suspended'
|
|
2656
2718
|
// Deployment events
|
|
2657
2719
|
| 'deployment.create'
|
|
2658
2720
|
| 'deployment.update'
|
|
@@ -2671,31 +2733,17 @@ export type ActivityEvent =
|
|
|
2671
2733
|
| 'token.delete'
|
|
2672
2734
|
// Admin events (not user-visible)
|
|
2673
2735
|
| 'admin.account.plan.update'
|
|
2736
|
+
| 'admin.account.suspended.update'
|
|
2674
2737
|
| 'admin.account.ref.update'
|
|
2675
|
-
| 'admin.account.billing.update'
|
|
2676
2738
|
| 'admin.account.labels.update'
|
|
2677
2739
|
| 'admin.deployment.delete'
|
|
2678
2740
|
| 'admin.domain.delete'
|
|
2679
|
-
| 'admin.
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
| 'billing.paused'
|
|
2686
|
-
| 'billing.expired'
|
|
2687
|
-
| 'billing.paid'
|
|
2688
|
-
| 'billing.trialing'
|
|
2689
|
-
| 'billing.scheduled_cancel'
|
|
2690
|
-
| 'billing.unpaid'
|
|
2691
|
-
| 'billing.update'
|
|
2692
|
-
| 'billing.past_due'
|
|
2693
|
-
| 'refund.created'
|
|
2694
|
-
| 'dispute.created'
|
|
2695
|
-
// Billing operational events (admin/debug only, not user-visible)
|
|
2696
|
-
| 'billing.sync' // Outbound: unit count pushed to payment provider
|
|
2697
|
-
| 'billing.stale' // Dropped: webhook predates last known state
|
|
2698
|
-
| 'billing.race'; // Dropped: concurrent webhook already updated state
|
|
2741
|
+
| 'admin.impersonate';
|
|
2742
|
+
|
|
2743
|
+
// A subscription's own history is not logged here. What a plan change MEANS
|
|
2744
|
+
// is recorded once, as `account.plan.transition`; everything behind it
|
|
2745
|
+
// (invoices, refunds, disputes, retries) belongs to Stripe, which owns the
|
|
2746
|
+
// record and shows it to the customer in the Customer Portal.
|
|
2699
2747
|
|
|
2700
2748
|
/**
|
|
2701
2749
|
* Activity events visible to users in the dashboard
|