@trpc/server 11.25.2 → 11.25.3-canary.13.g1341462e1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters/aws-lambda/index.cjs +5 -8
- package/dist/adapters/aws-lambda/index.d.cts +13 -5
- package/dist/adapters/aws-lambda/index.d.cts.map +1 -1
- package/dist/adapters/aws-lambda/index.d.mts +11 -5
- package/dist/adapters/aws-lambda/index.d.mts.map +1 -1
- package/dist/adapters/aws-lambda/index.mjs +5 -8
- package/dist/adapters/aws-lambda/index.mjs.map +1 -1
- package/dist/adapters/express.cjs +4 -5
- package/dist/adapters/express.d.cts +12 -4
- package/dist/adapters/express.d.cts.map +1 -1
- package/dist/adapters/express.d.mts +11 -4
- package/dist/adapters/express.d.mts.map +1 -1
- package/dist/adapters/express.mjs +4 -5
- package/dist/adapters/fastify/index.cjs +6 -8
- package/dist/adapters/fastify/index.d.cts +6 -8
- package/dist/adapters/fastify/index.d.cts.map +1 -1
- package/dist/adapters/fastify/index.d.mts +4 -8
- package/dist/adapters/fastify/index.d.mts.map +1 -1
- package/dist/adapters/fastify/index.mjs +6 -8
- package/dist/adapters/fastify/index.mjs.map +1 -1
- package/dist/adapters/fetch/index.cjs +3 -4
- package/dist/adapters/fetch/index.d.cts +3 -5
- package/dist/adapters/fetch/index.d.cts.map +1 -1
- package/dist/adapters/fetch/index.d.mts +1 -5
- package/dist/adapters/fetch/index.d.mts.map +1 -1
- package/dist/adapters/fetch/index.mjs +3 -4
- package/dist/adapters/next-app-dir.cjs +7 -11
- package/dist/adapters/next-app-dir.d.cts +8 -10
- package/dist/adapters/next-app-dir.d.cts.map +1 -1
- package/dist/adapters/next-app-dir.d.mts +7 -10
- package/dist/adapters/next-app-dir.d.mts.map +1 -1
- package/dist/adapters/next-app-dir.mjs +6 -10
- package/dist/adapters/next-app-dir.mjs.map +1 -1
- package/dist/adapters/next.cjs +5 -6
- package/dist/adapters/next.d.cts +12 -4
- package/dist/adapters/next.d.cts.map +1 -1
- package/dist/adapters/next.d.mts +11 -4
- package/dist/adapters/next.d.mts.map +1 -1
- package/dist/adapters/next.mjs +5 -6
- package/dist/adapters/node-http/index.cjs +1 -1
- package/dist/adapters/node-http/index.d.cts +103 -2
- package/dist/adapters/node-http/index.d.cts.map +1 -0
- package/dist/adapters/node-http/index.d.mts +1 -1
- package/dist/adapters/node-http/index.mjs +1 -2
- package/dist/adapters/standalone.cjs +5 -6
- package/dist/adapters/standalone.d.cts +13 -5
- package/dist/adapters/standalone.d.cts.map +1 -1
- package/dist/adapters/standalone.d.mts +12 -5
- package/dist/adapters/standalone.d.mts.map +1 -1
- package/dist/adapters/standalone.mjs +4 -5
- package/dist/adapters/standalone.mjs.map +1 -1
- package/dist/adapters/ws.cjs +1 -1
- package/dist/adapters/ws.d.cts +95 -3
- package/dist/adapters/ws.d.cts.map +1 -0
- package/dist/adapters/ws.d.mts +2 -2
- package/dist/adapters/ws.mjs +1 -2
- package/dist/{asyncGeneratorDelegate-JWx0LJUD.mjs → asyncGeneratorDelegate-BRQGtkYG.mjs} +30 -51
- package/dist/{asyncGeneratorDelegate-JWx0LJUD.mjs.map → asyncGeneratorDelegate-BRQGtkYG.mjs.map} +1 -1
- package/dist/{asyncGeneratorDelegate-CMdmcplC.cjs → asyncGeneratorDelegate-o88TWuuI.cjs} +29 -50
- package/dist/{codes-Be-DrYMh.cjs → codes-B96YeNnY.cjs} +2 -4
- package/dist/{codes-nbrm_zWY.mjs → codes-BCsCCyMj.mjs} +3 -5
- package/dist/{codes-nbrm_zWY.mjs.map → codes-BCsCCyMj.mjs.map} +1 -1
- package/dist/{contentTypeParsers-D1EBkFFY.mjs → contentTypeParsers-g-hK2Sqe.mjs} +2 -3
- package/dist/{contentTypeParsers-D1EBkFFY.mjs.map → contentTypeParsers-g-hK2Sqe.mjs.map} +1 -1
- package/dist/{contentTypeParsers-BTdoZrqN.cjs → contentTypeParsers-st4U3xYo.cjs} +1 -2
- package/dist/{getErrorShape-BAuHhNuh.cjs → getErrorShape-B1AlrJBV.cjs} +15 -24
- package/dist/{getErrorShape-B5jPKHJ3.mjs → getErrorShape-CVrl8_-w.mjs} +16 -25
- package/dist/{getErrorShape-B5jPKHJ3.mjs.map → getErrorShape-CVrl8_-w.mjs.map} +1 -1
- package/dist/http-11_NyRWk.d.cts +1 -0
- package/dist/http.cjs +3 -3
- package/dist/http.d.cts +2 -1
- package/dist/http.d.mts +1 -1
- package/dist/http.mjs +3 -3
- package/dist/{index-CFQnkrGZ.d.cts → index-BdKWn-Kv.d.cts} +1 -9
- package/dist/index-BdKWn-Kv.d.cts.map +1 -0
- package/dist/{index-CFQnkrGZ.d.mts → index-BdKWn-Kv.d.mts} +1 -9
- package/dist/index-BdKWn-Kv.d.mts.map +1 -0
- package/dist/{index-DVmu6VtT.d.mts → index-C7UHVQQf.d.mts} +2 -8
- package/dist/index-C7UHVQQf.d.mts.map +1 -0
- package/dist/index-DVXG_v0W.d.cts +9 -0
- package/dist/index-DVXG_v0W.d.cts.map +1 -0
- package/dist/index.cjs +3 -3
- package/dist/index.d.cts +3 -11
- package/dist/index.d.mts +1 -3
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +3 -3
- package/dist/{initTRPC-DPoVGUwX.mjs → initTRPC-BRhOzCfA.mjs} +15 -22
- package/dist/{initTRPC-DPoVGUwX.mjs.map → initTRPC-BRhOzCfA.mjs.map} +1 -1
- package/dist/{initTRPC-yeYwDikA.cjs → initTRPC-RIE9F856.cjs} +14 -21
- package/dist/{node-http-CyL_jN-0.mjs → node-http-5y0OmcF3.mjs} +8 -11
- package/dist/{node-http-CyL_jN-0.mjs.map → node-http-5y0OmcF3.mjs.map} +1 -1
- package/dist/{node-http-BnGON5Za.cjs → node-http-962IXGVP.cjs} +7 -10
- package/dist/observable/index.cjs +2 -2
- package/dist/observable/index.d.cts +1 -1
- package/dist/observable/index.d.mts +1 -1
- package/dist/observable/index.mjs +2 -2
- package/dist/{observable-Cmd1MFy3.mjs → observable-BjUZYMQq.mjs} +4 -6
- package/dist/{observable-Cmd1MFy3.mjs.map → observable-BjUZYMQq.mjs.map} +1 -1
- package/dist/{observable-kpFFzvou.mjs → observable-CodTG6Sf.mjs} +2 -3
- package/dist/{observable-kpFFzvou.mjs.map → observable-CodTG6Sf.mjs.map} +1 -1
- package/dist/{observable-1zKJIeLl.cjs → observable-DWjyAi42.cjs} +1 -2
- package/dist/{observable-CtU0hoef.cjs → observable-a_nbCVWw.cjs} +3 -5
- package/dist/{parseTRPCMessage-BsPr5reh.cjs → parseTRPCMessage-BHVPK_9B.cjs} +3 -5
- package/dist/{parseTRPCMessage-BO1-cCsX.mjs → parseTRPCMessage-_j-ul9Ni.mjs} +4 -6
- package/dist/{parseTRPCMessage-BO1-cCsX.mjs.map → parseTRPCMessage-_j-ul9Ni.mjs.map} +1 -1
- package/dist/{resolveResponse-2MBY36PP.mjs → resolveResponse-CWLbNRmT.mjs} +22 -39
- package/dist/{resolveResponse-2MBY36PP.mjs.map → resolveResponse-CWLbNRmT.mjs.map} +1 -1
- package/dist/{resolveResponse-CiTYuZCi.cjs → resolveResponse-FM4r4UGZ.cjs} +21 -38
- package/dist/{rolldown-runtime-CFW-PwTP.cjs → rolldown-runtime-Ct0tUeOX.cjs} +1 -2
- package/dist/rpc.cjs +2 -2
- package/dist/rpc.d.cts +1 -1
- package/dist/rpc.d.mts +1 -1
- package/dist/rpc.mjs +2 -2
- package/dist/shared.cjs +1 -1
- package/dist/shared.d.cts +2 -1
- package/dist/shared.d.mts +1 -1
- package/dist/shared.mjs +1 -2
- package/dist/{unstable-core-do-not-import-Db2TnFh8.d.cts → unstable-core-do-not-import-C8Gy-fzS.d.cts} +2 -84
- package/dist/unstable-core-do-not-import-C8Gy-fzS.d.cts.map +1 -0
- package/dist/{unstable-core-do-not-import-CzDUc5m2.d.mts → unstable-core-do-not-import-d-SHdPM9.d.mts} +2 -84
- package/dist/unstable-core-do-not-import-d-SHdPM9.d.mts.map +1 -0
- package/dist/unstable-core-do-not-import.cjs +8 -9
- package/dist/unstable-core-do-not-import.d.cts +11 -1
- package/dist/unstable-core-do-not-import.d.mts +11 -1
- package/dist/unstable-core-do-not-import.mjs +8 -9
- package/dist/{ws-Bl1WQEXo.mjs → ws-B4qoo-Ep.mjs} +10 -12
- package/dist/{ws-Bl1WQEXo.mjs.map → ws-B4qoo-Ep.mjs.map} +1 -1
- package/dist/{ws-BRFs3IJR.cjs → ws-D3hgtSpa.cjs} +9 -11
- package/dist/{ws-D-DF_k_T.d.cts → ws-DkO_xnzu.d.mts} +3 -5
- package/dist/ws-DkO_xnzu.d.mts.map +1 -0
- package/package.json +26 -26
- package/skills/adapter-aws-lambda/SKILL.md +1 -1
- package/skills/adapter-express/SKILL.md +1 -1
- package/skills/adapter-fastify/SKILL.md +1 -1
- package/skills/adapter-fetch/SKILL.md +1 -1
- package/skills/adapter-standalone/SKILL.md +1 -1
- package/skills/auth/SKILL.md +1 -1
- package/skills/caching/SKILL.md +1 -1
- package/skills/error-handling/SKILL.md +1 -1
- package/skills/middlewares/SKILL.md +1 -1
- package/skills/non-json-content-types/SKILL.md +1 -1
- package/skills/server-setup/SKILL.md +1 -1
- package/skills/server-side-calls/SKILL.md +1 -1
- package/skills/service-oriented-architecture/SKILL.md +1 -1
- package/skills/subscriptions/SKILL.md +1 -1
- package/skills/trpc-router/SKILL.md +1 -1
- package/skills/validators/SKILL.md +5 -3
- package/src/adapters/aws-lambda/index.ts +2 -0
- package/src/adapters/fastify/fastifyRequestHandler.ts +1 -1
- package/src/adapters/next-app-dir/redirect.ts +7 -1
- package/src/adapters/standalone.ts +1 -1
- package/dist/index-CFQnkrGZ.d.cts.map +0 -1
- package/dist/index-CFQnkrGZ.d.mts.map +0 -1
- package/dist/index-DVmu6VtT.d.mts.map +0 -1
- package/dist/index-Dn1ucZS5.d.cts +0 -107
- package/dist/index-Dn1ucZS5.d.cts.map +0 -1
- package/dist/index.d.cts.map +0 -1
- package/dist/unstable-core-do-not-import-CzDUc5m2.d.mts.map +0 -1
- package/dist/unstable-core-do-not-import-Db2TnFh8.d.cts.map +0 -1
- package/dist/ws-D-DF_k_T.d.cts.map +0 -1
- package/dist/ws-lJRDMspc.d.mts +0 -95
- package/dist/ws-lJRDMspc.d.mts.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { d as isObject, n as TRPC_ERROR_CODES_BY_NUMBER, s as emptyObject, t as TRPC_ERROR_CODES_BY_KEY } from "./codes-
|
|
2
|
-
|
|
1
|
+
import { d as isObject, n as TRPC_ERROR_CODES_BY_NUMBER, s as emptyObject, t as TRPC_ERROR_CODES_BY_KEY } from "./codes-BCsCCyMj.mjs";
|
|
2
|
+
// src/unstable-core-do-not-import/createProxy.ts
|
|
3
3
|
const noop = () => {};
|
|
4
4
|
const freezeIfAvailable = (obj) => {
|
|
5
5
|
if (Object.freeze) Object.freeze(obj);
|
|
@@ -51,8 +51,7 @@ const createFlatProxy = (callback) => {
|
|
|
51
51
|
return callback(name);
|
|
52
52
|
} });
|
|
53
53
|
};
|
|
54
|
-
|
|
55
|
-
//#region src/unstable-core-do-not-import/http/getHTTPStatusCode.ts
|
|
54
|
+
// src/unstable-core-do-not-import/http/getHTTPStatusCode.ts
|
|
56
55
|
const JSONRPC2_TO_HTTP_CODE = {
|
|
57
56
|
PARSE_ERROR: 400,
|
|
58
57
|
BAD_REQUEST: 400,
|
|
@@ -132,8 +131,7 @@ function getHTTPStatusCode(json, errors) {
|
|
|
132
131
|
function getHTTPStatusCodeFromError(error) {
|
|
133
132
|
return getStatusCodeFromKey(error.code);
|
|
134
133
|
}
|
|
135
|
-
|
|
136
|
-
//#region src/unstable-core-do-not-import/error/formatter.ts
|
|
134
|
+
// src/unstable-core-do-not-import/error/formatter.ts
|
|
137
135
|
const defaultFormatter = ({ shape }) => {
|
|
138
136
|
return shape;
|
|
139
137
|
};
|
|
@@ -174,8 +172,7 @@ function getFormattedErrorShape(error) {
|
|
|
174
172
|
function isFormattedErrorShape(error) {
|
|
175
173
|
return formattedShapeSymbol in error;
|
|
176
174
|
}
|
|
177
|
-
|
|
178
|
-
//#region \0@oxc-project+runtime@0.149.0/helpers/esm/typeof.js
|
|
175
|
+
// \0@oxc-project+runtime@0.157.0/helpers/esm/typeof.js
|
|
179
176
|
function _typeof(o) {
|
|
180
177
|
"@babel/helpers - typeof";
|
|
181
178
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -184,26 +181,23 @@ function _typeof(o) {
|
|
|
184
181
|
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
185
182
|
}, _typeof(o);
|
|
186
183
|
}
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
function toPrimitive(t, r) {
|
|
184
|
+
// \0@oxc-project+runtime@0.157.0/helpers/esm/toPrimitive.js
|
|
185
|
+
function toPrimitive(t, e) {
|
|
190
186
|
if ("object" != _typeof(t) || !t) return t;
|
|
191
|
-
var
|
|
192
|
-
if (void 0 !==
|
|
193
|
-
var i =
|
|
187
|
+
var r;
|
|
188
|
+
if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) {
|
|
189
|
+
var i = r.call(t, e || "default");
|
|
194
190
|
if ("object" != _typeof(i)) return i;
|
|
195
191
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
196
192
|
}
|
|
197
|
-
return ("string" ===
|
|
193
|
+
return ("string" === e ? String : Number)(t);
|
|
198
194
|
}
|
|
199
|
-
|
|
200
|
-
//#region \0@oxc-project+runtime@0.149.0/helpers/esm/toPropertyKey.js
|
|
195
|
+
// \0@oxc-project+runtime@0.157.0/helpers/esm/toPropertyKey.js
|
|
201
196
|
function toPropertyKey(t) {
|
|
202
197
|
var i = toPrimitive(t, "string");
|
|
203
198
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
204
199
|
}
|
|
205
|
-
|
|
206
|
-
//#region \0@oxc-project+runtime@0.149.0/helpers/esm/defineProperty.js
|
|
200
|
+
// \0@oxc-project+runtime@0.157.0/helpers/esm/defineProperty.js
|
|
207
201
|
function _defineProperty(e, r, t) {
|
|
208
202
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
209
203
|
value: t,
|
|
@@ -212,8 +206,7 @@ function _defineProperty(e, r, t) {
|
|
|
212
206
|
writable: !0
|
|
213
207
|
}) : e[r] = t, e;
|
|
214
208
|
}
|
|
215
|
-
|
|
216
|
-
//#region \0@oxc-project+runtime@0.149.0/helpers/esm/objectSpread2.js
|
|
209
|
+
// \0@oxc-project+runtime@0.157.0/helpers/esm/objectSpread2.js
|
|
217
210
|
function ownKeys(e, r) {
|
|
218
211
|
var t = Object.keys(e);
|
|
219
212
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -235,8 +228,7 @@ function _objectSpread2(e) {
|
|
|
235
228
|
}
|
|
236
229
|
return e;
|
|
237
230
|
}
|
|
238
|
-
|
|
239
|
-
//#region src/unstable-core-do-not-import/error/getErrorShape.ts
|
|
231
|
+
// src/unstable-core-do-not-import/error/getErrorShape.ts
|
|
240
232
|
/**
|
|
241
233
|
* The shape of an error as the client gets it: from a procedure's
|
|
242
234
|
* `.errors()` formatter if one ran, or else from the root error formatter.
|
|
@@ -253,8 +245,7 @@ function getErrorShape(opts) {
|
|
|
253
245
|
});
|
|
254
246
|
return config.errorFormatter(_objectSpread2(_objectSpread2({}, opts), {}, { shape }));
|
|
255
247
|
}
|
|
256
|
-
//#endregion
|
|
257
248
|
export { getDefaultErrorShape as a, setFormattedErrorShape as c, getHTTPStatusCode as d, getHTTPStatusCodeFromError as f, createRecursiveProxy as g, createFlatProxy as h, defaultFormatter as i, HTTP_CODE_TO_JSONRPC2 as l, getStatusKeyFromCode as m, _objectSpread2 as n, getFormattedErrorShape as o, getStatusCodeFromKey as p, _defineProperty as r, isFormattedErrorShape as s, getErrorShape as t, JSONRPC2_TO_HTTP_CODE as u };
|
|
258
249
|
|
|
259
250
|
|
|
260
|
-
//# sourceMappingURL=getErrorShape-
|
|
251
|
+
//# sourceMappingURL=getErrorShape-CVrl8_-w.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getErrorShape-B5jPKHJ3.mjs","names":[],"sources":["../src/unstable-core-do-not-import/createProxy.ts","../src/unstable-core-do-not-import/http/getHTTPStatusCode.ts","../src/unstable-core-do-not-import/error/formatter.ts","../src/unstable-core-do-not-import/error/getErrorShape.ts"],"sourcesContent":["import { emptyObject } from './utils';\n\ninterface ProxyCallbackOptions {\n path: readonly string[];\n args: readonly unknown[];\n}\ntype ProxyCallback = (opts: ProxyCallbackOptions) => unknown;\n\nconst noop = () => {\n // noop\n};\n\nconst freezeIfAvailable = (obj: object) => {\n if (Object.freeze) {\n Object.freeze(obj);\n }\n};\n\nfunction createInnerProxy(\n callback: ProxyCallback,\n path: readonly string[],\n memo: Record<string, unknown>,\n) {\n const cacheKey = path.join('.');\n\n memo[cacheKey] ??= new Proxy(noop, {\n get(_obj, key) {\n if (typeof key !== 'string' || key === 'then') {\n // special case for if the proxy is accidentally treated\n // like a PromiseLike (like in `Promise.resolve(proxy)`)\n return undefined;\n }\n return createInnerProxy(callback, [...path, key], memo);\n },\n apply(_1, _2, args) {\n const lastOfPath = path[path.length - 1];\n\n // React 19 may call valueOf / toString / toJSON when coercing a proxy\n // to a primitive (e.g. during rendering or logging). Return a debug\n // string so the coercion does not recurse into the proxy. This only\n // triggers for direct calls (proxy.toString()), not for chained access\n // (proxy.toString.query()), preserving route naming freedom.\n if (\n lastOfPath === 'valueOf' ||\n lastOfPath === 'toString' ||\n lastOfPath === 'toJSON'\n ) {\n const debugPath = path.slice(0, -1).join('.');\n return `tRPC.proxy(${debugPath})`;\n }\n\n let opts = { args, path };\n // special handling for e.g. `trpc.hello.call(this, 'there')` and `trpc.hello.apply(this, ['there'])\n if (lastOfPath === 'call') {\n opts = {\n args: args.length >= 2 ? [args[1]] : [],\n path: path.slice(0, -1),\n };\n } else if (lastOfPath === 'apply') {\n opts = {\n args: args.length >= 2 ? args[1] : [],\n path: path.slice(0, -1),\n };\n }\n freezeIfAvailable(opts.args);\n freezeIfAvailable(opts.path);\n return callback(opts);\n },\n });\n\n return memo[cacheKey];\n}\n\n/**\n * Creates a proxy that records the property path it's accessed with, and\n * calls `callback` with the path and arguments when it's called.\n * @internal\n */\nexport const createRecursiveProxy = <TFaux = unknown>(\n callback: ProxyCallback,\n): TFaux => createInnerProxy(callback, [], emptyObject()) as TFaux;\n\n/**\n * Creates a proxy that maps each property to `callback(name)`, one level\n * deep. It's not thenable.\n * @internal\n */\nexport const createFlatProxy = <TFaux>(\n callback: (path: keyof TFaux) => any,\n): TFaux => {\n return new Proxy(noop, {\n get(_obj, name) {\n if (name === 'then') {\n // special case for if the proxy is accidentally treated\n // like a PromiseLike (like in `Promise.resolve(proxy)`)\n return undefined;\n }\n return callback(name as any);\n },\n }) as TFaux;\n};\n","import type { TRPCError } from '../error/TRPCError';\nimport type { TRPC_ERROR_CODES_BY_KEY, TRPCResponse } from '../rpc';\nimport { TRPC_ERROR_CODES_BY_NUMBER } from '../rpc';\nimport type { InvertKeyValue, ValueOf } from '../types';\nimport { isObject } from '../utils';\n\nexport const JSONRPC2_TO_HTTP_CODE: Record<\n keyof typeof TRPC_ERROR_CODES_BY_KEY,\n number\n> = {\n PARSE_ERROR: 400,\n BAD_REQUEST: 400,\n UNAUTHORIZED: 401,\n PAYMENT_REQUIRED: 402,\n FORBIDDEN: 403,\n NOT_FOUND: 404,\n METHOD_NOT_SUPPORTED: 405,\n TIMEOUT: 408,\n CONFLICT: 409,\n PRECONDITION_FAILED: 412,\n PAYLOAD_TOO_LARGE: 413,\n UNSUPPORTED_MEDIA_TYPE: 415,\n UNPROCESSABLE_CONTENT: 422,\n PRECONDITION_REQUIRED: 428,\n TOO_MANY_REQUESTS: 429,\n CLIENT_CLOSED_REQUEST: 499,\n INTERNAL_SERVER_ERROR: 500,\n NOT_IMPLEMENTED: 501,\n BAD_GATEWAY: 502,\n SERVICE_UNAVAILABLE: 503,\n GATEWAY_TIMEOUT: 504,\n};\n\nexport const HTTP_CODE_TO_JSONRPC2: InvertKeyValue<\n typeof JSONRPC2_TO_HTTP_CODE\n> = {\n 400: 'BAD_REQUEST',\n 401: 'UNAUTHORIZED',\n 402: 'PAYMENT_REQUIRED',\n 403: 'FORBIDDEN',\n 404: 'NOT_FOUND',\n 405: 'METHOD_NOT_SUPPORTED',\n 408: 'TIMEOUT',\n 409: 'CONFLICT',\n 412: 'PRECONDITION_FAILED',\n 413: 'PAYLOAD_TOO_LARGE',\n 415: 'UNSUPPORTED_MEDIA_TYPE',\n 422: 'UNPROCESSABLE_CONTENT',\n 428: 'PRECONDITION_REQUIRED',\n 429: 'TOO_MANY_REQUESTS',\n 499: 'CLIENT_CLOSED_REQUEST',\n 500: 'INTERNAL_SERVER_ERROR',\n 501: 'NOT_IMPLEMENTED',\n 502: 'BAD_GATEWAY',\n 503: 'SERVICE_UNAVAILABLE',\n 504: 'GATEWAY_TIMEOUT',\n} as const;\n\nexport function getStatusCodeFromKey(\n code: keyof typeof TRPC_ERROR_CODES_BY_KEY,\n) {\n return JSONRPC2_TO_HTTP_CODE[code] ?? 500;\n}\n\nexport function getStatusKeyFromCode(\n code: keyof typeof HTTP_CODE_TO_JSONRPC2,\n): ValueOf<typeof HTTP_CODE_TO_JSONRPC2> {\n return HTTP_CODE_TO_JSONRPC2[code] ?? 'INTERNAL_SERVER_ERROR';\n}\n\n/**\n * The HTTP status for a response, or for a batch of them: `207` when the\n * responses' statuses differ.\n * @see https://trpc.io/docs/rpc#error-codes---http-status\n */\nexport function getHTTPStatusCode(\n json: TRPCResponse | TRPCResponse[],\n errors?: readonly (TRPCError | undefined)[],\n) {\n const arr = Array.isArray(json) ? json : [json];\n const httpStatuses = new Set<number>(\n arr.map((res, index) => {\n if ('error' in res) {\n if (\n isObject(res.error.data) &&\n typeof res.error.data['httpStatus'] === 'number'\n ) {\n return res.error.data['httpStatus'];\n }\n // several error codes share `-32603`, so the formatted code cannot\n // recover the original status when a formatter strips `data`\n const original = errors?.[index];\n if (original) {\n return getStatusCodeFromKey(original.code);\n }\n const code = TRPC_ERROR_CODES_BY_NUMBER[res.error.code];\n return getStatusCodeFromKey(code);\n }\n return 200;\n }),\n );\n\n if (httpStatuses.size !== 1) {\n return 207;\n }\n\n const httpStatus = httpStatuses.values().next().value;\n\n // oxlint-disable-next-line typescript/no-non-null-assertion\n return httpStatus!;\n}\n\n/**\n * The HTTP status of a `TRPCError`'s code.\n * @see https://trpc.io/docs/rpc#error-codes---http-status\n */\nexport function getHTTPStatusCodeFromError(error: TRPCError) {\n return getStatusCodeFromKey(error.code);\n}\n","import { getHTTPStatusCodeFromError } from '../http/getHTTPStatusCode';\nimport type { ProcedureType } from '../procedure';\nimport type {\n TRPC_ERROR_CODE_KEY,\n TRPC_ERROR_CODE_NUMBER,\n TRPCErrorShape,\n} from '../rpc';\nimport { TRPC_ERROR_CODES_BY_KEY } from '../rpc';\nimport type { Overwrite, Simplify } from '../types';\nimport type { TRPCError } from './TRPCError';\n\n/**\n * What an error formatter gets.\n * @see https://trpc.io/docs/server/error-formatting#all-properties-sent-to-errorformatter\n * @internal\n */\nexport interface ErrorFormatterOptions<TContext> {\n error: TRPCError;\n type: ProcedureType | 'unknown';\n /** The procedure's path, if the error came from one. */\n path: string | undefined;\n input: unknown;\n /** The context, if it was created before the error. */\n ctx: TContext;\n /** The shape tRPC sends by default, to extend or replace. */\n shape: DefaultErrorShape;\n}\n\n/**\n * Shapes the errors a router sends to the client.\n * @see https://trpc.io/docs/server/error-formatting\n * @internal\n */\nexport type ErrorFormatter<TContext, TShape extends TRPCErrorShape> = (\n opts: ErrorFormatterOptions<TContext | undefined>,\n) => TShape;\n\n/**\n * An error formatter for one procedure, as `.errors()` takes it. Return\n * `undefined` to leave the error to the next formatter.\n * @see https://trpc.io/docs/server/error-formatting#per-procedure-error-formatting\n * @internal\n */\nexport type ProcedureErrorFormatter<\n TContext,\n TContextOverrides,\n TShape extends TRPCErrorShape | undefined | void,\n> = (\n opts: ErrorFormatterOptions<Simplify<Overwrite<TContext, TContextOverrides>>>,\n) => TShape;\n\n/**\n * @internal\n */\nexport type AnyProcedureErrorFormatter = ProcedureErrorFormatter<any, any, any>;\n\n/**\n * The `data` of the default error shape.\n * @internal\n */\nexport type DefaultErrorData = {\n code: TRPC_ERROR_CODE_KEY;\n httpStatus: number;\n /**\n * The path of the procedure that threw.\n */\n path?: string;\n /**\n * The error's stack trace, only when `isDev` is set.\n */\n stack?: string;\n};\n\n/**\n * The error shape tRPC sends when there's no error formatter.\n * @see https://trpc.io/docs/server/error-formatting\n * @internal\n */\nexport interface DefaultErrorShape extends TRPCErrorShape<DefaultErrorData> {\n message: string;\n code: TRPC_ERROR_CODE_NUMBER;\n}\n\nexport const defaultFormatter: ErrorFormatter<any, any> = ({ shape }) => {\n return shape;\n};\n\n/**\n * @internal\n */\nexport function getDefaultErrorShape(opts: {\n error: TRPCError;\n path: string | undefined;\n isDev: boolean;\n}): DefaultErrorShape {\n const shape: DefaultErrorShape = {\n message: opts.error.message,\n code: TRPC_ERROR_CODES_BY_KEY[opts.error.code],\n data: {\n code: opts.error.code,\n httpStatus: getHTTPStatusCodeFromError(opts.error),\n },\n };\n if (opts.isDev && typeof opts.error.stack === 'string') {\n shape.data.stack = opts.error.stack;\n }\n if (typeof opts.path === 'string') {\n shape.data.path = opts.path;\n }\n return shape;\n}\n\nconst formattedShapeSymbol = Symbol('trpc_formattedErrorShape');\n\n/**\n * @internal\n */\nexport function setFormattedErrorShape(\n error: TRPCError,\n shape: TRPCErrorShape,\n): asserts error is TRPCError & { [formattedShapeSymbol]: TRPCErrorShape } {\n Object.defineProperty(error, formattedShapeSymbol, {\n value: shape,\n enumerable: false,\n configurable: true,\n writable: true,\n });\n}\n\n/**\n * @internal\n */\nexport function getFormattedErrorShape(\n error: TRPCError,\n): TRPCErrorShape | undefined {\n if (isFormattedErrorShape(error)) {\n return error[formattedShapeSymbol];\n }\n\n return undefined;\n}\n\nexport function isFormattedErrorShape(\n error: TRPCError,\n): error is TRPCError & { [formattedShapeSymbol]: TRPCErrorShape } {\n return formattedShapeSymbol in error;\n}\n","import type { ProcedureType } from '../procedure';\nimport type { AnyRootTypes, RootConfig } from '../rootConfig';\nimport { getDefaultErrorShape, getFormattedErrorShape } from './formatter';\nimport type { TRPCError } from './TRPCError';\n\n/**\n * The shape of an error as the client gets it: from a procedure's\n * `.errors()` formatter if one ran, or else from the root error formatter.\n * @internal\n */\nexport function getErrorShape<TRoot extends AnyRootTypes>(opts: {\n config: RootConfig<TRoot>;\n error: TRPCError;\n type: ProcedureType | 'unknown';\n path: string | undefined;\n input: unknown;\n ctx: TRoot['ctx'] | undefined;\n}): TRoot['errorShape'] {\n const { path, error, config } = opts;\n\n // a `.errors()` handler already created the final shape\n const formatted = getFormattedErrorShape(error);\n if (formatted !== undefined) {\n return formatted;\n }\n\n const shape = getDefaultErrorShape({ error, path, isDev: config.isDev });\n return config.errorFormatter({ ...opts, shape });\n}\n"],"mappings":";;AAQA,MAAM,aAAa,CAEnB;AAEA,MAAM,qBAAqB,QAAgB;CACzC,IAAI,OAAO,QACT,OAAO,OAAO,GAAG;AAErB;AAEA,SAAS,iBACP,UACA,MACA,MACA;;CACA,MAAM,WAAW,KAAK,KAAK,GAAG;CAE9B,CAAA,iBAAA,KAAK,eAAA,QAAA,mBAAA,KAAA,MAAL,KAAK,YAAc,IAAI,MAAM,MAAM;EACjC,IAAI,MAAM,KAAK;GACb,IAAI,OAAO,QAAQ,YAAY,QAAQ,QAGrC;GAEF,OAAO,iBAAiB,UAAU,CAAC,GAAG,MAAM,GAAG,GAAG,IAAI;EACxD;EACA,MAAM,IAAI,IAAI,MAAM;GAClB,MAAM,aAAa,KAAK,KAAK,SAAS;GAOtC,IACE,eAAe,aACf,eAAe,cACf,eAAe,UAGf,OAAO,cADW,KAAK,MAAM,GAAG,EAAE,CAAC,CAAC,KAAK,GACZ,EAAE;GAGjC,IAAI,OA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yE;CACzE,OAAO,eAAe,OAAO,sBAAsB;EACjD,OAAO;EACP,YAAY;EACZ,cAAc;EACd,UAAU;CACZ,CAAC;AACH;;;;AAKA,SAAgB,uBACd,OAC4B;CAC5B,IAAI,sBAAsB,KAAK,GAC7B,OAAO,MAAM;AAIjB;AAEA,SAAgB,sBACd,OACiE;CACjE,OAAO,wBAAwB;AACjC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACxIA,SAAgB,cAA0C,MAOlC;CACtB,MAAM,EAAE,MAAM,OAAO,WAAW;CAGhC,MAAM,YAAY,uBAAuB,KAAK;CAC9C,IAAI,cAAc,KAAA,GAChB,OAAO;CAGT,MAAM,QAAQ,qBAAqB;EAAE;EAAO;EAAM,OAAO,OAAO;CAAM,CAAC;CACvE,OAAO,OAAO,eAAA,eAAA,eAAA,CAAA,GAAoB,IAAA,GAAA,CAAA,GAAA,EAAM,MAAA,CAAM,CAAC;AACjD"}
|
|
1
|
+
{"version":3,"file":"getErrorShape-CVrl8_-w.mjs","names":[],"sources":["../src/unstable-core-do-not-import/createProxy.ts","../src/unstable-core-do-not-import/http/getHTTPStatusCode.ts","../src/unstable-core-do-not-import/error/formatter.ts","../src/unstable-core-do-not-import/error/getErrorShape.ts"],"sourcesContent":["import { emptyObject } from './utils';\n\ninterface ProxyCallbackOptions {\n path: readonly string[];\n args: readonly unknown[];\n}\ntype ProxyCallback = (opts: ProxyCallbackOptions) => unknown;\n\nconst noop = () => {\n // noop\n};\n\nconst freezeIfAvailable = (obj: object) => {\n if (Object.freeze) {\n Object.freeze(obj);\n }\n};\n\nfunction createInnerProxy(\n callback: ProxyCallback,\n path: readonly string[],\n memo: Record<string, unknown>,\n) {\n const cacheKey = path.join('.');\n\n memo[cacheKey] ??= new Proxy(noop, {\n get(_obj, key) {\n if (typeof key !== 'string' || key === 'then') {\n // special case for if the proxy is accidentally treated\n // like a PromiseLike (like in `Promise.resolve(proxy)`)\n return undefined;\n }\n return createInnerProxy(callback, [...path, key], memo);\n },\n apply(_1, _2, args) {\n const lastOfPath = path[path.length - 1];\n\n // React 19 may call valueOf / toString / toJSON when coercing a proxy\n // to a primitive (e.g. during rendering or logging). Return a debug\n // string so the coercion does not recurse into the proxy. This only\n // triggers for direct calls (proxy.toString()), not for chained access\n // (proxy.toString.query()), preserving route naming freedom.\n if (\n lastOfPath === 'valueOf' ||\n lastOfPath === 'toString' ||\n lastOfPath === 'toJSON'\n ) {\n const debugPath = path.slice(0, -1).join('.');\n return `tRPC.proxy(${debugPath})`;\n }\n\n let opts = { args, path };\n // special handling for e.g. `trpc.hello.call(this, 'there')` and `trpc.hello.apply(this, ['there'])\n if (lastOfPath === 'call') {\n opts = {\n args: args.length >= 2 ? [args[1]] : [],\n path: path.slice(0, -1),\n };\n } else if (lastOfPath === 'apply') {\n opts = {\n args: args.length >= 2 ? args[1] : [],\n path: path.slice(0, -1),\n };\n }\n freezeIfAvailable(opts.args);\n freezeIfAvailable(opts.path);\n return callback(opts);\n },\n });\n\n return memo[cacheKey];\n}\n\n/**\n * Creates a proxy that records the property path it's accessed with, and\n * calls `callback` with the path and arguments when it's called.\n * @internal\n */\nexport const createRecursiveProxy = <TFaux = unknown>(\n callback: ProxyCallback,\n): TFaux => createInnerProxy(callback, [], emptyObject()) as TFaux;\n\n/**\n * Creates a proxy that maps each property to `callback(name)`, one level\n * deep. It's not thenable.\n * @internal\n */\nexport const createFlatProxy = <TFaux>(\n callback: (path: keyof TFaux) => any,\n): TFaux => {\n return new Proxy(noop, {\n get(_obj, name) {\n if (name === 'then') {\n // special case for if the proxy is accidentally treated\n // like a PromiseLike (like in `Promise.resolve(proxy)`)\n return undefined;\n }\n return callback(name as any);\n },\n }) as TFaux;\n};\n","import type { TRPCError } from '../error/TRPCError';\nimport type { TRPC_ERROR_CODES_BY_KEY, TRPCResponse } from '../rpc';\nimport { TRPC_ERROR_CODES_BY_NUMBER } from '../rpc';\nimport type { InvertKeyValue, ValueOf } from '../types';\nimport { isObject } from '../utils';\n\nexport const JSONRPC2_TO_HTTP_CODE: Record<\n keyof typeof TRPC_ERROR_CODES_BY_KEY,\n number\n> = {\n PARSE_ERROR: 400,\n BAD_REQUEST: 400,\n UNAUTHORIZED: 401,\n PAYMENT_REQUIRED: 402,\n FORBIDDEN: 403,\n NOT_FOUND: 404,\n METHOD_NOT_SUPPORTED: 405,\n TIMEOUT: 408,\n CONFLICT: 409,\n PRECONDITION_FAILED: 412,\n PAYLOAD_TOO_LARGE: 413,\n UNSUPPORTED_MEDIA_TYPE: 415,\n UNPROCESSABLE_CONTENT: 422,\n PRECONDITION_REQUIRED: 428,\n TOO_MANY_REQUESTS: 429,\n CLIENT_CLOSED_REQUEST: 499,\n INTERNAL_SERVER_ERROR: 500,\n NOT_IMPLEMENTED: 501,\n BAD_GATEWAY: 502,\n SERVICE_UNAVAILABLE: 503,\n GATEWAY_TIMEOUT: 504,\n};\n\nexport const HTTP_CODE_TO_JSONRPC2: InvertKeyValue<\n typeof JSONRPC2_TO_HTTP_CODE\n> = {\n 400: 'BAD_REQUEST',\n 401: 'UNAUTHORIZED',\n 402: 'PAYMENT_REQUIRED',\n 403: 'FORBIDDEN',\n 404: 'NOT_FOUND',\n 405: 'METHOD_NOT_SUPPORTED',\n 408: 'TIMEOUT',\n 409: 'CONFLICT',\n 412: 'PRECONDITION_FAILED',\n 413: 'PAYLOAD_TOO_LARGE',\n 415: 'UNSUPPORTED_MEDIA_TYPE',\n 422: 'UNPROCESSABLE_CONTENT',\n 428: 'PRECONDITION_REQUIRED',\n 429: 'TOO_MANY_REQUESTS',\n 499: 'CLIENT_CLOSED_REQUEST',\n 500: 'INTERNAL_SERVER_ERROR',\n 501: 'NOT_IMPLEMENTED',\n 502: 'BAD_GATEWAY',\n 503: 'SERVICE_UNAVAILABLE',\n 504: 'GATEWAY_TIMEOUT',\n} as const;\n\nexport function getStatusCodeFromKey(\n code: keyof typeof TRPC_ERROR_CODES_BY_KEY,\n) {\n return JSONRPC2_TO_HTTP_CODE[code] ?? 500;\n}\n\nexport function getStatusKeyFromCode(\n code: keyof typeof HTTP_CODE_TO_JSONRPC2,\n): ValueOf<typeof HTTP_CODE_TO_JSONRPC2> {\n return HTTP_CODE_TO_JSONRPC2[code] ?? 'INTERNAL_SERVER_ERROR';\n}\n\n/**\n * The HTTP status for a response, or for a batch of them: `207` when the\n * responses' statuses differ.\n * @see https://trpc.io/docs/rpc#error-codes---http-status\n */\nexport function getHTTPStatusCode(\n json: TRPCResponse | TRPCResponse[],\n errors?: readonly (TRPCError | undefined)[],\n) {\n const arr = Array.isArray(json) ? json : [json];\n const httpStatuses = new Set<number>(\n arr.map((res, index) => {\n if ('error' in res) {\n if (\n isObject(res.error.data) &&\n typeof res.error.data['httpStatus'] === 'number'\n ) {\n return res.error.data['httpStatus'];\n }\n // several error codes share `-32603`, so the formatted code cannot\n // recover the original status when a formatter strips `data`\n const original = errors?.[index];\n if (original) {\n return getStatusCodeFromKey(original.code);\n }\n const code = TRPC_ERROR_CODES_BY_NUMBER[res.error.code];\n return getStatusCodeFromKey(code);\n }\n return 200;\n }),\n );\n\n if (httpStatuses.size !== 1) {\n return 207;\n }\n\n const httpStatus = httpStatuses.values().next().value;\n\n // oxlint-disable-next-line typescript/no-non-null-assertion\n return httpStatus!;\n}\n\n/**\n * The HTTP status of a `TRPCError`'s code.\n * @see https://trpc.io/docs/rpc#error-codes---http-status\n */\nexport function getHTTPStatusCodeFromError(error: TRPCError) {\n return getStatusCodeFromKey(error.code);\n}\n","import { getHTTPStatusCodeFromError } from '../http/getHTTPStatusCode';\nimport type { ProcedureType } from '../procedure';\nimport type {\n TRPC_ERROR_CODE_KEY,\n TRPC_ERROR_CODE_NUMBER,\n TRPCErrorShape,\n} from '../rpc';\nimport { TRPC_ERROR_CODES_BY_KEY } from '../rpc';\nimport type { Overwrite, Simplify } from '../types';\nimport type { TRPCError } from './TRPCError';\n\n/**\n * What an error formatter gets.\n * @see https://trpc.io/docs/server/error-formatting#all-properties-sent-to-errorformatter\n * @internal\n */\nexport interface ErrorFormatterOptions<TContext> {\n error: TRPCError;\n type: ProcedureType | 'unknown';\n /** The procedure's path, if the error came from one. */\n path: string | undefined;\n input: unknown;\n /** The context, if it was created before the error. */\n ctx: TContext;\n /** The shape tRPC sends by default, to extend or replace. */\n shape: DefaultErrorShape;\n}\n\n/**\n * Shapes the errors a router sends to the client.\n * @see https://trpc.io/docs/server/error-formatting\n * @internal\n */\nexport type ErrorFormatter<TContext, TShape extends TRPCErrorShape> = (\n opts: ErrorFormatterOptions<TContext | undefined>,\n) => TShape;\n\n/**\n * An error formatter for one procedure, as `.errors()` takes it. Return\n * `undefined` to leave the error to the next formatter.\n * @see https://trpc.io/docs/server/error-formatting#per-procedure-error-formatting\n * @internal\n */\nexport type ProcedureErrorFormatter<\n TContext,\n TContextOverrides,\n TShape extends TRPCErrorShape | undefined | void,\n> = (\n opts: ErrorFormatterOptions<Simplify<Overwrite<TContext, TContextOverrides>>>,\n) => TShape;\n\n/**\n * @internal\n */\nexport type AnyProcedureErrorFormatter = ProcedureErrorFormatter<any, any, any>;\n\n/**\n * The `data` of the default error shape.\n * @internal\n */\nexport type DefaultErrorData = {\n code: TRPC_ERROR_CODE_KEY;\n httpStatus: number;\n /**\n * The path of the procedure that threw.\n */\n path?: string;\n /**\n * The error's stack trace, only when `isDev` is set.\n */\n stack?: string;\n};\n\n/**\n * The error shape tRPC sends when there's no error formatter.\n * @see https://trpc.io/docs/server/error-formatting\n * @internal\n */\nexport interface DefaultErrorShape extends TRPCErrorShape<DefaultErrorData> {\n message: string;\n code: TRPC_ERROR_CODE_NUMBER;\n}\n\nexport const defaultFormatter: ErrorFormatter<any, any> = ({ shape }) => {\n return shape;\n};\n\n/**\n * @internal\n */\nexport function getDefaultErrorShape(opts: {\n error: TRPCError;\n path: string | undefined;\n isDev: boolean;\n}): DefaultErrorShape {\n const shape: DefaultErrorShape = {\n message: opts.error.message,\n code: TRPC_ERROR_CODES_BY_KEY[opts.error.code],\n data: {\n code: opts.error.code,\n httpStatus: getHTTPStatusCodeFromError(opts.error),\n },\n };\n if (opts.isDev && typeof opts.error.stack === 'string') {\n shape.data.stack = opts.error.stack;\n }\n if (typeof opts.path === 'string') {\n shape.data.path = opts.path;\n }\n return shape;\n}\n\nconst formattedShapeSymbol = Symbol('trpc_formattedErrorShape');\n\n/**\n * @internal\n */\nexport function setFormattedErrorShape(\n error: TRPCError,\n shape: TRPCErrorShape,\n): asserts error is TRPCError & { [formattedShapeSymbol]: TRPCErrorShape } {\n Object.defineProperty(error, formattedShapeSymbol, {\n value: shape,\n enumerable: false,\n configurable: true,\n writable: true,\n });\n}\n\n/**\n * @internal\n */\nexport function getFormattedErrorShape(\n error: TRPCError,\n): TRPCErrorShape | undefined {\n if (isFormattedErrorShape(error)) {\n return error[formattedShapeSymbol];\n }\n\n return undefined;\n}\n\nexport function isFormattedErrorShape(\n error: TRPCError,\n): error is TRPCError & { [formattedShapeSymbol]: TRPCErrorShape } {\n return formattedShapeSymbol in error;\n}\n","import type { ProcedureType } from '../procedure';\nimport type { AnyRootTypes, RootConfig } from '../rootConfig';\nimport { getDefaultErrorShape, getFormattedErrorShape } from './formatter';\nimport type { TRPCError } from './TRPCError';\n\n/**\n * The shape of an error as the client gets it: from a procedure's\n * `.errors()` formatter if one ran, or else from the root error formatter.\n * @internal\n */\nexport function getErrorShape<TRoot extends AnyRootTypes>(opts: {\n config: RootConfig<TRoot>;\n error: TRPCError;\n type: ProcedureType | 'unknown';\n path: string | undefined;\n input: unknown;\n ctx: TRoot['ctx'] | undefined;\n}): TRoot['errorShape'] {\n const { path, error, config } = opts;\n\n // a `.errors()` handler already created the final shape\n const formatted = getFormattedErrorShape(error);\n if (formatted !== undefined) {\n return formatted;\n }\n\n const shape = getDefaultErrorShape({ error, path, isDev: config.isDev });\n return config.errorFormatter({ ...opts, shape });\n}\n"],"mappings":";;AAQA,MAAM,aAAa,CAEnB;AAEA,MAAM,qBAAqB,QAAgB;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.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_getErrorShape = require("./getErrorShape-
|
|
3
|
-
const require_resolveResponse = require("./resolveResponse-
|
|
4
|
-
const require_contentTypeParsers = require("./contentTypeParsers-
|
|
2
|
+
const require_getErrorShape = require("./getErrorShape-B1AlrJBV.cjs");
|
|
3
|
+
const require_resolveResponse = require("./resolveResponse-FM4r4UGZ.cjs");
|
|
4
|
+
const require_contentTypeParsers = require("./contentTypeParsers-st4U3xYo.cjs");
|
|
5
5
|
exports.getHTTPStatusCode = require_getErrorShape.getHTTPStatusCode;
|
|
6
6
|
exports.getHTTPStatusCodeFromError = require_getErrorShape.getHTTPStatusCodeFromError;
|
|
7
7
|
exports.octetInputParser = require_contentTypeParsers.octetInputParser;
|
package/dist/http.d.cts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import { An as BaseHandlerOptions, D as getHTTPStatusCodeFromError, E as getHTTPStatusCode, Fn as ResponseMetaFn, Ln as TRPCRequestInfo, M as OctetInput, Mn as HTTPErrorHandler, N as UtilityParser, Nn as ResolveHTTPRequestOptionsContextFn, P as octetInputParser, Pn as ResponseMeta, b as parseConnectionParamsFromString, j as FileLike, jn as HTTPBaseHandlerOptions, x as parseConnectionParamsFromUnknown, y as resolveResponse } from "./unstable-core-do-not-import-
|
|
1
|
+
import { An as BaseHandlerOptions, D as getHTTPStatusCodeFromError, E as getHTTPStatusCode, Fn as ResponseMetaFn, Ln as TRPCRequestInfo, M as OctetInput, Mn as HTTPErrorHandler, N as UtilityParser, Nn as ResolveHTTPRequestOptionsContextFn, P as octetInputParser, Pn as ResponseMeta, b as parseConnectionParamsFromString, j as FileLike, jn as HTTPBaseHandlerOptions, x as parseConnectionParamsFromUnknown, y as resolveResponse } from "./unstable-core-do-not-import-C8Gy-fzS.cjs";
|
|
2
|
+
import "./http-11_NyRWk.cjs";
|
|
2
3
|
export { type BaseHandlerOptions, type FileLike, type HTTPBaseHandlerOptions, type HTTPErrorHandler, type HTTPErrorHandler as OnErrorFunction, type OctetInput, type ResolveHTTPRequestOptionsContextFn, type ResponseMeta, type ResponseMetaFn, type TRPCRequestInfo, type UtilityParser, getHTTPStatusCode, getHTTPStatusCodeFromError, octetInputParser, parseConnectionParamsFromString, parseConnectionParamsFromUnknown, resolveResponse };
|
package/dist/http.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { An as BaseHandlerOptions, D as getHTTPStatusCodeFromError, E as getHTTPStatusCode, Fn as ResponseMetaFn, Ln as TRPCRequestInfo, M as OctetInput, Mn as HTTPErrorHandler, N as UtilityParser, Nn as ResolveHTTPRequestOptionsContextFn, P as octetInputParser, Pn as ResponseMeta, b as parseConnectionParamsFromString, j as FileLike, jn as HTTPBaseHandlerOptions, x as parseConnectionParamsFromUnknown, y as resolveResponse } from "./unstable-core-do-not-import-
|
|
1
|
+
import { An as BaseHandlerOptions, D as getHTTPStatusCodeFromError, E as getHTTPStatusCode, Fn as ResponseMetaFn, Ln as TRPCRequestInfo, M as OctetInput, Mn as HTTPErrorHandler, N as UtilityParser, Nn as ResolveHTTPRequestOptionsContextFn, P as octetInputParser, Pn as ResponseMeta, b as parseConnectionParamsFromString, j as FileLike, jn as HTTPBaseHandlerOptions, x as parseConnectionParamsFromUnknown, y as resolveResponse } from "./unstable-core-do-not-import-d-SHdPM9.mjs";
|
|
2
2
|
export { type BaseHandlerOptions, type FileLike, type HTTPBaseHandlerOptions, type HTTPErrorHandler, type HTTPErrorHandler as OnErrorFunction, type OctetInput, type ResolveHTTPRequestOptionsContextFn, type ResponseMeta, type ResponseMetaFn, type TRPCRequestInfo, type UtilityParser, getHTTPStatusCode, getHTTPStatusCodeFromError, octetInputParser, parseConnectionParamsFromString, parseConnectionParamsFromUnknown, resolveResponse };
|
package/dist/http.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { d as getHTTPStatusCode, f as getHTTPStatusCodeFromError } from "./getErrorShape-
|
|
2
|
-
import { b as parseConnectionParamsFromString, t as resolveResponse, x as parseConnectionParamsFromUnknown } from "./resolveResponse-
|
|
3
|
-
import { t as octetInputParser } from "./contentTypeParsers-
|
|
1
|
+
import { d as getHTTPStatusCode, f as getHTTPStatusCodeFromError } from "./getErrorShape-CVrl8_-w.mjs";
|
|
2
|
+
import { b as parseConnectionParamsFromString, t as resolveResponse, x as parseConnectionParamsFromUnknown } from "./resolveResponse-CWLbNRmT.mjs";
|
|
3
|
+
import { t as octetInputParser } from "./contentTypeParsers-g-hK2Sqe.mjs";
|
|
4
4
|
export { getHTTPStatusCode, getHTTPStatusCodeFromError, octetInputParser, parseConnectionParamsFromString, parseConnectionParamsFromUnknown, resolveResponse };
|
|
5
5
|
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/observable/types.d.ts
|
|
2
1
|
/** What `subscribe()` returns: call `unsubscribe()` to stop. */
|
|
3
2
|
interface Unsubscribable {
|
|
4
3
|
/** Stops the subscription and runs its teardown. */
|
|
@@ -41,8 +40,6 @@ type UnaryFunction<TSource, TReturn> = (source: TSource) => TReturn;
|
|
|
41
40
|
type OperatorFunction<TValueBefore, TErrorBefore, TValueAfter, TErrorAfter> = UnaryFunction<Subscribable<TValueBefore, TErrorBefore>, Subscribable<TValueAfter, TErrorAfter>>;
|
|
42
41
|
/** An operator that keeps the value and error types. */
|
|
43
42
|
type MonoTypeOperatorFunction<TValue, TError> = OperatorFunction<TValue, TError, TValue, TError>;
|
|
44
|
-
//#endregion
|
|
45
|
-
//#region src/observable/observable.d.ts
|
|
46
43
|
/**
|
|
47
44
|
* The type of the values an observable emits.
|
|
48
45
|
* @public
|
|
@@ -86,8 +83,6 @@ declare function observableToPromise<TValue>(observable: Observable<TValue, unkn
|
|
|
86
83
|
* @internal
|
|
87
84
|
*/
|
|
88
85
|
declare function observableToAsyncIterable<TValue>(observable: Observable<TValue, unknown>, signal: AbortSignal): AsyncIterableIterator<TValue>;
|
|
89
|
-
//#endregion
|
|
90
|
-
//#region src/observable/operators.d.ts
|
|
91
86
|
/** Maps each value with `project`. */
|
|
92
87
|
declare function map<TValueBefore, TError, TValueAfter>(project: (value: TValueBefore, index: number) => TValueAfter): OperatorFunction<TValueBefore, TError, TValueAfter, TError>;
|
|
93
88
|
interface ShareConfig {}
|
|
@@ -106,8 +101,6 @@ declare function distinctUntilChanged<TValue, TError>(compare?: (a: TValue, b: T
|
|
|
106
101
|
* always count as equal.
|
|
107
102
|
*/
|
|
108
103
|
declare function distinctUntilDeepChanged<TValue, TError>(): MonoTypeOperatorFunction<TValue, TError>;
|
|
109
|
-
//#endregion
|
|
110
|
-
//#region src/observable/behaviorSubject.d.ts
|
|
111
104
|
/** An observable that holds a current value. */
|
|
112
105
|
interface BehaviorSubject<TValue> extends Observable<TValue, never> {
|
|
113
106
|
observable: Observable<TValue, never>;
|
|
@@ -127,7 +120,6 @@ interface ReadonlyBehaviorSubject<TValue> extends Omit<BehaviorSubject<TValue>,
|
|
|
127
120
|
* @internal
|
|
128
121
|
*/
|
|
129
122
|
declare function behaviorSubject<TValue>(initialValue: TValue): BehaviorSubject<TValue>;
|
|
130
|
-
//#endregion
|
|
131
123
|
export { Unsubscribable as _, distinctUntilDeepChanged as a, tap as c, observable as d, observableToAsyncIterable as f, TeardownLogic as g, Observer as h, distinctUntilChanged as i, inferObservableValue as l, Observable as m, ReadonlyBehaviorSubject as n, map as o, observableToPromise as p, behaviorSubject as r, share as s, BehaviorSubject as t, isObservable as u, UnsubscribeFn as v };
|
|
132
124
|
|
|
133
|
-
//# sourceMappingURL=index-
|
|
125
|
+
//# sourceMappingURL=index-BdKWn-Kv.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-BdKWn-Kv.d.cts","names":[],"sources":["../src/observable/types.ts","../src/observable/observable.ts","../src/observable/operators.ts","../src/observable/behaviorSubject.ts"],"mappings":";UACiB;;EAEf;;;KAGU;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IhB,yBAAyB,QAAQ,UAAU,iBACrD,QACA,QACA,QACA;;;;;KCjFU,qBAAqB,eAC/B,oBAAoB,iBAAiB,mBAAmB;;;;;iBAM1C,aAAa,aAAa,KAAK;;;;;;;;;;;;;;iBAiB/B,WAAW,QAAQ,kBACjC,YAAY,UAAU,SAAS,QAAQ,YAAY,gBAClD,WAAW,QAAQ;;;;;;iBAwFN,oBAAoB,QAClC,YAAY,WAAW,mBAAgB,QAAA;;;;;;;;;;;;;iBA6CzB,0BAA0B,QACxC,YAAY,WAAW,kBACvB,QAAQ,cACP,sBAAsB;;iBCvKT,IAAI,cAAc,QAAQ,aACxC,UAAU,OAAO,cAAc,kBAAkB,cAChD,iBAAiB,cAAc,QAAQ,aAAa;UAoB7C;;;;;iBAKM,MAAM,QAAQ,QAC5B,QAAQ,cACP,yBAAyB,QAAQ;;iBAqGpB,IAAI,QAAQ,QAC1B,UAAU,QAAQ,SAAS,QAAQ,WAClC,yBAAyB,QAAQ;;iBAuBpB,qBAAqB,QAAQ,QAC3C,WAAU,GAAG,QAAQ,GAAG,qBACvB,yBAAyB,QAAQ;;;;;;iBA0CpB,yBACd,QACA,WACG,yBAAyB,QAAQ;;UC/MrB,gBAAgB,gBAAgB,WAAW;EAC1D,YAAY,WAAW;;;;;EAKvB,OAAO,OAAO;;EAEd,WAAW;;;UAII,wBAAwB,gBAAgB,KACvD,gBAAgB;;;;;;iBAwBF,gBAAgB,QAC9B,cAAc,SACb,gBAAgB"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/observable/types.d.ts
|
|
2
1
|
/** What `subscribe()` returns: call `unsubscribe()` to stop. */
|
|
3
2
|
interface Unsubscribable {
|
|
4
3
|
/** Stops the subscription and runs its teardown. */
|
|
@@ -41,8 +40,6 @@ type UnaryFunction<TSource, TReturn> = (source: TSource) => TReturn;
|
|
|
41
40
|
type OperatorFunction<TValueBefore, TErrorBefore, TValueAfter, TErrorAfter> = UnaryFunction<Subscribable<TValueBefore, TErrorBefore>, Subscribable<TValueAfter, TErrorAfter>>;
|
|
42
41
|
/** An operator that keeps the value and error types. */
|
|
43
42
|
type MonoTypeOperatorFunction<TValue, TError> = OperatorFunction<TValue, TError, TValue, TError>;
|
|
44
|
-
//#endregion
|
|
45
|
-
//#region src/observable/observable.d.ts
|
|
46
43
|
/**
|
|
47
44
|
* The type of the values an observable emits.
|
|
48
45
|
* @public
|
|
@@ -86,8 +83,6 @@ declare function observableToPromise<TValue>(observable: Observable<TValue, unkn
|
|
|
86
83
|
* @internal
|
|
87
84
|
*/
|
|
88
85
|
declare function observableToAsyncIterable<TValue>(observable: Observable<TValue, unknown>, signal: AbortSignal): AsyncIterableIterator<TValue>;
|
|
89
|
-
//#endregion
|
|
90
|
-
//#region src/observable/operators.d.ts
|
|
91
86
|
/** Maps each value with `project`. */
|
|
92
87
|
declare function map<TValueBefore, TError, TValueAfter>(project: (value: TValueBefore, index: number) => TValueAfter): OperatorFunction<TValueBefore, TError, TValueAfter, TError>;
|
|
93
88
|
interface ShareConfig {}
|
|
@@ -106,8 +101,6 @@ declare function distinctUntilChanged<TValue, TError>(compare?: (a: TValue, b: T
|
|
|
106
101
|
* always count as equal.
|
|
107
102
|
*/
|
|
108
103
|
declare function distinctUntilDeepChanged<TValue, TError>(): MonoTypeOperatorFunction<TValue, TError>;
|
|
109
|
-
//#endregion
|
|
110
|
-
//#region src/observable/behaviorSubject.d.ts
|
|
111
104
|
/** An observable that holds a current value. */
|
|
112
105
|
interface BehaviorSubject<TValue> extends Observable<TValue, never> {
|
|
113
106
|
observable: Observable<TValue, never>;
|
|
@@ -127,7 +120,6 @@ interface ReadonlyBehaviorSubject<TValue> extends Omit<BehaviorSubject<TValue>,
|
|
|
127
120
|
* @internal
|
|
128
121
|
*/
|
|
129
122
|
declare function behaviorSubject<TValue>(initialValue: TValue): BehaviorSubject<TValue>;
|
|
130
|
-
//#endregion
|
|
131
123
|
export { Unsubscribable as _, distinctUntilDeepChanged as a, tap as c, observable as d, observableToAsyncIterable as f, TeardownLogic as g, Observer as h, distinctUntilChanged as i, inferObservableValue as l, Observable as m, ReadonlyBehaviorSubject as n, map as o, observableToPromise as p, behaviorSubject as r, share as s, BehaviorSubject as t, isObservable as u, UnsubscribeFn as v };
|
|
132
124
|
|
|
133
|
-
//# sourceMappingURL=index-
|
|
125
|
+
//# sourceMappingURL=index-BdKWn-Kv.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-BdKWn-Kv.d.mts","names":[],"sources":["../src/observable/types.ts","../src/observable/observable.ts","../src/observable/operators.ts","../src/observable/behaviorSubject.ts"],"mappings":";UACiB;;EAEf;;;KAGU;UACF,aAAa,QAAQ;;EAE7B,UAAU,UAAU,QAAQ,SAAS,QAAQ,WAAW;;;;;;;UAOzC,WAAW,QAAQ,gBAAgB,aAClD,QACA;;EAGA,QAAQ,WAAW,QAAQ;EAC3B,KAAK,SAAS,SACZ,KAAK,iBAAiB,QAAQ,QAAQ,SAAS,WAC9C,WAAW,SAAS;EACvB,KAAK,SAAS,SAAS,SAAS,SAC9B,KAAK,iBAAiB,QAAQ,QAAQ,SAAS,UAC/C,KAAK,iBAAiB,SAAS,SAAS,SAAS,WAChD,WAAW,SAAS;EACvB,KAAK,SAAS,SAAS,SAAS,SAAS,SAAS,SAChD,KAAK,iBAAiB,QAAQ,QAAQ,SAAS,UAC/C,KAAK,iBAAiB,SAAS,SAAS,SAAS,UACjD,KAAK,iBAAiB,SAAS,SAAS,SAAS,WAChD,WAAW,SAAS;EACvB,KAAK,SAAS,SAAS,SAAS,SAAS,SAAS,SAAS,SAAS,SAClE,KAAK,iBAAiB,QAAQ,QAAQ,SAAS,UAC/C,KAAK,iBAAiB,SAAS,SAAS,SAAS,UACjD,KAAK,iBAAiB,SAAS,SAAS,SAAS,UACjD,KAAK,iBAAiB,SAAS,SAAS,SAAS,WAChD,WAAW,SAAS;EACvB,KACE,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SACA,SAEA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,WAAW;;;UAII,wBAAwB,gBAAgB,KACvD,gBAAgB;;;;;;iBAwBF,gBAAgB,QAC9B,cAAc,SACb,gBAAgB"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { Ln as TRPCRequestInfo, Ti as MaybePromise, gi as DistributiveOmit, jn as HTTPBaseHandlerOptions, rr as inferRouterContext, ur as CreateContextCallback, zn as AnyRouter } from "./unstable-core-do-not-import-
|
|
1
|
+
import { Ln as TRPCRequestInfo, Ti as MaybePromise, gi as DistributiveOmit, jn as HTTPBaseHandlerOptions, rr as inferRouterContext, ur as CreateContextCallback, zn as AnyRouter } from "./unstable-core-do-not-import-d-SHdPM9.mjs";
|
|
2
2
|
import * as http$1 from "http";
|
|
3
3
|
import * as http2 from "http2";
|
|
4
|
-
//#region src/adapters/node-http/types.d.ts
|
|
5
4
|
/** A Node.js HTTP/1 or HTTP/2 request, as the Node.js adapters take it. */
|
|
6
5
|
type NodeHTTPRequest = DistributiveOmit<http$1.IncomingMessage | http2.Http2ServerRequest, 'socket'> & {
|
|
7
6
|
/**
|
|
@@ -72,8 +71,6 @@ type NodeHTTPCreateContextFnOptions<TRequest, TResponse> = {
|
|
|
72
71
|
};
|
|
73
72
|
/** The `createContext` function the Node.js adapters take. */
|
|
74
73
|
type NodeHTTPCreateContextFn<TRouter extends AnyRouter, TRequest, TResponse> = (opts: NodeHTTPCreateContextFnOptions<TRequest, TResponse>) => MaybePromise<inferRouterContext<TRouter>>;
|
|
75
|
-
//#endregion
|
|
76
|
-
//#region src/adapters/node-http/nodeHTTPRequestHandler.d.ts
|
|
77
74
|
/**
|
|
78
75
|
* Answers with an error response when handling a request throws.
|
|
79
76
|
* @internal
|
|
@@ -84,8 +81,6 @@ declare function internal_exceptionHandler<TRouter extends AnyRouter, TRequest e
|
|
|
84
81
|
* Next.js and the standalone server use it. The promise never rejects.
|
|
85
82
|
*/
|
|
86
83
|
declare function nodeHTTPRequestHandler<TRouter extends AnyRouter, TRequest extends NodeHTTPRequest, TResponse extends NodeHTTPResponse>(opts: NodeHTTPRequestHandlerOptions<TRouter, TRequest, TResponse>): Promise<void>;
|
|
87
|
-
//#endregion
|
|
88
|
-
//#region src/adapters/node-http/incomingMessageToRequest.d.ts
|
|
89
84
|
/**
|
|
90
85
|
* The full URL of a Node.js request, from its `Host` header and socket.
|
|
91
86
|
* Throws a `BAD_REQUEST` error if it isn't a valid URL.
|
|
@@ -101,7 +96,6 @@ declare function incomingMessageToRequest(req: NodeHTTPRequest, res: NodeHTTPRes
|
|
|
101
96
|
*/
|
|
102
97
|
maxBodySize: number | null;
|
|
103
98
|
}): Request;
|
|
104
|
-
//#endregion
|
|
105
99
|
export { NodeHTTPCreateContextFn as a, NodeHTTPHandlerOptions as c, NodeHTTPResponse as d, nodeHTTPRequestHandler as i, NodeHTTPRequest as l, incomingMessageToRequest as n, NodeHTTPCreateContextFnOptions as o, internal_exceptionHandler as r, NodeHTTPCreateContextOption as s, createURL as t, NodeHTTPRequestHandlerOptions as u };
|
|
106
100
|
|
|
107
|
-
//# sourceMappingURL=index-
|
|
101
|
+
//# sourceMappingURL=index-C7UHVQQf.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-C7UHVQQf.d.mts","names":["http"],"sources":["../src/adapters/node-http/types.ts","../src/adapters/node-http/nodeHTTPRequestHandler.ts","../src/adapters/node-http/incomingMessageToRequest.ts"],"mappings":";;;;KA6BY,kBAAkB,iBAC5BA,OAAK,kBAAkB,MAAM;;;;;EAO7B;;;;;EAKA,SACI,QAAQA,OAAK,6BACb,QAAQ,MAAM;;;KAIR,mBAAmB,iBAC7BA,OAAK,iBAAiB,MAAM;;;;;EAO5B;EAEA,QAAQ,gBAAgB;;;KAGd,4BACV,gBAAgB,WAChB,UACA,aACE,sBACF,mBAAmB,UACnB,wBAAwB,SAAS,UAAU;;;;KAMxC,kBACH,iBAAiB,kBAAkB,iBACnC,kBAAkB,mBAAmB,qBAClC,KAAK,UAAU,KAAK,WAAW,OAAO;;KAO/B,uBACV,gBAAgB,WAChB,iBAAiB,iBACjB,kBAAkB,oBAChB,uBAAuB,SAAS;;;;;;;;;;EAUlC,aAAa,kBAAkB,UAAU;;;;;;;EAOzC;IACE,4BAA4B,SAAS,UAAU;;KAGvC,8BACV,gBAAgB,WAChB,iBAAiB,iBACjB,kBAAkB,oBAChB,uBAAuB,SAAS,UAAU;EAC5C,KAAK;EACL,KAAK;;;;;EAKL;;;;;;;KAQU,+BAA+B,UAAU;EACnD,KAAK;EACL,KAAK;EACL,MAAM;;;KAGI,wBACV,gBAAgB,WAChB,UACA,cAEA,MAAM,+BAA+B,UAAU,eAC5C,aAAa,mBAAmB;;;;;iBC3FrB,0BACd,gBAAgB,WAChB,iBAAiB,iBACjB,kBAAkB,kBAClB,MAAM,8BAA8B,SAAS,UAAU,cAAU;;;;;iBAkD7C,uBACpB,gBAAgB,WAChB,iBAAiB,iBACjB,kBAAkB,kBAClB,MAAM,8BAA8B,SAAS,UAAU,aAAU;;;;;iBCTnD,UAAU,KAAK,kBAAkB;;;;;iBAiDjC,yBACd,KAAK,iBACL,KAAK,kBACL;;;;EAIE;IAED"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import "./unstable-core-do-not-import-C8Gy-fzS.cjs";
|
|
2
|
+
/**
|
|
3
|
+
* The type a function's promise resolves to.
|
|
4
|
+
* @deprecated Use `Awaited<ReturnType<typeof myFunction>>` instead.
|
|
5
|
+
*/
|
|
6
|
+
type inferAsyncReturnType<TFunction extends (...args: any[]) => any> = Awaited<ReturnType<TFunction>>;
|
|
7
|
+
export { inferAsyncReturnType as t };
|
|
8
|
+
|
|
9
|
+
//# sourceMappingURL=index-DVXG_v0W.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-DVXG_v0W.d.cts","names":[],"sources":["../src/@trpc/server/index.ts"],"mappings":";;;;;KAuJY,qBAAqB,sBAAsB,uBACrD,QAAQ,WAAW"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_getErrorShape = require("./getErrorShape-
|
|
3
|
-
const require_asyncGeneratorDelegate = require("./asyncGeneratorDelegate-
|
|
4
|
-
const require_initTRPC = require("./initTRPC-
|
|
2
|
+
const require_getErrorShape = require("./getErrorShape-B1AlrJBV.cjs");
|
|
3
|
+
const require_asyncGeneratorDelegate = require("./asyncGeneratorDelegate-o88TWuuI.cjs");
|
|
4
|
+
const require_initTRPC = require("./initTRPC-RIE9F856.cjs");
|
|
5
5
|
exports.StandardSchemaV1Error = require_initTRPC.StandardSchemaV1Error;
|
|
6
6
|
exports.TRPCError = require_asyncGeneratorDelegate.TRPCError;
|
|
7
7
|
exports.callTRPCProcedure = require_asyncGeneratorDelegate.callProcedure;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
import { $ as AnyMutationProcedure, $n as callProcedure, Ar as tracked, B as createRecursiveProxy, Bn as BuiltRouter, Br as PathSeparator, Ct as UnsetMarker, Er as TrackedEnvelope, G as inferTransformedProcedureOutput, Gn as MergeRouters, Gt as experimental_standaloneMiddleware, H as inferProcedureErrorShape, Hn as DecorateCreateRouterOptions, Jn as RouterCaller, Jt as DefaultErrorData, K as inferTransformedSubscriptionOutput, Lt as AnyMiddlewareFunction, Mi as Unwrap, Or as isTrackedEnvelope, Q as inferClientTypes, Qn as RouterRecord, R as getErrorShape, Rt as MiddlewareBuilder, St as inferProcedureBuilderResolverOptions, U as inferRouterInputs, Vn as CreateRouterOptions, W as inferRouterOutputs, X as AnyClientTypes, Xn as RouterCallerFactory, Xt as ErrorFormatter, Yt as DefaultErrorShape, Zn as RouterDef, _ as TRPCRootObject, an as CombinedDataTransformer, at as MutationProcedure, bn as TRPCErrorShape, c as StandardSchemaV1Error, ci as getTRPCErrorFromUnknown, ct as QueryProcedure, di as TRPC_ERROR_CODE_KEY, dt as inferProcedureOutput, et as AnyProcedure, fi as TRPC_ERROR_CODE_NUMBER, fn as transformTRPCResponse, g as TRPCBuilder, h as RuntimeConfigOptions, hi as Dict, ir as inferRouterError, kr as sse, lr as AnyRootTypes, lt as SubscriptionProcedure, mi as DeepPartial, mr as RootConfig, mt as inferSubscriptionOutput, nt as AnySubscriptionProcedure, oi as TRPCError, pt as inferSubscriptionInput, qn as RouterBuilder, rr as inferRouterContext, sn as DataTransformer, sr as lazy, st as ProcedureType, tt as AnyQueryProcedure, ur as CreateContextCallback, ut as inferProcedureInput, v as initTRPC, vt as ProcedureBuilder, z as createFlatProxy, zn as AnyRouter, zt as MiddlewareFunction } from "./unstable-core-do-not-import-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* The type a function's promise resolves to.
|
|
5
|
-
* @deprecated Use `Awaited<ReturnType<typeof myFunction>>` instead.
|
|
6
|
-
*/
|
|
7
|
-
export type inferAsyncReturnType<TFunction extends (...args: any[]) => any> = Awaited<ReturnType<TFunction>>;
|
|
8
|
-
//#endregion
|
|
9
|
-
export { type AnyMiddlewareFunction, type AnyMiddlewareFunction as AnyTRPCMiddlewareFunction, type AnyMutationProcedure, type AnyMutationProcedure as AnyTRPCMutationProcedure, type AnyProcedure, type AnyProcedure as AnyTRPCProcedure, type AnyQueryProcedure, type AnyQueryProcedure as AnyTRPCQueryProcedure, type AnyRouter, type AnyRouter as AnyTRPCRouter, type AnySubscriptionProcedure, type AnySubscriptionProcedure as AnyTRPCSubscriptionProcedure, type AnyClientTypes as AnyTRPCClientTypes, type AnyRootTypes as AnyTRPCRootTypes, type CombinedDataTransformer, type CombinedDataTransformer as TRPCCombinedDataTransformer, type CreateContextCallback, type DataTransformer, type DataTransformer as TRPCDataTransformer, type DeepPartial, type Dict, type ProcedureType, type ProcedureType as TRPCProcedureType, StandardSchemaV1Error, type TRPCBuilder, type BuiltRouter as TRPCBuiltRouter, type CreateRouterOptions as TRPCCreateRouterOptions, type DecorateCreateRouterOptions as TRPCDecorateCreateRouterOptions, type DefaultErrorData as TRPCDefaultErrorData, type DefaultErrorShape as TRPCDefaultErrorShape, TRPCError, type ErrorFormatter as TRPCErrorFormatter, type TRPCErrorShape, type MergeRouters as TRPCMergeRouters, type MiddlewareBuilder as TRPCMiddlewareBuilder, type MiddlewareFunction as TRPCMiddlewareFunction, type MutationProcedure as TRPCMutationProcedure, type PathSeparator as TRPCPathSeparator, type ProcedureBuilder as TRPCProcedureBuilder, type QueryProcedure as TRPCQueryProcedure, type RootConfig as TRPCRootConfig, type TRPCRootObject, type RouterBuilder as TRPCRouterBuilder, type RouterCaller as TRPCRouterCaller, type RouterCallerFactory as TRPCRouterCallerFactory, type RouterDef as TRPCRouterDef, type RouterRecord as TRPCRouterRecord, type RuntimeConfigOptions as TRPCRuntimeConfigOptions, type SubscriptionProcedure as TRPCSubscriptionProcedure, type UnsetMarker as TRPCUnsetMarker, type Unwrap as TRPCUnwrap, type TRPC_ERROR_CODE_KEY, type TRPC_ERROR_CODE_NUMBER, type TrackedEnvelope, callProcedure as callTRPCProcedure, createFlatProxy as createTRPCFlatProxy, createRecursiveProxy as createTRPCRecursiveProxy, lazy as experimental_lazy, lazy, experimental_standaloneMiddleware, experimental_standaloneMiddleware as experimental_trpcMiddleware, getErrorShape, getErrorShape as getTRPCErrorShape, getTRPCErrorFromUnknown, type inferProcedureBuilderResolverOptions, type inferProcedureErrorShape, type inferProcedureInput, type inferProcedureOutput, type inferRouterContext, type inferRouterError, type inferRouterInputs, type inferRouterOutputs, type inferSubscriptionInput, type inferSubscriptionOutput, type inferClientTypes as inferTRPCClientTypes, type inferTransformedProcedureOutput, type inferTransformedSubscriptionOutput, initTRPC, isTrackedEnvelope, sse, tracked, transformTRPCResponse };
|
|
10
|
-
|
|
11
|
-
//# sourceMappingURL=index.d.cts.map
|
|
1
|
+
import { $ as AnyMutationProcedure, $n as callProcedure, Ar as tracked, B as createRecursiveProxy, Bn as BuiltRouter, Br as PathSeparator, Ct as UnsetMarker, Er as TrackedEnvelope, G as inferTransformedProcedureOutput, Gn as MergeRouters, Gt as experimental_standaloneMiddleware, H as inferProcedureErrorShape, Hn as DecorateCreateRouterOptions, Jn as RouterCaller, Jt as DefaultErrorData, K as inferTransformedSubscriptionOutput, Lt as AnyMiddlewareFunction, Mi as Unwrap, Or as isTrackedEnvelope, Q as inferClientTypes, Qn as RouterRecord, R as getErrorShape, Rt as MiddlewareBuilder, St as inferProcedureBuilderResolverOptions, U as inferRouterInputs, Vn as CreateRouterOptions, W as inferRouterOutputs, X as AnyClientTypes, Xn as RouterCallerFactory, Xt as ErrorFormatter, Yt as DefaultErrorShape, Zn as RouterDef, _ as TRPCRootObject, an as CombinedDataTransformer, at as MutationProcedure, bn as TRPCErrorShape, c as StandardSchemaV1Error, ci as getTRPCErrorFromUnknown, ct as QueryProcedure, di as TRPC_ERROR_CODE_KEY, dt as inferProcedureOutput, et as AnyProcedure, fi as TRPC_ERROR_CODE_NUMBER, fn as transformTRPCResponse, g as TRPCBuilder, h as RuntimeConfigOptions, hi as Dict, ir as inferRouterError, kr as sse, lr as AnyRootTypes, lt as SubscriptionProcedure, mi as DeepPartial, mr as RootConfig, mt as inferSubscriptionOutput, nt as AnySubscriptionProcedure, oi as TRPCError, pt as inferSubscriptionInput, qn as RouterBuilder, rr as inferRouterContext, sn as DataTransformer, sr as lazy, st as ProcedureType, tt as AnyQueryProcedure, ur as CreateContextCallback, ut as inferProcedureInput, v as initTRPC, vt as ProcedureBuilder, z as createFlatProxy, zn as AnyRouter, zt as MiddlewareFunction } from "./unstable-core-do-not-import-C8Gy-fzS.cjs";
|
|
2
|
+
import { t as inferAsyncReturnType } from "./index-DVXG_v0W.cjs";
|
|
3
|
+
export { type AnyMiddlewareFunction, type AnyMiddlewareFunction as AnyTRPCMiddlewareFunction, type AnyMutationProcedure, type AnyMutationProcedure as AnyTRPCMutationProcedure, type AnyProcedure, type AnyProcedure as AnyTRPCProcedure, type AnyQueryProcedure, type AnyQueryProcedure as AnyTRPCQueryProcedure, type AnyRouter, type AnyRouter as AnyTRPCRouter, type AnySubscriptionProcedure, type AnySubscriptionProcedure as AnyTRPCSubscriptionProcedure, type AnyClientTypes as AnyTRPCClientTypes, type AnyRootTypes as AnyTRPCRootTypes, type CombinedDataTransformer, type CombinedDataTransformer as TRPCCombinedDataTransformer, type CreateContextCallback, type DataTransformer, type DataTransformer as TRPCDataTransformer, type DeepPartial, type Dict, type ProcedureType, type ProcedureType as TRPCProcedureType, StandardSchemaV1Error, type TRPCBuilder, type BuiltRouter as TRPCBuiltRouter, type CreateRouterOptions as TRPCCreateRouterOptions, type DecorateCreateRouterOptions as TRPCDecorateCreateRouterOptions, type DefaultErrorData as TRPCDefaultErrorData, type DefaultErrorShape as TRPCDefaultErrorShape, TRPCError, type ErrorFormatter as TRPCErrorFormatter, type TRPCErrorShape, type MergeRouters as TRPCMergeRouters, type MiddlewareBuilder as TRPCMiddlewareBuilder, type MiddlewareFunction as TRPCMiddlewareFunction, type MutationProcedure as TRPCMutationProcedure, type PathSeparator as TRPCPathSeparator, type ProcedureBuilder as TRPCProcedureBuilder, type QueryProcedure as TRPCQueryProcedure, type RootConfig as TRPCRootConfig, type TRPCRootObject, type RouterBuilder as TRPCRouterBuilder, type RouterCaller as TRPCRouterCaller, type RouterCallerFactory as TRPCRouterCallerFactory, type RouterDef as TRPCRouterDef, type RouterRecord as TRPCRouterRecord, type RuntimeConfigOptions as TRPCRuntimeConfigOptions, type SubscriptionProcedure as TRPCSubscriptionProcedure, type UnsetMarker as TRPCUnsetMarker, type Unwrap as TRPCUnwrap, type TRPC_ERROR_CODE_KEY, type TRPC_ERROR_CODE_NUMBER, type TrackedEnvelope, callProcedure as callTRPCProcedure, createFlatProxy as createTRPCFlatProxy, createRecursiveProxy as createTRPCRecursiveProxy, lazy as experimental_lazy, lazy, experimental_standaloneMiddleware, experimental_standaloneMiddleware as experimental_trpcMiddleware, getErrorShape, getErrorShape as getTRPCErrorShape, getTRPCErrorFromUnknown, inferAsyncReturnType, type inferProcedureBuilderResolverOptions, type inferProcedureErrorShape, type inferProcedureInput, type inferProcedureOutput, type inferRouterContext, type inferRouterError, type inferRouterInputs, type inferRouterOutputs, type inferSubscriptionInput, type inferSubscriptionOutput, type inferClientTypes as inferTRPCClientTypes, type inferTransformedProcedureOutput, type inferTransformedSubscriptionOutput, initTRPC, isTrackedEnvelope, sse, tracked, transformTRPCResponse };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import { $ as AnyMutationProcedure, $n as callProcedure, Ar as tracked, B as createRecursiveProxy, Bn as BuiltRouter, Br as PathSeparator, Ct as UnsetMarker, Er as TrackedEnvelope, G as inferTransformedProcedureOutput, Gn as MergeRouters, Gt as experimental_standaloneMiddleware, H as inferProcedureErrorShape, Hn as DecorateCreateRouterOptions, Jn as RouterCaller, Jt as DefaultErrorData, K as inferTransformedSubscriptionOutput, Lt as AnyMiddlewareFunction, Mi as Unwrap, Or as isTrackedEnvelope, Q as inferClientTypes, Qn as RouterRecord, R as getErrorShape, Rt as MiddlewareBuilder, St as inferProcedureBuilderResolverOptions, U as inferRouterInputs, Vn as CreateRouterOptions, W as inferRouterOutputs, X as AnyClientTypes, Xn as RouterCallerFactory, Xt as ErrorFormatter, Yt as DefaultErrorShape, Zn as RouterDef, _ as TRPCRootObject, an as CombinedDataTransformer, at as MutationProcedure, bn as TRPCErrorShape, c as StandardSchemaV1Error, ci as getTRPCErrorFromUnknown, ct as QueryProcedure, di as TRPC_ERROR_CODE_KEY, dt as inferProcedureOutput, et as AnyProcedure, fi as TRPC_ERROR_CODE_NUMBER, fn as transformTRPCResponse, g as TRPCBuilder, h as RuntimeConfigOptions, hi as Dict, ir as inferRouterError, kr as sse, lr as AnyRootTypes, lt as SubscriptionProcedure, mi as DeepPartial, mr as RootConfig, mt as inferSubscriptionOutput, nt as AnySubscriptionProcedure, oi as TRPCError, pt as inferSubscriptionInput, qn as RouterBuilder, rr as inferRouterContext, sn as DataTransformer, sr as lazy, st as ProcedureType, tt as AnyQueryProcedure, ur as CreateContextCallback, ut as inferProcedureInput, v as initTRPC, vt as ProcedureBuilder, z as createFlatProxy, zn as AnyRouter, zt as MiddlewareFunction } from "./unstable-core-do-not-import-
|
|
2
|
-
//#region src/@trpc/server/index.d.ts
|
|
1
|
+
import { $ as AnyMutationProcedure, $n as callProcedure, Ar as tracked, B as createRecursiveProxy, Bn as BuiltRouter, Br as PathSeparator, Ct as UnsetMarker, Er as TrackedEnvelope, G as inferTransformedProcedureOutput, Gn as MergeRouters, Gt as experimental_standaloneMiddleware, H as inferProcedureErrorShape, Hn as DecorateCreateRouterOptions, Jn as RouterCaller, Jt as DefaultErrorData, K as inferTransformedSubscriptionOutput, Lt as AnyMiddlewareFunction, Mi as Unwrap, Or as isTrackedEnvelope, Q as inferClientTypes, Qn as RouterRecord, R as getErrorShape, Rt as MiddlewareBuilder, St as inferProcedureBuilderResolverOptions, U as inferRouterInputs, Vn as CreateRouterOptions, W as inferRouterOutputs, X as AnyClientTypes, Xn as RouterCallerFactory, Xt as ErrorFormatter, Yt as DefaultErrorShape, Zn as RouterDef, _ as TRPCRootObject, an as CombinedDataTransformer, at as MutationProcedure, bn as TRPCErrorShape, c as StandardSchemaV1Error, ci as getTRPCErrorFromUnknown, ct as QueryProcedure, di as TRPC_ERROR_CODE_KEY, dt as inferProcedureOutput, et as AnyProcedure, fi as TRPC_ERROR_CODE_NUMBER, fn as transformTRPCResponse, g as TRPCBuilder, h as RuntimeConfigOptions, hi as Dict, ir as inferRouterError, kr as sse, lr as AnyRootTypes, lt as SubscriptionProcedure, mi as DeepPartial, mr as RootConfig, mt as inferSubscriptionOutput, nt as AnySubscriptionProcedure, oi as TRPCError, pt as inferSubscriptionInput, qn as RouterBuilder, rr as inferRouterContext, sn as DataTransformer, sr as lazy, st as ProcedureType, tt as AnyQueryProcedure, ur as CreateContextCallback, ut as inferProcedureInput, v as initTRPC, vt as ProcedureBuilder, z as createFlatProxy, zn as AnyRouter, zt as MiddlewareFunction } from "./unstable-core-do-not-import-d-SHdPM9.mjs";
|
|
3
2
|
/**
|
|
4
3
|
* The type a function's promise resolves to.
|
|
5
4
|
* @deprecated Use `Awaited<ReturnType<typeof myFunction>>` instead.
|
|
6
5
|
*/
|
|
7
6
|
export type inferAsyncReturnType<TFunction extends (...args: any[]) => any> = Awaited<ReturnType<TFunction>>;
|
|
8
|
-
//#endregion
|
|
9
7
|
export { type AnyMiddlewareFunction, type AnyMiddlewareFunction as AnyTRPCMiddlewareFunction, type AnyMutationProcedure, type AnyMutationProcedure as AnyTRPCMutationProcedure, type AnyProcedure, type AnyProcedure as AnyTRPCProcedure, type AnyQueryProcedure, type AnyQueryProcedure as AnyTRPCQueryProcedure, type AnyRouter, type AnyRouter as AnyTRPCRouter, type AnySubscriptionProcedure, type AnySubscriptionProcedure as AnyTRPCSubscriptionProcedure, type AnyClientTypes as AnyTRPCClientTypes, type AnyRootTypes as AnyTRPCRootTypes, type CombinedDataTransformer, type CombinedDataTransformer as TRPCCombinedDataTransformer, type CreateContextCallback, type DataTransformer, type DataTransformer as TRPCDataTransformer, type DeepPartial, type Dict, type ProcedureType, type ProcedureType as TRPCProcedureType, StandardSchemaV1Error, type TRPCBuilder, type BuiltRouter as TRPCBuiltRouter, type CreateRouterOptions as TRPCCreateRouterOptions, type DecorateCreateRouterOptions as TRPCDecorateCreateRouterOptions, type DefaultErrorData as TRPCDefaultErrorData, type DefaultErrorShape as TRPCDefaultErrorShape, TRPCError, type ErrorFormatter as TRPCErrorFormatter, type TRPCErrorShape, type MergeRouters as TRPCMergeRouters, type MiddlewareBuilder as TRPCMiddlewareBuilder, type MiddlewareFunction as TRPCMiddlewareFunction, type MutationProcedure as TRPCMutationProcedure, type PathSeparator as TRPCPathSeparator, type ProcedureBuilder as TRPCProcedureBuilder, type QueryProcedure as TRPCQueryProcedure, type RootConfig as TRPCRootConfig, type TRPCRootObject, type RouterBuilder as TRPCRouterBuilder, type RouterCaller as TRPCRouterCaller, type RouterCallerFactory as TRPCRouterCallerFactory, type RouterDef as TRPCRouterDef, type RouterRecord as TRPCRouterRecord, type RuntimeConfigOptions as TRPCRuntimeConfigOptions, type SubscriptionProcedure as TRPCSubscriptionProcedure, type UnsetMarker as TRPCUnsetMarker, type Unwrap as TRPCUnwrap, type TRPC_ERROR_CODE_KEY, type TRPC_ERROR_CODE_NUMBER, type TrackedEnvelope, callProcedure as callTRPCProcedure, createFlatProxy as createTRPCFlatProxy, createRecursiveProxy as createTRPCRecursiveProxy, lazy as experimental_lazy, lazy, experimental_standaloneMiddleware, experimental_standaloneMiddleware as experimental_trpcMiddleware, getErrorShape, getErrorShape as getTRPCErrorShape, getTRPCErrorFromUnknown, type inferProcedureBuilderResolverOptions, type inferProcedureErrorShape, type inferProcedureInput, type inferProcedureOutput, type inferRouterContext, type inferRouterError, type inferRouterInputs, type inferRouterOutputs, type inferSubscriptionInput, type inferSubscriptionOutput, type inferClientTypes as inferTRPCClientTypes, type inferTransformedProcedureOutput, type inferTransformedSubscriptionOutput, initTRPC, isTrackedEnvelope, sse, tracked, transformTRPCResponse };
|
|
10
8
|
|
|
11
9
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/@trpc/server/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/@trpc/server/index.ts"],"mappings":";;;;;YAuJY,qBAAqB,sBAAsB,uBACrD,QAAQ,WAAW"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { g as createRecursiveProxy, h as createFlatProxy, t as getErrorShape } from "./getErrorShape-
|
|
2
|
-
import { C as getTRPCErrorFromUnknown, b as transformTRPCResponse, d as callProcedure, h as lazy, i as tracked, n as isTrackedEnvelope, r as sse, x as TRPCError } from "./asyncGeneratorDelegate-
|
|
3
|
-
import { d as experimental_standaloneMiddleware, o as StandardSchemaV1Error, t as initTRPC } from "./initTRPC-
|
|
1
|
+
import { g as createRecursiveProxy, h as createFlatProxy, t as getErrorShape } from "./getErrorShape-CVrl8_-w.mjs";
|
|
2
|
+
import { C as getTRPCErrorFromUnknown, b as transformTRPCResponse, d as callProcedure, h as lazy, i as tracked, n as isTrackedEnvelope, r as sse, x as TRPCError } from "./asyncGeneratorDelegate-BRQGtkYG.mjs";
|
|
3
|
+
import { d as experimental_standaloneMiddleware, o as StandardSchemaV1Error, t as initTRPC } from "./initTRPC-BRhOzCfA.mjs";
|
|
4
4
|
export { StandardSchemaV1Error, TRPCError, callProcedure as callTRPCProcedure, createFlatProxy as createTRPCFlatProxy, createRecursiveProxy as createTRPCRecursiveProxy, lazy as experimental_lazy, lazy, experimental_standaloneMiddleware, experimental_standaloneMiddleware as experimental_trpcMiddleware, getErrorShape, getErrorShape as getTRPCErrorShape, getTRPCErrorFromUnknown, initTRPC, isTrackedEnvelope, sse, tracked, transformTRPCResponse };
|
|
5
5
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
1
|
+
import { a as getDefaultErrorShape, c as setFormattedErrorShape, i as defaultFormatter, n as _objectSpread2, r as _defineProperty, s as isFormattedErrorShape } from "./getErrorShape-CVrl8_-w.mjs";
|
|
2
|
+
import { C as getTRPCErrorFromUnknown, _ as defaultTransformer, a as _asyncIterator, f as createCallerFactory, g as mergeRouters, l as resolvePathSeparator, o as _wrapAsyncGenerator, p as createRouterFactory, t as _asyncGeneratorDelegate, v as getDataTransformer, x as TRPCError } from "./asyncGeneratorDelegate-BRQGtkYG.mjs";
|
|
3
|
+
import { n as observable, t as isObservable } from "./observable-CodTG6Sf.mjs";
|
|
4
|
+
import { d as isObject, f as mergeWithoutOverrides, l as isAsyncIterable } from "./codes-BCsCCyMj.mjs";
|
|
5
|
+
// src/unstable-core-do-not-import/middleware.ts
|
|
6
6
|
/** @internal */
|
|
7
7
|
const middlewareMarker = "middlewareMarker";
|
|
8
8
|
/**
|
|
@@ -131,8 +131,7 @@ function createOutputMiddleware(parse) {
|
|
|
131
131
|
outputMiddleware._type = "output";
|
|
132
132
|
return outputMiddleware;
|
|
133
133
|
}
|
|
134
|
-
|
|
135
|
-
//#region src/vendor/standard-schema-v1/error.ts
|
|
134
|
+
// src/vendor/standard-schema-v1/error.ts
|
|
136
135
|
/** A schema error with useful information. */
|
|
137
136
|
var StandardSchemaV1Error = class extends Error {
|
|
138
137
|
/**
|
|
@@ -148,8 +147,7 @@ var StandardSchemaV1Error = class extends Error {
|
|
|
148
147
|
this.issues = issues;
|
|
149
148
|
}
|
|
150
149
|
};
|
|
151
|
-
|
|
152
|
-
//#region src/unstable-core-do-not-import/parser.ts
|
|
150
|
+
// src/unstable-core-do-not-import/parser.ts
|
|
153
151
|
function getParseFn(procedureParser) {
|
|
154
152
|
const parser = procedureParser;
|
|
155
153
|
const isStandardSchema = "~standard" in parser;
|
|
@@ -184,8 +182,7 @@ function getParseFn(procedureParser) {
|
|
|
184
182
|
};
|
|
185
183
|
throw new Error("Could not find a validator fn");
|
|
186
184
|
}
|
|
187
|
-
|
|
188
|
-
//#region src/unstable-core-do-not-import/rootConfig.ts
|
|
185
|
+
// src/unstable-core-do-not-import/rootConfig.ts
|
|
189
186
|
var _globalThis$process;
|
|
190
187
|
var _globalThis$process2;
|
|
191
188
|
var _globalThis$process3;
|
|
@@ -200,30 +197,27 @@ function isDevDefault() {
|
|
|
200
197
|
var _globalThis$process4;
|
|
201
198
|
return ((_globalThis$process4 = globalThis.process) === null || _globalThis$process4 === void 0 ? void 0 : _globalThis$process4.env["NODE_ENV"]) !== "production";
|
|
202
199
|
}
|
|
203
|
-
|
|
204
|
-
//#region \0@oxc-project+runtime@0.149.0/helpers/esm/objectWithoutPropertiesLoose.js
|
|
200
|
+
// \0@oxc-project+runtime@0.157.0/helpers/esm/objectWithoutPropertiesLoose.js
|
|
205
201
|
function _objectWithoutPropertiesLoose(r, e) {
|
|
206
202
|
if (null == r) return {};
|
|
207
203
|
var t = {};
|
|
208
204
|
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
209
|
-
if (e.
|
|
205
|
+
if (-1 !== e.indexOf(n)) continue;
|
|
210
206
|
t[n] = r[n];
|
|
211
207
|
}
|
|
212
208
|
return t;
|
|
213
209
|
}
|
|
214
|
-
|
|
215
|
-
//#region \0@oxc-project+runtime@0.149.0/helpers/esm/objectWithoutProperties.js
|
|
210
|
+
// \0@oxc-project+runtime@0.157.0/helpers/esm/objectWithoutProperties.js
|
|
216
211
|
function _objectWithoutProperties(e, t) {
|
|
217
212
|
if (null == e) return {};
|
|
218
213
|
var o, r, i = _objectWithoutPropertiesLoose(e, t);
|
|
219
214
|
if (Object.getOwnPropertySymbols) {
|
|
220
|
-
var
|
|
221
|
-
for (r = 0; r <
|
|
215
|
+
var n = Object.getOwnPropertySymbols(e);
|
|
216
|
+
for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
|
|
222
217
|
}
|
|
223
218
|
return i;
|
|
224
219
|
}
|
|
225
|
-
|
|
226
|
-
//#region src/unstable-core-do-not-import/procedureBuilder.ts
|
|
220
|
+
// src/unstable-core-do-not-import/procedureBuilder.ts
|
|
227
221
|
const _excluded = [
|
|
228
222
|
"middlewares",
|
|
229
223
|
"inputs",
|
|
@@ -454,8 +448,7 @@ const initTRPC = new class TRPCBuilder {
|
|
|
454
448
|
};
|
|
455
449
|
}
|
|
456
450
|
}();
|
|
457
|
-
//#endregion
|
|
458
451
|
export { getParseFn as a, createInputMiddleware as c, experimental_standaloneMiddleware as d, middlewareMarker as f, isServerDefault as i, createMiddlewareFactory as l, createBuilder as n, StandardSchemaV1Error as o, isDevDefault as r, createErrorFormatterMiddleware as s, initTRPC as t, createOutputMiddleware as u };
|
|
459
452
|
|
|
460
453
|
|
|
461
|
-
//# sourceMappingURL=initTRPC-
|
|
454
|
+
//# sourceMappingURL=initTRPC-BRhOzCfA.mjs.map
|