@compilot/js-sdk 2.142.0-dev → 2.144.0-dev

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.
@@ -10,274 +10,116 @@ var zod = require('zod');
10
10
  var webhooks = require('@nexeraid/identity-schemas/webhooks');
11
11
  var svix = require('svix');
12
12
 
13
- function _regeneratorRuntime() {
14
- _regeneratorRuntime = function () {
15
- return r;
16
- };
17
- var t,
18
- r = {},
19
- e = Object.prototype,
20
- n = e.hasOwnProperty,
21
- o = "function" == typeof Symbol ? Symbol : {},
22
- i = o.iterator || "@@iterator",
23
- a = o.asyncIterator || "@@asyncIterator",
24
- u = o.toStringTag || "@@toStringTag";
25
- function c(t, r, e, n) {
26
- Object.defineProperty(t, r, {
27
- value: e,
28
- enumerable: !n,
29
- configurable: !n,
30
- writable: !n
31
- });
32
- }
13
+ function _regeneratorDefine(e, r, n, t) {
14
+ var i = Object.defineProperty;
33
15
  try {
34
- c({}, "");
35
- } catch (t) {
36
- c = function (t, r, e) {
37
- return t[r] = e;
38
- };
16
+ i({}, "", {});
17
+ } catch (e) {
18
+ i = 0;
39
19
  }
40
- function h(r, e, n, o) {
41
- var i = e && e.prototype instanceof Generator ? e : Generator,
42
- a = Object.create(i.prototype);
43
- return c(a, "_invoke", function (r, e, n) {
44
- var o = 1;
45
- return function (i, a) {
46
- if (3 === o) throw Error("Generator is already running");
47
- if (4 === o) {
48
- if ("throw" === i) throw a;
49
- return {
50
- value: t,
51
- done: !0
52
- };
53
- }
54
- for (n.method = i, n.arg = a;;) {
55
- var u = n.delegate;
56
- if (u) {
57
- var c = d(u, n);
58
- if (c) {
59
- if (c === f) continue;
60
- return c;
61
- }
20
+ _regeneratorDefine = function (e, r, n, t) {
21
+ if (r) i ? i(e, r, {
22
+ value: n,
23
+ enumerable: !t,
24
+ configurable: !t,
25
+ writable: !t
26
+ }) : e[r] = n;else {
27
+ function o(r, n) {
28
+ _regeneratorDefine(e, r, function (e) {
29
+ return this._invoke(r, n, e);
30
+ });
31
+ }
32
+ o("next", 0), o("throw", 1), o("return", 2);
33
+ }
34
+ }, _regeneratorDefine(e, r, n, t);
35
+ }
36
+
37
+ function _regenerator() {
38
+ /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
39
+ var e,
40
+ t,
41
+ r = "function" == typeof Symbol ? Symbol : {},
42
+ n = r.iterator || "@@iterator",
43
+ o = r.toStringTag || "@@toStringTag";
44
+ function i(r, n, o, i) {
45
+ var c = n && n.prototype instanceof Generator ? n : Generator,
46
+ u = Object.create(c.prototype);
47
+ return _regeneratorDefine(u, "_invoke", function (r, n, o) {
48
+ var i,
49
+ c,
50
+ u,
51
+ f = 0,
52
+ p = o || [],
53
+ y = !1,
54
+ G = {
55
+ p: 0,
56
+ n: 0,
57
+ v: e,
58
+ a: d,
59
+ f: d.bind(e, 4),
60
+ d: function (t, r) {
61
+ return i = t, c = 0, u = e, G.n = r, a;
62
62
  }
63
- if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
64
- if (1 === o) throw o = 4, n.arg;
65
- n.dispatchException(n.arg);
66
- } else "return" === n.method && n.abrupt("return", n.arg);
67
- o = 3;
68
- var h = s(r, e, n);
69
- if ("normal" === h.type) {
70
- if (o = n.done ? 4 : 2, h.arg === f) continue;
71
- return {
72
- value: h.arg,
73
- done: n.done
74
- };
63
+ };
64
+ function d(r, n) {
65
+ for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) {
66
+ var o,
67
+ i = p[t],
68
+ d = G.p,
69
+ l = i[2];
70
+ r > 3 ? (o = l === n) && (c = i[4] || 3, u = i[5] === e ? i[3] : i[5], i[4] = 3, i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0));
71
+ }
72
+ if (o || r > 1) return a;
73
+ throw y = !0, n;
74
+ }
75
+ return function (o, p, l) {
76
+ if (f > 1) throw TypeError("Generator is already running");
77
+ for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) {
78
+ i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u);
79
+ try {
80
+ if (f = 2, i) {
81
+ if (c || (o = "next"), t = i[o]) {
82
+ if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object");
83
+ if (!t.done) return t;
84
+ u = t.value, c < 2 && (c = 0);
85
+ } else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1);
86
+ i = e;
87
+ } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break;
88
+ } catch (t) {
89
+ i = e, c = 1, u = t;
90
+ } finally {
91
+ f = 1;
75
92
  }
76
- "throw" === h.type && (o = 4, n.method = "throw", n.arg = h.arg);
77
93
  }
94
+ return {
95
+ value: t,
96
+ done: y
97
+ };
78
98
  };
79
- }(r, n, new Context(o || [])), !0), a;
80
- }
81
- function s(t, r, e) {
82
- try {
83
- return {
84
- type: "normal",
85
- arg: t.call(r, e)
86
- };
87
- } catch (t) {
88
- return {
89
- type: "throw",
90
- arg: t
91
- };
92
- }
99
+ }(r, o, i), !0), u;
93
100
  }
94
- r.wrap = h;
95
- var f = {};
101
+ var a = {};
96
102
  function Generator() {}
97
103
  function GeneratorFunction() {}
98
104
  function GeneratorFunctionPrototype() {}
99
- var l = {};
100
- c(l, i, function () {
101
- return this;
102
- });
103
- var p = Object.getPrototypeOf,
104
- y = p && p(p(x([])));
105
- y && y !== e && n.call(y, i) && (l = y);
106
- var v = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(l);
107
- function g(t) {
108
- ["next", "throw", "return"].forEach(function (r) {
109
- c(t, r, function (t) {
110
- return this._invoke(r, t);
111
- });
112
- });
105
+ t = Object.getPrototypeOf;
106
+ var c = [][n] ? t(t([][n]())) : (_regeneratorDefine(t = {}, n, function () {
107
+ return this;
108
+ }), t),
109
+ u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c);
110
+ function f(e) {
111
+ return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e;
113
112
  }
114
- function AsyncIterator(t, r) {
115
- function e(o, i, a, u) {
116
- var c = s(t[o], t, i);
117
- if ("throw" !== c.type) {
118
- var h = c.arg,
119
- f = h.value;
120
- return f && "object" == typeof f && n.call(f, "__await") ? r.resolve(f.__await).then(function (t) {
121
- e("next", t, a, u);
122
- }, function (t) {
123
- e("throw", t, a, u);
124
- }) : r.resolve(f).then(function (t) {
125
- h.value = t, a(h);
126
- }, function (t) {
127
- return e("throw", t, a, u);
128
- });
129
- }
130
- u(c.arg);
131
- }
132
- var o;
133
- c(this, "_invoke", function (t, n) {
134
- function i() {
135
- return new r(function (r, o) {
136
- e(t, n, r, o);
137
- });
138
- }
139
- return o = o ? o.then(i, i) : i();
140
- }, !0);
141
- }
142
- function d(r, e) {
143
- var n = e.method,
144
- o = r.i[n];
145
- if (o === t) return e.delegate = null, "throw" === n && r.i.return && (e.method = "return", e.arg = t, d(r, e), "throw" === e.method) || "return" !== n && (e.method = "throw", e.arg = new TypeError("The iterator does not provide a '" + n + "' method")), f;
146
- var i = s(o, r.i, e.arg);
147
- if ("throw" === i.type) return e.method = "throw", e.arg = i.arg, e.delegate = null, f;
148
- var a = i.arg;
149
- return a ? a.done ? (e[r.r] = a.value, e.next = r.n, "return" !== e.method && (e.method = "next", e.arg = t), e.delegate = null, f) : a : (e.method = "throw", e.arg = new TypeError("iterator result is not an object"), e.delegate = null, f);
150
- }
151
- function w(t) {
152
- this.tryEntries.push(t);
153
- }
154
- function m(r) {
155
- var e = r[4] || {};
156
- e.type = "normal", e.arg = t, r[4] = e;
157
- }
158
- function Context(t) {
159
- this.tryEntries = [[-1]], t.forEach(w, this), this.reset(!0);
160
- }
161
- function x(r) {
162
- if (null != r) {
163
- var e = r[i];
164
- if (e) return e.call(r);
165
- if ("function" == typeof r.next) return r;
166
- if (!isNaN(r.length)) {
167
- var o = -1,
168
- a = function e() {
169
- for (; ++o < r.length;) if (n.call(r, o)) return e.value = r[o], e.done = !1, e;
170
- return e.value = t, e.done = !0, e;
171
- };
172
- return a.next = a;
173
- }
174
- }
175
- throw new TypeError(typeof r + " is not iterable");
176
- }
177
- return GeneratorFunction.prototype = GeneratorFunctionPrototype, c(v, "constructor", GeneratorFunctionPrototype), c(GeneratorFunctionPrototype, "constructor", GeneratorFunction), c(GeneratorFunctionPrototype, u, GeneratorFunction.displayName = "GeneratorFunction"), r.isGeneratorFunction = function (t) {
178
- var r = "function" == typeof t && t.constructor;
179
- return !!r && (r === GeneratorFunction || "GeneratorFunction" === (r.displayName || r.name));
180
- }, r.mark = function (t) {
181
- return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, c(t, u, "GeneratorFunction")), t.prototype = Object.create(v), t;
182
- }, r.awrap = function (t) {
183
- return {
184
- __await: t
185
- };
186
- }, g(AsyncIterator.prototype), c(AsyncIterator.prototype, a, function () {
113
+ return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine(u), _regeneratorDefine(u, o, "Generator"), _regeneratorDefine(u, n, function () {
187
114
  return this;
188
- }), r.AsyncIterator = AsyncIterator, r.async = function (t, e, n, o, i) {
189
- void 0 === i && (i = Promise);
190
- var a = new AsyncIterator(h(t, e, n, o), i);
191
- return r.isGeneratorFunction(e) ? a : a.next().then(function (t) {
192
- return t.done ? t.value : a.next();
193
- });
194
- }, g(v), c(v, u, "Generator"), c(v, i, function () {
195
- return this;
196
- }), c(v, "toString", function () {
115
+ }), _regeneratorDefine(u, "toString", function () {
197
116
  return "[object Generator]";
198
- }), r.keys = function (t) {
199
- var r = Object(t),
200
- e = [];
201
- for (var n in r) e.unshift(n);
202
- return function t() {
203
- for (; e.length;) if ((n = e.pop()) in r) return t.value = n, t.done = !1, t;
204
- return t.done = !0, t;
117
+ }), (_regenerator = function () {
118
+ return {
119
+ w: i,
120
+ m: f
205
121
  };
206
- }, r.values = x, Context.prototype = {
207
- constructor: Context,
208
- reset: function (r) {
209
- if (this.prev = this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(m), !r) for (var e in this) "t" === e.charAt(0) && n.call(this, e) && !isNaN(+e.slice(1)) && (this[e] = t);
210
- },
211
- stop: function () {
212
- this.done = !0;
213
- var t = this.tryEntries[0][4];
214
- if ("throw" === t.type) throw t.arg;
215
- return this.rval;
216
- },
217
- dispatchException: function (r) {
218
- if (this.done) throw r;
219
- var e = this;
220
- function n(t) {
221
- a.type = "throw", a.arg = r, e.next = t;
222
- }
223
- for (var o = e.tryEntries.length - 1; o >= 0; --o) {
224
- var i = this.tryEntries[o],
225
- a = i[4],
226
- u = this.prev,
227
- c = i[1],
228
- h = i[2];
229
- if (-1 === i[0]) return n("end"), !1;
230
- if (!c && !h) throw Error("try statement without catch or finally");
231
- if (null != i[0] && i[0] <= u) {
232
- if (u < c) return this.method = "next", this.arg = t, n(c), !0;
233
- if (u < h) return n(h), !1;
234
- }
235
- }
236
- },
237
- abrupt: function (t, r) {
238
- for (var e = this.tryEntries.length - 1; e >= 0; --e) {
239
- var n = this.tryEntries[e];
240
- if (n[0] > -1 && n[0] <= this.prev && this.prev < n[2]) {
241
- var o = n;
242
- break;
243
- }
244
- }
245
- o && ("break" === t || "continue" === t) && o[0] <= r && r <= o[2] && (o = null);
246
- var i = o ? o[4] : {};
247
- return i.type = t, i.arg = r, o ? (this.method = "next", this.next = o[2], f) : this.complete(i);
248
- },
249
- complete: function (t, r) {
250
- if ("throw" === t.type) throw t.arg;
251
- return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && r && (this.next = r), f;
252
- },
253
- finish: function (t) {
254
- for (var r = this.tryEntries.length - 1; r >= 0; --r) {
255
- var e = this.tryEntries[r];
256
- if (e[2] === t) return this.complete(e[4], e[3]), m(e), f;
257
- }
258
- },
259
- catch: function (t) {
260
- for (var r = this.tryEntries.length - 1; r >= 0; --r) {
261
- var e = this.tryEntries[r];
262
- if (e[0] === t) {
263
- var n = e[4];
264
- if ("throw" === n.type) {
265
- var o = n.arg;
266
- m(e);
267
- }
268
- return o;
269
- }
270
- }
271
- throw Error("illegal catch attempt");
272
- },
273
- delegateYield: function (r, e, n) {
274
- return this.delegate = {
275
- i: x(r),
276
- r: e,
277
- n: n
278
- }, "next" === this.method && (this.arg = t), f;
279
- }
280
- }, r;
122
+ })();
281
123
  }
