@barqjs/start 0.0.0-stage → 0.2.0-next.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.
- package/LICENSE +21 -0
- package/README.md +791 -2
- package/dist/client-BHyIiYxt.js +1527 -0
- package/dist/client-BHyIiYxt.js.map +1 -0
- package/dist/client-DHCV7yvQ.d.ts +440 -0
- package/dist/client-DHCV7yvQ.d.ts.map +1 -0
- package/dist/client.d.ts +3 -0
- package/dist/client.js +4 -0
- package/dist/env-qA8EyOr1.d.ts +49 -0
- package/dist/env-qA8EyOr1.d.ts.map +1 -0
- package/dist/env.d.ts +2 -0
- package/dist/env.js +44 -0
- package/dist/env.js.map +1 -0
- package/dist/index-Bm_-MTj6.d.ts +915 -0
- package/dist/index-Bm_-MTj6.d.ts.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +6 -0
- package/dist/middleware-BdVlE8qm.d.ts +576 -0
- package/dist/middleware-BdVlE8qm.d.ts.map +1 -0
- package/dist/middleware.d.ts +2 -0
- package/dist/middleware.js +282 -0
- package/dist/middleware.js.map +1 -0
- package/dist/prerender.d.ts +98 -0
- package/dist/prerender.d.ts.map +1 -0
- package/dist/prerender.js +289 -0
- package/dist/prerender.js.map +1 -0
- package/dist/protocol.d.ts +58 -0
- package/dist/protocol.d.ts.map +1 -0
- package/dist/protocol.js +26 -0
- package/dist/protocol.js.map +1 -0
- package/dist/serve.d.ts +135 -0
- package/dist/serve.d.ts.map +1 -0
- package/dist/serve.js +223 -0
- package/dist/serve.js.map +1 -0
- package/dist/server-BV3xKmLa.js +1148 -0
- package/dist/server-BV3xKmLa.js.map +1 -0
- package/dist/server.d.ts +142 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +1 -0
- package/dist/src-ChnB_xug.js +1140 -0
- package/dist/src-ChnB_xug.js.map +1 -0
- package/dist/static-fn-DgjNArBe.js +123 -0
- package/dist/static-fn-DgjNArBe.js.map +1 -0
- package/package.json +106 -4
- package/src/client.ts +672 -0
- package/src/context.ts +666 -0
- package/src/cookies.ts +229 -0
- package/src/env.ts +86 -0
- package/src/fn-error.ts +97 -0
- package/src/frames-client.ts +1216 -0
- package/src/frames-server.ts +464 -0
- package/src/frames.ts +285 -0
- package/src/index.ts +714 -0
- package/src/live-client.ts +50 -0
- package/src/live-server.ts +182 -0
- package/src/middleware.ts +994 -0
- package/src/prerender.ts +477 -0
- package/src/protocol.ts +61 -0
- package/src/rate-limit.ts +202 -0
- package/src/serve.ts +153 -0
- package/src/server.ts +990 -0
- package/src/session.ts +449 -0
- package/src/start-instance.ts +147 -0
- package/src/static-fn.ts +181 -0
- package/src/static.ts +302 -0
- package/src/stubs.ts +32 -0
- package/src/timing.ts +29 -0
- package/src/wire-types.ts +139 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-Bm_-MTj6.d.ts","names":[],"sources":["../src/cookies.ts","../src/session.ts","../src/start-instance.ts","../src/context.ts","../src/rate-limit.ts","../src/timing.ts","../src/wire-types.ts","../src/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UA2BiB;WACN;WACA,UAAU;WACV;;WAEA;;WAEA;WACA;WACA;WACA;WACA;;;;;;;WAOA,UAAU;;;;;;;;;;;iBA0CL,aAAa,oCAAoC;;;;;;;iBAmCjD,gBAAgB,cAAc,eAAe,UAAS;;;;;;;;;;iBAwGtD,iBAAiB,cAAc,UAAS;;;;KCpM5C,cAAc;UAET,QAAQ,UAAU,cAAc;;WAEtC;;WAEA;WACA,MAAM,QAAQ;;UAGR,eAAe,UAAU,cAAc;WAC7C;;WAEA;WACA,MAAM,QAAQ;;EAEvB,OACE,OAAO,QAAQ,OAAO,SAAS,QAAQ,OAAO,QAAQ,kBACrD,QAAQ,eAAe;;EAE1B,SAAS,QAAQ,eAAe;;UAGjB;;;;;;;;WAQN;;WAEA;;;;;;;;WAQA;;;;;;WAMA,SAAS;;;;;;;;;;;;;;;;;;;;;;WA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BAAgB,gBAAgB,OAAO,IAAI,QAAQ;EACtD,UAAU,yBAAyB,gBAAgB,gBAAgB;;EAEnE,eAAe,eAAe,oBAC5B,QAAQ,SAAS,WAAW,OAAO,cAAc,WAChD,gBAAgB,gBAAgB,OAAO,cAAc,SAAS,eAAe;EAChF,eAAe,IAAI,KACjB,YAAY,OAAO,OAAO,OAAO,WAAW,OAAO,MAClD,gBAAgB,gBAAgB,OAAO,IAAI,QAAQ;EACtD,eAAe,IAAI,KACjB;aAAmB,QAAQ,OAAO,OAAO;MAAQ,WAAW,OAAO,MAClE,gBAAgB,gBAAgB,OAAO,IAAI,QAAQ;EACtD,eAAe,yBAAyB,gBAAgB,gBAAgB;;;;;;EAMxE,QAAQ,QACN,MACE,SAAS,eAAe,YAAY,QAAQ,iBAAiB,YAC1D,SAAS,QAAQ,WACpB,YAAY,OAAO,UACpB,SAAS,YAAY,QAAQ,SAAS,QAAQ,UAAU,mBACzD,QAAQ;;;;;;;;;;;UAYK,gBACf,eAAe,iBAAiB,gBAChC,eAAe,aAAa;WAEnB,SAAS;;;;;;;;WAQT,SAAS;;;;;;;iBAQJ,eACd,eAAe,8BACT,eAAe,mBACrB,UAAS,gBAAgB,QAAQ,UAAe,gBAAgB,cAAc,QAAQ;;;;;;;;iBAuExE,UACd,IACA,KACA,OAAO,IACP,yBAAyB,OACzB,eAAe,yBAEf,MAAM,cACN,OAAO,MAAM,MAAM,KAAK,WACvB,SAAS,IAAI,SAAS,QAAQ,OAAO;;;;;;;;;;;;;iBAoHxB,aAAa,IAAI,uBAAuB"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { B as FRAME_APPLIED_EVENT, C as ServerFnInputAnswer, E as Streamed, F as LiveIterable, H as isFrame, I as LiveStatus, J as staticUrl, K as STATIC_PREFIX, N as live, O as clientRpc, S as ServerFnCallOptions, T as ServerFnMethod, V as Slot, X as ServerFnIssue, Y as ServerFnError, Z as ServerFnThrown, a as PAYLOAD_PARAM, b as ServerFn, c as RPC_CONTROL, d as RPC_STREAM, g as RpcRedirect, h as RpcNotFound, i as LIVE_SUFFIX, j as isServerFn, l as RPC_PREFIX, n as ChainStep, o as RPC_CALLER, p as RpcControl, q as staticFunctionMiddleware, r as DATA_SUFFIX, s as RPC_CONTEXT, t as AnyServerFn, v as SERVER_FN, w as ServerFnMeta, x as ServerFnArgs, z as BindingSlot } from "./client-DHCV7yvQ.js";
|
|
2
|
+
import { $ as runMiddleware, A as RequestMiddleware, B as ValidationError, C as NextOptions, D as OwnReplaced, E as OpenContext, F as StandardInput, G as WithClient, H as ValidatorInput, I as StandardOutput, J as applyValidator, K as WithServer, L as StandardSchema, M as RequestMiddlewareFn, N as RequestMiddlewareNext, O as Plain, P as RequestMiddlewareStart, Q as isInputError, R as StandardSchemaLike, S as NOT_FOUND, T as NoContribution, U as ValidatorReplaced, V as Validator, W as WithChain, X as flattenMiddleware, Y as createMiddleware, Z as isBuiltMiddleware, _ as MiddlewareContext, a as ClientReplaced, b as MiddlewareOptions, c as ContributionOf, d as Empty, et as runRequestMiddleware, f as FreshMiddleware, g as Middleware, h as Merged, i as ClientMiddlewareContext, j as RequestMiddlewareContext, k as REDIRECT, m as InputError, n as Carries, o as ContributedBy, p as FromNext, q as WithValidator, r as ChainContribution, s as Contribution, t as BuiltMiddleware, tt as toValidator, u as DataAt, v as MiddlewareFn, w as NextResult, x as MiddlewareState, y as MiddlewareNext, z as UncheckedInputError } from "./middleware-BdVlE8qm.js";
|
|
3
|
+
import { a as createServerOnlyFn, i as createIsomorphicFn, n as IsomorphicFn, r as createClientOnlyFn, t as IsomorphicBuilder } from "./env-qA8EyOr1.js";
|
|
4
|
+
import { $ as getRequestIP, A as RateLimitCount, At as SessionData, B as applyResponseDraft, Bt as parseCookies, C as InputProblem, Ct as StartInstance, D as WireProblem, Dt as startOptions, E as Strictness, Et as createStart, F as rateLimit, Ft as unsealSession, G as draftedStatus, H as collectRequestCss, I as ForwardedForTrust, It as updateSession, J as getGlobalStartContext, K as getCookie, L as RequestContext, Lt as useSession, M as RateLimitStore, Mt as clearSession, N as byIP, Nt as getSession, O as ServerTiming, Ot as Session, P as memoryStore, Pt as sealSession, Q as getRequestHost, R as ResponseDraft, Rt as CookieOptions, S as Crossable, St as RequestContextOf, T as StrictOn, Tt as clearStart, U as createResponseDraft, V as clearResponseHeaders, Vt as serializeCookie, W as deleteCookie, X as getRequestHeader, Y as getRequest, Z as getRequestHeaders, _ as createSerializationAdapter, _t as withRequest, a as FreshServerFn, at as installCssSink, b as middlewareOf, bt as GlobalRequestContext, c as HandlerData, ct as peekRequest, d as SerializationAdapter, dt as setCookie, et as getRequestProtocol, f as ServerFnBuilder, ft as setRequestMiddlewareContext, g as checkInput, gt as takeSendContext, h as Validates, ht as setResponseStatus, i as FnWithValidator, it as getResponseStatus, j as RateLimitOptions, jt as SessionManager, k as serverTiming, kt as SessionConfig, l as InputCheck, lt as peekResponseDraft, m as ServerFnState, mt as setResponseHeaders, n as CallerInput, nt as getResponseHeader, o as HandlerContext, ot as invalidateFrames, p as ServerFnOptions, pt as setResponseHeader, q as getCookies, r as FnWithChain, rt as getResponseHeaders, s as HandlerContextOf, st as markResponseSent, t as AnySerializationAdapter, tt as getRequestUrl, u as ResultCheck, ut as removeResponseHeader, v as createServerFn, vt as FunctionContextOf, w as ResultProblem, wt as StartOptions, x as serverRpc, xt as Register, y as json, yt as GlobalFunctionContext, z as appendResponseHeader, zt as deleteCookieLine } from "./index-Bm_-MTj6.js";
|
|
5
|
+
export { type AnySerializationAdapter, type AnyServerFn, type BindingSlot, type BuiltMiddleware, CallerInput, type Carries, type ChainContribution, type ChainStep, type ClientMiddlewareContext, type ClientReplaced, type ContributedBy, type Contribution, type ContributionOf, type CookieOptions, type Crossable, DATA_SUFFIX, type DataAt, type Empty, FRAME_APPLIED_EVENT, FnWithChain, FnWithValidator, type ForwardedForTrust, type FreshMiddleware, FreshServerFn, type FromNext, type FunctionContextOf, type GlobalFunctionContext, type GlobalRequestContext, HandlerContext, HandlerContextOf, HandlerData, InputCheck, InputError, type InputProblem, type IsomorphicBuilder, type IsomorphicFn, LIVE_SUFFIX, type LiveIterable, type LiveStatus, type Merged, type Middleware, type MiddlewareContext, type MiddlewareFn, type MiddlewareNext, type MiddlewareOptions, type MiddlewareState, NOT_FOUND, type NextOptions, type NextResult, type NoContribution, type OpenContext, type OwnReplaced, PAYLOAD_PARAM, type Plain, REDIRECT, RPC_CALLER, RPC_CONTEXT, RPC_CONTROL, RPC_PREFIX, RPC_STREAM, type RateLimitCount, type RateLimitOptions, type RateLimitStore, type Register, type RequestContext, type RequestContextOf, type RequestMiddleware, type RequestMiddlewareContext, type RequestMiddlewareFn, type RequestMiddlewareNext, type RequestMiddlewareStart, type ResponseDraft, ResultCheck, type ResultProblem, type RpcControl, RpcNotFound, RpcRedirect, SERVER_FN, STATIC_PREFIX, type SerializationAdapter, type ServerFn, type ServerFnArgs, ServerFnBuilder, type ServerFnCallOptions, ServerFnError, type ServerFnInputAnswer, type ServerFnIssue, type ServerFnMeta, type ServerFnMethod, ServerFnOptions, ServerFnState, type ServerFnThrown, type ServerTiming, type Session, type SessionConfig, type SessionData, type SessionManager, type Slot, type StandardInput, type StandardOutput, type StandardSchema, type StandardSchemaLike, type StartInstance, type StartOptions, type Streamed, type StrictOn, type Strictness, UncheckedInputError, Validates, ValidationError, type Validator, type ValidatorInput, type ValidatorReplaced, type WireProblem, type WithChain, type WithClient, type WithServer, type WithValidator, appendResponseHeader, applyResponseDraft, applyValidator, byIP, checkInput, clearResponseHeaders, clearSession, clearStart, clientRpc, collectRequestCss, createClientOnlyFn, createIsomorphicFn, createMiddleware, createResponseDraft, createSerializationAdapter, createServerFn, createServerOnlyFn, createStart, deleteCookie, deleteCookieLine, draftedStatus, flattenMiddleware, getCookie, getCookies, getGlobalStartContext, getRequest, getRequestHeader, getRequestHeaders, getRequestHost, getRequestIP, getRequestProtocol, getRequestUrl, getResponseHeader, getResponseHeaders, getResponseStatus, getSession, installCssSink, invalidateFrames, isBuiltMiddleware, isFrame, isInputError, isServerFn, json, live, markResponseSent, memoryStore, middlewareOf, parseCookies, peekRequest, peekResponseDraft, rateLimit, removeResponseHeader, runMiddleware, runRequestMiddleware, sealSession, serializeCookie, serverRpc, serverTiming, setCookie, setRequestMiddlewareContext, setResponseHeader, setResponseHeaders, setResponseStatus, startOptions, staticFunctionMiddleware, staticUrl, takeSendContext, toValidator, unsealSession, updateSession, useSession, withRequest };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { $ as serializeCookie, A as getRequestHost, B as markResponseSent, C as draftedStatus, D as getRequest, E as getGlobalStartContext, F as getResponseHeaders, G as setRequestMiddlewareContext, H as peekResponseDraft, I as getResponseStatus, J as setResponseStatus, K as setResponseHeader, L as installCssSink, M as getRequestProtocol, N as getRequestUrl, O as getRequestHeader, P as getResponseHeader, Q as parseCookies, R as invalidateFrames, S as deleteCookie, T as getCookies, U as removeResponseHeader, V as peekRequest, W as setCookie, X as withRequest, Y as takeSendContext, Z as deleteCookieLine, _ as appendResponseHeader, a as middlewareOf, b as collectRequestCss, c as clearSession, d as unsealSession, f as updateSession, g as rateLimit, h as memoryStore, i as json, j as getRequestIP, k as getRequestHeaders, l as getSession, m as byIP, n as createSerializationAdapter, o as serverRpc, p as useSession, q as setResponseHeaders, r as createServerFn, s as serverTiming, t as checkInput, u as sealSession, v as applyResponseDraft, w as getCookie, x as createResponseDraft, y as clearResponseHeaders } from "./src-ChnB_xug.js";
|
|
2
|
+
import { A as FRAME_APPLIED_EVENT, C as createStart, G as ServerFnError, S as clearStart, a as RPC_CONTEXT, d as RpcNotFound, f as RpcRedirect, g as clientRpc, i as RPC_CALLER, l as RPC_STREAM, n as LIVE_SUFFIX, o as RPC_CONTROL, p as SERVER_FN, r as PAYLOAD_PARAM, s as RPC_PREFIX, t as DATA_SUFFIX, w as startOptions, x as live, y as isServerFn, z as isFrame } from "./client-BHyIiYxt.js";
|
|
3
|
+
import { InputError, NOT_FOUND, REDIRECT, UncheckedInputError, ValidationError, applyValidator, createMiddleware, flattenMiddleware, isBuiltMiddleware, isInputError, runMiddleware, runRequestMiddleware, toValidator } from "./middleware.js";
|
|
4
|
+
import { i as staticUrl, r as staticFunctionMiddleware, t as STATIC_PREFIX } from "./static-fn-DgjNArBe.js";
|
|
5
|
+
import { createClientOnlyFn, createIsomorphicFn, createServerOnlyFn } from "./env.js";
|
|
6
|
+
export { DATA_SUFFIX, FRAME_APPLIED_EVENT, InputError, LIVE_SUFFIX, NOT_FOUND, PAYLOAD_PARAM, REDIRECT, RPC_CALLER, RPC_CONTEXT, RPC_CONTROL, RPC_PREFIX, RPC_STREAM, RpcNotFound, RpcRedirect, SERVER_FN, STATIC_PREFIX, ServerFnError, UncheckedInputError, ValidationError, appendResponseHeader, applyResponseDraft, applyValidator, byIP, checkInput, clearResponseHeaders, clearSession, clearStart, clientRpc, collectRequestCss, createClientOnlyFn, createIsomorphicFn, createMiddleware, createResponseDraft, createSerializationAdapter, createServerFn, createServerOnlyFn, createStart, deleteCookie, deleteCookieLine, draftedStatus, flattenMiddleware, getCookie, getCookies, getGlobalStartContext, getRequest, getRequestHeader, getRequestHeaders, getRequestHost, getRequestIP, getRequestProtocol, getRequestUrl, getResponseHeader, getResponseHeaders, getResponseStatus, getSession, installCssSink, invalidateFrames, isBuiltMiddleware, isFrame, isInputError, isServerFn, json, live, markResponseSent, memoryStore, middlewareOf, parseCookies, peekRequest, peekResponseDraft, rateLimit, removeResponseHeader, runMiddleware, runRequestMiddleware, sealSession, serializeCookie, serverRpc, serverTiming, setCookie, setRequestMiddlewareContext, setResponseHeader, setResponseHeaders, setResponseStatus, startOptions, staticFunctionMiddleware, staticUrl, takeSendContext, toValidator, unsealSession, updateSession, useSession, withRequest };
|
|
@@ -0,0 +1,576 @@
|
|
|
1
|
+
//#region src/middleware.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Middleware, and the input validation it composes.
|
|
4
|
+
*
|
|
5
|
+
* ITS OWN MODULE FOR ONE REASON: `client.ts` needs it. A middleware's client
|
|
6
|
+
* half runs in the browser, so the runner has to be reachable from the client
|
|
7
|
+
* stub — and `index.ts` re-exports `context.ts`, which reaches
|
|
8
|
+
* `node:async_hooks`. Importing the index from `client.ts` is the leak
|
|
9
|
+
* `DEFAULT_CLIENT_SOURCE` exists to avoid, and it is not theoretical: the same
|
|
10
|
+
* import through a route's `middleware` once left a fully server-rendered page
|
|
11
|
+
* on which nothing was interactive.
|
|
12
|
+
*
|
|
13
|
+
* Nothing here imports anything of barq's, for that reason.
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* A validator in the Standard Schema shape, which zod, valibot and arktype all
|
|
17
|
+
* implement. Taking the interface rather than a library keeps the dependency
|
|
18
|
+
* out and lets an application bring its own.
|
|
19
|
+
*/
|
|
20
|
+
interface StandardSchema<In = unknown, Out = In> {
|
|
21
|
+
"~standard": {
|
|
22
|
+
version: 1;
|
|
23
|
+
vendor: string;
|
|
24
|
+
validate: (value: unknown) => {
|
|
25
|
+
value: Out;
|
|
26
|
+
} | {
|
|
27
|
+
issues: ReadonlyArray<unknown>;
|
|
28
|
+
} | Promise<{
|
|
29
|
+
value: Out;
|
|
30
|
+
} | {
|
|
31
|
+
issues: ReadonlyArray<unknown>;
|
|
32
|
+
}>;
|
|
33
|
+
/** The spec's type carrier: what the schema takes and what it produces. */
|
|
34
|
+
readonly types?: {
|
|
35
|
+
readonly input: In;
|
|
36
|
+
readonly output: Out;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
/** Anything with a Standard Schema validator on it, which is all a schema is read for. */
|
|
41
|
+
interface StandardSchemaLike {
|
|
42
|
+
readonly "~standard": {
|
|
43
|
+
readonly validate: (value: unknown) => unknown;
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
/** What a caller hands a schema: its declared input, or anything when it declares none. */
|
|
47
|
+
type StandardInput<Schema> = [SchemaTypes<Schema>] extends [{
|
|
48
|
+
readonly input: infer In;
|
|
49
|
+
}] ? In : unknown;
|
|
50
|
+
/** What a schema produces: its declared output, or what its `validate` succeeds with. */
|
|
51
|
+
type StandardOutput<Schema> = [SchemaTypes<Schema>] extends [{
|
|
52
|
+
readonly output: infer Out;
|
|
53
|
+
}] ? Out : Schema extends {
|
|
54
|
+
readonly "~standard": {
|
|
55
|
+
readonly validate: (value: unknown) => infer Result;
|
|
56
|
+
};
|
|
57
|
+
} ? Succeeded<Awaited<Result>> : unknown;
|
|
58
|
+
/** The spec's optional `types`, read by key: a schema without it shares no member to match on. */
|
|
59
|
+
type SchemaTypes<Schema> = Schema extends {
|
|
60
|
+
readonly "~standard": infer Spec;
|
|
61
|
+
} ? "types" extends keyof Spec ? NonNullable<Spec["types" & keyof Spec]> : undefined : undefined;
|
|
62
|
+
type Succeeded<Result> = Result extends {
|
|
63
|
+
readonly value: infer Out;
|
|
64
|
+
} ? Out : never;
|
|
65
|
+
/**
|
|
66
|
+
* `'unchecked'` is the only way to open the input channel without a schema, and
|
|
67
|
+
* it has to be typed out.
|
|
68
|
+
*
|
|
69
|
+
* The default is the opposite: a server function declared with no validator
|
|
70
|
+
* rejects ANY argument off the wire with a 400. Every system surveyed except
|
|
71
|
+
* SvelteKit passes raw deserialized input straight into the handler, and the
|
|
72
|
+
* cost of not doing so is one word.
|
|
73
|
+
*/
|
|
74
|
+
type Validator<T> = StandardSchema<unknown, T> | "unchecked";
|
|
75
|
+
/**
|
|
76
|
+
* What `.validator()` and `.inputValidator()` accept: a Standard Schema, a
|
|
77
|
+
* function that returns the validated value or throws, or an object with a
|
|
78
|
+
* `parse` that does. TanStack's three, probed in that order, since a zod schema
|
|
79
|
+
* is both the first and the third and the first reports issues without
|
|
80
|
+
* throwing.
|
|
81
|
+
*/
|
|
82
|
+
type ValidatorInput<T> = Validator<T> | ((input: unknown) => T | Promise<T>) | {
|
|
83
|
+
readonly parse: (input: unknown) => T | Promise<T>;
|
|
84
|
+
};
|
|
85
|
+
/** Any accepted validator, as the one shape the runner applies. */
|
|
86
|
+
declare function toValidator<T>(input: ValidatorInput<T>): Validator<T>;
|
|
87
|
+
declare const INPUT_ERROR: unique symbol;
|
|
88
|
+
/**
|
|
89
|
+
* The caller's input was not acceptable — a 400 rather than a 500, whichever way
|
|
90
|
+
* it failed. One base so the handler cannot answer one of them correctly and
|
|
91
|
+
* turn the other into a server error, which is exactly what shipped first here.
|
|
92
|
+
*/
|
|
93
|
+
declare class InputError extends Error {
|
|
94
|
+
/**
|
|
95
|
+
* A brand, read by {@link isInputError}, because `instanceof` answers for one
|
|
96
|
+
* copy of this module: a host's request handler would read a refusal the
|
|
97
|
+
* bundle's validator threw as a server error and answer 500.
|
|
98
|
+
*/
|
|
99
|
+
readonly [INPUT_ERROR]: true;
|
|
100
|
+
}
|
|
101
|
+
/** Whether a thrown value is the caller's fault, whichever copy of this module threw it. */
|
|
102
|
+
declare function isInputError(error: unknown): error is InputError;
|
|
103
|
+
declare class ValidationError extends InputError {
|
|
104
|
+
readonly issues: ReadonlyArray<unknown>;
|
|
105
|
+
constructor(issues: ReadonlyArray<unknown>);
|
|
106
|
+
}
|
|
107
|
+
/** Thrown when a call arrives for a function that declared no validator. */
|
|
108
|
+
declare class UncheckedInputError extends InputError {
|
|
109
|
+
constructor();
|
|
110
|
+
}
|
|
111
|
+
/** The empty contribution: what a step that adds nothing adds. */
|
|
112
|
+
type Empty = object;
|
|
113
|
+
/**
|
|
114
|
+
* A context the types know some of. A key no typed step declared still reads,
|
|
115
|
+
* as `unknown`: an untyped closure may have put it there.
|
|
116
|
+
*/
|
|
117
|
+
type OpenContext<Known extends object> = Known & Record<string, unknown>;
|
|
118
|
+
declare const NEXT: unique symbol;
|
|
119
|
+
/**
|
|
120
|
+
* What `next()` resolves to, as far as the types can see.
|
|
121
|
+
*
|
|
122
|
+
* At runtime it is whatever the rest of the chain answered. The type carries
|
|
123
|
+
* what this call contributed, so a middleware's context is read off the
|
|
124
|
+
* `return next({ context })` it ends with rather than declared a second time.
|
|
125
|
+
*/
|
|
126
|
+
interface NextResult<Context extends object = Empty, Sent extends object = Empty> {
|
|
127
|
+
readonly [NEXT]: {
|
|
128
|
+
readonly context: Context;
|
|
129
|
+
readonly sent: Sent;
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
/** What a middleware may hand `next`. */
|
|
133
|
+
interface NextOptions<Context extends object = Empty, Sent extends object = Empty> {
|
|
134
|
+
/**
|
|
135
|
+
* MERGED into what every step below is handed, the handler included. This is
|
|
136
|
+
* how a middleware that authenticates hands the session down without a
|
|
137
|
+
* module-level store.
|
|
138
|
+
*/
|
|
139
|
+
readonly context?: Context;
|
|
140
|
+
/**
|
|
141
|
+
* Context the OTHER side is given.
|
|
142
|
+
*
|
|
143
|
+
* From a server half it travels back on the response, so a middleware that
|
|
144
|
+
* resolved a session can tell the browser who it decided the user is without
|
|
145
|
+
* a second round trip. From a client half it travels to the server, where it
|
|
146
|
+
* arrives as `clientContext`: untrusted input, never `context`.
|
|
147
|
+
*
|
|
148
|
+
* It is SERIALIZED, so it carries what the value codec carries and nothing
|
|
149
|
+
* else. A `context` holding a database handle is fine; a `sendContext`
|
|
150
|
+
* holding one is a value the other side cannot be given.
|
|
151
|
+
*/
|
|
152
|
+
readonly sendContext?: Sent;
|
|
153
|
+
/**
|
|
154
|
+
* Request headers for the fetch, from a CLIENT half: an `Authorization` a
|
|
155
|
+
* middleware holds the token for, a trace id.
|
|
156
|
+
*
|
|
157
|
+
* A later step's value for a name replaces an earlier one's, and the call's
|
|
158
|
+
* own `headers` replace both. A server half has no request to add to, so
|
|
159
|
+
* there it does nothing; its response headers are `setResponseHeader`'s.
|
|
160
|
+
*/
|
|
161
|
+
readonly headers?: HeadersInit;
|
|
162
|
+
/**
|
|
163
|
+
* The `fetch` the call goes out through, from a CLIENT half: a retry, a
|
|
164
|
+
* tracer, a test double. A later step's replaces an earlier one's, and the
|
|
165
|
+
* call's own `fetch` option replaces both.
|
|
166
|
+
*/
|
|
167
|
+
readonly fetch?: typeof fetch;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* What a middleware calls to run the rest of the chain. `next()` with no
|
|
171
|
+
* argument runs it unchanged.
|
|
172
|
+
*/
|
|
173
|
+
type MiddlewareNext = <Context extends object = Empty, Sent extends object = Empty>(options?: NextOptions<Context, Sent>) => Promise<NextResult<NoInfer<Context>, NoInfer<Sent>>>;
|
|
174
|
+
/**
|
|
175
|
+
* A middleware runs before the handler and decides whether there is going to be
|
|
176
|
+
* one. Rejecting is `throw new Response(...)`, which the request handler returns
|
|
177
|
+
* as it stands.
|
|
178
|
+
*
|
|
179
|
+
* Per FUNCTION, not per route. Every framework in the survey documents the same
|
|
180
|
+
* hole instead of closing it — Next.js: "A page-level authentication check does
|
|
181
|
+
* not extend to the Server Actions defined within it… the Server Action is a
|
|
182
|
+
* separate entry point." A middleware attached here cannot be escaped by
|
|
183
|
+
* reaching the function from somewhere else, because there is nowhere else.
|
|
184
|
+
*
|
|
185
|
+
* `Context` is what a bare closure promises to add, and it is checked against
|
|
186
|
+
* what it passes to `next`: `Middleware<{ user: string }>` that ends in
|
|
187
|
+
* `next()` is a type error. A built middleware needs no annotation, since its
|
|
188
|
+
* context is read off its body.
|
|
189
|
+
*/
|
|
190
|
+
type Middleware<Context extends object = Empty> = Empty extends Context ? (next: MiddlewareNext) => Promise<unknown> : (next: MiddlewareNext) => Promise<NextResult<Context>>;
|
|
191
|
+
/**
|
|
192
|
+
* What a middleware contributes to everything after it, at the type level.
|
|
193
|
+
* Nothing here exists at runtime.
|
|
194
|
+
*/
|
|
195
|
+
interface Contribution {
|
|
196
|
+
/** Added to the server `context` of every later step and of the handler. */
|
|
197
|
+
readonly context: object;
|
|
198
|
+
/** What its server halves send back to the caller. */
|
|
199
|
+
readonly sent: object;
|
|
200
|
+
/** What its client halves add to the client `context`. */
|
|
201
|
+
readonly clientContext: object;
|
|
202
|
+
/** What the first validator in the chain is handed: the caller's `data`. */
|
|
203
|
+
readonly input: unknown;
|
|
204
|
+
/** What the last validator in the chain produced: every later step's `data`. */
|
|
205
|
+
readonly output: unknown;
|
|
206
|
+
readonly validates: boolean;
|
|
207
|
+
}
|
|
208
|
+
interface NoContribution extends Contribution {
|
|
209
|
+
readonly context: Empty;
|
|
210
|
+
readonly sent: Empty;
|
|
211
|
+
readonly clientContext: Empty;
|
|
212
|
+
readonly input: undefined;
|
|
213
|
+
readonly output: undefined;
|
|
214
|
+
readonly validates: false;
|
|
215
|
+
}
|
|
216
|
+
/** `first`, then `second`: in the order the chain runs them. */
|
|
217
|
+
interface Merged<First extends Contribution, Second extends Contribution> extends Contribution {
|
|
218
|
+
readonly context: First["context"] & Second["context"];
|
|
219
|
+
readonly sent: First["sent"] & Second["sent"];
|
|
220
|
+
readonly clientContext: First["clientContext"] & Second["clientContext"];
|
|
221
|
+
readonly input: First["validates"] extends true ? First["input"] : Second["input"];
|
|
222
|
+
readonly output: Second["validates"] extends true ? Second["output"] : First["output"];
|
|
223
|
+
readonly validates: First["validates"] extends true ? true : Second["validates"];
|
|
224
|
+
}
|
|
225
|
+
/** What one `next(...)` call contributed, from the result it resolved to. */
|
|
226
|
+
type FromNext<Result> = Result extends NextResult<infer Context, infer Sent> ? {
|
|
227
|
+
readonly context: Plain<Context>;
|
|
228
|
+
readonly sent: Plain<Sent>;
|
|
229
|
+
} : never;
|
|
230
|
+
/** The same keys as one object, so a hover shows the context rather than how it was built. */
|
|
231
|
+
type Plain<Value> = { [Key in keyof Value]: Value[Key]; };
|
|
232
|
+
/**
|
|
233
|
+
* What a body contributed, from everything it can return. A branch that
|
|
234
|
+
* answers without calling `next` contributes nothing, and the handler never
|
|
235
|
+
* runs on it, so it is left out rather than widening the rest to nothing.
|
|
236
|
+
*/
|
|
237
|
+
type ContributedBy<Result> = [FromNext<Result>] extends [never] ? {
|
|
238
|
+
readonly context: Empty;
|
|
239
|
+
readonly sent: Empty;
|
|
240
|
+
} : FromNext<Result>;
|
|
241
|
+
declare const CONTRIBUTES: unique symbol;
|
|
242
|
+
/**
|
|
243
|
+
* The type-level record a built middleware carries.
|
|
244
|
+
*
|
|
245
|
+
* A METHOD and optional, so it exists in no value and compares bivariantly:
|
|
246
|
+
* one builder implementation serves every state, and what is read back is
|
|
247
|
+
* exact because it is read with `infer`.
|
|
248
|
+
*/
|
|
249
|
+
interface Carries<Types extends Contribution> {
|
|
250
|
+
[CONTRIBUTES]?(types: Types): void;
|
|
251
|
+
}
|
|
252
|
+
/** What a middleware contributes, whichever way it was written. */
|
|
253
|
+
type ContributionOf<Step> = Step extends Carries<infer Types> ? Types : Step extends ((next: never) => Promise<infer Result>) ? Merged<NoContribution, NoContribution & Omit<ContributedBy<Result>, never>> extends (infer Out) ? Out extends Contribution ? Out : NoContribution : NoContribution : NoContribution;
|
|
254
|
+
/** What a whole chain contributes, steps in the order they run. */
|
|
255
|
+
type ChainContribution<Chain> = Chain extends readonly [infer Head, ...infer Rest] ? Merged<ContributionOf<Head>, ChainContribution<Rest>> : Chain extends readonly [] ? NoContribution : Chain extends readonly (infer Step)[] ? ContributionOf<Step> : NoContribution;
|
|
256
|
+
/** Where a built middleware is: the chain it declared, and what it adds itself. */
|
|
257
|
+
interface MiddlewareState {
|
|
258
|
+
readonly chain: Contribution;
|
|
259
|
+
readonly own: Contribution;
|
|
260
|
+
}
|
|
261
|
+
interface FreshMiddleware extends MiddlewareState {
|
|
262
|
+
readonly chain: NoContribution;
|
|
263
|
+
readonly own: NoContribution;
|
|
264
|
+
}
|
|
265
|
+
interface WithChain<State extends MiddlewareState, Chain> extends MiddlewareState {
|
|
266
|
+
readonly chain: ChainContribution<Chain>;
|
|
267
|
+
readonly own: State["own"];
|
|
268
|
+
}
|
|
269
|
+
interface OwnReplaced<Own extends Contribution, Context extends object, Sent extends object> extends Contribution {
|
|
270
|
+
readonly context: Context;
|
|
271
|
+
readonly sent: Sent;
|
|
272
|
+
readonly clientContext: Own["clientContext"];
|
|
273
|
+
readonly input: Own["input"];
|
|
274
|
+
readonly output: Own["output"];
|
|
275
|
+
readonly validates: Own["validates"];
|
|
276
|
+
}
|
|
277
|
+
interface WithServer<State extends MiddlewareState, Result> extends MiddlewareState {
|
|
278
|
+
readonly chain: State["chain"];
|
|
279
|
+
readonly own: OwnReplaced<State["own"], ContributedBy<Awaited<Result>>["context"], ContributedBy<Awaited<Result>>["sent"]>;
|
|
280
|
+
}
|
|
281
|
+
interface ClientReplaced<Own extends Contribution, ClientContext extends object> extends Contribution {
|
|
282
|
+
readonly context: Own["context"];
|
|
283
|
+
readonly sent: Own["sent"];
|
|
284
|
+
readonly clientContext: ClientContext;
|
|
285
|
+
readonly input: Own["input"];
|
|
286
|
+
readonly output: Own["output"];
|
|
287
|
+
readonly validates: Own["validates"];
|
|
288
|
+
}
|
|
289
|
+
interface WithClient<State extends MiddlewareState, Result> extends MiddlewareState {
|
|
290
|
+
readonly chain: State["chain"];
|
|
291
|
+
readonly own: ClientReplaced<State["own"], ContributedBy<Awaited<Result>>["context"]>;
|
|
292
|
+
}
|
|
293
|
+
interface ValidatorReplaced<Own extends Contribution, In, Out> extends Contribution {
|
|
294
|
+
readonly context: Own["context"];
|
|
295
|
+
readonly sent: Own["sent"];
|
|
296
|
+
readonly clientContext: Own["clientContext"];
|
|
297
|
+
readonly input: In;
|
|
298
|
+
readonly output: Out;
|
|
299
|
+
readonly validates: true;
|
|
300
|
+
}
|
|
301
|
+
interface WithValidator<State extends MiddlewareState, In, Out> extends MiddlewareState {
|
|
302
|
+
readonly chain: State["chain"];
|
|
303
|
+
readonly own: ValidatorReplaced<State["own"], In, Out>;
|
|
304
|
+
}
|
|
305
|
+
/** What a built middleware contributes: its chain, then itself. */
|
|
306
|
+
type ContributionOfState<State extends MiddlewareState> = Merged<State["chain"], State["own"]>;
|
|
307
|
+
/** The `data` a step is handed: what the nearest validator above it produced. */
|
|
308
|
+
type DataAt<State extends MiddlewareState> = State["own"]["validates"] extends true ? State["own"]["output"] : State["chain"]["validates"] extends true ? State["chain"]["output"] : unknown;
|
|
309
|
+
/**
|
|
310
|
+
* What a built middleware's server half is handed.
|
|
311
|
+
*
|
|
312
|
+
* The OBJECT shape, where a bare `Middleware` closure takes `next` positionally.
|
|
313
|
+
* Both are supported and neither is deprecated: the closure is what a
|
|
314
|
+
* one-line guard writes, and this is what a middleware with a validator, a
|
|
315
|
+
* client half or a `sendContext` needs.
|
|
316
|
+
*/
|
|
317
|
+
interface MiddlewareContext<Data = unknown, Context extends object = Empty> {
|
|
318
|
+
readonly next: MiddlewareNext;
|
|
319
|
+
/**
|
|
320
|
+
* The input, as THIS middleware's validator left it.
|
|
321
|
+
*
|
|
322
|
+
* Validators compose along the chain: each one is handed what the one before
|
|
323
|
+
* it returned, and the function's own runs last. That is TanStack's pipeline
|
|
324
|
+
* (`createServerFn.ts:271-274`) and it is what lets a middleware normalise an
|
|
325
|
+
* argument every function under it then receives already normalised.
|
|
326
|
+
*/
|
|
327
|
+
readonly data: Data;
|
|
328
|
+
/** What the middlewares outside this one contributed. */
|
|
329
|
+
readonly context: OpenContext<Context>;
|
|
330
|
+
/**
|
|
331
|
+
* What the client halves sent with `next({ sendContext })`, as it came off
|
|
332
|
+
* the wire.
|
|
333
|
+
*
|
|
334
|
+
* UNTRUSTED, and kept apart from `context` for that reason: a caller writes
|
|
335
|
+
* the request body by hand as readily as the stub does, so this is input to
|
|
336
|
+
* check and never a fact to act on. Everything read from `context` was put
|
|
337
|
+
* there by a server step; a value from here joins it only when a server half
|
|
338
|
+
* passes it on with `next({ context })`. Untyped for the same reason: a type
|
|
339
|
+
* here would be a claim about what a stranger sent.
|
|
340
|
+
*
|
|
341
|
+
* Empty in a client half, and for a call made in-process.
|
|
342
|
+
*/
|
|
343
|
+
readonly clientContext: Readonly<Record<string, unknown>>;
|
|
344
|
+
readonly signal: AbortSignal;
|
|
345
|
+
/**
|
|
346
|
+
* The request, when this middleware is running for one: as a request
|
|
347
|
+
* middleware, global or on a route. Absent around a server function's own
|
|
348
|
+
* chain, where `getRequest()` is the way to it.
|
|
349
|
+
*/
|
|
350
|
+
readonly request?: Request;
|
|
351
|
+
/** The request's path, with any base stripped. Present with `request`. */
|
|
352
|
+
readonly pathname?: string;
|
|
353
|
+
/** What the request is for. Present with `request`. */
|
|
354
|
+
readonly handlerType?: "router" | "serverFn";
|
|
355
|
+
/**
|
|
356
|
+
* The server function this chain is running around, by its id. Absent for a
|
|
357
|
+
* request middleware, and the id is empty for a function that is not mounted.
|
|
358
|
+
*/
|
|
359
|
+
readonly serverFnMeta?: {
|
|
360
|
+
readonly id: string;
|
|
361
|
+
};
|
|
362
|
+
/** The method the server function answers. Absent for a request middleware. */
|
|
363
|
+
readonly method?: "GET" | "POST";
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* What a client half is handed: the caller's raw `data`, since validators run
|
|
367
|
+
* on the server, and a `context` holding what the client halves before it
|
|
368
|
+
* added and, once `next()` has resolved, what the server sent back.
|
|
369
|
+
*/
|
|
370
|
+
interface ClientMiddlewareContext<Context extends object = Empty, Sent extends object = Empty> extends MiddlewareContext<unknown, Context & Partial<Sent>> {}
|
|
371
|
+
/** Any server or client half, as the runner calls it. */
|
|
372
|
+
type MiddlewareFn = (context: MiddlewareContext) => unknown;
|
|
373
|
+
/** What a request middleware calls to run the rest of the request. */
|
|
374
|
+
type RequestMiddlewareNext = <Context extends object = Empty>(options?: {
|
|
375
|
+
readonly context?: Context;
|
|
376
|
+
}) => Promise<(Response & NextResult<NoInfer<Context>>) | undefined>;
|
|
377
|
+
/**
|
|
378
|
+
* What a request middleware is handed: the request is always there.
|
|
379
|
+
*
|
|
380
|
+
* `next()` resolves to the response, or `undefined` from a route handler that
|
|
381
|
+
* declined, so the page render answers instead.
|
|
382
|
+
*/
|
|
383
|
+
interface RequestMiddlewareContext<Context extends object = Empty> {
|
|
384
|
+
readonly next: RequestMiddlewareNext;
|
|
385
|
+
readonly data: undefined;
|
|
386
|
+
readonly context: OpenContext<Context>;
|
|
387
|
+
readonly clientContext: Readonly<Record<string, unknown>>;
|
|
388
|
+
readonly signal: AbortSignal;
|
|
389
|
+
readonly request: Request;
|
|
390
|
+
readonly pathname: string;
|
|
391
|
+
readonly handlerType: "router" | "serverFn";
|
|
392
|
+
}
|
|
393
|
+
type RequestMiddlewareFn = (context: RequestMiddlewareContext) => unknown;
|
|
394
|
+
/** What a built middleware carries, and what the runner reads off it. */
|
|
395
|
+
interface MiddlewareOptions {
|
|
396
|
+
/**
|
|
397
|
+
* TanStack's two kinds. `"request"` runs for a server request and is handed
|
|
398
|
+
* it; `"function"` runs around a server function and may have a client half.
|
|
399
|
+
* One builder makes both and the runner asks only where a middleware was
|
|
400
|
+
* listed, so the kind decides the TYPES of what `.server` is handed.
|
|
401
|
+
*/
|
|
402
|
+
readonly type?: "request" | "function";
|
|
403
|
+
readonly middleware?: readonly Middleware[];
|
|
404
|
+
readonly validator?: Validator<unknown>;
|
|
405
|
+
readonly server?: MiddlewareFn;
|
|
406
|
+
readonly client?: MiddlewareFn;
|
|
407
|
+
}
|
|
408
|
+
/**
|
|
409
|
+
* A middleware with more than a body: a chain of its own, an input validator,
|
|
410
|
+
* and separate halves for the two sides.
|
|
411
|
+
*
|
|
412
|
+
* IT IS STILL A FUNCTION. `Middleware` is a callable and the route-action
|
|
413
|
+
* verifier compares chains with `===`, so making this an object — which is what
|
|
414
|
+
* TanStack's is — would have broken both at once: a route's `middleware: [m]`
|
|
415
|
+
* would no longer typecheck, and every existing bare closure would need
|
|
416
|
+
* wrapping. A callable object is neither: it runs where a closure ran, it
|
|
417
|
+
* compares by identity as a closure did, and `options` is there for the runner
|
|
418
|
+
* that wants more.
|
|
419
|
+
*
|
|
420
|
+
* What each step adds is TYPED: a `.server` that ends in
|
|
421
|
+
* `next({ context: { user } })` hands `user` to every function that lists this
|
|
422
|
+
* middleware, typed as the body wrote it.
|
|
423
|
+
*/
|
|
424
|
+
type BuiltMiddleware<State extends MiddlewareState = MiddlewareState> = Middleware & Carries<ContributionOfState<State>> & {
|
|
425
|
+
readonly options: MiddlewareOptions;
|
|
426
|
+
/** Middlewares that run BEFORE this one, flattened into the chain that uses it. */
|
|
427
|
+
middleware<const Chain extends readonly Middleware[]>(chain: Chain): BuiltMiddleware<WithChain<State, Chain>>;
|
|
428
|
+
/**
|
|
429
|
+
* Validates and narrows the input every step after this one is handed. The
|
|
430
|
+
* schema form is tried first: an arktype type is callable as well, and read
|
|
431
|
+
* as a function its declared input would be lost.
|
|
432
|
+
*/
|
|
433
|
+
validator<Schema extends StandardSchemaLike>(schema: Schema): BuiltMiddleware<WithValidator<State, StandardInput<Schema>, StandardOutput<Schema>>>;
|
|
434
|
+
validator<In, Out>(validate: (input: In) => Out): BuiltMiddleware<WithValidator<State, In, Awaited<Out>>>;
|
|
435
|
+
validator<In, Out>(schema: {
|
|
436
|
+
readonly parse: (input: In) => Out;
|
|
437
|
+
}): BuiltMiddleware<WithValidator<State, In, Awaited<Out>>>;
|
|
438
|
+
validator(unchecked: "unchecked"): BuiltMiddleware<WithValidator<State, unknown, unknown>>;
|
|
439
|
+
/** `validator` under the name TanStack's release candidates used. */
|
|
440
|
+
inputValidator<Schema extends StandardSchemaLike>(schema: Schema): BuiltMiddleware<WithValidator<State, StandardInput<Schema>, StandardOutput<Schema>>>;
|
|
441
|
+
inputValidator<In, Out>(validate: (input: In) => Out): BuiltMiddleware<WithValidator<State, In, Awaited<Out>>>;
|
|
442
|
+
inputValidator<In, Out>(schema: {
|
|
443
|
+
readonly parse: (input: In) => Out;
|
|
444
|
+
}): BuiltMiddleware<WithValidator<State, In, Awaited<Out>>>;
|
|
445
|
+
inputValidator(unchecked: "unchecked"): BuiltMiddleware<WithValidator<State, unknown, unknown>>;
|
|
446
|
+
/** The half that runs on the server, where the handler is. */
|
|
447
|
+
server<Result>(fn: (context: MiddlewareContext<DataAt<State>, State["chain"]["context"]>) => Result): BuiltMiddleware<WithServer<State, Result>>;
|
|
448
|
+
/**
|
|
449
|
+
* The half that runs in the BROWSER, around the fetch.
|
|
450
|
+
*
|
|
451
|
+
* `next({ sendContext })` from here is what travels to the server half as
|
|
452
|
+
* `clientContext`. The compiler carries this into the client stub and leaves
|
|
453
|
+
* the server half behind, so a middleware may hold both without either
|
|
454
|
+
* reaching the wrong bundle.
|
|
455
|
+
*/
|
|
456
|
+
client<Result>(fn: (context: ClientMiddlewareContext<State["chain"]["clientContext"], State["chain"]["sent"]>) => Result): BuiltMiddleware<WithClient<State, Result>>;
|
|
457
|
+
};
|
|
458
|
+
/**
|
|
459
|
+
* The two brands a thrown redirect and a thrown `notFound()` carry.
|
|
460
|
+
*
|
|
461
|
+
* DECLARED TWICE ON PURPOSE. The classes live in `@barqjs/router`, which this
|
|
462
|
+
* package must not import: the dependency runs router -> start and start is an
|
|
463
|
+
* OPTIONAL peer of it, so an import here would be a cycle and would break the
|
|
464
|
+
* router for anyone using it without server functions. `Symbol.for` is the
|
|
465
|
+
* global registry, so both declarations name the same symbol with no edge
|
|
466
|
+
* between the packages — `SERVER_FN` in `client.ts` already works this way. The other
|
|
467
|
+
* declaration is `REDIRECT` / `NOT_FOUND` in `packages/router/src/errors.ts`,
|
|
468
|
+
* and `server.test.ts` checks the two agree.
|
|
469
|
+
*/
|
|
470
|
+
declare const REDIRECT: unique symbol;
|
|
471
|
+
declare const NOT_FOUND: unique symbol;
|
|
472
|
+
/** Whether a middleware was built by {@link createMiddleware}. */
|
|
473
|
+
declare function isBuiltMiddleware(value: Middleware): value is BuiltMiddleware;
|
|
474
|
+
/**
|
|
475
|
+
* Author a middleware that is more than one closure.
|
|
476
|
+
*
|
|
477
|
+
* `createMiddleware().server(async ({ next, context }) => next({ context: … }))`
|
|
478
|
+
* is the ordinary shape, and it is what a bare closure already did. What the
|
|
479
|
+
* builder adds is the three things a closure has nowhere to put: a chain of its
|
|
480
|
+
* own, an input validator, and a client half.
|
|
481
|
+
*
|
|
482
|
+
* EACH CALL RETURNS A NEW MIDDLEWARE, and the exported one is the last. That
|
|
483
|
+
* matters because the verifier compares by identity: a builder that mutated and
|
|
484
|
+
* returned itself would make every intermediate the same object as the final
|
|
485
|
+
* one, which is harmless, and one that shared its options object across
|
|
486
|
+
* branches — which TanStack's does — would make two middlewares built from one
|
|
487
|
+
* base overwrite each other. Neither is a risk worth carrying for an allocation.
|
|
488
|
+
*/
|
|
489
|
+
declare function createMiddleware(options: MiddlewareOptions & {
|
|
490
|
+
readonly type: "request";
|
|
491
|
+
}): RequestMiddleware<FreshMiddleware>;
|
|
492
|
+
declare function createMiddleware(options?: MiddlewareOptions): BuiltMiddleware<FreshMiddleware>;
|
|
493
|
+
/**
|
|
494
|
+
* A middleware built with `type: "request"`: a chain of its own and a server
|
|
495
|
+
* body that is always handed the request. It is a {@link BuiltMiddleware}
|
|
496
|
+
* underneath, so it goes wherever a `Middleware` does, and what its body passes
|
|
497
|
+
* to `next({ context })` is typed into everything after it.
|
|
498
|
+
*/
|
|
499
|
+
type RequestMiddleware<State extends MiddlewareState = MiddlewareState> = Middleware & Carries<ContributionOfState<State>> & {
|
|
500
|
+
readonly options: MiddlewareOptions;
|
|
501
|
+
middleware<const Chain extends readonly Middleware[]>(chain: Chain): RequestMiddleware<WithChain<State, Chain>>;
|
|
502
|
+
server<Result>(fn: (context: RequestMiddlewareContext<State["chain"]["context"]>) => Result): RequestMiddleware<WithServer<State, NonNullable<Awaited<Result>>>>;
|
|
503
|
+
};
|
|
504
|
+
/** Where a request middleware chain is running. */
|
|
505
|
+
interface RequestMiddlewareStart {
|
|
506
|
+
readonly request: Request;
|
|
507
|
+
readonly pathname: string;
|
|
508
|
+
readonly handlerType: "router" | "serverFn";
|
|
509
|
+
/** What the chain has produced so far; mutated as it unwinds inward. */
|
|
510
|
+
readonly context: Record<string, unknown>;
|
|
511
|
+
}
|
|
512
|
+
/**
|
|
513
|
+
* Run a chain of request middleware around `run`.
|
|
514
|
+
*
|
|
515
|
+
* `next()` resolves to whatever is inside: the response, or `undefined` from a
|
|
516
|
+
* route handler that declined. A middleware answers with what it returns, so
|
|
517
|
+
* one that returns `next()` passes the answer through and one that returns a
|
|
518
|
+
* `Response` of its own replaces it.
|
|
519
|
+
*/
|
|
520
|
+
declare function runRequestMiddleware<T>(chain: readonly Middleware[], start: RequestMiddlewareStart, run: () => Promise<T>): Promise<T>;
|
|
521
|
+
/**
|
|
522
|
+
* The chain a middleware list really is: every nested chain spliced in ahead of
|
|
523
|
+
* the middleware that declared it, each step once.
|
|
524
|
+
*
|
|
525
|
+
* Depth-first and parents-first, which is TanStack's `flattenMiddlewares` and
|
|
526
|
+
* the only order that means anything — a middleware declares a chain because it
|
|
527
|
+
* DEPENDS on it, so those steps have to have run by the time it does.
|
|
528
|
+
*
|
|
529
|
+
* Deduplicated by IDENTITY, so two middlewares that both depend on
|
|
530
|
+
* `requireSession` do not authenticate twice. That is also what keeps the
|
|
531
|
+
* route-action verifier honest: it asks whether a function's flattened chain
|
|
532
|
+
* contains the route's steps, and a step reached through a nest counts.
|
|
533
|
+
*/
|
|
534
|
+
declare function flattenMiddleware(chain: readonly Middleware[], depth?: number): readonly Middleware[];
|
|
535
|
+
/** One validator, applied. `"unchecked"` and absence both pass the value through. */
|
|
536
|
+
declare function applyValidator(validator: Validator<unknown> | undefined, raw: unknown): Promise<unknown>;
|
|
537
|
+
/**
|
|
538
|
+
* Run a flattened chain, then the innermost work.
|
|
539
|
+
*
|
|
540
|
+
* ONE RUNNER FOR BOTH SIDES, and `half` is which of a built middleware's two
|
|
541
|
+
* bodies to call. A bare closure has neither and is invoked positionally, which
|
|
542
|
+
* is what it has always been — so a chain may mix the two spellings and the
|
|
543
|
+
* order is the order it was written in.
|
|
544
|
+
*
|
|
545
|
+
* A middleware that declares no half for THIS side is skipped rather than
|
|
546
|
+
* refused: a `.server(...)`-only middleware is transparent in the browser, and
|
|
547
|
+
* a `.client(...)`-only one is transparent on the server. That is what makes
|
|
548
|
+
* one exported middleware usable from a route and a server function alike.
|
|
549
|
+
*/
|
|
550
|
+
declare function runMiddleware(chain: readonly Middleware[], half: "server" | "client", start: {
|
|
551
|
+
readonly data: unknown;
|
|
552
|
+
readonly signal: AbortSignal;
|
|
553
|
+
/** What the chain has produced so far; mutated as the chain unwinds inward. */
|
|
554
|
+
readonly context: Record<string, unknown>;
|
|
555
|
+
/** What the client halves sent, on the server. Never merged into `context`. */
|
|
556
|
+
readonly clientContext?: Record<string, unknown>;
|
|
557
|
+
/** What travels back to the caller. */
|
|
558
|
+
readonly sendContext: Record<string, unknown>;
|
|
559
|
+
/** Where a client half's `next({ headers })` collects. Absent on the server. */
|
|
560
|
+
readonly headers?: Headers;
|
|
561
|
+
/** Where a client half's `next({ fetch })` lands. Absent on the server. */
|
|
562
|
+
readonly fetch?: {
|
|
563
|
+
current: typeof fetch | undefined;
|
|
564
|
+
};
|
|
565
|
+
/** The function the chain is running around. */
|
|
566
|
+
readonly meta?: {
|
|
567
|
+
readonly id: string;
|
|
568
|
+
};
|
|
569
|
+
/** The method that function answers. */
|
|
570
|
+
readonly method?: "GET" | "POST";
|
|
571
|
+
/** The innermost work: the handler on the server, the fetch on the client. */
|
|
572
|
+
readonly run: (data: unknown) => Promise<unknown>;
|
|
573
|
+
}): Promise<unknown>;
|
|
574
|
+
//#endregion
|
|
575
|
+
export { runMiddleware as $, RequestMiddleware as A, ValidationError as B, NextOptions as C, OwnReplaced as D, OpenContext as E, StandardInput as F, WithClient as G, ValidatorInput as H, StandardOutput as I, applyValidator as J, WithServer as K, StandardSchema as L, RequestMiddlewareFn as M, RequestMiddlewareNext as N, Plain as O, RequestMiddlewareStart as P, isInputError as Q, StandardSchemaLike as R, NOT_FOUND as S, NoContribution as T, ValidatorReplaced as U, Validator as V, WithChain as W, flattenMiddleware as X, createMiddleware as Y, isBuiltMiddleware as Z, MiddlewareContext as _, ClientReplaced as a, MiddlewareOptions as b, ContributionOf as c, Empty as d, runRequestMiddleware as et, FreshMiddleware as f, Middleware as g, Merged as h, ClientMiddlewareContext as i, RequestMiddlewareContext as j, REDIRECT as k, ContributionOfState as l, InputError as m, Carries as n, ContributedBy as o, FromNext as p, WithValidator as q, ChainContribution as r, Contribution as s, BuiltMiddleware as t, toValidator as tt, DataAt as u, MiddlewareFn as v, NextResult as w, MiddlewareState as x, MiddlewareNext as y, UncheckedInputError as z };
|
|
576
|
+
//# sourceMappingURL=middleware-BdVlE8qm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"middleware-BdVlE8qm.d.ts","names":[],"sources":["../src/middleware.ts"],"mappings":";;;;;;;;;;;;;;;;;;;UAmBiB,eAAe,cAAc,MAAM;EAClD;IACE;IACA;IACA,WACE;MAEI,OAAO;;MACP,QAAQ;QACV;MAAU,OAAO;;MAAU,QAAQ;;;aAE9B;eAAmB,OAAO;eAAa,QAAQ;;;;;UAK3C;WACN;aAAwB,WAAW;;;;KAIlC,cAAc,WAAW,YAAY;WAA6B,aAAa;KACvF;;KAIQ,eAAe,WAAW,YAAY;WAA6B,cAAc;KACzF,MACA;WAA0B;aAAwB,WAAW,yBAAyB;;IACpF,UAAU,QAAQ;;KAInB,YAAY,UAAU;WAA0B,mBAAmB;0BAC9C,OACpB,YAAY,qBAAqB;KAIlC,UAAU,UAAU;WAA0B,aAAa;IAAQ;;;;;;;;;;KAW5D,UAAU,KAAK,wBAAwB;;;;;;;;KASvC,eAAe,KACvB,UAAU,OACR,mBAAmB,IAAI,QAAQ;WACtB,QAAQ,mBAAmB,IAAI,QAAQ;;;iBAGtC,YAAY,GAAG,OAAO,eAAe,KAAK,UAAU;cA2B9D;;;;;;cAOO,mBAAmB;;;;;;YAMpB;;;iBAII,aAAa,iBAAiB,SAAS;cAQ1C,wBAAwB;WAC1B,QAAQ;EACjB,YAAY,QAAQ;;;cAWT,4BAA4B;EACvC;;;KAUU;;;;;KAMA,YAAY,wBAAwB,QAAQ;cAE1C;;;;;;;;UASG,WAAW,yBAAyB,OAAO,sBAAsB;YACtE;aAAkB,SAAS;aAAkB,MAAM;;;;UAI9C,YAAY,yBAAyB,OAAO,sBAAsB;;;;;;WAMxE,UAAU;;;;;;;;;;;;;WAaV,cAAc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BAAkB,WAAW,OAAO,YAAY,QAAQ;;;UAI9C;WACN,SAAS;WACT;WACA;;WAEA,SAAS;;;;;;;;;;iBAWE,qBAAqB,GACzC,gBAAgB,cAChB,OAAO,wBACP,WAAW,QAAQ,KAClB,QAAQ;;;;;;;;;;;;;;iBAuDK,kBAAkB,gBAAgB,cAAc,0BAAqB;;iBAuB/D,eACpB,WAAW,gCACX,eACC;;;;;;;;;;;;;;iBAoBmB,cACpB,gBAAgB,cAChB,2BACA;WACW;WACA,QAAQ;;WAER,SAAS;;WAET,gBAAgB;;WAEhB,aAAa;;WAEb,UAAU;;WAEV;IAAU,gBAAgB;;;WAE1B;aAAkB;;;WAElB;;WAEA,MAAM,kBAAkB;IAElC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { $ as runMiddleware, A as RequestMiddleware, B as ValidationError, C as NextOptions, D as OwnReplaced, E as OpenContext, F as StandardInput, G as WithClient, H as ValidatorInput, I as StandardOutput, J as applyValidator, K as WithServer, L as StandardSchema, M as RequestMiddlewareFn, N as RequestMiddlewareNext, O as Plain, P as RequestMiddlewareStart, Q as isInputError, R as StandardSchemaLike, S as NOT_FOUND, T as NoContribution, U as ValidatorReplaced, V as Validator, W as WithChain, X as flattenMiddleware, Y as createMiddleware, Z as isBuiltMiddleware, _ as MiddlewareContext, a as ClientReplaced, b as MiddlewareOptions, c as ContributionOf, d as Empty, et as runRequestMiddleware, f as FreshMiddleware, g as Middleware, h as Merged, i as ClientMiddlewareContext, j as RequestMiddlewareContext, k as REDIRECT, l as ContributionOfState, m as InputError, n as Carries, o as ContributedBy, p as FromNext, q as WithValidator, r as ChainContribution, s as Contribution, t as BuiltMiddleware, tt as toValidator, u as DataAt, v as MiddlewareFn, w as NextResult, x as MiddlewareState, y as MiddlewareNext, z as UncheckedInputError } from "./middleware-BdVlE8qm.js";
|
|
2
|
+
export { BuiltMiddleware, Carries, ChainContribution, ClientMiddlewareContext, ClientReplaced, ContributedBy, Contribution, ContributionOf, ContributionOfState, DataAt, Empty, FreshMiddleware, FromNext, InputError, Merged, Middleware, MiddlewareContext, MiddlewareFn, MiddlewareNext, MiddlewareOptions, MiddlewareState, NOT_FOUND, NextOptions, NextResult, NoContribution, OpenContext, OwnReplaced, Plain, REDIRECT, RequestMiddleware, RequestMiddlewareContext, RequestMiddlewareFn, RequestMiddlewareNext, RequestMiddlewareStart, StandardInput, StandardOutput, StandardSchema, StandardSchemaLike, UncheckedInputError, ValidationError, Validator, ValidatorInput, ValidatorReplaced, WithChain, WithClient, WithServer, WithValidator, applyValidator, createMiddleware, flattenMiddleware, isBuiltMiddleware, isInputError, runMiddleware, runRequestMiddleware, toValidator };
|