@exodus/xqa 5.4.0 → 6.0.0

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.
@@ -0,0 +1,558 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __commonJS = (cb, mod) => function __require() {
9
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
+ };
11
+ var __export = (target, all) => {
12
+ for (var name in all)
13
+ __defProp(target, name, { get: all[name], enumerable: true });
14
+ };
15
+ var __copyProps = (to, from, except, desc) => {
16
+ if (from && typeof from === "object" || typeof from === "function") {
17
+ for (let key of __getOwnPropNames(from))
18
+ if (!__hasOwnProp.call(to, key) && key !== except)
19
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
20
+ }
21
+ return to;
22
+ };
23
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
24
+ // If the importer is in node compatibility mode or this is not an ESM
25
+ // file that has been converted to a CommonJS file using a Babel-
26
+ // compatible transform (i.e. "__esModule" has not been set), then set
27
+ // "default" to the CommonJS "module.exports" for node compatibility.
28
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
29
+ mod
30
+ ));
31
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
32
+
33
+ // ../../node_modules/.pnpm/neverthrow@8.2.0/node_modules/neverthrow/dist/index.cjs.js
34
+ var require_index_cjs = __commonJS({
35
+ "../../node_modules/.pnpm/neverthrow@8.2.0/node_modules/neverthrow/dist/index.cjs.js"(exports2) {
36
+ "use strict";
37
+ var defaultErrorConfig = {
38
+ withStackTrace: false
39
+ };
40
+ var createNeverThrowError = (message, result, config = defaultErrorConfig) => {
41
+ const data = result.isOk() ? { type: "Ok", value: result.value } : { type: "Err", value: result.error };
42
+ const maybeStack = config.withStackTrace ? new Error().stack : void 0;
43
+ return {
44
+ data,
45
+ message,
46
+ stack: maybeStack
47
+ };
48
+ };
49
+ function __awaiter(thisArg, _arguments, P, generator) {
50
+ function adopt(value) {
51
+ return value instanceof P ? value : new P(function(resolve) {
52
+ resolve(value);
53
+ });
54
+ }
55
+ return new (P || (P = Promise))(function(resolve, reject) {
56
+ function fulfilled(value) {
57
+ try {
58
+ step(generator.next(value));
59
+ } catch (e) {
60
+ reject(e);
61
+ }
62
+ }
63
+ function rejected(value) {
64
+ try {
65
+ step(generator["throw"](value));
66
+ } catch (e) {
67
+ reject(e);
68
+ }
69
+ }
70
+ function step(result) {
71
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
72
+ }
73
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
74
+ });
75
+ }
76
+ function __values(o) {
77
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
78
+ if (m) return m.call(o);
79
+ if (o && typeof o.length === "number") return {
80
+ next: function() {
81
+ if (o && i >= o.length) o = void 0;
82
+ return { value: o && o[i++], done: !o };
83
+ }
84
+ };
85
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
86
+ }
87
+ function __await(v) {
88
+ return this instanceof __await ? (this.v = v, this) : new __await(v);
89
+ }
90
+ function __asyncGenerator(thisArg, _arguments, generator) {
91
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
92
+ var g = generator.apply(thisArg, _arguments || []), i, q = [];
93
+ return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function() {
94
+ return this;
95
+ }, i;
96
+ function awaitReturn(f) {
97
+ return function(v) {
98
+ return Promise.resolve(v).then(f, reject);
99
+ };
100
+ }
101
+ function verb(n, f) {
102
+ if (g[n]) {
103
+ i[n] = function(v) {
104
+ return new Promise(function(a, b) {
105
+ q.push([n, v, a, b]) > 1 || resume(n, v);
106
+ });
107
+ };
108
+ if (f) i[n] = f(i[n]);
109
+ }
110
+ }
111
+ function resume(n, v) {
112
+ try {
113
+ step(g[n](v));
114
+ } catch (e) {
115
+ settle(q[0][3], e);
116
+ }
117
+ }
118
+ function step(r) {
119
+ r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r);
120
+ }
121
+ function fulfill(value) {
122
+ resume("next", value);
123
+ }
124
+ function reject(value) {
125
+ resume("throw", value);
126
+ }
127
+ function settle(f, v) {
128
+ if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]);
129
+ }
130
+ }
131
+ function __asyncDelegator(o) {
132
+ var i, p;
133
+ return i = {}, verb("next"), verb("throw", function(e) {
134
+ throw e;
135
+ }), verb("return"), i[Symbol.iterator] = function() {
136
+ return this;
137
+ }, i;
138
+ function verb(n, f) {
139
+ i[n] = o[n] ? function(v) {
140
+ return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v;
141
+ } : f;
142
+ }
143
+ }
144
+ function __asyncValues(o) {
145
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
146
+ var m = o[Symbol.asyncIterator], i;
147
+ return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() {
148
+ return this;
149
+ }, i);
150
+ function verb(n) {
151
+ i[n] = o[n] && function(v) {
152
+ return new Promise(function(resolve, reject) {
153
+ v = o[n](v), settle(resolve, reject, v.done, v.value);
154
+ });
155
+ };
156
+ }
157
+ function settle(resolve, reject, d, v) {
158
+ Promise.resolve(v).then(function(v2) {
159
+ resolve({ value: v2, done: d });
160
+ }, reject);
161
+ }
162
+ }
163
+ var ResultAsync2 = class _ResultAsync {
164
+ constructor(res) {
165
+ this._promise = res;
166
+ }
167
+ static fromSafePromise(promise) {
168
+ const newPromise = promise.then((value) => new Ok(value));
169
+ return new _ResultAsync(newPromise);
170
+ }
171
+ static fromPromise(promise, errorFn) {
172
+ const newPromise = promise.then((value) => new Ok(value)).catch((e) => new Err(errorFn(e)));
173
+ return new _ResultAsync(newPromise);
174
+ }
175
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
176
+ static fromThrowable(fn, errorFn) {
177
+ return (...args) => {
178
+ return new _ResultAsync((() => __awaiter(this, void 0, void 0, function* () {
179
+ try {
180
+ return new Ok(yield fn(...args));
181
+ } catch (error) {
182
+ return new Err(errorFn ? errorFn(error) : error);
183
+ }
184
+ }))());
185
+ };
186
+ }
187
+ static combine(asyncResultList) {
188
+ return combineResultAsyncList(asyncResultList);
189
+ }
190
+ static combineWithAllErrors(asyncResultList) {
191
+ return combineResultAsyncListWithAllErrors(asyncResultList);
192
+ }
193
+ map(f) {
194
+ return new _ResultAsync(this._promise.then((res) => __awaiter(this, void 0, void 0, function* () {
195
+ if (res.isErr()) {
196
+ return new Err(res.error);
197
+ }
198
+ return new Ok(yield f(res.value));
199
+ })));
200
+ }
201
+ andThrough(f) {
202
+ return new _ResultAsync(this._promise.then((res) => __awaiter(this, void 0, void 0, function* () {
203
+ if (res.isErr()) {
204
+ return new Err(res.error);
205
+ }
206
+ const newRes = yield f(res.value);
207
+ if (newRes.isErr()) {
208
+ return new Err(newRes.error);
209
+ }
210
+ return new Ok(res.value);
211
+ })));
212
+ }
213
+ andTee(f) {
214
+ return new _ResultAsync(this._promise.then((res) => __awaiter(this, void 0, void 0, function* () {
215
+ if (res.isErr()) {
216
+ return new Err(res.error);
217
+ }
218
+ try {
219
+ yield f(res.value);
220
+ } catch (e) {
221
+ }
222
+ return new Ok(res.value);
223
+ })));
224
+ }
225
+ orTee(f) {
226
+ return new _ResultAsync(this._promise.then((res) => __awaiter(this, void 0, void 0, function* () {
227
+ if (res.isOk()) {
228
+ return new Ok(res.value);
229
+ }
230
+ try {
231
+ yield f(res.error);
232
+ } catch (e) {
233
+ }
234
+ return new Err(res.error);
235
+ })));
236
+ }
237
+ mapErr(f) {
238
+ return new _ResultAsync(this._promise.then((res) => __awaiter(this, void 0, void 0, function* () {
239
+ if (res.isOk()) {
240
+ return new Ok(res.value);
241
+ }
242
+ return new Err(yield f(res.error));
243
+ })));
244
+ }
245
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
246
+ andThen(f) {
247
+ return new _ResultAsync(this._promise.then((res) => {
248
+ if (res.isErr()) {
249
+ return new Err(res.error);
250
+ }
251
+ const newValue = f(res.value);
252
+ return newValue instanceof _ResultAsync ? newValue._promise : newValue;
253
+ }));
254
+ }
255
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
256
+ orElse(f) {
257
+ return new _ResultAsync(this._promise.then((res) => __awaiter(this, void 0, void 0, function* () {
258
+ if (res.isErr()) {
259
+ return f(res.error);
260
+ }
261
+ return new Ok(res.value);
262
+ })));
263
+ }
264
+ match(ok3, _err) {
265
+ return this._promise.then((res) => res.match(ok3, _err));
266
+ }
267
+ unwrapOr(t) {
268
+ return this._promise.then((res) => res.unwrapOr(t));
269
+ }
270
+ /**
271
+ * @deprecated will be removed in 9.0.0.
272
+ *
273
+ * You can use `safeTry` without this method.
274
+ * @example
275
+ * ```typescript
276
+ * safeTry(async function* () {
277
+ * const okValue = yield* yourResult
278
+ * })
279
+ * ```
280
+ * Emulates Rust's `?` operator in `safeTry`'s body. See also `safeTry`.
281
+ */
282
+ safeUnwrap() {
283
+ return __asyncGenerator(this, arguments, function* safeUnwrap_1() {
284
+ return yield __await(yield __await(yield* __asyncDelegator(__asyncValues(yield __await(this._promise.then((res) => res.safeUnwrap()))))));
285
+ });
286
+ }
287
+ // Makes ResultAsync implement PromiseLike<Result>
288
+ then(successCallback, failureCallback) {
289
+ return this._promise.then(successCallback, failureCallback);
290
+ }
291
+ [Symbol.asyncIterator]() {
292
+ return __asyncGenerator(this, arguments, function* _a() {
293
+ const result = yield __await(this._promise);
294
+ if (result.isErr()) {
295
+ yield yield __await(errAsync2(result.error));
296
+ }
297
+ return yield __await(result.value);
298
+ });
299
+ }
300
+ };
301
+ function okAsync2(value) {
302
+ return new ResultAsync2(Promise.resolve(new Ok(value)));
303
+ }
304
+ function errAsync2(err3) {
305
+ return new ResultAsync2(Promise.resolve(new Err(err3)));
306
+ }
307
+ var fromPromise = ResultAsync2.fromPromise;
308
+ var fromSafePromise = ResultAsync2.fromSafePromise;
309
+ var fromAsyncThrowable = ResultAsync2.fromThrowable;
310
+ var combineResultList = (resultList) => {
311
+ let acc = ok2([]);
312
+ for (const result of resultList) {
313
+ if (result.isErr()) {
314
+ acc = err2(result.error);
315
+ break;
316
+ } else {
317
+ acc.map((list) => list.push(result.value));
318
+ }
319
+ }
320
+ return acc;
321
+ };
322
+ var combineResultAsyncList = (asyncResultList) => ResultAsync2.fromSafePromise(Promise.all(asyncResultList)).andThen(combineResultList);
323
+ var combineResultListWithAllErrors = (resultList) => {
324
+ let acc = ok2([]);
325
+ for (const result of resultList) {
326
+ if (result.isErr() && acc.isErr()) {
327
+ acc.error.push(result.error);
328
+ } else if (result.isErr() && acc.isOk()) {
329
+ acc = err2([result.error]);
330
+ } else if (result.isOk() && acc.isOk()) {
331
+ acc.value.push(result.value);
332
+ }
333
+ }
334
+ return acc;
335
+ };
336
+ var combineResultAsyncListWithAllErrors = (asyncResultList) => ResultAsync2.fromSafePromise(Promise.all(asyncResultList)).andThen(combineResultListWithAllErrors);
337
+ exports2.Result = void 0;
338
+ (function(Result2) {
339
+ function fromThrowable3(fn, errorFn) {
340
+ return (...args) => {
341
+ try {
342
+ const result = fn(...args);
343
+ return ok2(result);
344
+ } catch (e) {
345
+ return err2(errorFn ? errorFn(e) : e);
346
+ }
347
+ };
348
+ }
349
+ Result2.fromThrowable = fromThrowable3;
350
+ function combine(resultList) {
351
+ return combineResultList(resultList);
352
+ }
353
+ Result2.combine = combine;
354
+ function combineWithAllErrors(resultList) {
355
+ return combineResultListWithAllErrors(resultList);
356
+ }
357
+ Result2.combineWithAllErrors = combineWithAllErrors;
358
+ })(exports2.Result || (exports2.Result = {}));
359
+ function ok2(value) {
360
+ return new Ok(value);
361
+ }
362
+ function err2(err3) {
363
+ return new Err(err3);
364
+ }
365
+ function safeTry(body) {
366
+ const n = body().next();
367
+ if (n instanceof Promise) {
368
+ return new ResultAsync2(n.then((r) => r.value));
369
+ }
370
+ return n.value;
371
+ }
372
+ var Ok = class {
373
+ constructor(value) {
374
+ this.value = value;
375
+ }
376
+ isOk() {
377
+ return true;
378
+ }
379
+ isErr() {
380
+ return !this.isOk();
381
+ }
382
+ map(f) {
383
+ return ok2(f(this.value));
384
+ }
385
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
386
+ mapErr(_f) {
387
+ return ok2(this.value);
388
+ }
389
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
390
+ andThen(f) {
391
+ return f(this.value);
392
+ }
393
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
394
+ andThrough(f) {
395
+ return f(this.value).map((_value) => this.value);
396
+ }
397
+ andTee(f) {
398
+ try {
399
+ f(this.value);
400
+ } catch (e) {
401
+ }
402
+ return ok2(this.value);
403
+ }
404
+ orTee(_f) {
405
+ return ok2(this.value);
406
+ }
407
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
408
+ orElse(_f) {
409
+ return ok2(this.value);
410
+ }
411
+ asyncAndThen(f) {
412
+ return f(this.value);
413
+ }
414
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
415
+ asyncAndThrough(f) {
416
+ return f(this.value).map(() => this.value);
417
+ }
418
+ asyncMap(f) {
419
+ return ResultAsync2.fromSafePromise(f(this.value));
420
+ }
421
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
422
+ unwrapOr(_v) {
423
+ return this.value;
424
+ }
425
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
426
+ match(ok3, _err) {
427
+ return ok3(this.value);
428
+ }
429
+ safeUnwrap() {
430
+ const value = this.value;
431
+ return (function* () {
432
+ return value;
433
+ })();
434
+ }
435
+ _unsafeUnwrap(_) {
436
+ return this.value;
437
+ }
438
+ _unsafeUnwrapErr(config) {
439
+ throw createNeverThrowError("Called `_unsafeUnwrapErr` on an Ok", this, config);
440
+ }
441
+ // eslint-disable-next-line @typescript-eslint/no-this-alias, require-yield
442
+ *[Symbol.iterator]() {
443
+ return this.value;
444
+ }
445
+ };
446
+ var Err = class {
447
+ constructor(error) {
448
+ this.error = error;
449
+ }
450
+ isOk() {
451
+ return false;
452
+ }
453
+ isErr() {
454
+ return !this.isOk();
455
+ }
456
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
457
+ map(_f) {
458
+ return err2(this.error);
459
+ }
460
+ mapErr(f) {
461
+ return err2(f(this.error));
462
+ }
463
+ andThrough(_f) {
464
+ return err2(this.error);
465
+ }
466
+ andTee(_f) {
467
+ return err2(this.error);
468
+ }
469
+ orTee(f) {
470
+ try {
471
+ f(this.error);
472
+ } catch (e) {
473
+ }
474
+ return err2(this.error);
475
+ }
476
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
477
+ andThen(_f) {
478
+ return err2(this.error);
479
+ }
480
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
481
+ orElse(f) {
482
+ return f(this.error);
483
+ }
484
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
485
+ asyncAndThen(_f) {
486
+ return errAsync2(this.error);
487
+ }
488
+ asyncAndThrough(_f) {
489
+ return errAsync2(this.error);
490
+ }
491
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
492
+ asyncMap(_f) {
493
+ return errAsync2(this.error);
494
+ }
495
+ unwrapOr(v) {
496
+ return v;
497
+ }
498
+ match(_ok, err3) {
499
+ return err3(this.error);
500
+ }
501
+ safeUnwrap() {
502
+ const error = this.error;
503
+ return (function* () {
504
+ yield err2(error);
505
+ throw new Error("Do not use this generator out of `safeTry`");
506
+ })();
507
+ }
508
+ _unsafeUnwrap(config) {
509
+ throw createNeverThrowError("Called `_unsafeUnwrap` on an Err", this, config);
510
+ }
511
+ _unsafeUnwrapErr(_) {
512
+ return this.error;
513
+ }
514
+ *[Symbol.iterator]() {
515
+ const self = this;
516
+ yield self;
517
+ return self;
518
+ }
519
+ };
520
+ var fromThrowable2 = exports2.Result.fromThrowable;
521
+ exports2.Err = Err;
522
+ exports2.Ok = Ok;
523
+ exports2.ResultAsync = ResultAsync2;
524
+ exports2.err = err2;
525
+ exports2.errAsync = errAsync2;
526
+ exports2.fromAsyncThrowable = fromAsyncThrowable;
527
+ exports2.fromPromise = fromPromise;
528
+ exports2.fromSafePromise = fromSafePromise;
529
+ exports2.fromThrowable = fromThrowable2;
530
+ exports2.ok = ok2;
531
+ exports2.okAsync = okAsync2;
532
+ exports2.safeTry = safeTry;
533
+ }
534
+ });
535
+
536
+ // src/consumer-neverthrow.ts
537
+ var consumer_neverthrow_exports = {};
538
+ __export(consumer_neverthrow_exports, {
539
+ Result: () => import_neverthrow.Result,
540
+ ResultAsync: () => import_neverthrow.ResultAsync,
541
+ err: () => import_neverthrow.err,
542
+ errAsync: () => import_neverthrow.errAsync,
543
+ fromThrowable: () => import_neverthrow.fromThrowable,
544
+ ok: () => import_neverthrow.ok,
545
+ okAsync: () => import_neverthrow.okAsync
546
+ });
547
+ module.exports = __toCommonJS(consumer_neverthrow_exports);
548
+ var import_neverthrow = __toESM(require_index_cjs(), 1);
549
+ // Annotate the CommonJS export names for ESM import in node:
550
+ 0 && (module.exports = {
551
+ Result,
552
+ ResultAsync,
553
+ err,
554
+ errAsync,
555
+ fromThrowable,
556
+ ok,
557
+ okAsync
558
+ });