@shipstatic/ship 3.3.2 → 3.4.0-beta.2

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
@@ -786,18 +786,34 @@ type AccountRole = 'owner' | 'member';
786
786
  * account automation, not a person, and is always `active`.
787
787
  */
788
788
  type AccountAccess = 'active' | 'paused';
789
+ /**
790
+ * The word a refusal about the account carries in `details.account`, so a
791
+ * client can tell the two apart without reading the sentence:
792
+ *
793
+ * - `paused`: a 403. The person is a member, and the account holds more
794
+ * members than its plan allows (see {@link AccountAccess}).
795
+ * - `unknown`: a 404. The account the request names ({@link ACCOUNT_HEADER})
796
+ * is one the person is not a member of, or one that does not exist; the
797
+ * two are indistinguishable by design. A tab whose person was removed from
798
+ * the account meets it on its next request.
799
+ */
800
+ declare const AccountRefusal: {
801
+ readonly PAUSED: "paused";
802
+ readonly UNKNOWN: "unknown";
803
+ };
804
+ type AccountRefusalType = (typeof AccountRefusal)[keyof typeof AccountRefusal];
789
805
  /**
790
806
  * Core account object - used in both API responses and SDK
791
807
  * All fields are readonly to prevent accidental mutations
792
808
  */
793
809
  interface Account {
794
810
  /**
795
- * The account this response describes, by id. A person may belong to
796
- * several accounts and a browser session selects one, so a client names
797
- * the one it means on every request (`X-Account`) and this is where it
798
- * learns the name. Optional by the additive-evolution law.
811
+ * The account this response describes, by id: the name the console's URL
812
+ * carries (`/<account>/`) and a session request sends in
813
+ * {@link ACCOUNT_HEADER}. A machine credential IS its account, so the
814
+ * response names the account the credential belongs to.
799
815
  */
800
- readonly account?: string;
816
+ readonly account: string;
801
817
  /** User email address */
802
818
  readonly email: string;
803
819
  /**
@@ -941,20 +957,6 @@ interface PlanDestination {
941
957
  readonly plan: AccountPlanType;
942
958
  readonly intervals: BillingInterval[];
943
959
  }
944
- /**
945
- * Account as returned by `GET /account` — the entity plus how the request
946
- * was authorized, so `whoami` can answer "what credential am I holding?".
947
- * Request-scoped fields live on the response type, never on the entity
948
- * (the `DeploymentCreateResponse` pattern).
949
- */
950
- interface AccountGetResponse extends Account {
951
- /** How the request that produced this response was authorized. */
952
- readonly authMethod: AuthMethodType;
953
- /** Present (and true) only when the caller is an operator acting as themselves. */
954
- readonly isAdmin?: true;
955
- /** Present only during read-only admin impersonation: the operator's account id. */
956
- readonly impersonatedBy?: string;
957
- }
958
960
  /**
959
961
  * Acknowledgement of `DELETE /account` (202). Termination is asynchronous —
960
962
  * a cleanup consumer finishes the job — so the account survives long enough
@@ -1703,16 +1705,18 @@ declare const CALLER: {
1703
1705
  readonly PATTERN: RegExp;
1704
1706
  };
1705
1707
  /**
1706
- * The account a session request MEANS.
1708
+ * The account a session request is about.
1707
1709
  *
1708
- * A browser session selects one account for every tab at once, so a tab that
1709
- * switched leaves its siblings acting for an account they no longer show. A
1710
- * session caller may name the account it means in this header; the API
1711
- * answers 409 `details.account: 'select'` when it differs from the account the
1712
- * session resolves to, and the client re-selects. A precondition check the
1713
- * client volunteers, never authority: a request without it resolves exactly as
1714
- * before, and machine credentials never send it. One owner for the name, since
1715
- * the API's CORS allowlist and every browser transport spell it.
1710
+ * A person may belong to several accounts, so a request made with a browser
1711
+ * session names the one it means, on every request to an account route; the
1712
+ * console takes the value from its URL (`/<account>/`). The header names and
1713
+ * membership authorizes: the API resolves the person's membership in the
1714
+ * account named, answers 404 `details.account: 'unknown'` for an account the
1715
+ * person is not in (or one that does not exist), and 400 when a session
1716
+ * request names none. Machine credentials never send it, since a key, a
1717
+ * deploy token or an OAuth grant already belongs to one account. One owner
1718
+ * for the name, since the API's CORS allowlist and every browser transport
1719
+ * spell it.
1716
1720
  */
1717
1721
  declare const ACCOUNT_HEADER = "X-Account";
1718
1722
  /**
@@ -2005,6 +2009,122 @@ interface StaticFile {
2005
2009
  /** The size of the file in bytes. */
2006
2010
  size: number;
2007
2011
  }
