@farthershore/farthershore-js/test-utils exports
Every public export and declaration from @farthershore/farthershore-js/test-utils.
Every public export and declaration from @farthershore/farthershore-js/test-utils.
Import from @farthershore/farthershore-js/test-utils. This reference is extracted from the published declaration surface for version 0.32.0. Read the collection's guides for workflows, prerequisites and failure handling.
Build a fully-typed {@link FartherShoreClient} test double. Every resource
defaults to an empty/no-op implementation, so a component tree renders
without crashing under `<FartherShoreTestProvider>` with zero overrides.
`overrides` deep-merges onto the defaults — a nested plain object (a
resource) merges key-by-key, so overriding one method preserves every
sibling method's default; a function value always replaces wholesale.
Declaration source: packages/farthershore-js/dist/test-utils/mock-client.d.ts#L36.
export declare function createMockFartherShoreClient(overrides?: DeepPartial<FartherShoreClient__e4fe174a542f>): FartherShoreClient__e4fe174a542f;
Deep-merge `override` onto `base`: nested plain objects (resources) MERGE
key-by-key so an override of one method (`{ keys: { list } }`) preserves
every sibling method's default; functions and other leaves REPLACE
wholesale (never merged into). Exported for reuse by callers building their
own layered mocks.
Declaration source: packages/farthershore-js/dist/test-utils/mock-client.d.ts#L13.
export declare function deepMergeClient<T>(base: T, override: DeepPartial<T>): T;
Recursively-optional mirror of `T`. Plain nested objects stay deep-partial;
functions and other leaves (arrays, primitives, class instances) are only
ever REPLACED wholesale — see {@link deepMergeClient}.
Declaration source: packages/farthershore-js/dist/test-utils/mock-client.d.ts#L5.
export type DeepPartial<T> = T extends (...args: infer A) => infer R ? (...args: A) => R : T extends readonly unknown[] ? T : T extends object ? {
[K in keyof T]?: DeepPartial<T[K]>;
} : T;
Mount a component tree under a Farther Shore client for tests — the
`render(..., { wrapper })` target for any component that calls
`useFartherShore()` / one of the built-in hooks.
Declaration source: packages/farthershore-js/dist/test-utils/test-provider.d.ts#L24.
export declare function FartherShoreTestProvider({ client, children, }: FartherShoreTestProviderProps): import("react").JSX.Element;
Public export FartherShoreTestProviderProps.
Declaration source: packages/farthershore-js/dist/test-utils/test-provider.d.ts#L3.
export interface FartherShoreTestProviderProps {
/** A mock or real client — typically {@link createMockFartherShoreClient}'s
* return value. */
client: FartherShoreClient__e4fe174a542f;
children: ReactNode;
}
Build a generic {@link FartherShoreApiError} for asserting an error-handling
branch keyed on `status`/`code`.
expect(mockApiError(429, "x")).toBeInstanceOf(FartherShoreApiError);
Declaration source: packages/farthershore-js/dist/test-utils/error-builders.d.ts#L28.
export declare function mockApiError(status: number, code: string, message?: string): FartherShoreApiError__ae8b4410fda4;
Build a {@link LimitExceededError} (a plan/quota/spend cap deny) for
asserting a component's upgrade-prompt branch.
expect(mockLimitExceeded()).toBeInstanceOf(LimitExceededError);
Declaration source: packages/farthershore-js/dist/test-utils/error-builders.d.ts#L17.
export declare function mockLimitExceeded(overrides?: {
message?: string;
code?: string;
status?: number;
descriptor?: Partial<LimitDescriptor__01693492a147>;
}): LimitExceededError__7844c601e6fd;
Build a {@link FartherShoreRateLimitedError} (a `429` throttle deny) for
asserting a component's backoff/retry branch.
expect(mockRateLimited()).toBeInstanceOf(FartherShoreRateLimitedError);
Declaration source: packages/farthershore-js/dist/test-utils/error-builders.d.ts#L7.
export declare function mockRateLimited(overrides?: {
message?: string;
retryAfterSeconds?: number | null;
code?: string;
}): FartherShoreRateLimitedError__dbc7e0b60aee;
These declarations explain types reachable from the public exports above. They are source evidence, not supported package imports. Suffixed names are documentation identifiers that preserve distinct lexical bindings. Standard-library and third-party types (for example Promise, React and Zod) remain external boundaries; their implementation declarations are not expanded here.
Declaration source: packages/farthershore-js/dist/types.d.ts#L1061.
export interface AccessRequest__e4d3f89daefa {
id: string;
/** External identity id of the requesting member. */
requestedBy: string;
/** The requested permission (unified `<subject>:<verb>` grammar). */
permission: string;
note?: string | null;
/** PENDING | APPROVED | DENIED. */
status: string;
resolvedBy?: string | null;
resolvedAt?: string | null;
createdAt: string;
}
Declaration source: packages/farthershore-js/dist/types.d.ts#L465.
export interface ActiveServiceAccountCreateResponse__b15fda647836 {
status: "ACTIVE";
serviceAccountId: string;
apiKeyId: string;
keyPrefix: string;
/** One-time plaintext secret. */
plaintext: string;
requestedPermissions: string[];
grantedPermissions: string[];
}
Declaration source: packages/farthershore-js/dist/types.d.ts#L486.
export interface ActiveServiceAccountUpdateResponse__fe5e8ed2381b {
status: "ACTIVE";
serviceAccountId: string;
requestedPermissions: string[];
grantedPermissions: string[];
}
Declaration source: packages/farthershore-js/dist/types.d.ts#L347.
export interface ApiKey__a2eadd893331 {
id: string;
keyPrefix: string;
label: string | null;
/** Normalized lowercase, e.g. "active" | "revoked". */
status: string;
createdAt: string;
lastUsedAt: string | null;
revokedAt: string | null;
/** Consumer-principal (D2): the key's subject kind — a PERSONAL key mints a
* member subject, a SERVICE key an org-owned service account. Always present
* (Core's `ApiKey.kind` is a NOT NULL column). */
kind: ApiKeyKind__336a38a3bc29;
/** PERSONAL — the bound member's stable `Membership.id` (identity + permission
* source). Null for service keys / when the API omits it. */
memberId: string | null;
/** SERVICE — the org-owned `ServiceAccount.id` the key attaches to. Null for
* personal keys / when the API omits it. */
serviceAccountId: string | null;
/** SERVICE — the bound service account's display name, when the API returns
* it (the list groups service keys by account under this label). */
serviceAccountName: string | null;
/** Provenance: which member MINTED the key (audit only; may differ from the
* bound member when an admin mints a personal key for someone — D2a). Null
* for pre-attribution keys. */
createdBy: string | null;
}
Declaration source: packages/farthershore-js/dist/types.d.ts#L346.
export type ApiKeyKind__336a38a3bc29 = "PERSONAL" | "SERVICE";
Declaration source: packages/farthershore-js/dist/types.d.ts#L493.
export interface ApprovedServiceAccountCreateResponse__b73a29c4cc94 {
status: "ACTIVE";
operation: "CREATE";
serviceAccountId: string;
apiKeyId: string;
/** One-time plaintext secret. */
plaintext: string;
grantedPermissions: string[];
}
Declaration source: packages/farthershore-js/dist/types.d.ts#L502.
export interface ApprovedServiceAccountUpdateResponse__e4e8de0be760 {
status: "ACTIVE";
operation: "UPDATE";
serviceAccountId: string;
grantedPermissions: string[];
}
Declaration source: packages/farthershore-js/dist/types.d.ts#L451.
export interface ApproveServiceAccountInput__db09091445e7 {
/** Omit to approve the complete original request. */
grantedPermissions?: string[];
}
Declaration source: packages/farthershore-js/dist/types.d.ts#L1074.
export interface AuditLogEntry__fed61670ee17 {
id: string;
createdAt: string;
action: string;
decision?: "ALLOW" | "DENY" | null;
actorType?: string | null;
actorUserId?: string | null;
/** Friendly display name for a user actor (subscriber / builder / maker),
* resolved server-side from the actor's Clerk user id. Null for non-user
* actors (gateway / admin_service) or unknown ids — render `actorUserId`
* as the fallback. */
actorName?: string | null;
payloadJson?: Record<string, unknown> | null;
[k: string]: unknown;
}
Declaration source: packages/farthershore-js/dist/types.d.ts#L1089.
export interface AuditLogPage__2bf11a4137e1 {
items: AuditLogEntry__fed61670ee17[];
nextCursor: string | null;
}
Declaration source: packages/farthershore-js/dist/resources/account.d.ts#L142.
export interface AuditLogsResource__99efa1e02380 {
/** Cursor-paged subscriber audit log (decision ALLOW|DENY, limit ≤ 200).
* Degrades to an empty page on error, like the SSR page. */
list(filters?: {
action?: string;
actorUserId?: string;
decision?: "ALLOW" | "DENY";
from?: string;
to?: string;
cursor?: string;
limit?: number;
signal?: AbortSignal;
/**
* `null` intentionally reads the user's default subscription without an
* organization header. `undefined` preserves the selected workspace.
*/
organizationId?: string | null;
}): Promise<AuditLogPage__2bf11a4137e1>;
}
Declaration source: packages/farthershore-js/dist/resources/auth.d.ts#L3.
export interface AuthResource__beeda8a7af1a {
/** The current session (authenticated identity + a light subscriber slice).
* Resolves to `{ authenticated: false }` on 401/403 rather than throwing.
* Test-persona identity comes from Core's verified HttpOnly cookie; no
* persona bearer is exposed to browser JavaScript. */
getSession(opts?: {
signal?: AbortSignal;
}): Promise<Session__d51a47154738>;
/** Revoke the server-owned persona browser session and clear local auth
* caches. Clerk-strategy environments continue to sign out via Clerk. */
signOut(): Promise<void>;
/** Set a session bearer directly (for example, Clerk's session token). */
setToken(token: string | null): void;
/** Mint a short-lived Gateway bearer from the current authenticated browser
* session. In persona environments Core authenticates this with the
* same-origin HttpOnly cookie. */
gatewayContextToken(opts?: {
signal?: AbortSignal;
refresh?: boolean;
}): Promise<GatewayContextToken__447d2a94e34b>;
}
Declaration source: packages/farthershore-js/dist/types.d.ts#L59.
export type AuthStrategy__ccafca0932db = "clerk" | "test-personas";
Declaration source: packages/farthershore-js/dist/types.d.ts#L1097.
export interface AutoApiKeyError__bd378e9396dc {
code: string;
message: string;
}
Declaration source: packages/farthershore-js/dist/resources/billing.d.ts#L13.
export interface BillingResource__c8dbd9d25fa3 {
/** The consumer's current subscription for this product, or null.
*
* `opts.signal` is accepted for source-compat but does NOT cancel the shared
* cached fetch (the cache owns the fetch lifecycle); the read is unmount-safe
* via the hook's active-flag and bounded by the cache TTL. */
subscription(opts?: {
signal?: AbortSignal;
}): Promise<Subscription__3e996fafa8e7 | null>;
/** Open the Stripe-hosted billing portal (payment method + invoices). Returns
* the URL to navigate to. This is also how invoices are viewed in V0. */
openBillingPortal(input?: {
returnUrl?: string;
}): Promise<{
url: string;
}>;
/** Cancel the current subscription. Free subs cancel inline; paid subs are
* scheduled on the provider for the end of the current billing period and
* the result carries the `cancelsAt` boundary. `reason` is recorded for
* churn analytics. */
cancelSubscription(input?: {
reason?: string;
}): Promise<CancelSubscriptionResult__9dfffd11b827>;
/** Buy more prepaid balance. Starts a provider checkout for `amountCents`
* and returns the URL to send the subscriber to. Core gates this on
* `invoice:pay` and refuses (`INVALID_STATE`) for a plan that declares no
* prepaid funding. `requestId` is the idempotency handle — pass the SAME
* uuid to retry one intent; omit it and the SDK mints one per call. */
addFunds(input: {
amountCents: number;
requestId?: string;
successUrl?: string;
cancelUrl?: string;
}): Promise<{
checkoutUrl: string;
}>;
/** Reverse a scheduled cancel — the platform lifts `cancel_at_period_end`
* on the provider (paid) or flips a CANCELLED free sub back to ACTIVE. The
* result carries the platform's POST-restore `cancelAtPeriodEnd` so a
* caller can render the outcome instead of assuming it. */
restoreSubscription(): Promise<RestoreSubscriptionResult__60ac2939c09d>;
/** Change an existing subscription to another plan. Core applies or
* schedules the transition according to the product's policy. */
changePlan(input: {
compiledPlanId: string;
}): Promise<ChangePlanResult__11a914c015a6>;
/** Set (or clear, with `null`) the subscriber's monthly spend cap (in cents).
* PATCHes `/me/spend-cap`. CAVEAT: the cap is currently STORED-not-ENFORCED
* (held in subscription metadata pending the rate-limit migration) — do NOT
* present this as a hard spend limit in UI copy. */
setSpendCap(input: {
maxMonthlySpendCents: number | null;
}): Promise<SpendCapResult__395300e78371>;
/** Read the subscriber's current monthly spend cap (in cents), or null when
* none is set / signed out. P-SPENDCAP-READ — reads the additive
* `subscriber.maxMonthlySpendCents` surfaced on the `/me` context (no new
* route). Joins the memoized `/me` read.
*
* `opts.signal` is accepted for source-compat but does NOT cancel the shared
* cached `/me` fetch (the cache owns the fetch lifecycle); the read is
* unmount-safe via the hook's active-flag and bounded by the cache TTL. */
getSpendCap(opts?: {
signal?: AbortSignal;
}): Promise<number | null>;
/** The subscriber's current-window bill preview (`GET /me/bill-preview`) —
* computed by Core through the SAME rating engine + ledger state as
* invoicing, so preview === invoice by construction. Honors the plan's
* `spendPolicy.disclosure`: `transparent` carries windows / totals /
* nanodollar allowance balances; `opaque` carries allowance shape only (no
* amounts). Nanodollar fields are decimal STRINGS — format them with
* `format.formatNanos`, never `Number()`. Read-through cached; every
* entitlement mutation (subscribe / change plan / cancel / restore /
* migrate) busts it. Signed-out / no subscription → Core serves an empty
* transparent preview.
*
* `opts.signal` is accepted for source-compat but does NOT cancel the shared
* cached fetch (the cache owns the fetch lifecycle). */
getBillPreview(opts?: {
signal?: AbortSignal;
}): Promise<BillPreview__c6a85a661e87>;
}
Declaration source: packages/farthershore-js/dist/types.d.ts#L1284.
export type BillPreview__c6a85a661e87 = TransparentBillPreview__bd44f368bc40 | OpaqueBillPreview__249f4b617b5a;
Declaration source: packages/farthershore-js/dist/types.d.ts#L1198.
export interface BillPreviewAllowance__eba9c1df99be {
/** Bucket source kind (e.g. `included`, `prepaid`, `promo`). */
kind: string;
/** Bucket lifecycle state — Core's `BucketState`, verbatim. */
state: BucketState__c796139d57fe;
/** Nanodollars, decimal strings (null = unavailable). */
remainingNanos: NanosAmount__f9c1e22d3cbe;
heldNanos: NanosAmount__f9c1e22d3cbe;
consumedNanos: NanosAmount__f9c1e22d3cbe;
/** ISO timestamp, or null when the allowance does not expire. */
expiresAt: string | null;
}
Declaration source: packages/farthershore-js/dist/types.d.ts#L1251.
export interface BillPreviewUsageRating__fb184ad4d633 {
pendingEventCount: number;
unratableEventCount: number;
/** ISO instant of the oldest unaccounted event, or null when there is none. */
oldestUnratedServedAt: string | null;
}
Declaration source: packages/farthershore-js/dist/types.d.ts#L1186.
export interface BillPreviewWindow__ebfec15d43d1 {
windowId: string;
/** ISO timestamps. */
windowStart: string;
windowEnd: string;
/** Rated charges the engine recognized in this window. */
chargeCount: number;
/** Nanodollars, decimal string (null = unavailable). */
ratedNanos: NanosAmount__f9c1e22d3cbe;
}
Declaration source: packages/farthershore-js/dist/types.d.ts#L294.
export interface Bootstrap__ecb3d46aafde {
/** Wire schema version of the resolve DTO this bootstrap was decoded from
* (CC5). Additive negotiation hook; legacy payloads (no version) decode as
* `1`. Informational today — the SDK reads every shape tolerantly. */
schemaVersion: number;
business: Business__3ed5dd8f7507;
environment: EnvironmentInfo__866e98cf165d | null;
branding: Branding__c1352d7b32a1;
/** The business's available/purchasable plans (empty when none are
* published). The single source the plans/pricing UI renders from. */
plans: Plan__3a8348415fe9[];
/** The business's active custom-frontend release hash, or null. Informational
* (diagnostics) — V0 serving is host-keyed at the edge. */
frontendReleaseHash: string | null;
/** Available module keys derived from the plan set (non-empty once plans exist):
* e.g. "billing", "usage-quota", "docs", "legal". */
availableModules: string[];
/** The business's declared counted-resource catalog (W5.1). Empty when the
* business declares none. */
declaredResources: DeclaredResource__b4d9315d38c7[];
}
Declaration source: packages/farthershore-js/dist/types.d.ts#L2.
export interface Branding__c1352d7b32a1 {
displayName: string;
/** Square brand mark (favicon / nav mark). */
iconUrl: string | null;
/** Horizontal text logo (wordmark) — rendered in place of the displayName
* text when set. Most products only have an icon. */
logoUrl: string | null;
/** Marketing/header description for the business, when set. */
description: string | null;
}
Declaration source: packages/farthershore-js/dist/types.d.ts#L1184.
export type BucketState__c796139d57fe = "PENDING" | "AVAILABLE" | "EXPIRY_PENDING" | "FROZEN" | "EXPIRED" | "CANCELLED";
Declaration source: packages/farthershore-js/dist/types.d.ts#L23.
export interface Business__3ed5dd8f7507 {
id: string;
/** Subdomain slug (the first label of the gateway/portal host). */
slug: string;
name: string;
description: string | null;
branding: Branding__c1352d7b32a1;
/** Gateway origin host for builder-feature calls (the business `runtimeHostname`). */
gatewayHost: string;
/** Public portal host. */
portalHost: string;
/** R2 public origin + business prefix where MDX docs live, or null when the
* platform has no docs origin configured (local dev). The `/docs` view
* concatenates the doc filename onto this. */
docsBaseUrl: string | null;
/** R2 public origin + business prefix for per-business legal MDX
* (terms / privacy), or null. The legal view falls back to the platform
* terms notice when null. */
legalBaseUrl: string | null;
/** Versioned legal documents declared by the business, keyed by extensible
* kind (`terms`, `privacy`, custom kinds). URLs are public CDN MDX objects. */
legal?: {
documents: Record<string, LegalDocumentReference__0e8dba55b6a6>;
};
/** Platform-owned docs visibility flag. When `false` the portal /docs
* surface is suppressed (nav item hidden, route 404s) regardless of
* whether `docsBaseUrl` is set. Absent on older Core payloads — the SDK
* defaults this to `true` (backward-compatible). */
docsEnabled: boolean;
/** Immutable `CompiledPlan.id` of the featured plan, or null. Used to render
* the "Most Popular" treatment in the plans UI. */
featuredCompiledPlanId: string | null;
/** Business-level meter definitions — the dimension catalog used to label
* usage rows. Empty when the business declares no meters. */
meters: Meter__c4ca128fcf40[];
}
Declaration source: packages/farthershore-js/dist/resources/business.d.ts#L2.
export interface BusinessResource__933d34c2f16a {
/** The business this frontend is running for (resolved via bootstrap). */
get(): Promise<Business__3ed5dd8f7507>;
/** The business's declared counted-resource catalog (W5.1) — name + label +
* scope + per-plan cap. The same list `bootstrap()` resolves. */
resources(): Promise<DeclaredResource__b4d9315d38c7[]>;
}
Declaration source: packages/farthershore-js/dist/types.d.ts#L1122.
export interface CancelSubscriptionResult__9dfffd11b827 {
subscription?: unknown;
/** ISO instant the subscription ends, or null. */
cancelsAt: string | null;
raw: unknown;
}
Declaration source: packages/farthershore-js/dist/types.d.ts#L1144.
export interface ChangePlanResult__11a914c015a6 {
subscription?: unknown;
checkoutUrl?: string | null;
portalRedirect?: {
url: string;
} | null;
raw: unknown;
}
Declaration source: packages/farthershore-js/dist/config.d.ts#L183.
export interface ClientContext__d9dbf3313290 {
/** Platform Core base URL. LAZY: resolved on read as explicit config >
* injected `window.__FS_CONFIG__` > the production platform default —
* never throws. Reading this property is what performs the lazy window
* read; never read it at module scope or client-construction time. */
readonly coreUrl: string;
/** Portal host identifying the product/env to Core. LAZY — see {@link
* coreUrl}; defaults to `location.host` in the browser, read on access. */
readonly portalHost: string | null;
businessId: string | null;
environmentId: string | null;
organizationId: string | null;
/**
* The organization selection before it is reconciled against subscription
* contexts. Unlike `organizationId`, undefined means no explicit selection;
* null is a durable request for the user's default subscription. Internal
* runtime state used by the React organization provider.
*/
organizationSelection?: string | null;
/** Subscribers notified when the imperative organization scope changes. */
organizationListeners: Set<() => void>;
/** Read-through cache backing `fs.prefetch.*` (see cache.ts). */
readCache: Map<string, ReadCacheEntry__ee67854da2b9>;
gatewayUrl: string | null;
apiKey: string | null;
/** Cached short-lived gateway context token for browser-session feature
* calls. Cleared whenever session/org scope changes. */
gatewayContextToken: {
token: string;
expiresAt: string;
cacheKey: string;
} | null;
/** In-flight context-token mint, keyed by cacheKey — SINGLE-FLIGHT coalescing
* so concurrent feature calls share ONE mint instead of stampeding Core
* (W6.3). Cleared as soon as the mint settles. Internal. */
gatewayContextTokenInflight: {
cacheKey: string;
promise: Promise<GatewayContextToken__447d2a94e34b>;
} | null;
/** Explicit session bearer (for Clerk/advanced integrations), falling back
* to the configured `getToken` provider. Persona sessions are HttpOnly
* cookies and never enter JavaScript. */
sessionToken: string | null;
/** True after a cookie-authenticated Core request succeeds. This lets a
* later 401 trigger managed recovery without treating an anonymous first
* `/me` read as a lapsed session. Contains no credential. */
browserSessionAuthenticated: boolean;
getToken?: TokenProvider__40095f0da8e4;
/** Runtime-installed token provider (e.g. the managed Clerk bridge inside
* `<FartherShoreRoot>`). Wins over `config.getToken`; an explicitly set
* `sessionToken` still wins over both. */
tokenProvider: TokenProvider__40095f0da8e4 | null;
fetch: FetchLike__7d89beec4c77;
/** Resolved automatic-retry policy (defaults applied). */
retry: ResolvedRetryConfig__fe2336bea142;
/** Resolved global interceptors (all optional; default no-ops elsewhere). */
onError?: (err: unknown) => void;
onLimitExceeded?: (err: LimitExceededError__7844c601e6fd) => void;
onUnauthorized?: (err: FartherShoreApiError__ae8b4410fda4) => void;
/** Runtime-installed 401 reaction (the managed auth layer's mid-session
* recovery), wired by `<FsAuthProvider>` via `setOnUnauthorized`. Fires AFTER
* the config-level `onUnauthorized`. Internal. */
onUnauthorizedManaged?: (err: FartherShoreApiError__ae8b4410fda4) => void;
/**
* LATCH: managed auth recovery has already fired for the CURRENT credential.
*
* The interceptor de-dupe is per-ERROR-OBJECT, which only collapses one
* logical failure surfacing through nested transports. A dashboard runs many
* independent reads concurrently, so a single lapsed session produces MANY
* distinct 401 errors — each firing its own recovery, each remounting the
* surface, each triggering a fresh round of reads. That feedback loop was
* measured at ~274 requests in 25s from ONE dashboard (~650/min against
* core's 100/min portal limit): the portal rate-limited itself.
*
* Recovery is a per-SESSION event, not a per-request one. Cleared whenever a
* new credential is installed, so a genuinely re-authed session can recover
* again.
*/
managedRecoveryLatched?: boolean;
/** Last `X-RateLimit-*` snapshot observed on a gateway response (W8.5) — fed
* by `fs.route.getWithMeta`, read by `useRouteRateLimit()`. Null until the first
* gateway call that carried the headers. Internal. */
lastRateLimit: RateLimitSnapshot__934527ed940b | null;
/** Subscribers notified when `lastRateLimit` changes (the `useRouteRateLimit`
* external store). Internal. */
rateLimitListeners: Set<() => void>;
/** A5-amend (T11) — the last LIMIT/throttle deny observed leaving the
* transport, recorded by `fireInterceptors`. ADVISORY: the freshest known
* RECENT deny, not a live poll (the gateway stays authoritative). Read by
* `useLimitStatus()`. Null until the first limit deny is observed. Internal. */
lastLimitDeny: ObservedLimitDeny__ff379deca309 | null;
/** Subscribers notified when `lastLimitDeny` changes (the `useLimitStatus`
* external store). Internal. */
limitDenyListeners: Set<() => void>;
/** Subscribers notified when the read cache is BUSTED (auth change, org
* switch, entitlement mutation) — every mounted `useAsync` refetches.
*
* Clearing the cache alone only stops the NEXT read from being served stale;
* it does not re-run the reads already on screen. Without this notification a
* `setSessionToken` after a 401 leaves every mounted surface showing the
* signed-out result until something happens to remount it. Internal. */
readCacheListeners: Set<() => void>;
/** True when all SDK-owned network/auth paths are served by the local mock
* transport. Internal, read by the managed auth layer. */
mockMode: boolean;
}
Declaration source: packages/farthershore-js/dist/types.d.ts#L945.
export interface ComponentAccessPolicyRow__60d2c40fe86e {
/** A managed component id or a `custom:<slug>` key. */
componentKey: string;
/** Override render-gate permission, or null → component default. */
requiredPermission: string | null;
/** Override deny render (`hide|disable|readOnly|denied`), or null →
* component default. */
gateMode: string | null;
}
Declaration source: packages/farthershore-js/dist/http.d.ts#L3.
export interface CoreRequest__88dbed0693a0 {
method: "GET" | "POST" | "PATCH" | "PUT" | "DELETE";
path: string;
query?: Record<string, string | number | undefined | null>;
body?: unknown;
/** Caller-stable retry identity for durable mutation replay. */
idempotencyKey?: string;
/** "session" attaches the consumer session bearer; "none" is for public
* endpoints (resolve/discover). Defaults to "session". */
auth?: "session" | "none";
/** When `false`, a tolerated `401` on this (authed) read does NOT trigger the
* managed auth-layer recovery (`onUnauthorizedManaged` — the hosted-sign-in
* redirect / persona sign-out). Use for best-effort `/me` reads that already
* swallow a 401 and render a signed-out/unsubscribed surface: re-authing an
* already signed-in user can't clear an authorization 401, so the redirect is
* futile and loops. `onUnauthorized` (config hook) + `onError` still fire.
* Defaults to `true` (a lapsed authed session still bounces to recovery). */
recoverAuth?: boolean;
/** Abort signal — when it fires (e.g. a React hook unmounts or its deps
* change), the in-flight read rejects with {@link FartherShoreAbortError}. */
signal?: AbortSignal;
/**
* Per-request organization scope. `undefined` inherits the client selection;
* `null` deliberately omits the organization header without changing that
* shared selection. Use this for APIs whose documented default-subscription
* read is intentionally independent of the workspace currently shown in the
* rest of the portal.
*/
organizationId?: string | null;
}
Declaration source: packages/farthershore-js/dist/types.d.ts#L375.
export interface CreatedApiKey__eee6ebdc6f61 extends ApiKey__a2eadd893331 {
/** The full key. The platform never returns it again — store it now. */
secret: string;
}
Declaration source: packages/farthershore-js/dist/types.d.ts#L441.
export interface CreateServiceAccountInput__30c268ab08ba {
name: string;
requestedPermissions: NonEmptyPermissionList__ca911cbb6fa0;
scopes?: string[];
usageLimit?: ServiceAccountUsageLimitRequest__f255b800fa4e;
}
Declaration source: packages/farthershore-js/dist/types.d.ts#L604.
export type CreateUsageLimitInput__0aee95b69b13 = UsageLimitSubject__9eba54806aaa & UsageLimitValue__4ae5aa5bc7c5 & UsageLimitCreateMode__f16ef2d50497 & {
quantity: string;
};
Declaration source: packages/farthershore-js/dist/types.d.ts#L282.
export interface DeclaredResource__b4d9315d38c7 {
name: string;
display?: string;
scope: "subscription" | "subject";
subjectType?: string;
/** Per-plan cap for this resource, when a plan declares one (numeric only). */
cap?: number | null;
}
Declaration source: packages/farthershore-js/dist/resources/entitlements.d.ts#L3.
export interface EntitlementSnapshot__78b1daa335cc {
/** True when an ACTIVE subscriber context backed this snapshot. */
hasSubscriber: boolean;
/** Resource limits on the current subscriber's pinned plan. */
resourceLimits: Record<string, number>;
}
Declaration source: packages/farthershore-js/dist/resources/entitlements.d.ts#L16.
export interface EntitlementsResource__eae052f23903 {
/** Read the current subscriber's entitlement maps. Signed-out users get
* empty maps so app code can render disabled/upsell states without a
* separate auth guard. */
snapshot(): Promise<EntitlementSnapshot__78b1daa335cc>;
/** Numeric resource limit, or null when absent. */
resourceLimit(key: string): Promise<number | null>;
/** Per-resource `{ limit, current }` for the pinned plan (`N of M`). The
* LIMIT side lives in the `/me` snapshot, but `current` is a live count, so
* this reads the dedicated `/me/resource-limit-usage` route. Read-through cached
* (the cache owns the fetch lifecycle, like the other `/me` reads — no
* per-caller signal). Signed-out / no subscription → an empty map. */
resourceLimitUsage(): Promise<ResourceLimitUsageMap__cc534f1c9f18>;
}
Declaration source: packages/farthershore-js/dist/types.d.ts#L85.
export interface EnvironmentInfo__866e98cf165d {
id: string;
name: string;
slug: string;
/** Which sign-in flow the portal should drive: Clerk (production) or a
* platform-owned persona browser session (preview/test envs). */
authStrategy: AuthStrategy__ccafca0932db;
/** Env branch name (preview/test envs), or null for production scope. */
branch: string | null;
/** Billing provider mode for the env: "test" (no real money) or "live".
* Null when the resolve was production-scoped (no env block). The plans UI
* surfaces a "Test mode" badge when this is "test". */
stripeMode: string | null;
}
Declaration source: packages/farthershore-js/dist/errors/index.d.ts#L49.
export declare class FartherShoreApiError__ae8b4410fda4 extends FartherShoreError__8dbed6dcc500 {
readonly status: number;
readonly code: string;
readonly body: unknown;
/** Seconds to wait before retrying, parsed from `Retry-After`; null when the
* response carried no `Retry-After`. */
readonly retryAfterSeconds: number | null;
/** The `X-RateLimit-Remaining` / `-Reset` snapshot, or null when absent. */
readonly rateLimit: RateLimitSnapshot__934527ed940b | null;
/**
* Whether the request that produced this error actually carried an auth
* credential (a bearer was attached). Set by the transport AFTER the error is
* minted. A `401` with `authed === false` is a NEVER-authenticated visitor (a
* signed-out `/me` read sent no bearer) — the managed auth layer must treat it
* as a no-op, NOT a lapsed-session redirect. Defaults to `true` so any caller
* that doesn't thread the flag keeps the prior (always-fire) behaviour.
*/
authed: boolean;
/**
* Whether a `401` on this request should trigger the MANAGED auth-layer
* recovery (the hosted-sign-in redirect / persona sign-out). Best-effort `/me`
* reads that already swallow a 401 (and render a signed-out/unsubscribed
* surface) set this `false`: re-authenticating an already signed-in user can
* never clear an authorization 401, so the redirect is futile and loops. Set
* by the transport from `CoreRequest.recoverAuth`. The config-level
* `onUnauthorized` + `onError` hooks STILL fire (observability is unaffected);
* only the managed reaction is gated. Defaults to `true` (always recover).
*/
recoverAuth: boolean;
constructor(status: number, code: string, message: string, body: unknown, retryAfterSeconds?: number | null, rateLimit?: RateLimitSnapshot__934527ed940b | null);
}
Declaration source: packages/farthershore-js/dist/client.d.ts#L36.
export interface FartherShoreClient__e4fe174a542f {
/** The client's resolved runtime context (coreUrl, portalHost, businessId,
* auth/scoping state, …). `coreUrl`/`portalHost` are LAZY getters — reading
* them performs the `window.__FS_CONFIG__`/`location.host` resolution
* (`coreUrl` falls back to the production platform); everything else is a
* live snapshot of the client's current state. Mainly for
* introspection/tests — prefer the typed resources for actual calls. */
readonly context: ClientContext__d9dbf3313290;
/** Resolve + cache the business/env/gateway for the current portal host. Safe
* to call repeatedly (memoized). */
bootstrap(): Promise<Bootstrap__ecb3d46aafde>;
/** Set the consumer API key used for Gateway feature calls. */
setApiKey(key: string | null): void;
/** Set the Core session bearer directly (e.g. from the Clerk browser SDK). */
setSessionToken(token: string | null): void;
/** Install/replace a live token source resolved per request (short-lived
* Clerk JWTs). `<FartherShoreRoot>` wires this automatically in Clerk
* environments; pass null to uninstall. */
setTokenProvider(provider: (() => string | null | Promise<string | null>) | null): void;
/** Rescope subsequent Core calls to an owning org (the multi-org
* subscription-context switcher) — sets the `x-fs-organization-id` header.
* Pass null to return to the user's default subscription. Self-persists the
* choice (restored at the next client creation). */
setOrganizationId(organizationId: string | null): void;
/** The active org id scoping Core calls, or null (the user's default
* subscription). At boot this reflects the persisted choice restored from
* storage; the React org provider seeds its reactive state from it. */
getOrganizationId(): string | null;
/** Imperative organization scope as an external store. This keeps a mounted
* React provider in sync when an application calls `setOrganizationId()`
* directly rather than using the managed org switcher. */
readonly organizationScope?: {
subscribe(listener: () => void): () => void;
};
/** Install/replace the global 401 reaction (fired by the transport on a 401
* for an authed call). `<FartherShoreRoot>` / `<FsAuthProvider>` wire this
* automatically for managed mid-session recovery (persona sign-out / Clerk
* refresh); pass null to uninstall. A config-level `onUnauthorized` still
* fires first. */
setOnUnauthorized(handler: ((err: FartherShoreApiError__ae8b4410fda4) => void) | null): void;
/** Drop every cached Core read (and the short-lived gateway context token), so
* the next `me()` / list call goes to the network. Use after an out-of-band
* state change the SDK can't observe — e.g. polling `me()` for webhook lag to
* settle after returning from a Stripe Checkout (see `reconcileAfterCheckout`). */
invalidate(): void;
/** The last `X-RateLimit-*` snapshot observed on any `fs.route` gateway call,
* with a subscribe primitive — the external store behind `useRouteRateLimit()`
* (W8.5). `get()` is null until the first gateway response carried the
* headers; `subscribe` notifies on every change. */
readonly rateLimit: {
get(): RateLimitSnapshot__934527ed940b | null;
subscribe(listener: () => void): () => void;
};
/** A5-amend (T11) — the last LIMIT/throttle deny observed leaving the
* transport, with a subscribe primitive — the external store behind
* `useLimitStatus()`. ADVISORY (the freshest known RECENT deny, not a live
* poll — the gateway stays authoritative). `get()` is null until the first
* limit deny is observed; `subscribe` notifies on every change. */
readonly limitState: {
get(): ObservedLimitDeny__ff379deca309 | null;
subscribe(listener: () => void): () => void;
};
/** Read-cache invalidation as an external store. `subscribe` fires when a
* change invalidates what is ALREADY on screen: a new session/identity
* (`setSessionToken`, sign-in/sign-out) or a moved entitlement (any billing
* or plan action, and `invalidate()`).
*
* It deliberately does NOT fire on an org switch (org-scoped hooks refetch
* from their own deps) or on an ordinary resource mutation (the hook that
* performed it refetches itself).
*
* Every `useAsync`-backed hook subscribes automatically, so built-in hooks
* and custom ones written against `useAsync` already refetch. Use this
* directly only for state held OUTSIDE a hook (a store, an imperative cache
* of your own) that must be invalidated in step with ours. */
readonly readCache: {
subscribe(listener: () => void): () => void;
};
/** The business this frontend runs for (resolved via bootstrap). */
readonly business: BusinessResource__933d34c2f16a;
/** Consumer session: current identity, server-owned persona logout, and
* short-lived Gateway context-token minting. */
readonly auth: AuthResource__beeda8a7af1a;
/** The consumer's API keys (list / create / revoke / rotate). */
readonly keys: KeysResource__2bf8d8c5e820;
/** Per-dimension usage totals + recent events for this business. */
readonly usage: UsageResource__a3469cda0e70;
/** Subscriber-managed per-actor usage limits. */
readonly usageLimits: UsageLimitsResource__2b1e05e6bcda;
/** The consumer's subscription and Stripe billing portal. */
readonly billing: BillingResource__c8dbd9d25fa3;
/** The business's plan catalog + the subscribe/checkout flow. */
readonly plans: PlansResource__05a484289922;
/** Full subscriber context (`GET /me`): lifecycle, trial, scheduled
* transition, eligibility-scoped plans. Null when signed out / no
* subscriber. */
me(opts?: {
signal?: AbortSignal;
/** `null` omits the organization header without changing the shared
* client selection; `undefined` uses that selection. */
organizationId?: string | null;
}): Promise<SubscriberContext__86c582775b78 | null>;
/** Record legal-document acceptances for the current subscriber/org. */
acceptLegal(acceptances: LegalAcceptance__cc2291cc0442[]): Promise<void>;
/** Multi-org subscription contexts (the org switcher's data). */
readonly organizations: OrganizationsResource__18d4024e64ce;
/** Team management on the current subscription. */
readonly team: TeamResource__b9e413854377;
/** Managed-RBAC management on the current subscription (settings, the
* derived permission catalog, role CRUD) — team-org OWNER/ADMIN only.
* Configures UX + minted-token claims; the EDGE `permission` constraint
* is the security boundary. */
readonly rbac: RbacResource__b63486266173;
/** The subscriber's per-category notification preferences (opt-out model):
* `get` the current state, `update` a partial patch. */
readonly notifications: NotificationsResource__dc7aa1b64a0f;
/** The subscriber-side audit log (cursor-paged). */
readonly auditLogs: AuditLogsResource__99efa1e02380;
/** Current subscriber entitlement maps from the pinned plan version. */
readonly entitlements: EntitlementsResource__eae052f23903;
/** Navigation-intent data warmers — see {@link PrefetchSurface}. */
readonly prefetch: PrefetchSurface__2b22bd2b6c45;
/**
* One-line, zero-config calls to your business's enforced gateway — host,
* auth, surface, and businessId all auto-resolved from the hosted context.
* `fs.route.post("/forecast", { city })`. Limit responses surface as
* `LimitExceededError` so the upgrade prompt works on any call.
*/
readonly route: RouteResource__52eafab15328;
/**
* Typed CRUD over a product-declared, quota-counted resource. Rides the
* gateway (which diverts to core, the system of record); `create` throws
* `LimitExceededError` at the plan cap. `fs.resources("widgets").list()`.
*/
resources<T = unknown>(name: string): ResourcesResource__ef6d17bbf151<T>;
/** Bound named-integration helper: `fs.integration("clerk-admin").fetch(...)`. */
integration(id: string): ManagedIntegration__68b11f8f586e;
/**
* Generic authenticated Core call — the escape hatch for platform endpoints
* the typed resources don't model yet (e.g. a product's `/me/team`,
* `/me/audit-logs`). The Core counterpart to {@link invoke}:
* it attaches the session bearer + the host/env/org scoping headers and maps
* non-2xx to {@link FartherShoreApiError}, exactly like the typed resources —
* the caller only supplies the path and the response type. Prefer a typed
* resource (`fs.usage`, `fs.keys`, …) when one exists.
*/
core<T>(req: CoreRequest__88dbed0693a0): Promise<T>;
}
Declaration source: packages/farthershore-js/dist/errors/index.d.ts#L2.
export declare class FartherShoreError__8dbed6dcc500 extends Error {
constructor(message: string);
}
Declaration source: packages/farthershore-js/dist/errors/index.d.ts#L288.
export declare class FartherShoreRateLimitedError__dbc7e0b60aee extends FartherShoreApiError__ae8b4410fda4 {
/** The semantic {@link FsLimitClass} when this throttle classifies to one
* (`rate` / `concurrency` / `adaptive`), else null. */
readonly limitClass: FsLimitClass__2d5726601b87 | null;
/** The parsed `_fs` deny envelope when present. */
readonly envelope: FsDenyEnvelope__adf7ef9f2448 | null;
/** The recommended client reaction (default `backoff_retry` for a throttle). */
readonly reaction: FsLimitReaction__06a9e09be641;
/** Whether the platform or an upstream provider decided the throttle. */
readonly limitOrigin: FsLimitOrigin__1d4de1805fa7;
/** The gateway decision id, when the `_fs` envelope carried one. */
readonly decisionId: string | null;
constructor(status: number, code: string, message: string, body: unknown, retryAfterSeconds?: number | null, rateLimit?: RateLimitSnapshot__934527ed940b | null);
}
Declaration source: packages/farthershore-js/dist/config.d.ts#L2.
export type FetchLike__7d89beec4c77 = typeof fetch;
Declaration source: packages/farthershore-js/dist/deny-codes.d.ts#L63.
declare const FS_LIMIT_CLASSES__cf69b28be276: readonly ["quota", "rate", "concurrency", "capacity", "spend", "adaptive"];
Declaration source: packages/farthershore-js/dist/errors/index.d.ts#L109.
export interface FsDenyEnvelope__adf7ef9f2448 {
/**
* The semantic class of limit hit — the primary axis clients branch on.
* `null` ONLY when the wire carried a `limitClass` string the SDK's closed
* mirror does NOT know (a FUTURE class added to contracts but not yet shipped
* in this bundle, T13). In that case the raw value is preserved on
* {@link unknownLimitClass} and the whole `_fs` block on {@link raw} so a
* client can still render + introspect the deny, while the SDK refuses to
* invent a known-class facet for it. A KNOWN class is always non-null.
*/
limitClass: FsLimitClass__2d5726601b87 | null;
/**
* T13 — the raw `limitClass` string when it is NOT a member of the closed
* {@link FsLimitClass} mirror (a future/unknown class). Undefined for every
* known class. Lets a forward-compat client surface "a `<unknownLimitClass>`
* limit was hit" + a debug breadcrumb without the SDK guessing semantics.
*/
unknownLimitClass?: string;
/**
* T13 — the raw `_fs` block exactly as it arrived on the wire, preserved for
* debugging/forwarding. Always present (even for a known class) so a developer
* can inspect fields this bundle's typed projection doesn't model yet.
*/
raw?: Record<string, unknown>;
/** The limit's scope when known (e.g. `subscription`, `org`, `route`). */
scope?: string;
/** Actor facet for actor-scoped subscriber limits. Carries kind only; raw
* actor ids must never be present in deny envelopes. */
actorScope?: "member" | "service_account";
/** The metered/resource dimension when known (e.g. `tokens`, `requests`). */
metric?: string;
/** Unix epoch ms when the limit window resets, when known. */
reset?: number;
/** Units remaining in the window at decision time, when known. */
remaining?: number;
/** Units already consumed in the window at decision time, when known. */
used?: number;
/** The cap value (the ceiling that was hit), when known. */
limit?: number;
/** True when retrying the SAME request can succeed (velocity/transient cap). */
retrySafe: boolean;
/** True when the caller must MODIFY the request (reduce size / change plan)
* before it can succeed — the `capacity`/`spend` affordances. */
mustModify: boolean;
/** Provider-supplied reason verbatim, when relayed upstream (an `adaptive`
* throttle). */
providerReason?: string;
/** Whether the platform or an upstream provider decided the limit. */
limitOrigin: FsLimitOrigin__1d4de1805fa7;
/** Human-facing next step for the END USER, when one applies. */
userAction?: string;
/** Human-facing next step for the DEVELOPER/operator, when one applies. */
devAction?: string;
/** The per-attempt request id (correlates with logs/traces). */
requestId?: string;
/** The gateway decision id (correlates with the usage event / audit). */
decisionId?: string;
/** Which exact constraint denied (projects from
* `LimitDecision.blockingConstraintId`); present on a limit deny when known. */
blockingConstraintId?: string;
/** The recommended client reaction. */
reaction: FsLimitReaction__06a9e09be641;
/** Envelope schema version. Bumped on a NON-additive envelope change. */
envelopeVersion?: number;
}
Declaration source: packages/farthershore-js/dist/fetch.d.ts#L3.
export interface FsFetchOptions__62afbd421e0f {
/** HTTP method for the upstream call. Defaults to `GET`. */
method?: string;
/** Browser-controlled headers. The named integration allowlists them. */
headers?: Record<string, string>;
/** Browser-controlled query parameters. The named integration allowlists
* each name; secret injection parameters remain server-owned. */
query?: Record<string, string>;
/** Optional, explicitly typed request body. The named integration's bounded
* body declaration is enforced by the gateway. */
body?: {
kind: "json";
value: unknown;
} | {
kind: "text";
value: string;
};
/** Abort signal — cancels the in-flight secure fetch (and the token mint). */
signal?: AbortSignal;
}
Declaration source: packages/farthershore-js/dist/deny-codes.d.ts#L65.
export type FsLimitClass__2d5726601b87 = (typeof FS_LIMIT_CLASSES__cf69b28be276)[number];
Declaration source: packages/farthershore-js/dist/errors/index.d.ts#L96.
export type FsLimitOrigin__1d4de1805fa7 = "platform" | "provider" | "subscriber";
Declaration source: packages/farthershore-js/dist/errors/index.d.ts#L99.
export type FsLimitReaction__06a9e09be641 = "none" | "backoff_retry" | "wait_then_retry" | "queue" | "reduce_then_retry" | "fallback" | "upgrade";
Declaration source: packages/farthershore-js/dist/types.d.ts#L803.
export interface GatewayContextToken__447d2a94e34b {
/** Short-lived `fsc_` bearer accepted by the Gateway for this subscriber. */
token: string;
/** ISO timestamp when the token expires. */
expiresAt: string;
}
Declaration source: packages/farthershore-js/dist/resources/keys.d.ts#L3.
export interface KeysResource__2bf8d8c5e820 {
/** The consumer's API keys for this product (secrets are never returned). */
list(opts?: {
signal?: AbortSignal;
}): Promise<ApiKey__a2eadd893331[]>;
/**
* Create a key. The returned `secret` is shown ONCE.
*
* Consumer-principal (D2): this generic route creates PERSONAL member keys.
* Managed service credentials use the canonical `serviceAccounts` lifecycle,
* which can return PENDING without creating a secret.
*
* `roleKeys` binds the key to org RBAC roles (live-bound: a role edit reaches
* the key without reprovisioning); `restrictedPermissions` optionally narrows
* the bound roles to a Stripe-style subset. Both are grantable only within
* the creator's own permissions — the backend 403s an over-reaching binding.
* (PERSONAL keys ignore `roleKeys` — their perms track the bound member.)
*/
create(input?: {
label?: string;
scopes?: string[];
roleKeys?: string[];
restrictedPermissions?: string[];
kind?: "PERSONAL";
/** PERSONAL — mint FOR this member (their `Membership.id`); admin-gated. */
memberId?: string;
}): Promise<CreatedApiKey__eee6ebdc6f61>;
/** Permanently revoke a key by id. */
revoke(keyId: string): Promise<void>;
/** Rotate a key — revokes the old and returns a new `secret` (shown once). */
rotate(keyId: string): Promise<CreatedApiKey__eee6ebdc6f61>;
/** Canonical managed service-account provisioning and approval lifecycle. */
readonly serviceAccounts: ServiceAccountsResource__abd2dd8a7d4f;
}
Declaration source: packages/farthershore-js/dist/types.d.ts#L80.
export interface LegalAcceptance__cc2291cc0442 {
kind: string;
version: string;
contentHash: string;
}
Declaration source: packages/farthershore-js/dist/types.d.ts#L76.
export interface LegalConsentStatus__2c5f3ab016cd {
required: boolean;
documents: LegalDocumentStatus__f2d5a2d96393[];
}
Declaration source: packages/farthershore-js/dist/types.d.ts#L60.
export type LegalDocumentAcceptanceMode__6e040b71b235 = "agree" | "acknowledge" | "none";
Declaration source: packages/farthershore-js/dist/types.d.ts#L61.
export interface LegalDocumentReference__0e8dba55b6a6 {
title: string;
url: string;
acceptanceMode: LegalDocumentAcceptanceMode__6e040b71b235;
effectiveDate?: string;
}
Declaration source: packages/farthershore-js/dist/types.d.ts#L67.
export interface LegalDocumentStatus__f2d5a2d96393 extends LegalDocumentReference__0e8dba55b6a6 {
kind: string;
version: string;
contentHash: string;
consentLabel?: string;
changeNote?: string;
accepted: boolean;
acceptedAt?: string;
}
Declaration source: packages/farthershore-js/dist/errors/index.d.ts#L85.
export interface LimitDescriptor__01693492a147 {
/** Stable identifier for the limit that was hit, e.g. `resource:widgets`. */
limitCode: string;
/** The metered/resource dimension, when known (e.g. `widgets`, `requests`). */
dimension: string | null;
/** The cap the subscriber is at, when known. */
currentCapacity: number | null;
}
Declaration source: packages/farthershore-js/dist/errors/index.d.ts#L206.
export declare class LimitExceededError__7844c601e6fd extends FartherShoreApiError__ae8b4410fda4 {
readonly limitCode: string;
readonly dimension: string | null;
readonly currentCapacity: number | null;
/** The semantic {@link FsLimitClass} of this limit — derived from the `_fs`
* envelope when present, else from the wire code + limitCode + status
* ({@link classifyFsLimit}). null only when nothing classifies it. */
readonly limitClass: FsLimitClass__2d5726601b87 | null;
/** The parsed `_fs` deny envelope, when the body carried one. The richer
* source for the reaction/headroom fields below. */
readonly envelope: FsDenyEnvelope__adf7ef9f2448 | null;
/** True when retrying the SAME request can succeed (a velocity/transient cap);
* false when it never will (a spend cap / oversized request). */
readonly retrySafe: boolean;
/** True when the caller must MODIFY the request before it can succeed (a
* `capacity` ceiling or `spend` cap). */
readonly mustModify: boolean;
/** The recommended client reaction. */
readonly reaction: FsLimitReaction__06a9e09be641;
/** Whether the platform or an upstream provider decided the limit. */
readonly limitOrigin: FsLimitOrigin__1d4de1805fa7;
/** The gateway decision id (correlates with the usage event / audit), when
* the `_fs` envelope carried one. */
readonly decisionId: string | null;
/** When the limit window resets, when known (from the `_fs` envelope `reset`,
* unix-epoch ms, else the `X-RateLimit-Reset` snapshot). */
readonly reset: Date | null;
/** Units remaining in the window at decision time, when known. */
readonly remaining: number | null;
/** Units already consumed in the window at decision time, when known. */
readonly used: number | null;
/** The cap value hit, when known. */
readonly limit: number | null;
constructor(status: number, code: string, message: string, body: unknown, descriptor: LimitDescriptor__01693492a147, retryAfterSeconds?: number | null, rateLimit?: RateLimitSnapshot__934527ed940b | null);
}
Declaration source: packages/farthershore-js/dist/integrations.d.ts#L6.
export type ManagedIntegration__68b11f8f586e = {
fetch(path: string, init?: ManagedIntegrationRequestInit__57e8453840f3): Promise<Response>;
/**
* Fetch-compatible adapter for native SDKs that accept a custom transport.
* Pair it with {@link url}; it converts the SDK's ordinary Request into the
* bounded named-integration envelope without exposing the injected secret.
*/
transport(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
/** Same-origin reserved base URL for native SDKs. It must be paired with this
* handle's `transport`; a raw browser fetch to the URL is not authorized. */
url(path?: string): string;
};
Declaration source: packages/farthershore-js/dist/integrations.d.ts#L3.
export type ManagedIntegrationRequestInit__57e8453840f3 = FsFetchOptions__62afbd421e0f;
Declaration source: packages/farthershore-js/dist/types.d.ts#L15.
export interface Meter__c4ca128fcf40 {
/** Stable dimension key (e.g. "requests", "tokens"). */
key: string;
/** Human-friendly label for the dimension. */
display: string;
/** Optional unit suffix (e.g. "ms", "tokens"). */
unit?: string;
}
Declaration source: packages/farthershore-js/dist/types.d.ts#L1179.
export type NanosAmount__f9c1e22d3cbe = string | null;
Declaration source: packages/farthershore-js/dist/types.d.ts#L440.
export type NonEmptyPermissionList__ca911cbb6fa0 = [string, ...string[]];
Declaration source: packages/farthershore-js/dist/types.d.ts#L1164.
export interface NotificationPreferences__f7f3c3495466 {
master: boolean;
categories: Record<string, boolean>;
}
Declaration source: packages/farthershore-js/dist/types.d.ts#L1170.
export interface NotificationPreferencesPatch__73fed684877b {
master?: boolean;
categories?: Record<string, boolean>;
}
Declaration source: packages/farthershore-js/dist/resources/account.d.ts#L169.
export interface NotificationsResource__dc7aa1b64a0f {
/** The current preference state. Missing `master`/`categories` in a partial
* wire response are normalized to the opted-in defaults. */
preferences(opts?: {
signal?: AbortSignal;
}): Promise<NotificationPreferences__f7f3c3495466>;
/** Partial patch — send ONLY the changed channels/categories. Returns the
* full, normalized updated state. */
updatePreferences(patch: NotificationPreferencesPatch__73fed684877b): Promise<NotificationPreferences__f7f3c3495466>;
}
Declaration source: packages/farthershore-js/dist/errors/index.d.ts#L580.
export interface ObservedLimitDeny__ff379deca309 {
/** The semantic class, or null for an UNKNOWN/future class (T13). */
limitClass: FsLimitClass__2d5726601b87 | null;
/** The raw `limitClass` string when it is outside the closed mirror (T13). */
unknownLimitClass?: string;
/** The recommended client reaction. */
reaction: FsLimitReaction__06a9e09be641;
/** Whether the platform or an upstream provider decided the deny. */
limitOrigin: FsLimitOrigin__1d4de1805fa7;
/** The provider-supplied reason verbatim, when this relayed an upstream
* throttle (an adaptive deny). */
providerReason: string | null;
/** When the limit window resets, when known. */
reset: Date | null;
/** Units remaining in the window at decision time, when known. */
remaining: number | null;
/** The cap value hit, when known. */
limit: number | null;
/** The HTTP status of the deny. */
status: number;
/** The wire `code` of the deny. */
code: string;
/** The gateway decision id, when known. */
decisionId: string | null;
/** Wall-clock instant (epoch ms) the deny was observed — drives staleness. */
observedAt: number;
}
Declaration source: packages/farthershore-js/dist/types.d.ts#L535.
export interface OffsetPage__af8a84ff58be<T> {
data: T[];
pagination: {
limit: number;
offset: number;
hasMore: boolean;
};
}
Declaration source: packages/farthershore-js/dist/types.d.ts#L1104.
export interface OnboardingResult__d5ee678fcfed {
checkoutUrl?: string | null;
subscriber?: unknown;
/** One-time full key secret when Core auto-creates the first key. */
autoApiKey?: string | {
secret?: string;
} | null;
/** Set when the first-key mint failed AFTER the subscriber became active —
* surfaced (not swallowed) so the client can tell the user. */
autoApiKeyError?: AutoApiKeyError__bd378e9396dc | null;
raw: unknown;
}
Declaration source: packages/farthershore-js/dist/types.d.ts#L1215.
export type OpaqueAllowanceDisplay__09b08c9319dc = {
kind: "multiplier";
/** Authored allowance in display units (e.g. 5 for a "5x" plan). */
allowanceUnits: number;
/** Remaining allowance in display units, 2 decimals, as a string. */
remainingUnits: string;
/** Consumed allowance in display units, 2 decimals, as a string. */
consumedUnits: string;
} | {
kind: "fraction";
/** Consumed share of the allowance in basis points (0..10000). */
consumedBasisPoints: number;
/** Remaining share of the allowance in basis points (0..10000). */
remainingBasisPoints: number;
};
Declaration source: packages/farthershore-js/dist/types.d.ts#L1277.
export interface OpaqueBillPreview__249f4b617b5a {
currency: string;
disclosure: "opaque";
/** The plan's recurring fee, in cents. */
recurringFeeCents: number;
allowances: OpaqueBillPreviewAllowance__c67c601b6f42[];
}
Declaration source: packages/farthershore-js/dist/types.d.ts#L1232.
export interface OpaqueBillPreviewAllowance__c67c601b6f42 {
kind: string;
/** Bucket lifecycle state — Core's `BucketState`, verbatim. */
state: BucketState__c796139d57fe;
expiresAt: string | null;
display: OpaqueAllowanceDisplay__09b08c9319dc;
}
Declaration source: packages/farthershore-js/dist/resources/account.d.ts#L3.
export interface OrganizationsResource__18d4024e64ce {
/** The orgs through which the current user holds subscriptions to this
* product (B2B multi-org). Degrades to the empty shape on any error —
* exactly how the SSR portal treated it. Set `strict` only when a caller
* needs to render the read failure distinctly from a valid empty result. */
contexts(opts?: {
signal?: AbortSignal;
strict?: boolean;
}): Promise<SubscriptionContextsResult__fe44e57e7d49>;
}
Declaration source: packages/farthershore-js/dist/types.d.ts#L521.
export interface PendingServiceAccountApproval__5aaaeb81c691 {
id: string;
operation: ServiceAccountApprovalOperation__d422a57b0b16;
serviceAccountId: string;
requestedBy: string;
requestedPermissions: string[];
excessPermissions: string[];
createdAt: string;
serviceAccount: {
name: string;
/** Frozen grants that stay active for a pending UPDATE. */
grantedPermissions: string[];
};
}
Declaration source: packages/farthershore-js/dist/types.d.ts#L455.
export interface PendingServiceAccountCreateResponse__75eae3a7015a {
status: "PENDING";
serviceAccountId: string;
approvalId: string;
requestedPermissions: string[];
/** A pending create has no live credential or frozen authority. */
grantedPermissions: [];
excessPermissions: string[];
eligibleApproverIds: string[];
}
Declaration source: packages/farthershore-js/dist/types.d.ts#L476.
export interface PendingServiceAccountUpdateResponse__97b4460d1924 {
status: "PENDING";
serviceAccountId: string;
approvalId: string;
/** Frozen grants that remain active while approval is pending. */
activePermissions: string[];
requestedPermissions: string[];
excessPermissions: string[];
eligibleApproverIds: string[];
}
Declaration source: packages/farthershore-js/dist/types.d.ts#L334.
export interface PersonaAuthSession__da61c3cf64e7 {
kind: "test-persona";
personaId: string;
userId: string;
organizationId: string | null;
displayName: string | null;
expiresAt: string;
}
Declaration source: packages/farthershore-js/dist/types.d.ts#L127.
export interface Plan__3a8348415fe9 {
/** Immutable `CompiledPlan.id` — the pointer passed to `subscribe()`. */
id: string;
key: string;
name: string;
description: string | null;
/**
* The builder's DECLARED plan kind. `"free"` is the free tier — a FLOOR,
* not an option: subscribers are auto-enrolled on it at sign-up and fall
* back to it when a paid plan is cancelled, so `<PlansTable>` and every
* other plan-card surface hides it rather than offering it as a choice.
* Read this field — do NOT infer it from a zero recurring fee, which is
* also true of `usage` plans that bill usage.
*/
kind: PlanKind__5f6d46ef299c;
/** Recurring fee, in cents (0 for free / usage plans). */
recurringFeeCents: number;
/** Billing cadence for the recurring fee + metered usage — `"month"`
* (default) or `"year"` (annual). Lets a pricing card render "$X/yr" vs
* "$X/mo" and badge annual tiers. Defaults to `"month"` when the wire DTO
* omits it (the platform omits the key for monthly plans). */
billingInterval: "month" | "year";
/** ISO 4217 currency of every money field on the plan. REQUIRED in the
* normalized model — defaults to `"USD"` when the wire DTO omits it (the
* USD-only platform omits the key today). */
currency: string;
/** Free-trial length in days (0 = no trial). */
trialDays: number;
/** Optional monthly spend cap, in cents. */
maxMonthlySpendCents: number | null;
/** Optional minimum monthly spend floor, in cents. */
minMonthlySpendCents: number | null;
/** Structural metered dimensions (no money). Empty for non-metered plans. */
meters: PlanMeter__be60c6450f51[];
/** Quota + rate-limit rules. Month-window rules are the included allowances. */
limits: PlanLimit__8541d3e44c07[];
/** Optional builder-authored feature bullets shown on the plan card. */
planDetails: string[];
/** Control-plane resource limits — `key → maxCount` caps (webhooks: 5)
* such as api_keys or webhooks. Empty when the
* plan declares none. */
resourceLimits: Record<string, number>;
/**
* The plan's PUBLIC catalog terms for metered usage — the price list a buyer
* needs to compare plans, projected by Core from the served commercial
* release. `null` when the plan binds no catalog, when the served release
* carries no matching pricing policy, or when the builder declared
* `fs.disclosure.opaque`; card surfaces fall back to "priced per the
* catalog" and a docs pointer in that case.
*
* This is the only place on the SDK's plan model where per-unit money lives,
* and it is NOT an exception to the rule the rest of this module states: a
* pricing catalog is a PUBLISHED commerce term the builder authored for
* everyone, whereas a subscriber's rated usage, funding draw-down and
* projected bill remain exclusive to Core's bill preview. The SDK still
* derives NO money: it renders these rates, it never multiplies them by a
* usage count.
*/
pricingDisplay: PlanPricingDisplay__072fcb7dc8b6 | null;
}
Declaration source: packages/farthershore-js/dist/types.d.ts#L232.
export interface PlanFunding__89a4bc119cad {
kind: "included" | "promo" | "referral" | "prepaid";
/** Face value in minor units of {@link PlanPricingDisplay.currency}. */
amountMinor: number;
/** Whether the bucket refreshes each billing period. */
recurs: boolean;
/** The builder's authored marketing framing: the bucket is `factor`x of a
* `baseMinor` base. The base is `amountMinor / factor` by construction, so
* the label cannot misstate the allowance. */
display: {
kind: "multiplier";
factor: number;
baseMinor: number;
} | null;
}
Declaration source: packages/farthershore-js/dist/types.d.ts#L108.
export type PlanKind__5f6d46ef299c = PlanKindWire__a95f9171680c;
Declaration source: packages/farthershore-js/dist/generated/catalog-types.d.ts#L25.
export type PlanKindWire__a95f9171680c = "free" | "flat" | "usage" | "prepaid" | "hybrid" | "trial" | "custom";
Declaration source: packages/farthershore-js/dist/types.d.ts#L111.
export interface PlanLimit__8541d3e44c07 {
dimension: string;
window: {
type: "named";
name: string;
} | {
type: "custom";
seconds: number;
};
capacity: number;
enforcement?: "enforce" | "track";
}
Declaration source: packages/farthershore-js/dist/types.d.ts#L103.
export type PlanMeter__be60c6450f51 = PlanMeterWire__47c3d2492e8a;
Declaration source: packages/farthershore-js/dist/generated/catalog-types.d.ts#L17.
export interface PlanMeterWire__47c3d2492e8a {
dimension: string;
/** Aggregation formula (`linear` sum | `active_count` gauge |
* `event_count` per-event). OPTIONAL — absent means `linear`. */
kind?: "linear" | "active_count" | "event_count";
}
Declaration source: packages/farthershore-js/dist/resources/plans.d.ts#L31.
export interface PlanOffer__5ab47cb32b7d {
/** The immutable CompiledPlan version id (equals `plan.id`). */
compiledPlanId: string;
/** The plan, in the same wire shape as `list()` / the portal catalog. */
plan: Plan__3a8348415fe9;
/** The billing fingerprint of THIS plan version's economic content. Pass it
* to `subscribe()` / `startOnboarding()` as `offerFingerprint` to get a
* 409 PLAN_OFFER_CHANGED instead of a silent price change. */
offerFingerprint: string;
}
Declaration source: packages/farthershore-js/dist/types.d.ts#L248.
export interface PlanPricingDisplay__072fcb7dc8b6 {
/** The pricing policy key the plan's `usagePricing` binds. */
pricingPolicyKey: string;
/** Meter the policy rates. */
meterKey: string;
/** ISO 4217 currency of every amount below. */
currency: string;
/** How the plan binds the catalog. `fixed_version` plans pin `version`. */
binding: {
kind: "current" | "current_with_contract_terms" | "fixed_version";
version: number | null;
};
/** Rates in deterministic precedence order, most specific first. */
rules: PricingRule__391263f593d3[];
/** Funding buckets declared on the plan, in authored order. */
funding: PlanFunding__89a4bc119cad[];
/** What happens when funding runs out: `block` stops requests, `overage`
* keeps serving at the catalog, `prepaid` is the wallet shape. */
exhaustion: "block" | "overage" | "prepaid" | null;
}
Declaration source: packages/farthershore-js/dist/resources/plans.d.ts#L61.
export interface PlansResource__05a484289922 {
/** The product's available plans (resolved via bootstrap). Empty when the
* product has no published, self-serve plans. */
list(): Promise<Plan__3a8348415fe9[]>;
/** The currently-purchasable plan versions for the signed-in subscriber
* (including their pinned plan version), each with the `offerFingerprint`
* to echo back at `subscribe()` for price-change consent. Unlike `list()`,
* this is a live core read (not bootstrap-cached). */
getPlanOffers(): Promise<PlanOffer__5ab47cb32b7d[]>;
/** Start checkout for a plan. Paid → `{ url }` (navigate to Stripe). Free →
* `{ subscriber }` (activated directly). Pass `offerFingerprint` (from
* `getPlanOffers()`) to fail 409 PLAN_OFFER_CHANGED on a stale price. */
subscribe(input: SubscribeInput__62c7cb21d77a): Promise<SubscribeResult__4b2d9557cede>;
/** The dashboard onboarding path (`POST /onboarding`) the SSR portal's
* onboarding view uses. Differs from `subscribe()`: paid plans return
* `checkoutUrl` (not `url`), and free activations may include a one-time
* `autoApiKey` (drives the auto-created-key banner). */
startOnboarding(input?: StartOnboardingInput__af7cf0dea526): Promise<OnboardingResult__d5ee678fcfed>;
}
Declaration source: packages/farthershore-js/dist/client.d.ts#L24.
export interface PrefetchSurface__2b22bd2b6c45 {
/** Warm the host→business resolve (joins the memoized bootstrap). */
boot(): void;
/** Warm `GET /me` (subscriber context) for dashboard/account surfaces. */
me(): void;
/** Warm the default usage snapshot (what `<UsageCard>`/the usage page read). */
usage(): void;
/** Warm the API-key list. */
apiKeys(): void;
/** Warm the subscription read (billing surfaces). */
subscription(): void;
}
Declaration source: packages/farthershore-js/dist/types.d.ts#L190.
export interface PricingAmount__4680e23fbfac {
num: string;
den: string;
/** `num / den` long-divided; exact where the expansion terminates. */
decimal: string;
/** True when `decimal` was truncated because the rational does not terminate. */
rounded: boolean;
}
Declaration source: packages/farthershore-js/dist/types.d.ts#L206.
export type PricingRule__391263f593d3 = {
/** Stable catalog-entry key — the builder's semantic rule id. */
key: string;
/** Measure this rule prices (`pages`, `tokens`). There is no per-measure
* display name anywhere in the commerce manifest, so the unit label a card
* shows is derived from this key. */
measurementKey: string;
/** Catalog-item namespace, when the rule is provider/model scoped. */
item: {
provider: string;
model: string;
modality?: string;
} | null;
/** Dimension conditions that select this rule (`mode = ocr`). */
where: Array<{
dimensionKey: string;
value: string;
}>;
} & ({
kind: "perUnit";
amount: PricingAmount__4680e23fbfac;
} | {
kind: "graduated" | "volume";
tiers: PricingTier__f5519de88c98[];
});
Declaration source: packages/farthershore-js/dist/types.d.ts#L200.
export interface PricingTier__f5519de88c98 {
upTo: string | null;
amount: PricingAmount__4680e23fbfac;
}
Declaration source: packages/farthershore-js/dist/types.d.ts#L812.
export type PromoCodeKind__c6690a5a680c = "percent_off" | "amount_off" | "free_months" | (string & {});
Declaration source: packages/farthershore-js/dist/errors/index.d.ts#L8.
export interface RateLimitSnapshot__934527ed940b {
/** Requests left in the current window, or null when the header is absent. */
remaining: number | null;
/** When the window resets, or null when the header is absent. The
* `X-RateLimit-Reset` value is unix-epoch SECONDS. */
resetAt: Date | null;
}
Declaration source: packages/farthershore-js/dist/types.d.ts#L1053.
export interface RbacCatalogEntry__70378d25cd96 {
subject: string;
/** Optional display title for the subject. */
title?: string;
permissions: string[];
}
Declaration source: packages/farthershore-js/dist/resources/account.d.ts#L65.
export interface RbacResource__b63486266173 {
settings: {
/** Current org settings: `{ enabled, defaultRoleKey? }`. */
get(opts?: {
signal?: AbortSignal;
}): Promise<RbacSettings__15be951cf2e7>;
/** Full-document replace. `enabled: true` seeds the editable
* Admin/Editor/Viewer templates (idempotent); omitted/null
* `defaultRoleKey` clears the default. */
update(input: {
enabled: boolean;
defaultRoleKey?: string | null;
}): Promise<RbacSettings__15be951cf2e7>;
};
/** The DERIVED grantable-permission catalog (never authored) — grouped by
* route operation, in the `<route-id>:read|write` grammar. */
catalog(opts?: {
signal?: AbortSignal;
}): Promise<RbacCatalogEntry__70378d25cd96[]>;
roles: {
/** The org's role list (seeded templates + custom), sorted by key. */
list(opts?: {
signal?: AbortSignal;
}): Promise<RbacRole__8a7d3e5f7c64[]>;
/** Create a custom role. Permissions are validated against the catalog
* (400 `UNKNOWN_PERMISSION` naming offenders; `"*"` always grantable). */
create(input: {
roleKey: string;
name: string;
permissions: string[];
}): Promise<RbacRole__8a7d3e5f7c64>;
/** Rename and/or re-permission a role. */
update(roleKey: string, input: {
name?: string;
permissions?: string[];
}): Promise<RbacRole__8a7d3e5f7c64>;
/** Delete a role. Member assignments referencing it are left in place
* (resolution ignores stale keys); a matching `defaultRoleKey` is
* cleared server-side. */
remove(roleKey: string): Promise<void>;
};
/**
* Permissions Kernel Wave 6 — per-subscriber component gate policies. An
* org admin (team:manage_rbac) upserts one override row per component key;
* `requiredPermission: null` clears the permission override back to the
* component's default. Throws the typed `FartherShoreApiError` — a 409
* `GOVERNED_BY_CHANGE_SET` means change control governs these rows.
*/
componentPolicies: {
/** Upsert the override row for one component key
* (PUT /me/component-policies). */
update(input: {
componentKey: string;
requiredPermission: string | null;
gateMode: string;
}): Promise<ComponentAccessPolicyRow__60d2c40fe86e>;
};
/**
* Track T3 — Notion-minimal access requests. Any member files a request for a
* permission; owners/admins review the queue and approve (AUTO-GRANTS the
* permission onto the requester's direct grants) or deny.
*/
accessRequests: {
/** File a request for a permission. Idempotent on an open PENDING row for
* the same (requester, permission). Any authenticated member. */
create(input: {
permission: string;
note?: string;
}): Promise<AccessRequest__e4d3f89daefa>;
/** The request queue (OWNER/ADMIN): pending first, then resolved. */
list(opts?: {
signal?: AbortSignal;
}): Promise<AccessRequest__e4d3f89daefa[]>;
/** Approve (grants the permission) or deny a pending request. */
resolve(requestId: string, action: "approve" | "deny"): Promise<AccessRequest__e4d3f89daefa>;
};
}
Declaration source: packages/farthershore-js/dist/types.d.ts#L1035.
export interface RbacRole__8a7d3e5f7c64 {
roleKey: string;
name: string;
/** Permission strings in the `<subject>:read|write` grammar, or `"*"`. */
permissions: string[];
/** "ACCOUNT" rows are the membership-tier enforcement source: their
* permissions are editable but their identity is fixed — no rename,
* delete, default assignment, or credential binding. Absent ⇒ "CUSTOM". */
kind?: "CUSTOM" | "ACCOUNT";
/** ACCOUNT rows only: the full subscriber vocabulary — the editable
* option set (restoring a removed verb needs the catalog, not just the
* row's current grants). */
vocabulary?: string[];
createdAt?: string;
}
Declaration source: packages/farthershore-js/dist/types.d.ts#L1023.
export interface RbacRoleSummary__2161df852611 {
roleKey: string;
name: string;
}
Declaration source: packages/farthershore-js/dist/types.d.ts#L1028.
export interface RbacSettings__15be951cf2e7 {
/** Whether role permissions are enforced for this org's user tokens. */
enabled: boolean;
/** Role auto-assigned to members with no explicit assignment. */
defaultRoleKey?: string;
}
Declaration source: packages/farthershore-js/dist/cache.d.ts#L2.
export interface ReadCacheEntry__ee67854da2b9 {
at: number;
promise: Promise<unknown>;
}
Declaration source: packages/farthershore-js/dist/config.d.ts#L29.
export interface ResolvedRetryConfig__fe2336bea142 {
maxAttempts: number;
retryOn: (err: unknown) => boolean;
respectRetryAfter: boolean;
sleep: (ms: number) => Promise<void>;
}
Declaration source: packages/farthershore-js/dist/resources/entitlements.d.ts#L10.
export interface ResourceLimitUsage__a2c3c3e2955a {
limit: number;
current: number;
}
Declaration source: packages/farthershore-js/dist/resources/entitlements.d.ts#L15.
export type ResourceLimitUsageMap__cc534f1c9f18 = Record<string, ResourceLimitUsage__a2c3c3e2955a>;
Declaration source: packages/farthershore-js/dist/resources/resources.d.ts#L10.
export interface ResourceRecord__87f0c814eb51<TPayload = unknown> {
id: string;
resource: string;
payload: TPayload;
createdAt: string;
updatedAt: string;
}
Declaration source: packages/farthershore-js/dist/resources/resources.d.ts#L6.
export type ResourceRequestInit__06eb38c7f26b = RouteRequestInit__7377dee5c3ef & {
subjectId?: string;
};
Declaration source: packages/farthershore-js/dist/resources/resources.d.ts#L25.
export interface ResourcesResource__ef6d17bbf151<TPayload = unknown> {
/** List this subscriber's records of the resource. */
list(init?: ResourceRequestInit__06eb38c7f26b): Promise<ResourceRecord__87f0c814eb51<TPayload>[]>;
/** Fetch one record by id. */
get(id: string, init?: ResourceRequestInit__06eb38c7f26b): Promise<ResourceRecord__87f0c814eb51<TPayload>>;
/** Create a record. Throws `LimitExceededError` (402) at the plan cap. */
create(payload: TPayload, init?: ResourceRequestInit__06eb38c7f26b): Promise<ResourceRecord__87f0c814eb51<TPayload>>;
/** Replace a record's payload. */
update(id: string, payload: TPayload, init?: ResourceRequestInit__06eb38c7f26b): Promise<ResourceRecord__87f0c814eb51<TPayload>>;
/** Delete a record (frees one unit of the quota). */
delete(id: string, init?: ResourceRequestInit__06eb38c7f26b): Promise<void>;
/** Authoritative `{ count, cap }` for this resource on the caller's
* subscription (W5.2). Reads core (the system of record), so it works for
* backend-managed resources the SDK can't `list()`. Signed-out / no
* subscription → `{ count: 0, cap: null }`. */
count(init?: {
signal?: AbortSignal;
subjectId?: string;
}): Promise<ResourceUsage__40697d865d06>;
}
Declaration source: packages/farthershore-js/dist/resources/resources.d.ts#L21.
export interface ResourceUsage__40697d865d06 {
count: number;
cap: number | null;
}
Declaration source: packages/farthershore-js/dist/types.d.ts#L1134.
export interface RestoreSubscriptionResult__60ac2939c09d {
subscription?: unknown;
/** The platform's post-restore reading. `false` is the success signal; the
* field is `null` only when Core's response carried no subscription state
* to read it from — never guessed. */
cancelAtPeriodEnd: boolean | null;
raw: unknown;
}
Declaration source: packages/farthershore-js/dist/resources/route.d.ts#L2.
export type RouteRequestInit__7377dee5c3ef = RequestInit & {
apiKey?: string;
};
Declaration source: packages/farthershore-js/dist/resources/route.d.ts#L15.
export interface RouteResource__52eafab15328 {
/** Raw gateway call — returns the `Response` for any content type. */
fetch(path: string, init?: RouteRequestInit__7377dee5c3ef): Promise<Response>;
/** `GET path` → parsed JSON. */
get<T = unknown>(path: string, init?: RouteRequestInit__7377dee5c3ef): Promise<T>;
/** `GET path` → parsed JSON PLUS the `X-RateLimit-*` snapshot read off the
* live response before it's discarded (W8.5). Also publishes the snapshot to
* `useRouteRateLimit()`. */
getWithMeta<T = unknown>(path: string, init?: RouteRequestInit__7377dee5c3ef): Promise<RouteResponseMeta__0abf9098561d<T>>;
/** `POST path` with a JSON body → parsed JSON. */
post<T = unknown>(path: string, body?: unknown, init?: RouteRequestInit__7377dee5c3ef): Promise<T>;
/** `PUT path` with a JSON body → parsed JSON. */
put<T = unknown>(path: string, body?: unknown, init?: RouteRequestInit__7377dee5c3ef): Promise<T>;
/** `PATCH path` with a JSON body → parsed JSON. */
patch<T = unknown>(path: string, body?: unknown, init?: RouteRequestInit__7377dee5c3ef): Promise<T>;
/** `DELETE path` → parsed JSON (or undefined on 204). */
delete<T = void>(path: string, init?: RouteRequestInit__7377dee5c3ef): Promise<T>;
}
Declaration source: packages/farthershore-js/dist/resources/route.d.ts#L8.
export interface RouteResponseMeta__0abf9098561d<T> {
data: T;
rateLimit: {
remaining: number | null;
resetAt: Date | null;
};
}
Declaration source: packages/farthershore-js/dist/types.d.ts#L425.
export interface ServiceAccount__75f27de661cf {
id: string;
name: string;
state: ServiceAccountProvisioningState__9ac900abd622;
requestedPermissions: string[];
grantedPermissions: string[];
createdBy: string | null;
approvedBy: string | null;
createdAt: string;
activatedAt: string | null;
revokedAt: string | null;
usageLimits?: ServiceAccountUsageLimitRequest__f255b800fa4e[];
credentialApprovals: ServiceAccountApprovalSummary__7bb90b20ec66[];
}
Declaration source: packages/farthershore-js/dist/types.d.ts#L382.
export type ServiceAccountApprovalOperation__d422a57b0b16 = "CREATE" | "UPDATE";
Declaration source: packages/farthershore-js/dist/types.d.ts#L508.
export type ServiceAccountApprovalResponse__03a1e6be31e0 = ApprovedServiceAccountCreateResponse__b73a29c4cc94 | ApprovedServiceAccountUpdateResponse__e4e8de0be760;
Declaration source: packages/farthershore-js/dist/resources/keys.d.ts#L37.
export interface ServiceAccountApprovalsResource__52f0cefb9602 {
/** Approval requests this signed-in member is currently eligible to decide. */
list(opts?: {
signal?: AbortSignal;
limit?: number;
offset?: number;
}): Promise<OffsetPage__af8a84ff58be<PendingServiceAccountApproval__5aaaeb81c691>>;
/** Approve the complete request or an explicitly trimmed subset. */
approve(approvalId: string, input?: ApproveServiceAccountInput__db09091445e7): Promise<ServiceAccountApprovalResponse__03a1e6be31e0>;
/** Deny a pending request without minting or widening any credential. */
deny(approvalId: string): Promise<ServiceAccountDenyResponse__93ffa89effd0>;
}
Declaration source: packages/farthershore-js/dist/types.d.ts#L383.
export interface ServiceAccountApprovalSummary__7bb90b20ec66 {
id: string;
operation: ServiceAccountApprovalOperation__d422a57b0b16;
requestedBy: string;
requestedPermissions: string[];
excessPermissions: string[];
createdAt: string;
}
Declaration source: packages/farthershore-js/dist/types.d.ts#L475.
export type ServiceAccountCreateResponse__081d15d10c13 = ActiveServiceAccountCreateResponse__b15fda647836 | PendingServiceAccountCreateResponse__75eae3a7015a;
Declaration source: packages/farthershore-js/dist/types.d.ts#L518.
export interface ServiceAccountDenyResponse__93ffa89effd0 {
status: "DENIED";
}
Declaration source: packages/farthershore-js/dist/resources/keys.d.ts#L49.
export interface ServiceAccountMutationOptions__2dee3eb4c17c {
/** Reuse this value to replay the same pending create/update request safely. */
idempotencyKey?: string;
}
Declaration source: packages/farthershore-js/dist/types.d.ts#L380.
export type ServiceAccountProvisioningState__9ac900abd622 = "PENDING" | "ACTIVE";
Declaration source: packages/farthershore-js/dist/types.d.ts#L509.
export interface ServiceAccountRotationResponse__e5e68769c407 {
status: "ACTIVE";
serviceAccountId: string;
revokedKeyId: string;
apiKeyId: string;
/** One-time replacement secret. */
plaintext: string;
grantedPermissions: string[];
}
Declaration source: packages/farthershore-js/dist/resources/keys.d.ts#L53.
export interface ServiceAccountsResource__abd2dd8a7d4f {
/** List managed accounts, including PENDING rows with no credential material. */
list(opts?: {
signal?: AbortSignal;
limit?: number;
offset?: number;
}): Promise<OffsetPage__af8a84ff58be<ServiceAccount__75f27de661cf>>;
/** Create immediately when covered, otherwise return a strict PENDING response. */
create(input: CreateServiceAccountInput__30c268ab08ba, options?: ServiceAccountMutationOptions__2dee3eb4c17c): Promise<ServiceAccountCreateResponse__081d15d10c13>;
/** Replace the frozen grant snapshot or create a pending UPDATE request. */
update(serviceAccountId: string, input: UpdateServiceAccountInput__88886ec5643e, options?: ServiceAccountMutationOptions__2dee3eb4c17c): Promise<ServiceAccountUpdateResponse__e6029a12392c>;
/** Rotate the account credential and return the replacement secret once. */
rotate(serviceAccountId: string): Promise<ServiceAccountRotationResponse__e5e68769c407>;
/** Revoke the account and every active credential attached to it. */
revoke(serviceAccountId: string): Promise<void>;
readonly approvals: ServiceAccountApprovalsResource__52f0cefb9602;
}
Declaration source: packages/farthershore-js/dist/types.d.ts#L492.
export type ServiceAccountUpdateResponse__e6029a12392c = ActiveServiceAccountUpdateResponse__fe5e8ed2381b | PendingServiceAccountUpdateResponse__97b4460d1924;
Declaration source: packages/farthershore-js/dist/types.d.ts#L399.
export type ServiceAccountUsageLimitRequest__f255b800fa4e = {
quantity: string;
limitUnits: number;
limitCents?: never;
mode: "BLOCK";
notifyAtPct?: never;
} | {
quantity: string;
limitUnits: number;
limitCents?: never;
mode: "NOTIFY";
notifyAtPct: number;
} | {
quantity: string;
limitUnits?: never;
limitCents: number;
mode: "BLOCK";
notifyAtPct?: never;
} | {
quantity: string;
limitUnits?: never;
limitCents: number;
mode: "NOTIFY";
notifyAtPct: number;
};
Declaration source: packages/farthershore-js/dist/types.d.ts#L326.
export interface Session__d51a47154738 {
authenticated: boolean;
subscriber: Subscriber__c8719fbb7bfa | null;
/** Verified browser-session identity. Present only for a server-owned test
* persona cookie; Clerk sessions expose their user through the Clerk bridge. */
authSession: PersonaAuthSession__da61c3cf64e7 | null;
}
Declaration source: packages/farthershore-js/dist/resources/billing.d.ts#L5.
export interface SpendCapResult__395300e78371 {
/** The stored monthly spend cap in cents (null when cleared). */
maxMonthlySpendCents: number | null;
/** The subscription's entitlement version after the write, when returned. */
entitlementVersion?: number;
}
Declaration source: packages/farthershore-js/dist/resources/plans.d.ts#L27.
export interface StartOnboardingInput__af7cf0dea526 extends Omit<SubscribeInput__62c7cb21d77a, "compiledPlanId"> {
compiledPlanId?: string;
}
Declaration source: packages/farthershore-js/dist/resources/plans.d.ts#L5.
export interface SubscribeInput__62c7cb21d77a {
/** The plan to subscribe to — pass `plan.id`. */
compiledPlanId: string;
/** Owning org for org-owned subscriptions (forwarded as the
* `organizationId` query + header). */
organizationId?: string | null;
/** Where Stripe redirects after a successful paid checkout. */
successUrl?: string;
/** Where Stripe redirects if the subscriber abandons checkout. */
cancelUrl?: string;
/** OPTIONAL price-consent echo (E2 — Managed Stripe Price Integrity): the
* `offerFingerprint` from `getPlanOffers()`. When provided and the plan's
* economics changed since the offer was rendered, core rejects with
* 409 PLAN_OFFER_CHANGED (typed as `FartherShorePlanOfferChangedError`) and
* creates NO session — catch it, refetch offers, and re-present the price.
* Omit for today's unguarded behavior. */
offerFingerprint?: string;
}
Declaration source: packages/farthershore-js/dist/types.d.ts#L315.
export interface Subscriber__c8719fbb7bfa {
/** Lifecycle status (e.g. ONBOARDING | ACTIVE | SUSPENDED). */
status: string | null;
/** Denormalized plan key for display. */
planKey: string | null;
/** Immutable CompiledPlan id currently active for this subscriber. */
compiledPlanId: string | null;
/** True only after the selected environment's gateway has the exact active
* subscription projection. */
gatewayReady?: boolean;
}
Declaration source: packages/farthershore-js/dist/types.d.ts#L815.
export interface SubscriberActivePromo__160abba5e892 {
id: string;
code: string;
kind: PromoCodeKind__c6690a5a680c;
/** Discount magnitude (percent or cents, per `kind`), or null/absent. */
amount?: number | null;
/** How many billing periods the promo applies for. */
durationMonths: number;
/** ISO timestamp the promo stops applying, or null. */
activeUntil?: string | null;
/** ISO timestamp the promo was applied, or null. */
appliedAt?: string | null;
}
Declaration source: packages/farthershore-js/dist/types.d.ts#L897.
export interface SubscriberContext__86c582775b78 {
subscriber: SubscriberDetail__3358181c0560 | null;
availablePlans: Plan__3a8348415fe9[];
/**
* E1 — the subscriber's PINNED plan, resolved server-side from the
* subscription's pinned CompiledPlan version (NOT the catalog head — a
* pinned older version may not appear in `availablePlans` at all).
*
* Tri-state for old-Core back-compat:
* - `Plan` — resolved pinned plan.
* - `null` — Core resolved it: there IS no pinned plan (no
* subscription). Do NOT fall back to guessing.
* - `undefined` — the wire field was ABSENT (pre-E1 Core). Only here may
* a consumer fall back to matching `availablePlans` by
* `subscriber.compiledPlanId` (deprecated path).
*/
currentPlan?: Plan__3a8348415fe9 | null;
/** Managed-RBAC product-role keys assigned to the CALLER within the org
* (FAR-698/FAR-700). Server-resolved on `GET /me` — the same row-backed
* source the gateway-token mint uses; the SDK never decodes tokens.
* Empty for pre-RBAC responses. */
roles: string[];
/** The caller's resolved permission strings (`<subject>:read|write`
* grammar). `["*"]` means Managed RBAC is off or the caller is an OWNER;
* personal-org members receive the same resolved permission sets as team-org
* members. Client-side gating over these is UX ONLY — the gateway's
* `permission` constraint is the security boundary. */
permissions: string[];
/** Reviewed product permissions explicitly denied by the subscriber's
* effective roles. Present on current Core responses. */
deniedPermissions?: string[];
/** Current product permissions that were not reviewed by the effective
* roles and therefore inherit the safe product-evolution default of allow.
* Platform/account permissions are never included. */
unassignedProductPermissions?: string[];
/** Per-subscriber ComponentAccessPolicy override rows (Permissions Kernel,
* Wave 5) — `{componentKey, requiredPermission, gateMode}` as core emits
* them. Consumed by the SDK's component-policy resolver; `[]` when the
* subscriber has no overrides (or on older responses). */
componentAccessPolicies: ComponentAccessPolicyRow__60d2c40fe86e[];
/** Current legal acceptance state for this subscriber/org, when served by
* Core. Absent on older responses. */
legalConsent?: LegalConsentStatus__2c5f3ab016cd;
raw: unknown;
}
Declaration source: packages/farthershore-js/dist/types.d.ts#L859.
export interface SubscriberDetail__3358181c0560 {
id?: string;
status: string | null;
planKey: string | null;
compiledPlanId: string | null;
/** True only after the selected environment's gateway has the exact active
* subscription projection. */
gatewayReady?: boolean;
/** Resource limits on the subscriber's pinned plan, not the latest catalog. */
resourceLimits?: Record<string, number>;
/** Per-dimension meter map (`dimension → unit`) on the subscriber's PINNED
* compiled plan — the billing shape the subscriber is actually on. */
dimensions?: Record<string, number>;
/** The ordered list of meter dimensions the usage tab should display,
* authored by the pinned plan. `rules[].d` indexes into this array. */
displayDims?: string[];
/** Pinned-plan rate-limit / quota allowances (the source of truth for
* included quotas — see {@link SubscriberPinnedRule}). */
rules?: SubscriberPinnedRule__7b0d2ee36c4a[];
/** Stripe-driven lifecycle (e.g. ACTIVE | TRIALING | PAST_DUE | CANCELLED). */
subscriptionLifecycle?: string | null;
/** Stripe-synced trial end (ISO) — drives the trial banner countdown. */
trialEndsAt?: string | null;
/** True when a paid cancel is scheduled for period end ("Renew" un-schedules). */
cancelAtPeriodEnd?: boolean | null;
/** A scheduled plan transition (downgrades apply at period end). */
scheduledTransition?: SubscriberScheduledTransition__cd8a41b51ac1 | null;
/** An active promotional code applied to the subscription, when present. */
activePromo?: SubscriberActivePromo__160abba5e892 | null;
/** P-SPENDCAP-READ (W6.4) — the subscriber-set monthly spend cap, in cents,
* or null when none is set. STORED-not-ENFORCED today (held in
* `Subscription.customMetadata`, pending the rate-limit migration). */
maxMonthlySpendCents?: number | null;
[k: string]: unknown;
}
Declaration source: packages/farthershore-js/dist/resources/plans.d.ts#L44.
export interface SubscribeResult__4b2d9557cede {
/** Stripe Checkout URL (paid plans only). Undefined for free activations. */
url?: string;
/** The activated subscriber (free plans only). Undefined for paid checkout. */
subscriber?: {
id: string;
businessId?: string | null;
status: string;
};
/** Server-side checkout-attempt id, when returned. */
checkoutAttemptId?: string;
/** Best-effort initial API key minted on free-plan activation, when present. */
autoApiKey?: string;
/** Set when the subscriber activated but the first-key mint FAILED — surfaced
* (not swallowed) so the caller can prompt a manual key creation. */
autoApiKeyError?: AutoApiKeyError__bd378e9396dc;
}
Declaration source: packages/farthershore-js/dist/types.d.ts#L848.
export interface SubscriberPinnedRule__7b0d2ee36c4a {
/** Dimension index into `displayDims`. */
d: number;
/** Window length in seconds (a 30-day month is 2592000). */
w: number;
/** Capacity (the included allowance for the window). */
c: number;
}
Declaration source: packages/farthershore-js/dist/types.d.ts#L832.
export interface SubscriberScheduledTransition__cd8a41b51ac1 {
compiledPlanId: string | null;
planName: string | null;
planType: string | null;
/** ISO timestamp the transition takes effect. */
effectiveAt: string;
/** Movement direction (`CANCEL` | `UPGRADE` | `DOWNGRADE` | `SIDEGRADE`),
* open to producer-side additions. */
kind: string;
}
Declaration source: packages/farthershore-js/dist/types.d.ts#L739.
export interface Subscription__3e996fafa8e7 {
id: string;
/** Display lifecycle status (e.g. ACTIVE | TRIALING | PAST_DUE). Falls back
* across `status` / `lifecycle` on the wire. */
status: string;
planKey: string | null;
planName: string | null;
/** Owning product id, or null when absent on a lean DTO. */
businessId: string | null;
/** Immutable `CompiledPlan.id` currently active, or null. */
compiledPlanId: string | null;
/** Richer lifecycle string straight off the row (may equal `status`). */
lifecycle: string | null;
/** Payment health (`ok` | `past_due` | `incomplete` | …), or null when the
* DTO doesn't carry it (free subs). */
paymentHealth: string | null;
/** ISO start of the current billing period, or null. */
currentPeriodStart: string | null;
/** ISO end of the current billing period, or null. */
currentPeriodEnd: string | null;
/** True when a paid cancel is scheduled for period end. */
cancelAtPeriodEnd: boolean;
/** ISO trial end — drives the trial countdown. */
trialEndsAt: string | null;
/** ISO timestamp the subscription was canceled, or null. */
canceledAt: string | null;
/** A scheduled plan transition, or null when none is pending. */
scheduledTransition: SubscriptionScheduledTransition__57a7b2f83ca5 | null;
/** Whether the subscriber has a Stripe customer (can open the billing
* portal). Free subs that never touched Stripe are `false`. */
canManageInStripe: boolean;
/**
* Whether there is actually something here to cancel — SERVER-DECIDED.
*
* A subscription on a `free`-kind plan has no paid, Stripe-managed
* subscription behind it, so "cancel" has no meaning. The client cannot work
* this out on its own (the portal DTO always carries a real subscription id,
* so "nothing to cancel" looks identical to a lean wire body), which is why
* core answers it.
*
* `null` means the server did not say — treated as CANCELLABLE so an older
* core never strands a paying subscriber with no way to cancel.
*/
cancellable: boolean | null;
/** The full platform subscription DTO (large + evolving) for advanced reads. */
raw: unknown;
}
Declaration source: packages/farthershore-js/dist/types.d.ts#L955.
export interface SubscriptionContext__55ff0ed7dfb5 {
organizationId: string;
/** Org display name — matches core's wire field (`name`, NOT
* `organizationName`; see apps/core/src/routes/portal-customer/shared.ts). */
name?: string | null;
isDefault?: boolean;
/** Existing subscriber row for this business/org pair. A non-null value
* means this workspace already owns customer state for the product. */
subscriberId?: string | null;
/** Authoritative active-plan entitlement for the selected environment. */
hasEntitlement?: boolean;
[k: string]: unknown;
}
Declaration source: packages/farthershore-js/dist/types.d.ts#L968.
export interface SubscriptionContextsResult__fe44e57e7d49 {
contexts: SubscriptionContext__55ff0ed7dfb5[];
defaultOrganizationId: string;
selectedOrganizationId: string | null;
}
Declaration source: packages/farthershore-js/dist/types.d.ts#L726.
export interface SubscriptionScheduledTransition__57a7b2f83ca5 {
/** Immutable `CompiledPlan.id` the subscription moves to, or null. */
compiledPlanId: string | null;
/** ISO timestamp the transition takes effect, or null. */
effectiveAt: string | null;
/** Movement direction (`CANCEL` | `UPGRADE` | `DOWNGRADE` | `SIDEGRADE`),
* open to producer-side additions. */
kind: string | null;
}
Declaration source: packages/farthershore-js/dist/types.d.ts#L999.
export interface TeamInvitation__f9f120bf906d {
id: string;
email: string;
role: TeamRole__5a6deea9bec8;
/** Managed-RBAC product roles granted on accept. */
businessRoleKeys: string[];
status: string;
invitedByExternalId?: string | null;
expiresAt: string;
createdAt: string;
}
Declaration source: packages/farthershore-js/dist/types.d.ts#L1017.
export interface TeamInvitationAccepted__11c705c559ac {
membershipId: string;
role: TeamRole__5a6deea9bec8;
businessRoleKeys: string[];
}
Declaration source: packages/farthershore-js/dist/types.d.ts#L1012.
export interface TeamInvitationCreated__c157ef151993 extends TeamInvitation__f9f120bf906d {
token: string;
emailSent: boolean;
}
Declaration source: packages/farthershore-js/dist/types.d.ts#L990.
export interface TeamListResult__85d0b172007d {
ok: boolean;
members: TeamMember__4110e8306e32[];
/** The org's assignable Managed-RBAC role list (FAR-698) — what the
* per-member role multi-select offers. Empty when RBAC is unused. */
availableRoles?: RbacRoleSummary__2161df852611[];
error?: string;
}
Declaration source: packages/farthershore-js/dist/types.d.ts#L974.
export interface TeamMember__4110e8306e32 {
id: string;
userExternalId: string;
role: TeamRole__5a6deea9bec8;
/** Managed-RBAC product-role keys assigned to this member (FAR-698).
* Absent on pre-RBAC responses. */
businessRoleKeys?: string[];
/** Assigned keys whose role row no longer exists (deleted roles leave
* assignments in place — resolution ignores them). Drives the portal's
* stale-role warning. */
staleRoleKeys?: string[];
createdAt?: string;
updatedAt?: string;
[k: string]: unknown;
}
Declaration source: packages/farthershore-js/dist/resources/account.d.ts#L13.
export interface TeamResource__b9e413854377 {
/** Team members on the current subscription. A failed read surfaces
* `{ ok:false, error }` (drives the SSR portal's read-only banner) — NOT a
* silent empty list. */
list(opts?: {
signal?: AbortSignal;
}): Promise<TeamListResult__85d0b172007d>;
/**
* Track T2 — subscriber-team invitations. Managers (OWNER/ADMIN) invite by
* email; the invitee accepts with the emailed token. Each method THROWS the
* typed `FartherShoreApiError` on validation/authz failure.
*/
invites: {
/** Pending invitations (OWNER/ADMIN). */
list(opts?: {
signal?: AbortSignal;
}): Promise<TeamInvitation__f9f120bf906d[]>;
/** Create an invitation. `role` defaults to VIEWER; `businessRoleKeys` must
* be a subset of the caller's own permissions (403 otherwise). Returns the
* invitation plus the one-time raw token. */
create(input: {
email: string;
role?: TeamRole__5a6deea9bec8;
businessRoleKeys?: string[];
}): Promise<TeamInvitationCreated__c157ef151993>;
/** Revoke a pending invitation. */
revoke(invitationId: string): Promise<void>;
/** Accept an invitation with its token. The signed-in user's email must
* match the invite (403 mismatch; 409 expired/already-used). */
accept(token: string): Promise<TeamInvitationAccepted__11c705c559ac>;
};
updateRole(membershipId: string, role: TeamRole__5a6deea9bec8): Promise<TeamMember__4110e8306e32>;
remove(membershipId: string): Promise<void>;
/**
* Set-replace a member's Managed-RBAC product-role assignment (FAR-698):
* the given list becomes the member's full assignment; `[]` clears it.
* Every key must reference an existing role. Throws the typed
* `FartherShoreApiError` on validation/authz failures.
* Client-side role gating is UX only; the gateway's `permission`
* constraint is the security boundary.
*/
assignRoles(membershipId: string, roles: string[]): Promise<TeamMember__4110e8306e32>;
}
Declaration source: packages/farthershore-js/dist/types.d.ts#L973.
export type TeamRole__5a6deea9bec8 = "OWNER" | "ADMIN" | "VIEWER";
Declaration source: packages/farthershore-js/dist/config.d.ts#L80.
export type TokenProvider__40095f0da8e4 = () => string | null | undefined | Promise<string | null | undefined>;
Declaration source: packages/farthershore-js/dist/types.d.ts#L1257.
export interface TransparentBillPreview__bd44f368bc40 {
currency: string;
disclosure: "transparent";
/** The plan's recurring fee, in cents. */
recurringFeeCents: number;
/** Per-rating-window engine totals. */
windows: BillPreviewWindow__ebfec15d43d1[];
totals: {
/** Nanodollars, decimal strings (null = unavailable). */
ratedNanos: NanosAmount__f9c1e22d3cbe;
fundedNanos: NanosAmount__f9c1e22d3cbe;
receivableNanos: NanosAmount__f9c1e22d3cbe;
};
allowances: BillPreviewAllowance__eba9c1df99be[];
/** All-zero counts mean `totals` IS the whole bill. */
usageRating: BillPreviewUsageRating__fb184ad4d633;
}
Declaration source: packages/farthershore-js/dist/types.d.ts#L447.
export interface UpdateServiceAccountInput__88886ec5643e {
requestedPermissions?: NonEmptyPermissionList__ca911cbb6fa0;
usageLimit?: ServiceAccountUsageLimitRequest__f255b800fa4e | null;
}
Declaration source: packages/farthershore-js/dist/types.d.ts#L637.
export type UpdateUsageLimitInput__eb59c932012e = (UsageLimitUpdateValue__e8f19d3e563b & UsageLimitUpdateMode__0a6925ca669e) | (UsageLimitNoUpdateValue__cd3ce2b61e4f & UsageLimitExplicitUpdateMode__577df72501b7) | (UsageLimitNoUpdateValue__cd3ce2b61e4f & {
mode?: never;
notifyAtPct: number | null;
});
Declaration source: packages/farthershore-js/dist/types.d.ts#L553.
declare const USAGE_LIMIT_STRATEGIES__42e6020ce1f4: readonly ["fixed_window", "sliding_window"];
Declaration source: packages/farthershore-js/dist/types.d.ts#L650.
declare const USAGE_TRAFFIC_CLASSES__3e7da6994f34: readonly ["customer_operation", "control_plane", "admin_internal", "background_job", "webhook", "healthcheck", "unclassified"];
Declaration source: packages/farthershore-js/dist/types.d.ts#L649.
export type UsageBillingBasis__f1af1792f9ef = "requests" | "usage";
Declaration source: packages/farthershore-js/dist/types.d.ts#L654.
export type UsageChargeableOutcomes__7192cca0f62f = "success_only" | "success_and_partial" | "attempted" | "trusted_actual_usage_only";
Declaration source: packages/farthershore-js/dist/types.d.ts#L679.
export interface UsageEvent__0652cabf737c {
id: string;
timestamp: string;
operation: string;
apiKeyPrefix: string | null;
statusCode: number | null;
status: "success" | "error";
/** Event kind (e.g. "api"); shown as the row Type. */
type: string | null;
latencyMs: number | null;
/** Canonical per-event meter values, keyed by product-declared meter. */
dimensions: UsageEventDimensions__f3dde72e4b29;
/** Compatibility aliases for common legacy portal displays. */
requests: number | null;
tokens: number | null;
/** Advisory UsagePolicy state confirmed or relayed by the gateway/core. The
* frontend decides nothing from this; it is only for rendering stale-tolerant
* labels, cooldowns, and prompts. */
usagePolicy?: UsagePolicyAdvisory__0000f21c4f54;
}
Declaration source: packages/farthershore-js/dist/types.d.ts#L646.
export type UsageEventDimensions__f3dde72e4b29 = Record<string, number | null>;
Declaration source: packages/farthershore-js/dist/types.d.ts#L580.
export type UsageLimit__ab648bdf9611 = UsageLimitSubject__9eba54806aaa & UsageLimitValue__4ae5aa5bc7c5 & {
id: string;
quantity: string;
mode: UsageLimitMode__a43840c0d8cf;
period: "BILLING_PERIOD";
/** Present only for NOTIFY rows. */
notifyAtPct?: number;
ceiling: UsageLimitCeiling__6c51e5a840f6;
/** Present when the edge accounts this limit on a non-default window. */
effectiveWindow?: UsageLimitEffectiveWindow__87a0c7ebed46;
createdBy: string | null;
createdAt: string;
updatedAt: string;
};
Declaration source: packages/farthershore-js/dist/types.d.ts#L549.
export interface UsageLimitCeiling__6c51e5a840f6 {
limitUnits?: number;
limitCents?: number;
}
Declaration source: packages/farthershore-js/dist/types.d.ts#L595.
type UsageLimitCreateMode__f16ef2d50497 = {
mode: "BLOCK";
notifyAtPct?: never;
} | {
mode: "NOTIFY";
notifyAtPct: number;
};
Declaration source: packages/farthershore-js/dist/types.d.ts#L641.
export interface UsageLimitDeleteResult__734b143ab2a2 {
id: string;
deleted: true;
}
Declaration source: packages/farthershore-js/dist/types.d.ts#L559.
export interface UsageLimitEffectiveWindow__87a0c7ebed46 {
strategy: UsageLimitStrategy__119d691e431d;
periodSeconds: number;
}
Declaration source: packages/farthershore-js/dist/types.d.ts#L628.
type UsageLimitExplicitUpdateMode__577df72501b7 = {
mode: "BLOCK";
notifyAtPct?: null;
} | {
mode: "NOTIFY";
notifyAtPct: number;
};
Declaration source: packages/farthershore-js/dist/types.d.ts#L594.
export type UsageLimitListResponse__2eeb76f22fde = OffsetPage__af8a84ff58be<UsageLimit__ab648bdf9611>;
Declaration source: packages/farthershore-js/dist/types.d.ts#L548.
export type UsageLimitMode__a43840c0d8cf = "BLOCK" | "NOTIFY";
Declaration source: packages/farthershore-js/dist/types.d.ts#L614.
type UsageLimitNoUpdateValue__cd3ce2b61e4f = {
limitUnits?: never;
limitCents?: never;
};
Declaration source: packages/farthershore-js/dist/types.d.ts#L653.
export type UsageLimitProfile__4ac9b6a9c466 = "customer_usage" | "business_capacity" | "control_plane" | "admin_internal" | "platform_abuse_only" | "healthcheck" | "none";
Declaration source: packages/farthershore-js/dist/resources/usage-limits.d.ts#L3.
export interface UsageLimitsResource__2b1e05e6bcda {
/** List the current subscriber organization's visible per-actor limits.
* `options.signal` is accepted for source compatibility but does not cancel
* the shared cached fetch; the cache owns the request lifecycle. */
list(options?: {
signal?: AbortSignal;
limit?: number;
offset?: number;
}): Promise<UsageLimitListResponse__2eeb76f22fde>;
/** Create a subscriber-authored usage limit. */
create(input: CreateUsageLimitInput__0aee95b69b13): Promise<UsageLimit__ab648bdf9611>;
/** Update mutable value, mode, or threshold fields. */
update(limitId: string, input: UpdateUsageLimitInput__eb59c932012e): Promise<UsageLimit__ab648bdf9611>;
/** Permanently remove a subscriber-authored usage limit. */
delete(limitId: string): Promise<UsageLimitDeleteResult__734b143ab2a2>;
}
Declaration source: packages/farthershore-js/dist/types.d.ts#L554.
export type UsageLimitStrategy__119d691e431d = (typeof USAGE_LIMIT_STRATEGIES__42e6020ce1f4)[number];
Declaration source: packages/farthershore-js/dist/types.d.ts#L570.
export type UsageLimitSubject__9eba54806aaa = {
scope: "ORG";
subjectId?: never;
} | {
scope: "MEMBER";
subjectId: string;
} | {
scope: "SERVICE_ACCOUNT";
subjectId: string;
};
Declaration source: packages/farthershore-js/dist/types.d.ts#L618.
type UsageLimitUpdateMode__0a6925ca669e = {
mode?: never;
notifyAtPct?: number | null;
} | {
mode: "BLOCK";
notifyAtPct?: null;
} | {
mode: "NOTIFY";
notifyAtPct: number;
};
Declaration source: packages/farthershore-js/dist/types.d.ts#L607.
type UsageLimitUpdateValue__e8f19d3e563b = {
limitUnits: number;
limitCents?: never;
} | {
limitCents: number;
limitUnits?: never;
};
Declaration source: packages/farthershore-js/dist/types.d.ts#L563.
export type UsageLimitValue__4ae5aa5bc7c5 = {
limitUnits: number;
limitCents?: never;
} | {
limitCents: number;
limitUnits?: never;
};
Declaration source: packages/farthershore-js/dist/types.d.ts#L655.
export interface UsagePolicyAdvisory__0000f21c4f54 {
/** Gateway-resolved policy id, when the usage payload includes one. */
usagePolicyId: string | null;
/** Known traffic class; null when a newer gateway sends a class this SDK
* does not know yet. See `unknownTrafficClass` for the preserved raw value. */
trafficClass: UsageTrafficClass__530fe2057481 | null;
unknownTrafficClass?: string;
policySource: UsagePolicySource__baee26093419 | null;
limitProfile: UsageLimitProfile__4ac9b6a9c466 | null;
customerBillable: boolean | null;
providerCostTracked: boolean | null;
chargeableOutcomes: UsageChargeableOutcomes__7192cca0f62f | null;
meterKey: string | null;
cooldownResetAt: number | null;
retryAfterSeconds: number | null;
freeButLimited: boolean;
providerCost: boolean;
upgradePrompt: boolean;
creditPrompt: boolean;
genericMessage: string;
/** Raw gateway/core policy fields. Preserved for forward-compatible UIs and
* debugging; advisory only and never an enforcement input. */
raw: Record<string, unknown>;
}
Declaration source: packages/farthershore-js/dist/types.d.ts#L652.
export type UsagePolicySource__baee26093419 = "declared" | "inherited" | "defaulted" | "inferred";
Declaration source: packages/farthershore-js/dist/resources/usage.d.ts#L3.
export interface UsageRange__216cd12bcfd1 {
from?: string;
to?: string;
}
Declaration source: packages/farthershore-js/dist/resources/usage.d.ts#L7.
export interface UsageResource__a3469cda0e70 {
/** Dimension → total for the period (requests/tokens/computeMs/dollars…).
*
* `opts.signal` is accepted for source-compat but does NOT cancel the shared
* cached fetch (the cache owns the fetch lifecycle); the read is unmount-safe
* via the hook's active-flag and bounded by the cache TTL. */
summary(range?: UsageRange__216cd12bcfd1, opts?: {
signal?: AbortSignal;
}): Promise<UsageSummary__0f0a1f283e9b>;
/** The most-recent usage events (platform caps this list).
*
* `opts.signal` is accepted for source-compat but does NOT cancel the shared
* cached fetch (the cache owns the fetch lifecycle); the read is unmount-safe
* via the hook's active-flag and bounded by the cache TTL. */
events(range?: UsageRange__216cd12bcfd1, opts?: {
signal?: AbortSignal;
}): Promise<UsageEvent__0652cabf737c[]>;
/** Everything in one round-trip: per-dimension totals + recent events + the
* billing basis (the "Requests" vs "Usage" meter-label hint).
*
* `opts.signal` is accepted for source-compat but does NOT cancel the shared
* cached fetch (the cache owns the fetch lifecycle); the read is unmount-safe
* via the hook's active-flag and bounded by the cache TTL. */
snapshot(range?: UsageRange__216cd12bcfd1, opts?: {
signal?: AbortSignal;
includeEvents?: boolean;
}): Promise<UsageSnapshot__f8d76d9838e8>;
}
Declaration source: packages/farthershore-js/dist/types.d.ts#L701.
export interface UsageSnapshot__f8d76d9838e8 {
summary: UsageSummary__0f0a1f283e9b;
events: UsageEvent__0652cabf737c[];
billingBasis: UsageBillingBasis__f1af1792f9ef;
/** Whether `summary` is an EXACT total over the whole period (`true`, the
* DB-side aggregate) or an approximation from a bounded event sample
* (`false`). A `false` here means the UI should flag the figure as
* approximate. Defaults to `true` (additive — older Cores omit it). */
exact: boolean;
/** Number of usage events the `summary` total was computed from over the
* period. With `exact: true` this is the true event count; with
* `exact: false` it's the sampled (capped) count. */
sampledEvents: number;
/** ISO start of the period the `summary` covers (the resolved `from`), or
* null when the Core doesn't report it. */
periodStart: string | null;
/** ISO end of the period the `summary` covers (the resolved `to`), or null
* when the Core doesn't report it. */
periodEnd: string | null;
/** Aggregated advisory policy state from the freshest event in this snapshot.
* Null when no event carries policy metadata. */
usagePolicy: UsagePolicyAdvisory__0000f21c4f54 | null;
}
Declaration source: packages/farthershore-js/dist/types.d.ts#L645.
export type UsageSummary__0f0a1f283e9b = Record<string, number>;
Declaration source: packages/farthershore-js/dist/types.d.ts#L651.
export type UsageTrafficClass__530fe2057481 = (typeof USAGE_TRAFFIC_CLASSES__3e7da6994f34)[number];