camstack 1.2.14 → 1.2.16
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/chunk-LMMQX4CK.js +49 -0
- package/dist/{chunk-EA6763XQ.js → chunk-O5WJH4RV.js} +312 -135
- package/dist/chunk-RA674VWL.js +2785 -0
- package/dist/cli.js +27 -13
- package/dist/{discover-UMBUCPOL.js → discover-XMMUBDEM.js} +2 -2
- package/dist/{discover-addons-MHWUAAMX.js → discover-addons-3N32LTH7.js} +1 -1
- package/dist/dist-RV3V7TEU.js +902 -0
- package/dist/launcher-QKPDMXLY.js +382860 -0
- package/dist/main-IM5JIKX5.js +2302 -0
- package/package.json +1 -1
- package/dist/chunk-K3NQKI34.js +0 -10
|
@@ -0,0 +1,902 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
__esm
|
|
4
|
+
} from "./chunk-LMMQX4CK.js";
|
|
5
|
+
|
|
6
|
+
// ../../node_modules/@trpc/server/dist/codes-DagpWZLc.mjs
|
|
7
|
+
function mergeWithoutOverrides(obj1, ...objs) {
|
|
8
|
+
const newObj = Object.assign(emptyObject(), obj1);
|
|
9
|
+
for (const overrides of objs) for (const key in overrides) {
|
|
10
|
+
if (key in newObj && newObj[key] !== overrides[key]) throw new Error(`Duplicate key ${key}`);
|
|
11
|
+
newObj[key] = overrides[key];
|
|
12
|
+
}
|
|
13
|
+
return newObj;
|
|
14
|
+
}
|
|
15
|
+
function isObject(value) {
|
|
16
|
+
return !!value && !Array.isArray(value) && typeof value === "object";
|
|
17
|
+
}
|
|
18
|
+
function isFunction(fn) {
|
|
19
|
+
return typeof fn === "function";
|
|
20
|
+
}
|
|
21
|
+
function emptyObject() {
|
|
22
|
+
return /* @__PURE__ */ Object.create(null);
|
|
23
|
+
}
|
|
24
|
+
var TRPC_ERROR_CODES_BY_KEY, retryableRpcCodes;
|
|
25
|
+
var init_codes_DagpWZLc = __esm({
|
|
26
|
+
"../../node_modules/@trpc/server/dist/codes-DagpWZLc.mjs"() {
|
|
27
|
+
"use strict";
|
|
28
|
+
TRPC_ERROR_CODES_BY_KEY = {
|
|
29
|
+
PARSE_ERROR: -32700,
|
|
30
|
+
BAD_REQUEST: -32600,
|
|
31
|
+
INTERNAL_SERVER_ERROR: -32603,
|
|
32
|
+
NOT_IMPLEMENTED: -32603,
|
|
33
|
+
BAD_GATEWAY: -32603,
|
|
34
|
+
SERVICE_UNAVAILABLE: -32603,
|
|
35
|
+
GATEWAY_TIMEOUT: -32603,
|
|
36
|
+
UNAUTHORIZED: -32001,
|
|
37
|
+
PAYMENT_REQUIRED: -32002,
|
|
38
|
+
FORBIDDEN: -32003,
|
|
39
|
+
NOT_FOUND: -32004,
|
|
40
|
+
METHOD_NOT_SUPPORTED: -32005,
|
|
41
|
+
TIMEOUT: -32008,
|
|
42
|
+
CONFLICT: -32009,
|
|
43
|
+
PRECONDITION_FAILED: -32012,
|
|
44
|
+
PAYLOAD_TOO_LARGE: -32013,
|
|
45
|
+
UNSUPPORTED_MEDIA_TYPE: -32015,
|
|
46
|
+
UNPROCESSABLE_CONTENT: -32022,
|
|
47
|
+
PRECONDITION_REQUIRED: -32028,
|
|
48
|
+
TOO_MANY_REQUESTS: -32029,
|
|
49
|
+
CLIENT_CLOSED_REQUEST: -32099
|
|
50
|
+
};
|
|
51
|
+
retryableRpcCodes = [
|
|
52
|
+
TRPC_ERROR_CODES_BY_KEY.BAD_GATEWAY,
|
|
53
|
+
TRPC_ERROR_CODES_BY_KEY.SERVICE_UNAVAILABLE,
|
|
54
|
+
TRPC_ERROR_CODES_BY_KEY.GATEWAY_TIMEOUT,
|
|
55
|
+
TRPC_ERROR_CODES_BY_KEY.INTERNAL_SERVER_ERROR
|
|
56
|
+
];
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
// ../../node_modules/@trpc/server/dist/getErrorShape-BPSzUA7W.mjs
|
|
61
|
+
function createInnerProxy(callback, path, memo) {
|
|
62
|
+
var _memo$cacheKey;
|
|
63
|
+
const cacheKey = path.join(".");
|
|
64
|
+
(_memo$cacheKey = memo[cacheKey]) !== null && _memo$cacheKey !== void 0 || (memo[cacheKey] = new Proxy(noop, {
|
|
65
|
+
get(_obj, key) {
|
|
66
|
+
if (typeof key !== "string" || key === "then") return void 0;
|
|
67
|
+
return createInnerProxy(callback, [...path, key], memo);
|
|
68
|
+
},
|
|
69
|
+
apply(_1, _2, args) {
|
|
70
|
+
const lastOfPath = path[path.length - 1];
|
|
71
|
+
if (lastOfPath === "valueOf" || lastOfPath === "toString" || lastOfPath === "toJSON") {
|
|
72
|
+
const debugPath = path.slice(0, -1).join(".");
|
|
73
|
+
return `tRPC.proxy(${debugPath})`;
|
|
74
|
+
}
|
|
75
|
+
let opts = {
|
|
76
|
+
args,
|
|
77
|
+
path
|
|
78
|
+
};
|
|
79
|
+
if (lastOfPath === "call") opts = {
|
|
80
|
+
args: args.length >= 2 ? [args[1]] : [],
|
|
81
|
+
path: path.slice(0, -1)
|
|
82
|
+
};
|
|
83
|
+
else if (lastOfPath === "apply") opts = {
|
|
84
|
+
args: args.length >= 2 ? args[1] : [],
|
|
85
|
+
path: path.slice(0, -1)
|
|
86
|
+
};
|
|
87
|
+
freezeIfAvailable(opts.args);
|
|
88
|
+
freezeIfAvailable(opts.path);
|
|
89
|
+
return callback(opts);
|
|
90
|
+
}
|
|
91
|
+
}));
|
|
92
|
+
return memo[cacheKey];
|
|
93
|
+
}
|
|
94
|
+
function getStatusCodeFromKey(code) {
|
|
95
|
+
var _JSONRPC2_TO_HTTP_COD;
|
|
96
|
+
return (_JSONRPC2_TO_HTTP_COD = JSONRPC2_TO_HTTP_CODE[code]) !== null && _JSONRPC2_TO_HTTP_COD !== void 0 ? _JSONRPC2_TO_HTTP_COD : 500;
|
|
97
|
+
}
|
|
98
|
+
function getHTTPStatusCodeFromError(error) {
|
|
99
|
+
return getStatusCodeFromKey(error.code);
|
|
100
|
+
}
|
|
101
|
+
function getErrorShape(opts) {
|
|
102
|
+
const { path, error, config } = opts;
|
|
103
|
+
const { code } = opts.error;
|
|
104
|
+
const shape = {
|
|
105
|
+
message: error.message,
|
|
106
|
+
code: TRPC_ERROR_CODES_BY_KEY[code],
|
|
107
|
+
data: {
|
|
108
|
+
code,
|
|
109
|
+
httpStatus: getHTTPStatusCodeFromError(error)
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
if (config.isDev && typeof opts.error.stack === "string") shape.data.stack = opts.error.stack;
|
|
113
|
+
if (typeof path === "string") shape.data.path = path;
|
|
114
|
+
return config.errorFormatter((0, import_objectSpread2.default)((0, import_objectSpread2.default)({}, opts), {}, { shape }));
|
|
115
|
+
}
|
|
116
|
+
var __create, __defProp, __getOwnPropDesc, __getOwnPropNames, __getProtoOf, __hasOwnProp, __commonJS, __copyProps, __toESM, noop, freezeIfAvailable, createRecursiveProxy, createFlatProxy, JSONRPC2_TO_HTTP_CODE, require_typeof, require_toPrimitive, require_toPropertyKey, require_defineProperty, require_objectSpread2, import_objectSpread2;
|
|
117
|
+
var init_getErrorShape_BPSzUA7W = __esm({
|
|
118
|
+
"../../node_modules/@trpc/server/dist/getErrorShape-BPSzUA7W.mjs"() {
|
|
119
|
+
"use strict";
|
|
120
|
+
init_codes_DagpWZLc();
|
|
121
|
+
__create = Object.create;
|
|
122
|
+
__defProp = Object.defineProperty;
|
|
123
|
+
__getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
124
|
+
__getOwnPropNames = Object.getOwnPropertyNames;
|
|
125
|
+
__getProtoOf = Object.getPrototypeOf;
|
|
126
|
+
__hasOwnProp = Object.prototype.hasOwnProperty;
|
|
127
|
+
__commonJS = (cb, mod) => function() {
|
|
128
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
129
|
+
};
|
|
130
|
+
__copyProps = (to, from, except, desc) => {
|
|
131
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
132
|
+
key = keys[i];
|
|
133
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
134
|
+
get: ((k) => from[k]).bind(null, key),
|
|
135
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
return to;
|
|
139
|
+
};
|
|
140
|
+
__toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
141
|
+
value: mod,
|
|
142
|
+
enumerable: true
|
|
143
|
+
}) : target, mod));
|
|
144
|
+
noop = () => {
|
|
145
|
+
};
|
|
146
|
+
freezeIfAvailable = (obj) => {
|
|
147
|
+
if (Object.freeze) Object.freeze(obj);
|
|
148
|
+
};
|
|
149
|
+
createRecursiveProxy = (callback) => createInnerProxy(callback, [], emptyObject());
|
|
150
|
+
createFlatProxy = (callback) => {
|
|
151
|
+
return new Proxy(noop, { get(_obj, name) {
|
|
152
|
+
if (name === "then") return void 0;
|
|
153
|
+
return callback(name);
|
|
154
|
+
} });
|
|
155
|
+
};
|
|
156
|
+
JSONRPC2_TO_HTTP_CODE = {
|
|
157
|
+
PARSE_ERROR: 400,
|
|
158
|
+
BAD_REQUEST: 400,
|
|
159
|
+
UNAUTHORIZED: 401,
|
|
160
|
+
PAYMENT_REQUIRED: 402,
|
|
161
|
+
FORBIDDEN: 403,
|
|
162
|
+
NOT_FOUND: 404,
|
|
163
|
+
METHOD_NOT_SUPPORTED: 405,
|
|
164
|
+
TIMEOUT: 408,
|
|
165
|
+
CONFLICT: 409,
|
|
166
|
+
PRECONDITION_FAILED: 412,
|
|
167
|
+
PAYLOAD_TOO_LARGE: 413,
|
|
168
|
+
UNSUPPORTED_MEDIA_TYPE: 415,
|
|
169
|
+
UNPROCESSABLE_CONTENT: 422,
|
|
170
|
+
PRECONDITION_REQUIRED: 428,
|
|
171
|
+
TOO_MANY_REQUESTS: 429,
|
|
172
|
+
CLIENT_CLOSED_REQUEST: 499,
|
|
173
|
+
INTERNAL_SERVER_ERROR: 500,
|
|
174
|
+
NOT_IMPLEMENTED: 501,
|
|
175
|
+
BAD_GATEWAY: 502,
|
|
176
|
+
SERVICE_UNAVAILABLE: 503,
|
|
177
|
+
GATEWAY_TIMEOUT: 504
|
|
178
|
+
};
|
|
179
|
+
require_typeof = __commonJS({ "../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/typeof.js"(exports, module) {
|
|
180
|
+
function _typeof$2(o) {
|
|
181
|
+
"@babel/helpers - typeof";
|
|
182
|
+
return module.exports = _typeof$2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o$1) {
|
|
183
|
+
return typeof o$1;
|
|
184
|
+
} : function(o$1) {
|
|
185
|
+
return o$1 && "function" == typeof Symbol && o$1.constructor === Symbol && o$1 !== Symbol.prototype ? "symbol" : typeof o$1;
|
|
186
|
+
}, module.exports.__esModule = true, module.exports["default"] = module.exports, _typeof$2(o);
|
|
187
|
+
}
|
|
188
|
+
module.exports = _typeof$2, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
189
|
+
} });
|
|
190
|
+
require_toPrimitive = __commonJS({ "../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(exports, module) {
|
|
191
|
+
var _typeof$1 = require_typeof()["default"];
|
|
192
|
+
function toPrimitive$1(t, r) {
|
|
193
|
+
if ("object" != _typeof$1(t) || !t) return t;
|
|
194
|
+
var e = t[Symbol.toPrimitive];
|
|
195
|
+
if (void 0 !== e) {
|
|
196
|
+
var i = e.call(t, r || "default");
|
|
197
|
+
if ("object" != _typeof$1(i)) return i;
|
|
198
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
199
|
+
}
|
|
200
|
+
return ("string" === r ? String : Number)(t);
|
|
201
|
+
}
|
|
202
|
+
module.exports = toPrimitive$1, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
203
|
+
} });
|
|
204
|
+
require_toPropertyKey = __commonJS({ "../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(exports, module) {
|
|
205
|
+
var _typeof = require_typeof()["default"];
|
|
206
|
+
var toPrimitive = require_toPrimitive();
|
|
207
|
+
function toPropertyKey$1(t) {
|
|
208
|
+
var i = toPrimitive(t, "string");
|
|
209
|
+
return "symbol" == _typeof(i) ? i : i + "";
|
|
210
|
+
}
|
|
211
|
+
module.exports = toPropertyKey$1, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
212
|
+
} });
|
|
213
|
+
require_defineProperty = __commonJS({ "../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(exports, module) {
|
|
214
|
+
var toPropertyKey = require_toPropertyKey();
|
|
215
|
+
function _defineProperty(e, r, t) {
|
|
216
|
+
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
217
|
+
value: t,
|
|
218
|
+
enumerable: true,
|
|
219
|
+
configurable: true,
|
|
220
|
+
writable: true
|
|
221
|
+
}) : e[r] = t, e;
|
|
222
|
+
}
|
|
223
|
+
module.exports = _defineProperty, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
224
|
+
} });
|
|
225
|
+
require_objectSpread2 = __commonJS({ "../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(exports, module) {
|
|
226
|
+
var defineProperty = require_defineProperty();
|
|
227
|
+
function ownKeys(e, r) {
|
|
228
|
+
var t = Object.keys(e);
|
|
229
|
+
if (Object.getOwnPropertySymbols) {
|
|
230
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
231
|
+
r && (o = o.filter(function(r$1) {
|
|
232
|
+
return Object.getOwnPropertyDescriptor(e, r$1).enumerable;
|
|
233
|
+
})), t.push.apply(t, o);
|
|
234
|
+
}
|
|
235
|
+
return t;
|
|
236
|
+
}
|
|
237
|
+
function _objectSpread2(e) {
|
|
238
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
239
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
240
|
+
r % 2 ? ownKeys(Object(t), true).forEach(function(r$1) {
|
|
241
|
+
defineProperty(e, r$1, t[r$1]);
|
|
242
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r$1) {
|
|
243
|
+
Object.defineProperty(e, r$1, Object.getOwnPropertyDescriptor(t, r$1));
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
return e;
|
|
247
|
+
}
|
|
248
|
+
module.exports = _objectSpread2, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
249
|
+
} });
|
|
250
|
+
import_objectSpread2 = __toESM(require_objectSpread2(), 1);
|
|
251
|
+
}
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
// ../../node_modules/@trpc/server/dist/tracked-DWInO6EQ.mjs
|
|
255
|
+
function getMessage(cause) {
|
|
256
|
+
if ("message" in cause) return String(cause.message);
|
|
257
|
+
return void 0;
|
|
258
|
+
}
|
|
259
|
+
function getCauseFromUnknown(cause) {
|
|
260
|
+
if (cause instanceof Error) return cause;
|
|
261
|
+
const type = typeof cause;
|
|
262
|
+
if (type === "undefined" || type === "function" || cause === null) return void 0;
|
|
263
|
+
if (type !== "object") return new Error(String(cause));
|
|
264
|
+
if (isObject(cause)) return new UnknownCauseError(cause);
|
|
265
|
+
return void 0;
|
|
266
|
+
}
|
|
267
|
+
function getTRPCErrorFromUnknown(cause) {
|
|
268
|
+
if (cause instanceof TRPCError) return cause;
|
|
269
|
+
if (cause instanceof Error && cause.name === "TRPCError") return cause;
|
|
270
|
+
const trpcError = new TRPCError({
|
|
271
|
+
code: "INTERNAL_SERVER_ERROR",
|
|
272
|
+
cause
|
|
273
|
+
});
|
|
274
|
+
if (cause instanceof Error && cause.stack) trpcError.stack = cause.stack;
|
|
275
|
+
return trpcError;
|
|
276
|
+
}
|
|
277
|
+
function getDataTransformer(transformer) {
|
|
278
|
+
if ("input" in transformer) return transformer;
|
|
279
|
+
return {
|
|
280
|
+
input: transformer,
|
|
281
|
+
output: transformer
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
function transformTRPCResponseItem(config, item) {
|
|
285
|
+
if ("error" in item) return (0, import_objectSpread2$1.default)((0, import_objectSpread2$1.default)({}, item), {}, { error: config.transformer.output.serialize(item.error) });
|
|
286
|
+
if ("data" in item.result) return (0, import_objectSpread2$1.default)((0, import_objectSpread2$1.default)({}, item), {}, { result: (0, import_objectSpread2$1.default)((0, import_objectSpread2$1.default)({}, item.result), {}, { data: config.transformer.output.serialize(item.result.data) }) });
|
|
287
|
+
return item;
|
|
288
|
+
}
|
|
289
|
+
function transformTRPCResponse(config, itemOrItems) {
|
|
290
|
+
return Array.isArray(itemOrItems) ? itemOrItems.map((item) => transformTRPCResponseItem(config, item)) : transformTRPCResponseItem(config, itemOrItems);
|
|
291
|
+
}
|
|
292
|
+
function once(fn) {
|
|
293
|
+
const uncalled = /* @__PURE__ */ Symbol();
|
|
294
|
+
let result = uncalled;
|
|
295
|
+
return () => {
|
|
296
|
+
if (result === uncalled) result = fn();
|
|
297
|
+
return result;
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
function lazy(importRouter) {
|
|
301
|
+
async function resolve() {
|
|
302
|
+
const mod = await importRouter();
|
|
303
|
+
if (isRouter(mod)) return mod;
|
|
304
|
+
const routers = Object.values(mod);
|
|
305
|
+
if (routers.length !== 1 || !isRouter(routers[0])) throw new Error("Invalid router module - either define exactly 1 export or return the router directly.\nExample: `lazy(() => import('./slow.js').then((m) => m.slowRouter))`");
|
|
306
|
+
return routers[0];
|
|
307
|
+
}
|
|
308
|
+
resolve[lazyMarker] = true;
|
|
309
|
+
return resolve;
|
|
310
|
+
}
|
|
311
|
+
function isLazy(input) {
|
|
312
|
+
return typeof input === "function" && lazyMarker in input;
|
|
313
|
+
}
|
|
314
|
+
function isRouter(value) {
|
|
315
|
+
return isObject(value) && isObject(value["_def"]) && "router" in value["_def"];
|
|
316
|
+
}
|
|
317
|
+
function createRouterFactory(config) {
|
|
318
|
+
function createRouterInner(input) {
|
|
319
|
+
const reservedWordsUsed = new Set(Object.keys(input).filter((v) => reservedWords.includes(v)));
|
|
320
|
+
if (reservedWordsUsed.size > 0) throw new Error("Reserved words used in `router({})` call: " + Array.from(reservedWordsUsed).join(", "));
|
|
321
|
+
const procedures = emptyObject();
|
|
322
|
+
const lazy$1 = emptyObject();
|
|
323
|
+
function createLazyLoader(opts) {
|
|
324
|
+
return {
|
|
325
|
+
ref: opts.ref,
|
|
326
|
+
load: once(async () => {
|
|
327
|
+
const router$1 = await opts.ref();
|
|
328
|
+
const lazyPath = [...opts.path, opts.key];
|
|
329
|
+
const lazyKey = lazyPath.join(".");
|
|
330
|
+
opts.aggregate[opts.key] = step(router$1._def.record, lazyPath);
|
|
331
|
+
delete lazy$1[lazyKey];
|
|
332
|
+
for (const [nestedKey, nestedItem] of Object.entries(router$1._def.lazy)) {
|
|
333
|
+
const nestedRouterKey = [...lazyPath, nestedKey].join(".");
|
|
334
|
+
lazy$1[nestedRouterKey] = createLazyLoader({
|
|
335
|
+
ref: nestedItem.ref,
|
|
336
|
+
path: lazyPath,
|
|
337
|
+
key: nestedKey,
|
|
338
|
+
aggregate: opts.aggregate[opts.key]
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
})
|
|
342
|
+
};
|
|
343
|
+
}
|
|
344
|
+
function step(from, path = []) {
|
|
345
|
+
const aggregate = emptyObject();
|
|
346
|
+
for (const [key, item] of Object.entries(from !== null && from !== void 0 ? from : {})) {
|
|
347
|
+
if (isLazy(item)) {
|
|
348
|
+
lazy$1[[...path, key].join(".")] = createLazyLoader({
|
|
349
|
+
path,
|
|
350
|
+
ref: item,
|
|
351
|
+
key,
|
|
352
|
+
aggregate
|
|
353
|
+
});
|
|
354
|
+
continue;
|
|
355
|
+
}
|
|
356
|
+
if (isRouter(item)) {
|
|
357
|
+
aggregate[key] = step(item._def.record, [...path, key]);
|
|
358
|
+
continue;
|
|
359
|
+
}
|
|
360
|
+
if (!isProcedure(item)) {
|
|
361
|
+
aggregate[key] = step(item, [...path, key]);
|
|
362
|
+
continue;
|
|
363
|
+
}
|
|
364
|
+
const newPath = [...path, key].join(".");
|
|
365
|
+
if (procedures[newPath]) throw new Error(`Duplicate key: ${newPath}`);
|
|
366
|
+
procedures[newPath] = item;
|
|
367
|
+
aggregate[key] = item;
|
|
368
|
+
}
|
|
369
|
+
return aggregate;
|
|
370
|
+
}
|
|
371
|
+
const record = step(input);
|
|
372
|
+
const _def = (0, import_objectSpread22.default)((0, import_objectSpread22.default)({
|
|
373
|
+
_config: config,
|
|
374
|
+
router: true,
|
|
375
|
+
procedures,
|
|
376
|
+
lazy: lazy$1
|
|
377
|
+
}, emptyRouter), {}, { record });
|
|
378
|
+
const router = (0, import_objectSpread22.default)((0, import_objectSpread22.default)({}, record), {}, {
|
|
379
|
+
_def,
|
|
380
|
+
createCaller: createCallerFactory()({ _def })
|
|
381
|
+
});
|
|
382
|
+
return router;
|
|
383
|
+
}
|
|
384
|
+
return createRouterInner;
|
|
385
|
+
}
|
|
386
|
+
function isProcedure(procedureOrRouter) {
|
|
387
|
+
return typeof procedureOrRouter === "function";
|
|
388
|
+
}
|
|
389
|
+
async function getProcedureAtPath(router, path) {
|
|
390
|
+
const { _def } = router;
|
|
391
|
+
let procedure = _def.procedures[path];
|
|
392
|
+
while (!procedure) {
|
|
393
|
+
const key = Object.keys(_def.lazy).find((key$1) => path.startsWith(key$1));
|
|
394
|
+
if (!key) return null;
|
|
395
|
+
const lazyRouter = _def.lazy[key];
|
|
396
|
+
await lazyRouter.load();
|
|
397
|
+
procedure = _def.procedures[path];
|
|
398
|
+
}
|
|
399
|
+
return procedure;
|
|
400
|
+
}
|
|
401
|
+
async function callProcedure(opts) {
|
|
402
|
+
const { type, path } = opts;
|
|
403
|
+
const proc = await getProcedureAtPath(opts.router, path);
|
|
404
|
+
if (!proc || !isProcedure(proc) || proc._def.type !== type && !opts.allowMethodOverride) throw new TRPCError({
|
|
405
|
+
code: "NOT_FOUND",
|
|
406
|
+
message: `No "${type}"-procedure on path "${path}"`
|
|
407
|
+
});
|
|
408
|
+
if (proc._def.type !== type && opts.allowMethodOverride && proc._def.type === "subscription") throw new TRPCError({
|
|
409
|
+
code: "METHOD_NOT_SUPPORTED",
|
|
410
|
+
message: `Method override is not supported for subscriptions`
|
|
411
|
+
});
|
|
412
|
+
return proc(opts);
|
|
413
|
+
}
|
|
414
|
+
function createCallerFactory() {
|
|
415
|
+
return function createCallerInner(router) {
|
|
416
|
+
const { _def } = router;
|
|
417
|
+
return function createCaller(ctxOrCallback, opts) {
|
|
418
|
+
return createRecursiveProxy(async (innerOpts) => {
|
|
419
|
+
const { path, args } = innerOpts;
|
|
420
|
+
const fullPath = path.join(".");
|
|
421
|
+
if (path.length === 1 && path[0] === "_def") return _def;
|
|
422
|
+
const procedure = await getProcedureAtPath(router, fullPath);
|
|
423
|
+
let ctx = void 0;
|
|
424
|
+
try {
|
|
425
|
+
if (!procedure) throw new TRPCError({
|
|
426
|
+
code: "NOT_FOUND",
|
|
427
|
+
message: `No procedure found on path "${path}"`
|
|
428
|
+
});
|
|
429
|
+
ctx = isFunction(ctxOrCallback) ? await Promise.resolve(ctxOrCallback()) : ctxOrCallback;
|
|
430
|
+
return await procedure({
|
|
431
|
+
path: fullPath,
|
|
432
|
+
getRawInput: async () => args[0],
|
|
433
|
+
ctx,
|
|
434
|
+
type: procedure._def.type,
|
|
435
|
+
signal: opts === null || opts === void 0 ? void 0 : opts.signal,
|
|
436
|
+
batchIndex: 0
|
|
437
|
+
});
|
|
438
|
+
} catch (cause) {
|
|
439
|
+
var _opts$onError, _procedure$_def$type;
|
|
440
|
+
opts === null || opts === void 0 || (_opts$onError = opts.onError) === null || _opts$onError === void 0 || _opts$onError.call(opts, {
|
|
441
|
+
ctx,
|
|
442
|
+
error: getTRPCErrorFromUnknown(cause),
|
|
443
|
+
input: args[0],
|
|
444
|
+
path: fullPath,
|
|
445
|
+
type: (_procedure$_def$type = procedure === null || procedure === void 0 ? void 0 : procedure._def.type) !== null && _procedure$_def$type !== void 0 ? _procedure$_def$type : "unknown"
|
|
446
|
+
});
|
|
447
|
+
throw cause;
|
|
448
|
+
}
|
|
449
|
+
});
|
|
450
|
+
};
|
|
451
|
+
};
|
|
452
|
+
}
|
|
453
|
+
function mergeRouters(...routerList) {
|
|
454
|
+
var _routerList$, _routerList$2;
|
|
455
|
+
const record = mergeWithoutOverrides({}, ...routerList.map((r) => r._def.record));
|
|
456
|
+
const errorFormatter = routerList.reduce((currentErrorFormatter, nextRouter) => {
|
|
457
|
+
if (nextRouter._def._config.errorFormatter && nextRouter._def._config.errorFormatter !== defaultFormatter) {
|
|
458
|
+
if (currentErrorFormatter !== defaultFormatter && currentErrorFormatter !== nextRouter._def._config.errorFormatter) throw new Error("You seem to have several error formatters");
|
|
459
|
+
return nextRouter._def._config.errorFormatter;
|
|
460
|
+
}
|
|
461
|
+
return currentErrorFormatter;
|
|
462
|
+
}, defaultFormatter);
|
|
463
|
+
const transformer = routerList.reduce((prev, current) => {
|
|
464
|
+
if (current._def._config.transformer && current._def._config.transformer !== defaultTransformer) {
|
|
465
|
+
if (prev !== defaultTransformer && prev !== current._def._config.transformer) throw new Error("You seem to have several transformers");
|
|
466
|
+
return current._def._config.transformer;
|
|
467
|
+
}
|
|
468
|
+
return prev;
|
|
469
|
+
}, defaultTransformer);
|
|
470
|
+
const router = createRouterFactory({
|
|
471
|
+
errorFormatter,
|
|
472
|
+
transformer,
|
|
473
|
+
isDev: routerList.every((r) => r._def._config.isDev),
|
|
474
|
+
allowOutsideOfServer: routerList.every((r) => r._def._config.allowOutsideOfServer),
|
|
475
|
+
isServer: routerList.every((r) => r._def._config.isServer),
|
|
476
|
+
$types: (_routerList$ = routerList[0]) === null || _routerList$ === void 0 ? void 0 : _routerList$._def._config.$types,
|
|
477
|
+
sse: (_routerList$2 = routerList[0]) === null || _routerList$2 === void 0 ? void 0 : _routerList$2._def._config.sse
|
|
478
|
+
})(record);
|
|
479
|
+
return router;
|
|
480
|
+
}
|
|
481
|
+
function sse(event) {
|
|
482
|
+
return tracked(event.id, event.data);
|
|
483
|
+
}
|
|
484
|
+
function isTrackedEnvelope(value) {
|
|
485
|
+
return Array.isArray(value) && value[2] === trackedSymbol;
|
|
486
|
+
}
|
|
487
|
+
function tracked(id, data) {
|
|
488
|
+
if (id === "") throw new Error("`id` must not be an empty string as empty string is the same as not setting the id at all");
|
|
489
|
+
return [
|
|
490
|
+
id,
|
|
491
|
+
data,
|
|
492
|
+
trackedSymbol
|
|
493
|
+
];
|
|
494
|
+
}
|
|
495
|
+
var defaultFormatter, import_defineProperty, UnknownCauseError, TRPCError, import_objectSpread2$1, defaultTransformer, import_objectSpread22, lazyMarker, emptyRouter, reservedWords, trackedSymbol;
|
|
496
|
+
var init_tracked_DWInO6EQ = __esm({
|
|
497
|
+
"../../node_modules/@trpc/server/dist/tracked-DWInO6EQ.mjs"() {
|
|
498
|
+
"use strict";
|
|
499
|
+
init_getErrorShape_BPSzUA7W();
|
|
500
|
+
init_codes_DagpWZLc();
|
|
501
|
+
defaultFormatter = ({ shape }) => {
|
|
502
|
+
return shape;
|
|
503
|
+
};
|
|
504
|
+
import_defineProperty = __toESM(require_defineProperty(), 1);
|
|
505
|
+
UnknownCauseError = class extends Error {
|
|
506
|
+
constructor(cause) {
|
|
507
|
+
super(getMessage(cause));
|
|
508
|
+
Object.assign(this, cause);
|
|
509
|
+
}
|
|
510
|
+
};
|
|
511
|
+
TRPCError = class extends Error {
|
|
512
|
+
constructor(opts) {
|
|
513
|
+
var _ref, _opts$message, _this$cause;
|
|
514
|
+
const cause = getCauseFromUnknown(opts.cause);
|
|
515
|
+
const message = (_ref = (_opts$message = opts.message) !== null && _opts$message !== void 0 ? _opts$message : cause === null || cause === void 0 ? void 0 : cause.message) !== null && _ref !== void 0 ? _ref : opts.code;
|
|
516
|
+
super(message, { cause });
|
|
517
|
+
(0, import_defineProperty.default)(this, "cause", void 0);
|
|
518
|
+
(0, import_defineProperty.default)(this, "code", void 0);
|
|
519
|
+
this.code = opts.code;
|
|
520
|
+
this.name = "TRPCError";
|
|
521
|
+
(_this$cause = this.cause) !== null && _this$cause !== void 0 || (this.cause = cause);
|
|
522
|
+
}
|
|
523
|
+
};
|
|
524
|
+
import_objectSpread2$1 = __toESM(require_objectSpread2(), 1);
|
|
525
|
+
defaultTransformer = {
|
|
526
|
+
input: {
|
|
527
|
+
serialize: (obj) => obj,
|
|
528
|
+
deserialize: (obj) => obj
|
|
529
|
+
},
|
|
530
|
+
output: {
|
|
531
|
+
serialize: (obj) => obj,
|
|
532
|
+
deserialize: (obj) => obj
|
|
533
|
+
}
|
|
534
|
+
};
|
|
535
|
+
import_objectSpread22 = __toESM(require_objectSpread2(), 1);
|
|
536
|
+
lazyMarker = "lazyMarker";
|
|
537
|
+
emptyRouter = {
|
|
538
|
+
_ctx: null,
|
|
539
|
+
_errorShape: null,
|
|
540
|
+
_meta: null,
|
|
541
|
+
queries: {},
|
|
542
|
+
mutations: {},
|
|
543
|
+
subscriptions: {},
|
|
544
|
+
errorFormatter: defaultFormatter,
|
|
545
|
+
transformer: defaultTransformer
|
|
546
|
+
};
|
|
547
|
+
reservedWords = [
|
|
548
|
+
"then",
|
|
549
|
+
"call",
|
|
550
|
+
"apply"
|
|
551
|
+
];
|
|
552
|
+
trackedSymbol = /* @__PURE__ */ Symbol();
|
|
553
|
+
}
|
|
554
|
+
});
|
|
555
|
+
|
|
556
|
+
// ../../node_modules/@trpc/server/dist/initTRPC-BRf4imah.mjs
|
|
557
|
+
function createMiddlewareFactory() {
|
|
558
|
+
function createMiddlewareInner(middlewares) {
|
|
559
|
+
return {
|
|
560
|
+
_middlewares: middlewares,
|
|
561
|
+
unstable_pipe(middlewareBuilderOrFn) {
|
|
562
|
+
const pipedMiddleware = "_middlewares" in middlewareBuilderOrFn ? middlewareBuilderOrFn._middlewares : [middlewareBuilderOrFn];
|
|
563
|
+
return createMiddlewareInner([...middlewares, ...pipedMiddleware]);
|
|
564
|
+
}
|
|
565
|
+
};
|
|
566
|
+
}
|
|
567
|
+
function createMiddleware(fn) {
|
|
568
|
+
return createMiddlewareInner([fn]);
|
|
569
|
+
}
|
|
570
|
+
return createMiddleware;
|
|
571
|
+
}
|
|
572
|
+
function createInputMiddleware(parse) {
|
|
573
|
+
const inputMiddleware = async function inputValidatorMiddleware(opts) {
|
|
574
|
+
let parsedInput;
|
|
575
|
+
const rawInput = await opts.getRawInput();
|
|
576
|
+
try {
|
|
577
|
+
parsedInput = await parse(rawInput);
|
|
578
|
+
} catch (cause) {
|
|
579
|
+
throw new TRPCError({
|
|
580
|
+
code: "BAD_REQUEST",
|
|
581
|
+
cause
|
|
582
|
+
});
|
|
583
|
+
}
|
|
584
|
+
const combinedInput = isObject(opts.input) && isObject(parsedInput) ? (0, import_objectSpread2$2.default)((0, import_objectSpread2$2.default)({}, opts.input), parsedInput) : parsedInput;
|
|
585
|
+
return opts.next({ input: combinedInput });
|
|
586
|
+
};
|
|
587
|
+
inputMiddleware._type = "input";
|
|
588
|
+
return inputMiddleware;
|
|
589
|
+
}
|
|
590
|
+
function createOutputMiddleware(parse) {
|
|
591
|
+
const outputMiddleware = async function outputValidatorMiddleware({ next }) {
|
|
592
|
+
const result = await next();
|
|
593
|
+
if (!result.ok) return result;
|
|
594
|
+
try {
|
|
595
|
+
const data = await parse(result.data);
|
|
596
|
+
return (0, import_objectSpread2$2.default)((0, import_objectSpread2$2.default)({}, result), {}, { data });
|
|
597
|
+
} catch (cause) {
|
|
598
|
+
throw new TRPCError({
|
|
599
|
+
message: "Output validation failed",
|
|
600
|
+
code: "INTERNAL_SERVER_ERROR",
|
|
601
|
+
cause
|
|
602
|
+
});
|
|
603
|
+
}
|
|
604
|
+
};
|
|
605
|
+
outputMiddleware._type = "output";
|
|
606
|
+
return outputMiddleware;
|
|
607
|
+
}
|
|
608
|
+
function getParseFn(procedureParser) {
|
|
609
|
+
const parser = procedureParser;
|
|
610
|
+
const isStandardSchema = "~standard" in parser;
|
|
611
|
+
if (typeof parser === "function" && typeof parser.assert === "function") return parser.assert.bind(parser);
|
|
612
|
+
if (typeof parser === "function" && !isStandardSchema) return parser;
|
|
613
|
+
if (typeof parser.parseAsync === "function") return parser.parseAsync.bind(parser);
|
|
614
|
+
if (typeof parser.parse === "function") return parser.parse.bind(parser);
|
|
615
|
+
if (typeof parser.validateSync === "function") return parser.validateSync.bind(parser);
|
|
616
|
+
if (typeof parser.create === "function") return parser.create.bind(parser);
|
|
617
|
+
if (typeof parser.assert === "function") return (value) => {
|
|
618
|
+
parser.assert(value);
|
|
619
|
+
return value;
|
|
620
|
+
};
|
|
621
|
+
if (isStandardSchema) return async (value) => {
|
|
622
|
+
const result = await parser["~standard"].validate(value);
|
|
623
|
+
if (result.issues) throw new StandardSchemaV1Error(result.issues);
|
|
624
|
+
return result.value;
|
|
625
|
+
};
|
|
626
|
+
throw new Error("Could not find a validator fn");
|
|
627
|
+
}
|
|
628
|
+
function createNewBuilder(def1, def2) {
|
|
629
|
+
const { middlewares = [], inputs, meta } = def2, rest = (0, import_objectWithoutProperties.default)(def2, _excluded);
|
|
630
|
+
return createBuilder((0, import_objectSpread2$12.default)((0, import_objectSpread2$12.default)({}, mergeWithoutOverrides(def1, rest)), {}, {
|
|
631
|
+
inputs: [...def1.inputs, ...inputs !== null && inputs !== void 0 ? inputs : []],
|
|
632
|
+
middlewares: [...def1.middlewares, ...middlewares],
|
|
633
|
+
meta: def1.meta && meta ? (0, import_objectSpread2$12.default)((0, import_objectSpread2$12.default)({}, def1.meta), meta) : meta !== null && meta !== void 0 ? meta : def1.meta
|
|
634
|
+
}));
|
|
635
|
+
}
|
|
636
|
+
function createBuilder(initDef = {}) {
|
|
637
|
+
const _def = (0, import_objectSpread2$12.default)({
|
|
638
|
+
procedure: true,
|
|
639
|
+
inputs: [],
|
|
640
|
+
middlewares: []
|
|
641
|
+
}, initDef);
|
|
642
|
+
const builder = {
|
|
643
|
+
_def,
|
|
644
|
+
input(input) {
|
|
645
|
+
const parser = getParseFn(input);
|
|
646
|
+
return createNewBuilder(_def, {
|
|
647
|
+
inputs: [input],
|
|
648
|
+
middlewares: [createInputMiddleware(parser)]
|
|
649
|
+
});
|
|
650
|
+
},
|
|
651
|
+
output(output) {
|
|
652
|
+
const parser = getParseFn(output);
|
|
653
|
+
return createNewBuilder(_def, {
|
|
654
|
+
output,
|
|
655
|
+
middlewares: [createOutputMiddleware(parser)]
|
|
656
|
+
});
|
|
657
|
+
},
|
|
658
|
+
meta(meta) {
|
|
659
|
+
return createNewBuilder(_def, { meta });
|
|
660
|
+
},
|
|
661
|
+
use(middlewareBuilderOrFn) {
|
|
662
|
+
const middlewares = "_middlewares" in middlewareBuilderOrFn ? middlewareBuilderOrFn._middlewares : [middlewareBuilderOrFn];
|
|
663
|
+
return createNewBuilder(_def, { middlewares });
|
|
664
|
+
},
|
|
665
|
+
unstable_concat(builder$1) {
|
|
666
|
+
return createNewBuilder(_def, builder$1._def);
|
|
667
|
+
},
|
|
668
|
+
concat(builder$1) {
|
|
669
|
+
return createNewBuilder(_def, builder$1._def);
|
|
670
|
+
},
|
|
671
|
+
query(resolver) {
|
|
672
|
+
return createResolver((0, import_objectSpread2$12.default)((0, import_objectSpread2$12.default)({}, _def), {}, { type: "query" }), resolver);
|
|
673
|
+
},
|
|
674
|
+
mutation(resolver) {
|
|
675
|
+
return createResolver((0, import_objectSpread2$12.default)((0, import_objectSpread2$12.default)({}, _def), {}, { type: "mutation" }), resolver);
|
|
676
|
+
},
|
|
677
|
+
subscription(resolver) {
|
|
678
|
+
return createResolver((0, import_objectSpread2$12.default)((0, import_objectSpread2$12.default)({}, _def), {}, { type: "subscription" }), resolver);
|
|
679
|
+
},
|
|
680
|
+
experimental_caller(caller) {
|
|
681
|
+
return createNewBuilder(_def, { caller });
|
|
682
|
+
}
|
|
683
|
+
};
|
|
684
|
+
return builder;
|
|
685
|
+
}
|
|
686
|
+
function createResolver(_defIn, resolver) {
|
|
687
|
+
const finalBuilder = createNewBuilder(_defIn, {
|
|
688
|
+
resolver,
|
|
689
|
+
middlewares: [async function resolveMiddleware(opts) {
|
|
690
|
+
const data = await resolver(opts);
|
|
691
|
+
return {
|
|
692
|
+
marker: middlewareMarker,
|
|
693
|
+
ok: true,
|
|
694
|
+
data,
|
|
695
|
+
ctx: opts.ctx
|
|
696
|
+
};
|
|
697
|
+
}]
|
|
698
|
+
});
|
|
699
|
+
const _def = (0, import_objectSpread2$12.default)((0, import_objectSpread2$12.default)({}, finalBuilder._def), {}, {
|
|
700
|
+
type: _defIn.type,
|
|
701
|
+
experimental_caller: Boolean(finalBuilder._def.caller),
|
|
702
|
+
meta: finalBuilder._def.meta,
|
|
703
|
+
$types: null
|
|
704
|
+
});
|
|
705
|
+
const invoke = createProcedureCaller(finalBuilder._def);
|
|
706
|
+
const callerOverride = finalBuilder._def.caller;
|
|
707
|
+
if (!callerOverride) return invoke;
|
|
708
|
+
const callerWrapper = async (...args) => {
|
|
709
|
+
return await callerOverride({
|
|
710
|
+
args,
|
|
711
|
+
invoke,
|
|
712
|
+
_def
|
|
713
|
+
});
|
|
714
|
+
};
|
|
715
|
+
callerWrapper._def = _def;
|
|
716
|
+
return callerWrapper;
|
|
717
|
+
}
|
|
718
|
+
async function callRecursive(index, _def, opts) {
|
|
719
|
+
try {
|
|
720
|
+
const middleware = _def.middlewares[index];
|
|
721
|
+
const result = await middleware((0, import_objectSpread2$12.default)((0, import_objectSpread2$12.default)({}, opts), {}, {
|
|
722
|
+
meta: _def.meta,
|
|
723
|
+
input: opts.input,
|
|
724
|
+
next(_nextOpts) {
|
|
725
|
+
var _nextOpts$getRawInput;
|
|
726
|
+
const nextOpts = _nextOpts;
|
|
727
|
+
return callRecursive(index + 1, _def, (0, import_objectSpread2$12.default)((0, import_objectSpread2$12.default)({}, opts), {}, {
|
|
728
|
+
ctx: (nextOpts === null || nextOpts === void 0 ? void 0 : nextOpts.ctx) ? (0, import_objectSpread2$12.default)((0, import_objectSpread2$12.default)({}, opts.ctx), nextOpts.ctx) : opts.ctx,
|
|
729
|
+
input: nextOpts && "input" in nextOpts ? nextOpts.input : opts.input,
|
|
730
|
+
getRawInput: (_nextOpts$getRawInput = nextOpts === null || nextOpts === void 0 ? void 0 : nextOpts.getRawInput) !== null && _nextOpts$getRawInput !== void 0 ? _nextOpts$getRawInput : opts.getRawInput
|
|
731
|
+
}));
|
|
732
|
+
}
|
|
733
|
+
}));
|
|
734
|
+
return result;
|
|
735
|
+
} catch (cause) {
|
|
736
|
+
return {
|
|
737
|
+
ok: false,
|
|
738
|
+
error: getTRPCErrorFromUnknown(cause),
|
|
739
|
+
marker: middlewareMarker
|
|
740
|
+
};
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
function createProcedureCaller(_def) {
|
|
744
|
+
async function procedure(opts) {
|
|
745
|
+
if (!opts || !("getRawInput" in opts)) throw new Error(codeblock);
|
|
746
|
+
const result = await callRecursive(0, _def, opts);
|
|
747
|
+
if (!result) throw new TRPCError({
|
|
748
|
+
code: "INTERNAL_SERVER_ERROR",
|
|
749
|
+
message: "No result from middlewares - did you forget to `return next()`?"
|
|
750
|
+
});
|
|
751
|
+
if (!result.ok) throw result.error;
|
|
752
|
+
return result.data;
|
|
753
|
+
}
|
|
754
|
+
procedure._def = _def;
|
|
755
|
+
procedure.procedure = true;
|
|
756
|
+
procedure.meta = _def.meta;
|
|
757
|
+
return procedure;
|
|
758
|
+
}
|
|
759
|
+
var import_objectSpread2$2, middlewareMarker, experimental_standaloneMiddleware, import_defineProperty2, StandardSchemaV1Error, require_objectWithoutPropertiesLoose, require_objectWithoutProperties, import_objectWithoutProperties, import_objectSpread2$12, _excluded, codeblock, _globalThis$process, _globalThis$process2, _globalThis$process3, isServerDefault, import_objectSpread23, TRPCBuilder, initTRPC;
|
|
760
|
+
var init_initTRPC_BRf4imah = __esm({
|
|
761
|
+
"../../node_modules/@trpc/server/dist/initTRPC-BRf4imah.mjs"() {
|
|
762
|
+
"use strict";
|
|
763
|
+
init_getErrorShape_BPSzUA7W();
|
|
764
|
+
init_codes_DagpWZLc();
|
|
765
|
+
init_tracked_DWInO6EQ();
|
|
766
|
+
import_objectSpread2$2 = __toESM(require_objectSpread2(), 1);
|
|
767
|
+
middlewareMarker = "middlewareMarker";
|
|
768
|
+
experimental_standaloneMiddleware = () => ({ create: createMiddlewareFactory() });
|
|
769
|
+
import_defineProperty2 = __toESM(require_defineProperty(), 1);
|
|
770
|
+
StandardSchemaV1Error = class extends Error {
|
|
771
|
+
/**
|
|
772
|
+
* Creates a schema error with useful information.
|
|
773
|
+
*
|
|
774
|
+
* @param issues The schema issues.
|
|
775
|
+
*/
|
|
776
|
+
constructor(issues) {
|
|
777
|
+
var _issues$;
|
|
778
|
+
super((_issues$ = issues[0]) === null || _issues$ === void 0 ? void 0 : _issues$.message);
|
|
779
|
+
(0, import_defineProperty2.default)(this, "issues", void 0);
|
|
780
|
+
this.name = "SchemaError";
|
|
781
|
+
this.issues = issues;
|
|
782
|
+
}
|
|
783
|
+
};
|
|
784
|
+
require_objectWithoutPropertiesLoose = __commonJS({ "../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectWithoutPropertiesLoose.js"(exports, module) {
|
|
785
|
+
function _objectWithoutPropertiesLoose(r, e) {
|
|
786
|
+
if (null == r) return {};
|
|
787
|
+
var t = {};
|
|
788
|
+
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
789
|
+
if (e.includes(n)) continue;
|
|
790
|
+
t[n] = r[n];
|
|
791
|
+
}
|
|
792
|
+
return t;
|
|
793
|
+
}
|
|
794
|
+
module.exports = _objectWithoutPropertiesLoose, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
795
|
+
} });
|
|
796
|
+
require_objectWithoutProperties = __commonJS({ "../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectWithoutProperties.js"(exports, module) {
|
|
797
|
+
var objectWithoutPropertiesLoose = require_objectWithoutPropertiesLoose();
|
|
798
|
+
function _objectWithoutProperties$1(e, t) {
|
|
799
|
+
if (null == e) return {};
|
|
800
|
+
var o, r, i = objectWithoutPropertiesLoose(e, t);
|
|
801
|
+
if (Object.getOwnPropertySymbols) {
|
|
802
|
+
var s = Object.getOwnPropertySymbols(e);
|
|
803
|
+
for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
|
|
804
|
+
}
|
|
805
|
+
return i;
|
|
806
|
+
}
|
|
807
|
+
module.exports = _objectWithoutProperties$1, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
808
|
+
} });
|
|
809
|
+
import_objectWithoutProperties = __toESM(require_objectWithoutProperties(), 1);
|
|
810
|
+
import_objectSpread2$12 = __toESM(require_objectSpread2(), 1);
|
|
811
|
+
_excluded = [
|
|
812
|
+
"middlewares",
|
|
813
|
+
"inputs",
|
|
814
|
+
"meta"
|
|
815
|
+
];
|
|
816
|
+
codeblock = `
|
|
817
|
+
This is a client-only function.
|
|
818
|
+
If you want to call this function on the server, see https://trpc.io/docs/v11/server/server-side-calls
|
|
819
|
+
`.trim();
|
|
820
|
+
isServerDefault = typeof window === "undefined" || "Deno" in window || ((_globalThis$process = globalThis.process) === null || _globalThis$process === void 0 || (_globalThis$process = _globalThis$process.env) === null || _globalThis$process === void 0 ? void 0 : _globalThis$process["NODE_ENV"]) === "test" || !!((_globalThis$process2 = globalThis.process) === null || _globalThis$process2 === void 0 || (_globalThis$process2 = _globalThis$process2.env) === null || _globalThis$process2 === void 0 ? void 0 : _globalThis$process2["JEST_WORKER_ID"]) || !!((_globalThis$process3 = globalThis.process) === null || _globalThis$process3 === void 0 || (_globalThis$process3 = _globalThis$process3.env) === null || _globalThis$process3 === void 0 ? void 0 : _globalThis$process3["VITEST_WORKER_ID"]);
|
|
821
|
+
import_objectSpread23 = __toESM(require_objectSpread2(), 1);
|
|
822
|
+
TRPCBuilder = class TRPCBuilder2 {
|
|
823
|
+
/**
|
|
824
|
+
* Add a context shape as a generic to the root object
|
|
825
|
+
* @see https://trpc.io/docs/v11/server/context
|
|
826
|
+
*/
|
|
827
|
+
context() {
|
|
828
|
+
return new TRPCBuilder2();
|
|
829
|
+
}
|
|
830
|
+
/**
|
|
831
|
+
* Add a meta shape as a generic to the root object
|
|
832
|
+
* @see https://trpc.io/docs/v11/quickstart
|
|
833
|
+
*/
|
|
834
|
+
meta() {
|
|
835
|
+
return new TRPCBuilder2();
|
|
836
|
+
}
|
|
837
|
+
/**
|
|
838
|
+
* Create the root object
|
|
839
|
+
* @see https://trpc.io/docs/v11/server/routers#initialize-trpc
|
|
840
|
+
*/
|
|
841
|
+
create(opts) {
|
|
842
|
+
var _opts$transformer, _opts$isDev, _globalThis$process$1, _opts$allowOutsideOfS, _opts$errorFormatter, _opts$isServer;
|
|
843
|
+
const config = (0, import_objectSpread23.default)((0, import_objectSpread23.default)({}, opts), {}, {
|
|
844
|
+
transformer: getDataTransformer((_opts$transformer = opts === null || opts === void 0 ? void 0 : opts.transformer) !== null && _opts$transformer !== void 0 ? _opts$transformer : defaultTransformer),
|
|
845
|
+
isDev: (_opts$isDev = opts === null || opts === void 0 ? void 0 : opts.isDev) !== null && _opts$isDev !== void 0 ? _opts$isDev : ((_globalThis$process$1 = globalThis.process) === null || _globalThis$process$1 === void 0 ? void 0 : _globalThis$process$1.env["NODE_ENV"]) !== "production",
|
|
846
|
+
allowOutsideOfServer: (_opts$allowOutsideOfS = opts === null || opts === void 0 ? void 0 : opts.allowOutsideOfServer) !== null && _opts$allowOutsideOfS !== void 0 ? _opts$allowOutsideOfS : false,
|
|
847
|
+
errorFormatter: (_opts$errorFormatter = opts === null || opts === void 0 ? void 0 : opts.errorFormatter) !== null && _opts$errorFormatter !== void 0 ? _opts$errorFormatter : defaultFormatter,
|
|
848
|
+
isServer: (_opts$isServer = opts === null || opts === void 0 ? void 0 : opts.isServer) !== null && _opts$isServer !== void 0 ? _opts$isServer : isServerDefault,
|
|
849
|
+
$types: null
|
|
850
|
+
});
|
|
851
|
+
{
|
|
852
|
+
var _opts$isServer2;
|
|
853
|
+
const isServer = (_opts$isServer2 = opts === null || opts === void 0 ? void 0 : opts.isServer) !== null && _opts$isServer2 !== void 0 ? _opts$isServer2 : isServerDefault;
|
|
854
|
+
if (!isServer && (opts === null || opts === void 0 ? void 0 : opts.allowOutsideOfServer) !== true) throw new Error(`You're trying to use @trpc/server in a non-server environment. This is not supported by default.`);
|
|
855
|
+
}
|
|
856
|
+
return {
|
|
857
|
+
_config: config,
|
|
858
|
+
procedure: createBuilder({ meta: opts === null || opts === void 0 ? void 0 : opts.defaultMeta }),
|
|
859
|
+
middleware: createMiddlewareFactory(),
|
|
860
|
+
router: createRouterFactory(config),
|
|
861
|
+
mergeRouters,
|
|
862
|
+
createCallerFactory: createCallerFactory()
|
|
863
|
+
};
|
|
864
|
+
}
|
|
865
|
+
};
|
|
866
|
+
initTRPC = new TRPCBuilder();
|
|
867
|
+
}
|
|
868
|
+
});
|
|
869
|
+
|
|
870
|
+
// ../../node_modules/@trpc/server/dist/index.mjs
|
|
871
|
+
var init_dist = __esm({
|
|
872
|
+
"../../node_modules/@trpc/server/dist/index.mjs"() {
|
|
873
|
+
init_getErrorShape_BPSzUA7W();
|
|
874
|
+
init_tracked_DWInO6EQ();
|
|
875
|
+
init_initTRPC_BRf4imah();
|
|
876
|
+
}
|
|
877
|
+
});
|
|
878
|
+
init_dist();
|
|
879
|
+
export {
|
|
880
|
+
StandardSchemaV1Error,
|
|
881
|
+
TRPCError,
|
|
882
|
+
callProcedure as callTRPCProcedure,
|
|
883
|
+
createFlatProxy as createTRPCFlatProxy,
|
|
884
|
+
createRecursiveProxy as createTRPCRecursiveProxy,
|
|
885
|
+
lazy as experimental_lazy,
|
|
886
|
+
experimental_standaloneMiddleware,
|
|
887
|
+
experimental_standaloneMiddleware as experimental_trpcMiddleware,
|
|
888
|
+
getErrorShape,
|
|
889
|
+
getTRPCErrorFromUnknown,
|
|
890
|
+
getErrorShape as getTRPCErrorShape,
|
|
891
|
+
initTRPC,
|
|
892
|
+
isTrackedEnvelope,
|
|
893
|
+
lazy,
|
|
894
|
+
sse,
|
|
895
|
+
tracked,
|
|
896
|
+
transformTRPCResponse
|
|
897
|
+
};
|
|
898
|
+
/*! Bundled license information:
|
|
899
|
+
|
|
900
|
+
@trpc/server/dist/tracked-DWInO6EQ.mjs:
|
|
901
|
+
(* istanbul ignore if -- @preserve *)
|
|
902
|
+
*/
|