2012
+ /**
2013
+ * The sections of an account, by first segment, each mounted twice by the
2014
+ * console: under `/<account>/` and at the root.
2015
+ *
2016
+ * `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.
2021
+ */
2022
+ declare const SECTIONS: {
2023
+ readonly new: {
2024
+ readonly owner: false;
2025
+ };
2026
+ readonly deployments: {
2027
+ readonly owner: false;
2028
+ };
2029
+ readonly domains: {
2030
+ readonly owner: false;
2031
+ };
2032
+ readonly settings: {
2033
+ readonly owner: false;
2034
+ };
2035
+ readonly upgrade: {
2036
+ readonly owner: true;
2037
+ };
2038
+ readonly success: {
2039
+ readonly owner: false;
2040
+ };
2041
+ readonly 'api-key': {
2042
+ readonly owner: true;
2043
+ };
2044
+ };
2045
+ /** A section's first segment. */
2046
+ type ConsoleSection = keyof typeof SECTIONS;
2047
+ /** The two fragments of the settings page a link may name. */
2048
+ type SettingsFragment = 'members' | 'api-key';
2049
+ /**
2050
+ * The query markers a Stripe return lands with, each written by a builder
2051
+ * below and read by `billingReturnOf`, so neither side spells one.
2052
+ */
2053
+ declare const BILLING_RETURNS: {
2054
+ readonly checkout: readonly ["upgrading", "true"];
2055
+ readonly portal: readonly ["billing", "returned"];
2056
+ };
2057
+ type BillingReturn = keyof typeof BILLING_RETURNS;
2058
+ /**
2059
+ * The paths inside one account, or, with no account, the bare form the
2060
+ * console opens in the account entered last.
2061
+ *
2062
+ * ```ts
2063
+ * consolePaths(account).domains.connect('www.example.com')
2064
+ * // '/<account>/domains/www.example.com/connect'
2065
+ * consolePaths().apiKey()
2066
+ * // '/api-key'
2067
+ * ```
2068
+ */
2069
+ declare function consolePaths(account?: string): {
2070
+ dashboard: () => string;
2071
+ newSite: () => string;
2072
+ deployments: (() => string) & {
2073
+ upload: () => string;
2074
+ };
2075
+ domains: (() => string) & {
2076
+ connect: (domain: string) => string;
2077
+ deployment: (domain: string) => string;
2078
+ };
2079
+ settings: (fragment?: SettingsFragment) => string;
2080
+ /** Settings, marked as the landing of a Stripe Customer Portal return. */
2081
+ settingsAfterBilling: () => string;
2082
+ upgrade: (plan?: AccountPlanType) => string;
2083
+ success: () => string;
2084
+ /** The success page, marked as the landing of a Stripe Checkout return. */
2085
+ successAfterCheckout: () => string;
2086
+ apiKey: () => string;
2087
+ };
2088
+ /** The builders `consolePaths` returns. */
2089
+ type ConsolePaths = ReturnType<typeof consolePaths>;
2090
+ /** The doors: the pages that exist before an account is known. */
2091
+ declare const doors: {
2092
+ readonly login: (next?: string) => string;
2093
+ readonly register: (next?: string) => string;
2094
+ readonly logout: () => string;
2095
+ readonly invitation: (invitation: string) => string;
2096
+ readonly claim: (code: string) => string;
2097
+ readonly consent: () => string;
2098
+ };
2099
+ /**
2100
+ * Which Stripe return a query string marks: `checkout` for the success page
2101
+ * after Checkout, `portal` for settings after the Customer Portal, or null.
2102
+ */
2103
+ declare function billingReturnOf(search: string): BillingReturn | null;
2104
+ /**
2105
+ * The account a path names, or null for a door, the operator partition, or
2106
+ * the bare form. Any first segment that is not a section, a door or the
2107
+ * partition is an account: the grammar has no other reading, and whether
2108
+ * the account exists is the server's answer, never the path's.
2109
+ */
2110
+ declare function accountOfPath(path: string): string | null;
2111
+ /** Whether a path names a claim link (`/claim/:code`, a bearer credential). */
2112
+ declare const isClaimPath: (path: string) => boolean;
2113
+ /** Whether a path names an invitation (`/invitations/:invitation`). */
2114
+ declare const isInvitationPath: (path: string) => boolean;
2115
+ /**
2116
+ * Whether a path names the upgrade section, in either form: `/upgrade`,
2117
+ * `/upgrade/:plan`, and the same under `/<account>/`.
2118
+ */
2119
+ declare const isUpgradePath: (path: string) => boolean;
2120
+ /** The errand a destination path carries, as the sign-in doors read it. */
2121
+ type ConsoleErrand = 'claim' | 'invite' | 'upgrade';
2122
+ /**
2123
+ * The errand a destination path carries, in specificity order: a pricing
2124
+ * link is the broadest, and the narrower ones do not normally coexist with
2125
+ * it.
2126
+ */
2127
+ declare function errandOf(path: string): ConsoleErrand | null;
2008
2128
  /** Default API URL if not otherwise configured. */
