@learncard/network-plugin 1.7.11 → 1.8.1
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/lcn-plugin.cjs.development.js +632 -218
- package/dist/lcn-plugin.cjs.development.js.map +3 -3
- package/dist/lcn-plugin.cjs.production.min.js +2 -1
- package/dist/lcn-plugin.cjs.production.min.js.map +3 -3
- package/dist/lcn-plugin.esm.js +632 -218
- package/dist/lcn-plugin.esm.js.map +3 -3
- package/dist/plugin.d.ts.map +1 -1
- package/dist/types.d.ts +12 -2
- package/dist/types.d.ts.map +1 -1
- package/package.json +4 -4
package/dist/lcn-plugin.esm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
3
|
|
|
4
|
-
// ../../../node_modules/.pnpm/@trpc+server@10.
|
|
4
|
+
// ../../../node_modules/.pnpm/@trpc+server@10.45.2/node_modules/@trpc/server/dist/observable-ade1bad8.mjs
|
|
5
5
|
function identity(x) {
|
|
6
6
|
return x;
|
|
7
7
|
}
|
|
@@ -80,7 +80,7 @@ function observable(subscribe) {
|
|
|
80
80
|
}
|
|
81
81
|
__name(observable, "observable");
|
|
82
82
|
|
|
83
|
-
// ../../../node_modules/.pnpm/@trpc+server@10.
|
|
83
|
+
// ../../../node_modules/.pnpm/@trpc+server@10.45.2/node_modules/@trpc/server/dist/observable/index.mjs
|
|
84
84
|
function share(_opts) {
|
|
85
85
|
return (originalObserver) => {
|
|
86
86
|
let refCount = 0;
|
|
@@ -183,85 +183,7 @@ function observableToPromise(observable2) {
|
|
|
183
183
|
}
|
|
184
184
|
__name(observableToPromise, "observableToPromise");
|
|
185
185
|
|
|
186
|
-
// ../../../node_modules/.pnpm/@trpc+client@10.
|
|
187
|
-
var TRPCClientError = class extends Error {
|
|
188
|
-
static from(cause, opts = {}) {
|
|
189
|
-
if (!(cause instanceof Error)) {
|
|
190
|
-
return new TRPCClientError(cause.error.message ?? "", {
|
|
191
|
-
...opts,
|
|
192
|
-
cause: void 0,
|
|
193
|
-
result: cause
|
|
194
|
-
});
|
|
195
|
-
}
|
|
196
|
-
if (cause.name === "TRPCClientError") {
|
|
197
|
-
return cause;
|
|
198
|
-
}
|
|
199
|
-
return new TRPCClientError(cause.message, {
|
|
200
|
-
...opts,
|
|
201
|
-
cause,
|
|
202
|
-
result: null
|
|
203
|
-
});
|
|
204
|
-
}
|
|
205
|
-
constructor(message, opts) {
|
|
206
|
-
const cause = opts?.cause;
|
|
207
|
-
super(message, {
|
|
208
|
-
cause
|
|
209
|
-
});
|
|
210
|
-
this.meta = opts?.meta;
|
|
211
|
-
this.cause = cause;
|
|
212
|
-
this.shape = opts?.result?.error;
|
|
213
|
-
this.data = opts?.result?.error.data;
|
|
214
|
-
this.name = "TRPCClientError";
|
|
215
|
-
Object.setPrototypeOf(this, TRPCClientError.prototype);
|
|
216
|
-
}
|
|
217
|
-
};
|
|
218
|
-
__name(TRPCClientError, "TRPCClientError");
|
|
219
|
-
function transformResultInner(response, runtime) {
|
|
220
|
-
if ("error" in response) {
|
|
221
|
-
const error = runtime.transformer.deserialize(response.error);
|
|
222
|
-
return {
|
|
223
|
-
ok: false,
|
|
224
|
-
error: {
|
|
225
|
-
...response,
|
|
226
|
-
error
|
|
227
|
-
}
|
|
228
|
-
};
|
|
229
|
-
}
|
|
230
|
-
const result = {
|
|
231
|
-
...response.result,
|
|
232
|
-
...(!response.result.type || response.result.type === "data") && {
|
|
233
|
-
type: "data",
|
|
234
|
-
data: runtime.transformer.deserialize(response.result.data)
|
|
235
|
-
}
|
|
236
|
-
};
|
|
237
|
-
return {
|
|
238
|
-
ok: true,
|
|
239
|
-
result
|
|
240
|
-
};
|
|
241
|
-
}
|
|
242
|
-
__name(transformResultInner, "transformResultInner");
|
|
243
|
-
function isObject(value) {
|
|
244
|
-
return !!value && !Array.isArray(value) && typeof value === "object";
|
|
245
|
-
}
|
|
246
|
-
__name(isObject, "isObject");
|
|
247
|
-
function transformResult(response, runtime) {
|
|
248
|
-
let result;
|
|
249
|
-
try {
|
|
250
|
-
result = transformResultInner(response, runtime);
|
|
251
|
-
} catch (err) {
|
|
252
|
-
throw new TRPCClientError("Unable to transform response from server");
|
|
253
|
-
}
|
|
254
|
-
if (!result.ok && (!isObject(result.error.error) || typeof result.error.error.code !== "number")) {
|
|
255
|
-
throw new TRPCClientError("Badly formatted response from server");
|
|
256
|
-
}
|
|
257
|
-
if (result.ok && !isObject(result.result)) {
|
|
258
|
-
throw new TRPCClientError("Badly formatted response from server");
|
|
259
|
-
}
|
|
260
|
-
return result;
|
|
261
|
-
}
|
|
262
|
-
__name(transformResult, "transformResult");
|
|
263
|
-
|
|
264
|
-
// ../../../node_modules/.pnpm/@trpc+client@10.17.0_@trpc+server@10.17.0/node_modules/@trpc/client/dist/splitLink-4c75f7be.mjs
|
|
186
|
+
// ../../../node_modules/.pnpm/@trpc+client@10.45.2_@trpc+server@10.45.2/node_modules/@trpc/client/dist/splitLink-4c75f7be.mjs
|
|
265
187
|
function createChain(opts) {
|
|
266
188
|
return observable((observer) => {
|
|
267
189
|
function execute(index = 0, op = opts.op) {
|
|
@@ -285,7 +207,37 @@ function createChain(opts) {
|
|
|
285
207
|
}
|
|
286
208
|
__name(createChain, "createChain");
|
|
287
209
|
|
|
288
|
-
// ../../../node_modules/.pnpm/@trpc+server@10.
|
|
210
|
+
// ../../../node_modules/.pnpm/@trpc+server@10.45.2/node_modules/@trpc/server/dist/codes-c924c3db.mjs
|
|
211
|
+
function invert(obj) {
|
|
212
|
+
const newObj = /* @__PURE__ */ Object.create(null);
|
|
213
|
+
for (const key in obj) {
|
|
214
|
+
const v = obj[key];
|
|
215
|
+
newObj[v] = key;
|
|
216
|
+
}
|
|
217
|
+
return newObj;
|
|
218
|
+
}
|
|
219
|
+
__name(invert, "invert");
|
|
220
|
+
var TRPC_ERROR_CODES_BY_KEY = {
|
|
221
|
+
PARSE_ERROR: -32700,
|
|
222
|
+
BAD_REQUEST: -32600,
|
|
223
|
+
INTERNAL_SERVER_ERROR: -32603,
|
|
224
|
+
NOT_IMPLEMENTED: -32603,
|
|
225
|
+
UNAUTHORIZED: -32001,
|
|
226
|
+
FORBIDDEN: -32003,
|
|
227
|
+
NOT_FOUND: -32004,
|
|
228
|
+
METHOD_NOT_SUPPORTED: -32005,
|
|
229
|
+
TIMEOUT: -32008,
|
|
230
|
+
CONFLICT: -32009,
|
|
231
|
+
PRECONDITION_FAILED: -32012,
|
|
232
|
+
PAYLOAD_TOO_LARGE: -32013,
|
|
233
|
+
UNPROCESSABLE_CONTENT: -32022,
|
|
234
|
+
TOO_MANY_REQUESTS: -32029,
|
|
235
|
+
CLIENT_CLOSED_REQUEST: -32099
|
|
236
|
+
};
|
|
237
|
+
var TRPC_ERROR_CODES_BY_NUMBER = invert(TRPC_ERROR_CODES_BY_KEY);
|
|
238
|
+
|
|
239
|
+
// ../../../node_modules/.pnpm/@trpc+server@10.45.2/node_modules/@trpc/server/dist/index-f91d720c.mjs
|
|
240
|
+
var TRPC_ERROR_CODES_BY_NUMBER2 = invert(TRPC_ERROR_CODES_BY_KEY);
|
|
289
241
|
var noop = /* @__PURE__ */ __name(() => {
|
|
290
242
|
}, "noop");
|
|
291
243
|
function createInnerProxy(callback, path) {
|
|
@@ -300,9 +252,10 @@ function createInnerProxy(callback, path) {
|
|
|
300
252
|
]);
|
|
301
253
|
},
|
|
302
254
|
apply(_1, _2, args) {
|
|
255
|
+
const isApply = path[path.length - 1] === "apply";
|
|
303
256
|
return callback({
|
|
304
|
-
args,
|
|
305
|
-
path
|
|
257
|
+
args: isApply ? args.length >= 2 ? args[1] : [] : args,
|
|
258
|
+
path: isApply ? path.slice(0, -1) : path
|
|
306
259
|
});
|
|
307
260
|
}
|
|
308
261
|
});
|
|
@@ -321,21 +274,152 @@ var createFlatProxy = /* @__PURE__ */ __name((callback) => {
|
|
|
321
274
|
});
|
|
322
275
|
}, "createFlatProxy");
|
|
323
276
|
|
|
324
|
-
// ../../../node_modules/.pnpm/@trpc+
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
return isFunction(fn.bind) ? fn.bind(thisArg) : fn;
|
|
277
|
+
// ../../../node_modules/.pnpm/@trpc+server@10.45.2/node_modules/@trpc/server/dist/getCauseFromUnknown-2d66414a.mjs
|
|
278
|
+
function isObject(value) {
|
|
279
|
+
return !!value && !Array.isArray(value) && typeof value === "object";
|
|
328
280
|
}
|
|
329
|
-
__name(
|
|
281
|
+
__name(isObject, "isObject");
|
|
282
|
+
var UnknownCauseError = class extends Error {
|
|
283
|
+
};
|
|
284
|
+
__name(UnknownCauseError, "UnknownCauseError");
|
|
285
|
+
function getCauseFromUnknown(cause) {
|
|
286
|
+
if (cause instanceof Error) {
|
|
287
|
+
return cause;
|
|
288
|
+
}
|
|
289
|
+
const type = typeof cause;
|
|
290
|
+
if (type === "undefined" || type === "function" || cause === null) {
|
|
291
|
+
return void 0;
|
|
292
|
+
}
|
|
293
|
+
if (type !== "object") {
|
|
294
|
+
return new Error(String(cause));
|
|
295
|
+
}
|
|
296
|
+
if (isObject(cause)) {
|
|
297
|
+
const err = new UnknownCauseError();
|
|
298
|
+
for (const key in cause) {
|
|
299
|
+
err[key] = cause[key];
|
|
300
|
+
}
|
|
301
|
+
return err;
|
|
302
|
+
}
|
|
303
|
+
return void 0;
|
|
304
|
+
}
|
|
305
|
+
__name(getCauseFromUnknown, "getCauseFromUnknown");
|
|
306
|
+
|
|
307
|
+
// ../../../node_modules/.pnpm/@trpc+client@10.45.2_@trpc+server@10.45.2/node_modules/@trpc/client/dist/transformResult-ace864b8.mjs
|
|
308
|
+
function isObject2(value) {
|
|
309
|
+
return !!value && !Array.isArray(value) && typeof value === "object";
|
|
310
|
+
}
|
|
311
|
+
__name(isObject2, "isObject");
|
|
312
|
+
function transformResultInner(response, runtime) {
|
|
313
|
+
if ("error" in response) {
|
|
314
|
+
const error = runtime.transformer.deserialize(response.error);
|
|
315
|
+
return {
|
|
316
|
+
ok: false,
|
|
317
|
+
error: {
|
|
318
|
+
...response,
|
|
319
|
+
error
|
|
320
|
+
}
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
const result = {
|
|
324
|
+
...response.result,
|
|
325
|
+
...(!response.result.type || response.result.type === "data") && {
|
|
326
|
+
type: "data",
|
|
327
|
+
data: runtime.transformer.deserialize(response.result.data)
|
|
328
|
+
}
|
|
329
|
+
};
|
|
330
|
+
return {
|
|
331
|
+
ok: true,
|
|
332
|
+
result
|
|
333
|
+
};
|
|
334
|
+
}
|
|
335
|
+
__name(transformResultInner, "transformResultInner");
|
|
336
|
+
var TransformResultError = class extends Error {
|
|
337
|
+
constructor() {
|
|
338
|
+
super("Unable to transform response from server");
|
|
339
|
+
}
|
|
340
|
+
};
|
|
341
|
+
__name(TransformResultError, "TransformResultError");
|
|
342
|
+
function transformResult(response, runtime) {
|
|
343
|
+
let result;
|
|
344
|
+
try {
|
|
345
|
+
result = transformResultInner(response, runtime);
|
|
346
|
+
} catch (err) {
|
|
347
|
+
throw new TransformResultError();
|
|
348
|
+
}
|
|
349
|
+
if (!result.ok && (!isObject2(result.error.error) || typeof result.error.error.code !== "number")) {
|
|
350
|
+
throw new TransformResultError();
|
|
351
|
+
}
|
|
352
|
+
if (result.ok && !isObject2(result.result)) {
|
|
353
|
+
throw new TransformResultError();
|
|
354
|
+
}
|
|
355
|
+
return result;
|
|
356
|
+
}
|
|
357
|
+
__name(transformResult, "transformResult");
|
|
358
|
+
|
|
359
|
+
// ../../../node_modules/.pnpm/@trpc+client@10.45.2_@trpc+server@10.45.2/node_modules/@trpc/client/dist/TRPCClientError-38f9a32a.mjs
|
|
360
|
+
function isTRPCClientError(cause) {
|
|
361
|
+
return cause instanceof TRPCClientError || cause instanceof Error && cause.name === "TRPCClientError";
|
|
362
|
+
}
|
|
363
|
+
__name(isTRPCClientError, "isTRPCClientError");
|
|
364
|
+
function isTRPCErrorResponse(obj) {
|
|
365
|
+
return isObject2(obj) && isObject2(obj.error) && typeof obj.error.code === "number" && typeof obj.error.message === "string";
|
|
366
|
+
}
|
|
367
|
+
__name(isTRPCErrorResponse, "isTRPCErrorResponse");
|
|
368
|
+
var TRPCClientError = class extends Error {
|
|
369
|
+
static from(_cause, opts = {}) {
|
|
370
|
+
const cause = _cause;
|
|
371
|
+
if (isTRPCClientError(cause)) {
|
|
372
|
+
if (opts.meta) {
|
|
373
|
+
cause.meta = {
|
|
374
|
+
...cause.meta,
|
|
375
|
+
...opts.meta
|
|
376
|
+
};
|
|
377
|
+
}
|
|
378
|
+
return cause;
|
|
379
|
+
}
|
|
380
|
+
if (isTRPCErrorResponse(cause)) {
|
|
381
|
+
return new TRPCClientError(cause.error.message, {
|
|
382
|
+
...opts,
|
|
383
|
+
result: cause
|
|
384
|
+
});
|
|
385
|
+
}
|
|
386
|
+
if (!(cause instanceof Error)) {
|
|
387
|
+
return new TRPCClientError("Unknown error", {
|
|
388
|
+
...opts,
|
|
389
|
+
cause
|
|
390
|
+
});
|
|
391
|
+
}
|
|
392
|
+
return new TRPCClientError(cause.message, {
|
|
393
|
+
...opts,
|
|
394
|
+
cause: getCauseFromUnknown(cause)
|
|
395
|
+
});
|
|
396
|
+
}
|
|
397
|
+
constructor(message, opts) {
|
|
398
|
+
const cause = opts?.cause;
|
|
399
|
+
super(message, {
|
|
400
|
+
cause
|
|
401
|
+
});
|
|
402
|
+
this.meta = opts?.meta;
|
|
403
|
+
this.cause = cause;
|
|
404
|
+
this.shape = opts?.result?.error;
|
|
405
|
+
this.data = opts?.result?.error.data;
|
|
406
|
+
this.name = "TRPCClientError";
|
|
407
|
+
Object.setPrototypeOf(this, TRPCClientError.prototype);
|
|
408
|
+
}
|
|
409
|
+
};
|
|
410
|
+
__name(TRPCClientError, "TRPCClientError");
|
|
411
|
+
|
|
412
|
+
// ../../../node_modules/.pnpm/@trpc+client@10.45.2_@trpc+server@10.45.2/node_modules/@trpc/client/dist/httpUtils-b9d0cb48.mjs
|
|
413
|
+
var isFunction = /* @__PURE__ */ __name((fn) => typeof fn === "function", "isFunction");
|
|
330
414
|
function getFetch(customFetchImpl) {
|
|
331
415
|
if (customFetchImpl) {
|
|
332
416
|
return customFetchImpl;
|
|
333
417
|
}
|
|
334
418
|
if (typeof window !== "undefined" && isFunction(window.fetch)) {
|
|
335
|
-
return
|
|
419
|
+
return window.fetch;
|
|
336
420
|
}
|
|
337
421
|
if (typeof globalThis !== "undefined" && isFunction(globalThis.fetch)) {
|
|
338
|
-
return
|
|
422
|
+
return globalThis.fetch;
|
|
339
423
|
}
|
|
340
424
|
throw new Error("No fetch implementation found");
|
|
341
425
|
}
|
|
@@ -354,12 +438,10 @@ function getAbortController(customAbortControllerImpl) {
|
|
|
354
438
|
}
|
|
355
439
|
__name(getAbortController, "getAbortController");
|
|
356
440
|
function resolveHTTPLinkOptions(opts) {
|
|
357
|
-
const headers = opts.headers || (() => ({}));
|
|
358
441
|
return {
|
|
359
|
-
url: opts.url,
|
|
360
|
-
fetch:
|
|
361
|
-
AbortController: getAbortController(opts.AbortController)
|
|
362
|
-
headers: typeof headers === "function" ? headers : () => headers
|
|
442
|
+
url: opts.url.toString().replace(/\/$/, ""),
|
|
443
|
+
fetch: opts.fetch,
|
|
444
|
+
AbortController: getAbortController(opts.AbortController)
|
|
363
445
|
};
|
|
364
446
|
}
|
|
365
447
|
__name(resolveHTTPLinkOptions, "resolveHTTPLinkOptions");
|
|
@@ -380,7 +462,7 @@ function getInput(opts) {
|
|
|
380
462
|
return "input" in opts ? opts.runtime.transformer.serialize(opts.input) : arrayToDict(opts.inputs.map((_input) => opts.runtime.transformer.serialize(_input)));
|
|
381
463
|
}
|
|
382
464
|
__name(getInput, "getInput");
|
|
383
|
-
|
|
465
|
+
var getUrl = /* @__PURE__ */ __name((opts) => {
|
|
384
466
|
let url = opts.url + "/" + opts.path;
|
|
385
467
|
const queryParts = [];
|
|
386
468
|
if ("inputs" in opts) {
|
|
@@ -396,48 +478,73 @@ function getUrl(opts) {
|
|
|
396
478
|
url += "?" + queryParts.join("&");
|
|
397
479
|
}
|
|
398
480
|
return url;
|
|
399
|
-
}
|
|
400
|
-
__name(
|
|
401
|
-
function getBody(opts) {
|
|
481
|
+
}, "getUrl");
|
|
482
|
+
var getBody = /* @__PURE__ */ __name((opts) => {
|
|
402
483
|
if (opts.type === "query") {
|
|
403
484
|
return void 0;
|
|
404
485
|
}
|
|
405
486
|
const input = getInput(opts);
|
|
406
487
|
return input !== void 0 ? JSON.stringify(input) : void 0;
|
|
488
|
+
}, "getBody");
|
|
489
|
+
var jsonHttpRequester = /* @__PURE__ */ __name((opts) => {
|
|
490
|
+
return httpRequest({
|
|
491
|
+
...opts,
|
|
492
|
+
contentTypeHeader: "application/json",
|
|
493
|
+
getUrl,
|
|
494
|
+
getBody
|
|
495
|
+
});
|
|
496
|
+
}, "jsonHttpRequester");
|
|
497
|
+
async function fetchHTTPResponse(opts, ac) {
|
|
498
|
+
const url = opts.getUrl(opts);
|
|
499
|
+
const body = opts.getBody(opts);
|
|
500
|
+
const { type } = opts;
|
|
501
|
+
const resolvedHeaders = await opts.headers();
|
|
502
|
+
if (type === "subscription") {
|
|
503
|
+
throw new Error("Subscriptions should use wsLink");
|
|
504
|
+
}
|
|
505
|
+
const headers = {
|
|
506
|
+
...opts.contentTypeHeader ? {
|
|
507
|
+
"content-type": opts.contentTypeHeader
|
|
508
|
+
} : {},
|
|
509
|
+
...opts.batchModeHeader ? {
|
|
510
|
+
"trpc-batch-mode": opts.batchModeHeader
|
|
511
|
+
} : {},
|
|
512
|
+
...resolvedHeaders
|
|
513
|
+
};
|
|
514
|
+
return getFetch(opts.fetch)(url, {
|
|
515
|
+
method: METHOD[type],
|
|
516
|
+
signal: ac?.signal,
|
|
517
|
+
body,
|
|
518
|
+
headers
|
|
519
|
+
});
|
|
407
520
|
}
|
|
408
|
-
__name(
|
|
521
|
+
__name(fetchHTTPResponse, "fetchHTTPResponse");
|
|
409
522
|
function httpRequest(opts) {
|
|
410
|
-
const { type } = opts;
|
|
411
523
|
const ac = opts.AbortController ? new opts.AbortController() : null;
|
|
524
|
+
const meta = {};
|
|
525
|
+
let done = false;
|
|
412
526
|
const promise = new Promise((resolve, reject) => {
|
|
413
|
-
|
|
414
|
-
const body = getBody(opts);
|
|
415
|
-
const meta = {};
|
|
416
|
-
Promise.resolve(opts.headers()).then((headers) => {
|
|
417
|
-
if (type === "subscription") {
|
|
418
|
-
throw new Error("Subscriptions should use wsLink");
|
|
419
|
-
}
|
|
420
|
-
return opts.fetch(url, {
|
|
421
|
-
method: METHOD[type],
|
|
422
|
-
signal: ac?.signal,
|
|
423
|
-
body,
|
|
424
|
-
headers: {
|
|
425
|
-
"content-type": "application/json",
|
|
426
|
-
...headers
|
|
427
|
-
}
|
|
428
|
-
});
|
|
429
|
-
}).then((_res) => {
|
|
527
|
+
fetchHTTPResponse(opts, ac).then((_res) => {
|
|
430
528
|
meta.response = _res;
|
|
529
|
+
done = true;
|
|
431
530
|
return _res.json();
|
|
432
531
|
}).then((json) => {
|
|
532
|
+
meta.responseJSON = json;
|
|
433
533
|
resolve({
|
|
434
534
|
json,
|
|
435
535
|
meta
|
|
436
536
|
});
|
|
437
|
-
}).catch(
|
|
537
|
+
}).catch((err) => {
|
|
538
|
+
done = true;
|
|
539
|
+
reject(TRPCClientError.from(err, {
|
|
540
|
+
meta
|
|
541
|
+
}));
|
|
542
|
+
});
|
|
438
543
|
});
|
|
439
544
|
const cancel = /* @__PURE__ */ __name(() => {
|
|
440
|
-
|
|
545
|
+
if (!done) {
|
|
546
|
+
ac?.abort();
|
|
547
|
+
}
|
|
441
548
|
}, "cancel");
|
|
442
549
|
return {
|
|
443
550
|
promise,
|
|
@@ -446,7 +553,7 @@ function httpRequest(opts) {
|
|
|
446
553
|
}
|
|
447
554
|
__name(httpRequest, "httpRequest");
|
|
448
555
|
|
|
449
|
-
// ../../../node_modules/.pnpm/@trpc+client@10.
|
|
556
|
+
// ../../../node_modules/.pnpm/@trpc+client@10.45.2_@trpc+server@10.45.2/node_modules/@trpc/client/dist/httpBatchLink-d0f9eac9.mjs
|
|
450
557
|
var throwFatalError = /* @__PURE__ */ __name(() => {
|
|
451
558
|
throw new Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new");
|
|
452
559
|
}, "throwFatalError");
|
|
@@ -470,7 +577,7 @@ function dataLoader(batchLoader) {
|
|
|
470
577
|
}
|
|
471
578
|
const lastGroup = groupedItems[groupedItems.length - 1];
|
|
472
579
|
if (item.aborted) {
|
|
473
|
-
item.reject(new Error("Aborted"));
|
|
580
|
+
item.reject?.(new Error("Aborted"));
|
|
474
581
|
index++;
|
|
475
582
|
continue;
|
|
476
583
|
}
|
|
@@ -481,7 +588,7 @@ function dataLoader(batchLoader) {
|
|
|
481
588
|
continue;
|
|
482
589
|
}
|
|
483
590
|
if (lastGroup.length === 0) {
|
|
484
|
-
item.reject(new Error("Input is too big for a single dispatch"));
|
|
591
|
+
item.reject?.(new Error("Input is too big for a single dispatch"));
|
|
485
592
|
index++;
|
|
486
593
|
continue;
|
|
487
594
|
}
|
|
@@ -504,18 +611,27 @@ function dataLoader(batchLoader) {
|
|
|
504
611
|
for (const item of items) {
|
|
505
612
|
item.batch = batch;
|
|
506
613
|
}
|
|
507
|
-
const
|
|
614
|
+
const unitResolver = /* @__PURE__ */ __name((index, value) => {
|
|
615
|
+
const item = batch.items[index];
|
|
616
|
+
item.resolve?.(value);
|
|
617
|
+
item.batch = null;
|
|
618
|
+
item.reject = null;
|
|
619
|
+
item.resolve = null;
|
|
620
|
+
}, "unitResolver");
|
|
621
|
+
const { promise, cancel } = batchLoader.fetch(batch.items.map((_item) => _item.key), unitResolver);
|
|
508
622
|
batch.cancel = cancel;
|
|
509
623
|
promise.then((result) => {
|
|
510
624
|
for (let i = 0; i < result.length; i++) {
|
|
511
625
|
const value = result[i];
|
|
512
|
-
|
|
513
|
-
|
|
626
|
+
unitResolver(i, value);
|
|
627
|
+
}
|
|
628
|
+
for (const item of batch.items) {
|
|
629
|
+
item.reject?.(new Error("Missing result"));
|
|
514
630
|
item.batch = null;
|
|
515
631
|
}
|
|
516
632
|
}).catch((cause) => {
|
|
517
633
|
for (const item of batch.items) {
|
|
518
|
-
item.reject(cause);
|
|
634
|
+
item.reject?.(cause);
|
|
519
635
|
item.batch = null;
|
|
520
636
|
}
|
|
521
637
|
});
|
|
@@ -559,89 +675,170 @@ function dataLoader(batchLoader) {
|
|
|
559
675
|
};
|
|
560
676
|
}
|
|
561
677
|
__name(dataLoader, "dataLoader");
|
|
562
|
-
function
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
const maxURLLength = opts.maxURLLength
|
|
566
|
-
|
|
567
|
-
const
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
const
|
|
584
|
-
const inputs = batchOps.map((op) => op.input);
|
|
585
|
-
const { promise, cancel } = httpRequest({
|
|
678
|
+
function createHTTPBatchLink(requester) {
|
|
679
|
+
return /* @__PURE__ */ __name(function httpBatchLink2(opts) {
|
|
680
|
+
const resolvedOpts = resolveHTTPLinkOptions(opts);
|
|
681
|
+
const maxURLLength = opts.maxURLLength ?? Infinity;
|
|
682
|
+
return (runtime) => {
|
|
683
|
+
const batchLoader = /* @__PURE__ */ __name((type) => {
|
|
684
|
+
const validate = /* @__PURE__ */ __name((batchOps) => {
|
|
685
|
+
if (maxURLLength === Infinity) {
|
|
686
|
+
return true;
|
|
687
|
+
}
|
|
688
|
+
const path = batchOps.map((op) => op.path).join(",");
|
|
689
|
+
const inputs = batchOps.map((op) => op.input);
|
|
690
|
+
const url = getUrl({
|
|
691
|
+
...resolvedOpts,
|
|
692
|
+
runtime,
|
|
693
|
+
type,
|
|
694
|
+
path,
|
|
695
|
+
inputs
|
|
696
|
+
});
|
|
697
|
+
return url.length <= maxURLLength;
|
|
698
|
+
}, "validate");
|
|
699
|
+
const fetch2 = requester({
|
|
586
700
|
...resolvedOpts,
|
|
587
701
|
runtime,
|
|
588
702
|
type,
|
|
589
|
-
|
|
590
|
-
inputs
|
|
703
|
+
opts
|
|
591
704
|
});
|
|
592
705
|
return {
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
const result = resJSON.map((item) => ({
|
|
596
|
-
meta: res.meta,
|
|
597
|
-
json: item
|
|
598
|
-
}));
|
|
599
|
-
return result;
|
|
600
|
-
}),
|
|
601
|
-
cancel
|
|
706
|
+
validate,
|
|
707
|
+
fetch: fetch2
|
|
602
708
|
};
|
|
603
|
-
}, "
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
709
|
+
}, "batchLoader");
|
|
710
|
+
const query = dataLoader(batchLoader("query"));
|
|
711
|
+
const mutation = dataLoader(batchLoader("mutation"));
|
|
712
|
+
const subscription = dataLoader(batchLoader("subscription"));
|
|
713
|
+
const loaders = {
|
|
714
|
+
query,
|
|
715
|
+
subscription,
|
|
716
|
+
mutation
|
|
607
717
|
};
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
718
|
+
return ({ op }) => {
|
|
719
|
+
return observable((observer) => {
|
|
720
|
+
const loader = loaders[op.type];
|
|
721
|
+
const { promise, cancel } = loader.load(op);
|
|
722
|
+
let _res = void 0;
|
|
723
|
+
promise.then((res) => {
|
|
724
|
+
_res = res;
|
|
725
|
+
const transformed = transformResult(res.json, runtime);
|
|
726
|
+
if (!transformed.ok) {
|
|
727
|
+
observer.error(TRPCClientError.from(transformed.error, {
|
|
728
|
+
meta: res.meta
|
|
729
|
+
}));
|
|
730
|
+
return;
|
|
731
|
+
}
|
|
732
|
+
observer.next({
|
|
733
|
+
context: res.meta,
|
|
734
|
+
result: transformed.result
|
|
735
|
+
});
|
|
736
|
+
observer.complete();
|
|
737
|
+
}).catch((err) => {
|
|
738
|
+
observer.error(TRPCClientError.from(err, {
|
|
739
|
+
meta: _res?.meta
|
|
626
740
|
}));
|
|
627
|
-
return;
|
|
628
|
-
}
|
|
629
|
-
observer.next({
|
|
630
|
-
context: res.meta,
|
|
631
|
-
result: transformed.result
|
|
632
741
|
});
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
});
|
|
742
|
+
return () => {
|
|
743
|
+
cancel();
|
|
744
|
+
};
|
|
745
|
+
});
|
|
746
|
+
};
|
|
639
747
|
};
|
|
748
|
+
}, "httpBatchLink");
|
|
749
|
+
}
|
|
750
|
+
__name(createHTTPBatchLink, "createHTTPBatchLink");
|
|
751
|
+
var batchRequester = /* @__PURE__ */ __name((requesterOpts) => {
|
|
752
|
+
return (batchOps) => {
|
|
753
|
+
const path = batchOps.map((op) => op.path).join(",");
|
|
754
|
+
const inputs = batchOps.map((op) => op.input);
|
|
755
|
+
const { promise, cancel } = jsonHttpRequester({
|
|
756
|
+
...requesterOpts,
|
|
757
|
+
path,
|
|
758
|
+
inputs,
|
|
759
|
+
headers() {
|
|
760
|
+
if (!requesterOpts.opts.headers) {
|
|
761
|
+
return {};
|
|
762
|
+
}
|
|
763
|
+
if (typeof requesterOpts.opts.headers === "function") {
|
|
764
|
+
return requesterOpts.opts.headers({
|
|
765
|
+
opList: batchOps
|
|
766
|
+
});
|
|
767
|
+
}
|
|
768
|
+
return requesterOpts.opts.headers;
|
|
769
|
+
}
|
|
770
|
+
});
|
|
771
|
+
return {
|
|
772
|
+
promise: promise.then((res) => {
|
|
773
|
+
const resJSON = Array.isArray(res.json) ? res.json : batchOps.map(() => res.json);
|
|
774
|
+
const result = resJSON.map((item) => ({
|
|
775
|
+
meta: res.meta,
|
|
776
|
+
json: item
|
|
777
|
+
}));
|
|
778
|
+
return result;
|
|
779
|
+
}),
|
|
780
|
+
cancel
|
|
781
|
+
};
|
|
782
|
+
};
|
|
783
|
+
}, "batchRequester");
|
|
784
|
+
var httpBatchLink = createHTTPBatchLink(batchRequester);
|
|
785
|
+
|
|
786
|
+
// ../../../node_modules/.pnpm/@trpc+client@10.45.2_@trpc+server@10.45.2/node_modules/@trpc/client/dist/links/httpLink.mjs
|
|
787
|
+
function httpLinkFactory(factoryOpts) {
|
|
788
|
+
return (opts) => {
|
|
789
|
+
const resolvedOpts = resolveHTTPLinkOptions(opts);
|
|
790
|
+
return (runtime) => ({ op }) => observable((observer) => {
|
|
791
|
+
const { path, input, type } = op;
|
|
792
|
+
const { promise, cancel } = factoryOpts.requester({
|
|
793
|
+
...resolvedOpts,
|
|
794
|
+
runtime,
|
|
795
|
+
type,
|
|
796
|
+
path,
|
|
797
|
+
input,
|
|
798
|
+
headers() {
|
|
799
|
+
if (!opts.headers) {
|
|
800
|
+
return {};
|
|
801
|
+
}
|
|
802
|
+
if (typeof opts.headers === "function") {
|
|
803
|
+
return opts.headers({
|
|
804
|
+
op
|
|
805
|
+
});
|
|
806
|
+
}
|
|
807
|
+
return opts.headers;
|
|
808
|
+
}
|
|
809
|
+
});
|
|
810
|
+
let meta = void 0;
|
|
811
|
+
promise.then((res) => {
|
|
812
|
+
meta = res.meta;
|
|
813
|
+
const transformed = transformResult(res.json, runtime);
|
|
814
|
+
if (!transformed.ok) {
|
|
815
|
+
observer.error(TRPCClientError.from(transformed.error, {
|
|
816
|
+
meta
|
|
817
|
+
}));
|
|
818
|
+
return;
|
|
819
|
+
}
|
|
820
|
+
observer.next({
|
|
821
|
+
context: res.meta,
|
|
822
|
+
result: transformed.result
|
|
823
|
+
});
|
|
824
|
+
observer.complete();
|
|
825
|
+
}).catch((cause) => {
|
|
826
|
+
observer.error(TRPCClientError.from(cause, {
|
|
827
|
+
meta
|
|
828
|
+
}));
|
|
829
|
+
});
|
|
830
|
+
return () => {
|
|
831
|
+
cancel();
|
|
832
|
+
};
|
|
833
|
+
});
|
|
640
834
|
};
|
|
641
835
|
}
|
|
642
|
-
__name(
|
|
836
|
+
__name(httpLinkFactory, "httpLinkFactory");
|
|
837
|
+
var httpLink = httpLinkFactory({
|
|
838
|
+
requester: jsonHttpRequester
|
|
839
|
+
});
|
|
643
840
|
|
|
644
|
-
// ../../../node_modules/.pnpm/@trpc+client@10.
|
|
841
|
+
// ../../../node_modules/.pnpm/@trpc+client@10.45.2_@trpc+server@10.45.2/node_modules/@trpc/client/dist/index.mjs
|
|
645
842
|
var TRPCUntypedClient = class {
|
|
646
843
|
$request({ type, input, path, context = {} }) {
|
|
647
844
|
const chain$ = createChain({
|
|
@@ -714,23 +911,34 @@ var TRPCUntypedClient = class {
|
|
|
714
911
|
}
|
|
715
912
|
constructor(opts) {
|
|
716
913
|
this.requestId = 0;
|
|
717
|
-
|
|
914
|
+
const combinedTransformer = (() => {
|
|
718
915
|
const transformer = opts.transformer;
|
|
719
|
-
if (!transformer)
|
|
720
|
-
return {
|
|
721
|
-
serialize: (data) => data,
|
|
722
|
-
deserialize: (data) => data
|
|
723
|
-
};
|
|
724
|
-
if ("input" in transformer)
|
|
916
|
+
if (!transformer) {
|
|
725
917
|
return {
|
|
726
|
-
|
|
727
|
-
|
|
918
|
+
input: {
|
|
919
|
+
serialize: (data) => data,
|
|
920
|
+
deserialize: (data) => data
|
|
921
|
+
},
|
|
922
|
+
output: {
|
|
923
|
+
serialize: (data) => data,
|
|
924
|
+
deserialize: (data) => data
|
|
925
|
+
}
|
|
728
926
|
};
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
927
|
+
}
|
|
928
|
+
if ("input" in transformer) {
|
|
929
|
+
return opts.transformer;
|
|
930
|
+
}
|
|
931
|
+
return {
|
|
932
|
+
input: transformer,
|
|
933
|
+
output: transformer
|
|
934
|
+
};
|
|
935
|
+
})();
|
|
732
936
|
this.runtime = {
|
|
733
|
-
transformer:
|
|
937
|
+
transformer: {
|
|
938
|
+
serialize: (data) => combinedTransformer.input.serialize(data),
|
|
939
|
+
deserialize: (data) => combinedTransformer.output.deserialize(data)
|
|
940
|
+
},
|
|
941
|
+
combinedTransformer
|
|
734
942
|
};
|
|
735
943
|
this.links = opts.links.map((link) => link(this.runtime));
|
|
736
944
|
}
|
|
@@ -741,18 +949,23 @@ var clientCallTypeMap = {
|
|
|
741
949
|
mutate: "mutation",
|
|
742
950
|
subscribe: "subscription"
|
|
743
951
|
};
|
|
952
|
+
var clientCallTypeToProcedureType = /* @__PURE__ */ __name((clientCallType) => {
|
|
953
|
+
return clientCallTypeMap[clientCallType];
|
|
954
|
+
}, "clientCallTypeToProcedureType");
|
|
744
955
|
function createTRPCClientProxy(client) {
|
|
745
956
|
return createFlatProxy((key) => {
|
|
746
957
|
if (client.hasOwnProperty(key)) {
|
|
747
958
|
return client[key];
|
|
748
959
|
}
|
|
960
|
+
if (key === "__untypedClient") {
|
|
961
|
+
return client;
|
|
962
|
+
}
|
|
749
963
|
return createRecursiveProxy(({ path, args }) => {
|
|
750
964
|
const pathCopy = [
|
|
751
965
|
key,
|
|
752
966
|
...path
|
|
753
967
|
];
|
|
754
|
-
const
|
|
755
|
-
const procedureType = clientCallTypeMap[clientCallType];
|
|
968
|
+
const procedureType = clientCallTypeToProcedureType(pathCopy.pop());
|
|
756
969
|
const fullPath = pathCopy.join(".");
|
|
757
970
|
return client[procedureType](fullPath, ...args);
|
|
758
971
|
});
|
|
@@ -765,6 +978,161 @@ function createTRPCProxyClient(opts) {
|
|
|
765
978
|
return proxy;
|
|
766
979
|
}
|
|
767
980
|
__name(createTRPCProxyClient, "createTRPCProxyClient");
|
|
981
|
+
function getTextDecoder(customTextDecoder) {
|
|
982
|
+
if (customTextDecoder) {
|
|
983
|
+
return customTextDecoder;
|
|
984
|
+
}
|
|
985
|
+
if (typeof window !== "undefined" && window.TextDecoder) {
|
|
986
|
+
return new window.TextDecoder();
|
|
987
|
+
}
|
|
988
|
+
if (typeof globalThis !== "undefined" && globalThis.TextDecoder) {
|
|
989
|
+
return new globalThis.TextDecoder();
|
|
990
|
+
}
|
|
991
|
+
throw new Error("No TextDecoder implementation found");
|
|
992
|
+
}
|
|
993
|
+
__name(getTextDecoder, "getTextDecoder");
|
|
994
|
+
async function parseJSONStream(opts) {
|
|
995
|
+
const parse = opts.parse ?? JSON.parse;
|
|
996
|
+
const onLine = /* @__PURE__ */ __name((line) => {
|
|
997
|
+
if (opts.signal?.aborted)
|
|
998
|
+
return;
|
|
999
|
+
if (!line || line === "}") {
|
|
1000
|
+
return;
|
|
1001
|
+
}
|
|
1002
|
+
const indexOfColon = line.indexOf(":");
|
|
1003
|
+
const indexAsStr = line.substring(2, indexOfColon - 1);
|
|
1004
|
+
const text = line.substring(indexOfColon + 1);
|
|
1005
|
+
opts.onSingle(Number(indexAsStr), parse(text));
|
|
1006
|
+
}, "onLine");
|
|
1007
|
+
await readLines(opts.readableStream, onLine, opts.textDecoder);
|
|
1008
|
+
}
|
|
1009
|
+
__name(parseJSONStream, "parseJSONStream");
|
|
1010
|
+
async function readLines(readableStream, onLine, textDecoder) {
|
|
1011
|
+
let partOfLine = "";
|
|
1012
|
+
const onChunk = /* @__PURE__ */ __name((chunk) => {
|
|
1013
|
+
const chunkText = textDecoder.decode(chunk);
|
|
1014
|
+
const chunkLines = chunkText.split("\n");
|
|
1015
|
+
if (chunkLines.length === 1) {
|
|
1016
|
+
partOfLine += chunkLines[0];
|
|
1017
|
+
} else if (chunkLines.length > 1) {
|
|
1018
|
+
onLine(partOfLine + chunkLines[0]);
|
|
1019
|
+
for (let i = 1; i < chunkLines.length - 1; i++) {
|
|
1020
|
+
onLine(chunkLines[i]);
|
|
1021
|
+
}
|
|
1022
|
+
partOfLine = chunkLines[chunkLines.length - 1];
|
|
1023
|
+
}
|
|
1024
|
+
}, "onChunk");
|
|
1025
|
+
if ("getReader" in readableStream) {
|
|
1026
|
+
await readStandardChunks(readableStream, onChunk);
|
|
1027
|
+
} else {
|
|
1028
|
+
await readNodeChunks(readableStream, onChunk);
|
|
1029
|
+
}
|
|
1030
|
+
onLine(partOfLine);
|
|
1031
|
+
}
|
|
1032
|
+
__name(readLines, "readLines");
|
|
1033
|
+
function readNodeChunks(stream, onChunk) {
|
|
1034
|
+
return new Promise((resolve) => {
|
|
1035
|
+
stream.on("data", onChunk);
|
|
1036
|
+
stream.on("end", resolve);
|
|
1037
|
+
});
|
|
1038
|
+
}
|
|
1039
|
+
__name(readNodeChunks, "readNodeChunks");
|
|
1040
|
+
async function readStandardChunks(stream, onChunk) {
|
|
1041
|
+
const reader = stream.getReader();
|
|
1042
|
+
let readResult = await reader.read();
|
|
1043
|
+
while (!readResult.done) {
|
|
1044
|
+
onChunk(readResult.value);
|
|
1045
|
+
readResult = await reader.read();
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1048
|
+
__name(readStandardChunks, "readStandardChunks");
|
|
1049
|
+
var streamingJsonHttpRequester = /* @__PURE__ */ __name((opts, onSingle) => {
|
|
1050
|
+
const ac = opts.AbortController ? new opts.AbortController() : null;
|
|
1051
|
+
const responsePromise = fetchHTTPResponse({
|
|
1052
|
+
...opts,
|
|
1053
|
+
contentTypeHeader: "application/json",
|
|
1054
|
+
batchModeHeader: "stream",
|
|
1055
|
+
getUrl,
|
|
1056
|
+
getBody
|
|
1057
|
+
}, ac);
|
|
1058
|
+
const cancel = /* @__PURE__ */ __name(() => ac?.abort(), "cancel");
|
|
1059
|
+
const promise = responsePromise.then(async (res) => {
|
|
1060
|
+
if (!res.body)
|
|
1061
|
+
throw new Error("Received response without body");
|
|
1062
|
+
const meta = {
|
|
1063
|
+
response: res
|
|
1064
|
+
};
|
|
1065
|
+
return parseJSONStream({
|
|
1066
|
+
readableStream: res.body,
|
|
1067
|
+
onSingle,
|
|
1068
|
+
parse: (string) => ({
|
|
1069
|
+
json: JSON.parse(string),
|
|
1070
|
+
meta
|
|
1071
|
+
}),
|
|
1072
|
+
signal: ac?.signal,
|
|
1073
|
+
textDecoder: opts.textDecoder
|
|
1074
|
+
});
|
|
1075
|
+
});
|
|
1076
|
+
return {
|
|
1077
|
+
cancel,
|
|
1078
|
+
promise
|
|
1079
|
+
};
|
|
1080
|
+
}, "streamingJsonHttpRequester");
|
|
1081
|
+
var streamRequester = /* @__PURE__ */ __name((requesterOpts) => {
|
|
1082
|
+
const textDecoder = getTextDecoder(requesterOpts.opts.textDecoder);
|
|
1083
|
+
return (batchOps, unitResolver) => {
|
|
1084
|
+
const path = batchOps.map((op) => op.path).join(",");
|
|
1085
|
+
const inputs = batchOps.map((op) => op.input);
|
|
1086
|
+
const { cancel, promise } = streamingJsonHttpRequester({
|
|
1087
|
+
...requesterOpts,
|
|
1088
|
+
textDecoder,
|
|
1089
|
+
path,
|
|
1090
|
+
inputs,
|
|
1091
|
+
headers() {
|
|
1092
|
+
if (!requesterOpts.opts.headers) {
|
|
1093
|
+
return {};
|
|
1094
|
+
}
|
|
1095
|
+
if (typeof requesterOpts.opts.headers === "function") {
|
|
1096
|
+
return requesterOpts.opts.headers({
|
|
1097
|
+
opList: batchOps
|
|
1098
|
+
});
|
|
1099
|
+
}
|
|
1100
|
+
return requesterOpts.opts.headers;
|
|
1101
|
+
}
|
|
1102
|
+
}, (index, res) => {
|
|
1103
|
+
unitResolver(index, res);
|
|
1104
|
+
});
|
|
1105
|
+
return {
|
|
1106
|
+
promise: promise.then(() => []),
|
|
1107
|
+
cancel
|
|
1108
|
+
};
|
|
1109
|
+
};
|
|
1110
|
+
}, "streamRequester");
|
|
1111
|
+
var unstable_httpBatchStreamLink = createHTTPBatchLink(streamRequester);
|
|
1112
|
+
var getBody2 = /* @__PURE__ */ __name((opts) => {
|
|
1113
|
+
if (!("input" in opts)) {
|
|
1114
|
+
return void 0;
|
|
1115
|
+
}
|
|
1116
|
+
if (!(opts.input instanceof FormData)) {
|
|
1117
|
+
throw new Error("Input is not FormData");
|
|
1118
|
+
}
|
|
1119
|
+
return opts.input;
|
|
1120
|
+
}, "getBody");
|
|
1121
|
+
var formDataRequester = /* @__PURE__ */ __name((opts) => {
|
|
1122
|
+
if (opts.type !== "mutation") {
|
|
1123
|
+
throw new Error("We only handle mutations with formdata");
|
|
1124
|
+
}
|
|
1125
|
+
return httpRequest({
|
|
1126
|
+
...opts,
|
|
1127
|
+
getUrl() {
|
|
1128
|
+
return `${opts.url}/${opts.path}`;
|
|
1129
|
+
},
|
|
1130
|
+
getBody: getBody2
|
|
1131
|
+
});
|
|
1132
|
+
}, "formDataRequester");
|
|
1133
|
+
var experimental_formDataLink = httpLinkFactory({
|
|
1134
|
+
requester: formDataRequester
|
|
1135
|
+
});
|
|
768
1136
|
|
|
769
1137
|
// ../../learn-card-network/brain-client/dist/brain-client.esm.js
|
|
770
1138
|
var __defProp2 = Object.defineProperty;
|
|
@@ -807,7 +1175,11 @@ var getClient = /* @__PURE__ */ __name2(async (url, didAuthFunction) => {
|
|
|
807
1175
|
let challenges = [];
|
|
808
1176
|
const challengeRequester = createTRPCProxyClient({
|
|
809
1177
|
links: [
|
|
810
|
-
httpBatchLink({
|
|
1178
|
+
httpBatchLink({
|
|
1179
|
+
url,
|
|
1180
|
+
maxURLLength: 2048,
|
|
1181
|
+
headers: { Authorization: `Bearer ${await didAuthFunction()}` }
|
|
1182
|
+
})
|
|
811
1183
|
]
|
|
812
1184
|
});
|
|
813
1185
|
const getChallenges = /* @__PURE__ */ __name2(async (amount = 95 + Math.round((Math.random() - 0.5) * 5)) => {
|
|
@@ -820,6 +1192,7 @@ var getClient = /* @__PURE__ */ __name2(async (url, didAuthFunction) => {
|
|
|
820
1192
|
challenges = await getChallenges();
|
|
821
1193
|
}),
|
|
822
1194
|
httpBatchLink({
|
|
1195
|
+
maxURLLength: 2048,
|
|
823
1196
|
url,
|
|
824
1197
|
headers: async () => {
|
|
825
1198
|
if (challenges.length === 0)
|
|
@@ -4584,11 +4957,17 @@ var BoostValidator = mod.object({
|
|
|
4584
4957
|
status: LCNBoostStatus.optional(),
|
|
4585
4958
|
autoConnectRecipients: mod.boolean().optional()
|
|
4586
4959
|
});
|
|
4960
|
+
var PaginatedBoostsValidator = PaginationResponseValidator.extend({
|
|
4961
|
+
records: BoostValidator.array()
|
|
4962
|
+
});
|
|
4587
4963
|
var BoostRecipientValidator = mod.object({
|
|
4588
4964
|
to: LCNProfileValidator,
|
|
4589
4965
|
from: mod.string(),
|
|
4590
4966
|
received: mod.string().optional()
|
|
4591
4967
|
});
|
|
4968
|
+
var PaginatedBoostRecipientsValidator = PaginationResponseValidator.extend({
|
|
4969
|
+
records: BoostRecipientValidator.array()
|
|
4970
|
+
});
|
|
4592
4971
|
var LCNBoostClaimLinkSigningAuthorityValidator = mod.object({
|
|
4593
4972
|
endpoint: mod.string(),
|
|
4594
4973
|
name: mod.string(),
|
|
@@ -4921,21 +5300,39 @@ var getLearnCardNetworkPlugin = /* @__PURE__ */ __name(async (learnCard, url) =>
|
|
|
4921
5300
|
throw new Error("Please make an account first!");
|
|
4922
5301
|
return client.profile.acceptConnectionRequest.mutate({ profileId });
|
|
4923
5302
|
},
|
|
4924
|
-
getConnections: async () => {
|
|
5303
|
+
getConnections: async (_learnCard) => {
|
|
5304
|
+
console.warn("The getConnections method is deprecated! Please use getPaginatedConnections instead!");
|
|
4925
5305
|
if (!userData)
|
|
4926
5306
|
throw new Error("Please make an account first!");
|
|
4927
5307
|
return client.profile.connections.query();
|
|
4928
5308
|
},
|
|
4929
|
-
|
|
5309
|
+
getPaginatedConnections: async (_learnCard, options) => {
|
|
5310
|
+
if (!userData)
|
|
5311
|
+
throw new Error("Please make an account first!");
|
|
5312
|
+
return client.profile.paginatedConnections.query(options);
|
|
5313
|
+
},
|
|
5314
|
+
getPendingConnections: async (_learnCard) => {
|
|
5315
|
+
console.warn("The getPendingConnections method is deprecated! Please use getPaginatedPendingConnections instead!");
|
|
4930
5316
|
if (!userData)
|
|
4931
5317
|
throw new Error("Please make an account first!");
|
|
4932
5318
|
return client.profile.pendingConnections.query();
|
|
4933
5319
|
},
|
|
4934
|
-
|
|
5320
|
+
getPaginatedPendingConnections: async (_learnCard, options) => {
|
|
5321
|
+
if (!userData)
|
|
5322
|
+
throw new Error("Please make an account first!");
|
|
5323
|
+
return client.profile.paginatedPendingConnections.query(options);
|
|
5324
|
+
},
|
|
5325
|
+
getConnectionRequests: async (_learnCard) => {
|
|
5326
|
+
console.warn("The getConnectionRequests method is deprecated! Please use getPaginatedConnectionRequests instead!");
|
|
4935
5327
|
if (!userData)
|
|
4936
5328
|
throw new Error("Please make an account first!");
|
|
4937
5329
|
return client.profile.connectionRequests.query();
|
|
4938
5330
|
},
|
|
5331
|
+
getPaginatedConnectionRequests: async (_learnCard, options) => {
|
|
5332
|
+
if (!userData)
|
|
5333
|
+
throw new Error("Please make an account first!");
|
|
5334
|
+
return client.profile.paginatedConnectionRequests.query(options);
|
|
5335
|
+
},
|
|
4939
5336
|
generateInvite: async (_learnCard, challenge, expiration) => {
|
|
4940
5337
|
if (!userData)
|
|
4941
5338
|
throw new Error("Please make an account first!");
|
|
@@ -5043,12 +5440,19 @@ var getLearnCardNetworkPlugin = /* @__PURE__ */ __name(async (learnCard, url) =>
|
|
|
5043
5440
|
throw new Error("Please make an account first!");
|
|
5044
5441
|
return client.boost.getBoost.query({ uri });
|
|
5045
5442
|
},
|
|
5046
|
-
getBoosts: async () => {
|
|
5443
|
+
getBoosts: async (_learnCard) => {
|
|
5444
|
+
console.warn("The getBoosts method is deprecated! Please use getPaginatedBoosts instead!");
|
|
5047
5445
|
if (!userData)
|
|
5048
5446
|
throw new Error("Please make an account first!");
|
|
5049
5447
|
return client.boost.getBoosts.query();
|
|
5050
5448
|
},
|
|
5449
|
+
getPaginatedBoosts: async (_learnCard, options) => {
|
|
5450
|
+
if (!userData)
|
|
5451
|
+
throw new Error("Please make an account first!");
|
|
5452
|
+
return client.boost.getPaginatedBoosts.query(options);
|
|
5453
|
+
},
|
|
5051
5454
|
getBoostRecipients: async (_learnCard, uri, limit = 25, skip = void 0, includeUnacceptedBoosts = true) => {
|
|
5455
|
+
console.warn("The getBoostRecipients method is deprecated! Please use getPaginatedBoostRecipients instead!");
|
|
5052
5456
|
if (!userData)
|
|
5053
5457
|
throw new Error("Please make an account first!");
|
|
5054
5458
|
return client.boost.getBoostRecipients.query({
|
|
@@ -5058,6 +5462,16 @@ var getLearnCardNetworkPlugin = /* @__PURE__ */ __name(async (learnCard, url) =>
|
|
|
5058
5462
|
includeUnacceptedBoosts
|
|
5059
5463
|
});
|
|
5060
5464
|
},
|
|
5465
|
+
getPaginatedBoostRecipients: async (_learnCard, uri, limit = 25, cursor = void 0, includeUnacceptedBoosts = true) => {
|
|
5466
|
+
if (!userData)
|
|
5467
|
+
throw new Error("Please make an account first!");
|
|
5468
|
+
return client.boost.getPaginatedBoostRecipients.query({
|
|
5469
|
+
uri,
|
|
5470
|
+
limit,
|
|
5471
|
+
cursor,
|
|
5472
|
+
includeUnacceptedBoosts
|
|
5473
|
+
});
|
|
5474
|
+
},
|
|
5061
5475
|
countBoostRecipients: async (_learnCard, uri, includeUnacceptedBoosts = true) => {
|
|
5062
5476
|
if (!userData)
|
|
5063
5477
|
throw new Error("Please make an account first!");
|