@shipstatic/ship 2.5.0-beta.1 → 2.6.0-beta.10
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/THIRD-PARTY-LICENSES.md +1 -1
- package/dist/browser.d.ts +158 -36
- package/dist/browser.js +1 -1
- package/dist/browser.js.map +1 -1
- package/dist/cli.cjs +1 -1
- package/dist/cli.cjs.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +158 -36
- package/dist/index.d.ts +158 -36
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -518,11 +518,15 @@ interface TokenDeleteResponse {
|
|
|
518
518
|
* account keeps its tier through suspension and into deletion.
|
|
519
519
|
*
|
|
520
520
|
* - **Free** — `free`.
|
|
521
|
-
* - **Billed** — `pro`. The
|
|
522
|
-
* knows about, and the only
|
|
523
|
-
* derived from the Stripe
|
|
521
|
+
* - **Billed** — `pro`, `team`. The plans a customer buys; the only plans
|
|
522
|
+
* Stripe knows about, and the only ones the platform never sets by hand —
|
|
523
|
+
* each is derived from the Stripe Subscription, which names its plan on the
|
|
524
|
+
* Price it is on. They form a ladder: a dearer tier is a superset of the one
|
|
525
|
+
* below it, and the API says which is next in {@link Account.upgrade}.
|
|
524
526
|
* - **Granted** — `scale`, `sponsored`. Paid plans the operator confers by
|
|
525
|
-
* hand; no Stripe subscription, no Checkout, no Stripe object at all.
|
|
527
|
+
* hand; no Stripe subscription, no Checkout, no Stripe object at all. These
|
|
528
|
+
* and `free` are the only plans an operator can set; a billed plan is only
|
|
529
|
+
* ever Stripe's to confer.
|
|
526
530
|
*
|
|
527
531
|
* The numbers each plan confers — caps, sizes — are POLICY and are delivered
|
|
528
532
|
* by the API (`GET /plans`, `GET /account`, `GET /limits`), never published
|
|
@@ -532,23 +536,31 @@ interface TokenDeleteResponse {
|
|
|
532
536
|
declare const AccountPlan: {
|
|
533
537
|
readonly FREE: "free";
|
|
534
538
|
readonly PRO: "pro";
|
|
539
|
+
readonly TEAM: "team";
|
|
535
540
|
readonly SCALE: "scale";
|
|
536
541
|
readonly SPONSORED: "sponsored";
|
|
537
542
|
};
|
|
538
543
|
type AccountPlanType = (typeof AccountPlan)[keyof typeof AccountPlan];
|
|
539
544
|
/**
|
|
540
|
-
* The
|
|
541
|
-
* caps. One word for the count and for the ceiling: `Account.usage` and
|
|
545
|
+
* The three things an account ACCUMULATES, and therefore the three things a
|
|
546
|
+
* plan caps. One word for the count and for the ceiling: `Account.usage` and
|
|
542
547
|
* `Account.caps` are the same shape, so a surface renders "2 of 3" by
|
|
543
548
|
* dividing one by the other and can never divide by a different denominator
|
|
544
549
|
* than the 403 uses.
|
|
545
550
|
*
|
|
546
|
-
*
|
|
547
|
-
* is
|
|
548
|
-
* plan bounds how many
|
|
551
|
+
* All three are counts plans SELL, and every plan publishes a number for each.
|
|
552
|
+
* A platform subdomain (`my-app.shipstatic.com`) is among them: the namespace
|
|
553
|
+
* is the platform's, so every plan bounds how many names one account may take
|
|
554
|
+
* from it — which is not the address every deployment gets by construction
|
|
555
|
+
* (`happy-cat-abc1234.shipstatic.com`), one per deployment and bounded by
|
|
556
|
+
* `deployments` already.
|
|
549
557
|
*
|
|
550
558
|
* Every cap carries a number on every plan — never `null`, never
|
|
551
|
-
* "unlimited" — so no consumer needs an "is it bounded?" branch.
|
|
559
|
+
* "unlimited" — so no consumer needs an "is it bounded?" branch. A cap of `0`
|
|
560
|
+
* means the plan does not have the feature at all; a cap of `N` bounds
|
|
561
|
+
* creation, and what an account already holds above a cap stays until a plan
|
|
562
|
+
* TRANSITION fits it (excess paused, newest first — a domain is the only kind
|
|
563
|
+
* that pauses).
|
|
552
564
|
*
|
|
553
565
|
* A count is an aggregate over a collection, so it lives on the summary
|
|
554
566
|
* resource that owns the collection: `GET /account` for one caller, `GET
|
|
@@ -562,6 +574,12 @@ interface Caps {
|
|
|
562
574
|
* different question asked of a different resource.)
|
|
563
575
|
*/
|
|
564
576
|
readonly deployments: number;
|
|
577
|
+
/**
|
|
578
|
+
* Names the customer chose under the platform's own suffix
|
|
579
|
+
* (`my-app.shipstatic.com`) — every row, paused ones included, by the same
|
|
580
|
+
* rule as custom domains.
|
|
581
|
+
*/
|
|
582
|
+
readonly platformDomains: number;
|
|
565
583
|
/**
|
|
566
584
|
* Hostnames the customer owns — every row, paused ones included. A paused
|
|
567
585
|
* domain still occupies its slot, so deleting one is what frees capacity.
|
|
@@ -620,6 +638,47 @@ interface Account {
|
|
|
620
638
|
* mirrored on the account row for the operator surface.
|
|
621
639
|
*/
|
|
622
640
|
readonly pastDue: boolean;
|
|
641
|
+
/**
|
|
642
|
+
* Does Stripe bill this plan — is there a Subscription behind it? True for
|
|
643
|
+
* every billed tier, including one no longer on the menu (a grandfathered
|
|
644
|
+
* row keeps its subscribers), so a console cannot derive it from `/plans`.
|
|
645
|
+
* It is what sends the account to the Customer Portal rather than to
|
|
646
|
+
* Checkout, and what a granted plan (`scale`, `sponsored`) never is.
|
|
647
|
+
*/
|
|
648
|
+
readonly billed: boolean;
|
|
649
|
+
/**
|
|
650
|
+
* The next plan up the ladder this account could move to, or `null` when
|
|
651
|
+
* there is none: the top billed tier, every granted plan, and any plan not
|
|
652
|
+
* on the menu answer `null`. One server-side fact so that no surface
|
|
653
|
+
* derives "can this account upgrade, and to what" from the menu — a
|
|
654
|
+
* grandfathered row has no menu price to compare, and a granted account
|
|
655
|
+
* must never be sent to Checkout.
|
|
656
|
+
*/
|
|
657
|
+
readonly upgrade: AccountPlanType | null;
|
|
658
|
+
/**
|
|
659
|
+
* The live Subscription's billing interval — Stripe's
|
|
660
|
+
* `Price.recurring.interval`, mirrored — or `null` when no Subscription
|
|
661
|
+
* bills the account (free and granted plans). It is what lets the console
|
|
662
|
+
* offer the current plan's OTHER interval as a switch.
|
|
663
|
+
*/
|
|
664
|
+
readonly interval: BillingInterval | null;
|
|
665
|
+
/**
|
|
666
|
+
* The pending plan change, or `null`. *Up is now, down is at period end*:
|
|
667
|
+
* a downgrade is a Stripe Subscription Schedule that applies at `at`, and
|
|
668
|
+
* until then the account keeps everything it paid for. Reversible —
|
|
669
|
+
* `DELETE /billing/change` releases it.
|
|
670
|
+
*/
|
|
671
|
+
readonly scheduled: ScheduledChange | null;
|
|
672
|
+
/**
|
|
673
|
+
* When the Subscription is set to END — Stripe's `cancel_at`, mirrored
|
|
674
|
+
* (Unix seconds) — or `null` while it renews. Set by a cancellation in the
|
|
675
|
+
* Customer Portal; the Portal is also where it is resumed. The console
|
|
676
|
+
* needs it to ACT: no "cancel" offered to an account already cancelling,
|
|
677
|
+
* and no plan change offered until it is resumed (the API refuses one).
|
|
678
|
+
* Mirrored on the rule that survives: what the console must act on is
|
|
679
|
+
* mirrored, what it would merely display is not.
|
|
680
|
+
*/
|
|
681
|
+
readonly cancelAt: number | null;
|
|
623
682
|
}
|
|
624
683
|
/**
|
|
625
684
|
* Account as returned by `GET /account` — the entity plus how the request
|
|
@@ -1164,8 +1223,10 @@ declare const SIGN_IN_RETURN_PARAM = "signing-in";
|
|
|
1164
1223
|
* Client populations: `SESSION` (first-party cookie), `API_KEY` (`ship-`
|
|
1165
1224
|
* key), `TOKEN` (`deploy-` deploy token), `AGENT` (anonymous public deploy —
|
|
1166
1225
|
* no credential; the platform grants the public-account identity per
|
|
1167
|
-
* request), `OAUTH` (delegated access token).
|
|
1168
|
-
*
|
|
1226
|
+
* request), `OAUTH` (delegated access token). The one server population:
|
|
1227
|
+
* `SYSTEM` (scheduled/background jobs). Webhook receipt is deliberately not
|
|
1228
|
+
* a population: a signed delivery is verified, never authorized — it acts
|
|
1229
|
+
* as no one and audits as no one.
|
|
1169
1230
|
*/
|
|
1170
1231
|
declare const AuthMethod: {
|
|
1171
1232
|
readonly SESSION: "session";
|
|
@@ -1173,7 +1234,6 @@ declare const AuthMethod: {
|
|
|
1173
1234
|
readonly TOKEN: "token";
|
|
1174
1235
|
readonly AGENT: "agent";
|
|
1175
1236
|
readonly OAUTH: "oauth";
|
|
1176
|
-
readonly WEBHOOK: "webhook";
|
|
1177
1237
|
readonly SYSTEM: "system";
|
|
1178
1238
|
};
|
|
1179
1239
|
type AuthMethodType = (typeof AuthMethod)[keyof typeof AuthMethod];
|
|
@@ -1748,11 +1808,11 @@ interface TokenResource {
|
|
|
1748
1808
|
delete: (token: string) => Promise<TokenDeleteResponse>;
|
|
1749
1809
|
}
|
|
1750
1810
|
/**
|
|
1751
|
-
* How often a subscription renews.
|
|
1752
|
-
* intervals, so
|
|
1811
|
+
* How often a subscription renews. Every billed plan is sold at both
|
|
1812
|
+
* intervals, so a buyer chooses a plan and an interval, and nothing else.
|
|
1753
1813
|
*
|
|
1754
1814
|
* It never branches business logic — monthly and yearly confer identical
|
|
1755
|
-
* caps. It exists to be displayed and to pick a
|
|
1815
|
+
* caps. It exists to be displayed and to pick a Price at checkout.
|
|
1756
1816
|
*/
|
|
1757
1817
|
type BillingInterval = 'month' | 'year';
|
|
1758
1818
|
/**
|
|
@@ -1771,13 +1831,20 @@ interface Plan {
|
|
|
1771
1831
|
/** Display name, as the marketing site and the console should print it. */
|
|
1772
1832
|
readonly name: string;
|
|
1773
1833
|
/**
|
|
1774
|
-
* What it costs
|
|
1775
|
-
*
|
|
1776
|
-
*
|
|
1777
|
-
*
|
|
1778
|
-
*
|
|
1834
|
+
* What it costs, per interval — integer CENTS in USD, as the API's plan
|
|
1835
|
+
* table states them and as Stripe's Prices are provisioned from it. The wire
|
|
1836
|
+
* never carries a formatted price: formatting is the reader's job.
|
|
1837
|
+
*
|
|
1838
|
+
* **A free plan costs `{ month: 0, year: 0 }`, not a sentinel.** Free IS
|
|
1839
|
+
* zero, so it is a number like any other and every reader formats it with
|
|
1840
|
+
* the same call; a `'free'` member bought one thing — a branch in each
|
|
1841
|
+
* consumer that mapped it straight back to `$0`.
|
|
1842
|
+
*
|
|
1843
|
+
* `'contact'` stays, and the asymmetry is the point: "not sold at a list
|
|
1844
|
+
* price" is genuinely a different KIND of answer, not a different number, so
|
|
1845
|
+
* it is a different shape. Two shapes, and each earns its own.
|
|
1779
1846
|
*/
|
|
1780
|
-
readonly price: '
|
|
1847
|
+
readonly price: 'contact' | {
|
|
1781
1848
|
readonly month: number;
|
|
1782
1849
|
readonly year: number;
|
|
1783
1850
|
};
|
|
@@ -1786,6 +1853,20 @@ interface Plan {
|
|
|
1786
1853
|
* nothing (a plan sold by conversation publishes no numbers).
|
|
1787
1854
|
*/
|
|
1788
1855
|
readonly caps: Caps | null;
|
|
1856
|
+
/**
|
|
1857
|
+
* Why this row cannot be ordered right now — the closed door's own sentence,
|
|
1858
|
+
* verbatim — or absent when the way is open. A menu lists what can be
|
|
1859
|
+
* ordered, and a row that is sold but not yet orderable (its door is closed:
|
|
1860
|
+
* checkout unbuilt, a feature unfinished) SAYS SO on the menu instead of
|
|
1861
|
+
* only at the order.
|
|
1862
|
+
*
|
|
1863
|
+
* Clients branch on PRESENCE and render the sentence unchanged — they know
|
|
1864
|
+
* *that* the row is closed, never *which* door or *when it lifts*; the
|
|
1865
|
+
* vocabulary of doors stays server-side. The same rule the refusal follows:
|
|
1866
|
+
* `POST /billing/change` onto a closed row answers 400 with
|
|
1867
|
+
* `details.closed`, and its `message` is this sentence.
|
|
1868
|
+
*/
|
|
1869
|
+
readonly closed?: string;
|
|
1789
1870
|
}
|
|
1790
1871
|
/**
|
|
1791
1872
|
* Response for `GET /plans` — the whole public menu, in display order.
|
|
@@ -1801,23 +1882,59 @@ interface PlansResponse {
|
|
|
1801
1882
|
readonly plans: readonly Plan[];
|
|
1802
1883
|
}
|
|
1803
1884
|
/**
|
|
1804
|
-
* The
|
|
1805
|
-
*
|
|
1885
|
+
* The body of `POST /billing/change` — the one door for "get me onto this
|
|
1886
|
+
* plan". Both fields required: with more than one billed plan there is no
|
|
1887
|
+
* honest default, and the console always knows which card was clicked.
|
|
1806
1888
|
*
|
|
1807
|
-
*
|
|
1808
|
-
*
|
|
1809
|
-
*
|
|
1810
|
-
*
|
|
1889
|
+
* The SERVER decides what the change means — the rule is *up is now, down is
|
|
1890
|
+
* at period end* — so the client holds no copy of the ladder: a free account
|
|
1891
|
+
* is sent to Stripe Checkout, a billed account moving up is sent to the
|
|
1892
|
+
* Portal's confirmation page (money moves now, so Stripe's page takes the
|
|
1893
|
+
* consent), and a billed account moving down gets a Stripe Subscription
|
|
1894
|
+
* Schedule that applies the change at period end. The answer says which
|
|
1895
|
+
* happened ({@link PlanChangeResponse}).
|
|
1811
1896
|
*/
|
|
1812
|
-
interface
|
|
1813
|
-
|
|
1897
|
+
interface PlanChangeRequest {
|
|
1898
|
+
readonly plan: AccountPlanType;
|
|
1899
|
+
readonly interval: BillingInterval;
|
|
1900
|
+
}
|
|
1901
|
+
/**
|
|
1902
|
+
* The pending plan change — a Stripe Subscription Schedule the platform
|
|
1903
|
+
* minted, mirrored onto the account. `at` is when it applies (the current
|
|
1904
|
+
* period's end, Unix seconds). Reversible until then: `DELETE
|
|
1905
|
+
* /billing/change` releases it.
|
|
1906
|
+
*/
|
|
1907
|
+
interface ScheduledChange {
|
|
1908
|
+
readonly plan: AccountPlanType;
|
|
1909
|
+
readonly interval: BillingInterval;
|
|
1910
|
+
readonly at: number;
|
|
1911
|
+
}
|
|
1912
|
+
/**
|
|
1913
|
+
* The answer of `POST /billing/change` — exactly one field is set, and the
|
|
1914
|
+
* UNION is what holds that: an answer carrying both, or neither, does not
|
|
1915
|
+
* compile, so "which door was taken" is structural rather than prose.
|
|
1916
|
+
*
|
|
1917
|
+
* `url` means GO: a Stripe page (Checkout, or the Portal's confirmation page)
|
|
1918
|
+
* finishes the change and the browser must be redirected to it. `scheduled`
|
|
1919
|
+
* means DONE: the downgrade is booked for period end, nothing to visit, and
|
|
1920
|
+
* the account's `scheduled` field now carries it.
|
|
1921
|
+
*/
|
|
1922
|
+
type PlanChangeResponse =
|
|
1923
|
+
/** GO: a Stripe page finishes the change. Absolute URL, single use, short-lived. */
|
|
1924
|
+
{
|
|
1814
1925
|
readonly url: string;
|
|
1926
|
+
readonly scheduled?: never;
|
|
1815
1927
|
}
|
|
1928
|
+
/** DONE: the downgrade is booked for period end; nothing to visit. */
|
|
1929
|
+
| {
|
|
1930
|
+
readonly url?: never;
|
|
1931
|
+
readonly scheduled: ScheduledChange;
|
|
1932
|
+
};
|
|
1816
1933
|
/**
|
|
1817
1934
|
* The answer of `POST /billing/portal` — Stripe's `BillingPortal.Session`,
|
|
1818
|
-
* projected the
|
|
1819
|
-
*
|
|
1820
|
-
*
|
|
1935
|
+
* projected to the one field a client needs. The Portal home: cards,
|
|
1936
|
+
* invoices, cancellation. Plan changes have their own door
|
|
1937
|
+
* ({@link PlanChangeRequest}).
|
|
1821
1938
|
*/
|
|
1822
1939
|
interface BillingPortalSession {
|
|
1823
1940
|
/** Absolute URL to redirect the browser to. Single use, short-lived. */
|
|
@@ -1836,12 +1953,17 @@ interface BillingSyncResponse {
|
|
|
1836
1953
|
/**
|
|
1837
1954
|
* All activity event types logged in the system.
|
|
1838
1955
|
* Uses dot notation consistently: {resource}.{action}
|
|
1956
|
+
*
|
|
1957
|
+
* Retention: activity rows are permanent — the account's own history and
|
|
1958
|
+
* the platform's audit ledgers are one table, kept for the life of the
|
|
1959
|
+
* account (deletion removes them). Only the personal payload is
|
|
1960
|
+
* time-bounded: past 90 days each row sheds its IP.
|
|
1839
1961
|
*/
|
|
1840
|
-
type ActivityEvent = 'account.create' | 'account.
|
|
1962
|
+
type ActivityEvent = 'account.create' | 'account.delete' | 'account.key.generate' | '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';
|
|
1841
1963
|
/**
|
|
1842
1964
|
* Activity events visible to users in the dashboard
|
|
1843
1965
|
*/
|
|
1844
|
-
type UserVisibleActivityEvent = 'account.create' | 'account.
|
|
1966
|
+
type UserVisibleActivityEvent = 'account.create' | 'account.delete' | 'account.key.generate' | 'account.plan.transition' | 'deployment.create' | 'deployment.update' | 'deployment.delete' | 'deployment.claim' | 'domain.create' | 'domain.update' | 'domain.delete' | 'domain.verify' | 'token.create' | 'token.consume' | 'token.delete';
|
|
1845
1967
|
/**
|
|
1846
1968
|
* Activity record returned from the API
|
|
1847
1969
|
*/
|
|
@@ -3020,6 +3142,6 @@ declare class Ship extends Ship$1 {
|
|
|
3020
3142
|
}
|
|
3021
3143
|
|
|
3022
3144
|
declare namespace Ship {
|
|
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,
|
|
3145
|
+
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, 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, PlanChangeRequest, PlanChangeResponse, PlansResponse, PlatformLimits, RequestResult, ResourceContext, SHIP_ENV, SIGN_IN_RETURN_PARAM, SPACheckDebug, SPACheckRequest, SPACheckResponse, SPA_CHECK_CONSTRAINTS, SPA_DEFAULT_CONFIG, ScheduledChange, 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 };
|
|
3024
3146
|
}
|
|
3025
3147
|
export = Ship;
|
package/dist/index.d.ts
CHANGED
|
@@ -518,11 +518,15 @@ interface TokenDeleteResponse {
|
|
|
518
518
|
* account keeps its tier through suspension and into deletion.
|
|
519
519
|
*
|
|
520
520
|
* - **Free** — `free`.
|
|
521
|
-
* - **Billed** — `pro`. The
|
|
522
|
-
* knows about, and the only
|
|
523
|
-
* derived from the Stripe
|
|
521
|
+
* - **Billed** — `pro`, `team`. The plans a customer buys; the only plans
|
|
522
|
+
* Stripe knows about, and the only ones the platform never sets by hand —
|
|
523
|
+
* each is derived from the Stripe Subscription, which names its plan on the
|
|
524
|
+
* Price it is on. They form a ladder: a dearer tier is a superset of the one
|
|
525
|
+
* below it, and the API says which is next in {@link Account.upgrade}.
|
|
524
526
|
* - **Granted** — `scale`, `sponsored`. Paid plans the operator confers by
|
|
525
|
-
* hand; no Stripe subscription, no Checkout, no Stripe object at all.
|
|
527
|
+
* hand; no Stripe subscription, no Checkout, no Stripe object at all. These
|
|
528
|
+
* and `free` are the only plans an operator can set; a billed plan is only
|
|
529
|
+
* ever Stripe's to confer.
|
|
526
530
|
*
|
|
527
531
|
* The numbers each plan confers — caps, sizes — are POLICY and are delivered
|
|
528
532
|
* by the API (`GET /plans`, `GET /account`, `GET /limits`), never published
|
|
@@ -532,23 +536,31 @@ interface TokenDeleteResponse {
|
|
|
532
536
|
declare const AccountPlan: {
|
|
533
537
|
readonly FREE: "free";
|
|
534
538
|
readonly PRO: "pro";
|
|
539
|
+
readonly TEAM: "team";
|
|
535
540
|
readonly SCALE: "scale";
|
|
536
541
|
readonly SPONSORED: "sponsored";
|
|
537
542
|
};
|
|
538
543
|
type AccountPlanType = (typeof AccountPlan)[keyof typeof AccountPlan];
|
|
539
544
|
/**
|
|
540
|
-
* The
|
|
541
|
-
* caps. One word for the count and for the ceiling: `Account.usage` and
|
|
545
|
+
* The three things an account ACCUMULATES, and therefore the three things a
|
|
546
|
+
* plan caps. One word for the count and for the ceiling: `Account.usage` and
|
|
542
547
|
* `Account.caps` are the same shape, so a surface renders "2 of 3" by
|
|
543
548
|
* dividing one by the other and can never divide by a different denominator
|
|
544
549
|
* than the 403 uses.
|
|
545
550
|
*
|
|
546
|
-
*
|
|
547
|
-
* is
|
|
548
|
-
* plan bounds how many
|
|
551
|
+
* All three are counts plans SELL, and every plan publishes a number for each.
|
|
552
|
+
* A platform subdomain (`my-app.shipstatic.com`) is among them: the namespace
|
|
553
|
+
* is the platform's, so every plan bounds how many names one account may take
|
|
554
|
+
* from it — which is not the address every deployment gets by construction
|
|
555
|
+
* (`happy-cat-abc1234.shipstatic.com`), one per deployment and bounded by
|
|
556
|
+
* `deployments` already.
|
|
549
557
|
*
|
|
550
558
|
* Every cap carries a number on every plan — never `null`, never
|
|
551
|
-
* "unlimited" — so no consumer needs an "is it bounded?" branch.
|
|
559
|
+
* "unlimited" — so no consumer needs an "is it bounded?" branch. A cap of `0`
|
|
560
|
+
* means the plan does not have the feature at all; a cap of `N` bounds
|
|
561
|
+
* creation, and what an account already holds above a cap stays until a plan
|
|
562
|
+
* TRANSITION fits it (excess paused, newest first — a domain is the only kind
|
|
563
|
+
* that pauses).
|
|
552
564
|
*
|
|
553
565
|
* A count is an aggregate over a collection, so it lives on the summary
|
|
554
566
|
* resource that owns the collection: `GET /account` for one caller, `GET
|
|
@@ -562,6 +574,12 @@ interface Caps {
|
|
|
562
574
|
* different question asked of a different resource.)
|
|
563
575
|
*/
|
|
564
576
|
readonly deployments: number;
|
|
577
|
+
/**
|
|
578
|
+
* Names the customer chose under the platform's own suffix
|
|
579
|
+
* (`my-app.shipstatic.com`) — every row, paused ones included, by the same
|
|
580
|
+
* rule as custom domains.
|
|
581
|
+
*/
|
|
582
|
+
readonly platformDomains: number;
|
|
565
583
|
/**
|
|
566
584
|
* Hostnames the customer owns — every row, paused ones included. A paused
|
|
567
585
|
* domain still occupies its slot, so deleting one is what frees capacity.
|
|
@@ -620,6 +638,47 @@ interface Account {
|
|
|
620
638
|
* mirrored on the account row for the operator surface.
|
|
621
639
|
*/
|
|
622
640
|
readonly pastDue: boolean;
|
|
641
|
+
/**
|
|
642
|
+
* Does Stripe bill this plan — is there a Subscription behind it? True for
|
|
643
|
+
* every billed tier, including one no longer on the menu (a grandfathered
|
|
644
|
+
* row keeps its subscribers), so a console cannot derive it from `/plans`.
|
|
645
|
+
* It is what sends the account to the Customer Portal rather than to
|
|
646
|
+
* Checkout, and what a granted plan (`scale`, `sponsored`) never is.
|
|
647
|
+
*/
|
|
648
|
+
readonly billed: boolean;
|
|
649
|
+
/**
|
|
650
|
+
* The next plan up the ladder this account could move to, or `null` when
|
|
651
|
+
* there is none: the top billed tier, every granted plan, and any plan not
|
|
652
|
+
* on the menu answer `null`. One server-side fact so that no surface
|
|
653
|
+
* derives "can this account upgrade, and to what" from the menu — a
|
|
654
|
+
* grandfathered row has no menu price to compare, and a granted account
|
|
655
|
+
* must never be sent to Checkout.
|
|
656
|
+
*/
|
|
657
|
+
readonly upgrade: AccountPlanType | null;
|
|
658
|
+
/**
|
|
659
|
+
* The live Subscription's billing interval — Stripe's
|
|
660
|
+
* `Price.recurring.interval`, mirrored — or `null` when no Subscription
|
|
661
|
+
* bills the account (free and granted plans). It is what lets the console
|
|
662
|
+
* offer the current plan's OTHER interval as a switch.
|
|
663
|
+
*/
|
|
664
|
+
readonly interval: BillingInterval | null;
|
|
665
|
+
/**
|
|
666
|
+
* The pending plan change, or `null`. *Up is now, down is at period end*:
|
|
667
|
+
* a downgrade is a Stripe Subscription Schedule that applies at `at`, and
|
|
668
|
+
* until then the account keeps everything it paid for. Reversible —
|
|
669
|
+
* `DELETE /billing/change` releases it.
|
|
670
|
+
*/
|
|
671
|
+
readonly scheduled: ScheduledChange | null;
|
|
672
|
+
/**
|
|
673
|
+
* When the Subscription is set to END — Stripe's `cancel_at`, mirrored
|
|
674
|
+
* (Unix seconds) — or `null` while it renews. Set by a cancellation in the
|
|
675
|
+
* Customer Portal; the Portal is also where it is resumed. The console
|
|
676
|
+
* needs it to ACT: no "cancel" offered to an account already cancelling,
|
|
677
|
+
* and no plan change offered until it is resumed (the API refuses one).
|
|
678
|
+
* Mirrored on the rule that survives: what the console must act on is
|
|
679
|
+
* mirrored, what it would merely display is not.
|
|
680
|
+
*/
|
|
681
|
+
readonly cancelAt: number | null;
|
|
623
682
|
}
|
|
624
683
|
/**
|
|
625
684
|
* Account as returned by `GET /account` — the entity plus how the request
|
|
@@ -1164,8 +1223,10 @@ declare const SIGN_IN_RETURN_PARAM = "signing-in";
|
|
|
1164
1223
|
* Client populations: `SESSION` (first-party cookie), `API_KEY` (`ship-`
|
|
1165
1224
|
* key), `TOKEN` (`deploy-` deploy token), `AGENT` (anonymous public deploy —
|
|
1166
1225
|
* no credential; the platform grants the public-account identity per
|
|
1167
|
-
* request), `OAUTH` (delegated access token).
|
|
1168
|
-
*
|
|
1226
|
+
* request), `OAUTH` (delegated access token). The one server population:
|
|
1227
|
+
* `SYSTEM` (scheduled/background jobs). Webhook receipt is deliberately not
|
|
1228
|
+
* a population: a signed delivery is verified, never authorized — it acts
|
|
1229
|
+
* as no one and audits as no one.
|
|
1169
1230
|
*/
|
|
1170
1231
|
declare const AuthMethod: {
|
|
1171
1232
|
readonly SESSION: "session";
|
|
@@ -1173,7 +1234,6 @@ declare const AuthMethod: {
|
|
|
1173
1234
|
readonly TOKEN: "token";
|
|
1174
1235
|
readonly AGENT: "agent";
|
|
1175
1236
|
readonly OAUTH: "oauth";
|
|
1176
|
-
readonly WEBHOOK: "webhook";
|
|
1177
1237
|
readonly SYSTEM: "system";
|
|
1178
1238
|
};
|
|
1179
1239
|
type AuthMethodType = (typeof AuthMethod)[keyof typeof AuthMethod];
|
|
@@ -1748,11 +1808,11 @@ interface TokenResource {
|
|
|
1748
1808
|
delete: (token: string) => Promise<TokenDeleteResponse>;
|
|
1749
1809
|
}
|
|
1750
1810
|
/**
|
|
1751
|
-
* How often a subscription renews.
|
|
1752
|
-
* intervals, so
|
|
1811
|
+
* How often a subscription renews. Every billed plan is sold at both
|
|
1812
|
+
* intervals, so a buyer chooses a plan and an interval, and nothing else.
|
|
1753
1813
|
*
|
|
1754
1814
|
* It never branches business logic — monthly and yearly confer identical
|
|
1755
|
-
* caps. It exists to be displayed and to pick a
|
|
1815
|
+
* caps. It exists to be displayed and to pick a Price at checkout.
|
|
1756
1816
|
*/
|
|
1757
1817
|
type BillingInterval = 'month' | 'year';
|
|
1758
1818
|
/**
|
|
@@ -1771,13 +1831,20 @@ interface Plan {
|
|
|
1771
1831
|
/** Display name, as the marketing site and the console should print it. */
|
|
1772
1832
|
readonly name: string;
|
|
1773
1833
|
/**
|
|
1774
|
-
* What it costs
|
|
1775
|
-
*
|
|
1776
|
-
*
|
|
1777
|
-
*
|
|
1778
|
-
*
|
|
1834
|
+
* What it costs, per interval — integer CENTS in USD, as the API's plan
|
|
1835
|
+
* table states them and as Stripe's Prices are provisioned from it. The wire
|
|
1836
|
+
* never carries a formatted price: formatting is the reader's job.
|
|
1837
|
+
*
|
|
1838
|
+
* **A free plan costs `{ month: 0, year: 0 }`, not a sentinel.** Free IS
|
|
1839
|
+
* zero, so it is a number like any other and every reader formats it with
|
|
1840
|
+
* the same call; a `'free'` member bought one thing — a branch in each
|
|
1841
|
+
* consumer that mapped it straight back to `$0`.
|
|
1842
|
+
*
|
|
1843
|
+
* `'contact'` stays, and the asymmetry is the point: "not sold at a list
|
|
1844
|
+
* price" is genuinely a different KIND of answer, not a different number, so
|
|
1845
|
+
* it is a different shape. Two shapes, and each earns its own.
|
|
1779
1846
|
*/
|
|
1780
|
-
readonly price: '
|
|
1847
|
+
readonly price: 'contact' | {
|
|
1781
1848
|
readonly month: number;
|
|
1782
1849
|
readonly year: number;
|
|
1783
1850
|
};
|
|
@@ -1786,6 +1853,20 @@ interface Plan {
|
|
|
1786
1853
|
* nothing (a plan sold by conversation publishes no numbers).
|
|
1787
1854
|
*/
|
|
1788
1855
|
readonly caps: Caps | null;
|
|
1856
|
+
/**
|
|
1857
|
+
* Why this row cannot be ordered right now — the closed door's own sentence,
|
|
1858
|
+
* verbatim — or absent when the way is open. A menu lists what can be
|
|
1859
|
+
* ordered, and a row that is sold but not yet orderable (its door is closed:
|
|
1860
|
+
* checkout unbuilt, a feature unfinished) SAYS SO on the menu instead of
|
|
1861
|
+
* only at the order.
|
|
1862
|
+
*
|
|
1863
|
+
* Clients branch on PRESENCE and render the sentence unchanged — they know
|
|
1864
|
+
* *that* the row is closed, never *which* door or *when it lifts*; the
|
|
1865
|
+
* vocabulary of doors stays server-side. The same rule the refusal follows:
|
|
1866
|
+
* `POST /billing/change` onto a closed row answers 400 with
|
|
1867
|
+
* `details.closed`, and its `message` is this sentence.
|
|
1868
|
+
*/
|
|
1869
|
+
readonly closed?: string;
|
|
1789
1870
|
}
|
|
1790
1871
|
/**
|
|
1791
1872
|
* Response for `GET /plans` — the whole public menu, in display order.
|
|
@@ -1801,23 +1882,59 @@ interface PlansResponse {
|
|
|
1801
1882
|
readonly plans: readonly Plan[];
|
|
1802
1883
|
}
|
|
1803
1884
|
/**
|
|
1804
|
-
* The
|
|
1805
|
-
*
|
|
1885
|
+
* The body of `POST /billing/change` — the one door for "get me onto this
|
|
1886
|
+
* plan". Both fields required: with more than one billed plan there is no
|
|
1887
|
+
* honest default, and the console always knows which card was clicked.
|
|
1806
1888
|
*
|
|
1807
|
-
*
|
|
1808
|
-
*
|
|
1809
|
-
*
|
|
1810
|
-
*
|
|
1889
|
+
* The SERVER decides what the change means — the rule is *up is now, down is
|
|
1890
|
+
* at period end* — so the client holds no copy of the ladder: a free account
|
|
1891
|
+
* is sent to Stripe Checkout, a billed account moving up is sent to the
|
|
1892
|
+
* Portal's confirmation page (money moves now, so Stripe's page takes the
|
|
1893
|
+
* consent), and a billed account moving down gets a Stripe Subscription
|
|
1894
|
+
* Schedule that applies the change at period end. The answer says which
|
|
1895
|
+
* happened ({@link PlanChangeResponse}).
|
|
1811
1896
|
*/
|
|
1812
|
-
interface
|
|
1813
|
-
|
|
1897
|
+
interface PlanChangeRequest {
|
|
1898
|
+
readonly plan: AccountPlanType;
|
|
1899
|
+
readonly interval: BillingInterval;
|
|
1900
|
+
}
|
|
1901
|
+
/**
|
|
1902
|
+
* The pending plan change — a Stripe Subscription Schedule the platform
|
|
1903
|
+
* minted, mirrored onto the account. `at` is when it applies (the current
|
|
1904
|
+
* period's end, Unix seconds). Reversible until then: `DELETE
|
|
1905
|
+
* /billing/change` releases it.
|
|
1906
|
+
*/
|
|
1907
|
+
interface ScheduledChange {
|
|
1908
|
+
readonly plan: AccountPlanType;
|
|
1909
|
+
readonly interval: BillingInterval;
|
|
1910
|
+
readonly at: number;
|
|
1911
|
+
}
|
|
1912
|
+
/**
|
|
1913
|
+
* The answer of `POST /billing/change` — exactly one field is set, and the
|
|
1914
|
+
* UNION is what holds that: an answer carrying both, or neither, does not
|
|
1915
|
+
* compile, so "which door was taken" is structural rather than prose.
|
|
1916
|
+
*
|
|
1917
|
+
* `url` means GO: a Stripe page (Checkout, or the Portal's confirmation page)
|
|
1918
|
+
* finishes the change and the browser must be redirected to it. `scheduled`
|
|
1919
|
+
* means DONE: the downgrade is booked for period end, nothing to visit, and
|
|
1920
|
+
* the account's `scheduled` field now carries it.
|
|
1921
|
+
*/
|
|
1922
|
+
type PlanChangeResponse =
|
|
1923
|
+
/** GO: a Stripe page finishes the change. Absolute URL, single use, short-lived. */
|
|
1924
|
+
{
|
|
1814
1925
|
readonly url: string;
|
|
1926
|
+
readonly scheduled?: never;
|
|
1815
1927
|
}
|
|
1928
|
+
/** DONE: the downgrade is booked for period end; nothing to visit. */
|
|
1929
|
+
| {
|
|
1930
|
+
readonly url?: never;
|
|
1931
|
+
readonly scheduled: ScheduledChange;
|
|
1932
|
+
};
|
|
1816
1933
|
/**
|
|
1817
1934
|
* The answer of `POST /billing/portal` — Stripe's `BillingPortal.Session`,
|
|
1818
|
-
* projected the
|
|
1819
|
-
*
|
|
1820
|
-
*
|
|
1935
|
+
* projected to the one field a client needs. The Portal home: cards,
|
|
1936
|
+
* invoices, cancellation. Plan changes have their own door
|
|
1937
|
+
* ({@link PlanChangeRequest}).
|
|
1821
1938
|
*/
|
|
1822
1939
|
interface BillingPortalSession {
|
|
1823
1940
|
/** Absolute URL to redirect the browser to. Single use, short-lived. */
|
|
@@ -1836,12 +1953,17 @@ interface BillingSyncResponse {
|
|
|
1836
1953
|
/**
|
|
1837
1954
|
* All activity event types logged in the system.
|
|
1838
1955
|
* Uses dot notation consistently: {resource}.{action}
|
|
1956
|
+
*
|
|
1957
|
+
* Retention: activity rows are permanent — the account's own history and
|
|
1958
|
+
* the platform's audit ledgers are one table, kept for the life of the
|
|
1959
|
+
* account (deletion removes them). Only the personal payload is
|
|
1960
|
+
* time-bounded: past 90 days each row sheds its IP.
|
|
1839
1961
|
*/
|
|
1840
|
-
type ActivityEvent = 'account.create' | 'account.
|
|
1962
|
+
type ActivityEvent = 'account.create' | 'account.delete' | 'account.key.generate' | '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';
|
|
1841
1963
|
/**
|
|
1842
1964
|
* Activity events visible to users in the dashboard
|
|
1843
1965
|
*/
|
|
1844
|
-
type UserVisibleActivityEvent = 'account.create' | 'account.
|
|
1966
|
+
type UserVisibleActivityEvent = 'account.create' | 'account.delete' | 'account.key.generate' | 'account.plan.transition' | 'deployment.create' | 'deployment.update' | 'deployment.delete' | 'deployment.claim' | 'domain.create' | 'domain.update' | 'domain.delete' | 'domain.verify' | 'token.create' | 'token.consume' | 'token.delete';
|
|
1845
1967
|
/**
|
|
1846
1968
|
* Activity record returned from the API
|
|
1847
1969
|
*/
|
|
@@ -3019,4 +3141,4 @@ declare class Ship extends Ship$1 {
|
|
|
3019
3141
|
protected processInput(input: DeployInput, options: DeploymentOptions): Promise<StaticFile[]>;
|
|
3020
3142
|
}
|
|
3021
3143
|
|
|
3022
|
-
export { API_KEY, API_PATHS, AUTH_BASE_PATH, type Account, type AccountDeleteResponse, type AccountGetResponse, type AccountKeyResponse, AccountPlan, type AccountPlanType, type AccountResource, type Activity, type ActivityEvent, type ActivityListResponse, type ActivityMeta, type ApiDeployOptions, ApiHttp, type ApiHttpOptions, AuthMethod, type AuthMethodType, type BillingInterval, type BillingPortalSession, type BillingSyncResponse, CALLER, type Caps,
|
|
3144
|
+
export { API_KEY, API_PATHS, AUTH_BASE_PATH, type Account, type AccountDeleteResponse, type AccountGetResponse, type AccountKeyResponse, AccountPlan, type AccountPlanType, type AccountResource, type Activity, type ActivityEvent, type ActivityListResponse, type ActivityMeta, type ApiDeployOptions, ApiHttp, type ApiHttpOptions, AuthMethod, type AuthMethodType, type BillingInterval, type BillingPortalSession, type BillingSyncResponse, CALLER, type Caps, DEFAULT_API, DEPLOYMENT_CONFIG_FILENAME, DEPLOY_FIELDS, DEPLOY_TOKEN, type DeployBodyContext, type DeployFile, type DeployInput, type DeployTransport, type Deployment, type DeploymentCreateResponse, type DeploymentDeleteResponse, type DeploymentListResponse, type DeploymentOptions, type DeploymentResource, type DeploymentResourceContext, type DeploymentSetOptions, DeploymentStatus, type DeploymentStatusType, type DeploymentUploadOptions, DeploymentVia, type DeploymentViaType, type DnsLookup, type DnsProvider, type DnsRecord, type DnsRecordType, type Domain, type DomainDeleteResponse, type DomainDnsResponse, type DomainListResponse, type DomainRecordsResponse, type DomainResource, type DomainSetOptions, type DomainSetResult, type DomainShareResponse, DomainStatus, type DomainStatusType, type DomainValidateResponse, type DomainVerifyResponse, type ErrorResponse, ErrorType, type ExecutionEnvironment, FileValidationStatus as FILE_VALIDATION_STATUS, type Fetch, type FileValidationResult, FileValidationStatus, type FileValidationStatusType, IDEMPOTENCY_KEY_CONSTRAINTS, JUNK_DIRECTORIES, LABEL_CONSTRAINTS, LABEL_PATTERN, type LabelsResponse, type ListOptions, type ListResponse, type MD5Result, MY_API_KEY_URL, OAUTH_TOKEN, OAuthScope, type OAuthScopeType, PASSWORD_CONSTRAINTS, PUBLIC_DEPLOYMENT_TTL_SECONDS, type PingResponse, type Plan, type PlanChangeRequest, type PlanChangeResponse, type PlansResponse, type PlatformLimits, type RequestResult, type ResourceContext, SHIP_ENV, SIGN_IN_RETURN_PARAM, type SPACheckDebug, type SPACheckRequest, type SPACheckResponse, SPA_CHECK_CONSTRAINTS, SPA_DEFAULT_CONFIG, type ScheduledChange, type SetupInstructionsResponse, Ship, type ShipClientOptions, ShipError, type ShipEvents, type ShipRequestInit, type StaticFile, TTL_CONSTRAINTS, type Token, type TokenCreateOptions, type TokenCreateResponse, type TokenDeleteResponse, TokenKind, type TokenKindType, type TokenListResponse, type TokenProvider, type TokenResource, type Transport, UNBUILT_PROJECT_MARKERS, UNSAFE_FILENAME_CHARS, type UploadedFile, type UserVisibleActivityEvent, type ValidatableFile, type ValidationIssue, WEB_FILE_ACCEPT, __setTestEnvironment, allValidFilesReady, assertShipJsonSyntax, calculateMD5, classifyToken, createAccountResource, createDeploymentResource, createDomainResource, createTokenResource, Ship as default, 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 };
|