2009
2129
  declare const DEFAULT_API = "https://api.shipstatic.com";
2010
2130
  /**
@@ -2044,15 +2164,15 @@ declare const SHIP_ENV: {
2044
2164
  */
2045
2165
  declare const SHIP_VIA_ENV = "SHIP_VIA";
2046
2166
  /**
2047
- * Where a human creates an API key — the console deep link quoted by every
2167
+ * Where a human creates an API key: the console deep link quoted by every
2048
2168
  * surface that teaches authentication (the CLI's config wizard, the VS Code
2049
- * and n8n listings, the n8n rate-limit hint and credential copy). Written
2050
- * out in five files across three repos until this export.
2169
+ * and n8n listings, the n8n rate-limit hint and credential copy). The bare
2170
+ * form of the path, which the console opens in the reader's own account.
2051
2171
  *
2052
2172
  * Production-branded by design: published artifacts name the product, never
2053
2173
  * an environment (root `CLAUDE.md`, "Environment-Aware URLs").
2054
2174
  */
2055
- declare const MY_API_KEY_URL = "https://my.shipstatic.com/api-key";
2175
+ declare const MY_API_KEY_URL: string;
2056
2176
  /**
2057
2177
  * How long an anonymous deployment lives before it expires.
2058
2178
  *
@@ -2267,7 +2387,7 @@ interface DomainResource {
2267
2387
  * Account resource interface - the contract all implementations must follow
2268
2388
  */
2269
2389
  interface AccountResource {
2270
- get: () => Promise<AccountGetResponse>;
2390
+ get: () => Promise<Account>;
2271
2391
  }
2272
2392
  /**
2273
2393
  * Token resource interface - the contract all implementations must follow
@@ -3246,17 +3366,9 @@ declare abstract class Ship$1 {
3246
3366
  readonly tokens: TokenResource;
3247
3367
  private readonly http;
3248
3368
  private readonly clientOptions;
3249
- private initPromise;
3250
- protected platformLimits: PlatformLimits | null;
3251
3369
  private credential;
3252
3370
  constructor(options?: ShipClientOptions);
3253
- protected abstract processInput(input: DeployInput, options: DeploymentOptions): Promise<StaticFile[]>;
3254
- /**
3255
- * Lazy initialization — fetches platform limits (file size / count caps) once,
3256
- * on the first API call. Subsequent calls reuse the resolved promise.
3257
- */
3258
- protected ensureInitialized(): Promise<void>;
3259
- private fetchPlatformLimits;
3371
+ protected abstract processInput(input: DeployInput, options: DeploymentOptions, limits: PlatformLimits): Promise<StaticFile[]>;
3260
3372
  /**
3261
3373
  * Ping the API server, resolving its answer: `{ success, timestamp }`, where
3262
3374
  * `timestamp` is the server clock in unix SECONDS.
@@ -3275,11 +3387,11 @@ declare abstract class Ship$1 {
3275
3387
  /**
3276
3388
  * Get current account information (convenience shortcut to `ship.account.get()`).
3277
3389
  */
