@learncard/network-brain-client 2.5.49 → 2.5.50
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/brain-client.esm.js +696 -522
- package/dist/brain-client.esm.js.map +4 -4
- package/package.json +5 -5
package/dist/brain-client.esm.js
CHANGED
|
@@ -34331,6 +34331,108 @@ var RegExpTransformer = {
|
|
|
34331
34331
|
}
|
|
34332
34332
|
};
|
|
34333
34333
|
|
|
34334
|
+
// ../../../node_modules/@trpc/client/dist/objectSpread2-BvkFp-_Y.mjs
|
|
34335
|
+
var __create2 = Object.create;
|
|
34336
|
+
var __defProp3 = Object.defineProperty;
|
|
34337
|
+
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
34338
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
34339
|
+
var __getProtoOf2 = Object.getPrototypeOf;
|
|
34340
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
34341
|
+
var __commonJS2 = /* @__PURE__ */ __name((cb, mod) => function() {
|
|
34342
|
+
return mod || (0, cb[__getOwnPropNames2(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
34343
|
+
}, "__commonJS");
|
|
34344
|
+
var __copyProps2 = /* @__PURE__ */ __name((to, from, except, desc) => {
|
|
34345
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames2(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
34346
|
+
key = keys[i];
|
|
34347
|
+
if (!__hasOwnProp2.call(to, key) && key !== except) __defProp3(to, key, {
|
|
34348
|
+
get: ((k) => from[k]).bind(null, key),
|
|
34349
|
+
enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable
|
|
34350
|
+
});
|
|
34351
|
+
}
|
|
34352
|
+
return to;
|
|
34353
|
+
}, "__copyProps");
|
|
34354
|
+
var __toESM2 = /* @__PURE__ */ __name((mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(isNodeMode || !mod || !mod.__esModule ? __defProp3(target, "default", {
|
|
34355
|
+
value: mod,
|
|
34356
|
+
enumerable: true
|
|
34357
|
+
}) : target, mod)), "__toESM");
|
|
34358
|
+
var require_typeof = __commonJS2({ "../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/typeof.js"(exports, module) {
|
|
34359
|
+
function _typeof$2(o) {
|
|
34360
|
+
"@babel/helpers - typeof";
|
|
34361
|
+
return module.exports = _typeof$2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o$1) {
|
|
34362
|
+
return typeof o$1;
|
|
34363
|
+
} : function(o$1) {
|
|
34364
|
+
return o$1 && "function" == typeof Symbol && o$1.constructor === Symbol && o$1 !== Symbol.prototype ? "symbol" : typeof o$1;
|
|
34365
|
+
}, module.exports.__esModule = true, module.exports["default"] = module.exports, _typeof$2(o);
|
|
34366
|
+
}
|
|
34367
|
+
__name(_typeof$2, "_typeof$2");
|
|
34368
|
+
module.exports = _typeof$2, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
34369
|
+
} });
|
|
34370
|
+
var require_toPrimitive = __commonJS2({ "../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(exports, module) {
|
|
34371
|
+
var _typeof$1 = require_typeof()["default"];
|
|
34372
|
+
function toPrimitive$1(t, r) {
|
|
34373
|
+
if ("object" != _typeof$1(t) || !t) return t;
|
|
34374
|
+
var e = t[Symbol.toPrimitive];
|
|
34375
|
+
if (void 0 !== e) {
|
|
34376
|
+
var i = e.call(t, r || "default");
|
|
34377
|
+
if ("object" != _typeof$1(i)) return i;
|
|
34378
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
34379
|
+
}
|
|
34380
|
+
return ("string" === r ? String : Number)(t);
|
|
34381
|
+
}
|
|
34382
|
+
__name(toPrimitive$1, "toPrimitive$1");
|
|
34383
|
+
module.exports = toPrimitive$1, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
34384
|
+
} });
|
|
34385
|
+
var require_toPropertyKey = __commonJS2({ "../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(exports, module) {
|
|
34386
|
+
var _typeof = require_typeof()["default"];
|
|
34387
|
+
var toPrimitive = require_toPrimitive();
|
|
34388
|
+
function toPropertyKey$1(t) {
|
|
34389
|
+
var i = toPrimitive(t, "string");
|
|
34390
|
+
return "symbol" == _typeof(i) ? i : i + "";
|
|
34391
|
+
}
|
|
34392
|
+
__name(toPropertyKey$1, "toPropertyKey$1");
|
|
34393
|
+
module.exports = toPropertyKey$1, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
34394
|
+
} });
|
|
34395
|
+
var require_defineProperty = __commonJS2({ "../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(exports, module) {
|
|
34396
|
+
var toPropertyKey = require_toPropertyKey();
|
|
34397
|
+
function _defineProperty(e, r, t) {
|
|
34398
|
+
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
34399
|
+
value: t,
|
|
34400
|
+
enumerable: true,
|
|
34401
|
+
configurable: true,
|
|
34402
|
+
writable: true
|
|
34403
|
+
}) : e[r] = t, e;
|
|
34404
|
+
}
|
|
34405
|
+
__name(_defineProperty, "_defineProperty");
|
|
34406
|
+
module.exports = _defineProperty, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
34407
|
+
} });
|
|
34408
|
+
var require_objectSpread2 = __commonJS2({ "../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(exports, module) {
|
|
34409
|
+
var defineProperty = require_defineProperty();
|
|
34410
|
+
function ownKeys(e, r) {
|
|
34411
|
+
var t = Object.keys(e);
|
|
34412
|
+
if (Object.getOwnPropertySymbols) {
|
|
34413
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
34414
|
+
r && (o = o.filter(function(r$1) {
|
|
34415
|
+
return Object.getOwnPropertyDescriptor(e, r$1).enumerable;
|
|
34416
|
+
})), t.push.apply(t, o);
|
|
34417
|
+
}
|
|
34418
|
+
return t;
|
|
34419
|
+
}
|
|
34420
|
+
__name(ownKeys, "ownKeys");
|
|
34421
|
+
function _objectSpread2(e) {
|
|
34422
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
34423
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
34424
|
+
r % 2 ? ownKeys(Object(t), true).forEach(function(r$1) {
|
|
34425
|
+
defineProperty(e, r$1, t[r$1]);
|
|
34426
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r$1) {
|
|
34427
|
+
Object.defineProperty(e, r$1, Object.getOwnPropertyDescriptor(t, r$1));
|
|
34428
|
+
});
|
|
34429
|
+
}
|
|
34430
|
+
return e;
|
|
34431
|
+
}
|
|
34432
|
+
__name(_objectSpread2, "_objectSpread2");
|
|
34433
|
+
module.exports = _objectSpread2, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
34434
|
+
} });
|
|
34435
|
+
|
|
34334
34436
|
// ../../../node_modules/@trpc/server/dist/observable-UMO3vUa_.mjs
|
|
34335
34437
|
function observable(subscribe) {
|
|
34336
34438
|
const self = {
|
|
@@ -34495,14 +34597,12 @@ function behaviorSubject(initialValue) {
|
|
|
34495
34597
|
}
|
|
34496
34598
|
__name(behaviorSubject, "behaviorSubject");
|
|
34497
34599
|
|
|
34498
|
-
// ../../../node_modules/@trpc/client/dist/
|
|
34600
|
+
// ../../../node_modules/@trpc/client/dist/splitLink-B7Cuf2c_.mjs
|
|
34499
34601
|
function createChain(opts) {
|
|
34500
34602
|
return observable((observer) => {
|
|
34501
34603
|
function execute(index = 0, op = opts.op) {
|
|
34502
34604
|
const next = opts.links[index];
|
|
34503
|
-
if (!next)
|
|
34504
|
-
throw new Error("No more links to execute - did you forget to add an ending link?");
|
|
34505
|
-
}
|
|
34605
|
+
if (!next) throw new Error("No more links to execute - did you forget to add an ending link?");
|
|
34506
34606
|
const subscription = next({
|
|
34507
34607
|
op,
|
|
34508
34608
|
next(nextOp) {
|
|
@@ -34555,26 +34655,26 @@ function isObject2(value) {
|
|
|
34555
34655
|
__name(isObject2, "isObject");
|
|
34556
34656
|
|
|
34557
34657
|
// ../../../node_modules/@trpc/server/dist/getErrorShape-BH60iMC2.mjs
|
|
34558
|
-
var
|
|
34559
|
-
var
|
|
34560
|
-
var
|
|
34561
|
-
var
|
|
34562
|
-
var
|
|
34563
|
-
var
|
|
34564
|
-
var
|
|
34565
|
-
return mod || (0, cb[
|
|
34658
|
+
var __create3 = Object.create;
|
|
34659
|
+
var __defProp4 = Object.defineProperty;
|
|
34660
|
+
var __getOwnPropDesc3 = Object.getOwnPropertyDescriptor;
|
|
34661
|
+
var __getOwnPropNames3 = Object.getOwnPropertyNames;
|
|
34662
|
+
var __getProtoOf3 = Object.getPrototypeOf;
|
|
34663
|
+
var __hasOwnProp3 = Object.prototype.hasOwnProperty;
|
|
34664
|
+
var __commonJS3 = /* @__PURE__ */ __name((cb, mod) => function() {
|
|
34665
|
+
return mod || (0, cb[__getOwnPropNames3(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
34566
34666
|
}, "__commonJS");
|
|
34567
|
-
var
|
|
34568
|
-
if (from && typeof from === "object" || typeof from === "function") for (var keys =
|
|
34667
|
+
var __copyProps3 = /* @__PURE__ */ __name((to, from, except, desc) => {
|
|
34668
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames3(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
34569
34669
|
key = keys[i];
|
|
34570
|
-
if (!
|
|
34670
|
+
if (!__hasOwnProp3.call(to, key) && key !== except) __defProp4(to, key, {
|
|
34571
34671
|
get: ((k) => from[k]).bind(null, key),
|
|
34572
|
-
enumerable: !(desc =
|
|
34672
|
+
enumerable: !(desc = __getOwnPropDesc3(from, key)) || desc.enumerable
|
|
34573
34673
|
});
|
|
34574
34674
|
}
|
|
34575
34675
|
return to;
|
|
34576
34676
|
}, "__copyProps");
|
|
34577
|
-
var
|
|
34677
|
+
var __toESM3 = /* @__PURE__ */ __name((mod, isNodeMode, target) => (target = mod != null ? __create3(__getProtoOf3(mod)) : {}, __copyProps3(isNodeMode || !mod || !mod.__esModule ? __defProp4(target, "default", {
|
|
34578
34678
|
value: mod,
|
|
34579
34679
|
enumerable: true
|
|
34580
34680
|
}) : target, mod)), "__toESM");
|
|
@@ -34620,7 +34720,7 @@ var createFlatProxy = /* @__PURE__ */ __name((callback) => {
|
|
|
34620
34720
|
return callback(name);
|
|
34621
34721
|
} });
|
|
34622
34722
|
}, "createFlatProxy");
|
|
34623
|
-
var
|
|
34723
|
+
var require_typeof2 = __commonJS3({ "../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/typeof.js"(exports, module) {
|
|
34624
34724
|
function _typeof$2(o) {
|
|
34625
34725
|
"@babel/helpers - typeof";
|
|
34626
34726
|
return module.exports = _typeof$2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o$1) {
|
|
@@ -34632,8 +34732,8 @@ var require_typeof = __commonJS2({ "../../node_modules/.pnpm/@oxc-project+runtim
|
|
|
34632
34732
|
__name(_typeof$2, "_typeof$2");
|
|
34633
34733
|
module.exports = _typeof$2, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
34634
34734
|
} });
|
|
34635
|
-
var
|
|
34636
|
-
var _typeof$1 =
|
|
34735
|
+
var require_toPrimitive2 = __commonJS3({ "../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(exports, module) {
|
|
34736
|
+
var _typeof$1 = require_typeof2()["default"];
|
|
34637
34737
|
function toPrimitive$1(t, r) {
|
|
34638
34738
|
if ("object" != _typeof$1(t) || !t) return t;
|
|
34639
34739
|
var e = t[Symbol.toPrimitive];
|
|
@@ -34647,9 +34747,9 @@ var require_toPrimitive = __commonJS2({ "../../node_modules/.pnpm/@oxc-project+r
|
|
|
34647
34747
|
__name(toPrimitive$1, "toPrimitive$1");
|
|
34648
34748
|
module.exports = toPrimitive$1, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
34649
34749
|
} });
|
|
34650
|
-
var
|
|
34651
|
-
var _typeof =
|
|
34652
|
-
var toPrimitive =
|
|
34750
|
+
var require_toPropertyKey2 = __commonJS3({ "../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(exports, module) {
|
|
34751
|
+
var _typeof = require_typeof2()["default"];
|
|
34752
|
+
var toPrimitive = require_toPrimitive2();
|
|
34653
34753
|
function toPropertyKey$1(t) {
|
|
34654
34754
|
var i = toPrimitive(t, "string");
|
|
34655
34755
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
@@ -34657,8 +34757,8 @@ var require_toPropertyKey = __commonJS2({ "../../node_modules/.pnpm/@oxc-project
|
|
|
34657
34757
|
__name(toPropertyKey$1, "toPropertyKey$1");
|
|
34658
34758
|
module.exports = toPropertyKey$1, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
34659
34759
|
} });
|
|
34660
|
-
var
|
|
34661
|
-
var toPropertyKey =
|
|
34760
|
+
var require_defineProperty2 = __commonJS3({ "../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(exports, module) {
|
|
34761
|
+
var toPropertyKey = require_toPropertyKey2();
|
|
34662
34762
|
function _defineProperty(e, r, t) {
|
|
34663
34763
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
34664
34764
|
value: t,
|
|
@@ -34670,8 +34770,8 @@ var require_defineProperty = __commonJS2({ "../../node_modules/.pnpm/@oxc-projec
|
|
|
34670
34770
|
__name(_defineProperty, "_defineProperty");
|
|
34671
34771
|
module.exports = _defineProperty, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
34672
34772
|
} });
|
|
34673
|
-
var
|
|
34674
|
-
var defineProperty =
|
|
34773
|
+
var require_objectSpread22 = __commonJS3({ "../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(exports, module) {
|
|
34774
|
+
var defineProperty = require_defineProperty2();
|
|
34675
34775
|
function ownKeys(e, r) {
|
|
34676
34776
|
var t = Object.keys(e);
|
|
34677
34777
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -34697,11 +34797,11 @@ var require_objectSpread2 = __commonJS2({ "../../node_modules/.pnpm/@oxc-project
|
|
|
34697
34797
|
__name(_objectSpread2, "_objectSpread2");
|
|
34698
34798
|
module.exports = _objectSpread2, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
34699
34799
|
} });
|
|
34700
|
-
var import_objectSpread2 =
|
|
34800
|
+
var import_objectSpread2 = __toESM3(require_objectSpread22(), 1);
|
|
34701
34801
|
|
|
34702
|
-
// ../../../node_modules/@trpc/server/dist/tracked-
|
|
34703
|
-
var import_defineProperty =
|
|
34704
|
-
var import_objectSpread2$1 =
|
|
34802
|
+
// ../../../node_modules/@trpc/server/dist/tracked-DBSMdVzR.mjs
|
|
34803
|
+
var import_defineProperty = __toESM3(require_defineProperty2(), 1);
|
|
34804
|
+
var import_objectSpread2$1 = __toESM3(require_objectSpread22(), 1);
|
|
34705
34805
|
function transformResultInner(response, transformer) {
|
|
34706
34806
|
if ("error" in response) {
|
|
34707
34807
|
const error51 = transformer.deserialize(response.error);
|
|
@@ -34740,23 +34840,11 @@ function transformResult(response, transformer) {
|
|
|
34740
34840
|
return result;
|
|
34741
34841
|
}
|
|
34742
34842
|
__name(transformResult, "transformResult");
|
|
34743
|
-
var import_objectSpread22 =
|
|
34843
|
+
var import_objectSpread22 = __toESM3(require_objectSpread22(), 1);
|
|
34744
34844
|
|
|
34745
|
-
// ../../../node_modules/@trpc/client/dist/TRPCClientError.mjs
|
|
34746
|
-
|
|
34747
|
-
|
|
34748
|
-
Object.defineProperty(obj, key, {
|
|
34749
|
-
value,
|
|
34750
|
-
enumerable: true,
|
|
34751
|
-
configurable: true,
|
|
34752
|
-
writable: true
|
|
34753
|
-
});
|
|
34754
|
-
} else {
|
|
34755
|
-
obj[key] = value;
|
|
34756
|
-
}
|
|
34757
|
-
return obj;
|
|
34758
|
-
}
|
|
34759
|
-
__name(_define_property, "_define_property");
|
|
34845
|
+
// ../../../node_modules/@trpc/client/dist/TRPCClientError-CjKyS10w.mjs
|
|
34846
|
+
var import_defineProperty2 = __toESM2(require_defineProperty(), 1);
|
|
34847
|
+
var import_objectSpread23 = __toESM2(require_objectSpread2(), 1);
|
|
34760
34848
|
function isTRPCClientError(cause) {
|
|
34761
34849
|
return cause instanceof TRPCClientError;
|
|
34762
34850
|
}
|
|
@@ -34766,220 +34854,180 @@ function isTRPCErrorResponse(obj) {
|
|
|
34766
34854
|
}
|
|
34767
34855
|
__name(isTRPCErrorResponse, "isTRPCErrorResponse");
|
|
34768
34856
|
function getMessageFromUnknownError(err, fallback) {
|
|
34769
|
-
if (typeof err === "string")
|
|
34770
|
-
|
|
34771
|
-
}
|
|
34772
|
-
if (isObject2(err) && typeof err["message"] === "string") {
|
|
34773
|
-
return err["message"];
|
|
34774
|
-
}
|
|
34857
|
+
if (typeof err === "string") return err;
|
|
34858
|
+
if (isObject2(err) && typeof err["message"] === "string") return err["message"];
|
|
34775
34859
|
return fallback;
|
|
34776
34860
|
}
|
|
34777
34861
|
__name(getMessageFromUnknownError, "getMessageFromUnknownError");
|
|
34778
|
-
var TRPCClientError = class
|
|
34862
|
+
var TRPCClientError = class TRPCClientError2 extends Error {
|
|
34779
34863
|
static {
|
|
34780
34864
|
__name(this, "TRPCClientError");
|
|
34781
34865
|
}
|
|
34866
|
+
constructor(message, opts) {
|
|
34867
|
+
var _opts$result, _opts$result2;
|
|
34868
|
+
const cause = opts === null || opts === void 0 ? void 0 : opts.cause;
|
|
34869
|
+
super(message, { cause });
|
|
34870
|
+
(0, import_defineProperty2.default)(this, "cause", void 0);
|
|
34871
|
+
(0, import_defineProperty2.default)(this, "shape", void 0);
|
|
34872
|
+
(0, import_defineProperty2.default)(this, "data", void 0);
|
|
34873
|
+
(0, import_defineProperty2.default)(this, "meta", void 0);
|
|
34874
|
+
this.meta = opts === null || opts === void 0 ? void 0 : opts.meta;
|
|
34875
|
+
this.cause = cause;
|
|
34876
|
+
this.shape = opts === null || opts === void 0 || (_opts$result = opts.result) === null || _opts$result === void 0 ? void 0 : _opts$result.error;
|
|
34877
|
+
this.data = opts === null || opts === void 0 || (_opts$result2 = opts.result) === null || _opts$result2 === void 0 ? void 0 : _opts$result2.error.data;
|
|
34878
|
+
this.name = "TRPCClientError";
|
|
34879
|
+
Object.setPrototypeOf(this, TRPCClientError2.prototype);
|
|
34880
|
+
}
|
|
34782
34881
|
static from(_cause, opts = {}) {
|
|
34783
34882
|
const cause = _cause;
|
|
34784
34883
|
if (isTRPCClientError(cause)) {
|
|
34785
|
-
if (opts.meta) {
|
|
34786
|
-
cause.meta = {
|
|
34787
|
-
...cause.meta,
|
|
34788
|
-
...opts.meta
|
|
34789
|
-
};
|
|
34790
|
-
}
|
|
34884
|
+
if (opts.meta) cause.meta = (0, import_objectSpread23.default)((0, import_objectSpread23.default)({}, cause.meta), opts.meta);
|
|
34791
34885
|
return cause;
|
|
34792
34886
|
}
|
|
34793
|
-
if (isTRPCErrorResponse(cause)) {
|
|
34794
|
-
|
|
34795
|
-
...opts,
|
|
34796
|
-
result: cause
|
|
34797
|
-
});
|
|
34798
|
-
}
|
|
34799
|
-
return new _TRPCClientError(getMessageFromUnknownError(cause, "Unknown error"), {
|
|
34800
|
-
...opts,
|
|
34801
|
-
cause
|
|
34802
|
-
});
|
|
34803
|
-
}
|
|
34804
|
-
constructor(message, opts) {
|
|
34805
|
-
const cause = opts?.cause;
|
|
34806
|
-
super(message, {
|
|
34807
|
-
cause
|
|
34808
|
-
}), // eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
34809
|
-
// @ts-ignore override doesn't work in all environments due to "This member cannot have an 'override' modifier because it is not declared in the base class 'Error'"
|
|
34810
|
-
_define_property(this, "cause", void 0), _define_property(this, "shape", void 0), _define_property(this, "data", void 0), /**
|
|
34811
|
-
* Additional meta data about the error
|
|
34812
|
-
* In the case of HTTP-errors, we'll have `response` and potentially `responseJSON` here
|
|
34813
|
-
*/
|
|
34814
|
-
_define_property(this, "meta", void 0);
|
|
34815
|
-
this.meta = opts?.meta;
|
|
34816
|
-
this.cause = cause;
|
|
34817
|
-
this.shape = opts?.result?.error;
|
|
34818
|
-
this.data = opts?.result?.error.data;
|
|
34819
|
-
this.name = "TRPCClientError";
|
|
34820
|
-
Object.setPrototypeOf(this, _TRPCClientError.prototype);
|
|
34887
|
+
if (isTRPCErrorResponse(cause)) return new TRPCClientError2(cause.error.message, (0, import_objectSpread23.default)((0, import_objectSpread23.default)({}, opts), {}, { result: cause }));
|
|
34888
|
+
return new TRPCClientError2(getMessageFromUnknownError(cause, "Unknown error"), (0, import_objectSpread23.default)((0, import_objectSpread23.default)({}, opts), {}, { cause }));
|
|
34821
34889
|
}
|
|
34822
34890
|
};
|
|
34823
34891
|
|
|
34824
|
-
// ../../../node_modules/@trpc/client/dist/internals
|
|
34825
|
-
function
|
|
34826
|
-
|
|
34827
|
-
|
|
34828
|
-
|
|
34829
|
-
|
|
34830
|
-
|
|
34831
|
-
|
|
34832
|
-
|
|
34833
|
-
|
|
34834
|
-
|
|
34835
|
-
|
|
34836
|
-
|
|
34892
|
+
// ../../../node_modules/@trpc/client/dist/unstable-internals-Bg7n9BBj.mjs
|
|
34893
|
+
function getTransformer(transformer) {
|
|
34894
|
+
const _transformer = transformer;
|
|
34895
|
+
if (!_transformer) return {
|
|
34896
|
+
input: {
|
|
34897
|
+
serialize: /* @__PURE__ */ __name((data) => data, "serialize"),
|
|
34898
|
+
deserialize: /* @__PURE__ */ __name((data) => data, "deserialize")
|
|
34899
|
+
},
|
|
34900
|
+
output: {
|
|
34901
|
+
serialize: /* @__PURE__ */ __name((data) => data, "serialize"),
|
|
34902
|
+
deserialize: /* @__PURE__ */ __name((data) => data, "deserialize")
|
|
34903
|
+
}
|
|
34904
|
+
};
|
|
34905
|
+
if ("input" in _transformer) return _transformer;
|
|
34906
|
+
return {
|
|
34907
|
+
input: _transformer,
|
|
34908
|
+
output: _transformer
|
|
34909
|
+
};
|
|
34837
34910
|
}
|
|
34838
|
-
__name(
|
|
34839
|
-
|
|
34840
|
-
|
|
34841
|
-
|
|
34911
|
+
__name(getTransformer, "getTransformer");
|
|
34912
|
+
|
|
34913
|
+
// ../../../node_modules/@trpc/client/dist/httpUtils-Dv57hbOd.mjs
|
|
34914
|
+
var isFunction2 = /* @__PURE__ */ __name((fn) => typeof fn === "function", "isFunction");
|
|
34915
|
+
function getFetch(customFetchImpl) {
|
|
34916
|
+
if (customFetchImpl) return customFetchImpl;
|
|
34917
|
+
if (typeof window !== "undefined" && isFunction2(window.fetch)) return window.fetch;
|
|
34918
|
+
if (typeof globalThis !== "undefined" && isFunction2(globalThis.fetch)) return globalThis.fetch;
|
|
34919
|
+
throw new Error("No fetch implementation found");
|
|
34920
|
+
}
|
|
34921
|
+
__name(getFetch, "getFetch");
|
|
34922
|
+
var import_objectSpread24 = __toESM2(require_objectSpread2(), 1);
|
|
34923
|
+
function resolveHTTPLinkOptions(opts) {
|
|
34924
|
+
return {
|
|
34925
|
+
url: opts.url.toString(),
|
|
34926
|
+
fetch: opts.fetch,
|
|
34927
|
+
transformer: getTransformer(opts.transformer),
|
|
34928
|
+
methodOverride: opts.methodOverride
|
|
34929
|
+
};
|
|
34930
|
+
}
|
|
34931
|
+
__name(resolveHTTPLinkOptions, "resolveHTTPLinkOptions");
|
|
34932
|
+
function arrayToDict(array2) {
|
|
34933
|
+
const dict = {};
|
|
34934
|
+
for (let index = 0; index < array2.length; index++) {
|
|
34935
|
+
const element = array2[index];
|
|
34936
|
+
dict[index] = element;
|
|
34842
34937
|
}
|
|
34843
|
-
|
|
34844
|
-
|
|
34845
|
-
|
|
34846
|
-
|
|
34847
|
-
|
|
34848
|
-
|
|
34849
|
-
|
|
34850
|
-
|
|
34851
|
-
|
|
34852
|
-
|
|
34938
|
+
return dict;
|
|
34939
|
+
}
|
|
34940
|
+
__name(arrayToDict, "arrayToDict");
|
|
34941
|
+
var METHOD = {
|
|
34942
|
+
query: "GET",
|
|
34943
|
+
mutation: "POST",
|
|
34944
|
+
subscription: "PATCH"
|
|
34945
|
+
};
|
|
34946
|
+
function getInput(opts) {
|
|
34947
|
+
return "input" in opts ? opts.transformer.input.serialize(opts.input) : arrayToDict(opts.inputs.map((_input) => opts.transformer.input.serialize(_input)));
|
|
34948
|
+
}
|
|
34949
|
+
__name(getInput, "getInput");
|
|
34950
|
+
var getUrl = /* @__PURE__ */ __name((opts) => {
|
|
34951
|
+
const parts = opts.url.split("?");
|
|
34952
|
+
const base = parts[0].replace(/\/$/, "");
|
|
34953
|
+
let url2 = base + "/" + opts.path;
|
|
34954
|
+
const queryParts = [];
|
|
34955
|
+
if (parts[1]) queryParts.push(parts[1]);
|
|
34956
|
+
if ("inputs" in opts) queryParts.push("batch=1");
|
|
34957
|
+
if (opts.type === "query" || opts.type === "subscription") {
|
|
34958
|
+
const input = getInput(opts);
|
|
34959
|
+
if (input !== void 0 && opts.methodOverride !== "POST") queryParts.push(`input=${encodeURIComponent(JSON.stringify(input))}`);
|
|
34853
34960
|
}
|
|
34854
|
-
|
|
34855
|
-
|
|
34856
|
-
|
|
34857
|
-
|
|
34858
|
-
|
|
34859
|
-
|
|
34860
|
-
|
|
34861
|
-
|
|
34862
|
-
|
|
34961
|
+
if (queryParts.length) url2 += "?" + queryParts.join("&");
|
|
34962
|
+
return url2;
|
|
34963
|
+
}, "getUrl");
|
|
34964
|
+
var getBody = /* @__PURE__ */ __name((opts) => {
|
|
34965
|
+
if (opts.type === "query" && opts.methodOverride !== "POST") return void 0;
|
|
34966
|
+
const input = getInput(opts);
|
|
34967
|
+
return input !== void 0 ? JSON.stringify(input) : void 0;
|
|
34968
|
+
}, "getBody");
|
|
34969
|
+
var jsonHttpRequester = /* @__PURE__ */ __name((opts) => {
|
|
34970
|
+
return httpRequest((0, import_objectSpread24.default)((0, import_objectSpread24.default)({}, opts), {}, {
|
|
34971
|
+
contentTypeHeader: "application/json",
|
|
34972
|
+
getUrl,
|
|
34973
|
+
getBody
|
|
34974
|
+
}));
|
|
34975
|
+
}, "jsonHttpRequester");
|
|
34976
|
+
var AbortError = class extends Error {
|
|
34977
|
+
static {
|
|
34978
|
+
__name(this, "AbortError");
|
|
34863
34979
|
}
|
|
34864
|
-
|
|
34865
|
-
|
|
34866
|
-
|
|
34867
|
-
|
|
34868
|
-
|
|
34869
|
-
context: opts?.context,
|
|
34870
|
-
signal: opts?.signal
|
|
34871
|
-
});
|
|
34980
|
+
constructor() {
|
|
34981
|
+
const name = "AbortError";
|
|
34982
|
+
super(name);
|
|
34983
|
+
this.name = name;
|
|
34984
|
+
this.message = name;
|
|
34872
34985
|
}
|
|
34873
|
-
mutation(path, input, opts) {
|
|
34874
|
-
return this.requestAsPromise({
|
|
34875
|
-
type: "mutation",
|
|
34876
|
-
path,
|
|
34877
|
-
input,
|
|
34878
|
-
context: opts?.context,
|
|
34879
|
-
signal: opts?.signal
|
|
34880
|
-
});
|
|
34881
|
-
}
|
|
34882
|
-
subscription(path, input, opts) {
|
|
34883
|
-
const observable$ = this.$request({
|
|
34884
|
-
type: "subscription",
|
|
34885
|
-
path,
|
|
34886
|
-
input,
|
|
34887
|
-
context: opts.context,
|
|
34888
|
-
signal: opts.signal
|
|
34889
|
-
});
|
|
34890
|
-
return observable$.subscribe({
|
|
34891
|
-
next(envelope) {
|
|
34892
|
-
switch (envelope.result.type) {
|
|
34893
|
-
case "state": {
|
|
34894
|
-
opts.onConnectionStateChange?.(envelope.result);
|
|
34895
|
-
break;
|
|
34896
|
-
}
|
|
34897
|
-
case "started": {
|
|
34898
|
-
opts.onStarted?.({
|
|
34899
|
-
context: envelope.context
|
|
34900
|
-
});
|
|
34901
|
-
break;
|
|
34902
|
-
}
|
|
34903
|
-
case "stopped": {
|
|
34904
|
-
opts.onStopped?.();
|
|
34905
|
-
break;
|
|
34906
|
-
}
|
|
34907
|
-
case "data":
|
|
34908
|
-
case void 0: {
|
|
34909
|
-
opts.onData?.(envelope.result.data);
|
|
34910
|
-
break;
|
|
34911
|
-
}
|
|
34912
|
-
}
|
|
34913
|
-
},
|
|
34914
|
-
error(err) {
|
|
34915
|
-
opts.onError?.(err);
|
|
34916
|
-
},
|
|
34917
|
-
complete() {
|
|
34918
|
-
opts.onComplete?.();
|
|
34919
|
-
}
|
|
34920
|
-
});
|
|
34921
|
-
}
|
|
34922
|
-
constructor(opts) {
|
|
34923
|
-
_define_property2(this, "links", void 0);
|
|
34924
|
-
_define_property2(this, "runtime", void 0);
|
|
34925
|
-
_define_property2(this, "requestId", void 0);
|
|
34926
|
-
this.requestId = 0;
|
|
34927
|
-
this.runtime = {};
|
|
34928
|
-
this.links = opts.links.map((link) => link(this.runtime));
|
|
34929
|
-
}
|
|
34930
|
-
};
|
|
34931
|
-
|
|
34932
|
-
// ../../../node_modules/@trpc/client/dist/createTRPCClient.mjs
|
|
34933
|
-
var untypedClientSymbol = /* @__PURE__ */ Symbol.for("trpc_untypedClient");
|
|
34934
|
-
var clientCallTypeMap = {
|
|
34935
|
-
query: "query",
|
|
34936
|
-
mutate: "mutation",
|
|
34937
|
-
subscribe: "subscription"
|
|
34938
34986
|
};
|
|
34939
|
-
var
|
|
34940
|
-
|
|
34941
|
-
|
|
34942
|
-
|
|
34943
|
-
|
|
34944
|
-
|
|
34945
|
-
|
|
34946
|
-
|
|
34947
|
-
|
|
34948
|
-
|
|
34949
|
-
|
|
34950
|
-
|
|
34951
|
-
|
|
34952
|
-
|
|
34953
|
-
|
|
34954
|
-
|
|
34955
|
-
return
|
|
34987
|
+
var throwIfAborted = /* @__PURE__ */ __name((signal) => {
|
|
34988
|
+
var _signal$throwIfAborte;
|
|
34989
|
+
if (!(signal === null || signal === void 0 ? void 0 : signal.aborted)) return;
|
|
34990
|
+
(_signal$throwIfAborte = signal.throwIfAborted) === null || _signal$throwIfAborte === void 0 || _signal$throwIfAborte.call(signal);
|
|
34991
|
+
if (typeof DOMException !== "undefined") throw new DOMException("AbortError", "AbortError");
|
|
34992
|
+
throw new AbortError();
|
|
34993
|
+
}, "throwIfAborted");
|
|
34994
|
+
async function fetchHTTPResponse(opts) {
|
|
34995
|
+
var _opts$methodOverride;
|
|
34996
|
+
throwIfAborted(opts.signal);
|
|
34997
|
+
const url2 = opts.getUrl(opts);
|
|
34998
|
+
const body = opts.getBody(opts);
|
|
34999
|
+
const method = (_opts$methodOverride = opts.methodOverride) !== null && _opts$methodOverride !== void 0 ? _opts$methodOverride : METHOD[opts.type];
|
|
35000
|
+
const resolvedHeaders = await (async () => {
|
|
35001
|
+
const heads = await opts.headers();
|
|
35002
|
+
if (Symbol.iterator in heads) return Object.fromEntries(heads);
|
|
35003
|
+
return heads;
|
|
35004
|
+
})();
|
|
35005
|
+
const headers = (0, import_objectSpread24.default)((0, import_objectSpread24.default)((0, import_objectSpread24.default)({}, opts.contentTypeHeader && method !== "GET" ? { "content-type": opts.contentTypeHeader } : {}), opts.trpcAcceptHeader ? { "trpc-accept": opts.trpcAcceptHeader } : void 0), resolvedHeaders);
|
|
35006
|
+
return getFetch(opts.fetch)(url2, {
|
|
35007
|
+
method,
|
|
35008
|
+
signal: opts.signal,
|
|
35009
|
+
body,
|
|
35010
|
+
headers
|
|
34956
35011
|
});
|
|
34957
35012
|
}
|
|
34958
|
-
__name(
|
|
34959
|
-
function
|
|
34960
|
-
const
|
|
34961
|
-
const
|
|
34962
|
-
|
|
35013
|
+
__name(fetchHTTPResponse, "fetchHTTPResponse");
|
|
35014
|
+
async function httpRequest(opts) {
|
|
35015
|
+
const meta3 = {};
|
|
35016
|
+
const res = await fetchHTTPResponse(opts);
|
|
35017
|
+
meta3.response = res;
|
|
35018
|
+
const json2 = await res.json();
|
|
35019
|
+
meta3.responseJSON = json2;
|
|
35020
|
+
return {
|
|
35021
|
+
json: json2,
|
|
35022
|
+
meta: meta3
|
|
35023
|
+
};
|
|
34963
35024
|
}
|
|
34964
|
-
__name(
|
|
35025
|
+
__name(httpRequest, "httpRequest");
|
|
34965
35026
|
|
|
34966
|
-
// ../../../node_modules/@trpc/client/dist/
|
|
34967
|
-
var
|
|
34968
|
-
function getFetch(customFetchImpl) {
|
|
34969
|
-
if (customFetchImpl) {
|
|
34970
|
-
return customFetchImpl;
|
|
34971
|
-
}
|
|
34972
|
-
if (typeof window !== "undefined" && isFunction2(window.fetch)) {
|
|
34973
|
-
return window.fetch;
|
|
34974
|
-
}
|
|
34975
|
-
if (typeof globalThis !== "undefined" && isFunction2(globalThis.fetch)) {
|
|
34976
|
-
return globalThis.fetch;
|
|
34977
|
-
}
|
|
34978
|
-
throw new Error("No fetch implementation found");
|
|
34979
|
-
}
|
|
34980
|
-
__name(getFetch, "getFetch");
|
|
35027
|
+
// ../../../node_modules/@trpc/client/dist/httpLink-DCFpUmZF.mjs
|
|
35028
|
+
var import_objectSpread25 = __toESM2(require_objectSpread2(), 1);
|
|
34981
35029
|
|
|
34982
|
-
// ../../../node_modules/@trpc/client/dist/
|
|
35030
|
+
// ../../../node_modules/@trpc/client/dist/httpBatchLink-BOe5aCcR.mjs
|
|
34983
35031
|
var throwFatalError = /* @__PURE__ */ __name(() => {
|
|
34984
35032
|
throw new Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new");
|
|
34985
35033
|
}, "throwFatalError");
|
|
@@ -34992,18 +35040,15 @@ function dataLoader(batchLoader) {
|
|
|
34992
35040
|
pendingItems = null;
|
|
34993
35041
|
}, "destroyTimerAndPendingItems");
|
|
34994
35042
|
function groupItems(items) {
|
|
34995
|
-
const groupedItems = [
|
|
34996
|
-
[]
|
|
34997
|
-
];
|
|
35043
|
+
const groupedItems = [[]];
|
|
34998
35044
|
let index = 0;
|
|
34999
35045
|
while (true) {
|
|
35000
35046
|
const item = items[index];
|
|
35001
|
-
if (!item)
|
|
35002
|
-
break;
|
|
35003
|
-
}
|
|
35047
|
+
if (!item) break;
|
|
35004
35048
|
const lastGroup = groupedItems[groupedItems.length - 1];
|
|
35005
35049
|
if (item.aborted) {
|
|
35006
|
-
|
|
35050
|
+
var _item$reject;
|
|
35051
|
+
(_item$reject = item.reject) === null || _item$reject === void 0 || _item$reject.call(item, new Error("Aborted"));
|
|
35007
35052
|
index++;
|
|
35008
35053
|
continue;
|
|
35009
35054
|
}
|
|
@@ -35014,7 +35059,8 @@ function dataLoader(batchLoader) {
|
|
|
35014
35059
|
continue;
|
|
35015
35060
|
}
|
|
35016
35061
|
if (lastGroup.length === 0) {
|
|
35017
|
-
|
|
35062
|
+
var _item$reject2;
|
|
35063
|
+
(_item$reject2 = item.reject) === null || _item$reject2 === void 0 || _item$reject2.call(item, new Error("Input is too big for a single dispatch"));
|
|
35018
35064
|
index++;
|
|
35019
35065
|
continue;
|
|
35020
35066
|
}
|
|
@@ -35027,36 +35073,34 @@ function dataLoader(batchLoader) {
|
|
|
35027
35073
|
const groupedItems = groupItems(pendingItems);
|
|
35028
35074
|
destroyTimerAndPendingItems();
|
|
35029
35075
|
for (const items of groupedItems) {
|
|
35030
|
-
if (!items.length)
|
|
35031
|
-
|
|
35032
|
-
|
|
35033
|
-
const batch = {
|
|
35034
|
-
items
|
|
35035
|
-
};
|
|
35036
|
-
for (const item of items) {
|
|
35037
|
-
item.batch = batch;
|
|
35038
|
-
}
|
|
35076
|
+
if (!items.length) continue;
|
|
35077
|
+
const batch = { items };
|
|
35078
|
+
for (const item of items) item.batch = batch;
|
|
35039
35079
|
const promise2 = batchLoader.fetch(batch.items.map((_item) => _item.key));
|
|
35040
35080
|
promise2.then(async (result) => {
|
|
35041
35081
|
await Promise.all(result.map(async (valueOrPromise, index) => {
|
|
35042
35082
|
const item = batch.items[index];
|
|
35043
35083
|
try {
|
|
35084
|
+
var _item$resolve;
|
|
35044
35085
|
const value = await Promise.resolve(valueOrPromise);
|
|
35045
|
-
item.resolve
|
|
35086
|
+
(_item$resolve = item.resolve) === null || _item$resolve === void 0 || _item$resolve.call(item, value);
|
|
35046
35087
|
} catch (cause) {
|
|
35047
|
-
|
|
35088
|
+
var _item$reject3;
|
|
35089
|
+
(_item$reject3 = item.reject) === null || _item$reject3 === void 0 || _item$reject3.call(item, cause);
|
|
35048
35090
|
}
|
|
35049
35091
|
item.batch = null;
|
|
35050
35092
|
item.reject = null;
|
|
35051
35093
|
item.resolve = null;
|
|
35052
35094
|
}));
|
|
35053
35095
|
for (const item of batch.items) {
|
|
35054
|
-
|
|
35096
|
+
var _item$reject4;
|
|
35097
|
+
(_item$reject4 = item.reject) === null || _item$reject4 === void 0 || _item$reject4.call(item, new Error("Missing result"));
|
|
35055
35098
|
item.batch = null;
|
|
35056
35099
|
}
|
|
35057
35100
|
}).catch((cause) => {
|
|
35058
35101
|
for (const item of batch.items) {
|
|
35059
|
-
|
|
35102
|
+
var _item$reject5;
|
|
35103
|
+
(_item$reject5 = item.reject) === null || _item$reject5 === void 0 || _item$reject5.call(item, cause);
|
|
35060
35104
|
item.batch = null;
|
|
35061
35105
|
}
|
|
35062
35106
|
});
|
|
@@ -35064,6 +35108,7 @@ function dataLoader(batchLoader) {
|
|
|
35064
35108
|
}
|
|
35065
35109
|
__name(dispatch, "dispatch");
|
|
35066
35110
|
function load(key) {
|
|
35111
|
+
var _dispatchTimer;
|
|
35067
35112
|
const item = {
|
|
35068
35113
|
aborted: false,
|
|
35069
35114
|
key,
|
|
@@ -35072,245 +35117,68 @@ function dataLoader(batchLoader) {
|
|
|
35072
35117
|
reject: throwFatalError
|
|
35073
35118
|
};
|
|
35074
35119
|
const promise2 = new Promise((resolve, reject) => {
|
|
35120
|
+
var _pendingItems;
|
|
35075
35121
|
item.reject = reject;
|
|
35076
35122
|
item.resolve = resolve;
|
|
35077
|
-
pendingItems
|
|
35123
|
+
(_pendingItems = pendingItems) !== null && _pendingItems !== void 0 || (pendingItems = []);
|
|
35078
35124
|
pendingItems.push(item);
|
|
35079
35125
|
});
|
|
35080
|
-
dispatchTimer
|
|
35126
|
+
(_dispatchTimer = dispatchTimer) !== null && _dispatchTimer !== void 0 || (dispatchTimer = setTimeout(dispatch));
|
|
35081
35127
|
return promise2;
|
|
35082
35128
|
}
|
|
35083
35129
|
__name(load, "load");
|
|
35084
|
-
return {
|
|
35085
|
-
load
|
|
35086
|
-
};
|
|
35130
|
+
return { load };
|
|
35087
35131
|
}
|
|
35088
35132
|
__name(dataLoader, "dataLoader");
|
|
35089
|
-
|
|
35090
|
-
// ../../../node_modules/@trpc/client/dist/internals/signals.mjs
|
|
35091
35133
|
function allAbortSignals(...signals) {
|
|
35092
35134
|
const ac = new AbortController();
|
|
35093
35135
|
const count = signals.length;
|
|
35094
35136
|
let abortedCount = 0;
|
|
35095
35137
|
const onAbort = /* @__PURE__ */ __name(() => {
|
|
35096
|
-
if (++abortedCount === count)
|
|
35097
|
-
ac.abort();
|
|
35098
|
-
}
|
|
35138
|
+
if (++abortedCount === count) ac.abort();
|
|
35099
35139
|
}, "onAbort");
|
|
35100
|
-
for (const signal of signals)
|
|
35101
|
-
|
|
35102
|
-
onAbort();
|
|
35103
|
-
} else {
|
|
35104
|
-
signal?.addEventListener("abort", onAbort, {
|
|
35105
|
-
once: true
|
|
35106
|
-
});
|
|
35107
|
-
}
|
|
35108
|
-
}
|
|
35140
|
+
for (const signal of signals) if (signal === null || signal === void 0 ? void 0 : signal.aborted) onAbort();
|
|
35141
|
+
else signal === null || signal === void 0 || signal.addEventListener("abort", onAbort, { once: true });
|
|
35109
35142
|
return ac.signal;
|
|
35110
35143
|
}
|
|
35111
35144
|
__name(allAbortSignals, "allAbortSignals");
|
|
35112
|
-
|
|
35113
|
-
// ../../../node_modules/@trpc/client/dist/internals/transformer.mjs
|
|
35114
|
-
function getTransformer(transformer) {
|
|
35115
|
-
const _transformer = transformer;
|
|
35116
|
-
if (!_transformer) {
|
|
35117
|
-
return {
|
|
35118
|
-
input: {
|
|
35119
|
-
serialize: /* @__PURE__ */ __name((data) => data, "serialize"),
|
|
35120
|
-
deserialize: /* @__PURE__ */ __name((data) => data, "deserialize")
|
|
35121
|
-
},
|
|
35122
|
-
output: {
|
|
35123
|
-
serialize: /* @__PURE__ */ __name((data) => data, "serialize"),
|
|
35124
|
-
deserialize: /* @__PURE__ */ __name((data) => data, "deserialize")
|
|
35125
|
-
}
|
|
35126
|
-
};
|
|
35127
|
-
}
|
|
35128
|
-
if ("input" in _transformer) {
|
|
35129
|
-
return _transformer;
|
|
35130
|
-
}
|
|
35131
|
-
return {
|
|
35132
|
-
input: _transformer,
|
|
35133
|
-
output: _transformer
|
|
35134
|
-
};
|
|
35135
|
-
}
|
|
35136
|
-
__name(getTransformer, "getTransformer");
|
|
35137
|
-
|
|
35138
|
-
// ../../../node_modules/@trpc/client/dist/links/internals/httpUtils.mjs
|
|
35139
|
-
function resolveHTTPLinkOptions(opts) {
|
|
35140
|
-
return {
|
|
35141
|
-
url: opts.url.toString(),
|
|
35142
|
-
fetch: opts.fetch,
|
|
35143
|
-
transformer: getTransformer(opts.transformer),
|
|
35144
|
-
methodOverride: opts.methodOverride
|
|
35145
|
-
};
|
|
35146
|
-
}
|
|
35147
|
-
__name(resolveHTTPLinkOptions, "resolveHTTPLinkOptions");
|
|
35148
|
-
function arrayToDict(array2) {
|
|
35149
|
-
const dict = {};
|
|
35150
|
-
for (let index = 0; index < array2.length; index++) {
|
|
35151
|
-
const element = array2[index];
|
|
35152
|
-
dict[index] = element;
|
|
35153
|
-
}
|
|
35154
|
-
return dict;
|
|
35155
|
-
}
|
|
35156
|
-
__name(arrayToDict, "arrayToDict");
|
|
35157
|
-
var METHOD = {
|
|
35158
|
-
query: "GET",
|
|
35159
|
-
mutation: "POST",
|
|
35160
|
-
subscription: "PATCH"
|
|
35161
|
-
};
|
|
35162
|
-
function getInput(opts) {
|
|
35163
|
-
return "input" in opts ? opts.transformer.input.serialize(opts.input) : arrayToDict(opts.inputs.map((_input) => opts.transformer.input.serialize(_input)));
|
|
35164
|
-
}
|
|
35165
|
-
__name(getInput, "getInput");
|
|
35166
|
-
var getUrl = /* @__PURE__ */ __name((opts) => {
|
|
35167
|
-
const parts = opts.url.split("?");
|
|
35168
|
-
const base = parts[0].replace(/\/$/, "");
|
|
35169
|
-
let url2 = base + "/" + opts.path;
|
|
35170
|
-
const queryParts = [];
|
|
35171
|
-
if (parts[1]) {
|
|
35172
|
-
queryParts.push(parts[1]);
|
|
35173
|
-
}
|
|
35174
|
-
if ("inputs" in opts) {
|
|
35175
|
-
queryParts.push("batch=1");
|
|
35176
|
-
}
|
|
35177
|
-
if (opts.type === "query" || opts.type === "subscription") {
|
|
35178
|
-
const input = getInput(opts);
|
|
35179
|
-
if (input !== void 0 && opts.methodOverride !== "POST") {
|
|
35180
|
-
queryParts.push(`input=${encodeURIComponent(JSON.stringify(input))}`);
|
|
35181
|
-
}
|
|
35182
|
-
}
|
|
35183
|
-
if (queryParts.length) {
|
|
35184
|
-
url2 += "?" + queryParts.join("&");
|
|
35185
|
-
}
|
|
35186
|
-
return url2;
|
|
35187
|
-
}, "getUrl");
|
|
35188
|
-
var getBody = /* @__PURE__ */ __name((opts) => {
|
|
35189
|
-
if (opts.type === "query" && opts.methodOverride !== "POST") {
|
|
35190
|
-
return void 0;
|
|
35191
|
-
}
|
|
35192
|
-
const input = getInput(opts);
|
|
35193
|
-
return input !== void 0 ? JSON.stringify(input) : void 0;
|
|
35194
|
-
}, "getBody");
|
|
35195
|
-
var jsonHttpRequester = /* @__PURE__ */ __name((opts) => {
|
|
35196
|
-
return httpRequest({
|
|
35197
|
-
...opts,
|
|
35198
|
-
contentTypeHeader: "application/json",
|
|
35199
|
-
getUrl,
|
|
35200
|
-
getBody
|
|
35201
|
-
});
|
|
35202
|
-
}, "jsonHttpRequester");
|
|
35203
|
-
var AbortError = class extends Error {
|
|
35204
|
-
static {
|
|
35205
|
-
__name(this, "AbortError");
|
|
35206
|
-
}
|
|
35207
|
-
constructor() {
|
|
35208
|
-
const name = "AbortError";
|
|
35209
|
-
super(name);
|
|
35210
|
-
this.name = name;
|
|
35211
|
-
this.message = name;
|
|
35212
|
-
}
|
|
35213
|
-
};
|
|
35214
|
-
var throwIfAborted = /* @__PURE__ */ __name((signal) => {
|
|
35215
|
-
if (!signal?.aborted) {
|
|
35216
|
-
return;
|
|
35217
|
-
}
|
|
35218
|
-
signal.throwIfAborted?.();
|
|
35219
|
-
if (typeof DOMException !== "undefined") {
|
|
35220
|
-
throw new DOMException("AbortError", "AbortError");
|
|
35221
|
-
}
|
|
35222
|
-
throw new AbortError();
|
|
35223
|
-
}, "throwIfAborted");
|
|
35224
|
-
async function fetchHTTPResponse(opts) {
|
|
35225
|
-
throwIfAborted(opts.signal);
|
|
35226
|
-
const url2 = opts.getUrl(opts);
|
|
35227
|
-
const body = opts.getBody(opts);
|
|
35228
|
-
const { type } = opts;
|
|
35229
|
-
const resolvedHeaders = await (async () => {
|
|
35230
|
-
const heads = await opts.headers();
|
|
35231
|
-
if (Symbol.iterator in heads) {
|
|
35232
|
-
return Object.fromEntries(heads);
|
|
35233
|
-
}
|
|
35234
|
-
return heads;
|
|
35235
|
-
})();
|
|
35236
|
-
const headers = {
|
|
35237
|
-
...opts.contentTypeHeader ? {
|
|
35238
|
-
"content-type": opts.contentTypeHeader
|
|
35239
|
-
} : {},
|
|
35240
|
-
...opts.trpcAcceptHeader ? {
|
|
35241
|
-
"trpc-accept": opts.trpcAcceptHeader
|
|
35242
|
-
} : void 0,
|
|
35243
|
-
...resolvedHeaders
|
|
35244
|
-
};
|
|
35245
|
-
return getFetch(opts.fetch)(url2, {
|
|
35246
|
-
method: opts.methodOverride ?? METHOD[type],
|
|
35247
|
-
signal: opts.signal,
|
|
35248
|
-
body,
|
|
35249
|
-
headers
|
|
35250
|
-
});
|
|
35251
|
-
}
|
|
35252
|
-
__name(fetchHTTPResponse, "fetchHTTPResponse");
|
|
35253
|
-
async function httpRequest(opts) {
|
|
35254
|
-
const meta3 = {};
|
|
35255
|
-
const res = await fetchHTTPResponse(opts);
|
|
35256
|
-
meta3.response = res;
|
|
35257
|
-
const json2 = await res.json();
|
|
35258
|
-
meta3.responseJSON = json2;
|
|
35259
|
-
return {
|
|
35260
|
-
json: json2,
|
|
35261
|
-
meta: meta3
|
|
35262
|
-
};
|
|
35263
|
-
}
|
|
35264
|
-
__name(httpRequest, "httpRequest");
|
|
35265
|
-
|
|
35266
|
-
// ../../../node_modules/@trpc/client/dist/links/httpBatchLink.mjs
|
|
35145
|
+
var import_objectSpread26 = __toESM2(require_objectSpread2(), 1);
|
|
35267
35146
|
function httpBatchLink(opts) {
|
|
35147
|
+
var _opts$maxURLLength, _opts$maxItems;
|
|
35268
35148
|
const resolvedOpts = resolveHTTPLinkOptions(opts);
|
|
35269
|
-
const maxURLLength = opts.maxURLLength
|
|
35270
|
-
const maxItems = opts.maxItems
|
|
35149
|
+
const maxURLLength = (_opts$maxURLLength = opts.maxURLLength) !== null && _opts$maxURLLength !== void 0 ? _opts$maxURLLength : Infinity;
|
|
35150
|
+
const maxItems = (_opts$maxItems = opts.maxItems) !== null && _opts$maxItems !== void 0 ? _opts$maxItems : Infinity;
|
|
35271
35151
|
return () => {
|
|
35272
35152
|
const batchLoader = /* @__PURE__ */ __name((type) => {
|
|
35273
35153
|
return {
|
|
35274
35154
|
validate(batchOps) {
|
|
35275
|
-
if (maxURLLength === Infinity && maxItems === Infinity)
|
|
35276
|
-
|
|
35277
|
-
}
|
|
35278
|
-
if (batchOps.length > maxItems) {
|
|
35279
|
-
return false;
|
|
35280
|
-
}
|
|
35155
|
+
if (maxURLLength === Infinity && maxItems === Infinity) return true;
|
|
35156
|
+
if (batchOps.length > maxItems) return false;
|
|
35281
35157
|
const path = batchOps.map((op) => op.path).join(",");
|
|
35282
35158
|
const inputs = batchOps.map((op) => op.input);
|
|
35283
|
-
const url2 = getUrl({
|
|
35284
|
-
...resolvedOpts,
|
|
35159
|
+
const url2 = getUrl((0, import_objectSpread26.default)((0, import_objectSpread26.default)({}, resolvedOpts), {}, {
|
|
35285
35160
|
type,
|
|
35286
35161
|
path,
|
|
35287
35162
|
inputs,
|
|
35288
35163
|
signal: null
|
|
35289
|
-
});
|
|
35164
|
+
}));
|
|
35290
35165
|
return url2.length <= maxURLLength;
|
|
35291
35166
|
},
|
|
35292
35167
|
async fetch(batchOps) {
|
|
35293
35168
|
const path = batchOps.map((op) => op.path).join(",");
|
|
35294
35169
|
const inputs = batchOps.map((op) => op.input);
|
|
35295
35170
|
const signal = allAbortSignals(...batchOps.map((op) => op.signal));
|
|
35296
|
-
const res = await jsonHttpRequester({
|
|
35297
|
-
...resolvedOpts,
|
|
35171
|
+
const res = await jsonHttpRequester((0, import_objectSpread26.default)((0, import_objectSpread26.default)({}, resolvedOpts), {}, {
|
|
35298
35172
|
path,
|
|
35299
35173
|
inputs,
|
|
35300
35174
|
type,
|
|
35301
35175
|
headers() {
|
|
35302
|
-
if (!opts.headers) {
|
|
35303
|
-
|
|
35304
|
-
}
|
|
35305
|
-
if (typeof opts.headers === "function") {
|
|
35306
|
-
return opts.headers({
|
|
35307
|
-
opList: batchOps
|
|
35308
|
-
});
|
|
35309
|
-
}
|
|
35176
|
+
if (!opts.headers) return {};
|
|
35177
|
+
if (typeof opts.headers === "function") return opts.headers({ opList: batchOps });
|
|
35310
35178
|
return opts.headers;
|
|
35311
35179
|
},
|
|
35312
35180
|
signal
|
|
35313
|
-
});
|
|
35181
|
+
}));
|
|
35314
35182
|
const resJSON = Array.isArray(res.json) ? res.json : batchOps.map(() => res.json);
|
|
35315
35183
|
const result = resJSON.map((item) => ({
|
|
35316
35184
|
meta: res.meta,
|
|
@@ -35328,9 +35196,7 @@ function httpBatchLink(opts) {
|
|
|
35328
35196
|
};
|
|
35329
35197
|
return ({ op }) => {
|
|
35330
35198
|
return observable((observer) => {
|
|
35331
|
-
if (op.type === "subscription")
|
|
35332
|
-
throw new Error("Subscriptions are unsupported by `httpLink` - use `httpSubscriptionLink` or `wsLink`");
|
|
35333
|
-
}
|
|
35199
|
+
if (op.type === "subscription") throw new Error("Subscriptions are unsupported by `httpLink` - use `httpSubscriptionLink` or `wsLink`");
|
|
35334
35200
|
const loader = loaders[op.type];
|
|
35335
35201
|
const promise2 = loader.load(op);
|
|
35336
35202
|
let _res = void 0;
|
|
@@ -35338,9 +35204,7 @@ function httpBatchLink(opts) {
|
|
|
35338
35204
|
_res = res;
|
|
35339
35205
|
const transformed = transformResult(res.json, resolvedOpts.transformer.output);
|
|
35340
35206
|
if (!transformed.ok) {
|
|
35341
|
-
observer.error(TRPCClientError.from(transformed.error, {
|
|
35342
|
-
meta: res.meta
|
|
35343
|
-
}));
|
|
35207
|
+
observer.error(TRPCClientError.from(transformed.error, { meta: res.meta }));
|
|
35344
35208
|
return;
|
|
35345
35209
|
}
|
|
35346
35210
|
observer.next({
|
|
@@ -35349,9 +35213,7 @@ function httpBatchLink(opts) {
|
|
|
35349
35213
|
});
|
|
35350
35214
|
observer.complete();
|
|
35351
35215
|
}).catch((err) => {
|
|
35352
|
-
observer.error(TRPCClientError.from(err, {
|
|
35353
|
-
meta: _res?.meta
|
|
35354
|
-
}));
|
|
35216
|
+
observer.error(TRPCClientError.from(err, { meta: _res === null || _res === void 0 ? void 0 : _res.meta }));
|
|
35355
35217
|
});
|
|
35356
35218
|
return () => {
|
|
35357
35219
|
};
|
|
@@ -35361,12 +35223,14 @@ function httpBatchLink(opts) {
|
|
|
35361
35223
|
}
|
|
35362
35224
|
__name(httpBatchLink, "httpBatchLink");
|
|
35363
35225
|
|
|
35364
|
-
// ../../../node_modules/@trpc/client/dist/
|
|
35226
|
+
// ../../../node_modules/@trpc/client/dist/loggerLink-ineCN1PO.mjs
|
|
35227
|
+
var import_objectSpread27 = __toESM2(require_objectSpread2(), 1);
|
|
35228
|
+
|
|
35229
|
+
// ../../../node_modules/@trpc/client/dist/wsLink-CatceK3c.mjs
|
|
35365
35230
|
var resultOf = /* @__PURE__ */ __name((value, ...args) => {
|
|
35366
35231
|
return typeof value === "function" ? value(...args) : value;
|
|
35367
35232
|
}, "resultOf");
|
|
35368
|
-
|
|
35369
|
-
// ../../../node_modules/@trpc/client/dist/links/wsLink/wsClient/utils.mjs
|
|
35233
|
+
var import_defineProperty$3 = __toESM2(require_defineProperty(), 1);
|
|
35370
35234
|
function withResolvers() {
|
|
35371
35235
|
let resolve;
|
|
35372
35236
|
let reject;
|
|
@@ -35397,22 +35261,8 @@ async function buildConnectionMessage(connectionParams) {
|
|
|
35397
35261
|
return JSON.stringify(message);
|
|
35398
35262
|
}
|
|
35399
35263
|
__name(buildConnectionMessage, "buildConnectionMessage");
|
|
35400
|
-
|
|
35401
|
-
|
|
35402
|
-
function _define_property3(obj, key, value) {
|
|
35403
|
-
if (key in obj) {
|
|
35404
|
-
Object.defineProperty(obj, key, {
|
|
35405
|
-
value,
|
|
35406
|
-
enumerable: true,
|
|
35407
|
-
configurable: true,
|
|
35408
|
-
writable: true
|
|
35409
|
-
});
|
|
35410
|
-
} else {
|
|
35411
|
-
obj[key] = value;
|
|
35412
|
-
}
|
|
35413
|
-
return obj;
|
|
35414
|
-
}
|
|
35415
|
-
__name(_define_property3, "_define_property");
|
|
35264
|
+
var import_defineProperty$2 = __toESM2(require_defineProperty(), 1);
|
|
35265
|
+
var import_defineProperty$1 = __toESM2(require_defineProperty(), 1);
|
|
35416
35266
|
function asyncWsOpen(ws) {
|
|
35417
35267
|
const { promise: promise2, resolve, reject } = withResolvers();
|
|
35418
35268
|
ws.addEventListener("open", () => {
|
|
@@ -35449,9 +35299,7 @@ function setupPingInterval(ws, { intervalMs, pongTimeoutMs }) {
|
|
|
35449
35299
|
ws.addEventListener("message", ({ data }) => {
|
|
35450
35300
|
clearTimeout(pingTimeout);
|
|
35451
35301
|
start();
|
|
35452
|
-
if (data === "PONG")
|
|
35453
|
-
pong();
|
|
35454
|
-
}
|
|
35302
|
+
if (data === "PONG") pong();
|
|
35455
35303
|
});
|
|
35456
35304
|
ws.addEventListener("close", () => {
|
|
35457
35305
|
clearTimeout(pingTimeout);
|
|
@@ -35459,10 +35307,23 @@ function setupPingInterval(ws, { intervalMs, pongTimeoutMs }) {
|
|
|
35459
35307
|
});
|
|
35460
35308
|
}
|
|
35461
35309
|
__name(setupPingInterval, "setupPingInterval");
|
|
35462
|
-
var WsConnection = class
|
|
35310
|
+
var WsConnection = class WsConnection2 {
|
|
35463
35311
|
static {
|
|
35464
35312
|
__name(this, "WsConnection");
|
|
35465
35313
|
}
|
|
35314
|
+
constructor(opts) {
|
|
35315
|
+
var _opts$WebSocketPonyfi;
|
|
35316
|
+
(0, import_defineProperty$1.default)(this, "id", ++WsConnection2.connectCount);
|
|
35317
|
+
(0, import_defineProperty$1.default)(this, "WebSocketPonyfill", void 0);
|
|
35318
|
+
(0, import_defineProperty$1.default)(this, "urlOptions", void 0);
|
|
35319
|
+
(0, import_defineProperty$1.default)(this, "keepAliveOpts", void 0);
|
|
35320
|
+
(0, import_defineProperty$1.default)(this, "wsObservable", behaviorSubject(null));
|
|
35321
|
+
(0, import_defineProperty$1.default)(this, "openPromise", null);
|
|
35322
|
+
this.WebSocketPonyfill = (_opts$WebSocketPonyfi = opts.WebSocketPonyfill) !== null && _opts$WebSocketPonyfi !== void 0 ? _opts$WebSocketPonyfi : WebSocket;
|
|
35323
|
+
if (!this.WebSocketPonyfill) throw new Error("No WebSocket implementation found - you probably don't want to use this on the server, but if you do you need to pass a `WebSocket`-ponyfill");
|
|
35324
|
+
this.urlOptions = opts.urlOptions;
|
|
35325
|
+
this.keepAliveOpts = opts.keepAlive;
|
|
35326
|
+
}
|
|
35466
35327
|
get ws() {
|
|
35467
35328
|
return this.wsObservable.get();
|
|
35468
35329
|
}
|
|
@@ -35482,33 +35343,26 @@ var WsConnection = class _WsConnection {
|
|
|
35482
35343
|
return !!this.ws && (this.ws.readyState === this.WebSocketPonyfill.CLOSING || this.ws.readyState === this.WebSocketPonyfill.CLOSED);
|
|
35483
35344
|
}
|
|
35484
35345
|
async open() {
|
|
35485
|
-
|
|
35486
|
-
|
|
35487
|
-
|
|
35488
|
-
|
|
35489
|
-
|
|
35346
|
+
var _this = this;
|
|
35347
|
+
if (_this.openPromise) return _this.openPromise;
|
|
35348
|
+
_this.id = ++WsConnection2.connectCount;
|
|
35349
|
+
const wsPromise = prepareUrl(_this.urlOptions).then((url2) => new _this.WebSocketPonyfill(url2));
|
|
35350
|
+
_this.openPromise = wsPromise.then(async (ws) => {
|
|
35351
|
+
_this.ws = ws;
|
|
35490
35352
|
ws.addEventListener("message", function({ data }) {
|
|
35491
|
-
if (data === "PING")
|
|
35492
|
-
this.send("PONG");
|
|
35493
|
-
}
|
|
35353
|
+
if (data === "PING") this.send("PONG");
|
|
35494
35354
|
});
|
|
35495
|
-
if (
|
|
35496
|
-
setupPingInterval(ws, this.keepAliveOpts);
|
|
35497
|
-
}
|
|
35355
|
+
if (_this.keepAliveOpts.enabled) setupPingInterval(ws, _this.keepAliveOpts);
|
|
35498
35356
|
ws.addEventListener("close", () => {
|
|
35499
|
-
if (
|
|
35500
|
-
this.ws = null;
|
|
35501
|
-
}
|
|
35357
|
+
if (_this.ws === ws) _this.ws = null;
|
|
35502
35358
|
});
|
|
35503
35359
|
await asyncWsOpen(ws);
|
|
35504
|
-
if (
|
|
35505
|
-
ws.send(await buildConnectionMessage(this.urlOptions.connectionParams));
|
|
35506
|
-
}
|
|
35360
|
+
if (_this.urlOptions.connectionParams) ws.send(await buildConnectionMessage(_this.urlOptions.connectionParams));
|
|
35507
35361
|
});
|
|
35508
35362
|
try {
|
|
35509
|
-
await
|
|
35363
|
+
await _this.openPromise;
|
|
35510
35364
|
} finally {
|
|
35511
|
-
|
|
35365
|
+
_this.openPromise = null;
|
|
35512
35366
|
}
|
|
35513
35367
|
}
|
|
35514
35368
|
/**
|
|
@@ -35516,28 +35370,351 @@ var WsConnection = class _WsConnection {
|
|
|
35516
35370
|
* Waits for any ongoing open operation to complete before closing.
|
|
35517
35371
|
*/
|
|
35518
35372
|
async close() {
|
|
35373
|
+
var _this2 = this;
|
|
35519
35374
|
try {
|
|
35520
|
-
await
|
|
35375
|
+
await _this2.openPromise;
|
|
35521
35376
|
} finally {
|
|
35522
|
-
|
|
35377
|
+
var _this$ws;
|
|
35378
|
+
(_this$ws = _this2.ws) === null || _this$ws === void 0 || _this$ws.close();
|
|
35523
35379
|
}
|
|
35524
35380
|
}
|
|
35381
|
+
};
|
|
35382
|
+
(0, import_defineProperty$1.default)(WsConnection, "connectCount", 0);
|
|
35383
|
+
var import_defineProperty3 = __toESM2(require_defineProperty(), 1);
|
|
35384
|
+
var import_objectSpread28 = __toESM2(require_objectSpread2(), 1);
|
|
35385
|
+
|
|
35386
|
+
// ../../../node_modules/@trpc/client/dist/index.mjs
|
|
35387
|
+
var import_defineProperty4 = __toESM2(require_defineProperty(), 1);
|
|
35388
|
+
var import_objectSpread2$4 = __toESM2(require_objectSpread2(), 1);
|
|
35389
|
+
var TRPCUntypedClient = class {
|
|
35390
|
+
static {
|
|
35391
|
+
__name(this, "TRPCUntypedClient");
|
|
35392
|
+
}
|
|
35525
35393
|
constructor(opts) {
|
|
35526
|
-
|
|
35527
|
-
|
|
35528
|
-
|
|
35529
|
-
|
|
35530
|
-
|
|
35531
|
-
|
|
35532
|
-
|
|
35533
|
-
|
|
35534
|
-
|
|
35394
|
+
(0, import_defineProperty4.default)(this, "links", void 0);
|
|
35395
|
+
(0, import_defineProperty4.default)(this, "runtime", void 0);
|
|
35396
|
+
(0, import_defineProperty4.default)(this, "requestId", void 0);
|
|
35397
|
+
this.requestId = 0;
|
|
35398
|
+
this.runtime = {};
|
|
35399
|
+
this.links = opts.links.map((link) => link(this.runtime));
|
|
35400
|
+
}
|
|
35401
|
+
$request(opts) {
|
|
35402
|
+
var _opts$context;
|
|
35403
|
+
const chain$ = createChain({
|
|
35404
|
+
links: this.links,
|
|
35405
|
+
op: (0, import_objectSpread2$4.default)((0, import_objectSpread2$4.default)({}, opts), {}, {
|
|
35406
|
+
context: (_opts$context = opts.context) !== null && _opts$context !== void 0 ? _opts$context : {},
|
|
35407
|
+
id: ++this.requestId
|
|
35408
|
+
})
|
|
35409
|
+
});
|
|
35410
|
+
return chain$.pipe(share());
|
|
35411
|
+
}
|
|
35412
|
+
async requestAsPromise(opts) {
|
|
35413
|
+
var _this = this;
|
|
35414
|
+
try {
|
|
35415
|
+
const req$ = _this.$request(opts);
|
|
35416
|
+
const envelope = await observableToPromise(req$);
|
|
35417
|
+
const data = envelope.result.data;
|
|
35418
|
+
return data;
|
|
35419
|
+
} catch (err) {
|
|
35420
|
+
throw TRPCClientError.from(err);
|
|
35535
35421
|
}
|
|
35536
|
-
|
|
35537
|
-
|
|
35422
|
+
}
|
|
35423
|
+
query(path, input, opts) {
|
|
35424
|
+
return this.requestAsPromise({
|
|
35425
|
+
type: "query",
|
|
35426
|
+
path,
|
|
35427
|
+
input,
|
|
35428
|
+
context: opts === null || opts === void 0 ? void 0 : opts.context,
|
|
35429
|
+
signal: opts === null || opts === void 0 ? void 0 : opts.signal
|
|
35430
|
+
});
|
|
35431
|
+
}
|
|
35432
|
+
mutation(path, input, opts) {
|
|
35433
|
+
return this.requestAsPromise({
|
|
35434
|
+
type: "mutation",
|
|
35435
|
+
path,
|
|
35436
|
+
input,
|
|
35437
|
+
context: opts === null || opts === void 0 ? void 0 : opts.context,
|
|
35438
|
+
signal: opts === null || opts === void 0 ? void 0 : opts.signal
|
|
35439
|
+
});
|
|
35440
|
+
}
|
|
35441
|
+
subscription(path, input, opts) {
|
|
35442
|
+
const observable$ = this.$request({
|
|
35443
|
+
type: "subscription",
|
|
35444
|
+
path,
|
|
35445
|
+
input,
|
|
35446
|
+
context: opts.context,
|
|
35447
|
+
signal: opts.signal
|
|
35448
|
+
});
|
|
35449
|
+
return observable$.subscribe({
|
|
35450
|
+
next(envelope) {
|
|
35451
|
+
switch (envelope.result.type) {
|
|
35452
|
+
case "state": {
|
|
35453
|
+
var _opts$onConnectionSta;
|
|
35454
|
+
(_opts$onConnectionSta = opts.onConnectionStateChange) === null || _opts$onConnectionSta === void 0 || _opts$onConnectionSta.call(opts, envelope.result);
|
|
35455
|
+
break;
|
|
35456
|
+
}
|
|
35457
|
+
case "started": {
|
|
35458
|
+
var _opts$onStarted;
|
|
35459
|
+
(_opts$onStarted = opts.onStarted) === null || _opts$onStarted === void 0 || _opts$onStarted.call(opts, { context: envelope.context });
|
|
35460
|
+
break;
|
|
35461
|
+
}
|
|
35462
|
+
case "stopped": {
|
|
35463
|
+
var _opts$onStopped;
|
|
35464
|
+
(_opts$onStopped = opts.onStopped) === null || _opts$onStopped === void 0 || _opts$onStopped.call(opts);
|
|
35465
|
+
break;
|
|
35466
|
+
}
|
|
35467
|
+
case "data":
|
|
35468
|
+
case void 0: {
|
|
35469
|
+
var _opts$onData;
|
|
35470
|
+
(_opts$onData = opts.onData) === null || _opts$onData === void 0 || _opts$onData.call(opts, envelope.result.data);
|
|
35471
|
+
break;
|
|
35472
|
+
}
|
|
35473
|
+
}
|
|
35474
|
+
},
|
|
35475
|
+
error(err) {
|
|
35476
|
+
var _opts$onError;
|
|
35477
|
+
(_opts$onError = opts.onError) === null || _opts$onError === void 0 || _opts$onError.call(opts, err);
|
|
35478
|
+
},
|
|
35479
|
+
complete() {
|
|
35480
|
+
var _opts$onComplete;
|
|
35481
|
+
(_opts$onComplete = opts.onComplete) === null || _opts$onComplete === void 0 || _opts$onComplete.call(opts);
|
|
35482
|
+
}
|
|
35483
|
+
});
|
|
35538
35484
|
}
|
|
35539
35485
|
};
|
|
35540
|
-
|
|
35486
|
+
var untypedClientSymbol = /* @__PURE__ */ Symbol.for("trpc_untypedClient");
|
|
35487
|
+
var clientCallTypeMap = {
|
|
35488
|
+
query: "query",
|
|
35489
|
+
mutate: "mutation",
|
|
35490
|
+
subscribe: "subscription"
|
|
35491
|
+
};
|
|
35492
|
+
var clientCallTypeToProcedureType = /* @__PURE__ */ __name((clientCallType) => {
|
|
35493
|
+
return clientCallTypeMap[clientCallType];
|
|
35494
|
+
}, "clientCallTypeToProcedureType");
|
|
35495
|
+
function createTRPCClientProxy(client) {
|
|
35496
|
+
const proxy = createRecursiveProxy(({ path, args }) => {
|
|
35497
|
+
const pathCopy = [...path];
|
|
35498
|
+
const procedureType = clientCallTypeToProcedureType(pathCopy.pop());
|
|
35499
|
+
const fullPath = pathCopy.join(".");
|
|
35500
|
+
return client[procedureType](fullPath, ...args);
|
|
35501
|
+
});
|
|
35502
|
+
return createFlatProxy((key) => {
|
|
35503
|
+
if (key === untypedClientSymbol) return client;
|
|
35504
|
+
return proxy[key];
|
|
35505
|
+
});
|
|
35506
|
+
}
|
|
35507
|
+
__name(createTRPCClientProxy, "createTRPCClientProxy");
|
|
35508
|
+
function createTRPCClient(opts) {
|
|
35509
|
+
const client = new TRPCUntypedClient(opts);
|
|
35510
|
+
const proxy = createTRPCClientProxy(client);
|
|
35511
|
+
return proxy;
|
|
35512
|
+
}
|
|
35513
|
+
__name(createTRPCClient, "createTRPCClient");
|
|
35514
|
+
var import_objectSpread2$3 = __toESM2(require_objectSpread2(), 1);
|
|
35515
|
+
var import_objectSpread2$2 = __toESM2(require_objectSpread2(), 1);
|
|
35516
|
+
var require_asyncIterator = __commonJS2({ "../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/asyncIterator.js"(exports, module) {
|
|
35517
|
+
function _asyncIterator$1(r) {
|
|
35518
|
+
var n, t, o, e = 2;
|
|
35519
|
+
for ("undefined" != typeof Symbol && (t = Symbol.asyncIterator, o = Symbol.iterator); e--; ) {
|
|
35520
|
+
if (t && null != (n = r[t])) return n.call(r);
|
|
35521
|
+
if (o && null != (n = r[o])) return new AsyncFromSyncIterator(n.call(r));
|
|
35522
|
+
t = "@@asyncIterator", o = "@@iterator";
|
|
35523
|
+
}
|
|
35524
|
+
throw new TypeError("Object is not async iterable");
|
|
35525
|
+
}
|
|
35526
|
+
__name(_asyncIterator$1, "_asyncIterator$1");
|
|
35527
|
+
function AsyncFromSyncIterator(r) {
|
|
35528
|
+
function AsyncFromSyncIteratorContinuation(r$1) {
|
|
35529
|
+
if (Object(r$1) !== r$1) return Promise.reject(new TypeError(r$1 + " is not an object."));
|
|
35530
|
+
var n = r$1.done;
|
|
35531
|
+
return Promise.resolve(r$1.value).then(function(r$2) {
|
|
35532
|
+
return {
|
|
35533
|
+
value: r$2,
|
|
35534
|
+
done: n
|
|
35535
|
+
};
|
|
35536
|
+
});
|
|
35537
|
+
}
|
|
35538
|
+
__name(AsyncFromSyncIteratorContinuation, "AsyncFromSyncIteratorContinuation");
|
|
35539
|
+
return AsyncFromSyncIterator = /* @__PURE__ */ __name(function AsyncFromSyncIterator$1(r$1) {
|
|
35540
|
+
this.s = r$1, this.n = r$1.next;
|
|
35541
|
+
}, "AsyncFromSyncIterator$1"), AsyncFromSyncIterator.prototype = {
|
|
35542
|
+
s: null,
|
|
35543
|
+
n: null,
|
|
35544
|
+
next: /* @__PURE__ */ __name(function next() {
|
|
35545
|
+
return AsyncFromSyncIteratorContinuation(this.n.apply(this.s, arguments));
|
|
35546
|
+
}, "next"),
|
|
35547
|
+
"return": /* @__PURE__ */ __name(function _return(r$1) {
|
|
35548
|
+
var n = this.s["return"];
|
|
35549
|
+
return void 0 === n ? Promise.resolve({
|
|
35550
|
+
value: r$1,
|
|
35551
|
+
done: true
|
|
35552
|
+
}) : AsyncFromSyncIteratorContinuation(n.apply(this.s, arguments));
|
|
35553
|
+
}, "_return"),
|
|
35554
|
+
"throw": /* @__PURE__ */ __name(function _throw(r$1) {
|
|
35555
|
+
var n = this.s["return"];
|
|
35556
|
+
return void 0 === n ? Promise.reject(r$1) : AsyncFromSyncIteratorContinuation(n.apply(this.s, arguments));
|
|
35557
|
+
}, "_throw")
|
|
35558
|
+
}, new AsyncFromSyncIterator(r);
|
|
35559
|
+
}
|
|
35560
|
+
__name(AsyncFromSyncIterator, "AsyncFromSyncIterator");
|
|
35561
|
+
module.exports = _asyncIterator$1, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
35562
|
+
} });
|
|
35563
|
+
var import_asyncIterator = __toESM2(require_asyncIterator(), 1);
|
|
35564
|
+
var import_objectSpread2$12 = __toESM2(require_objectSpread2(), 1);
|
|
35565
|
+
var require_usingCtx = __commonJS2({ "../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/usingCtx.js"(exports, module) {
|
|
35566
|
+
function _usingCtx() {
|
|
35567
|
+
var r = "function" == typeof SuppressedError ? SuppressedError : function(r$1, e$1) {
|
|
35568
|
+
var n$1 = Error();
|
|
35569
|
+
return n$1.name = "SuppressedError", n$1.error = r$1, n$1.suppressed = e$1, n$1;
|
|
35570
|
+
}, e = {}, n = [];
|
|
35571
|
+
function using(r$1, e$1) {
|
|
35572
|
+
if (null != e$1) {
|
|
35573
|
+
if (Object(e$1) !== e$1) throw new TypeError("using declarations can only be used with objects, functions, null, or undefined.");
|
|
35574
|
+
if (r$1) var o = e$1[Symbol.asyncDispose || Symbol["for"]("Symbol.asyncDispose")];
|
|
35575
|
+
if (void 0 === o && (o = e$1[Symbol.dispose || Symbol["for"]("Symbol.dispose")], r$1)) var t = o;
|
|
35576
|
+
if ("function" != typeof o) throw new TypeError("Object is not disposable.");
|
|
35577
|
+
t && (o = /* @__PURE__ */ __name(function o$1() {
|
|
35578
|
+
try {
|
|
35579
|
+
t.call(e$1);
|
|
35580
|
+
} catch (r$2) {
|
|
35581
|
+
return Promise.reject(r$2);
|
|
35582
|
+
}
|
|
35583
|
+
}, "o$1")), n.push({
|
|
35584
|
+
v: e$1,
|
|
35585
|
+
d: o,
|
|
35586
|
+
a: r$1
|
|
35587
|
+
});
|
|
35588
|
+
} else r$1 && n.push({
|
|
35589
|
+
d: e$1,
|
|
35590
|
+
a: r$1
|
|
35591
|
+
});
|
|
35592
|
+
return e$1;
|
|
35593
|
+
}
|
|
35594
|
+
__name(using, "using");
|
|
35595
|
+
return {
|
|
35596
|
+
e,
|
|
35597
|
+
u: using.bind(null, false),
|
|
35598
|
+
a: using.bind(null, true),
|
|
35599
|
+
d: /* @__PURE__ */ __name(function d() {
|
|
35600
|
+
var o, t = this.e, s = 0;
|
|
35601
|
+
function next() {
|
|
35602
|
+
for (; o = n.pop(); ) try {
|
|
35603
|
+
if (!o.a && 1 === s) return s = 0, n.push(o), Promise.resolve().then(next);
|
|
35604
|
+
if (o.d) {
|
|
35605
|
+
var r$1 = o.d.call(o.v);
|
|
35606
|
+
if (o.a) return s |= 2, Promise.resolve(r$1).then(next, err);
|
|
35607
|
+
} else s |= 1;
|
|
35608
|
+
} catch (r$2) {
|
|
35609
|
+
return err(r$2);
|
|
35610
|
+
}
|
|
35611
|
+
if (1 === s) return t !== e ? Promise.reject(t) : Promise.resolve();
|
|
35612
|
+
if (t !== e) throw t;
|
|
35613
|
+
}
|
|
35614
|
+
__name(next, "next");
|
|
35615
|
+
function err(n$1) {
|
|
35616
|
+
return t = t !== e ? new r(n$1, t) : n$1, next();
|
|
35617
|
+
}
|
|
35618
|
+
__name(err, "err");
|
|
35619
|
+
return next();
|
|
35620
|
+
}, "d")
|
|
35621
|
+
};
|
|
35622
|
+
}
|
|
35623
|
+
__name(_usingCtx, "_usingCtx");
|
|
35624
|
+
module.exports = _usingCtx, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
35625
|
+
} });
|
|
35626
|
+
var require_OverloadYield = __commonJS2({ "../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/OverloadYield.js"(exports, module) {
|
|
35627
|
+
function _OverloadYield(e, d) {
|
|
35628
|
+
this.v = e, this.k = d;
|
|
35629
|
+
}
|
|
35630
|
+
__name(_OverloadYield, "_OverloadYield");
|
|
35631
|
+
module.exports = _OverloadYield, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
35632
|
+
} });
|
|
35633
|
+
var require_awaitAsyncGenerator = __commonJS2({ "../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/awaitAsyncGenerator.js"(exports, module) {
|
|
35634
|
+
var OverloadYield$1 = require_OverloadYield();
|
|
35635
|
+
function _awaitAsyncGenerator$1(e) {
|
|
35636
|
+
return new OverloadYield$1(e, 0);
|
|
35637
|
+
}
|
|
35638
|
+
__name(_awaitAsyncGenerator$1, "_awaitAsyncGenerator$1");
|
|
35639
|
+
module.exports = _awaitAsyncGenerator$1, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
35640
|
+
} });
|
|
35641
|
+
var require_wrapAsyncGenerator = __commonJS2({ "../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/wrapAsyncGenerator.js"(exports, module) {
|
|
35642
|
+
var OverloadYield = require_OverloadYield();
|
|
35643
|
+
function _wrapAsyncGenerator$1(e) {
|
|
35644
|
+
return function() {
|
|
35645
|
+
return new AsyncGenerator(e.apply(this, arguments));
|
|
35646
|
+
};
|
|
35647
|
+
}
|
|
35648
|
+
__name(_wrapAsyncGenerator$1, "_wrapAsyncGenerator$1");
|
|
35649
|
+
function AsyncGenerator(e) {
|
|
35650
|
+
var r, t;
|
|
35651
|
+
function resume(r$1, t$1) {
|
|
35652
|
+
try {
|
|
35653
|
+
var n = e[r$1](t$1), o = n.value, u = o instanceof OverloadYield;
|
|
35654
|
+
Promise.resolve(u ? o.v : o).then(function(t$2) {
|
|
35655
|
+
if (u) {
|
|
35656
|
+
var i = "return" === r$1 ? "return" : "next";
|
|
35657
|
+
if (!o.k || t$2.done) return resume(i, t$2);
|
|
35658
|
+
t$2 = e[i](t$2).value;
|
|
35659
|
+
}
|
|
35660
|
+
settle(n.done ? "return" : "normal", t$2);
|
|
35661
|
+
}, function(e$1) {
|
|
35662
|
+
resume("throw", e$1);
|
|
35663
|
+
});
|
|
35664
|
+
} catch (e$1) {
|
|
35665
|
+
settle("throw", e$1);
|
|
35666
|
+
}
|
|
35667
|
+
}
|
|
35668
|
+
__name(resume, "resume");
|
|
35669
|
+
function settle(e$1, n) {
|
|
35670
|
+
switch (e$1) {
|
|
35671
|
+
case "return":
|
|
35672
|
+
r.resolve({
|
|
35673
|
+
value: n,
|
|
35674
|
+
done: true
|
|
35675
|
+
});
|
|
35676
|
+
break;
|
|
35677
|
+
case "throw":
|
|
35678
|
+
r.reject(n);
|
|
35679
|
+
break;
|
|
35680
|
+
default:
|
|
35681
|
+
r.resolve({
|
|
35682
|
+
value: n,
|
|
35683
|
+
done: false
|
|
35684
|
+
});
|
|
35685
|
+
}
|
|
35686
|
+
(r = r.next) ? resume(r.key, r.arg) : t = null;
|
|
35687
|
+
}
|
|
35688
|
+
__name(settle, "settle");
|
|
35689
|
+
this._invoke = function(e$1, n) {
|
|
35690
|
+
return new Promise(function(o, u) {
|
|
35691
|
+
var i = {
|
|
35692
|
+
key: e$1,
|
|
35693
|
+
arg: n,
|
|
35694
|
+
resolve: o,
|
|
35695
|
+
reject: u,
|
|
35696
|
+
next: null
|
|
35697
|
+
};
|
|
35698
|
+
t ? t = t.next = i : (r = t = i, resume(e$1, n));
|
|
35699
|
+
});
|
|
35700
|
+
}, "function" != typeof e["return"] && (this["return"] = void 0);
|
|
35701
|
+
}
|
|
35702
|
+
__name(AsyncGenerator, "AsyncGenerator");
|
|
35703
|
+
AsyncGenerator.prototype["function" == typeof Symbol && Symbol.asyncIterator || "@@asyncIterator"] = function() {
|
|
35704
|
+
return this;
|
|
35705
|
+
}, AsyncGenerator.prototype.next = function(e) {
|
|
35706
|
+
return this._invoke("next", e);
|
|
35707
|
+
}, AsyncGenerator.prototype["throw"] = function(e) {
|
|
35708
|
+
return this._invoke("throw", e);
|
|
35709
|
+
}, AsyncGenerator.prototype["return"] = function(e) {
|
|
35710
|
+
return this._invoke("return", e);
|
|
35711
|
+
};
|
|
35712
|
+
module.exports = _wrapAsyncGenerator$1, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
35713
|
+
} });
|
|
35714
|
+
var import_usingCtx = __toESM2(require_usingCtx(), 1);
|
|
35715
|
+
var import_awaitAsyncGenerator = __toESM2(require_awaitAsyncGenerator(), 1);
|
|
35716
|
+
var import_wrapAsyncGenerator = __toESM2(require_wrapAsyncGenerator(), 1);
|
|
35717
|
+
var import_objectSpread29 = __toESM2(require_objectSpread2(), 1);
|
|
35541
35718
|
|
|
35542
35719
|
// src/callbackLink.ts
|
|
35543
35720
|
var callbackLink = /* @__PURE__ */ __name((callback) => {
|
|
@@ -35671,9 +35848,6 @@ export {
|
|
|
35671
35848
|
};
|
|
35672
35849
|
/*! Bundled license information:
|
|
35673
35850
|
|
|
35674
|
-
@trpc/client/dist/
|
|
35851
|
+
@trpc/client/dist/httpBatchLink-BOe5aCcR.mjs:
|
|
35675
35852
|
(* istanbul ignore if -- @preserve *)
|
|
35676
|
-
|
|
35677
|
-
@trpc/client/dist/links/retryLink.mjs:
|
|
35678
|
-
(* istanbul ignore file -- @preserve *)
|
|
35679
35853
|
*/
|