stitchkit 0.49.1 → 0.50.0

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.
@@ -1,18 +1,20 @@
1
1
  /**
2
2
  * Declare an application's domain errors once. Each definition owns its HTTP
3
- * status and optional Zod schema for structured details; generated factories
4
- * construct (but do not throw) branded `AppError` instances.
3
+ * status, its default message and an optional Zod schema for structured
4
+ * details; generated factories construct (but do not throw) branded `AppError`
5
+ * instances.
5
6
  *
6
7
  * ```ts
7
8
  * export const appErrors = defineErrors({
8
- * SESSION_NOT_FOUND: { status: 404 },
9
+ * SESSION_NOT_FOUND: { status: 404, message: 'No such session' },
9
10
  * QUOTA_EXCEEDED: {
10
11
  * status: 429,
12
+ * message: 'Monthly quota exhausted',
11
13
  * details: z.object({ retryAfterSeconds: z.number().int().positive() }),
12
14
  * },
13
15
  * })
14
16
  *
15
- * throw appErrors.errors.SESSION_NOT_FOUND({ message: 'No such session' })
17
+ * throw appErrors.errors.SESSION_NOT_FOUND()
16
18
  * throw appErrors.errors.QUOTA_EXCEEDED({
17
19
  * details: { retryAfterSeconds: 30 },
18
20
  * hint: 'Wait for the current window to expire',
@@ -23,12 +25,20 @@ import { z } from 'zod';
23
25
  import { AppError } from './errors';
24
26
  /** Supported structured-details schemas: a required or optional Zod object. */
25
27
  export type ErrorDetailsSchema = z.ZodObject | z.ZodOptional<z.ZodObject>;
26
- /** One domain error definition. Omitting `details` forbids structured details. */
28
+ /**
29
+ * One domain error definition. Omitting `details` forbids structured details.
30
+ *
31
+ * `message` is the code's default human-readable text: without it `AppError`
32
+ * falls back to the code itself, and every `throw` site has to repeat the
33
+ * sentence. A per-call `message` still wins.
34
+ */
27
35
  export type ErrorDefinition = {
28
36
  readonly status: number;
37
+ readonly message?: string;
29
38
  readonly details?: never;
30
39
  } | {
31
40
  readonly status: number;
41
+ readonly message?: string;
32
42
  readonly details: ErrorDetailsSchema;
33
43
  };
34
44
  export type ErrorDefinitions = Record<string, ErrorDefinition>;
@@ -70,8 +80,19 @@ export type ErrorFactory<TCode extends string, TDefinition extends ErrorDefiniti
70
80
  export type ErrorFactories<TDefinitions extends ErrorDefinitions> = {
71
81
  readonly [TCode in keyof TDefinitions]: ErrorFactory<TCode & string, TDefinitions[TCode]>;
72
82
  };
83
+ /**
84
+ * `const` inference keeps only the keys a definition actually wrote, so a
85
+ * registry that mixes codes with and without `message` has no common `message`
86
+ * key — and `definitions[code].message`, the whole point of declaring it, would
87
+ * not type-check. Normalising the optional key restores that lookup.
88
+ *
89
+ * A declared literal stays literal (`'gone' & string` is `'gone'`); this only
90
+ * adds the key where a definition omitted it.
91
+ */
73
92
  export type FrozenErrorDefinitions<TDefinitions extends ErrorDefinitions> = {
74
- readonly [TCode in keyof TDefinitions]: Readonly<TDefinitions[TCode]>;
93
+ readonly [TCode in keyof TDefinitions]: Readonly<TDefinitions[TCode]> & {
94
+ readonly message?: string;
95
+ };
75
96
  };
76
97
  /** The immutable handle returned by `defineErrors`. */