3278
- whoami(): Promise<AccountGetResponse>;
3390
+ whoami(): Promise<Account>;
3279
3391
  /**
3280
- * Get platform limits (max file size, file count, total size).
3281
- * Reuses the response fetched during initialization. Per-instance state —
3282
- * does not leak between concurrent Ships against different API URLs.
3392
+ * Get the platform limits the server states now (max file size, file count,
3393
+ * total size, and the blocked extensions). Asked every time and never held,
3394
+ * since a plan move or an operator's grant changes them.
3283
3395
  */
3284
3396
  getLimits(): Promise<PlatformLimits>;
3285
3397
  on<K extends keyof ShipEvents>(event: K, handler: (...args: ShipEvents[K]) => void): void;
@@ -3627,10 +3739,10 @@ declare function pluralize(count: number, singular: string, plural: string, incl
3627
3739
  *
3628
3740
  * @param paths - File or directory paths to scan and process.
3629
3741
  * @param options - Processing options (pathDetect, etc.).
3630
- * @param platformLimits - Per-instance platform limits (file-size / count /
3631
- * total-size caps) from the originating Ship's `GET /limits` fetch. Passed
3632
- * in rather than read from a module global so concurrent Ships against
3633
- * different API URLs cannot clobber each other's caps.
3742
+ * @param platformLimits - The platform limits (file-size / count /
3743
+ * total-size caps and the blocked extensions) the deploy read from
3744
+ * `GET /limits` at its start. Passed in, never held, so a validation always
3745
+ * meets the limits the server states now.
3634
3746
  * @returns Promise resolving to an array of StaticFile objects.
3635
3747
  * @throws {ShipError} If called outside Node.js or if fs/path modules fail.
3636
3748
  */
@@ -3681,10 +3793,10 @@ declare class Ship extends Ship$1 {
3681
3793
  * contract stays platform-neutral.
3682
3794
  */
3683
3795
  deploy(input: string | string[], options?: DeploymentOptions): Promise<DeploymentCreateResponse>;
3684
- protected processInput(input: DeployInput, options: DeploymentOptions): Promise<StaticFile[]>;
3796
+ protected processInput(input: DeployInput, options: DeploymentOptions, limits: PlatformLimits): Promise<StaticFile[]>;
3685
3797
  }
3686
3798
 
3687
3799
  declare namespace Ship {
3688
- export { ACCOUNT_HEADER, API_KEY, API_PATHS, AUTH_BASE_PATH, Account, AccountAccess, AccountDeleteResponse, AccountGetResponse, AccountKeyResponse, AccountPlan, AccountPlanType, AccountResource, AccountRole, Activity, ActivityEvent, ActivityListResponse, ActivityMeta, ApiDeployOptions, ApiHttp, ApiHttpOptions, AuthMethod, AuthMethodType, BUILD_SETTINGS, BillingInterval, BillingPortalSession, BillingSyncResponse, BuildFailureDetails, CALLER, Caps, 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, SETUP_TROUBLESHOOTING_ANCHOR, SHIP_ENV, SHIP_VIA_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, USER_VISIBLE_EVENTS, UploadedFile, UserVisibleActivityEvent, ValidatableFile, ValidationIssue, WEB_FILE_ACCEPT, __setTestEnvironment, allValidFilesReady, assertShipJsonSyntax, calculateMD5, classifyToken, createAccountResource, createDeploymentResource, createDomainResource, createTokenResource, deserializeLabels, extractSubdomain, filterJunk, formatDuration, formatFileSize, formatTimeRemaining, generateDeploymentUrl, generateDomainUrl, getENV, getValidFiles, hasUnbuiltMarker, hasUnsafeChars, isBlockedExtension, isCustomDomain, isDeployment, isPlatformDomain, isShipError, normalizeVia, optimizeDeployPaths, personName, personShortName, pluralize, processFilesForNode, readBearerValue, serializeLabels, validateApiKey, validateApiUrl, validateBuildCommand, validateCaller, validateDeployFile, validateDeployPath, validateDeployToken, validateFileName, validateFiles, validateIdempotencyKey, validateOAuthToken, validateOutputDir, validatePassword, validateToken, validateTtl };
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 };
3689
3801
  }
