@shipstatic/ship 3.4.0-beta.2 → 3.4.0-beta.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -724,7 +724,7 @@ type AccountPlanType = (typeof AccountPlan)[keyof typeof AccountPlan];
724
724
  * than the 403 uses.
725
725
  *
726
726
  * All three are counts plans SELL, and every plan publishes a number for each.
727
- * A platform subdomain (`my-app.shipstatic.com`) is among them: the namespace
727
+ * A platform domain (`my-app.shipstatic.com`) is among them: the namespace
728
728
  * is the platform's, so every plan bounds how many names one account may take
729
729
  * from it — which is not the address every deployment gets by construction
730
730
  * (`happy-cat-abc1234.shipstatic.com`), one per deployment and bounded by
@@ -734,8 +734,9 @@ type AccountPlanType = (typeof AccountPlan)[keyof typeof AccountPlan];
734
734
  * "unlimited" — so no consumer needs an "is it bounded?" branch. A cap of `0`
735
735
  * means the plan does not have the feature at all; a cap of `N` bounds
736
736
  * creation, and what an account already holds above a cap stays until a plan
737
- * TRANSITION fits it (excess paused, newest first — a domain is the only kind
738
- * that pauses).
737
+ * TRANSITION fits it: excess domains are paused, newest first, and members
738
+ * are paused together while the account holds more than its cap. Deployments
739
+ * never pause; above their cap they only block creation.
739
740
  *
740
741
  * A count is an aggregate over a collection, so it lives on the summary