77
98
  export interface DefinedErrors<TDefinitions extends ErrorDefinitions> {
@@ -1 +1 @@
1
- {"version":3,"file":"errors-factory.d.ts","sourceRoot":"","sources":["../../src/contract/errors-factory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEpC,+EAA+E;AAC/E,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;AAE1E,kFAAkF;AAClF,MAAM,MAAM,eAAe,GACvB;IAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,KAAK,CAAA;CAAE,GACrD;IAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,OA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40
40
  };
41
41
  }
42
+ /**
43
+ * An endpoint authored through the factory: the per-endpoint `scope` override is
44
+ * held to the same union as the contract's.
45
+ *
46
+ * Constraining the type parameter (rather than intersecting the argument) keeps
47
+ * `T` itself unchanged, so `ExplicitToolExposureEndpoints<T>` and the boundary
48
+ * mapping below still see the endpoints the caller wrote. The check is
49
+ * structural, so it also covers `HeadEndpointDef`, which declares its own
50
+ * `scope` outside `EndpointDefBase`.
51
+ */
52
+ export type FactoryScopedEndpoint<TScope extends string> = EndpointDef & {
53
+ scope?: TScope;
54
+ };
42
55
  /** A `defineContract` whose `scope` is required and typed to `TScope`. */
43
- export type ScopedDefineContract<TScope extends string> = <const TContractScope extends TScope, const T extends Record<string, EndpointDef>>(meta: {
56
+ export type ScopedDefineContract<TScope extends string> = <const TContractScope extends TScope, const T extends Record<string, FactoryScopedEndpoint<TScope>>>(meta: {
44
57
  prefix: string;
45
58
  scope: TContractScope;
46
59
  meta?: Record<string, unknown>;
47
60
  }, endpoints: T) => ScopedContractDef<T, TContractScope>;
48
61
  /** Scoped contract authoring where every omitted exposure becomes HTTP-only. */
49
- export type ExplicitScopedDefineContract<TScope extends string> = <const TContractScope extends TScope, const T extends Record<string, EndpointDef>>(meta: {
62
+ export type ExplicitScopedDefineContract<TScope extends string> = <const TContractScope extends TScope, const T extends Record<string, FactoryScopedEndpoint<TScope>>>(meta: {
50
63
  prefix: string;
51
64
  scope: TContractScope;
52
65
  meta?: Record<string, unknown>;
@@ -1 +1 @@
1
- {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../src/contract/factory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAGlF,MAAM,MAAM,2BAA2B,GAAG,UAAU,CAAC;AAErD,MAAM,WAAW,qBAAqB;IACpC,iFAAiF;IACjF,YAAY,EAAE,2BAA2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6B,CAAC,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC;AAEzE;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,SAAS,MAAM,KAAK;IAC9D,cAAc,EAAE,oBAAoB,CAAC,MAAM,CAAC,CAAC;CAC9C,CAAC;AACF,wBAAgB,qBAAqB,CAAC,MAAM,SAAS,MAAM,EACzD,MAAM,EAAE,qBAAqB,GAC5B;IACD,cAAc,EAAE,4BAA4B,CAAC,MAAM,CAAC,CAAC;CACtD,CAAC"}
@@ -1,6 +1,6 @@
1
1
  export { ALL_TRANSPORTS, type BodyHttpSuccessStatus, type ClientRequestOptions, type ContractDef, type ContractMeta, defineContract, type EndpointDef, type EndpointFn, type EndpointMcpInputRequired, type EndpointMcpPolicy, type EndpointResponseMeta, type EndpointToolAnnotations, type EndpointUiMeta, type FileDescriptor, type HandlerContext, type HeadEndpointDef, type HttpMethod, type HttpSuccessStatus, type MultipartBufferedFiles, type MultipartDescriptor, type MultipartFile, type MultipartFilePolicy, type ResponseMetadata, type RuntimeContext, type ScopedEndpointFn, type ScopedHttpClient, type ScopedUrlBuilder, type ScopedUrlFn, type Transport, type TransportSource, type TypedClient, type TypedHttpClient, type TypedUrlBuilder, } from './define';
2
2
  export { AppError, appError, badRequest, conflict, type ErrorEnvelope, forbidden, isStitchErrorCode, notFound, rateLimited, STITCH_ERROR_STATUS, type StitchErrorCode, unauthorized, } from './errors';
3
3
  export { type DefinedAppError, type DefinedErrors, defineErrors, type ErrorDefinition, type ErrorDefinitions, type ErrorDetailsOutput, type ErrorDetailsSchema, type ErrorFactories, type ErrorFactory, type ErrorFactoryArguments, type FrozenErrorDefinitions, } from './errors-factory';
4
- export { type ContractFactoryConfig, type ContractFactoryToolExposure, createContractFactory, type ExplicitScopedDefineContract, type ExplicitToolExposureEndpoints, type ScopedContractDef, type ScopedDefineContract, } from './factory';
4
+ export { type ContractFactoryConfig, type ContractFactoryToolExposure, createContractFactory, type ExplicitScopedDefineContract, type ExplicitToolExposureEndpoints, type FactoryScopedEndpoint, type ScopedContractDef, type ScopedDefineContract, } from './factory';
5
5
  export { decodeCursor, encodeCursor, type Paginated, paginatedSchema, } from './pagination';
6
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/contract/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EACzB,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,cAAc,EACd,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,wBAAwB,EAC7B,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,EACzB,KAAK,uBAAuB,EAC5B,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,UAAU,EACf,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACxB,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,eAAe,GACrB,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,KAAK,aAAa,EAClB,SAAS,EACT,iBAAiB,EACjB,QAAQ,EACR,WAAW,EACX,mBAAmB,EACnB,KAAK,eAAe,EACpB,YAAY,GACb,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,YAAY,EACZ,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,GAC5B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,KAAK,qBAAqB,EAC1B,KAAK,2BAA2B,EAChC,qBAAqB,EACrB,KAAK,4BAA4B,EACjC,KAAK,6BAA6B,EAClC,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,GAC1B,MAAM,WAAW,CAAC;AAEnB,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,KAAK,SAAS,EACd,eAAe,GAChB,MAAM,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/contract/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EACzB,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,cAAc,EACd,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,wBAAwB,EAC7B,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,EACzB,KAAK,uBAAuB,EAC5B,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,UAAU,EACf,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACxB,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,eAAe,GACrB,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,KAAK,aAAa,EAClB,SAAS,EACT,iBAAiB,EACjB,QAAQ,EACR,WAAW,EACX,mBAAmB,EACnB,KAAK,eAAe,EACpB,YAAY,GACb,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,YAAY,EACZ,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,GAC5B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,KAAK,qBAAqB,EAC1B,KAAK,2BAA2B,EAChC,qBAAqB,EACrB,KAAK,4BAA4B,EACjC,KAAK,6BAA6B,EAClC,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,GAC1B,MAAM,WAAW,CAAC;AAEnB,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,KAAK,SAAS,EACd,eAAe,GAChB,MAAM,cAAc,CAAC"}
@@ -16,7 +16,7 @@ import {
16
16
  paginatedSchema,
17
17
  rateLimited,
18
18
  unauthorized
19
- } from "../index-45dz4m51.js";
19
+ } from "../index-trz4ate5.js";
20
20
  import"../index-tss6bk5c.js";
21
21
  export {
22
22
  unauthorized,
@@ -1612,8 +1612,11 @@ function isStreamingImplementation(value) {
1612
1612
  return typeof value === "object" && value !== null && "kind" in value && value.kind === "stitchkit.multipart.stream";
1613
1613
  }
1614
1614
  function defineMultipartStream(endpoint, config) {
1615
+ return buildMultipartStream(endpoint, config.files, config.handler);
1616
+ }
1617
+ function buildMultipartStream(endpoint, files, handler) {
1615
1618
  const receivers = {};
1616
- for (const [key, receiver] of typedEntries(config.files)) {
1619
+ for (const [key, receiver] of typedEntries(files)) {
1617
1620
  receivers[String(key)] = receiver;
1618
1621
  }
1619
1622
  const declared = Object.keys(endpoint.multipart.files);
@@ -1624,11 +1627,14 @@ function defineMultipartStream(endpoint, config) {
1624
1627
  return {
1625
1628
  kind: "stitchkit.multipart.stream",
1626
1629
  receivers,
1627
- execute(ctx, files) {
1628
- return callRuntimeHandler(config.handler, { ...ctx, files });
1630
+ execute(ctx, streamedFiles) {
1631
+ return callRuntimeHandler(handler, { ...ctx, files: streamedFiles });
1629
1632
  }
1630
1633
  };
1631
1634
  }
1635
+ function createMultipartStream() {
1636
+ return (endpoint, config) => buildMultipartStream(endpoint, config.files, config.handler);
1637
+ }
1632
1638
  var HTTP_ONLY = Object.freeze(["HTTP"]);
1633
1639
  function bindContract(contract, handlers) {
1634
1640
  const methods = {};
@@ -1689,6 +1695,19 @@ function implement(contract, handlers) {
1689
1695
  function createImplement() {
1690
1696
  return (contract, handlers) => implement(contract, handlers);
1691
1697
  }
1698
+ function createScopedImplement() {
1699
+ const implementScoped = (contract, handlers) => bindContract(contract, handlers);
1700
+ const stream = (scope, endpoint, config) => {
1701
+ if (endpoint.scope !== undefined && endpoint.scope !== scope) {
1702
+ throw new Error(`[stitchkit] createScopedImplement.stream: endpoint declares scope "${endpoint.scope}" but "${String(scope)}" was given`);
1703
+ }
1704
+ return buildMultipartStream(endpoint, config.files, config.handler);
1705
+ };
1706
+ return Object.assign(implementScoped, { stream });
1707
+ }
1708
+ function createScopedImplementRegistry() {
1709
+ return (contracts, handlers) => bindRegistry(contracts, handlers);
1710
+ }
1692
1711
  function isImplementationContract(value) {
1693
1712
  return isRecord(value) && isRecord(value.meta) && typeof value.meta.prefix === "string" && isRecord(value.endpoints);
1694
1713
  }
@@ -1734,6 +1753,140 @@ function createImplementRegistry() {
1734
1753
  return (contracts, handlers) => bindRegistry(contracts, handlers);
1735
1754
  }
1736
1755
 
1756
+ // src/server/process-signals.ts
1757
+ var DEFAULT_SIGNALS = ["SIGINT", "SIGTERM"];
1758
+ var defaultSignalSource = {
1759
+ on: (signal, handler) => {
1760
+ process.on(signal, handler);
1761
+ },
1762
+ off: (signal, handler) => {
1763
+ process.off(signal, handler);
1764
+ },
1765
+ raiseDefault: (signal) => {
1766
+ if (process.listenerCount(signal) > 0)
1767
+ return false;
1768
+ process.kill(process.pid, signal);
1769
+ return true;
1770
+ }
1771
+ };
1772
+ var bound = new WeakSet;
1773
+ function reportError(phase, error, onError) {
1774
+ try {
1775
+ onError?.(phase, error);
1776
+ } catch {}
1777
+ }
1778
+ function guard(run, phase, onError) {
1779
+ try {
1780
+ run();
1781
+ } catch (error) {
1782
+ reportError(phase, error, onError);
1783
+ }
1784
+ }
1785
+ function bindProcessSignals(handle, options = {}) {
1786
+ if (bound.has(handle)) {
1787
+ throw new Error("[stitchkit] bindProcessSignals: this server is already bound; close the first binding before creating another");
1788
+ }
1789
+ bound.add(handle);
1790
+ const signals = [...new Set(options.signals ?? DEFAULT_SIGNALS)];
1791
+ const source = options.signalSource ?? defaultSignalSource;
1792
+ const budgets = ShutdownOptionsSchema.omit({ signal: true }).parse(options.shutdown ?? {});
1793
+ const controller = new AbortController;
1794
+ const handlers = [];
1795
+ let started = false;
1796
+ let sameTurnAsStart = false;
1797
+ let settled = false;
1798
+ let closed = false;
1799
+ let resolveChain = () => {
1800
+ return;
1801
+ };
1802
+ let rejectChain = () => {
1803
+ return;
1804
+ };
1805
+ const promise = new Promise((resolve, reject) => {
1806
+ resolveChain = resolve;
1807
+ rejectChain = reject;
1808
+ });
1809
+ promise.catch(() => {
1810
+ return;
1811
+ });
1812
+ const removeListeners = () => {
1813
+ if (closed)
1814
+ return;
1815
+ closed = true;
1816
+ for (const [signal, handler] of handlers)
1817
+ source.off(signal, handler);
1818
+ if (!started)
1819
+ bound.delete(handle);
1820
+ };
1821
+ const close = () => {
1822
+ const hadStarted = started;
1823
+ removeListeners();
1824
+ if (!hadStarted)
1825
+ resolveChain(undefined);
1826
+ };
1827
+ const run = async (signal) => {
1828
+ try {
1829
+ await options.onShutdown?.(signal);
1830
+ } catch (error) {
1831
+ reportError("prepare", error, options.onError);
1832
+ }
1833
+ let result;
1834
+ try {
1835
+ result = await handle.shutdown({ ...budgets, signal: controller.signal });
1836
+ } catch (error) {
1837
+ settled = true;
1838
+ rejectChain(error);
1839
+ reportError("shutdown", error, options.onError);
1840
+ removeListeners();
1841
+ return;
1842
+ }
1843
+ settled = true;
1844
+ resolveChain(result);
1845
+ try {
1846
+ await options.onComplete?.(result);
1847
+ } catch (error) {
1848
+ reportError("complete", error, options.onError);
1849
+ } finally {
1850
+ removeListeners();
1851
+ }
1852
+ };
1853
+ const onSignal = (signal) => {
1854
+ if (!started) {
1855
+ started = true;
1856
+ sameTurnAsStart = true;
1857
+ queueMicrotask(() => {
1858
+ sameTurnAsStart = false;
1859
+ });
1860
+ run(signal).catch((error) => reportError("shutdown", error, options.onError));
1861
+ return;
1862
+ }
1863
+ if (sameTurnAsStart)
1864
+ return;
1865
+ if (!settled && !controller.signal.aborted) {
1866
+ controller.abort();
1867
+ guard(() => options.onRepeatedSignal?.(signal, "force"), "shutdown", options.onError);
1868
+ return;
1869
+ }
1870
+ removeListeners();
1871
+ guard(() => options.onRepeatedSignal?.(signal, "escalate"), "shutdown", options.onError);
1872
+ let restored = false;
1873
+ try {
1874
+ restored = source.raiseDefault(signal);
1875
+ } catch (error) {
1876
+ reportError("shutdown", error, options.onError);
1877
+ }
1878
+ if (!restored) {
1879
+ guard(() => options.onEscalationBlocked?.(signal), "shutdown", options.onError);
1880
+ }
1881
+ };
1882
+ for (const signal of signals) {
1883
+ const handler = () => onSignal(signal);
1884
+ handlers.push([signal, handler]);
1885
+ source.on(signal, handler);
1886
+ }
1887
+ return { promise, close };
1888
+ }
1889
+
1737
1890
  // src/realtime/rejection.ts
1738
1891
  import { z as z2 } from "zod";
1739
1892
  function realtimeContractViolation(options) {
@@ -2148,4 +2301,4 @@ function socketIoLane(websocket) {
2148
2301
  });
2149
2302
  }
2150
2303
 
2151
- export { parseMultipart, createHandler, ShutdownStateSchema, ShutdownOptionsSchema, ShutdownStatusSchema, ShutdownResultSchema, createServerLifecycle, defineMultipartStream, implement, createImplement, implementRegistry, createImplementRegistry, bindRealtimeServer, webSocketLane, composeWebSocketHandlers, createSocketIOServer, socketIoLane };
2304
+ export { parseMultipart, createHandler, ShutdownStateSchema, ShutdownOptionsSchema, ShutdownStatusSchema, ShutdownResultSchema, createServerLifecycle, defineMultipartStream, createMultipartStream, implement, createImplement, createScopedImplement, createScopedImplementRegistry, implementRegistry, createImplementRegistry, bindProcessSignals, bindRealtimeServer, webSocketLane, composeWebSocketHandlers, createSocketIOServer, socketIoLane };
@@ -295,6 +295,9 @@ function validateDefinition(code, definition) {
295
295
  if (definition.details !== undefined && !isErrorDetailsSchema(definition.details)) {
296
296
  throw new Error(`[stitchkit] Error "${code}" details must be a Zod object or optional Zod object`);
297
297
  }
298
+ if (definition.message !== undefined && (typeof definition.message !== "string" || definition.message.trim() === "")) {
299
+ throw new Error(`[stitchkit] Error "${code}" message must be a non-empty string`);
300
+ }
298
301
  }
299
302
  function defineErrors(source) {
300
303
  const definitions = mapObjectTypeBoundary(source, (code, definition) => {
@@ -306,14 +309,15 @@ function defineErrors(source) {
306
309
  const errors = mapObjectTypeBoundary(definitions, (code, definition) => {
307
310
  const name = String(code);
308
311
  return (options = {}) => {
312
+ const message = options.message ?? definition.message;
309
313
  if (definition.details === undefined) {
310
314
  if ("details" in options) {
311
315
  throw new Error(`[stitchkit] Error "${name}" does not declare details`);
312
316
  }
313
- return new AppError(name, options.message, definition.status, undefined, options.hint);
317
+ return new AppError(name, message, definition.status, undefined, options.hint);
314
318
  }
315
319
  const details = definition.details.parse(options.details);
316
- return new AppError(name, options.message, definition.status, details, options.hint);
320
+ return new AppError(name, message, definition.status, details, options.hint);
317
321
  };
318
322
  });
319
323
  Object.freeze(errors);
package/dist/index.js CHANGED
@@ -17,7 +17,7 @@ import {
17
17
  parseTrailingWildcard,
18
18
  rateLimited,
19
19
  unauthorized
20
- } from "./index-45dz4m51.js";
20
+ } from "./index-trz4ate5.js";
21
21
  import {
22
22
  isRecord,
23
23
  mapObject,
package/dist/node.d.ts CHANGED
@@ -6,11 +6,12 @@
6
6
  */
7
7
  export { AppError, appError, badRequest, conflict, forbidden, notFound, rateLimited, unauthorized, } from './contract';
8
8
  export { createHandler } from './server/create';
9
- export { createImplement, createImplementRegistry, type ExactRegistryHandlers, type ImplementationRegistry, implement, implementRegistry, type RegistryHandlers, } from './server/implement';
9
+ export { createImplement, createImplementRegistry, createMultipartStream, createScopedImplement, createScopedImplementRegistry, type ExactRegistryHandlers, type ExactScopedRegistryHandlers, type ImplementationRegistry, implement, implementRegistry, type MultipartStreamConfig, type RegistryHandlers, type ScopedImplementationRegistry, type ScopedRegistryHandlers, type StreamScope, } from './server/implement';
10
10
  export type { LogFormat } from './server/logger';
11
11
  export { type NodeRuntimeServer, type NodeServerConfig, type NodeServerHandle, type NodeSocketLifecycle, serveNode, } from './server/node';
12
+ export { bindProcessSignals, type ProcessSignalName, type ProcessSignalsBinding, type ProcessSignalsErrorPhase, type ProcessSignalsOptions, type ShutdownTarget, type SignalSource, } from './server/process-signals';
12
13
  export { bindRealtimeServer, type RealtimeServer, type RealtimeServerConnection, type RealtimeServerHandle, } from './server/realtime';
13
14
  export { type ManagedServerHandle, type ShutdownOptions, ShutdownOptionsSchema, type ShutdownResult, ShutdownResultSchema, type ShutdownState, ShutdownStateSchema, type ShutdownStatus, ShutdownStatusSchema, } from './server/shutdown';
14
15
  export { createNodeSocketIOServer as createSocketIOServer, type NodeSocketIOServerHandle as SocketIOServerHandle, type SocketIORequestPolicy, type SocketIOServerConfig, } from './server/socket-io-node';
15
- export type { FetchComposition, FetchHandler, HandlerConfig, LoggingConfig, LogOutcome, RawRoute, RawRouteContext, ServiceDef, } from './server/types';
16
+ export type { EffectiveScope, FetchComposition, FetchHandler, HandlerConfig, LoggingConfig, LogOutcome, RawRoute, RawRouteContext, ScopeContexts, ScopedHandlers, ServiceDef, } from './server/types';
16
17
  //# sourceMappingURL=node.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EACL,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,SAAS,EACT,QAA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eAAe,EACf,aAAa,EACb,cAAc,EACd,UAAU,GACX,MAAM,gBAAgB,CAAC"}
package/dist/node.js CHANGED
@@ -3,15 +3,19 @@ import {
3
3
  ShutdownResultSchema,
4
4
  ShutdownStateSchema,
5
5
  ShutdownStatusSchema,
6
+ bindProcessSignals,
6
7
  bindRealtimeServer,
7
8
  createHandler,
8
9
  createImplement,
9
10
  createImplementRegistry,
11
+ createMultipartStream,
12
+ createScopedImplement,
13
+ createScopedImplementRegistry,
10
14
  createServerLifecycle,
11
15
  createSocketIOServer,
12
16
  implement,
13
17
  implementRegistry
14
- } from "./index-z992nfbx.js";
18
+ } from "./index-a4qmxybq.js";
15
19
  import"./index-r1qp4rve.js";
16
20
  import {
17
21
  AppError,
@@ -142,11 +146,15 @@ export {
142
146
  implement,
143
147
  forbidden,
144
148
  createNodeSocketIOServer as createSocketIOServer,
149
+ createScopedImplementRegistry,
150
+ createScopedImplement,
151
+ createMultipartStream,
145
152
  createImplementRegistry,
146
153
  createImplement,
147
154
  createHandler,
148
155
  conflict,
149
156
  bindRealtimeServer,
157
+ bindProcessSignals,
150
158
  badRequest,
151
159
  appError,
152
160
  ShutdownStatusSchema,
@@ -1,6 +1,6 @@
1
1
  import type { ZodType } from 'zod';
2
2
  import type { ContractDef, EndpointDef, MultipartDescriptor, RuntimeContext } from '../contract';
3
- import type { EndpointHandlerContext, Handlers, MultipartReceiver, ServiceDef, StreamingMultipartImplementation } from './types';
3
+ import type { EndpointHandlerContext, Handlers, MultipartReceiver, ScopeContexts, ScopedHandlers, ServiceDef, StreamingMultipartImplementation } from './types';
4
4
  type StreamingEndpoint = EndpointDef & {
5
5
  multipart: MultipartDescriptor & {
6
6
  delivery: 'stream';
@@ -21,15 +21,33 @@ type StreamingReturn<E extends EndpointDef> = E extends {
21
21
  output: ZodType<infer O>;
22
22
  } ? O | Promise<O> : void | Promise<void>;
23
23
  /**
24
- * Bind streaming multipart receivers to one endpoint while inferring the
25
- * receiver values handed to its final handler.
24
+ * Receivers plus the final handler for one streaming multipart endpoint. `TCtx`
25
+ * is the handler context: `RuntimeContext` by default, an application context
26
+ * through `createMultipartStream`, a scope's context through
27
+ * `createScopedImplement(...).stream`.
26
28
  */
27
- export declare function defineMultipartStream<const E extends StreamingEndpoint, const R extends ReceiverMap<E>>(endpoint: E, config: {
29
+ export interface MultipartStreamConfig<E extends StreamingEndpoint, R extends ReceiverMap<E>, TCtx extends RuntimeContext> {
28
30
  files: R & Record<Exclude<keyof R, keyof E['multipart']['files']>, never>;
29
- handler: (ctx: EndpointHandlerContext<E, RuntimeContext> & {
31
+ handler: (ctx: EndpointHandlerContext<E, TCtx> & {
30
32
  files: StreamedFiles<E, R>;
31
33
  }) => StreamingReturn<E>;
32
- }): StreamingMultipartImplementation;
34
+ }
35
+ /**
36
+ * Bind streaming multipart receivers to one endpoint while inferring the
37
+ * receiver values handed to its final handler.
38
+ *
39
+ * The handler context is the loose `RuntimeContext`. To read fields the
40
+ * application injects, build the implementation through
41
+ * `createMultipartStream<Ctx>()` or, in a scoped app,
42
+ * `createScopedImplement<Scopes>().stream(scope, …)`.
43
+ */
44
+ export declare function defineMultipartStream<const E extends StreamingEndpoint, const R extends ReceiverMap<E>>(endpoint: E, config: MultipartStreamConfig<E, R, RuntimeContext>): StreamingMultipartImplementation;
45
+ /**
46
+ * Fix one handler context type for streaming multipart endpoints, the way
47
+ * `createImplement` fixes it for ordinary handlers. Without this, a streaming
48
+ * handler only ever sees the loose `RuntimeContext`.
49
+ */
50
+ export declare function createMultipartStream<TCtx extends RuntimeContext>(): <const E extends StreamingEndpoint, const R extends ReceiverMap<E>>(endpoint: E, config: MultipartStreamConfig<E, R, TCtx>) => StreamingMultipartImplementation;
33
51
  export declare function implement<T extends Record<string, EndpointDef>, TCtx extends RuntimeContext = RuntimeContext>(contract: ContractDef<T, string>, handlers: Handlers<T, TCtx>): ServiceDef;
34
52
  /**
35
53
  * Fix the handler context type once — `const implement =
@@ -37,6 +55,54 @@ export declare function implement<T extends Record<string, EndpointDef>, TCtx ex
37
55
  * the generic. The application declares its context shape in a single place.
38
56
  */
39
57
  export declare function createImplement<TCtx extends RuntimeContext>(): <T extends Record<string, EndpointDef>>(contract: ContractDef<T, string>, handlers: Handlers<T, TCtx>) => ServiceDef;
58
+ /**
59
+ * Fix one scope→context map for the application, then implement every contract
60
+ * with it — each handler typed by its endpoint's **effective** scope rather than
61
+ * by a superset that promises fields the runtime never injects into a
62
+ * `public` call.
63
+ *
64
+ * ```ts
65
+ * const implementFor = createScopedImplement<{
66
+ * public: object
67
+ * user: { userId: string }
68
+ * admin: { userId: string; isAdmin: true }
69
+ * }>()
70
+ *
71
+ * implementFor(usersContract, { … }) // ctx typed per endpoint scope
72
+ * ```
73
+ *
74
+ * The map is type-only — scope fields are types, and a runtime map would force
75
+ * `{} as UserFields` at the call site. A contract with no `scope` is `'public'`
76
+ * (→ `defineContract`), so `'public'` must be a key of the map.
77
+ *
78
+ * The map states what the application's `beforeHandle` / `createAuthHook.inject`
79
+ * puts in the context. The framework does not verify it — a scope whose fields
80
+ * are never injected still type-checks. → ADR 0075.
81
+ */
82
+ export declare function createScopedImplement<TScopes extends ScopeContexts>(): (<const T extends Record<string, EndpointDef>, TContractScope extends Extract<keyof TScopes, string>>(contract: ContractDef<T, TContractScope>, handlers: ScopedHandlers<T, TContractScope, TScopes>) => ServiceDef) & {
83
+ stream: <const E extends StreamingEndpoint, const R extends ReceiverMap<E>>(scope: StreamScope<E, TScopes>, endpoint: E, config: MultipartStreamConfig<E, R, RuntimeContext & TScopes[StreamScope<E, TScopes> & keyof TScopes]>) => StreamingMultipartImplementation;
84
+ };
85
+ /** A contract registry whose every group scope is a key of the scope map. */
86
+ export type ScopedImplementationRegistry<TScopes extends ScopeContexts> = Record<string, ContractDef<Record<string, EndpointDef>, Extract<keyof TScopes, string>>>;
87
+ /**
88
+ * The scope `createScopedImplement(...).stream` accepts for one endpoint: the
89
+ * literal the endpoint declares, or a message explaining why it cannot be typed.
90
+ */
91
+ export type StreamScope<E extends EndpointDef, TScopes extends ScopeContexts> = 'scope' extends keyof E ? undefined extends E['scope'] ? 'stitchkit: .stream() needs the endpoint to declare its own scope' : Extract<E['scope'], string> extends infer S extends string ? [S] extends [Extract<keyof TScopes, string>] ? S : `stitchkit: scope "${S}" is not declared in createScopedImplement` : 'stitchkit: .stream() needs the endpoint to declare its own scope' : 'stitchkit: .stream() needs the endpoint to declare its own scope';
92
+ /** Exact scoped handlers map derived from a literal contract registry. */
93
+ export type ScopedRegistryHandlers<TContracts extends ImplementationRegistry, TScopes extends ScopeContexts> = {
94
+ [K in keyof TContracts]: TContracts[K] extends ContractDef<infer TEndpoints, infer TContractScope extends string> ? ScopedHandlers<TEndpoints, TContractScope, TScopes> : never;
95
+ };
96
+ export type ExactScopedRegistryHandlers<TContracts extends ImplementationRegistry, THandlers extends ScopedRegistryHandlers<TContracts, TScopes>, TScopes extends ScopeContexts> = THandlers & ScopedRegistryHandlers<TContracts, TScopes> & Record<Exclude<keyof THandlers, keyof TContracts>, never> & {
97
+ [K in keyof THandlers & keyof TContracts]: THandlers[K] & Record<Exclude<keyof THandlers[K], keyof ScopedRegistryHandlers<TContracts, TScopes>[K]>, never>;
98
+ };
99
+ /**
100
+ * The registry form of {@link createScopedImplement} — one literal contract
101
+ * registry bound to one handler registry, with every handler still typed by its
102
+ * endpoint's effective scope. Missing, extra and endpoint-incompatible entries
103
+ * fail exactly as they do in `implementRegistry`.
104
+ */
105
+ export declare function createScopedImplementRegistry<TScopes extends ScopeContexts>(): <const TContracts extends ScopedImplementationRegistry<TScopes>, const THandlers extends ScopedRegistryHandlers<TContracts, TScopes>>(contracts: TContracts, handlers: ExactScopedRegistryHandlers<TContracts, THandlers, TScopes>) => ServiceDef[];
40
106
  export type ImplementationRegistry = Record<string, ContractDef<Record<string, EndpointDef>, string>>;
41
107
  /** Exact handlers map derived from a literal contract registry. */
42
108
  export type RegistryHandlers<TContracts extends ImplementationRegistry, TCtx extends RuntimeContext = RuntimeContext> = {
@@ -1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EAAE,KAAK,CAAC,GAAG;KACzD,CAAC,IAAI,MAAM,SAAS,GAAG,MAAM,UAAU,GAAG,SAAS,CAAC,CAAC,CAAC,GACrD,MAAM,CAAC,OAAO,CAAC,MAAM,SAAS,CAAC,CAAC,CAAC,EAAE,MAAM,gBAAgB,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC;CAC1F,CAAC;AAwDJ;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,CAAC,UAAU,SAAS,sBAAsB,EAC/C,KAAK,CAAC,SAAS,SAAS,gBAAgB,CAAC,UAAU,CAAC,EAEpD,SAAS,EAAE,UAAU,EACrB,QAAQ,EAAE,qBAAqB,CAAC,UAAU,EAAE,SAAS,EAAE,cAAc,CAAC,GACrE,UAAU,EAAE,CAEd;AAED,kFAAkF;AAClF,wBAAgB,uBAAuB,CAAC,IAAI,SAAS,cAAc,MAE/D,KAAK,CAAC,UAAU,SAAS,sBAAsB,EAC/C,KAAK,CAAC,SAAS,SAAS,gBAAgB,CAAC,UAAU,EAAE,IAAI,CAAC,aAE/C,UAAU,YACX,qBAAqB,CAAC,UAAU,EAAE,SAAS,EAAE,IAAI,CAAC,KAC3D,UAAU,EAAE,CAChB"}
@@ -7,7 +7,7 @@ export { createHandler } from './create';
7
7
  export { createErrorHook, type ErrorHookConfig, type ResolvedError, } from './error-hook';
8
8
  export { createEventBus, type DefaultEventMap, type EventBus, type EventBusOptions, type EventHandler, } from './event-bus';
9
9
  export { type ByteRange, parseByteRange, type ServeFileOptions, serveFile, staticRoute, weakETag, } from './file';
10
- export { createImplement, createImplementRegistry, defineMultipartStream, type ExactRegistryHandlers, type ImplementationRegistry, implement, implementRegistry, type RegistryHandlers, } from './implement';
10
+ export { createImplement, createImplementRegistry, createMultipartStream, createScopedImplement, createScopedImplementRegistry, defineMultipartStream, type ExactRegistryHandlers, type ExactScopedRegistryHandlers, type ImplementationRegistry, implement, implementRegistry, type MultipartStreamConfig, type RegistryHandlers, type ScopedImplementationRegistry, type ScopedRegistryHandlers, type StreamScope, } from './implement';
11
11
  export type { LogFormat } from './logger';
12
12
  export { type AuthHook, type AuthHookConfig, type AuthRule, type BearerResolverConfig, createAuthHook, createBearerResolver, extractToken, type JwtPayload, type SignJwtOptions, signJwt, type VerifyJwtOptions, verifyJwt, } from './middleware/auth';
13
13
  export { type CookieDef, type CookieOptions, defineCookie, parseCookies, serializeCookie, } from './middleware/cookies';
@@ -15,6 +15,7 @@ export { type CorsConfig, corsHeaders, corsPreflightResponse, DEFAULT_CORS_ALLOW
15
15
  export { deriveCodeChallenge, type PkceMethod, verifyPkce } from './middleware/pkce';
16
16
  export { type MultipartLifecycle, type MultipartResult, parseMultipart } from './multipart';
17
17
  export { generateOpenApiDocument, type OpenApiConfig, type OpenApiDocument, type OpenApiInfo, type OpenApiServer, openApiRoute, } from './openapi';
18
+ export { bindProcessSignals, type ProcessSignalName, type ProcessSignalsBinding, type ProcessSignalsErrorPhase, type ProcessSignalsOptions, type ShutdownTarget, type SignalSource, } from './process-signals';
18
19
  export { createRateLimiter, type RateLimitConfig } from './rate-limit';
19
20
  export { errorResponse, parseBody, respondJson } from './raw';
20
21
  export { bindRealtimeServer, type RealtimeServer, type RealtimeServerConnection, type RealtimeServerHandle, } from './realtime';
@@ -23,6 +24,6 @@ export { type ManagedServerHandle, type ShutdownOptions, ShutdownOptionsSchema,
23
24
  export type { SocketIORequestPolicy, SocketIOServerConfig, SocketIOServerHandle, SocketIOServerLifecycle, } from './socket-io';
24
25
  export { createSocketIOServer, socketIoLane } from './socket-io';
25
26
  export { type ParseSSEOptions, parseSSE, streamSSE } from './stream';
26
- export type { AuthorizationContext, EndpointHandlerContext, Handlers, LifecycleHooks, LoggingConfig, LogOutcome, MethodDef, MultipartFileMetadata, MultipartReceiver, MultipartReceiverResult, OperationIdentity, RouteGroup, ServiceDef, StitchLogger, StreamingMultipartImplementation, } from './types';
27
+ export type { AuthorizationContext, EffectiveScope, EndpointHandlerContext, Handlers, LifecycleHooks, LoggingConfig, LogOutcome, MethodDef, MultipartFileMetadata, MultipartReceiver, MultipartReceiverResult, OperationIdentity, RouteGroup, ScopeContexts, ScopedHandlers, ServiceDef, StitchLogger, StreamingMultipartImplementation, } from './types';
27
28
  export { type ComposedLane, composeWebSocketHandlers, type WebSocketComposeConfig, type WebSocketLane, webSocketLane, } from './websocket';
28
29
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,SAAS,EACT,iBAAiB,EACjB,QAAQ,EACR,WAAW,EACX,mBAAmB,EACnB,KAAK,eAAe,EACpB,YAAY,GACb,MAAM,aAAa,CAAC;AAIrB,OAAO,EACL,SAAS,EACT,cAAc,EACd,cAAc,EACd,KAAK,eAAe,EACpB,SAAS,GACV,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EACL,KAAK,mBAAmB,IAAI,gBAAgB,EAC5C,KAAK,eAAe,IAAI,YAAY,EACpC,KAAK,gBAAgB,IAAI,aAAa,EACtC,KAAK,WAAW,IAAI,QAAQ,EAC5B,KAAK,kBAAkB,IAAI,eAAe,EAC1C,KAAK,SAAS,EACd,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,YAAY,EACZ,KAAK,iBAAiB,GACvB,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,KAAK,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EACL,eAAe,EACf,KAAK,eAAe,EACpB,KAAK,aAAa,GACnB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,cAAc,EACd,KAAK,eAAe,EACpB,KAAK,Q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E,aAAa,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAC9D,OAAO,EACL,kBAAkB,EAClB,KAAK,cAAc,EACnB,KAAK,wBAAwB,EAC7B,KAAK,oBAAoB,GAC1B,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,KAAK,eAAe,EACpB,SAAS,EACT,eAAe,EACf,aAAa,EACb,eAAe,EACf,cAAc,GACf,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,qBAAqB,EACrB,KAAK,cAAc,EACnB,oBAAoB,EACpB,KAAK,aAAa,EAClB,mBAAmB,EACnB,KAAK,cAAc,EACnB,oBAAoB,GACrB,MAAM,YAAY,CAAC;AACpB,YAAY,EACV,qBAAqB,EACrB,oBAAoB,EACpB,oBAAoB,EACpB,uBAAuB,GACxB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACjE,OAAO,EAAE,KAAK,eAAe,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrE,YAAY,EACV,oBAAoB,EACpB,sBAAsB,EACtB,QAAQ,EACR,cAAc,EACd,aAAa,EACb,UAAU,EACV,SAAS,EACT,qBAAqB,EACrB,iBAAiB,EACjB,uBAAuB,EACvB,iBAAiB,EACjB,UAAU,EACV,UAAU,EACV,YAAY,EACZ,gCAAgC,GACjC,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,KAAK,YAAY,EACjB,wBAAwB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,aAAa,EAClB,aAAa,GACd,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,SAAS,EACT,iBAAiB,EACjB,QAAQ,EACR,WAAW,EACX,mBAAmB,EAC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