3690
3802
  export = Ship;
package/dist/index.d.ts CHANGED
@@ -786,18 +786,34 @@ type AccountRole = 'owner' | 'member';
786
786
  * account automation, not a person, and is always `active`.
787
787
  */
788
788
  type AccountAccess = 'active' | 'paused';
789
+ /**
790
+ * The word a refusal about the account carries in `details.account`, so a
791
+ * client can tell the two apart without reading the sentence:
792
+ *
793
+ * - `paused`: a 403. The person is a member, and the account holds more
794
+ * members than its plan allows (see {@link AccountAccess}).
795
+ * - `unknown`: a 404. The account the request names ({@link ACCOUNT_HEADER})
796
+ * is one the person is not a member of, or one that does not exist; the
797
+ * two are indistinguishable by design. A tab whose person was removed from
798
+ * the account meets it on its next request.
799
+ */
800
+ declare const AccountRefusal: {
801
+ readonly PAUSED: "paused";
802
+ readonly UNKNOWN: "unknown";
803
+ };
804
+ type AccountRefusalType = (typeof AccountRefusal)[keyof typeof AccountRefusal];
789
805
  /**
790
806
  * Core account object - used in both API responses and SDK
791
807
  * All fields are readonly to prevent accidental mutations
792
808
  */
793
809
  interface Account {
794
810
  /**
795
- * The account this response describes, by id. A person may belong to
796
- * several accounts and a browser session selects one, so a client names
797
- * the one it means on every request (`X-Account`) and this is where it
798
- * learns the name. Optional by the additive-evolution law.
811
+ * The account this response describes, by id: the name the console's URL
812
+ * carries (`/<account>/`) and a session request sends in
813
+ * {@link ACCOUNT_HEADER}. A machine credential IS its account, so the
814
+ * response names the account the credential belongs to.
799
815
  */
800
- readonly account?: string;
816
+ readonly account: string;
801
817
  /** User email address */
802
818
  readonly email: string;
803
819
  /**
@@ -941,20 +957,6 @@ interface PlanDestination {
941
957
  readonly plan: AccountPlanType;
942
958
  readonly intervals: BillingInterval[];
943
959
  }
944
- /**
945
- * Account as returned by `GET /account` — the entity plus how the request
946
- * was authorized, so `whoami` can answer "what credential am I holding?".
947
- * Request-scoped fields live on the response type, never on the entity
948
- * (the `DeploymentCreateResponse` pattern).
949
- */
950
- interface AccountGetResponse extends Account {
951
- /** How the request that produced this response was authorized. */
952
- readonly authMethod: AuthMethodType;
953
- /** Present (and true) only when the caller is an operator acting as themselves. */
954
- readonly isAdmin?: true;
955
- /** Present only during read-only admin impersonation: the operator's account id. */
956
- readonly impersonatedBy?: string;
957
- }
958
960
  /**
959
961
  * Acknowledgement of `DELETE /account` (202). Termination is asynchronous —
960
962
  * a cleanup consumer finishes the job — so the account survives long enough
@@ -1703,16 +1705,18 @@ declare const CALLER: {
1703
1705
  readonly PATTERN: RegExp;
1704
1706
  };
1705
1707
  /**
1706
- * The account a session request MEANS.
1708
+ * The account a session request is about.
1707
1709
  *
1708
- * A browser session selects one account for every tab at once, so a tab that
1709
- * switched leaves its siblings acting for an account they no longer show. A
1710
- * session caller may name the account it means in this header; the API
1711
- * answers 409 `details.account: 'select'` when it differs from the account the
1712
- * session resolves to, and the client re-selects. A precondition check the
1713
- * client volunteers, never authority: a request without it resolves exactly as
1714
- * before, and machine credentials never send it. One owner for the name, since
1715
- * the API's CORS allowlist and every browser transport spell it.
1710
+ * A person may belong to several accounts, so a request made with a browser
1711
+ * session names the one it means, on every request to an account route; the
1712
+ * console takes the value from its URL (`/<account>/`). The header names and
1713
+ * membership authorizes: the API resolves the person's membership in the
1714
+ * account named, answers 404 `details.account: 'unknown'` for an account the
1715
+ * person is not in (or one that does not exist), and 400 when a session
1716
+ * request names none. Machine credentials never send it, since a key, a
1717
+ * deploy token or an OAuth grant already belongs to one account. One owner
1718
+ * for the name, since the API's CORS allowlist and every browser transport
1719
+ * spell it.
1716
1720
  */
1717
1721
  declare const ACCOUNT_HEADER = "X-Account";
1718
1722
  /**
@@ -2005,6 +2009,122 @@ interface StaticFile {
2005
2009
  /** The size of the file in bytes. */
2006
2010
  size: number;
2007
2011
  }