741
742
  * resource that owns the collection: `GET /account` for one caller, `GET
@@ -1266,11 +1267,12 @@ interface ErrorResponse {
1266
1267
  /**
1267
1268
  * `details` of an `ErrorType.Build` error: the evidence behind the verdict.
1268
1269
  *
1269
- * The one `details` shape this file names, because it is the one a HUMAN
1270
- * surface renders rather than a machine reads. The sentence in `message`
1271
- * says what went wrong; the log is how the person fixing the project sees
1272
- * where. A surface that builds shows both, the log as a block rather than
1273
- * as prose.
1270
+ * Named, like {@link PlanChangeRefusalDetails}, because a surface reads it:
1271
+ * `ErrorResponse.details` stays `unknown`, and a shape a client narrows to is
1272
+ * owned here rather than restated at its read site. The sentence in
1273
+ * `message` says what went wrong; the log is how the person fixing the
1274
+ * project sees where. A surface that builds shows both, the log as a block
1275
+ * rather than as prose.
1274
1276
  */
1275
1277
  interface BuildFailureDetails {
1276
1278
  /**
@@ -1476,7 +1478,27 @@ interface PlatformLimits {
1476
1478
  * retire with it (tracked in root `backlog.md`).
1477
1479
  */
1478
1480
  readonly blockedExtensions?: readonly string[];
1481
+ /**
1482
+ * The way forward past each limit, in the API's own words, for the account
1483
+ * that asked: `"Upgrade to Pro for more."` where a sold plan allows more,
1484
+ * `"Please contact support if you need more."` where none does. The API
1485
+ * writes it with the same function its own refusals use, so a client that
1486
+ * refuses a file before uploading it appends this sentence to its refusal
1487
+ * verbatim and says exactly what the server would have said. Which plans
1488
+ * exist, which are sold and what an account's grant raises are the server's
1489
+ * to know; a client never learns a plan name from this field, only a
1490
+ * sentence. An anonymous caller is answered the free plan's sentence, as it
1491
+ * is the free plan's numbers.
1492
+ *
1493
+ * **Optional, and the absence is load-bearing**, as `blockedExtensions`
1494
+ * above: an API deployed before this field existed sends nothing, and a
1495
+ * client then appends nothing. It hardens to required at the entity's next
1496
+ * natural break, with the blocklist.
1497
+ */
1498
+ readonly suggestions?: Readonly<Record<PlatformLimitKey, string>>;
1479
1499
  }
1500
+ /** The three request limits, named as `PlatformLimits` names them. */
1501
+ type PlatformLimitKey = 'maxFileSize' | 'maxFilesCount' | 'maxTotalSize';
1480
1502
  /**
1481
1503
  * Whether a file is one the platform refuses to host.
1482
1504
  *
@@ -2014,10 +2036,12 @@ interface StaticFile {
2014
2036
  * console: under `/<account>/` and at the root.
2015
2037
  *
2016
2038
  * `owner` marks a section that means the person's OWN account: a bare path
2017
- * into it opens the person's own account rather than the one entered last,
2018
- * since a pricing link's `/upgrade/pro` and the published API-key link speak
2019
- * about the reader's plan and key. Modals inside a section carry their own
2020
- * owner rule in the console; this flag is the section's alone.
2039
+ * into it opens the person's own account rather than the one entered last.
2040
+ * A pricing link's `/upgrade/pro` and the published API-key link speak about
2041
+ * the reader's plan and key, and `/success` is where a purchase lands: only
2042
+ * an owner buys, and a person owns exactly one account. Modals inside a
2043
+ * section carry their own owner rule in the console; this flag is the
2044
+ * section's alone.
2021
2045
  */
2022
2046
  declare const SECTIONS: {
2023
2047
  readonly new: {
@@ -2036,7 +2060,7 @@ declare const SECTIONS: {
2036
2060
  readonly owner: true;
2037
2061
  };
2038
2062
  readonly success: {
2039
- readonly owner: false;
2063
+ readonly owner: true;
2040
2064
  };
2041
2065
  readonly 'api-key': {
2042
2066
  readonly owner: true;
@@ -2484,11 +2508,29 @@ interface PlansResponse {
2484
2508
  * consent), and a billed account moving down gets a Stripe Subscription
2485
2509
  * Schedule that applies the change at period end. The answer says which
2486
2510
  * happened ({@link PlanChangeResponse}).
2511
+ *
2512
+ * A move down a tier is booked only by an account that fits it: until it
2513
+ * does, the door refuses (400) with a sentence naming what to remove, and
2514
+ * the same counts as {@link PlanChangeRefusalDetails}.
2487
2515
  */
2488
2516
  interface PlanChangeRequest {
2489
2517
  readonly plan: AccountPlanType;
2490
2518
  readonly interval: BillingInterval;
2491
2519
  }
2520
+ /**
2521
+ * `details` of the change door's refusal of a move down a tier the account
2522
+ * does not fit: the account holds more members, custom domains or platform
2523
+ * domains than the destination allows.
2524
+ *
2525
+ * `excess` counts what to REMOVE before asking again, per kind, keyed like
2526
+ * {@link Caps}; only the kinds over the destination's caps appear. The
2527
+ * door's `message` names the same counts in a sentence, and that sentence is
2528
+ * what a surface shows; the counts are for a client that acts on the
2529
+ * refusal.
2530
+ */
2531
+ interface PlanChangeRefusalDetails {
2532
+ readonly excess: Partial<Caps>;
2533
+ }
2492
2534
  /**
2493
2535
  * The pending plan change — a Stripe Subscription Schedule, mirrored onto the
2494
2536
  * account. `at` is when it applies (the current period's end, Unix seconds).
@@ -2755,7 +2797,7 @@ interface UploadedFile {
2755
2797
  */
2756
2798
  declare function isPlatformDomain(domain: string, platformDomain: string): boolean;
2757
2799
  /**
2758
- * Check if a domain is a custom domain (not a platform subdomain).
2800
+ * Check if a domain is a custom domain (not a platform domain).
2759
2801
  * Custom domains are billable and require DNS verification.
2760
2802
  *
2761
2803
  * @example isCustomDomain("example.com", "shipstatic.com") → true
@@ -2901,8 +2943,11 @@ declare function validatePassword(value: unknown): string | undefined;
2901
2943
  interface DeploymentOptions extends DeploymentUploadOptions {
2902
2944
  /**
2903
2945
  * An AbortSignal to allow cancellation of the deploy operation. The one
2904
- * cancellation mechanism — abort the signal and the request rejects with
2905
- * a typed `Cancelled` error. Request timeouts are a client concern
2946
+ * cancellation mechanism: it reaches every request the deploy makes (the
2947
+ * limits it validates against, the SPA question and the upload itself),
2948
+ * and aborting it rejects the deploy with a typed `Cancelled` error
2949
+ * wherever it stands. A deploy the server had already committed stays
2950
+ * committed. Request timeouts are a client concern
2906
2951
  * (`ShipClientOptions.timeout`), not a per-deploy one.
2907
2952
  */
2908
2953
  signal?: AbortSignal;
@@ -3391,9 +3436,12 @@ declare abstract class Ship$1 {
3391
3436
  /**
3392
3437
  * Get the platform limits the server states now (max file size, file count,
3393
3438
  * total size, and the blocked extensions). Asked every time and never held,
3394
- * since a plan move or an operator's grant changes them.
3439
+ * since a plan move or an operator's grant changes them. A `signal` aborts
3440
+ * the request, rejecting with the typed `Cancelled` error.
3395
3441
  */
3396
- getLimits(): Promise<PlatformLimits>;
3442
+ getLimits(options?: {
3443
+ signal?: AbortSignal;
3444
+ }): Promise<PlatformLimits>;
3397
3445
  on<K extends keyof ShipEvents>(event: K, handler: (...args: ShipEvents[K]) => void): void;
3398
3446
  off<K extends keyof ShipEvents>(event: K, handler: (...args: ShipEvents[K]) => void): void;
3399
3447
  /**
@@ -3500,6 +3548,9 @@ declare function getENV(): ExecutionEnvironment;
3500
3548
  * Everything else is allowed — browser percent-encodes, Worker decodes, R2 matches.
3501
3549
  *
3502
3550
  * Additional checks: path traversal, reserved names, leading/trailing dots or spaces.
3551
+ *
3552
+ * The reason is a complete sentence naming the file, so every surface shows it
3553
+ * as it is (`file-rules.ts` on why).
3503
3554
  */
3504
3555
  declare function validateFileName(filename: string): {
3505
3556
  valid: boolean;
@@ -3628,35 +3679,40 @@ declare function calculateMD5(input: Blob | Buffer | string): Promise<MD5Result>
3628
3679
  * @file One ordered table of deploy-file rules, and the single evaluation two
3629
3680
  * renderers share.
3630
3681
  *
3631
- * **The defect this closes:** one rule was rendering as three sentences. A
3632
- * file over the size cap said `File x is too large. Maximum allowed size is
3633
- * 20MB.` from the deploy pipelines, `File size (21 MB) exceeds limit of 20 MB`
3634
- * from `validateFiles`, and `File too large. Maximum 20971520 bytes allowed`
3635
- * from the API — against the dual-validation doctrine that an error reads the
3636
- * same wherever it was caught (root `CLAUDE.md`). Both pipelines also restated
3637
- * the whole ordered check, so node/browser parity was a comment.
3638
- *
3639
3682
  * **A rule states a predicate and a sentence; a renderer chooses only how to
3640
3683
  * DELIVER it.** That is the `SHAPES`-table move (`cli/formatters.ts`) applied
3641
3684
  * to validation: the throwing renderer raises the first broken rule, the
3642
3685
  * collecting renderer records it, and neither authors prose. Adding a rule is
3643
- * a row, and both surfaces get it in the same position by construction.
3644
- *
3645
- * **Wording follows the API where a choice existed**, so the deferred Phase B
3646
- * — promoting this table to `@shipstatic/types` with the API consuming it —
3647
- * has less to move. Two deliberate deviations, recorded rather than silent:
3648
- *
3649
- * - **Sizes are formatted, not raw bytes.** The API says `20971520 bytes`;
3650
- * a browser upload UI showing that is worse for the person reading it, and
3651
- * the unit is the smaller half of the sentence to reconcile later.
3652
- * - **The path is named.** The API has no path to name; the throwing renderer
3653
- * has nothing BUT the message, so dropping it would leave a CLI user asking
3654
- * which file.
3686
+ * a row, and both surfaces get it in the same position by construction. One
3687
+ * table is also what keeps a rule from reading three ways: the deploy
3688
+ * pipelines, `validateFiles` and the API once each worded the size cap
3689
+ * differently, against the dual-validation doctrine that an error reads the
3690
+ * same wherever it is caught (root `CLAUDE.md`).
3691
+ *
3692
+ * **Every sentence is complete on its own.** The SDK is where a refusal is
3693
+ * worded; drop, the console, the CLI and the MCPs show the sentence verbatim
3694
+ * and add nothing, so a sentence names its file exactly once and states the
3695
+ * limit, and reads without a prefix. The family is subject first: `File
3696
+ * "<path>" <verdict>. Maximum <limit> allowed.`, and `File name "<path>" …`
3697
+ * where the name is the subject. The two rules about the SET, the count and
3698
+ * the total, name no path. A limit's sentence ends with the suggestion the
3699
+ * API delivered for it (`withSuggestion`), so the whole reads `File "x" is
3700
+ * too large. Maximum 20 MB allowed. Upgrade to Pro for more.`
3701
+ *
3702
+ * **The API words the same rules the same way, in the same order**
3703
+ * (`cloudflare/api/src/lib/validation.ts`), so a refusal reads alike whether
3704
+ * the SDK made it before uploading or the boundary made it after. Sizes are
3705
+ * formatted on both sides, and the path is named on both. That is a
3706
+ * restatement, and it is fenced from the API's side: a test there imports
3707
+ * this package's `validateFiles` and compares every shared rule's sentence to
3708
+ * `validateUpload`'s. The fence dies the day the table is promoted to
3709
+ * `@shipstatic/types` and the API imports it (Phase B, `CLAUDE.md`).
3655
3710
  *
3656
3711
  * Out of scope, and left where they are: `validateDeployPath` (a rule about
3657
3712
  * the deploy PATH rather than the file, and pipelines-only), and
3658
- * `validateFiles`' UI-tier pre-checks — empty, negative, count, unbuilt
3659
- * marker, processing error — which have one holder each and no drift.
3713
+ * `validateFiles`' UI-tier pre-checks (empty, negative, unbuilt marker,
3714
+ * processing error), which have one holder each and no drift, and word their
3715
+ * sentences by the same family.
3660
3716
  */
3661
3717
 
3662
3718
  /** What a rule is asked about: one file, and the deploy so far. */
@@ -3708,6 +3764,15 @@ declare function validateDeployPath(deployPath: string, sourceIdentifier: string
3708
3764
  * @throws {ShipError} The first broken rule's sentence
3709
3765
  */
3710
3766
  declare function validateDeployFile(input: FileRuleInput, limits: PlatformLimits): void;
3767
+ /**
3768
+ * The throwing renderer of `COUNT_RULE`: the deploy's file count, judged over
3769
+ * the files the pipeline will send.
3770
+ *
3771
+ * @param count - How many files the deploy carries
3772
+ * @param limits - The platform's limits, from `/limits`
3773
+ * @throws {ShipError} The count rule's sentence
3774
+ */
3775
+ declare function validateDeployCount(count: number, limits: PlatformLimits): void;
3711
3776
 
3712
3777
  /**
3713
3778
  * Utility functions for string manipulation.
@@ -3797,6 +3862,6 @@ declare class Ship extends Ship$1 {
3797
3862
  }
3798
3863
 
3799
3864
  declare namespace Ship {
3800
- export { ACCOUNT_HEADER, API_KEY, API_PATHS, AUTH_BASE_PATH, Account, AccountAccess, AccountDeleteResponse, AccountKeyResponse, AccountPlan, AccountPlanType, AccountRefusal, AccountRefusalType, AccountResource, AccountRole, Activity, ActivityEvent, ActivityListResponse, ActivityMeta, ApiDeployOptions, ApiHttp, ApiHttpOptions, AuthMethod, AuthMethodType, BUILD_SETTINGS, BillingInterval, BillingPortalSession, BillingSyncResponse, BuildFailureDetails, CALLER, Caps, ConsoleErrand, ConsolePaths, ConsoleSection, DEFAULT_API, DEPLOYMENT_CONFIG_FILENAME, DEPLOY_FIELDS, DEPLOY_FILE_GRAMMAR, DEPLOY_TOKEN, DeployBodyContext, DeployFile, DeployFileEncoding, DeployFileSpec, 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, DomainVerification, DomainVerificationType, 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, PlanDestination, PlansResponse, PlatformLimits, RequestResult, ResourceContext, SECTIONS, SETUP_TROUBLESHOOTING_ANCHOR, SHIP_ENV, SHIP_VIA_ENV, SIGN_IN_RETURN_PARAM, SPACheckDebug, SPACheckRequest, SPACheckResponse, SPA_CHECK_CONSTRAINTS, SPA_DEFAULT_CONFIG, ScheduledChange, SettingsFragment, SetupInstructionsResponse, ShipClientOptions, ShipError, ShipEvents, ShipRequestInit, StaticFile, TTL_CONSTRAINTS, Token, TokenCreateOptions, TokenCreateResponse, TokenDeleteResponse, TokenKind, TokenKindType, TokenListResponse, TokenProvider, TokenResource, Transport, UNBUILT_PROJECT_MARKERS, UNSAFE_FILENAME_CHARS, USER_VISIBLE_EVENTS, UploadedFile, UserVisibleActivityEvent, ValidatableFile, ValidationIssue, WEB_FILE_ACCEPT, __setTestEnvironment, accountOfPath, allValidFilesReady, assertShipJsonSyntax, billingReturnOf, calculateMD5, classifyToken, consolePaths, createAccountResource, createDeploymentResource, createDomainResource, createTokenResource, deserializeLabels, doors, errandOf, extractSubdomain, filterJunk, formatDuration, formatFileSize, formatTimeRemaining, generateDeploymentUrl, generateDomainUrl, getENV, getValidFiles, hasUnbuiltMarker, hasUnsafeChars, isBlockedExtension, isClaimPath, isCustomDomain, isDeployment, isInvitationPath, isPlatformDomain, isShipError, isUpgradePath, normalizeVia, optimizeDeployPaths, personName, personShortName, pluralize, processFilesForNode, readBearerValue, serializeLabels, validateApiKey, validateApiUrl, validateBuildCommand, validateCaller, validateDeployFile, validateDeployPath, validateDeployToken, validateFileName, validateFiles, validateIdempotencyKey, validateOAuthToken, validateOutputDir, validatePassword, validateToken, validateTtl };
3865
+ export { ACCOUNT_HEADER, API_KEY, API_PATHS, AUTH_BASE_PATH, Account, AccountAccess, AccountDeleteResponse, AccountKeyResponse, AccountPlan, AccountPlanType, AccountRefusal, AccountRefusalType, AccountResource, AccountRole, Activity, ActivityEvent, ActivityListResponse, ActivityMeta, ApiDeployOptions, ApiHttp, ApiHttpOptions, AuthMethod, AuthMethodType, BUILD_SETTINGS, BillingInterval, BillingPortalSession, BillingSyncResponse, BuildFailureDetails, CALLER, Caps, ConsoleErrand, ConsolePaths, ConsoleSection, DEFAULT_API, DEPLOYMENT_CONFIG_FILENAME, DEPLOY_FIELDS, DEPLOY_FILE_GRAMMAR, DEPLOY_TOKEN, DeployBodyContext, DeployFile, DeployFileEncoding, DeployFileSpec, 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, DomainVerification, DomainVerificationType, 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, PlanChangeRefusalDetails, PlanChangeRequest, PlanChangeResponse, PlanDestination, PlansResponse, PlatformLimitKey, PlatformLimits, RequestResult, ResourceContext, SECTIONS, SETUP_TROUBLESHOOTING_ANCHOR, SHIP_ENV, SHIP_VIA_ENV, SIGN_IN_RETURN_PARAM, SPACheckDebug, SPACheckRequest, SPACheckResponse, SPA_CHECK_CONSTRAINTS, SPA_DEFAULT_CONFIG, ScheduledChange, SettingsFragment, SetupInstructionsResponse, ShipClientOptions, ShipError, ShipEvents, ShipRequestInit, StaticFile, TTL_CONSTRAINTS, Token, TokenCreateOptions, TokenCreateResponse, TokenDeleteResponse, TokenKind, TokenKindType, TokenListResponse, TokenProvider, TokenResource, Transport, UNBUILT_PROJECT_MARKERS, UNSAFE_FILENAME_CHARS, USER_VISIBLE_EVENTS, UploadedFile, UserVisibleActivityEvent, ValidatableFile, ValidationIssue, WEB_FILE_ACCEPT, __setTestEnvironment, accountOfPath, allValidFilesReady, assertShipJsonSyntax, billingReturnOf, calculateMD5, classifyToken, consolePaths, createAccountResource, createDeploymentResource, createDomainResource, createTokenResource, deserializeLabels, doors, errandOf, extractSubdomain, filterJunk, formatDuration, formatFileSize, formatTimeRemaining, generateDeploymentUrl, generateDomainUrl, getENV, getValidFiles, hasUnbuiltMarker, hasUnsafeChars, isBlockedExtension, isClaimPath, isCustomDomain, isDeployment, isInvitationPath, isPlatformDomain, isShipError, isUpgradePath, normalizeVia, optimizeDeployPaths, personName, personShortName, pluralize, processFilesForNode, readBearerValue, serializeLabels, validateApiKey, validateApiUrl, validateBuildCommand, validateCaller, validateDeployCount, validateDeployFile, validateDeployPath, validateDeployToken, validateFileName, validateFiles, validateIdempotencyKey, validateOAuthToken, validateOutputDir, validatePassword, validateToken, validateTtl };
3801
3866
  }
3802
3867
  export = Ship;
package/dist/index.d.ts CHANGED
@@ -724,7 +724,7 @@ type AccountPlanType = (typeof AccountPlan)[keyof typeof AccountPlan];
724
724
  * than the 403 uses.
725
725
  *
726
726
  * All three are counts plans SELL, and every plan publishes a number for each.
727
- * A platform subdomain (`my-app.shipstatic.com`) is among them: the namespace
727
+ * A platform domain (`my-app.shipstatic.com`) is among them: the namespace
728
728
  * is the platform's, so every plan bounds how many names one account may take
729
729
  * from it — which is not the address every deployment gets by construction
730
730
  * (`happy-cat-abc1234.shipstatic.com`), one per deployment and bounded by
@@ -734,8 +734,9 @@ type AccountPlanType = (typeof AccountPlan)[keyof typeof AccountPlan];
734
734
  * "unlimited" — so no consumer needs an "is it bounded?" branch. A cap of `0`
735
735
  * means the plan does not have the feature at all; a cap of `N` bounds
736
736
  * creation, and what an account already holds above a cap stays until a plan
737
- * TRANSITION fits it (excess paused, newest first — a domain is the only kind
738
- * that pauses).
737
+ * TRANSITION fits it: excess domains are paused, newest first, and members
738
+ * are paused together while the account holds more than its cap. Deployments
739
+ * never pause; above their cap they only block creation.
739
740
  *
740
741
  * A count is an aggregate over a collection, so it lives on the summary
741
742
  * resource that owns the collection: `GET /account` for one caller, `GET
