@shipstatic/types 2.12.0 → 2.13.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 +136 -84
- package/dist/index.js +21 -6
- package/package.json +1 -1
- package/src/index.ts +141 -106
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.
|
|
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
|
-
*
|
|
529
|
-
*
|
|
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
|
-
*
|
|
535
|
-
*
|
|
536
|
-
*
|
|
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,16 @@ 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
|
|
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 @@ export interface AccountGetResponse extends Account {
|
|
|
606
642
|
* {@link DeploymentDeleteResponse} for the law.
|
|
607
643
|
*/
|
|
608
644
|
export interface AccountDeleteResponse {
|
|
609
|
-
/** The account
|
|
645
|
+
/** The account whose deletion was accepted */
|
|
610
646
|
readonly account: string;
|
|
611
|
-
/**
|
|
612
|
-
readonly
|
|
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 @@ export 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
|
-
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
666
|
/**
|
|
647
667
|
* Every path the public API answers on, declared once.
|
|
648
668
|
*
|
|
@@ -694,6 +714,7 @@ export 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 @@ export interface TokenResource {
|
|
|
1726
1747
|
delete: (token: string) => Promise<TokenDeleteResponse>;
|
|
1727
1748
|
}
|
|
1728
1749
|
/**
|
|
1729
|
-
*
|
|
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
|
-
*
|
|
1732
|
-
*
|
|
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
|
+
export type BillingInterval = 'month' | 'year';
|
|
1757
|
+
/**
|
|
1758
|
+
* One row of the plan menu, answered by `GET /plans`.
|
|
1733
1759
|
*
|
|
1734
|
-
*
|
|
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
|
-
export interface
|
|
1737
|
-
/**
|
|
1738
|
-
|
|
1739
|
-
/**
|
|
1740
|
-
|
|
1741
|
-
/**
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1767
|
+
export 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
|
-
*
|
|
1790
|
+
* Response for `GET /plans` — the whole public menu, in display order.
|
|
1748
1791
|
*
|
|
1749
|
-
*
|
|
1750
|
-
*
|
|
1751
|
-
*
|
|
1792
|
+
* Public, unauthenticated and cacheable: it describes the product, not the
|
|
1793
|
+
* caller. Plans the operator only ever grants by hand are absent — a menu
|
|
1794
|
+
* lists what can be ordered.
|
|
1752
1795
|
*
|
|
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.
|
|
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
|
-
export interface
|
|
1760
|
-
|
|
1761
|
-
readonly account: string;
|
|
1762
|
-
/** The plan the account now holds — `free` on a successful cancellation */
|
|
1763
|
-
readonly plan: AccountPlanType;
|
|
1799
|
+
export interface PlansResponse {
|
|
1800
|
+
readonly plans: readonly Plan[];
|
|
1764
1801
|
}
|
|
1765
1802
|
/**
|
|
1766
|
-
* 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
|
-
export interface
|
|
1769
|
-
/** URL to redirect
|
|
1770
|
-
url: string;
|
|
1810
|
+
export 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
|
+
export 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
|
-
export type ActivityEvent = 'account.create' | 'account.update' | 'account.delete' | 'account.key.generate' | 'account.plan.paid' | 'account.plan.transition' | '
|
|
1828
|
+
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
1829
|
/**
|
|
1778
1830
|
* Activity events visible to users in the dashboard
|
|
1779
1831
|
*/
|
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,16 @@ 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
|
|
693
|
+
* act on. Stripe's own status word is mirrored on the account row for the
|
|
694
|
+
* operator surface.
|
|
695
|
+
*/
|
|
696
|
+
readonly overdue: boolean;
|
|
661
697
|
}
|
|
662
698
|
|
|
663
699
|
/**
|
|
@@ -683,10 +719,10 @@ export interface AccountGetResponse extends Account {
|
|
|
683
719
|
* {@link DeploymentDeleteResponse} for the law.
|
|
684
720
|
*/
|
|
685
721
|
export interface AccountDeleteResponse {
|
|
686
|
-
/** The account
|
|
722
|
+
/** The account whose deletion was accepted */
|
|
687
723
|
readonly account: string;
|
|
688
|
-
/**
|
|
689
|
-
readonly
|
|
724
|
+
/** Unix timestamp (seconds) the deletion was requested; cleanup completes it */
|
|
725
|
+
readonly deleted: number;
|
|
690
726
|
}
|
|
691
727
|
|
|
692
728
|
/**
|
|
@@ -706,23 +742,6 @@ export interface AccountKeyResponse {
|
|
|
706
742
|
readonly secret: string;
|
|
707
743
|
}
|
|
708
744
|
|
|
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
745
|
// =============================================================================
|
|
727
746
|
// WIRE SURFACE
|
|
728
747
|
// =============================================================================
|
|
@@ -778,6 +797,7 @@ export const API_PATHS = {
|
|
|
778
797
|
ACTIVITIES: '/activities',
|
|
779
798
|
LABELS: '/labels',
|
|
780
799
|
LIMITS: '/limits',
|
|
800
|
+
PLANS: '/plans',
|
|
781
801
|
PING: '/ping',
|
|
782
802
|
SETUP: '/setup',
|
|
783
803
|
SPA_CHECK: '/spa-check',
|
|
@@ -2590,50 +2610,80 @@ export interface TokenResource {
|
|
|
2590
2610
|
// =============================================================================
|
|
2591
2611
|
|
|
2592
2612
|
/**
|
|
2593
|
-
*
|
|
2613
|
+
* How often a subscription renews. The platform sells one plan at two
|
|
2614
|
+
* intervals, so this is the only thing a buyer chooses at checkout.
|
|
2594
2615
|
*
|
|
2595
|
-
*
|
|
2596
|
-
*
|
|
2616
|
+
* It never branches business logic — monthly and yearly confer identical
|
|
2617
|
+
* caps. It exists to be displayed and to pick a price at checkout.
|
|
2618
|
+
*/
|
|
2619
|
+
export type BillingInterval = 'month' | 'year';
|
|
2620
|
+
|
|
2621
|
+
/**
|
|
2622
|
+
* One row of the plan menu, answered by `GET /plans`.
|
|
2597
2623
|
*
|
|
2598
|
-
*
|
|
2624
|
+
* **Vocabulary here, values from the server.** The shape is a wire contract
|
|
2625
|
+
* every surface agrees on; the numbers in it are policy the API owns and may
|
|
2626
|
+
* change on a deploy (`CLAUDE.md`, "Validation: format vs policy"). That is
|
|
2627
|
+
* why the public site and the console both READ this endpoint instead of
|
|
2628
|
+
* carrying their own copy of the price list — a hand-copied plan table was
|
|
2629
|
+
* the platform's longest-lived restatement.
|
|
2599
2630
|
*/
|
|
2600
|
-
export interface
|
|
2601
|
-
/**
|
|
2602
|
-
|
|
2603
|
-
/**
|
|
2604
|
-
|
|
2605
|
-
/**
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2631
|
+
export interface Plan {
|
|
2632
|
+
/** Which plan this row describes. */
|
|
2633
|
+
readonly plan: AccountPlanType;
|
|
2634
|
+
/** Display name, as the marketing site and the console should print it. */
|
|
2635
|
+
readonly name: string;
|
|
2636
|
+
/**
|
|
2637
|
+
* What it costs. A union rather than a nullable number, so "free" and
|
|
2638
|
+
* "talk to us" are two different answers instead of two readings of the
|
|
2639
|
+
* same `null`. Amounts are integer CENTS in USD, as the API's plan table
|
|
2640
|
+
* states them and as Stripe's Prices are provisioned from it — the wire
|
|
2641
|
+
* never carries a formatted price, because formatting is the reader's job.
|
|
2642
|
+
*/
|
|
2643
|
+
readonly price: 'free' | 'contact' | { readonly month: number; readonly year: number };
|
|
2644
|
+
/**
|
|
2645
|
+
* The caps this plan publishes, or `null` where the menu deliberately says
|
|
2646
|
+
* nothing (a plan sold by conversation publishes no numbers).
|
|
2647
|
+
*/
|
|
2648
|
+
readonly caps: Caps | null;
|
|
2609
2649
|
}
|
|
2610
2650
|
|
|
2611
2651
|
/**
|
|
2612
|
-
*
|
|
2652
|
+
* Response for `GET /plans` — the whole public menu, in display order.
|
|
2613
2653
|
*
|
|
2614
|
-
*
|
|
2615
|
-
*
|
|
2616
|
-
*
|
|
2654
|
+
* Public, unauthenticated and cacheable: it describes the product, not the
|
|
2655
|
+
* caller. Plans the operator only ever grants by hand are absent — a menu
|
|
2656
|
+
* lists what can be ordered.
|
|
2617
2657
|
*
|
|
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.
|
|
2658
|
+
* An aggregate rather than a list: the registry is the bound, so there is no
|
|
2659
|
+
* cursor (the {@link LabelsResponse} shape).
|
|
2623
2660
|
*/
|
|
2624
|
-
export interface
|
|
2625
|
-
|
|
2626
|
-
readonly account: string;
|
|
2627
|
-
/** The plan the account now holds — `free` on a successful cancellation */
|
|
2628
|
-
readonly plan: AccountPlanType;
|
|
2661
|
+
export interface PlansResponse {
|
|
2662
|
+
readonly plans: readonly Plan[];
|
|
2629
2663
|
}
|
|
2630
2664
|
|
|
2631
2665
|
/**
|
|
2632
|
-
* Checkout
|
|
2666
|
+
* A page Stripe hosts — a Checkout Session or a Customer Portal session — the
|
|
2667
|
+
* answer of `POST /billing/checkout` and `POST /billing/portal` alike.
|
|
2668
|
+
*
|
|
2669
|
+
* One shape for both because both say the same thing: the platform is not
|
|
2670
|
+
* where this happens, go here. There is nothing else to return — the
|
|
2671
|
+
* outcome arrives later, as a Stripe webhook.
|
|
2672
|
+
*/
|
|
2673
|
+
export interface StripeSession {
|
|
2674
|
+
/** Absolute URL to redirect the browser to. Single use, short-lived. */
|
|
2675
|
+
readonly url: string;
|
|
2676
|
+
}
|
|
2677
|
+
|
|
2678
|
+
/**
|
|
2679
|
+
* The answer of `POST /billing/sync` — the account's plan after the platform
|
|
2680
|
+
* re-read Stripe. The success page calls it once on arrival from Checkout,
|
|
2681
|
+
* instead of polling for the webhook: a card payment is settled by the time
|
|
2682
|
+
* Stripe redirects, so one read makes the plan current before anything
|
|
2683
|
+
* renders.
|
|
2633
2684
|
*/
|
|
2634
|
-
export interface
|
|
2635
|
-
|
|
2636
|
-
url: string;
|
|
2685
|
+
export interface BillingSyncResponse {
|
|
2686
|
+
readonly plan: AccountPlanType;
|
|
2637
2687
|
}
|
|
2638
2688
|
|
|
2639
2689
|
// =============================================================================
|
|
@@ -2652,7 +2702,6 @@ export type ActivityEvent =
|
|
|
2652
2702
|
| 'account.key.generate'
|
|
2653
2703
|
| 'account.plan.paid'
|
|
2654
2704
|
| 'account.plan.transition'
|
|
2655
|
-
| 'account.suspended'
|
|
2656
2705
|
// Deployment events
|
|
2657
2706
|
| 'deployment.create'
|
|
2658
2707
|
| 'deployment.update'
|
|
@@ -2671,31 +2720,17 @@ export type ActivityEvent =
|
|
|
2671
2720
|
| 'token.delete'
|
|
2672
2721
|
// Admin events (not user-visible)
|
|
2673
2722
|
| 'admin.account.plan.update'
|
|
2723
|
+
| 'admin.account.suspended.update'
|
|
2674
2724
|
| 'admin.account.ref.update'
|
|
2675
|
-
| 'admin.account.billing.update'
|
|
2676
2725
|
| 'admin.account.labels.update'
|
|
2677
2726
|
| 'admin.deployment.delete'
|
|
2678
2727
|
| '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
|
|
2728
|
+
| 'admin.impersonate';
|
|
2729
|
+
|
|
2730
|
+
// A subscription's own history is not logged here. What a plan change MEANS
|
|
2731
|
+
// is recorded once, as `account.plan.transition`; everything behind it
|
|
2732
|
+
// (invoices, refunds, disputes, retries) belongs to Stripe, which owns the
|
|
2733
|
+
// record and shows it to the customer in the Customer Portal.
|
|
2699
2734
|
|
|
2700
2735
|
/**
|
|
2701
2736
|
* Activity events visible to users in the dashboard
|