2012
+ /**
2013
+ * The sections of an account, by first segment, each mounted twice by the
2014
+ * console: under `/<account>/` and at the root.
2015
+ *
2016
+ * `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.
2021
+ */
2022
+ declare const SECTIONS: {
2023
+ readonly new: {
2024
+ readonly owner: false;
2025
+ };
2026
+ readonly deployments: {
2027
+ readonly owner: false;
2028
+ };
2029
+ readonly domains: {
2030
+ readonly owner: false;
2031
+ };
2032
+ readonly settings: {
2033
+ readonly owner: false;
2034
+ };
2035
+ readonly upgrade: {
2036
+ readonly owner: true;
2037
+ };
2038
+ readonly success: {
2039
+ readonly owner: false;
2040
+ };
2041
+ readonly 'api-key': {
2042
+ readonly owner: true;
2043
+ };
2044
+ };
2045
+ /** A section's first segment. */
2046
+ type ConsoleSection = keyof typeof SECTIONS;
2047
+ /** The two fragments of the settings page a link may name. */
2048
+ type SettingsFragment = 'members' | 'api-key';
2049
+ /**
2050
+ * The query markers a Stripe return lands with, each written by a builder
2051
+ * below and read by `billingReturnOf`, so neither side spells one.
2052
+ */
2053
+ declare const BILLING_RETURNS: {
2054
+ readonly checkout: readonly ["upgrading", "true"];
2055
+ readonly portal: readonly ["billing", "returned"];
2056
+ };
2057
+ type BillingReturn = keyof typeof BILLING_RETURNS;
2058
+ /**
2059
+ * The paths inside one account, or, with no account, the bare form the
2060
+ * console opens in the account entered last.
2061
+ *
2062
+ * ```ts
2063
+ * consolePaths(account).domains.connect('www.example.com')
2064
+ * // '/<account>/domains/www.example.com/connect'
2065
+ * consolePaths().apiKey()
2066
+ * // '/api-key'
2067
+ * ```
2068
+ */
2069
+ declare function consolePaths(account?: string): {
2070
+ dashboard: () => string;
2071
+ newSite: () => string;
2072
+ deployments: (() => string) & {
2073
+ upload: () => string;
2074
+ };
2075
+ domains: (() => string) & {
2076
+ connect: (domain: string) => string;
2077
+ deployment: (domain: string) => string;
2078
+ };
2079
+ settings: (fragment?: SettingsFragment) => string;
2080
+ /** Settings, marked as the landing of a Stripe Customer Portal return. */
2081
+ settingsAfterBilling: () => string;
2082
+ upgrade: (plan?: AccountPlanType) => string;
2083
+ success: () => string;
2084
+ /** The success page, marked as the landing of a Stripe Checkout return. */
2085
+ successAfterCheckout: () => string;
2086
+ apiKey: () => string;
2087
+ };
2088
+ /** The builders `consolePaths` returns. */
2089
+ type ConsolePaths = ReturnType<typeof consolePaths>;
2090
+ /** The doors: the pages that exist before an account is known. */
2091
+ declare const doors: {
2092
+ readonly login: (next?: string) => string;
2093
+ readonly register: (next?: string) => string;
2094
+ readonly logout: () => string;
2095
+ readonly invitation: (invitation: string) => string;
2096
+ readonly claim: (code: string) => string;
2097
+ readonly consent: () => string;
2098
+ };
2099
+ /**
2100
+ * Which Stripe return a query string marks: `checkout` for the success page
2101
+ * after Checkout, `portal` for settings after the Customer Portal, or null.
2102
+ */
2103
+ declare function billingReturnOf(search: string): BillingReturn | null;
2104
+ /**
2105
+ * The account a path names, or null for a door, the operator partition, or
2106
+ * the bare form. Any first segment that is not a section, a door or the
2107
+ * partition is an account: the grammar has no other reading, and whether
2108
+ * the account exists is the server's answer, never the path's.
2109
+ */
2110
+ declare function accountOfPath(path: string): string | null;
2111
+ /** Whether a path names a claim link (`/claim/:code`, a bearer credential). */
2112
+ declare const isClaimPath: (path: string) => boolean;
2113
+ /** Whether a path names an invitation (`/invitations/:invitation`). */
2114
+ declare const isInvitationPath: (path: string) => boolean;
2115
+ /**
2116
+ * Whether a path names the upgrade section, in either form: `/upgrade`,
2117
+ * `/upgrade/:plan`, and the same under `/<account>/`.
2118
+ */
2119
+ declare const isUpgradePath: (path: string) => boolean;
2120
+ /** The errand a destination path carries, as the sign-in doors read it. */
2121
+ type ConsoleErrand = 'claim' | 'invite' | 'upgrade';
2122
+ /**
2123
+ * The errand a destination path carries, in specificity order: a pricing
2124
+ * link is the broadest, and the narrower ones do not normally coexist with
2125
+ * it.
2126
+ */
2127
+ declare function errandOf(path: string): ConsoleErrand | null;
2008
2128
  /** Default API URL if not otherwise configured. */