282
124
 
283
125
  function asyncGeneratorStep(n, t, e, r, o, a, c) {
@@ -349,27 +191,24 @@ var attachCustomerInformationFactory = function attachCustomerInformationFactory
349
191
  compilotApiClient = _ref.compilotApiClient;
350
192
  var externalIdToCustomerIdMap = new Map();
351
193
  var getCustomerId = /*#__PURE__*/function () {
352
- var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(externalCustomerId) {
194
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(externalCustomerId) {
353
195
  var customer;
354
- return _regeneratorRuntime().wrap(function _callee$(_context) {
355
- while (1) switch (_context.prev = _context.next) {
196
+ return _regenerator().w(function (_context) {
197
+ while (1) switch (_context.n) {
356
198
  case 0:
357
199
  if (externalIdToCustomerIdMap.has(externalCustomerId)) {
358
- _context.next = 5;
200
+ _context.n = 2;
359
201
  break;
360
202
  }
361
- _context.next = 3;
203
+ _context.n = 1;
362
204
  return compilotApiClient.customers.internalCustomerRouterGetCustomerByExternalCustomerId({
363
205
  externalCustomerId: externalCustomerId
364
206
  });
365
- case 3:
366
- customer = _context.sent;
207
+ case 1:
208
+ customer = _context.v;
367
209
  externalIdToCustomerIdMap.set(externalCustomerId, customer.id);
368
- case 5:
369
- return _context.abrupt("return", externalIdToCustomerIdMap.get(externalCustomerId));
370
- case 6:
371
- case "end":
372
- return _context.stop();
210
+ case 2:
211
+ return _context.a(2, externalIdToCustomerIdMap.get(externalCustomerId));
373
212
  }
374
213
  }, _callee);
375
214
  }));
@@ -378,115 +217,115 @@ var attachCustomerInformationFactory = function attachCustomerInformationFactory
378
217
  };
379
218
  }();
380
219
  return /*#__PURE__*/function () {
381
- var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(params) {
220
+ var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(params) {
382
221
  var customerId, emails, emailExists, _customerId, phones, phoneExists, _customerId2, wallet, wallets, walletExists;
383
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
384
- while (1) switch (_context2.prev = _context2.next) {
222
+ return _regenerator().w(function (_context2) {
223
+ while (1) switch (_context2.n) {
385
224
  case 0:
386
225
  if (!params.information.email) {
387
- _context2.next = 13;
226
+ _context2.n = 3;
388
227
  break;
389
228
  }
390
- _context2.next = 3;
229
+ _context2.n = 1;
391
230
  return getCustomerId(params.externalCustomerId);
392
- case 3:
393
- customerId = _context2.sent;
231
+ case 1:
232
+ customerId = _context2.v;
394
233
  logger.debug({
395
234
  msg: "Fetching emails for customer",
396
235
  customerId: customerId
397
236
  });
398
- _context2.next = 7;
237
+ _context2.n = 2;
399
238
  return compilotApiClient.customers.internalCustomerRouterEmailsGetCustomerEmails({
400
239
  customerId: customerId
401
240
  });
402
- case 7:
403
- emails = _context2.sent;
241
+ case 2:
242
+ emails = _context2.v;
404
243
  emailExists = emails.some(function (row) {
405
244
  return row.email === params.information.email;
406
245
  });
407
246
  if (emailExists) {
408
- _context2.next = 13;
247
+ _context2.n = 3;
409
248
  break;
410
249
  }
411
250
  logger.info({
412
251
  msg: "Creating email for customer",
413
252
  customerId: customerId
414
253
  });
415
- _context2.next = 13;
254
+ _context2.n = 3;
416
255
  return compilotApiClient.customers.internalCustomerRouterEmailsCreateCustomerEmail({
417
256
  customerId: customerId,
418
257
  requestBody: {
419
258
  email: params.information.email
420
259
  }
421
260
  });
422
- case 13:
261
+ case 3:
423
262
  if (!params.information.phone) {
424
- _context2.next = 26;
263
+ _context2.n = 6;
425
264
  break;
426
265
  }
427
- _context2.next = 16;
266
+ _context2.n = 4;
428
267
  return getCustomerId(params.externalCustomerId);
429
- case 16:
430
- _customerId = _context2.sent;
268
+ case 4:
269
+ _customerId = _context2.v;
431
270
  logger.debug({
432
271
  msg: "Fetching phones for customer",
433
272
  customerId: _customerId
434
273
  });
435
- _context2.next = 20;
274
+ _context2.n = 5;
436
275
  return compilotApiClient.customers.internalCustomerRouterPhoneNumbersGetCustomerPhoneNumbers({
437
276
  customerId: _customerId
438
277
  });
439
- case 20:
440
- phones = _context2.sent;
278
+ case 5:
279
+ phones = _context2.v;
441
280
  phoneExists = phones.some(function (row) {
442
281
  return row.phoneNumber === params.information.phone;
443
282
  });
444
283
  if (phoneExists) {
445
- _context2.next = 26;
284
+ _context2.n = 6;
446
285
  break;
447
286
  }
448
287
  logger.info({
449
288
  msg: "Creating phone for customer",
450
289
  customerId: _customerId
451
290
  });
452
- _context2.next = 26;
291
+ _context2.n = 6;
453
292
  return compilotApiClient.customers.internalCustomerRouterPhoneNumbersCreateCustomerPhoneNumber({
454
293
  customerId: _customerId,
455
294
  requestBody: {
456
295
  phoneNumber: params.information.phone
457
296
  }
458
297
  });
459
- case 26:
298
+ case 6:
460
299
  if (!params.information.wallet) {
461
- _context2.next = 40;
300
+ _context2.n = 9;
462
301
  break;
463
302
  }
464
- _context2.next = 29;
303
+ _context2.n = 7;
465
304
  return getCustomerId(params.externalCustomerId);
466
- case 29:
467
- _customerId2 = _context2.sent;
305
+ case 7:
306
+ _customerId2 = _context2.v;
468
307
  logger.debug({
469
308
  msg: "Fetching wallets for customer",
470
309
  customerId: _customerId2
471
310
  });
472
311
  wallet = params.information.wallet;
473
- _context2.next = 34;
312
+ _context2.n = 8;
474
313
  return compilotApiClient.customers.internalCustomerRouterWalletsGetCustomerWallets({
475
314
  customerId: _customerId2
476
315
  });
477
- case 34:
478
- wallets = _context2.sent;
316
+ case 8:
317
+ wallets = _context2.v;
479
318
  walletExists = wallets.some(function (row) {
480
319
  return row.wallet === wallet.address && row.blockchainNamespace === wallet.namespace;
481
320
  });
482
321
  if (walletExists) {
483
- _context2.next = 40;
322
+ _context2.n = 9;
484
323
  break;
485
324
  }
486
325
  logger.info("Creating wallet for customer", {
487
326
  customerId: _customerId2
488
327
  });
489
- _context2.next = 40;
328
+ _context2.n = 9;
490
329
  return compilotApiClient.customers.internalCustomerRouterWalletsCreateCustomerWallet({
491
330
  customerId: _customerId2,
492
331
  requestBody: {
@@ -494,9 +333,8 @@ var attachCustomerInformationFactory = function attachCustomerInformationFactory
494
333
  blockchainNamespace: wallet.namespace
495
334
  }
496
335
  });
497
- case 40:
498
- case "end":
499
- return _context2.stop();
336
+ case 9:
337
+ return _context2.a(2);
500
338
  }
501
339
  }, _callee2);
502
340
  }));
@@ -566,21 +404,18 @@ var attachCustomerInformationFactory = function attachCustomerInformationFactory
566
404
  /** @hidden */
567
405
  var createWeb2SessionFactory = function createWeb2SessionFactory(deps) {
568
406
  return /*#__PURE__*/function () {
569
- var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(params) {
407
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(params) {
570
408
  var res;
571
- return _regeneratorRuntime().wrap(function _callee$(_context) {
572
- while (1) switch (_context.prev = _context.next) {
409
+ return _regenerator().w(function (_context) {
410
+ while (1) switch (_context.n) {
573
411
  case 0:
574
- _context.next = 2;
412
+ _context.n = 1;
575
413
  return deps.identityApiClient.auth.createSession({
576
414
  requestBody: params
577
415
  });
578
- case 2:
579
- res = _context.sent;
580
- return _context.abrupt("return", res);
581
- case 4:
582
- case "end":
583
- return _context.stop();
416
+ case 1:
417
+ res = _context.v;
418
+ return _context.a(2, res);
584
419
  }
585
420
  }, _callee);
586
421
  }));
@@ -650,21 +485,18 @@ var createWeb2SessionFactory = function createWeb2SessionFactory(deps) {
650
485
  /** @hidden */
651
486
  var createWeb3ChallengeFactory = function createWeb3ChallengeFactory(deps) {
652
487
  return /*#__PURE__*/function () {
653
- var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(params) {
488
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(params) {
654
489
  var res;
655
- return _regeneratorRuntime().wrap(function _callee$(_context) {
656
- while (1) switch (_context.prev = _context.next) {
490
+ return _regenerator().w(function (_context) {
491
+ while (1) switch (_context.n) {
657
492
  case 0:
658
- _context.next = 2;
493
+ _context.n = 1;
659
494
  return deps.identityApiClient.auth.createWalletChallenge({
660
495
  requestBody: params
661
496
  });
662
- case 2:
663
- res = _context.sent;
664
- return _context.abrupt("return", res);
665
- case 4:
666
- case "end":
667
- return _context.stop();
497
+ case 1:
498
+ res = _context.v;
499
+ return _context.a(2, res);
668
500
  }
669
501
  }, _callee);
670
502
  }));
@@ -697,19 +529,16 @@ var createWeb3ChallengeFactory = function createWeb3ChallengeFactory(deps) {
697
529
  /** @hidden */
698
530
  var getCustomerSessionDataFactory = function getCustomerSessionDataFactory(deps) {
699
531
  return /*#__PURE__*/function () {
700
- var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(params) {
532
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(params) {
701
533
  var identityApiClient$1;
702
- return _regeneratorRuntime().wrap(function _callee$(_context) {
703
- while (1) switch (_context.prev = _context.next) {
534
+ return _regenerator().w(function (_context) {
535
+ while (1) switch (_context.n) {
704
536
  case 0:
705
537
  identityApiClient$1 = identityApiClient.createIdentityApiClient({
706
538
  env: deps.env,
707
539
  jwt: params.authSession.token
708
540
  });
709
- return _context.abrupt("return", identityApiClient$1.identity.getIdentitySessionIds());
710
- case 2:
711
- case "end":
712
- return _context.stop();
541
+ return _context.a(2, identityApiClient$1.identity.getIdentitySessionIds());
713
542
  }
714
543
  }, _callee);
715
544
  }));
@@ -743,21 +572,18 @@ var getCustomerSessionDataFactory = function getCustomerSessionDataFactory(deps)
743
572
  /** @hidden */
744
573
  var getCustomerStatusByCustomerIdFactory = function getCustomerStatusByCustomerIdFactory(deps) {
745
574
  return /*#__PURE__*/function () {
746
- var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(params) {
575
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(params) {
747
576
  var customer;
748
- return _regeneratorRuntime().wrap(function _callee$(_context) {
749
- while (1) switch (_context.prev = _context.next) {
577
+ return _regenerator().w(function (_context) {
578
+ while (1) switch (_context.n) {
750
579
  case 0:
751
- _context.next = 2;
580
+ _context.n = 1;
752
581
  return deps.compilotApiClient.customers.internalCustomerRouterGetCustomerDetails({
753
582
  id: params.customerId
754
583
  });
755
- case 2:
756
- customer = _context.sent;
757
- return _context.abrupt("return", customer.status);
758
- case 4:
759
- case "end":
760
- return _context.stop();
584
+ case 1:
585
+ customer = _context.v;
586
+ return _context.a(2, customer.status);
761
587
  }
762
588
  }, _callee);
763
589
  }));
@@ -791,19 +617,16 @@ var getCustomerStatusByCustomerIdFactory = function getCustomerStatusByCustomerI
791
617
  /** @hidden */
792
618
  var getCustomerStatusByExternalCustomerIdFactory = function getCustomerStatusByExternalCustomerIdFactory(deps) {
793
619
  return /*#__PURE__*/function () {
794
- var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(params) {
620
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(params) {
795
621
  var customer;
796
- return _regeneratorRuntime().wrap(function _callee$(_context) {
797
- while (1) switch (_context.prev = _context.next) {
622
+ return _regenerator().w(function (_context) {
623
+ while (1) switch (_context.n) {
798
624
  case 0:
799
- _context.next = 2;
625
+ _context.n = 1;
800
626
  return deps.compilotApiClient.customers.internalCustomerRouterGetCustomerByExternalCustomerId(params);
801
- case 2:
802
- customer = _context.sent;
803
- return _context.abrupt("return", customer.status);
804
- case 4:
805
- case "end":
806
- return _context.stop();
627
+ case 1:
628
+ customer = _context.v;
629
+ return _context.a(2, customer.status);
807
630
  }
808
631
  }, _callee);
809
632
  }));
@@ -836,23 +659,20 @@ var getCustomerStatusByExternalCustomerIdFactory = function getCustomerStatusByE
836
659
  /** @hidden */
837
660
  var getCustomerStatusByWalletFactory = function getCustomerStatusByWalletFactory(deps) {
838
661
  return /*#__PURE__*/function () {
839
- var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(params) {
662
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(params) {
840
663
  var customer;
841
- return _regeneratorRuntime().wrap(function _callee$(_context) {
842
- while (1) switch (_context.prev = _context.next) {
664
+ return _regenerator().w(function (_context) {
665
+ while (1) switch (_context.n) {
843
666
  case 0:
844
- _context.next = 2;
667
+ _context.n = 1;
845
668
  return deps.compilotApiClient.customers.internalCustomerRouterGetCustomerByProjectAndWalletAddress({
846
669
  address: params.walletAddress,
847
670
  cmsProjectId: params.workspaceId,
848
671
  type: params.type
849
672
  });
850
- case 2:
851
- customer = _context.sent;
852
- return _context.abrupt("return", customer.status);
853
- case 4:
854
- case "end":
855
- return _context.stop();
673
+ case 1:
674
+ customer = _context.v;
675
+ return _context.a(2, customer.status);
856
676
  }
857
677
  }, _callee);
858
678
  }));
@@ -885,18 +705,18 @@ var getCustomerStatusByWalletFactory = function getCustomerStatusByWalletFactory
885
705
  /** @hidden */
886
706
  var getCustomerWalletsFactory = function getCustomerWalletsFactory(deps) {
887
707
  return /*#__PURE__*/function () {
888
- var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(params) {
708
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(params) {
889
709
  var customer;
890
- return _regeneratorRuntime().wrap(function _callee$(_context) {
891
- while (1) switch (_context.prev = _context.next) {
710
+ return _regenerator().w(function (_context) {
711
+ while (1) switch (_context.n) {
892
712
  case 0:
893
- _context.next = 2;
713
+ _context.n = 1;
894
714
  return deps.compilotApiClient.customers.internalCustomerRouterWalletsGetCustomerWallets({
895
715
  customerId: params.customerId
896
716
  });
897
- case 2:
898
- customer = _context.sent;
899
- return _context.abrupt("return", customer.map(function (wallet) {
717
+ case 1:
718
+ customer = _context.v;
719
+ return _context.a(2, customer.map(function (wallet) {
900
720
  return {
901
721
  address: wallet.wallet,
902
722
  chain: wallet.blockchainNamespace,
@@ -905,9 +725,6 @@ var getCustomerWalletsFactory = function getCustomerWalletsFactory(deps) {
905
725
  }).filter(function (wallet) {
906
726
  return wallet.chain !== null;
907
727
  }));
908
- case 4:
909
- case "end":
910
- return _context.stop();
911
728
  }
912
729
  }, _callee);
913
730
  }));
@@ -1019,31 +836,28 @@ var getTxAuthDataSignatureFactory = function getTxAuthDataSignatureFactory(deps)
1019
836
  // use a mapping so we get a type error here when we add a new namespace
1020
837
  var mapping = {
1021
838
  eip155: function () {
1022
- var _eip = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(params) {
839
+ var _eip = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(params) {
1023
840
  var res;
1024
- return _regeneratorRuntime().wrap(function _callee$(_context) {
1025
- while (1) switch (_context.prev = _context.next) {
841
+ return _regenerator().w(function (_context) {
842
+ while (1) switch (_context.n) {
1026
843
  case 0:
1027
844
  if (!(params.namespace !== "eip155")) {
1028
- _context.next = 2;
845
+ _context.n = 1;
1029
846
  break;
1030
847
  }
1031
848
  throw new Error("Unsupported namespace: ".concat(params.namespace));
1032
- case 2:
1033
- _context.next = 4;
849
+ case 1:
850
+ _context.n = 2;
1034
851
  return deps.compilotApiClient.sigGating.publicRouterSignatureGatingGetTxAuthDataSignature({
1035
852
  requestBody: params,
1036
853
  workflowId: params.workflowId
1037
854
  });
1038
- case 4:
1039
- res = _context.sent;
1040
- return _context.abrupt("return", identitySchemas.ExtendedTxAuthDataSignatureResponse.parse(_objectSpread2({
855
+ case 2:
856
+ res = _context.v;
857
+ return _context.a(2, identitySchemas.ExtendedTxAuthDataSignatureResponse.parse(_objectSpread2({
1041
858
  namespace: params.namespace,
1042
859
  userAddress: params.userAddress
1043
860
  }, res)));
1044
- case 6:
1045
- case "end":
1046
- return _context.stop();
1047
861
  }
1048
862
  }, _callee);
1049
863
  }));
@@ -1053,31 +867,28 @@ var getTxAuthDataSignatureFactory = function getTxAuthDataSignatureFactory(deps)
1053
867
  return eip155;
1054
868
  }(),
1055
869
  tezos: function () {
1056
- var _tezos = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(params) {
870
+ var _tezos = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(params) {
1057
871
  var res;
1058
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
1059
- while (1) switch (_context2.prev = _context2.next) {
872
+ return _regenerator().w(function (_context2) {
873
+ while (1) switch (_context2.n) {
1060
874
  case 0:
1061
875
  if (!(params.namespace !== "tezos")) {
1062
- _context2.next = 2;
876
+ _context2.n = 1;
1063
877
  break;
1064
878
  }
1065
879
  throw new Error("Unsupported namespace: ".concat(params.namespace));
1066
- case 2:
1067
- _context2.next = 4;
880
+ case 1:
881
+ _context2.n = 2;
1068
882
  return deps.compilotApiClient.sigGating.publicRouterSignatureGatingGetTezosTxAuthDataSignature({
1069
883
  requestBody: params,
1070
884
  workflowId: params.workflowId
1071
885
  });
1072
- case 4:
1073
- res = _context2.sent;
1074
- return _context2.abrupt("return", identitySchemas.ExtendedTezosTxAuthDataSignatureResponse.parse(_objectSpread2({
886
+ case 2:
887
+ res = _context2.v;
888
+ return _context2.a(2, identitySchemas.ExtendedTezosTxAuthDataSignatureResponse.parse(_objectSpread2({
1075
889
  namespace: params.namespace,
1076
890
  userAddress: params.userAddress
1077
891
  }, res)));
1078
- case 6:
1079
- case "end":
1080
- return _context2.stop();
1081
892
  }
1082
893
  }, _callee2);
1083
894
  }));
@@ -1352,21 +1163,18 @@ var validateWebhookEventFactory = function validateWebhookEventFactory(_ref) {
1352
1163
  /** @hidden */
1353
1164
  var verifyWeb3ChallengeFactory = function verifyWeb3ChallengeFactory(deps) {
1354
1165
  return /*#__PURE__*/function () {
1355
- var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(params) {
1166
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(params) {
1356
1167
  var res;
1357
- return _regeneratorRuntime().wrap(function _callee$(_context) {
1358
- while (1) switch (_context.prev = _context.next) {
1168
+ return _regenerator().w(function (_context) {
1169
+ while (1) switch (_context.n) {
1359
1170
  case 0:
1360
- _context.next = 2;
1171
+ _context.n = 1;
1361
1172
  return deps.identityApiClient.auth.verifyWalletChallenge({
1362
1173
  requestBody: params
1363
1174
  });
1364
- case 2:
1365
- res = _context.sent;
1366
- return _context.abrupt("return", res);
1367
- case 4:
1368
- case "end":
1369
- return _context.stop();
1175
+ case 1:
1176
+ res = _context.v;
1177
+ return _context.a(2, res);
1370
1178
  }
1371
1179
  }, _callee);
1372
1180
  }));