stitchkit 0.123.1 → 0.123.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -15,6 +15,24 @@ additive**; the first breaking change landed in 0.10.0. Grep the file for
15
15
 
16
16
  ## [Unreleased]
17
17
 
18
+ ## [0.123.2] - 2026-11-12
19
+
20
+ ### Added
21
+
22
+ - `stitchkit/http`, `stitchkit` — **a contract client takes arguments once: `bound`.**
23
+ `createClient(contract, http, { bound: { slug } })` returns methods without `slug`: the key
24
+ leaves every method's arguments in the type, and an operation whose every argument is bound is
25
+ called with none (`client.session()`, `client.session.withOptions(options)`). The value travels
26
+ where the caller's argument would — a path parameter, a key `pathPrefix` consumes, the query of
27
+ a `GET` / `DELETE`, a body or multipart field — and reaches only the endpoints that declare the
28
+ key, so nothing is added to a query or body that did not name it. An application with one fixed
29
+ value per client no longer wraps every operation and repeats its input types. The same option
30
+ works in `createClients`, `createScopedClients`, `createUrlBuilder`, `createUrlBuilders` and
31
+ `createScopedUrlBuilders`. `ScopedHttpClient`, `ScopedUrlBuilder`, `ScopedEndpointFn` and
32
+ `ScopedUrlFn` gain an optional third type parameter naming the bound keys, and
33
+ `ContractClientConfig` a second one for the bound object.
34
+ [guide](docs/guide/client.md#bound-arguments)
35
+
18
36
  ## [0.123.1] - 2026-11-12
19
37
 
20
38
  ### Fixed
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Arguments a client was given once, for every call: which of them one endpoint takes, and
3
+ * whether they are all the arguments it has.
4
+ */
5
+ import type { EndpointDef } from '../contract/define.js';
6
+ import type { ContractClientConfig } from './client.js';
7
+ /** What a client's bound arguments mean for one endpoint. */
8
+ export interface BoundEndpointArguments {
9
+ /** The bound values this endpoint takes: a path parameter, a prefix key or a declared field. */
10
+ readonly values: Readonly<Record<string, unknown>>;
11
+ /** Every argument the endpoint has is bound, so its method is called with none. */
12
+ readonly complete: boolean;
13
+ }
14
+ /**
15
+ * Select the bound arguments of one endpoint's request, or of its URL alone. A bound key the endpoint does not declare is left
16
+ * out: it would otherwise travel as a query parameter or body field the operation never named.
17
+ */
18
+ export declare function boundEndpointArguments<K extends string>(endpoint: EndpointDef, contractPrefix: string, config: ContractClientConfig<K> | undefined, surface?: 'request' | 'url'): BoundEndpointArguments;
19
+ //# sourceMappingURL=client-bound.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client-bound.d.ts","sourceRoot":"","sources":["../../src/browser/client-bound.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAGtD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AA0CrD,6DAA6D;AAC7D,MAAM,WAAW,sBAAsB;IACrC,gGAAgG;IAChG,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACnD,mFAAmF;IACnF,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;CAC5B;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,SAAS,MAAM,EACrD,QAAQ,EAAE,WAAW,EACrB,cAAc,EAAE,MAAM,EACtB,MAAM,EAAE,oBAAoB,CAAC,CAAC,CAAC,GAAG,SAAS,EAC3C,OAAO,GAAE,SAAS,GAAG,KAAiB,GACrC,sBAAsB,CA8BxB"}
@@ -6,6 +6,8 @@ export interface ClientRequestPlan {
6
6
  }
7
7
  /** Compile the same contract/prefix structure used by the request planner into a pathname matcher. */
8
8
  export declare function createClientRouteMatcher<K extends string>(endpoint: EndpointDef, contractPrefix: string, config?: ContractClientConfig<K>): (pathname: string) => boolean;
9
+ /** The names a route template takes from its arguments: `:name` segments and a trailing wildcard. */
10
+ export declare function routeParamNames(path: string): string[];
9
11
  /** Plan the complete request URL and body/form fields without executing I/O. */
10
12
  export declare function planClientRequest<K extends string>(endpoint: EndpointDef, contractPrefix: string, args: Record<string, unknown>, config?: ContractClientConfig<K>): ClientRequestPlan;
11
13
  /** Join a configured absolute or relative base with a planner-owned relative URL. */
@@ -1 +1 @@
1
- {"version":3,"file":"client-url.d.ts","sourceRoot":"","sources":["../../src/browser/client-url.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAItD,OAAO,KAAK,EAAE,oBAAoB,EAAkB,MAAM,UAAU,CAAC;AAIrE,MAAM,WAAW,iBAAiB;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACxC;AAkFD,sGAAsG;AACtG,wBAAgB,wBAAwB,CAAC,CAAC,SAAS,MAAM,EACvD,QAAQ,EAAE,WAAW,EACrB,cAAc,EAAE,MAAM,EACtB,MAAM,CAAC,EAAE,oBAAoB,CAAC,CAAC,CAAC,GAC/B,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAqC/B;AAoFD,gFAAgF;AAChF,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,MAAM,EAChD,QAAQ,EAAE,WAAW,EACrB,cAAc,EAAE,MAAM,EACtB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,MAAM,CAAC,EAAE,oBAAoB,CAAC,CAAC,CAAC,GAC/B,iBAAiB,CAenB;AAED,qFAAqF;AACrF,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAI9E"}
1
+ {"version":3,"file":"client-url.d.ts","sourceRoot":"","sources":["../../src/browser/client-url.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAItD,OAAO,KAAK,EAAE,oBAAoB,EAAkB,MAAM,UAAU,CAAC;AAIrE,MAAM,WAAW,iBAAiB;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACxC;AAkFD,sGAAsG;AACtG,wBAAgB,wBAAwB,CAAC,CAAC,SAAS,MAAM,EACvD,QAAQ,EAAE,WAAW,EACrB,cAAc,EAAE,MAAM,EACtB,MAAM,CAAC,EAAE,oBAAoB,CAAC,CAAC,CAAC,GAC/B,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAqC/B;AAyBD,qGAAqG;AACrG,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAMtD;AAqDD,gFAAgF;AAChF,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,MAAM,EAChD,QAAQ,EAAE,WAAW,EACrB,cAAc,EAAE,MAAM,EACtB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,MAAM,CAAC,EAAE,oBAAoB,CAAC,CAAC,CAAC,GAC/B,iBAAiB,CAenB;AAED,qFAAqF;AACrF,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAI9E"}
@@ -29,9 +29,16 @@ export type PathPrefixArgs<K extends string> = {
29
29
  * and they become required, typed args on every method of the returned client —
30
30
  * no hand-written scoped-client wrapper.
31
31
  */
32
- export interface ContractClientConfig<K extends string = never> {
32
+ export interface ContractClientConfig<K extends string = never, B extends Record<string, unknown> = Record<never, never>> {
33
33
  pathPrefix?: string | ((args: PathPrefixArgs<K>) => string);
34
34
  stripPrefixKeys?: readonly K[];
35
+ /**
36
+ * Arguments given once for every call, e.g. `{ tenantId }`. A bound key leaves the args of
37
+ * every method, and a method whose every argument is bound is called with none. The value goes
38
+ * where the caller's argument would: a path parameter, a prefix key, the query or the body.
39
+ * An endpoint that does not declare the key does not receive it.
40
+ */
41
+ bound?: B;
35
42
  }
36
43
  /**
37
44
  * Build exact expected-401 pathname matchers from selected contract operations.
@@ -44,29 +51,32 @@ export declare function contractEndpointMatchers<T extends Record<string, Endpoi
44
51
  * (from `createHttpClient`) for cookie auth, SSR and retry, or a plain
45
52
  * `ClientConfig` for a bare fetch client.
46
53
  */
47
- export declare function createClient<T extends Record<string, EndpointDef>, const K extends string = never>(contract: ContractDef<T, string>, configOrClient: ClientConfig | HttpAdapter, contractConfig?: ContractClientConfig<K>): ScopedHttpClient<T, ScopedKeys<K>>;
54
+ export declare function createClient<T extends Record<string, EndpointDef>, const K extends string = never, const B extends Record<string, unknown> = Record<never, never>>(contract: ContractDef<T, string>, configOrClient: ClientConfig | HttpAdapter, contractConfig?: ContractClientConfig<K, B>): ScopedHttpClient<T, ScopedKeys<K>, keyof B>;
48
55
  /**
49
56
  * Batch form of `createClient` — one fully-typed client per contract, built
50
57
  * from a `name → contract` registry. Each key keeps its own client type, so
51
58
  * the project lists its contracts once and gets the whole typed API.
52
59
  */
53
- export declare function createClients<T extends Record<string, ContractDef<Record<string, EndpointDef>, string>>, const K extends string = never>(contracts: T, configOrClient: ClientConfig | HttpAdapter, contractConfig?: ContractClientConfig<K>): {
54
- [P in keyof T]: ScopedHttpClient<T[P]['endpoints'], ScopedKeys<K>>;
60
+ export declare function createClients<T extends Record<string, ContractDef<Record<string, EndpointDef>, string>>, const K extends string = never, const B extends Record<string, unknown> = Record<never, never>>(contracts: T, configOrClient: ClientConfig | HttpAdapter, contractConfig?: ContractClientConfig<K, B>): {
61
+ [P in keyof T]: ScopedHttpClient<T[P]['endpoints'], ScopedKeys<K>, keyof B>;
55
62
  };
56
63
  export type ClientContract = ContractDef<Record<string, EndpointDef>, string>;
57
64
  export type ClientRegistryValue = ClientContract | readonly ClientContract[];
58
65
  export type ScopeClientConfigs<TScope extends string> = {
59
- [S in TScope]: ContractClientConfig<string>;
66
+ [S in TScope]: ContractClientConfig<string, Record<string, unknown>>;
60
67
  };
61
68
  type RegistryContract<R> = R extends readonly (infer C)[] ? C : R;
62
69
  export type RegistryScope<R> = RegistryContract<R> extends ContractDef<Record<string, EndpointDef>, infer S> ? S : never;
63
70
  type PrefixKeys<C> = C extends {
64
71
  stripPrefixKeys: readonly (infer K extends string)[];
65
72
  } ? K : never;
66
- type ClientForContract<C, Configs> = C extends ContractDef<infer E, infer S> ? S extends keyof Configs ? ScopedHttpClient<E, ScopedKeys<PrefixKeys<Configs[S]>>> : never : never;
73
+ type BoundKeys<C> = C extends {
74
+ bound: infer B;
75
+ } ? keyof B : never;
76
+ type ClientForContract<C, Configs> = C extends ContractDef<infer E, infer S> ? S extends keyof Configs ? ScopedHttpClient<E, ScopedKeys<PrefixKeys<Configs[S]>>, BoundKeys<Configs[S]>> : never : never;
67
77
  type UnionToIntersection<U> = (U extends unknown ? (value: U) => void : never) extends (value: infer I) => void ? I : never;
68
78
  type ScopedNamespace<R, Configs> = UnionToIntersection<ClientForContract<RegistryContract<R>, Configs>>;
69
- type UrlBuilderForContract<C, Configs> = C extends ContractDef<infer E, infer S> ? S extends keyof Configs ? ScopedUrlBuilder<E, ScopedKeys<PrefixKeys<Configs[S]>>> : never : never;
79
+ type UrlBuilderForContract<C, Configs> = C extends ContractDef<infer E, infer S> ? S extends keyof Configs ? ScopedUrlBuilder<E, ScopedKeys<PrefixKeys<Configs[S]>>, BoundKeys<Configs[S]>> : never : never;
70
80
  type ScopedUrlNamespace<R, Configs> = UnionToIntersection<UrlBuilderForContract<RegistryContract<R>, Configs>>;
71
81
  export type ScopedClientRegistry<T extends Record<string, ClientRegistryValue>, Configs> = {
72
82
  [P in keyof T]: ScopedNamespace<T[P], Configs>;
@@ -80,9 +90,9 @@ export declare function createScopedClients<const T extends Record<string, Clien
80
90
  export interface UrlBuilderConfig {
81
91
  baseUrl: string;
82
92
  }
83
- export declare function createUrlBuilder<T extends Record<string, EndpointDef>, const K extends string = never>(contract: ContractDef<T, string>, source: UrlBuilderConfig, contractConfig?: ContractClientConfig<K>): ScopedUrlBuilder<T, ScopedKeys<K>>;
84
- export declare function createUrlBuilders<T extends Record<string, ContractDef<Record<string, EndpointDef>, string>>, const K extends string = never>(contracts: T, source: UrlBuilderConfig, contractConfig?: ContractClientConfig<K>): {
85
- [P in keyof T]: ScopedUrlBuilder<T[P]['endpoints'], ScopedKeys<K>>;
93
+ export declare function createUrlBuilder<T extends Record<string, EndpointDef>, const K extends string = never, const B extends Record<string, unknown> = Record<never, never>>(contract: ContractDef<T, string>, source: UrlBuilderConfig, contractConfig?: ContractClientConfig<K, B>): ScopedUrlBuilder<T, ScopedKeys<K>, keyof B>;
94
+ export declare function createUrlBuilders<T extends Record<string, ContractDef<Record<string, EndpointDef>, string>>, const K extends string = never, const B extends Record<string, unknown> = Record<never, never>>(contracts: T, source: UrlBuilderConfig, contractConfig?: ContractClientConfig<K, B>): {
95
+ [P in keyof T]: ScopedUrlBuilder<T[P]['endpoints'], ScopedKeys<K>, keyof B>;
86
96
  };
87
97
  /** Build one URL registry routed by contract scope; arrays compose a namespace. */
88
98
  export declare function createScopedUrlBuilders<const T extends Record<string, ClientRegistryValue>, const Configs extends ScopeClientConfigs<RegistryScope<T[keyof T]>>>(contracts: T, source: UrlBuilderConfig, scopeConfigs: Configs): ScopedUrlBuilderRegistry<T, Configs>;
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/browser/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,gBAAgB,EAChB,gBAAgB,EAGjB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AASnE,OAAO,KAAK,EAAE,UAAU,IAAI,WAAW,EAAE,mBAAmB,EAAE,MAAM,QAAQ,CAAC;AAC7E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG/C,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,iFAAiF;IACjF,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB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K,CAAC,EAE9D,SAAS,EAAE,CAAC,EACZ,MAAM,EAAE,gBAAgB,EACxB,cAAc,CAAC,EAAE,oBAAoB,CAAC,CAAC,EAAE,CAAC,CAAC,GAC1C;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;CAAE,CAOjF;AAED,mFAAmF;AACnF,wBAAgB,uBAAuB,CACrC,KAAK,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,EACnD,KAAK,CAAC,OAAO,SAAS,kBAAkB,CAAC,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAEnE,SAAS,EAAE,CAAC,EACZ,MAAM,EAAE,gBAAgB,EACxB,YAAY,EAAE,OAAO,GACpB,wBAAwB,CAAC,CAAC,EAAE,OAAO,CAAC,CAOtC"}
@@ -137,20 +137,25 @@ type GuaranteesHttp<Exposure extends readonly Transport[]> = Exposure extends re
137
137
  ] ? [First] extends ['HTTP'] ? true : GuaranteesHttp<Rest> : Exposure extends readonly [...infer Rest extends readonly Transport[], infer Last] ? [Last] extends ['HTTP'] ? true : GuaranteesHttp<Rest> : false;
138
138
  type ExposureHasHttp<Exposure> = Exposure extends undefined ? true : Exposure extends readonly Transport[] ? GuaranteesHttp<Exposure> : false;
139
139
  type ExposesHttp<Endpoint> = Endpoint extends unknown ? 'expose' extends keyof Endpoint ? ExposureHasHttp<Endpoint['expose']> : true : never;
140
- type ArgsWith<E, Extra> = EndpointArgs<E> & Extra;
141
- export type ScopedEndpointFn<E, Extra> = [keyof ArgsWith<E, Extra>] extends [never] ? ClientEndpointWithoutArgs<EndpointOutput<E>> : ClientEndpointWithArgs<ArgsWith<E, Extra>, EndpointOutput<E>>;
142
- export type ScopedHttpClient<C extends Record<string, EndpointDef>, Extra> = {
143
- [K in keyof C as ExposesHttp<C[K]> extends true ? K : never]: ScopedEndpointFn<C[K], Extra>;
140
+ type WithoutBound<Args, Bound extends PropertyKey> = [Bound] extends [never] ? Args : Args extends unknown ? Omit<Args, Bound> : never;
141
+ type ArgsWith<E, Extra, Bound extends PropertyKey> = WithoutBound<EndpointArgs<E> & Extra, Bound>;
142
+ export type ScopedEndpointFn<E, Extra, Bound extends PropertyKey = never> = [
143
+ keyof ArgsWith<E, Extra, Bound>
144
+ ] extends [never] ? ClientEndpointWithoutArgs<EndpointOutput<E>> : ClientEndpointWithArgs<ArgsWith<E, Extra, Bound>, EndpointOutput<E>>;
145
+ export type ScopedHttpClient<C extends Record<string, EndpointDef>, Extra, Bound extends PropertyKey = never> = {
146
+ [K in keyof C as ExposesHttp<C[K]> extends true ? K : never]: ScopedEndpointFn<C[K], Extra, Bound>;
144
147
  };
145
148
  export type TypedHttpClient<C extends Record<string, EndpointDef>> = ScopedHttpClient<C, unknown>;
146
149
  type IsUrlBuildable<E> = ExposesHttp<E>;
147
150
  type EndpointUrlArgs<E> = EndpointParamsInput<E> & (E extends {
148
151
  method: 'GET' | 'DELETE';
149
152
  } ? InferInput<Prop<E, 'input'>> : unknown);
150
- type UrlArgsWith<E, Extra> = EndpointUrlArgs<E> & Extra;
151
- export type ScopedUrlFn<E, Extra> = [keyof UrlArgsWith<E, Extra>] extends [never] ? () => string : (args: UrlArgsWith<E, Extra>) => string;
152
- export type ScopedUrlBuilder<C extends Record<string, EndpointDef>, Extra> = {
153
- [K in keyof C as IsUrlBuildable<C[K]> extends true ? K : never]: ScopedUrlFn<C[K], Extra>;
153
+ type UrlArgsWith<E, Extra, Bound extends PropertyKey> = WithoutBound<EndpointUrlArgs<E> & Extra, Bound>;
154
+ export type ScopedUrlFn<E, Extra, Bound extends PropertyKey = never> = [
155
+ keyof UrlArgsWith<E, Extra, Bound>
156
+ ] extends [never] ? () => string : (args: UrlArgsWith<E, Extra, Bound>) => string;
157
+ export type ScopedUrlBuilder<C extends Record<string, EndpointDef>, Extra, Bound extends PropertyKey = never> = {
158
+ [K in keyof C as IsUrlBuildable<C[K]> extends true ? K : never]: ScopedUrlFn<C[K], Extra, Bound>;
154
159
  };
155
160
  export type TypedUrlBuilder<C extends Record<string, EndpointDef>> = ScopedUrlBuilder<C, unknown>;
156
161
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"client-types.d.ts","sourceRoot":"","sources":["../../src/contract/client-types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACtC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAIvD,KAAK,IAAI,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,IAAI,CAAC,SAAS,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;AAYtE,KAAK,UAAU,CAAC,CAAC,IAAI,CAAC,SAAS,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC;AAE9D;;;;;;GAMG;AACH,MAAM,WAAW,cAAc;IAC7B,mEAAmE;IACnE,GAAG,EAAE,MAAM,CAAC;IACZ,wCAAwC;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,wCAAwC;IACxC,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG,IAAI,GAAG,cAAc,CAAC;AAElD,6DAA6D;AAC7D,MAAM,MAAM,mBAAmB,GAC3B;IACE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,KAAK,CAAC;IACjB,QAAQ,CAAC,EAAE,KAAK,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAClC,GAC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AAe,CAAC,CAAC,CAAC,GAAG,KAAK,EAC1B,KAAK,CACN,CAAC;AAEF,MAAM,MAAM,WAAW,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,SAAS,WAAW,GAAG,KAAK,IAAI;IACrE,MAAM,WAAW,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC;CACnC,SAAS,CAAC,KAAK,CAAC,GACb,MAAM,MAAM,GACZ,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,MAAM,CAAC;AAEnD,MAAM,MAAM,gBAAgB,CAC1B,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,EACrC,KAAK,EACL,KAAK,SAAS,WAAW,GAAG,KAAK,IAC/B;KACD,CAAC,IAAI,MAAM,CAAC,IAAI,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,IAAI,GAAG,CAAC,GAAG,KAAK,GAAG,WAAW,CAC1E,CAAC,CAAC,CAAC,CAAC,EACJ,KAAK,EACL,KAAK,CACN;CACF,CAAC;AAEF,MAAM,MAAM,eAAe,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,IAAI,gBAAgB,CACnF,CAAC,EACD,OAAO,CACR,CAAC"}
@@ -14,7 +14,7 @@ import {
14
14
  createUrlBuilder2,
15
15
  createUrlBuilders2,
16
16
  createScopedUrlBuilders2
17
- } from "../index-mdyhr36s.js";
17
+ } from "../index-zbzagr9k.js";
18
18
  import {
19
19
  ApiError2
20
20
  } from "../index-kfjkb396.js";
@@ -74,7 +74,7 @@ import {
74
74
  createUrlBuilder2,
75
75
  createUrlBuilders2,
76
76
  createScopedUrlBuilders2
77
- } from "../index-mdyhr36s.js";
77
+ } from "../index-zbzagr9k.js";
78
78
  import {
79
79
  StreamLineLimitError2,
80
80
  StreamTruncatedLineError2
@@ -5,7 +5,7 @@ import"../index-yt1gg11x.js";
5
5
  import {
6
6
  endpointHasArguments,
7
7
  createClient2
8
- } from "../index-mdyhr36s.js";
8
+ } from "../index-zbzagr9k.js";
9
9
  import {
10
10
  ApiError2
11
11
  } from "../index-kfjkb396.js";
@@ -36,7 +36,7 @@ import"../index-ndjzbt2v.js";
36
36
  import {
37
37
  createClient2,
38
38
  createClients2
39
- } from "../index-mdyhr36s.js";
39
+ } from "../index-zbzagr9k.js";
40
40
  import {
41
41
  assertPositiveSafeInteger
42
42
  } from "../index-0s4xebbg.js";
@@ -37,56 +37,6 @@ function endpointHasArguments(endpoint) {
37
37
  return Boolean(endpoint.params || endpoint.input || endpoint.multipart);
38
38
  }
39
39
 
40
- // src/browser/client-multipart.ts
41
- function isFileDescriptor(value) {
42
- return typeof value === "object" && value !== null && !(value instanceof Blob) && "uri" in value && typeof value.uri === "string" && "name" in value && typeof value.name === "string" && "type" in value && typeof value.type === "string";
43
- }
44
- function isMultipartFile(value) {
45
- return value instanceof Blob || isFileDescriptor(value);
46
- }
47
- function appendMultipartFile(form, field, file) {
48
- const sink = form;
49
- sink.append(field, file);
50
- }
51
- function appendFormFields(formData, values, skipKeys) {
52
- for (const [key, value] of Object.entries(values)) {
53
- if (skipKeys.has(key) || value === undefined || value === null)
54
- continue;
55
- formData.append(key, typeof value === "string" ? value : JSON.stringify(value));
56
- }
57
- }
58
- function buildMultipartForm(descriptor, values) {
59
- const formData = new FormData;
60
- const fileFields = new Set(Object.keys(descriptor.files));
61
- for (const [field, policy] of Object.entries(descriptor.files)) {
62
- const value = values[field];
63
- if (value === undefined) {
64
- if (policy.required !== false) {
65
- throw refuseLocally(field, `Missing multipart file field: ${field}`);
66
- }
67
- continue;
68
- }
69
- if (policy.multiple === true) {
70
- if (!Array.isArray(value) || value.length === 0) {
71
- throw refuseLocally(field, `Multipart file field "${field}" must be a non-empty array`);
72
- }
73
- for (const file of value) {
74
- if (!isMultipartFile(file)) {
75
- throw refuseLocally(field, `Invalid multipart file field: ${field}`);
76
- }
77
- appendMultipartFile(formData, field, file);
78
- }
79
- continue;
80
- }
81
- if (!isMultipartFile(value)) {
82
- throw refuseLocally(field, `Invalid multipart file field: ${field}`);
83
- }
84
- appendMultipartFile(formData, field, value);
85
- }
86
- appendFormFields(formData, values, fileFields);
87
- return formData;
88
- }
89
-
90
40
  // src/browser/client-url.ts
91
41
  function isParamArray(value) {
92
42
  return Array.isArray(value) && value.every((item) => typeof item === "string" || typeof item === "number");
@@ -184,7 +134,7 @@ function compileSegmentTest(pattern, markers) {
184
134
  const expression = new RegExp(`^${source}$`);
185
135
  return (actual) => expression.test(actual);
186
136
  }
187
- function extractParamNames(path) {
137
+ function routeParamNames(path) {
188
138
  const matches = path.match(/:(\w+)/g);
189
139
  const names = matches ? matches.map((match) => match.slice(1)) : [];
190
140
  const wildcard = parseTrailingWildcard(path);
@@ -213,7 +163,7 @@ function fillPathParams(path, args) {
213
163
  }
214
164
  function stripConsumedArgs(args, path, scopeKeys) {
215
165
  const consumed = new Set(scopeKeys);
216
- for (const name of extractParamNames(path))
166
+ for (const name of routeParamNames(path))
217
167
  consumed.add(name);
218
168
  const remaining = {};
219
169
  for (const [key, value] of Object.entries(args)) {
@@ -258,6 +208,118 @@ function joinClientBaseUrl(baseUrl, relativeUrl) {
258
208
  return `${base}${path}`;
259
209
  }
260
210
 
211
+ // src/browser/client-bound.ts
212
+ var WRAPPERS = new Set([
213
+ "optional",
214
+ "nullable",
215
+ "default",
216
+ "prefault",
217
+ "nonoptional",
218
+ "readonly",
219
+ "catch"
220
+ ]);
221
+ function collectDeclaredFields(schema, into) {
222
+ if (!isRecord(schema))
223
+ return false;
224
+ const def = isRecord(schema.def) ? schema.def : {};
225
+ if (isRecord(schema.shape)) {
226
+ for (const key of Object.keys(schema.shape))
227
+ into.add(key);
228
+ return def.catchall === undefined;
229
+ }
230
+ if (def.type === "union" && Array.isArray(def.options)) {
231
+ let closed = true;
232
+ for (const option of def.options)
233
+ closed = collectDeclaredFields(option, into) && closed;
234
+ return closed;
235
+ }
236
+ if (def.type === "intersection") {
237
+ const left = collectDeclaredFields(def.left, into);
238
+ return collectDeclaredFields(def.right, into) && left;
239
+ }
240
+ if (def.type === "pipe")
241
+ return collectDeclaredFields(def.in, into);
242
+ if (typeof def.type === "string" && WRAPPERS.has(def.type))
243
+ return collectDeclaredFields(def.innerType, into);
244
+ return false;
245
+ }
246
+ function boundEndpointArguments(endpoint, contractPrefix, config, surface = "request") {
247
+ const scopeKeys = config?.stripPrefixKeys ?? [];
248
+ const declared = new Set(scopeKeys);
249
+ const staticPrefix = typeof config?.pathPrefix === "string" ? config.pathPrefix : "";
250
+ for (const name of routeParamNames(`${staticPrefix}/${contractPrefix}${endpoint.path}`))
251
+ declared.add(name);
252
+ let closed = true;
253
+ if (endpoint.params)
254
+ closed = collectDeclaredFields(endpoint.params, declared) && closed;
255
+ if (surface === "request" || inputIsQuery(endpoint.method)) {
256
+ if (endpoint.input)
257
+ closed = collectDeclaredFields(endpoint.input, declared) && closed;
258
+ }
259
+ if (surface === "request")
260
+ for (const name of Object.keys(endpoint.multipart?.files ?? {}))
261
+ declared.add(name);
262
+ const bound = config?.bound ?? {};
263
+ const values = {};
264
+ for (const [key, value] of Object.entries(bound)) {
265
+ if (value !== undefined && declared.has(key))
266
+ values[key] = value;
267
+ }
268
+ const takesArguments = endpointHasArguments(endpoint) || scopeKeys.length > 0;
269
+ const complete = !takesArguments || Object.keys(values).length > 0 && closed && [...declared].every((key) => Object.hasOwn(values, key));
270
+ return { values, complete };
271
+ }
272
+
273
+ // src/browser/client-multipart.ts
274
+ function isFileDescriptor(value) {
275
+ return typeof value === "object" && value !== null && !(value instanceof Blob) && "uri" in value && typeof value.uri === "string" && "name" in value && typeof value.name === "string" && "type" in value && typeof value.type === "string";
276
+ }
277
+ function isMultipartFile(value) {
278
+ return value instanceof Blob || isFileDescriptor(value);
279
+ }
280
+ function appendMultipartFile(form, field, file) {
281
+ const sink = form;
282
+ sink.append(field, file);
283
+ }
284
+ function appendFormFields(formData, values, skipKeys) {
285
+ for (const [key, value] of Object.entries(values)) {
286
+ if (skipKeys.has(key) || value === undefined || value === null)
287
+ continue;
288
+ formData.append(key, typeof value === "string" ? value : JSON.stringify(value));
289
+ }
290
+ }
291
+ function buildMultipartForm(descriptor, values) {
292
+ const formData = new FormData;
293
+ const fileFields = new Set(Object.keys(descriptor.files));
294
+ for (const [field, policy] of Object.entries(descriptor.files)) {
295
+ const value = values[field];
296
+ if (value === undefined) {
297
+ if (policy.required !== false) {
298
+ throw refuseLocally(field, `Missing multipart file field: ${field}`);
299
+ }
300
+ continue;
301
+ }
302
+ if (policy.multiple === true) {
303
+ if (!Array.isArray(value) || value.length === 0) {
304
+ throw refuseLocally(field, `Multipart file field "${field}" must be a non-empty array`);
305
+ }
306
+ for (const file of value) {
307
+ if (!isMultipartFile(file)) {
308
+ throw refuseLocally(field, `Invalid multipart file field: ${field}`);
309
+ }
310
+ appendMultipartFile(formData, field, file);
311
+ }
312
+ continue;
313
+ }
314
+ if (!isMultipartFile(value)) {
315
+ throw refuseLocally(field, `Invalid multipart file field: ${field}`);
316
+ }
317
+ appendMultipartFile(formData, field, value);
318
+ }
319
+ appendFormFields(formData, values, fileFields);
320
+ return formData;
321
+ }
322
+
261
323
  // src/browser/stream.ts
262
324
  function ndjsonLine(rawLine) {
263
325
  return (rawLine.endsWith("\r") ? rawLine.slice(0, -1) : rawLine).trim();
@@ -701,7 +763,7 @@ function createClient2(contract, configOrClient, contractConfig) {
701
763
  for (const [key, endpoint] of typedEntries(contract.endpoints)) {
702
764
  if (endpoint.expose && !endpoint.expose.includes("HTTP"))
703
765
  continue;
704
- setClientMethod(client, key, createEndpointMethod(endpoint, namedOperation(makeExecutor(endpoint), `${contract.meta.prefix}.${String(key)}`), contractConfig));
766
+ setClientMethod(client, key, createEndpointMethod(endpoint, namedOperation(makeExecutor(endpoint), `${contract.meta.prefix}.${String(key)}`), boundEndpointArguments(endpoint, contract.meta.prefix, contractConfig)));
705
767
  }
706
768
  return client;
707
769
  }
@@ -742,22 +804,25 @@ function isHttpAdapter(value) {
742
804
  function setClientMethod(target, key, method) {
743
805
  target[key] = method;
744
806
  }
745
- function createEndpointMethod(endpoint, execute, contractConfig) {
746
- const hasScopedArguments = (contractConfig?.stripPrefixKeys?.length ?? 0) > 0;
747
- if (endpointHasArguments(endpoint) || hasScopedArguments) {
748
- const method = (requestArgs) => settle(execute, readClientRequestArgs(requestArgs), undefined);
807
+ function createEndpointMethod(endpoint, execute, bound) {
808
+ if (!bound.complete) {
809
+ const readArgs = (requestArgs) => ({
810
+ ...readClientRequestArgs(requestArgs),
811
+ ...bound.values
812
+ });
813
+ const method = (requestArgs) => settle(execute, readArgs(requestArgs), undefined);
749
814
  return Object.assign(method, {
750
815
  withOptions: (...args) => {
751
816
  refuseExtraWithOptionsArguments(endpoint, args.length, 2);
752
- return settle(execute, readClientRequestArgs(args[0]), readClientRequestOptions(endpoint, args[1]));
817
+ return settle(execute, readArgs(args[0]), readClientRequestOptions(endpoint, args[1]));
753
818
  }
754
819
  });
755
820
  }
756
- const method = () => settle(execute, {}, undefined);
821
+ const method = () => settle(execute, { ...bound.values }, undefined);
757
822
  return Object.assign(method, {
758
823
  withOptions: (...args) => {
759
824
  refuseExtraWithOptionsArguments(endpoint, args.length, 1);
760
- return settle(execute, {}, readClientRequestOptions(endpoint, args[0]));
825
+ return settle(execute, { ...bound.values }, readClientRequestOptions(endpoint, args[0]));
761
826
  }
762
827
  });
763
828
  }
@@ -813,8 +878,9 @@ function createUrlBuilder2(contract, source, contractConfig) {
813
878
  for (const [key, endpoint] of typedEntries(contract.endpoints)) {
814
879
  if (endpoint.expose && !endpoint.expose.includes("HTTP"))
815
880
  continue;
881
+ const bound = boundEndpointArguments(endpoint, contract.meta.prefix, contractConfig, "url");
816
882
  setClientMethod(builder, key, (args) => {
817
- const plan = planClientRequest(endpoint, contract.meta.prefix, args ?? {}, contractConfig);
883
+ const plan = planClientRequest(endpoint, contract.meta.prefix, { ...args, ...bound.values }, contractConfig);
818
884
  if (endpoint.method !== "GET" && endpoint.method !== "DELETE" && Object.keys(plan.remainingArgs).length > 0) {
819
885
  const fields = Object.keys(plan.remainingArgs).join(", ");
820
886
  throw new Error(`URL builder for ${endpoint.method} ${endpoint.path} received non-URL fields: ${fields}`);
@@ -1,11 +1,13 @@
1
- # stitchkit — stitchkit docs slice, part 2 of 2
1
+ # stitchkit — stitchkit docs slice, part 2 of 3
2
2
 
3
3
  > Generated from the `docs/` tree by `bun run gen:llms`. The index of all slices is
4
4
  > `llms.txt` in this package.
5
+ > Continues in `llms/stitchkit.3.txt`.
5
6
 
6
7
  Parts of this slice:
7
8
  - `llms/stitchkit.txt`: Guide: Getting started (docs/guide/getting-started.md) · Guide: Typed client (docs/guide/client.md)
8
- - `llms/stitchkit.2.txt`: Guide: Typed client (docs/guide/client.md) · API reference: `stitchkit` (docs/api/reference.md)
9
+ - `llms/stitchkit.2.txt`: Guide: Typed client (docs/guide/client.md)
10
+ - `llms/stitchkit.3.txt`: API reference: `stitchkit` (docs/api/reference.md)
9
11
 
10
12
  Also read:
11
13
  - see `llms/contract.txt` for the Contracts guide
@@ -366,6 +368,8 @@ interface ContractClientConfig {
366
368
  * they are not also sent there (the endpoint's own path `:params` are
367
369
  * stripped automatically; list any *extra* keys here). */
368
370
  stripPrefixKeys?: string[]
371
+ /** Arguments given once for every call — see "Bound arguments" below. */
372
+ bound?: Record<string, unknown>
369
373
  }
370
374
  ```
371
375
 
@@ -386,6 +390,36 @@ List it in `stripPrefixKeys` so it lands in the URL **and is removed from the
386
390
  query/body** — otherwise it would be sent twice. Endpoint path `:params` are
387
391
  stripped for you; only extra prefix keys need listing.
388
392
 
393
+ ### Bound arguments
394
+
395
+ A client that always calls with the same value — a site that knows its `slug` for the whole page
396
+ load, a tenant-scoped service — states the value once in `bound`. The key leaves the arguments of
397
+ every method, in the type and at the call, and a method whose every argument is bound is called
398
+ with none:
399
+
400
+ ```ts
401
+ // site contract: GET /:slug/session, GET /:slug/courses/:courseSlug, POST /:slug/orders { item }
402
+ const site = createClient(siteContract, http, { bound: { slug } })
403
+
404
+ site.session() // GET /api/site/acme/session
405
+ site.course({ courseSlug }) // GET /api/site/acme/courses/intro
406
+ site.order({ item: 'book' }) // POST /api/site/acme/orders body: { item }
407
+ site.session.withOptions({ signal })
408
+ site.course({ slug, courseSlug }) // type error: `slug` is not an argument any more
409
+ ```
410
+
411
+ - The value travels where the caller's argument would: a path parameter, a key `pathPrefix`
412
+ consumes, a query parameter of a `GET` / `DELETE`, a body or multipart field.
413
+ - An endpoint receives a bound key only if it declares it — as a path parameter, a prefix key, or a
414
+ field of its `params` / `input` object schema. A bound `lang` reaches the operations whose input
415
+ has `lang` and is not added to the others.
416
+ - A bound value wins over the same key passed by an untyped caller.
417
+ - `createClients`, `createScopedClients` (per scope), `createUrlBuilder`, `createUrlBuilders` and
418
+ `createScopedUrlBuilders` take the same option. A URL builder binds what a URL carries: path and
419
+ prefix keys, and the input of a `GET` / `DELETE`.
420
+ - Write the object in place (`{ bound: { slug } }`): the keys are read from its type, so a value
421
+ typed `Record<string, string>` names no key and binds nothing in the types.
422
+
389
423
  ## React data layer
390
424
 
391
425
  stitchkit does not ship a hook engine. Pair the typed client with
@@ -695,175 +729,3 @@ may be retried once; do not replay a multi-step callback or treat any `403` as e
695
729
  This is per-instance coordination. Route all writes through it; shared tabs/processes
696
730
  need storage-level locking. Replace the local session counter and refresh queue when
697
731
  adopting these primitives instead of retaining two independent lifetimes.
698
-
699
- ==============================================================================
700
- # API reference: `stitchkit` (docs/api/reference.md)
701
- ==============================================================================
702
-
703
- ## `stitchkit`
704
-
705
- The browser-and-server entrypoint. Re-exports everything from
706
- [`stitchkit/contract`](#stitchkitcontract), plus the client and browser realtime.
707
-
708
- ### Client
709
-
710
- | Export | Kind | Summary |
711
- |--------|------|---------|
712
- | `createClient` | function | build a typed client from a contract — [guide](../guide/client.md#createclient) |
713
- | `createClients` | function | build one exact typed client per contract from a registry; accepts the same scoped config and transports as `createClient` |
714
- | `createScopedClients` | function | build one registry routed by contract scope; arrays compose contracts into one namespace |
715
- | `createScopedUrlBuilders` | function | build one URL registry routed by contract scope; arrays compose contracts into one namespace |
716
- | `ScopeClientConfigs` | _type_ | per-scope routing configuration consumed by scoped clients and URL builders |
717
- | `ScopedClientRegistry` | _type_ | exact composed registry returned by `createScopedClients` |
718
- | `ScopedUrlBuilderRegistry` | _type_ | exact composed registry returned by `createScopedUrlBuilders` |
719
- | `ClientRegistryValue` | _type_ | one contract or a contract array composing one client namespace |
720
- | `ClientContract` | _type_ | HTTP-client-compatible contract value used by scoped registries |
721
- | `RegistryScope` | _type_ | contract-scope union inferred from a scoped client registry value |
722
- | `createUrlBuilder` | function | build synchronous browser-native URLs for all HTTP endpoints; body methods accept URL-bound args only — [guide](../guide/client.md#contract-url-builders) |
723
- | `createUrlBuilders` | function | build one exact URL builder per contract in a registry |
724
- | `readContractIdentity` | function | read the server's contract fingerprint in one call and return it beside the client's own — [guide](../guide/client.md#which-contract-does-the-server-speak) |
725
- | `ContractIdentity` | _type_ | `{ client, server }` fingerprints; `server` is `undefined` when the server answers no identity |
726
- | `UrlBuilderConfig` | _type_ | explicit `{ baseUrl }` source for a URL builder |
727
- | `ClientConfig` | _type_ | config for `createClient`'s bare-fetch mode (2nd arg, no `HttpClient`) |
728
- | `ClientFetch` | _type_ | injectable Fetch-compatible transport used by framework and application-owned adapters |
729
- | `ClientRequestOptions` | _type_ | per-call `{ signal?, onUploadProgress? }` passed through an endpoint callable's `.withOptions(...)`; caller abort is distinct from timeout — [guide](../guide/client.md#per-call-cancellation) |
730
- | `UploadProgress` | _type_ | `{ sentBytes, totalBytes, attempt }` heard by `onUploadProgress`: bytes of the encoded body handed to the network, first `0`, last `totalBytes`, counted again on each transport retry — [guide](../guide/client.md#upload-progress) |
731
- | `uploadInChunks` | function | send a file larger than one request as `init` → parts → `finalize` through three calls the app owns; client-minted id, repeats of a part on a failure that may pass, `finalize` never repeated, cancel checked between parts, progress in file bytes — [guide](../guide/client.md#chunked-uploads) |
732
- | `ChunkedUploadConfig` / `ChunkedUploadStart` / `ChunkedUploadPart` / `ChunkedUploadProgress` | _type_ | the driver's file, part size, retries and three calls; what `init` declares; one part; progress `{ sentBytes, totalBytes, index, chunkCount, attempt }` |
733
- | `ChunkSource` | _type_ | what the driver reads a file through — `size` and `slice(start, end)`; a `Blob` is one, so is a platform file that is not (an Expo `File`), and a part's `bytes` is what its `slice` returns |
734
- | `ContractClientConfig` | _type_ | per-tenant / resource-scoped client config — dynamic `pathPrefix` + `stripPrefixKeys` ([guide](../guide/client.md#contractclientconfig--per-tenant--resource-scoped-clients)) |
735
- | `contractEndpointMatchers` | function | compile exact pathname matchers for selected HTTP contract operations and expected-401 policy |
736
- | `PathPrefixArgs` | _type_ | required string-valued keys exposed to a typed dynamic `pathPrefix` callback |
737
- | `createHttpClient` | function | the Ky-based HTTP transport; on Next.js SSR its first attempt stays request-memoizable while every retry is a distinct transport attempt — [guide](../guide/client.md#createhttpclient) |
738
- | `ApiError` | class | a non-2xx or client failure, with `code` / `status` / `details` / `hint`, optional readonly `traceId` from `x-request-id`, and standard `cause` preserving an injected transport failure |
739
- | `zodIssues` | function | a `ZodError` → structured `{ path, code, message }[]` — the exact projection a `VALIDATION_ERROR` carries in `ApiError.details.issues`, so a caller renders one shape. Also on `stitchkit/server`; same name, one definition |
740
- | `ZodIssueSummary` | _type_ | one structured validation issue (`{ path, code, message }`) — the element type of `details.issues`. Also on `stitchkit/server` |
741
- | `formatZodError` | function | a `ZodError` → a readable, field-summarised string. Also on `stitchkit/server` |
742
- | `HttpClient` | _type_ | the transport interface `createClient` builds on |
743
- | `ConfiguredHttpClient` | _type_ | a framework-created `HttpClient` carrying its readonly `baseUrl` for URL builders |
744
- | `HttpClientConfig` | _type_ | config for `createHttpClient`; retry `limit` counts retries after the initial attempt (default 2 = at most 3 GET attempts), with `statusCodes: []` by default; `fetch` installs an explicit transport and is mutually exclusive with the legacy Bun-only `unix` option — [details](../guide/client.md#createhttpclient) |
745
- | `UnauthorizedMatcher` | _type_ | exact `(pathname) => boolean` policy accepted by `suppressUnauthorizedFor` |
746
- | `RequestOptions` | _type_ | per-call options — params, timeout, response type, `onUploadProgress` |
747
- | `HeaderProvider` | _type_ | static or per-request headers |
748
- | `ApiEvent` | _type_ | a client event — `unauthorized` / `network_error` / `logout` |
749
- | `ApiEventListener` | _type_ | an `ApiEvent` handler |
750
-
751
- ### Realtime (client) & streaming
752
-
753
- | Export | Kind | Summary |
754
- |--------|------|---------|
755
- | `createSocketIOClient` | function | low-level typed Socket.IO transport primitive — [guide](../guide/realtime.md#low-level-transport) |
756
- | `defineRealtimeContract` | function | Zod-first shared Socket.IO event contract — [guide](../guide/realtime.md#zod-first-event-contract) |
757
- | `createRealtimeClient` | function | inferred, runtime-validated Socket.IO client — [guide](../guide/realtime.md#client--createrealtimeclient) |
758
- | `bindRealtimeClient` | function | bind contract validation and typed acknowledgements to an existing Stitchkit client transport without owning its lifecycle |
759
- | `createLiveStateController` | function | keep typed application state current across one source-owned snapshot/event generation with finite pre-snapshot buffering, generation fencing and explicit resync — [guide](../guide/realtime.md#snapshot--event-state-synchronization) |
760
- | `LiveStateController` | _type_ | renderer-neutral `start` / `resync` / `getSnapshot` / `subscribe` / `close` handle |
761
- | `LiveStateControllerConfig` | _type_ | typed source, reducer, explicit event/byte bounds, event sizing and isolated error hooks |
762
- | `LiveStateControllerSnapshot` / `LiveStateControllerStatus` | _types_ | current value plus phase, generation, buffer and application/duplicate/gap/refusal counters |
763
- | `LiveStateControllerStatusSchema` | schema | strict runtime validation for controller status metadata |
764
- | `LiveStatePhaseSchema` / `LiveStatePhase` | schema / _type_ | `idle`, `opening`, `live`, `resync-required`, `unavailable` or `closed` |
765
- | `LiveStateStopReasonSchema` / `LiveStateStopReason` | schema / _type_ | explicit gap, overflow, source loss, controller failure and bounded `controller-capacity` reasons |
766
- | `LiveStateEventDecision` | _type_ | provider-owned reducer result: applied state, duplicate or gap |
767
- | `LiveStateSource` / `LiveStateSourceOpenInput` / `LiveStateSourceOpenResult` | _types_ | host binding for one continuous snapshot/event boundary; transport retry and cursor semantics remain host-owned |
768
- | `LiveStateControllerError` / `LiveStateSubscriberError` | _types_ | isolated observer failure payloads that do not change source or subscriber truth |
769
- | `createRetainedTopics` | function | retained last-value store for sticky events — [guide](../guide/realtime.md#sticky-events) |
770
- | `parseSSE` | function | parse SSE from a `Response`, a web stream or an async byte iterable into an async generator — [guide](../guide/client.md#sse) |
771
- | `parseNDJSON` | function | parse bounded fatal-UTF-8 NDJSON from a `Response`, a `ReadableStream<Uint8Array>` or an `AsyncIterable<Uint8Array>` (a child's stdout); blank keep-alives are skipped, `finalLine: 'require-newline'` makes the delimiter mandatory and `signal` cancels the source — [guide](../guide/client.md#any-byte-source) |
772
- | `createNDJSONDecoder` / `NDJSONDecoder` | function / _type_ | the same bounded NDJSON reading driven by `push(chunk)` / `end()`, for a socket `data` callback |
773
- | `readBoundedBody` / `BoundedBodyOptions` | function / _type_ | the whole body of a `ReadableStream<Uint8Array>` or async byte iterable as bytes, never reading past `maxBytes` plus one chunk; `limitError(observedBytes)` and `abortError(reason)` choose the two errors, the source is cancelled on both, a `null` body is empty — [guide](../guide/client.md#reading-a-body-up-to-a-byte-limit) |
774
- | `StreamByteSource` | _type_ | `Response \| ReadableStream<Uint8Array> \| AsyncIterable<Uint8Array>`, what the NDJSON and SSE readers accept |
775
- | `StreamLineLimitError` / `StreamTruncatedLineError` | class | a line past `maxLineBytes` (`limitBytes`, `lineBytes`; a `RangeError`) and a source ended inside a line under `require-newline` (`lineBytes`; a `SyntaxError`) |
776
- | `resumableIterator` | function | re-open a long-lived stream from the last delivered cursor, with jittered backoff, a caller-owned terminal item and prompt abort — [guide](../guide/client.md#resumable-streams) |
777
- | `createBackoff` | function | exponential backoff with subtractive jitter as a value: `next()` / `reset()` |
778
- | `contractFingerprint` | function | synchronous digest of the operations HTTP carries, whole and per `prefix.key` — [guide](../guide/client.md#which-contract-does-the-server-speak) |
779
- | `ContractFingerprintSchema` / `ContractFingerprint` | schema / _type_ | `{ fingerprint, operations }` — one digest for the set and one per operation |
780
- | `contractIdentityContract` | contract | the operation a server answers its fingerprint with; mount it with `withContractIdentity` |
781
- | `ContractStreamFrameSchema` / `ContractStreamFrame` | schema / _type_ | default on-the-wire `data` / safe `error` / `end` envelope of a contract-first stream |
782
- | `ContractStreamFraming` / `ContractStreamCompletion` | _types_ | opt-in item-vs-envelope framing and terminal-vs-stream-end completion policies |
783
- | `StreamFinalLinePolicy` | _type_ | permissive or newline-required final NDJSON line policy |
784
- | `DEFAULT_CONTRACT_STREAM_FRAME_BYTES` | const | default maximum encoded contract-stream frame: 256 KiB |
785
- | `SocketIOClient` | _type_ | low-level client handle; `emit` reports disconnected drops and `emitWithAck` exposes the native Promise primitive used by validated `request()` |
786
- | `SocketIOClientPeerLoaders` | _type_ | inject `socket.io-client` so a bundler can put it in a self-contained artifact |
787
- | `SocketIOClientConfig` | _type_ | config for `createSocketIOClient` (incl. `retain`, `onConnectError`, `onDroppedEmit`) |
788
- | `SocketEventMap` | _type_ | the shape of an event map |
789
- | `RealtimeClient` | _type_ | validated client inferred from a realtime contract |
790
- | `RealtimeClientOptions` | _type_ | transport options plus rejected-event and metadata-only acknowledged-request phase hooks for `createRealtimeClient` |
791
- | `BoundRealtimeClient` | _type_ | validated non-owning `on`/`emit`/`request` client with no `connect`/`disconnect` |
792
- | `RealtimeClientTransport` | _type_ | minimal existing transport capability accepted by `bindRealtimeClient` |
793
- | `BindRealtimeClientOptions` | _type_ | rejection/logger options for a bound existing transport |
794
- | `RealtimeAcknowledgedEvent` | _type_ | event-name union restricted to definitions with an `ack` schema |
795
- | `RealtimeAcknowledgement` | _type_ | validated acknowledgement output inferred from an event definition |
796
- | `RealtimeRequestArguments` | _type_ | request arguments inferred from an acknowledged event tuple |
797
- | `RealtimeRequestOptions` | _type_ | finite positive native acknowledgement `timeoutMs` plus an optional invocation-scoped `onPhase` observer |
798
- | `RealtimeRequestPhaseSchema` / `RealtimeRequestPhase` | schema / _type_ | closed `engine-handoff` / `engine-ack-received` / `settled` / `timeout` / `disconnected` lifecycle |
799
- | `RealtimeRequestPhaseEventSchema` / `RealtimeRequestPhaseEvent` | schema / _type_ | strict metadata-only `{ requestId, event, phase, elapsedMs }` observation |
800
- | `RealtimeRequestPhaseHook` | _type_ | isolated sync/async observer accepted globally by `RealtimeClientOptions.onRequestPhase` or per invocation by `RealtimeRequestOptions.onPhase` |
801
- | `RealtimeRequestTimeoutError` | class | stable `REALTIME_REQUEST_TIMEOUT` rejection |
802
- | `RealtimeRequestDisconnectedError` | class | stable `REALTIME_REQUEST_DISCONNECTED` rejection, including an immediate disconnected call |
803
- | `RealtimeRequestInvalidAcknowledgementError` | class | invalid ack was reported through `onRejected` and the request rejected |
804
- | `RealtimeRequestRejectedError` | class | the peer refused the frame against its own contract and said so — `reason`, `issues` — instead of leaving the sender to time out ([ADR 0106](../decisions/0106-a-refused-frame-answers-its-sender.md)) |
805
- | `REALTIME_REJECTION_KEY` | const | the reserved acknowledgement key a refusal travels under |
806
- | `RealtimeRejectionEnvelope` | _type_ | the wire shape of a refusal |
807
- | `RealtimeRejectionReport` | _type_ | what the sender is told: event, reason, message, issues |
808
- | `RealtimeRejectionIssue` | _type_ | one refused field, already flattened (`path: '0.v'`) |
809
- | `asRealtimeRejection` | function | recognise a refusal in an acknowledgement value, validating it |
810
- | `RealtimeContract` | _type_ | shared server-to-client and client-to-server event registries |
811
- | `RealtimeEventRegistry` | _type_ | string-keyed registry of event definitions |
812
- | `RealtimeEventDefinition` | _type_ | one tuple-shaped event and optional acknowledgement schema |
813
- | `RealtimeEventArguments` | _type_ | tuple inferred from an event definition |
814
- | `RealtimeEmitArguments` | _type_ | emit arguments including an inferred acknowledgement callback |
815
- | `RealtimeEventHandler` | _type_ | handler inferred from an event definition |
816
- | `InferRealtimeEventMap` | _type_ | inferred Socket.IO-compatible event map |
817
- | `RealtimeRejectDirection` / `RealtimeRejectPhase` / `RealtimeRejectReason` / `RealtimeRejectFault` | _types_ | canonical inferred rejection direction, validation phase, reason and fault classification |
818
- | `RealtimeRejectedEvent` | _type_ | structured rejected event with event, direction, phase, reason and fault |
819
- | `RealtimeRejectedEventHook` | _type_ | sync/async observer for structured realtime rejections |
820
- | `ValidatedRealtimeSocket` | _type_ | runtime-validating `on`/`emit` surface inferred from registries; `emit` returns "accepted by the transport" (`false` only for a client-side disconnected drop) |
821
- | `RetainedTopics` | _type_ | the `createRetainedTopics` handle |
822
- | `ParseSSEOptions` | _type_ | options for `parseSSE` |
823
- | `ParseNDJSONOptions` | _type_ | options for `parseNDJSON` |
824
- | `BackoffPolicySchema` / `BackoffPolicy` | schema / _type_ | `minDelayMs`, `maxDelayMs` and a `0`–`1` jitter fraction; a ceiling below the floor is refused |
825
- | `Backoff` | _type_ | the backoff handle returned by `createBackoff` |
826
- | `ResumableIteratorConfig` | _type_ | caller-owned `open` / `advance` / `isTerminal`, retry policy, abort signal and `onAttempt` observer |
827
- | `ResumableAttempt` | _type_ | attempt number, the delay about to be waited and the error that caused it |
828
-
829
- ### Trace (client)
830
-
831
- Browser-safe W3C trace helpers — the same functions as on
832
- [`stitchkit/observability`](#stitchkitobservability), re-exported so a client
833
- can emit / propagate a `traceparent` (see `HttpClientConfig.trace`).
834
-
835
- | Export | Kind | Summary |
836
- |--------|------|---------|
837
- | `createTraceContext` | function | a fresh root trace |
838
- | `formatTraceparent` | function | render a `traceparent` header value |
839
- | `parseTraceparent` | function | parse a `traceparent` header |
840
- | `childSpan` | function | a child span of a parent trace |
841
- | `TraceContext` | _type_ | `{ traceId, spanId, parentSpanId?, tracestate?, baggage? }` |
842
-
843
- ---
844
-
845
- ### Session lifetime and credential coordination
846
-
847
- `createSessionScope` (`stitchkit`) returns the generic `SessionScope`: `replace(context)`
848
- creates a new login lifetime (including same-account relogin), `capture()` returns
849
- its `SessionOperation<T>`, `clear()` invalidates it, `stop()` permanently closes
850
- the host, and `owns(operation)` answers whether an operation is this scope's current
851
- one — `current()` alone cannot tell an operation of another scope. Operations expose `id`, `generation`, `context`, `signal`, `current()` and
852
- `assertCurrent()`. `run(callback)` checks both success and failure across an await;
853
- `deliver(callback)` admits a synchronous final send/state change or returns false.
854
- `bindFetch(fetch, headers?)` guards every attempt and scopes its abort signal. Wrap
855
- the complete client call in `run` too: headers are not the response body boundary.
856
- Expired work throws `SessionExpiredError`, not a refresh instruction; when the work
857
- itself failed, that failure is its `cause`.
858
-
859
- `createSessionCredentials` accepts `SessionCredentialsConfig`:
860
- `scope`, `refresh(credentials, signal)`, `storage.write(session, credentials)`,
861
- `storage.clear()`, `maxPendingWrites` (128), `refreshTimeoutMs` (30000, at most one
862
- hour) and `storageTimeoutMs` (30000, at most one hour): a storage call past it
863
- rejects and frees the queue, so `logout()` still clears; when the late call settles,
864
- storage is written again from memory, or cleared when nobody is logged in. `SessionCredentials` provides `login`, `logout`, `read(operation)` and
865
- `refresh(operation)`. Concurrent refresh calls in one generation share the same
866
- promise. Logout invalidates memory before its returned persistence promise settles.
867
- Storage errors and queue-capacity refusals reject; callers must handle them. All
868
- writes must pass through the same instance. There is no cross-process/tab lock,
869
- provider error classifier or automatic retry of arbitrary application callbacks.
@@ -0,0 +1,186 @@
1
+ # stitchkit — stitchkit docs slice, part 3 of 3
2
+
3
+ > Generated from the `docs/` tree by `bun run gen:llms`. The index of all slices is
4
+ > `llms.txt` in this package.
5
+
6
+ Parts of this slice:
7
+ - `llms/stitchkit.txt`: Guide: Getting started (docs/guide/getting-started.md) · Guide: Typed client (docs/guide/client.md)
8
+ - `llms/stitchkit.2.txt`: Guide: Typed client (docs/guide/client.md)
9
+ - `llms/stitchkit.3.txt`: API reference: `stitchkit` (docs/api/reference.md)
10
+
11
+ Also read:
12
+ - see `llms/contract.txt` for the Contracts guide
13
+ - see `llms/server.txt` for the Realtime guide
14
+ - see `llms/server.txt` for the Auth & errors guide
15
+
16
+ ==============================================================================
17
+ # API reference: `stitchkit` (docs/api/reference.md)
18
+ ==============================================================================
19
+
20
+ ## `stitchkit`
21
+
22
+ The browser-and-server entrypoint. Re-exports everything from
23
+ [`stitchkit/contract`](#stitchkitcontract), plus the client and browser realtime.
24
+
25
+ ### Client
26
+
27
+ | Export | Kind | Summary |
28
+ |--------|------|---------|
29
+ | `createClient` | function | build a typed client from a contract — [guide](../guide/client.md#createclient) |
30
+ | `createClients` | function | build one exact typed client per contract from a registry; accepts the same scoped config and transports as `createClient` |
31
+ | `createScopedClients` | function | build one registry routed by contract scope; arrays compose contracts into one namespace |
32
+ | `createScopedUrlBuilders` | function | build one URL registry routed by contract scope; arrays compose contracts into one namespace |
33
+ | `ScopeClientConfigs` | _type_ | per-scope routing configuration consumed by scoped clients and URL builders |
34
+ | `ScopedClientRegistry` | _type_ | exact composed registry returned by `createScopedClients` |
35
+ | `ScopedUrlBuilderRegistry` | _type_ | exact composed registry returned by `createScopedUrlBuilders` |
36
+ | `ClientRegistryValue` | _type_ | one contract or a contract array composing one client namespace |
37
+ | `ClientContract` | _type_ | HTTP-client-compatible contract value used by scoped registries |
38
+ | `RegistryScope` | _type_ | contract-scope union inferred from a scoped client registry value |
39
+ | `createUrlBuilder` | function | build synchronous browser-native URLs for all HTTP endpoints; body methods accept URL-bound args only — [guide](../guide/client.md#contract-url-builders) |
40
+ | `createUrlBuilders` | function | build one exact URL builder per contract in a registry |
41
+ | `readContractIdentity` | function | read the server's contract fingerprint in one call and return it beside the client's own — [guide](../guide/client.md#which-contract-does-the-server-speak) |
42
+ | `ContractIdentity` | _type_ | `{ client, server }` fingerprints; `server` is `undefined` when the server answers no identity |
43
+ | `UrlBuilderConfig` | _type_ | explicit `{ baseUrl }` source for a URL builder |
44
+ | `ClientConfig` | _type_ | config for `createClient`'s bare-fetch mode (2nd arg, no `HttpClient`) |
45
+ | `ClientFetch` | _type_ | injectable Fetch-compatible transport used by framework and application-owned adapters |
46
+ | `ClientRequestOptions` | _type_ | per-call `{ signal?, onUploadProgress? }` passed through an endpoint callable's `.withOptions(...)`; caller abort is distinct from timeout — [guide](../guide/client.md#per-call-cancellation) |
47
+ | `UploadProgress` | _type_ | `{ sentBytes, totalBytes, attempt }` heard by `onUploadProgress`: bytes of the encoded body handed to the network, first `0`, last `totalBytes`, counted again on each transport retry — [guide](../guide/client.md#upload-progress) |
48
+ | `uploadInChunks` | function | send a file larger than one request as `init` → parts → `finalize` through three calls the app owns; client-minted id, repeats of a part on a failure that may pass, `finalize` never repeated, cancel checked between parts, progress in file bytes — [guide](../guide/client.md#chunked-uploads) |
49
+ | `ChunkedUploadConfig` / `ChunkedUploadStart` / `ChunkedUploadPart` / `ChunkedUploadProgress` | _type_ | the driver's file, part size, retries and three calls; what `init` declares; one part; progress `{ sentBytes, totalBytes, index, chunkCount, attempt }` |
50
+ | `ChunkSource` | _type_ | what the driver reads a file through — `size` and `slice(start, end)`; a `Blob` is one, so is a platform file that is not (an Expo `File`), and a part's `bytes` is what its `slice` returns |
51
+ | `ContractClientConfig` | _type_ | per-tenant / resource-scoped client config — dynamic `pathPrefix` + `stripPrefixKeys`, and `bound` arguments given once for every call ([guide](../guide/client.md#contractclientconfig--per-tenant--resource-scoped-clients)) |
52
+ | `contractEndpointMatchers` | function | compile exact pathname matchers for selected HTTP contract operations and expected-401 policy |
53
+ | `PathPrefixArgs` | _type_ | required string-valued keys exposed to a typed dynamic `pathPrefix` callback |
54
+ | `createHttpClient` | function | the Ky-based HTTP transport; on Next.js SSR its first attempt stays request-memoizable while every retry is a distinct transport attempt — [guide](../guide/client.md#createhttpclient) |
55
+ | `ApiError` | class | a non-2xx or client failure, with `code` / `status` / `details` / `hint`, optional readonly `traceId` from `x-request-id`, and standard `cause` preserving an injected transport failure |
56
+ | `zodIssues` | function | a `ZodError` → structured `{ path, code, message }[]` — the exact projection a `VALIDATION_ERROR` carries in `ApiError.details.issues`, so a caller renders one shape. Also on `stitchkit/server`; same name, one definition |
57
+ | `ZodIssueSummary` | _type_ | one structured validation issue (`{ path, code, message }`) — the element type of `details.issues`. Also on `stitchkit/server` |
58
+ | `formatZodError` | function | a `ZodError` → a readable, field-summarised string. Also on `stitchkit/server` |
59
+ | `HttpClient` | _type_ | the transport interface `createClient` builds on |
60
+ | `ConfiguredHttpClient` | _type_ | a framework-created `HttpClient` carrying its readonly `baseUrl` for URL builders |
61
+ | `HttpClientConfig` | _type_ | config for `createHttpClient`; retry `limit` counts retries after the initial attempt (default 2 = at most 3 GET attempts), with `statusCodes: []` by default; `fetch` installs an explicit transport and is mutually exclusive with the legacy Bun-only `unix` option — [details](../guide/client.md#createhttpclient) |
62
+ | `UnauthorizedMatcher` | _type_ | exact `(pathname) => boolean` policy accepted by `suppressUnauthorizedFor` |
63
+ | `RequestOptions` | _type_ | per-call options — params, timeout, response type, `onUploadProgress` |
64
+ | `HeaderProvider` | _type_ | static or per-request headers |
65
+ | `ApiEvent` | _type_ | a client event — `unauthorized` / `network_error` / `logout` |
66
+ | `ApiEventListener` | _type_ | an `ApiEvent` handler |
67
+
68
+ ### Realtime (client) & streaming
69
+
70
+ | Export | Kind | Summary |
71
+ |--------|------|---------|
72
+ | `createSocketIOClient` | function | low-level typed Socket.IO transport primitive — [guide](../guide/realtime.md#low-level-transport) |
73
+ | `defineRealtimeContract` | function | Zod-first shared Socket.IO event contract — [guide](../guide/realtime.md#zod-first-event-contract) |
74
+ | `createRealtimeClient` | function | inferred, runtime-validated Socket.IO client — [guide](../guide/realtime.md#client--createrealtimeclient) |
75
+ | `bindRealtimeClient` | function | bind contract validation and typed acknowledgements to an existing Stitchkit client transport without owning its lifecycle |
76
+ | `createLiveStateController` | function | keep typed application state current across one source-owned snapshot/event generation with finite pre-snapshot buffering, generation fencing and explicit resync — [guide](../guide/realtime.md#snapshot--event-state-synchronization) |
77
+ | `LiveStateController` | _type_ | renderer-neutral `start` / `resync` / `getSnapshot` / `subscribe` / `close` handle |
78
+ | `LiveStateControllerConfig` | _type_ | typed source, reducer, explicit event/byte bounds, event sizing and isolated error hooks |
79
+ | `LiveStateControllerSnapshot` / `LiveStateControllerStatus` | _types_ | current value plus phase, generation, buffer and application/duplicate/gap/refusal counters |
80
+ | `LiveStateControllerStatusSchema` | schema | strict runtime validation for controller status metadata |
81
+ | `LiveStatePhaseSchema` / `LiveStatePhase` | schema / _type_ | `idle`, `opening`, `live`, `resync-required`, `unavailable` or `closed` |
82
+ | `LiveStateStopReasonSchema` / `LiveStateStopReason` | schema / _type_ | explicit gap, overflow, source loss, controller failure and bounded `controller-capacity` reasons |
83
+ | `LiveStateEventDecision` | _type_ | provider-owned reducer result: applied state, duplicate or gap |
84
+ | `LiveStateSource` / `LiveStateSourceOpenInput` / `LiveStateSourceOpenResult` | _types_ | host binding for one continuous snapshot/event boundary; transport retry and cursor semantics remain host-owned |
85
+ | `LiveStateControllerError` / `LiveStateSubscriberError` | _types_ | isolated observer failure payloads that do not change source or subscriber truth |
86
+ | `createRetainedTopics` | function | retained last-value store for sticky events — [guide](../guide/realtime.md#sticky-events) |
87
+ | `parseSSE` | function | parse SSE from a `Response`, a web stream or an async byte iterable into an async generator — [guide](../guide/client.md#sse) |
88
+ | `parseNDJSON` | function | parse bounded fatal-UTF-8 NDJSON from a `Response`, a `ReadableStream<Uint8Array>` or an `AsyncIterable<Uint8Array>` (a child's stdout); blank keep-alives are skipped, `finalLine: 'require-newline'` makes the delimiter mandatory and `signal` cancels the source — [guide](../guide/client.md#any-byte-source) |
89
+ | `createNDJSONDecoder` / `NDJSONDecoder` | function / _type_ | the same bounded NDJSON reading driven by `push(chunk)` / `end()`, for a socket `data` callback |
90
+ | `readBoundedBody` / `BoundedBodyOptions` | function / _type_ | the whole body of a `ReadableStream<Uint8Array>` or async byte iterable as bytes, never reading past `maxBytes` plus one chunk; `limitError(observedBytes)` and `abortError(reason)` choose the two errors, the source is cancelled on both, a `null` body is empty — [guide](../guide/client.md#reading-a-body-up-to-a-byte-limit) |
91
+ | `StreamByteSource` | _type_ | `Response \| ReadableStream<Uint8Array> \| AsyncIterable<Uint8Array>`, what the NDJSON and SSE readers accept |
92
+ | `StreamLineLimitError` / `StreamTruncatedLineError` | class | a line past `maxLineBytes` (`limitBytes`, `lineBytes`; a `RangeError`) and a source ended inside a line under `require-newline` (`lineBytes`; a `SyntaxError`) |
93
+ | `resumableIterator` | function | re-open a long-lived stream from the last delivered cursor, with jittered backoff, a caller-owned terminal item and prompt abort — [guide](../guide/client.md#resumable-streams) |
94
+ | `createBackoff` | function | exponential backoff with subtractive jitter as a value: `next()` / `reset()` |
95
+ | `contractFingerprint` | function | synchronous digest of the operations HTTP carries, whole and per `prefix.key` — [guide](../guide/client.md#which-contract-does-the-server-speak) |
96
+ | `ContractFingerprintSchema` / `ContractFingerprint` | schema / _type_ | `{ fingerprint, operations }` — one digest for the set and one per operation |
97
+ | `contractIdentityContract` | contract | the operation a server answers its fingerprint with; mount it with `withContractIdentity` |
98
+ | `ContractStreamFrameSchema` / `ContractStreamFrame` | schema / _type_ | default on-the-wire `data` / safe `error` / `end` envelope of a contract-first stream |
99
+ | `ContractStreamFraming` / `ContractStreamCompletion` | _types_ | opt-in item-vs-envelope framing and terminal-vs-stream-end completion policies |
100
+ | `StreamFinalLinePolicy` | _type_ | permissive or newline-required final NDJSON line policy |
101
+ | `DEFAULT_CONTRACT_STREAM_FRAME_BYTES` | const | default maximum encoded contract-stream frame: 256 KiB |
102
+ | `SocketIOClient` | _type_ | low-level client handle; `emit` reports disconnected drops and `emitWithAck` exposes the native Promise primitive used by validated `request()` |
103
+ | `SocketIOClientPeerLoaders` | _type_ | inject `socket.io-client` so a bundler can put it in a self-contained artifact |
104
+ | `SocketIOClientConfig` | _type_ | config for `createSocketIOClient` (incl. `retain`, `onConnectError`, `onDroppedEmit`) |
105
+ | `SocketEventMap` | _type_ | the shape of an event map |
106
+ | `RealtimeClient` | _type_ | validated client inferred from a realtime contract |
107
+ | `RealtimeClientOptions` | _type_ | transport options plus rejected-event and metadata-only acknowledged-request phase hooks for `createRealtimeClient` |
108
+ | `BoundRealtimeClient` | _type_ | validated non-owning `on`/`emit`/`request` client with no `connect`/`disconnect` |
109
+ | `RealtimeClientTransport` | _type_ | minimal existing transport capability accepted by `bindRealtimeClient` |
110
+ | `BindRealtimeClientOptions` | _type_ | rejection/logger options for a bound existing transport |
111
+ | `RealtimeAcknowledgedEvent` | _type_ | event-name union restricted to definitions with an `ack` schema |
112
+ | `RealtimeAcknowledgement` | _type_ | validated acknowledgement output inferred from an event definition |
113
+ | `RealtimeRequestArguments` | _type_ | request arguments inferred from an acknowledged event tuple |
114
+ | `RealtimeRequestOptions` | _type_ | finite positive native acknowledgement `timeoutMs` plus an optional invocation-scoped `onPhase` observer |
115
+ | `RealtimeRequestPhaseSchema` / `RealtimeRequestPhase` | schema / _type_ | closed `engine-handoff` / `engine-ack-received` / `settled` / `timeout` / `disconnected` lifecycle |
116
+ | `RealtimeRequestPhaseEventSchema` / `RealtimeRequestPhaseEvent` | schema / _type_ | strict metadata-only `{ requestId, event, phase, elapsedMs }` observation |
117
+ | `RealtimeRequestPhaseHook` | _type_ | isolated sync/async observer accepted globally by `RealtimeClientOptions.onRequestPhase` or per invocation by `RealtimeRequestOptions.onPhase` |
118
+ | `RealtimeRequestTimeoutError` | class | stable `REALTIME_REQUEST_TIMEOUT` rejection |
119
+ | `RealtimeRequestDisconnectedError` | class | stable `REALTIME_REQUEST_DISCONNECTED` rejection, including an immediate disconnected call |
120
+ | `RealtimeRequestInvalidAcknowledgementError` | class | invalid ack was reported through `onRejected` and the request rejected |
121
+ | `RealtimeRequestRejectedError` | class | the peer refused the frame against its own contract and said so — `reason`, `issues` — instead of leaving the sender to time out ([ADR 0106](../decisions/0106-a-refused-frame-answers-its-sender.md)) |
122
+ | `REALTIME_REJECTION_KEY` | const | the reserved acknowledgement key a refusal travels under |
123
+ | `RealtimeRejectionEnvelope` | _type_ | the wire shape of a refusal |
124
+ | `RealtimeRejectionReport` | _type_ | what the sender is told: event, reason, message, issues |
125
+ | `RealtimeRejectionIssue` | _type_ | one refused field, already flattened (`path: '0.v'`) |
126
+ | `asRealtimeRejection` | function | recognise a refusal in an acknowledgement value, validating it |
127
+ | `RealtimeContract` | _type_ | shared server-to-client and client-to-server event registries |
128
+ | `RealtimeEventRegistry` | _type_ | string-keyed registry of event definitions |
129
+ | `RealtimeEventDefinition` | _type_ | one tuple-shaped event and optional acknowledgement schema |
130
+ | `RealtimeEventArguments` | _type_ | tuple inferred from an event definition |
131
+ | `RealtimeEmitArguments` | _type_ | emit arguments including an inferred acknowledgement callback |
132
+ | `RealtimeEventHandler` | _type_ | handler inferred from an event definition |
133
+ | `InferRealtimeEventMap` | _type_ | inferred Socket.IO-compatible event map |
134
+ | `RealtimeRejectDirection` / `RealtimeRejectPhase` / `RealtimeRejectReason` / `RealtimeRejectFault` | _types_ | canonical inferred rejection direction, validation phase, reason and fault classification |
135
+ | `RealtimeRejectedEvent` | _type_ | structured rejected event with event, direction, phase, reason and fault |
136
+ | `RealtimeRejectedEventHook` | _type_ | sync/async observer for structured realtime rejections |
137
+ | `ValidatedRealtimeSocket` | _type_ | runtime-validating `on`/`emit` surface inferred from registries; `emit` returns "accepted by the transport" (`false` only for a client-side disconnected drop) |
138
+ | `RetainedTopics` | _type_ | the `createRetainedTopics` handle |
139
+ | `ParseSSEOptions` | _type_ | options for `parseSSE` |
140
+ | `ParseNDJSONOptions` | _type_ | options for `parseNDJSON` |
141
+ | `BackoffPolicySchema` / `BackoffPolicy` | schema / _type_ | `minDelayMs`, `maxDelayMs` and a `0`–`1` jitter fraction; a ceiling below the floor is refused |
142
+ | `Backoff` | _type_ | the backoff handle returned by `createBackoff` |
143
+ | `ResumableIteratorConfig` | _type_ | caller-owned `open` / `advance` / `isTerminal`, retry policy, abort signal and `onAttempt` observer |
144
+ | `ResumableAttempt` | _type_ | attempt number, the delay about to be waited and the error that caused it |
145
+
146
+ ### Trace (client)
147
+
148
+ Browser-safe W3C trace helpers — the same functions as on
149
+ [`stitchkit/observability`](#stitchkitobservability), re-exported so a client
150
+ can emit / propagate a `traceparent` (see `HttpClientConfig.trace`).
151
+
152
+ | Export | Kind | Summary |
153
+ |--------|------|---------|
154
+ | `createTraceContext` | function | a fresh root trace |
155
+ | `formatTraceparent` | function | render a `traceparent` header value |
156
+ | `parseTraceparent` | function | parse a `traceparent` header |
157
+ | `childSpan` | function | a child span of a parent trace |
158
+ | `TraceContext` | _type_ | `{ traceId, spanId, parentSpanId?, tracestate?, baggage? }` |
159
+
160
+ ---
161
+
162
+ ### Session lifetime and credential coordination
163
+
164
+ `createSessionScope` (`stitchkit`) returns the generic `SessionScope`: `replace(context)`
165
+ creates a new login lifetime (including same-account relogin), `capture()` returns
166
+ its `SessionOperation<T>`, `clear()` invalidates it, `stop()` permanently closes
167
+ the host, and `owns(operation)` answers whether an operation is this scope's current
168
+ one — `current()` alone cannot tell an operation of another scope. Operations expose `id`, `generation`, `context`, `signal`, `current()` and
169
+ `assertCurrent()`. `run(callback)` checks both success and failure across an await;
170
+ `deliver(callback)` admits a synchronous final send/state change or returns false.
171
+ `bindFetch(fetch, headers?)` guards every attempt and scopes its abort signal. Wrap
172
+ the complete client call in `run` too: headers are not the response body boundary.
173
+ Expired work throws `SessionExpiredError`, not a refresh instruction; when the work
174
+ itself failed, that failure is its `cause`.
175
+
176
+ `createSessionCredentials` accepts `SessionCredentialsConfig`:
177
+ `scope`, `refresh(credentials, signal)`, `storage.write(session, credentials)`,
178
+ `storage.clear()`, `maxPendingWrites` (128), `refreshTimeoutMs` (30000, at most one
179
+ hour) and `storageTimeoutMs` (30000, at most one hour): a storage call past it
180
+ rejects and frees the queue, so `logout()` still clears; when the late call settles,
181
+ storage is written again from memory, or cleared when nobody is logged in. `SessionCredentials` provides `login`, `logout`, `read(operation)` and
182
+ `refresh(operation)`. Concurrent refresh calls in one generation share the same
183
+ promise. Logout invalidates memory before its returned persistence promise settles.
184
+ Storage errors and queue-capacity refusals reject; callers must handle them. All
185
+ writes must pass through the same instance. There is no cross-process/tab lock,
186
+ provider error classifier or automatic retry of arbitrary application callbacks.
@@ -1,4 +1,4 @@
1
- # stitchkit — stitchkit docs slice, part 1 of 2
1
+ # stitchkit — stitchkit docs slice, part 1 of 3
2
2
 
3
3
  > Generated from the `docs/` tree by `bun run gen:llms`. The index of all slices is
4
4
  > `llms.txt` in this package.
@@ -6,7 +6,8 @@
6
6
 
7
7
  Parts of this slice:
8
8
  - `llms/stitchkit.txt`: Guide: Getting started (docs/guide/getting-started.md) · Guide: Typed client (docs/guide/client.md)
9
- - `llms/stitchkit.2.txt`: Guide: Typed client (docs/guide/client.md) · API reference: `stitchkit` (docs/api/reference.md)
9
+ - `llms/stitchkit.2.txt`: Guide: Typed client (docs/guide/client.md)
10
+ - `llms/stitchkit.3.txt`: API reference: `stitchkit` (docs/api/reference.md)
10
11
 
11
12
  Also read:
12
13
  - see `llms/contract.txt` for the Contracts guide
package/llms-full.txt CHANGED
@@ -3615,6 +3615,8 @@ interface ContractClientConfig {
3615
3615
  * they are not also sent there (the endpoint's own path `:params` are
3616
3616
  * stripped automatically; list any *extra* keys here). */
3617
3617
  stripPrefixKeys?: string[]
3618
+ /** Arguments given once for every call — see "Bound arguments" below. */
3619
+ bound?: Record<string, unknown>
3618
3620
  }
3619
3621
  ```
3620
3622
 
@@ -3635,6 +3637,36 @@ List it in `stripPrefixKeys` so it lands in the URL **and is removed from the
3635
3637
  query/body** — otherwise it would be sent twice. Endpoint path `:params` are
3636
3638
  stripped for you; only extra prefix keys need listing.
3637
3639
 
3640
+ ### Bound arguments
3641
+
3642
+ A client that always calls with the same value — a site that knows its `slug` for the whole page
3643
+ load, a tenant-scoped service — states the value once in `bound`. The key leaves the arguments of
3644
+ every method, in the type and at the call, and a method whose every argument is bound is called
3645
+ with none:
3646
+
3647
+ ```ts
3648
+ // site contract: GET /:slug/session, GET /:slug/courses/:courseSlug, POST /:slug/orders { item }
3649
+ const site = createClient(siteContract, http, { bound: { slug } })
3650
+
3651
+ site.session() // GET /api/site/acme/session
3652
+ site.course({ courseSlug }) // GET /api/site/acme/courses/intro
3653
+ site.order({ item: 'book' }) // POST /api/site/acme/orders body: { item }
3654
+ site.session.withOptions({ signal })
3655
+ site.course({ slug, courseSlug }) // type error: `slug` is not an argument any more
3656
+ ```
3657
+
3658
+ - The value travels where the caller's argument would: a path parameter, a key `pathPrefix`
3659
+ consumes, a query parameter of a `GET` / `DELETE`, a body or multipart field.
3660
+ - An endpoint receives a bound key only if it declares it — as a path parameter, a prefix key, or a
3661
+ field of its `params` / `input` object schema. A bound `lang` reaches the operations whose input
3662
+ has `lang` and is not added to the others.
3663
+ - A bound value wins over the same key passed by an untyped caller.
3664
+ - `createClients`, `createScopedClients` (per scope), `createUrlBuilder`, `createUrlBuilders` and
3665
+ `createScopedUrlBuilders` take the same option. A URL builder binds what a URL carries: path and
3666
+ prefix keys, and the input of a `GET` / `DELETE`.
3667
+ - Write the object in place (`{ bound: { slug } }`): the keys are read from its type, so a value
3668
+ typed `Record<string, string>` names no key and binds nothing in the types.
3669
+
3638
3670
  ## React data layer
3639
3671
 
3640
3672
  stitchkit does not ship a hook engine. Pair the typed client with
@@ -23034,7 +23066,7 @@ The browser-and-server entrypoint. Re-exports everything from
23034
23066
  | `uploadInChunks` | function | send a file larger than one request as `init` → parts → `finalize` through three calls the app owns; client-minted id, repeats of a part on a failure that may pass, `finalize` never repeated, cancel checked between parts, progress in file bytes — [guide](../guide/client.md#chunked-uploads) |
23035
23067
  | `ChunkedUploadConfig` / `ChunkedUploadStart` / `ChunkedUploadPart` / `ChunkedUploadProgress` | _type_ | the driver's file, part size, retries and three calls; what `init` declares; one part; progress `{ sentBytes, totalBytes, index, chunkCount, attempt }` |
23036
23068
  | `ChunkSource` | _type_ | what the driver reads a file through — `size` and `slice(start, end)`; a `Blob` is one, so is a platform file that is not (an Expo `File`), and a part's `bytes` is what its `slice` returns |
23037
- | `ContractClientConfig` | _type_ | per-tenant / resource-scoped client config — dynamic `pathPrefix` + `stripPrefixKeys` ([guide](../guide/client.md#contractclientconfig--per-tenant--resource-scoped-clients)) |
23069
+ | `ContractClientConfig` | _type_ | per-tenant / resource-scoped client config — dynamic `pathPrefix` + `stripPrefixKeys`, and `bound` arguments given once for every call ([guide](../guide/client.md#contractclientconfig--per-tenant--resource-scoped-clients)) |
23038
23070
  | `contractEndpointMatchers` | function | compile exact pathname matchers for selected HTTP contract operations and expected-401 policy |
23039
23071
  | `PathPrefixArgs` | _type_ | required string-valued keys exposed to a typed dynamic `pathPrefix` callback |
23040
23072
  | `createHttpClient` | function | the Ky-based HTTP transport; on Next.js SSR its first attempt stays request-memoizable while every retry is a distinct transport attempt — [guide](../guide/client.md#createhttpclient) |
package/llms.txt CHANGED
@@ -9,7 +9,7 @@ Build with stitchkit: define a contract once, then `implement` it and serve it (
9
9
  Load the slice for each entrypoint your code imports — `import … from 'stitchkit/server'` → `llms/server.txt`; the root `stitchkit` import → `llms/stitchkit.txt`. A slice holds that entrypoint's API reference section and the guide pages whose home it is; every guide lives in exactly one slice, and a slice that needs another's guide names it under "Also read". Each file is at most 50.0 KB; a longer one continues in numbered parts, each naming the next at its top. Moving across versions: load `llms/upgrading.txt` and the range slices it lists between your version and the target. `llms-full.txt` inlines everything; it is far larger than a context window, so do not read it whole.
10
10
 
11
11
  ## Entrypoint slices
12
- - **stitchkit**: [llms/stitchkit.txt](llms/stitchkit.txt) 44.8 KB → [llms/stitchkit.2.txt](llms/stitchkit.2.txt) 47.4 KB
12
+ - **stitchkit**: [llms/stitchkit.txt](llms/stitchkit.txt) 44.8 KB → [llms/stitchkit.2.txt](llms/stitchkit.2.txt) 30.9 KB → [llms/stitchkit.3.txt](llms/stitchkit.3.txt) 19.1 KB
13
13
  - **stitchkit/live**: [llms/live.txt](llms/live.txt) 21.2 KB
14
14
  - **stitchkit/react**: [llms/react.txt](llms/react.txt) 8.7 KB
15
15
  - **stitchkit/react/keyboard**: [llms/react-keyboard.txt](llms/react-keyboard.txt) 22.7 KB
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stitchkit",
3
- "version": "0.123.1",
3
+ "version": "0.123.2",
4
4
  "description": "Contract-first backend framework — one defineContract() into an HTTP API, MCP tools, AI-agent tools and a typed client. Bun and Node.",
5
5
  "keywords": [
6
6
  "bun",