2009
2129
  declare const DEFAULT_API = "https://api.shipstatic.com";
2010
2130
  /**
@@ -2044,15 +2164,15 @@ declare const SHIP_ENV: {
2044
2164
  */
2045
2165
  declare const SHIP_VIA_ENV = "SHIP_VIA";
2046
2166
  /**
2047
- * Where a human creates an API key — the console deep link quoted by every
2167
+ * Where a human creates an API key: the console deep link quoted by every
2048
2168
  * surface that teaches authentication (the CLI's config wizard, the VS Code
2049
- * and n8n listings, the n8n rate-limit hint and credential copy). Written
2050
- * out in five files across three repos until this export.
2169
+ * and n8n listings, the n8n rate-limit hint and credential copy). The bare
2170
+ * form of the path, which the console opens in the reader's own account.
2051
2171
  *
2052
2172
  * Production-branded by design: published artifacts name the product, never
2053
2173
  * an environment (root `CLAUDE.md`, "Environment-Aware URLs").
2054
2174
  */
2055
- declare const MY_API_KEY_URL = "https://my.shipstatic.com/api-key";
2175
+ declare const MY_API_KEY_URL: string;
2056
2176
  /**
2057
2177
  * How long an anonymous deployment lives before it expires.
2058
2178
  *
@@ -2267,7 +2387,7 @@ interface DomainResource {
2267
2387
  * Account resource interface - the contract all implementations must follow
2268
2388
  */
2269
2389
  interface AccountResource {
2270
- get: () => Promise<AccountGetResponse>;
2390
+ get: () => Promise<Account>;
2271
2391
  }
2272
2392
  /**
2273
2393
  * Token resource interface - the contract all implementations must follow
@@ -3246,17 +3366,9 @@ declare abstract class Ship$1 {
3246
3366
  readonly tokens: TokenResource;
3247
3367
  private readonly http;
3248
3368
  private readonly clientOptions;
3249
- private initPromise;
3250
- protected platformLimits: PlatformLimits | null;
3251
3369
  private credential;
3252
3370
  constructor(options?: ShipClientOptions);
3253
- protected abstract processInput(input: DeployInput, options: DeploymentOptions): Promise<StaticFile[]>;
3254
- /**
3255
- * Lazy initialization — fetches platform limits (file size / count caps) once,
3256
- * on the first API call. Subsequent calls reuse the resolved promise.
3257
- */
3258
- protected ensureInitialized(): Promise<void>;
3259
- private fetchPlatformLimits;
3371
+ protected abstract processInput(input: DeployInput, options: DeploymentOptions, limits: PlatformLimits): Promise<StaticFile[]>;
3260
3372
  /**
3261
3373
  * Ping the API server, resolving its answer: `{ success, timestamp }`, where
3262
3374
  * `timestamp` is the server clock in unix SECONDS.
@@ -3275,11 +3387,11 @@ declare abstract class Ship$1 {
3275
3387
  /**
3276
3388
  * Get current account information (convenience shortcut to `ship.account.get()`).
3277
3389
  */