@@ -1266,11 +1267,12 @@ interface ErrorResponse {
1266
1267
  /**
1267
1268
  * `details` of an `ErrorType.Build` error: the evidence behind the verdict.
1268
1269
  *
1269
- * The one `details` shape this file names, because it is the one a HUMAN
1270
- * surface renders rather than a machine reads. The sentence in `message`
1271
- * says what went wrong; the log is how the person fixing the project sees
1272
- * where. A surface that builds shows both, the log as a block rather than
1273
- * as prose.
1270
+ * Named, like {@link PlanChangeRefusalDetails}, because a surface reads it:
1271
+ * `ErrorResponse.details` stays `unknown`, and a shape a client narrows to is
1272
+ * owned here rather than restated at its read site. The sentence in
1273
+ * `message` says what went wrong; the log is how the person fixing the
1274
+ * project sees where. A surface that builds shows both, the log as a block
1275
+ * rather than as prose.
1274
1276
  */
1275
1277
  interface BuildFailureDetails {
1276
1278
  /**
@@ -1476,7 +1478,27 @@ interface PlatformLimits {
1476
1478
  * retire with it (tracked in root `backlog.md`).
1477
1479
  */
1478
1480
  readonly blockedExtensions?: readonly string[];
1481
+ /**
1482
+ * The way forward past each limit, in the API's own words, for the account
1483
+ * that asked: `"Upgrade to Pro for more."` where a sold plan allows more,
1484
+ * `"Please contact support if you need more."` where none does. The API
1485
+ * writes it with the same function its own refusals use, so a client that
1486
+ * refuses a file before uploading it appends this sentence to its refusal
1487
+ * verbatim and says exactly what the server would have said. Which plans
1488
+ * exist, which are sold and what an account's grant raises are the server's
1489
+ * to know; a client never learns a plan name from this field, only a
1490
+ * sentence. An anonymous caller is answered the free plan's sentence, as it
1491
+ * is the free plan's numbers.
1492
+ *
1493
+ * **Optional, and the absence is load-bearing**, as `blockedExtensions`
1494
+ * above: an API deployed before this field existed sends nothing, and a
1495
+ * client then appends nothing. It hardens to required at the entity's next
1496
+ * natural break, with the blocklist.
1497
+ */
1498
+ readonly suggestions?: Readonly<Record<PlatformLimitKey, string>>;
1479
1499
  }
1500
+ /** The three request limits, named as `PlatformLimits` names them. */
1501
+ type PlatformLimitKey = 'maxFileSize' | 'maxFilesCount' | 'maxTotalSize';
1480
1502
  /**
1481
1503
  * Whether a file is one the platform refuses to host.
1482
1504
  *
@@ -2014,10 +2036,12 @@ interface StaticFile {
2014
2036
  * console: under `/<account>/` and at the root.
2015
2037
  *
2016
2038
  * `owner` marks a section that means the person's OWN account: a bare path
2017
- * into it opens the person's own account rather than the one entered last,
2018
- * since a pricing link's `/upgrade/pro` and the published API-key link speak
2019
- * about the reader's plan and key. Modals inside a section carry their own
2020
- * owner rule in the console; this flag is the section's alone.
2039
+ * into it opens the person's own account rather than the one entered last.
2040
+ * A pricing link's `/upgrade/pro` and the published API-key link speak about
2041
+ * the reader's plan and key, and `/success` is where a purchase lands: only
2042
+ * an owner buys, and a person owns exactly one account. Modals inside a
2043
+ * section carry their own owner rule in the console; this flag is the
2044
+ * section's alone.
2021
2045
  */
2022
2046
  declare const SECTIONS: {
2023
2047
  readonly new: {
@@ -2036,7 +2060,7 @@ declare const SECTIONS: {
2036
2060
  readonly owner: true;
2037
2061
  };
2038
2062
  readonly success: {
2039
- readonly owner: false;
2063
+ readonly owner: true;
2040
2064
  };
2041
2065
  readonly 'api-key': {
2042
2066
  readonly owner: true;
@@ -2484,11 +2508,29 @@ interface PlansResponse {
2484
2508
  * consent), and a billed account moving down gets a Stripe Subscription
2485
2509
  * Schedule that applies the change at period end. The answer says which
2486
2510
  * happened ({@link PlanChangeResponse}).
2511
+ *
2512
+ * A move down a tier is booked only by an account that fits it: until it
2513
+ * does, the door refuses (400) with a sentence naming what to remove, and
2514
+ * the same counts as {@link PlanChangeRefusalDetails}.
2487
2515
  */
2488
2516
  interface PlanChangeRequest {
2489
2517
  readonly plan: AccountPlanType;
2490
2518
  readonly interval: BillingInterval;
2491
2519
  }
2520
+ /**
2521
+ * `details` of the change door's refusal of a move down a tier the account
2522
+ * does not fit: the account holds more members, custom domains or platform
2523
+ * domains than the destination allows.
2524
+ *
2525
+ * `excess` counts what to REMOVE before asking again, per kind, keyed like
2526
+ * {@link Caps}; only the kinds over the destination's caps appear. The
2527
+ * door's `message` names the same counts in a sentence, and that sentence is
2528
+ * what a surface shows; the counts are for a client that acts on the
2529
+ * refusal.
2530
+ */
2531
+ interface PlanChangeRefusalDetails {
2532
+ readonly excess: Partial<Caps>;
2533
+ }
2492
2534
  /**
2493
2535
  * The pending plan change — a Stripe Subscription Schedule, mirrored onto the
2494
2536
  * account. `at` is when it applies (the current period's end, Unix seconds).
@@ -2755,7 +2797,7 @@ interface UploadedFile {
2755
2797
  */
2756
2798
  declare function isPlatformDomain(domain: string, platformDomain: string): boolean;
2757
2799
  /**
2758
- * Check if a domain is a custom domain (not a platform subdomain).
2800
+ * Check if a domain is a custom domain (not a platform domain).
2759
2801
  * Custom domains are billable and require DNS verification.
2760
2802
  *
2761
2803
  * @example isCustomDomain("example.com", "shipstatic.com") → true
@@ -2901,8 +2943,11 @@ declare function validatePassword(value: unknown): string | undefined;
2901
2943
  interface DeploymentOptions extends DeploymentUploadOptions {
2902
2944
  /**
2903
2945
  * An AbortSignal to allow cancellation of the deploy operation. The one
2904
- * cancellation mechanism — abort the signal and the request rejects with
2905
- * a typed `Cancelled` error. Request timeouts are a client concern
2946
+ * cancellation mechanism: it reaches every request the deploy makes (the
2947
+ * limits it validates against, the SPA question and the upload itself),
2948
+ * and aborting it rejects the deploy with a typed `Cancelled` error
2949
+ * wherever it stands. A deploy the server had already committed stays
2950
+ * committed. Request timeouts are a client concern
2906
2951
  * (`ShipClientOptions.timeout`), not a per-deploy one.
2907
2952
  */
2908
2953
  signal?: AbortSignal;
@@ -3391,9 +3436,12 @@ declare abstract class Ship$1 {
3391
3436
  /**
3392
3437
  * Get the platform limits the server states now (max file size, file count,
3393
3438
  * total size, and the blocked extensions). Asked every time and never held,
3394
- * since a plan move or an operator's grant changes them.
3439
+ * since a plan move or an operator's grant changes them. A `signal` aborts
3440
+ * the request, rejecting with the typed `Cancelled` error.
3395
3441
  */
3396
- getLimits(): Promise<PlatformLimits>;
3442
+ getLimits(options?: {
3443
+ signal?: AbortSignal;
3444
+ }): Promise<PlatformLimits>;
3397
3445
  on<K extends keyof ShipEvents>(event: K, handler: (...args: ShipEvents[K]) => void): void;
3398
3446
  off<K extends keyof ShipEvents>(event: K, handler: (...args: ShipEvents[K]) => void): void;
3399
3447
  /**
@@ -3500,6 +3548,9 @@ declare function getENV(): ExecutionEnvironment;
3500
3548
  * Everything else is allowed — browser percent-encodes, Worker decodes, R2 matches.
3501
3549
  *
3502
3550
  * Additional checks: path traversal, reserved names, leading/trailing dots or spaces.
3551
+ *
3552
+ * The reason is a complete sentence naming the file, so every surface shows it
3553
+ * as it is (`file-rules.ts` on why).
3503
3554
  */
3504
3555
  declare function validateFileName(filename: string): {
3505
3556
  valid: boolean;
@@ -3628,35 +3679,40 @@ declare function calculateMD5(input: Blob | Buffer | string): Promise<MD5Result>
3628
3679
  * @file One ordered table of deploy-file rules, and the single evaluation two
3629
3680
  * renderers share.
3630
3681
  *
3631
- * **The defect this closes:** one rule was rendering as three sentences. A
3632
- * file over the size cap said `File x is too large. Maximum allowed size is
3633
- * 20MB.` from the deploy pipelines, `File size (21 MB) exceeds limit of 20 MB`
3634
- * from `validateFiles`, and `File too large. Maximum 20971520 bytes allowed`
3635
- * from the API — against the dual-validation doctrine that an error reads the
3636
- * same wherever it was caught (root `CLAUDE.md`). Both pipelines also restated
3637
- * the whole ordered check, so node/browser parity was a comment.
3638
- *
3639
3682
  * **A rule states a predicate and a sentence; a renderer chooses only how to
3640
3683
  * DELIVER it.** That is the `SHAPES`-table move (`cli/formatters.ts`) applied
3641
3684
  * to validation: the throwing renderer raises the first broken rule, the
3642
3685
  * collecting renderer records it, and neither authors prose. Adding a rule is
3643
- * a row, and both surfaces get it in the same position by construction.
3644
- *
3645
- * **Wording follows the API where a choice existed**, so the deferred Phase B
3646
- * — promoting this table to `@shipstatic/types` with the API consuming it —
3647
- * has less to move. Two deliberate deviations, recorded rather than silent:
3648
- *
3649
- * - **Sizes are formatted, not raw bytes.** The API says `20971520 bytes`;
3650
- * a browser upload UI showing that is worse for the person reading it, and
3651
- * the unit is the smaller half of the sentence to reconcile later.
3652
- * - **The path is named.** The API has no path to name; the throwing renderer
3653
- * has nothing BUT the message, so dropping it would leave a CLI user asking
3654
- * which file.
3686
+ * a row, and both surfaces get it in the same position by construction. One
3687
+ * table is also what keeps a rule from reading three ways: the deploy
3688
+ * pipelines, `validateFiles` and the API once each worded the size cap
3689
+ * differently, against the dual-validation doctrine that an error reads the
3690
+ * same wherever it is caught (root `CLAUDE.md`).
3691
+ *
3692
+ * **Every sentence is complete on its own.** The SDK is where a refusal is
3693
+ * worded; drop, the console, the CLI and the MCPs show the sentence verbatim
3694
+ * and add nothing, so a sentence names its file exactly once and states the
3695
+ * limit, and reads without a prefix. The family is subject first: `File
3696
+ * "<path>" <verdict>. Maximum <limit> allowed.`, and `File name "<path>" …`
3697
+ * where the name is the subject. The two rules about the SET, the count and
3698
+ * the total, name no path. A limit's sentence ends with the suggestion the
3699
+ * API delivered for it (`withSuggestion`), so the whole reads `File "x" is
3700
+ * too large. Maximum 20 MB allowed. Upgrade to Pro for more.`
3701
+ *
3702
+ * **The API words the same rules the same way, in the same order**
3703
+ * (`cloudflare/api/src/lib/validation.ts`), so a refusal reads alike whether
3704
+ * the SDK made it before uploading or the boundary made it after. Sizes are
3705
+ * formatted on both sides, and the path is named on both. That is a
3706
+ * restatement, and it is fenced from the API's side: a test there imports
3707
+ * this package's `validateFiles` and compares every shared rule's sentence to
3708
+ * `validateUpload`'s. The fence dies the day the table is promoted to
3709
+ * `@shipstatic/types` and the API imports it (Phase B, `CLAUDE.md`).
3655
3710
  *
3656
3711
  * Out of scope, and left where they are: `validateDeployPath` (a rule about
3657
3712
  * the deploy PATH rather than the file, and pipelines-only), and
3658
- * `validateFiles`' UI-tier pre-checks — empty, negative, count, unbuilt
3659
- * marker, processing error — which have one holder each and no drift.
3713
+ * `validateFiles`' UI-tier pre-checks (empty, negative, unbuilt marker,
3714
+ * processing error), which have one holder each and no drift, and word their
3715
+ * sentences by the same family.
3660
3716
  */
3661
3717
 
3662
3718
  /** What a rule is asked about: one file, and the deploy so far. */
@@ -3708,6 +3764,15 @@ declare function validateDeployPath(deployPath: string, sourceIdentifier: string
3708
3764
  * @throws {ShipError} The first broken rule's sentence
3709
3765
  */
3710
3766
  declare function validateDeployFile(input: FileRuleInput, limits: PlatformLimits): void;
3767
+ /**
3768
+ * The throwing renderer of `COUNT_RULE`: the deploy's file count, judged over
3769
+ * the files the pipeline will send.
3770
+ *
3771
+ * @param count - How many files the deploy carries
3772
+ * @param limits - The platform's limits, from `/limits`
3773
+ * @throws {ShipError} The count rule's sentence
3774
+ */
3775
+ declare function validateDeployCount(count: number, limits: PlatformLimits): void;
3711
3776
 
3712
3777
  /**
3713
3778
  * Utility functions for string manipulation.
@@ -3796,4 +3861,4 @@ declare class Ship extends Ship$1 {
3796
3861
  protected processInput(input: DeployInput, options: DeploymentOptions, limits: PlatformLimits): Promise<StaticFile[]>;
3797
3862
  }
3798
3863
 
3799
- export { ACCOUNT_HEADER, API_KEY, API_PATHS, AUTH_BASE_PATH, type Account, type AccountAccess, type AccountDeleteResponse, type AccountKeyResponse, AccountPlan, type AccountPlanType, AccountRefusal, type AccountRefusalType, type AccountResource, type AccountRole, type Activity, type ActivityEvent, type ActivityListResponse, type ActivityMeta, type ApiDeployOptions, ApiHttp, type ApiHttpOptions, AuthMethod, type AuthMethodType, BUILD_SETTINGS, type BillingInterval, type BillingPortalSession, type BillingSyncResponse, type BuildFailureDetails, CALLER, type Caps, type ConsoleErrand, type ConsolePaths, type ConsoleSection, DEFAULT_API, DEPLOYMENT_CONFIG_FILENAME, DEPLOY_FIELDS, DEPLOY_FILE_GRAMMAR, DEPLOY_TOKEN, type DeployBodyContext, type DeployFile, type DeployFileEncoding, type DeployFileSpec, 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, DomainVerification, type DomainVerificationType, 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 PlanDestination, type PlansResponse, type PlatformLimits, type RequestResult, type ResourceContext, SECTIONS, SETUP_TROUBLESHOOTING_ANCHOR, SHIP_ENV, SHIP_VIA_ENV, SIGN_IN_RETURN_PARAM, type SPACheckDebug, type SPACheckRequest, type SPACheckResponse, SPA_CHECK_CONSTRAINTS, SPA_DEFAULT_CONFIG, type ScheduledChange, type SettingsFragment, 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, USER_VISIBLE_EVENTS, type UploadedFile, type UserVisibleActivityEvent, type ValidatableFile, type ValidationIssue, WEB_FILE_ACCEPT, __setTestEnvironment, accountOfPath, allValidFilesReady, assertShipJsonSyntax, billingReturnOf, calculateMD5, classifyToken, consolePaths, createAccountResource, createDeploymentResource, createDomainResource, createTokenResource, Ship as default, deserializeLabels, doors, errandOf, extractSubdomain, filterJunk, formatDuration, formatFileSize, formatTimeRemaining, generateDeploymentUrl, generateDomainUrl, getENV, getValidFiles, hasUnbuiltMarker, hasUnsafeChars, isBlockedExtension, isClaimPath, isCustomDomain, isDeployment, isInvitationPath, isPlatformDomain, isShipError, isUpgradePath, normalizeVia, optimizeDeployPaths, personName, personShortName, pluralize, processFilesForNode, readBearerValue, serializeLabels, validateApiKey, validateApiUrl, validateBuildCommand, validateCaller, validateDeployFile, validateDeployPath, validateDeployToken, validateFileName, validateFiles, validateIdempotencyKey, validateOAuthToken, validateOutputDir, validatePassword, validateToken, validateTtl };
3864
+ export { ACCOUNT_HEADER, API_KEY, API_PATHS, AUTH_BASE_PATH, type Account, type AccountAccess, type AccountDeleteResponse, type AccountKeyResponse, AccountPlan, type AccountPlanType, AccountRefusal, type AccountRefusalType, type AccountResource, type AccountRole, type Activity, type ActivityEvent, type ActivityListResponse, type ActivityMeta, type ApiDeployOptions, ApiHttp, type ApiHttpOptions, AuthMethod, type AuthMethodType, BUILD_SETTINGS, type BillingInterval, type BillingPortalSession, type BillingSyncResponse, type BuildFailureDetails, CALLER, type Caps, type ConsoleErrand, type ConsolePaths, type ConsoleSection, DEFAULT_API, DEPLOYMENT_CONFIG_FILENAME, DEPLOY_FIELDS, DEPLOY_FILE_GRAMMAR, DEPLOY_TOKEN, type DeployBodyContext, type DeployFile, type DeployFileEncoding, type DeployFileSpec, 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, DomainVerification, type DomainVerificationType, 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 PlanChangeRefusalDetails, type PlanChangeRequest, type PlanChangeResponse, type PlanDestination, type PlansResponse, type PlatformLimitKey, type PlatformLimits, type RequestResult, type ResourceContext, SECTIONS, SETUP_TROUBLESHOOTING_ANCHOR, SHIP_ENV, SHIP_VIA_ENV, SIGN_IN_RETURN_PARAM, type SPACheckDebug, type SPACheckRequest, type SPACheckResponse, SPA_CHECK_CONSTRAINTS, SPA_DEFAULT_CONFIG, type ScheduledChange, type SettingsFragment, 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, USER_VISIBLE_EVENTS, type UploadedFile, type UserVisibleActivityEvent, type ValidatableFile, type ValidationIssue, WEB_FILE_ACCEPT, __setTestEnvironment, accountOfPath, allValidFilesReady, assertShipJsonSyntax, billingReturnOf, calculateMD5, classifyToken, consolePaths, createAccountResource, createDeploymentResource, createDomainResource, createTokenResource, Ship as default, deserializeLabels, doors, errandOf, extractSubdomain, filterJunk, formatDuration, formatFileSize, formatTimeRemaining, generateDeploymentUrl, generateDomainUrl, getENV, getValidFiles, hasUnbuiltMarker, hasUnsafeChars, isBlockedExtension, isClaimPath, isCustomDomain, isDeployment, isInvitationPath, isPlatformDomain, isShipError, isUpgradePath, normalizeVia, optimizeDeployPaths, personName, personShortName, pluralize, processFilesForNode, readBearerValue, serializeLabels, validateApiKey, validateApiUrl, validateBuildCommand, validateCaller, validateDeployCount, validateDeployFile, validateDeployPath, validateDeployToken, validateFileName, validateFiles, validateIdempotencyKey, validateOAuthToken, validateOutputDir, validatePassword, validateToken, validateTtl };