3278
- whoami(): Promise<AccountGetResponse>;
3390
+ whoami(): Promise<Account>;
3279
3391
  /**
3280
- * Get platform limits (max file size, file count, total size).
3281
- * Reuses the response fetched during initialization. Per-instance state —
3282
- * does not leak between concurrent Ships against different API URLs.
3392
+ * Get the platform limits the server states now (max file size, file count,
3393
+ * total size, and the blocked extensions). Asked every time and never held,
3394
+ * since a plan move or an operator's grant changes them.
3283
3395
  */
3284
3396
  getLimits(): Promise<PlatformLimits>;
3285
3397
  on<K extends keyof ShipEvents>(event: K, handler: (...args: ShipEvents[K]) => void): void;
@@ -3627,10 +3739,10 @@ declare function pluralize(count: number, singular: string, plural: string, incl
3627
3739
  *
3628
3740
  * @param paths - File or directory paths to scan and process.
3629
3741
  * @param options - Processing options (pathDetect, etc.).
3630
- * @param platformLimits - Per-instance platform limits (file-size / count /
3631
- * total-size caps) from the originating Ship's `GET /limits` fetch. Passed
3632
- * in rather than read from a module global so concurrent Ships against
3633
- * different API URLs cannot clobber each other's caps.
3742
+ * @param platformLimits - The platform limits (file-size / count /
3743
+ * total-size caps and the blocked extensions) the deploy read from
3744
+ * `GET /limits` at its start. Passed in, never held, so a validation always
3745
+ * meets the limits the server states now.
3634
3746
  * @returns Promise resolving to an array of StaticFile objects.
3635
3747
  * @throws {ShipError} If called outside Node.js or if fs/path modules fail.
3636
3748
  */
@@ -3681,7 +3793,7 @@ declare class Ship extends Ship$1 {
3681
3793
  * contract stays platform-neutral.
3682
3794
  */
3683
3795
  deploy(input: string | string[], options?: DeploymentOptions): Promise<DeploymentCreateResponse>;
3684
- protected processInput(input: DeployInput, options: DeploymentOptions): Promise<StaticFile[]>;
3796
+ protected processInput(input: DeployInput, options: DeploymentOptions, limits: PlatformLimits): Promise<StaticFile[]>;
3685
3797
  }
3686
3798
 
3687
- export { ACCOUNT_HEADER, API_KEY, API_PATHS, AUTH_BASE_PATH, type Account, type AccountAccess, type AccountDeleteResponse, type AccountGetResponse, type AccountKeyResponse, AccountPlan, type AccountPlanType, 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, 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, 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 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, allValidFilesReady, assertShipJsonSyntax, calculateMD5, classifyToken, createAccountResource, createDeploymentResource, createDomainResource, createTokenResource, Ship as default, deserializeLabels, extractSubdomain, filterJunk, formatDuration, formatFileSize, formatTimeRemaining, generateDeploymentUrl, generateDomainUrl, getENV, getValidFiles, hasUnbuiltMarker, hasUnsafeChars, isBlockedExtension, isCustomDomain, isDeployment, isPlatformDomain, isShipError, normalizeVia, optimizeDeployPaths, personName, personShortName, pluralize, processFilesForNode, readBearerValue, serializeLabels, validateApiKey, validateApiUrl, validateBuildCommand, validateCaller, validateDeployFile, validateDeployPath, validateDeployToken, validateFileName, validateFiles, validateIdempotencyKey, validateOAuthToken, validateOutputDir, validatePassword, validateToken, validateTtl };
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 };