@1shotapi/1shotpay-common 0.1.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.
- package/README.md +75 -0
- package/dist/index.d.ts +697 -0
- package/dist/index.js +1377 -0
- package/dist/index.js.map +1 -0
- package/package.json +53 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,1377 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __knownSymbol = (name, symbol) => (symbol = Symbol[name]) ? symbol : /* @__PURE__ */ Symbol.for("Symbol." + name);
|
|
8
|
+
var __typeError = (msg) => {
|
|
9
|
+
throw TypeError(msg);
|
|
10
|
+
};
|
|
11
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
13
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
14
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
15
|
+
};
|
|
16
|
+
var __copyProps = (to, from, except, desc) => {
|
|
17
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
18
|
+
for (let key of __getOwnPropNames(from))
|
|
19
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
20
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
21
|
+
}
|
|
22
|
+
return to;
|
|
23
|
+
};
|
|
24
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
25
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
26
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
27
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
28
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
29
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
30
|
+
mod
|
|
31
|
+
));
|
|
32
|
+
var __decoratorStart = (base) => [, , , __create(base?.[__knownSymbol("metadata")] ?? null)];
|
|
33
|
+
var __decoratorStrings = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
|
|
34
|
+
var __expectFn = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError("Function expected") : fn;
|
|
35
|
+
var __decoratorContext = (kind, name, done, metadata, fns) => ({ kind: __decoratorStrings[kind], name, metadata, addInitializer: (fn) => done._ ? __typeError("Already initialized") : fns.push(__expectFn(fn || null)) });
|
|
36
|
+
var __decoratorMetadata = (array, target) => __defNormalProp(target, __knownSymbol("metadata"), array[3]);
|
|
37
|
+
var __runInitializers = (array, flags, self, value) => {
|
|
38
|
+
for (var i = 0, fns = array[flags >> 1], n = fns && fns.length; i < n; i++) flags & 1 ? fns[i].call(self) : value = fns[i].call(self, value);
|
|
39
|
+
return value;
|
|
40
|
+
};
|
|
41
|
+
var __decorateElement = (array, flags, name, decorators, target, extra) => {
|
|
42
|
+
var fn, it, done, ctx, access, k = flags & 7, s = !!(flags & 8), p = !!(flags & 16);
|
|
43
|
+
var j = k > 3 ? array.length + 1 : k ? s ? 1 : 2 : 0, key = __decoratorStrings[k + 5];
|
|
44
|
+
var initializers = k > 3 && (array[j - 1] = []), extraInitializers = array[j] || (array[j] = []);
|
|
45
|
+
var desc = k && (!p && !s && (target = target.prototype), k < 5 && (k > 3 || !p) && __getOwnPropDesc(k < 4 ? target : { get [name]() {
|
|
46
|
+
return __privateGet(this, extra);
|
|
47
|
+
}, set [name](x) {
|
|
48
|
+
return __privateSet(this, extra, x);
|
|
49
|
+
} }, name));
|
|
50
|
+
k ? p && k < 4 && __name(extra, (k > 2 ? "set " : k > 1 ? "get " : "") + name) : __name(target, name);
|
|
51
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
52
|
+
ctx = __decoratorContext(k, name, done = {}, array[3], extraInitializers);
|
|
53
|
+
if (k) {
|
|
54
|
+
ctx.static = s, ctx.private = p, access = ctx.access = { has: p ? (x) => __privateIn(target, x) : (x) => name in x };
|
|
55
|
+
if (k ^ 3) access.get = p ? (x) => (k ^ 1 ? __privateGet : __privateMethod)(x, target, k ^ 4 ? extra : desc.get) : (x) => x[name];
|
|
56
|
+
if (k > 2) access.set = p ? (x, y) => __privateSet(x, target, y, k ^ 4 ? extra : desc.set) : (x, y) => x[name] = y;
|
|
57
|
+
}
|
|
58
|
+
it = (0, decorators[i])(k ? k < 4 ? p ? extra : desc[key] : k > 4 ? void 0 : { get: desc.get, set: desc.set } : target, ctx), done._ = 1;
|
|
59
|
+
if (k ^ 4 || it === void 0) __expectFn(it) && (k > 4 ? initializers.unshift(it) : k ? p ? extra = it : desc[key] = it : target = it);
|
|
60
|
+
else if (typeof it !== "object" || it === null) __typeError("Object expected");
|
|
61
|
+
else __expectFn(fn = it.get) && (desc.get = fn), __expectFn(fn = it.set) && (desc.set = fn), __expectFn(fn = it.init) && initializers.unshift(fn);
|
|
62
|
+
}
|
|
63
|
+
return k || __decoratorMetadata(array, target), desc && __defProp(target, name, desc), p ? k ^ 4 ? extra : desc : target;
|
|
64
|
+
};
|
|
65
|
+
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
66
|
+
var __privateIn = (member, obj) => Object(obj) !== obj ? __typeError('Cannot use the "in" operator on this value') : member.has(obj);
|
|
67
|
+
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
68
|
+
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
69
|
+
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
70
|
+
|
|
71
|
+
// ../../node_modules/safe-stable-stringify/index.js
|
|
72
|
+
var require_safe_stable_stringify = __commonJS({
|
|
73
|
+
"../../node_modules/safe-stable-stringify/index.js"(exports, module) {
|
|
74
|
+
"use strict";
|
|
75
|
+
var { hasOwnProperty } = Object.prototype;
|
|
76
|
+
var stringify = configure2();
|
|
77
|
+
stringify.configure = configure2;
|
|
78
|
+
stringify.stringify = stringify;
|
|
79
|
+
stringify.default = stringify;
|
|
80
|
+
exports.stringify = stringify;
|
|
81
|
+
exports.configure = configure2;
|
|
82
|
+
module.exports = stringify;
|
|
83
|
+
var strEscapeSequencesRegExp = /[\u0000-\u001f\u0022\u005c\ud800-\udfff]/;
|
|
84
|
+
function strEscape(str) {
|
|
85
|
+
if (str.length < 5e3 && !strEscapeSequencesRegExp.test(str)) {
|
|
86
|
+
return `"${str}"`;
|
|
87
|
+
}
|
|
88
|
+
return JSON.stringify(str);
|
|
89
|
+
}
|
|
90
|
+
function sort(array, comparator) {
|
|
91
|
+
if (array.length > 200 || comparator) {
|
|
92
|
+
return array.sort(comparator);
|
|
93
|
+
}
|
|
94
|
+
for (let i = 1; i < array.length; i++) {
|
|
95
|
+
const currentValue = array[i];
|
|
96
|
+
let position = i;
|
|
97
|
+
while (position !== 0 && array[position - 1] > currentValue) {
|
|
98
|
+
array[position] = array[position - 1];
|
|
99
|
+
position--;
|
|
100
|
+
}
|
|
101
|
+
array[position] = currentValue;
|
|
102
|
+
}
|
|
103
|
+
return array;
|
|
104
|
+
}
|
|
105
|
+
var typedArrayPrototypeGetSymbolToStringTag = Object.getOwnPropertyDescriptor(
|
|
106
|
+
Object.getPrototypeOf(
|
|
107
|
+
Object.getPrototypeOf(
|
|
108
|
+
new Int8Array()
|
|
109
|
+
)
|
|
110
|
+
),
|
|
111
|
+
Symbol.toStringTag
|
|
112
|
+
).get;
|
|
113
|
+
function isTypedArrayWithEntries(value) {
|
|
114
|
+
return typedArrayPrototypeGetSymbolToStringTag.call(value) !== void 0 && value.length !== 0;
|
|
115
|
+
}
|
|
116
|
+
function stringifyTypedArray(array, separator, maximumBreadth) {
|
|
117
|
+
if (array.length < maximumBreadth) {
|
|
118
|
+
maximumBreadth = array.length;
|
|
119
|
+
}
|
|
120
|
+
const whitespace = separator === "," ? "" : " ";
|
|
121
|
+
let res = `"0":${whitespace}${array[0]}`;
|
|
122
|
+
for (let i = 1; i < maximumBreadth; i++) {
|
|
123
|
+
res += `${separator}"${i}":${whitespace}${array[i]}`;
|
|
124
|
+
}
|
|
125
|
+
return res;
|
|
126
|
+
}
|
|
127
|
+
function getCircularValueOption(options) {
|
|
128
|
+
if (hasOwnProperty.call(options, "circularValue")) {
|
|
129
|
+
const circularValue = options.circularValue;
|
|
130
|
+
if (typeof circularValue === "string") {
|
|
131
|
+
return `"${circularValue}"`;
|
|
132
|
+
}
|
|
133
|
+
if (circularValue == null) {
|
|
134
|
+
return circularValue;
|
|
135
|
+
}
|
|
136
|
+
if (circularValue === Error || circularValue === TypeError) {
|
|
137
|
+
return {
|
|
138
|
+
toString() {
|
|
139
|
+
throw new TypeError("Converting circular structure to JSON");
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
throw new TypeError('The "circularValue" argument must be of type string or the value null or undefined');
|
|
144
|
+
}
|
|
145
|
+
return '"[Circular]"';
|
|
146
|
+
}
|
|
147
|
+
function getDeterministicOption(options) {
|
|
148
|
+
let value;
|
|
149
|
+
if (hasOwnProperty.call(options, "deterministic")) {
|
|
150
|
+
value = options.deterministic;
|
|
151
|
+
if (typeof value !== "boolean" && typeof value !== "function") {
|
|
152
|
+
throw new TypeError('The "deterministic" argument must be of type boolean or comparator function');
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
return value === void 0 ? true : value;
|
|
156
|
+
}
|
|
157
|
+
function getBooleanOption(options, key) {
|
|
158
|
+
let value;
|
|
159
|
+
if (hasOwnProperty.call(options, key)) {
|
|
160
|
+
value = options[key];
|
|
161
|
+
if (typeof value !== "boolean") {
|
|
162
|
+
throw new TypeError(`The "${key}" argument must be of type boolean`);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
return value === void 0 ? true : value;
|
|
166
|
+
}
|
|
167
|
+
function getPositiveIntegerOption(options, key) {
|
|
168
|
+
let value;
|
|
169
|
+
if (hasOwnProperty.call(options, key)) {
|
|
170
|
+
value = options[key];
|
|
171
|
+
if (typeof value !== "number") {
|
|
172
|
+
throw new TypeError(`The "${key}" argument must be of type number`);
|
|
173
|
+
}
|
|
174
|
+
if (!Number.isInteger(value)) {
|
|
175
|
+
throw new TypeError(`The "${key}" argument must be an integer`);
|
|
176
|
+
}
|
|
177
|
+
if (value < 1) {
|
|
178
|
+
throw new RangeError(`The "${key}" argument must be >= 1`);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
return value === void 0 ? Infinity : value;
|
|
182
|
+
}
|
|
183
|
+
function getItemCount(number) {
|
|
184
|
+
if (number === 1) {
|
|
185
|
+
return "1 item";
|
|
186
|
+
}
|
|
187
|
+
return `${number} items`;
|
|
188
|
+
}
|
|
189
|
+
function getUniqueReplacerSet(replacerArray) {
|
|
190
|
+
const replacerSet = /* @__PURE__ */ new Set();
|
|
191
|
+
for (const value of replacerArray) {
|
|
192
|
+
if (typeof value === "string" || typeof value === "number") {
|
|
193
|
+
replacerSet.add(String(value));
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
return replacerSet;
|
|
197
|
+
}
|
|
198
|
+
function getStrictOption(options) {
|
|
199
|
+
if (hasOwnProperty.call(options, "strict")) {
|
|
200
|
+
const value = options.strict;
|
|
201
|
+
if (typeof value !== "boolean") {
|
|
202
|
+
throw new TypeError('The "strict" argument must be of type boolean');
|
|
203
|
+
}
|
|
204
|
+
if (value) {
|
|
205
|
+
return (value2) => {
|
|
206
|
+
let message = `Object can not safely be stringified. Received type ${typeof value2}`;
|
|
207
|
+
if (typeof value2 !== "function") message += ` (${value2.toString()})`;
|
|
208
|
+
throw new Error(message);
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
function configure2(options) {
|
|
214
|
+
options = { ...options };
|
|
215
|
+
const fail = getStrictOption(options);
|
|
216
|
+
if (fail) {
|
|
217
|
+
if (options.bigint === void 0) {
|
|
218
|
+
options.bigint = false;
|
|
219
|
+
}
|
|
220
|
+
if (!("circularValue" in options)) {
|
|
221
|
+
options.circularValue = Error;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
const circularValue = getCircularValueOption(options);
|
|
225
|
+
const bigint = getBooleanOption(options, "bigint");
|
|
226
|
+
const deterministic = getDeterministicOption(options);
|
|
227
|
+
const comparator = typeof deterministic === "function" ? deterministic : void 0;
|
|
228
|
+
const maximumDepth = getPositiveIntegerOption(options, "maximumDepth");
|
|
229
|
+
const maximumBreadth = getPositiveIntegerOption(options, "maximumBreadth");
|
|
230
|
+
function stringifyFnReplacer(key, parent, stack, replacer, spacer, indentation) {
|
|
231
|
+
let value = parent[key];
|
|
232
|
+
if (typeof value === "object" && value !== null && typeof value.toJSON === "function") {
|
|
233
|
+
value = value.toJSON(key);
|
|
234
|
+
}
|
|
235
|
+
value = replacer.call(parent, key, value);
|
|
236
|
+
switch (typeof value) {
|
|
237
|
+
case "string":
|
|
238
|
+
return strEscape(value);
|
|
239
|
+
case "object": {
|
|
240
|
+
if (value === null) {
|
|
241
|
+
return "null";
|
|
242
|
+
}
|
|
243
|
+
if (stack.indexOf(value) !== -1) {
|
|
244
|
+
return circularValue;
|
|
245
|
+
}
|
|
246
|
+
let res = "";
|
|
247
|
+
let join = ",";
|
|
248
|
+
const originalIndentation = indentation;
|
|
249
|
+
if (Array.isArray(value)) {
|
|
250
|
+
if (value.length === 0) {
|
|
251
|
+
return "[]";
|
|
252
|
+
}
|
|
253
|
+
if (maximumDepth < stack.length + 1) {
|
|
254
|
+
return '"[Array]"';
|
|
255
|
+
}
|
|
256
|
+
stack.push(value);
|
|
257
|
+
if (spacer !== "") {
|
|
258
|
+
indentation += spacer;
|
|
259
|
+
res += `
|
|
260
|
+
${indentation}`;
|
|
261
|
+
join = `,
|
|
262
|
+
${indentation}`;
|
|
263
|
+
}
|
|
264
|
+
const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
|
|
265
|
+
let i = 0;
|
|
266
|
+
for (; i < maximumValuesToStringify - 1; i++) {
|
|
267
|
+
const tmp2 = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation);
|
|
268
|
+
res += tmp2 !== void 0 ? tmp2 : "null";
|
|
269
|
+
res += join;
|
|
270
|
+
}
|
|
271
|
+
const tmp = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation);
|
|
272
|
+
res += tmp !== void 0 ? tmp : "null";
|
|
273
|
+
if (value.length - 1 > maximumBreadth) {
|
|
274
|
+
const removedKeys = value.length - maximumBreadth - 1;
|
|
275
|
+
res += `${join}"... ${getItemCount(removedKeys)} not stringified"`;
|
|
276
|
+
}
|
|
277
|
+
if (spacer !== "") {
|
|
278
|
+
res += `
|
|
279
|
+
${originalIndentation}`;
|
|
280
|
+
}
|
|
281
|
+
stack.pop();
|
|
282
|
+
return `[${res}]`;
|
|
283
|
+
}
|
|
284
|
+
let keys = Object.keys(value);
|
|
285
|
+
const keyLength = keys.length;
|
|
286
|
+
if (keyLength === 0) {
|
|
287
|
+
return "{}";
|
|
288
|
+
}
|
|
289
|
+
if (maximumDepth < stack.length + 1) {
|
|
290
|
+
return '"[Object]"';
|
|
291
|
+
}
|
|
292
|
+
let whitespace = "";
|
|
293
|
+
let separator = "";
|
|
294
|
+
if (spacer !== "") {
|
|
295
|
+
indentation += spacer;
|
|
296
|
+
join = `,
|
|
297
|
+
${indentation}`;
|
|
298
|
+
whitespace = " ";
|
|
299
|
+
}
|
|
300
|
+
const maximumPropertiesToStringify = Math.min(keyLength, maximumBreadth);
|
|
301
|
+
if (deterministic && !isTypedArrayWithEntries(value)) {
|
|
302
|
+
keys = sort(keys, comparator);
|
|
303
|
+
}
|
|
304
|
+
stack.push(value);
|
|
305
|
+
for (let i = 0; i < maximumPropertiesToStringify; i++) {
|
|
306
|
+
const key2 = keys[i];
|
|
307
|
+
const tmp = stringifyFnReplacer(key2, value, stack, replacer, spacer, indentation);
|
|
308
|
+
if (tmp !== void 0) {
|
|
309
|
+
res += `${separator}${strEscape(key2)}:${whitespace}${tmp}`;
|
|
310
|
+
separator = join;
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
if (keyLength > maximumBreadth) {
|
|
314
|
+
const removedKeys = keyLength - maximumBreadth;
|
|
315
|
+
res += `${separator}"...":${whitespace}"${getItemCount(removedKeys)} not stringified"`;
|
|
316
|
+
separator = join;
|
|
317
|
+
}
|
|
318
|
+
if (spacer !== "" && separator.length > 1) {
|
|
319
|
+
res = `
|
|
320
|
+
${indentation}${res}
|
|
321
|
+
${originalIndentation}`;
|
|
322
|
+
}
|
|
323
|
+
stack.pop();
|
|
324
|
+
return `{${res}}`;
|
|
325
|
+
}
|
|
326
|
+
case "number":
|
|
327
|
+
return isFinite(value) ? String(value) : fail ? fail(value) : "null";
|
|
328
|
+
case "boolean":
|
|
329
|
+
return value === true ? "true" : "false";
|
|
330
|
+
case "undefined":
|
|
331
|
+
return void 0;
|
|
332
|
+
case "bigint":
|
|
333
|
+
if (bigint) {
|
|
334
|
+
return String(value);
|
|
335
|
+
}
|
|
336
|
+
// fallthrough
|
|
337
|
+
default:
|
|
338
|
+
return fail ? fail(value) : void 0;
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
function stringifyArrayReplacer(key, value, stack, replacer, spacer, indentation) {
|
|
342
|
+
if (typeof value === "object" && value !== null && typeof value.toJSON === "function") {
|
|
343
|
+
value = value.toJSON(key);
|
|
344
|
+
}
|
|
345
|
+
switch (typeof value) {
|
|
346
|
+
case "string":
|
|
347
|
+
return strEscape(value);
|
|
348
|
+
case "object": {
|
|
349
|
+
if (value === null) {
|
|
350
|
+
return "null";
|
|
351
|
+
}
|
|
352
|
+
if (stack.indexOf(value) !== -1) {
|
|
353
|
+
return circularValue;
|
|
354
|
+
}
|
|
355
|
+
const originalIndentation = indentation;
|
|
356
|
+
let res = "";
|
|
357
|
+
let join = ",";
|
|
358
|
+
if (Array.isArray(value)) {
|
|
359
|
+
if (value.length === 0) {
|
|
360
|
+
return "[]";
|
|
361
|
+
}
|
|
362
|
+
if (maximumDepth < stack.length + 1) {
|
|
363
|
+
return '"[Array]"';
|
|
364
|
+
}
|
|
365
|
+
stack.push(value);
|
|
366
|
+
if (spacer !== "") {
|
|
367
|
+
indentation += spacer;
|
|
368
|
+
res += `
|
|
369
|
+
${indentation}`;
|
|
370
|
+
join = `,
|
|
371
|
+
${indentation}`;
|
|
372
|
+
}
|
|
373
|
+
const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
|
|
374
|
+
let i = 0;
|
|
375
|
+
for (; i < maximumValuesToStringify - 1; i++) {
|
|
376
|
+
const tmp2 = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation);
|
|
377
|
+
res += tmp2 !== void 0 ? tmp2 : "null";
|
|
378
|
+
res += join;
|
|
379
|
+
}
|
|
380
|
+
const tmp = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation);
|
|
381
|
+
res += tmp !== void 0 ? tmp : "null";
|
|
382
|
+
if (value.length - 1 > maximumBreadth) {
|
|
383
|
+
const removedKeys = value.length - maximumBreadth - 1;
|
|
384
|
+
res += `${join}"... ${getItemCount(removedKeys)} not stringified"`;
|
|
385
|
+
}
|
|
386
|
+
if (spacer !== "") {
|
|
387
|
+
res += `
|
|
388
|
+
${originalIndentation}`;
|
|
389
|
+
}
|
|
390
|
+
stack.pop();
|
|
391
|
+
return `[${res}]`;
|
|
392
|
+
}
|
|
393
|
+
stack.push(value);
|
|
394
|
+
let whitespace = "";
|
|
395
|
+
if (spacer !== "") {
|
|
396
|
+
indentation += spacer;
|
|
397
|
+
join = `,
|
|
398
|
+
${indentation}`;
|
|
399
|
+
whitespace = " ";
|
|
400
|
+
}
|
|
401
|
+
let separator = "";
|
|
402
|
+
for (const key2 of replacer) {
|
|
403
|
+
const tmp = stringifyArrayReplacer(key2, value[key2], stack, replacer, spacer, indentation);
|
|
404
|
+
if (tmp !== void 0) {
|
|
405
|
+
res += `${separator}${strEscape(key2)}:${whitespace}${tmp}`;
|
|
406
|
+
separator = join;
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
if (spacer !== "" && separator.length > 1) {
|
|
410
|
+
res = `
|
|
411
|
+
${indentation}${res}
|
|
412
|
+
${originalIndentation}`;
|
|
413
|
+
}
|
|
414
|
+
stack.pop();
|
|
415
|
+
return `{${res}}`;
|
|
416
|
+
}
|
|
417
|
+
case "number":
|
|
418
|
+
return isFinite(value) ? String(value) : fail ? fail(value) : "null";
|
|
419
|
+
case "boolean":
|
|
420
|
+
return value === true ? "true" : "false";
|
|
421
|
+
case "undefined":
|
|
422
|
+
return void 0;
|
|
423
|
+
case "bigint":
|
|
424
|
+
if (bigint) {
|
|
425
|
+
return String(value);
|
|
426
|
+
}
|
|
427
|
+
// fallthrough
|
|
428
|
+
default:
|
|
429
|
+
return fail ? fail(value) : void 0;
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
function stringifyIndent(key, value, stack, spacer, indentation) {
|
|
433
|
+
switch (typeof value) {
|
|
434
|
+
case "string":
|
|
435
|
+
return strEscape(value);
|
|
436
|
+
case "object": {
|
|
437
|
+
if (value === null) {
|
|
438
|
+
return "null";
|
|
439
|
+
}
|
|
440
|
+
if (typeof value.toJSON === "function") {
|
|
441
|
+
value = value.toJSON(key);
|
|
442
|
+
if (typeof value !== "object") {
|
|
443
|
+
return stringifyIndent(key, value, stack, spacer, indentation);
|
|
444
|
+
}
|
|
445
|
+
if (value === null) {
|
|
446
|
+
return "null";
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
if (stack.indexOf(value) !== -1) {
|
|
450
|
+
return circularValue;
|
|
451
|
+
}
|
|
452
|
+
const originalIndentation = indentation;
|
|
453
|
+
if (Array.isArray(value)) {
|
|
454
|
+
if (value.length === 0) {
|
|
455
|
+
return "[]";
|
|
456
|
+
}
|
|
457
|
+
if (maximumDepth < stack.length + 1) {
|
|
458
|
+
return '"[Array]"';
|
|
459
|
+
}
|
|
460
|
+
stack.push(value);
|
|
461
|
+
indentation += spacer;
|
|
462
|
+
let res2 = `
|
|
463
|
+
${indentation}`;
|
|
464
|
+
const join2 = `,
|
|
465
|
+
${indentation}`;
|
|
466
|
+
const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
|
|
467
|
+
let i = 0;
|
|
468
|
+
for (; i < maximumValuesToStringify - 1; i++) {
|
|
469
|
+
const tmp2 = stringifyIndent(String(i), value[i], stack, spacer, indentation);
|
|
470
|
+
res2 += tmp2 !== void 0 ? tmp2 : "null";
|
|
471
|
+
res2 += join2;
|
|
472
|
+
}
|
|
473
|
+
const tmp = stringifyIndent(String(i), value[i], stack, spacer, indentation);
|
|
474
|
+
res2 += tmp !== void 0 ? tmp : "null";
|
|
475
|
+
if (value.length - 1 > maximumBreadth) {
|
|
476
|
+
const removedKeys = value.length - maximumBreadth - 1;
|
|
477
|
+
res2 += `${join2}"... ${getItemCount(removedKeys)} not stringified"`;
|
|
478
|
+
}
|
|
479
|
+
res2 += `
|
|
480
|
+
${originalIndentation}`;
|
|
481
|
+
stack.pop();
|
|
482
|
+
return `[${res2}]`;
|
|
483
|
+
}
|
|
484
|
+
let keys = Object.keys(value);
|
|
485
|
+
const keyLength = keys.length;
|
|
486
|
+
if (keyLength === 0) {
|
|
487
|
+
return "{}";
|
|
488
|
+
}
|
|
489
|
+
if (maximumDepth < stack.length + 1) {
|
|
490
|
+
return '"[Object]"';
|
|
491
|
+
}
|
|
492
|
+
indentation += spacer;
|
|
493
|
+
const join = `,
|
|
494
|
+
${indentation}`;
|
|
495
|
+
let res = "";
|
|
496
|
+
let separator = "";
|
|
497
|
+
let maximumPropertiesToStringify = Math.min(keyLength, maximumBreadth);
|
|
498
|
+
if (isTypedArrayWithEntries(value)) {
|
|
499
|
+
res += stringifyTypedArray(value, join, maximumBreadth);
|
|
500
|
+
keys = keys.slice(value.length);
|
|
501
|
+
maximumPropertiesToStringify -= value.length;
|
|
502
|
+
separator = join;
|
|
503
|
+
}
|
|
504
|
+
if (deterministic) {
|
|
505
|
+
keys = sort(keys, comparator);
|
|
506
|
+
}
|
|
507
|
+
stack.push(value);
|
|
508
|
+
for (let i = 0; i < maximumPropertiesToStringify; i++) {
|
|
509
|
+
const key2 = keys[i];
|
|
510
|
+
const tmp = stringifyIndent(key2, value[key2], stack, spacer, indentation);
|
|
511
|
+
if (tmp !== void 0) {
|
|
512
|
+
res += `${separator}${strEscape(key2)}: ${tmp}`;
|
|
513
|
+
separator = join;
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
if (keyLength > maximumBreadth) {
|
|
517
|
+
const removedKeys = keyLength - maximumBreadth;
|
|
518
|
+
res += `${separator}"...": "${getItemCount(removedKeys)} not stringified"`;
|
|
519
|
+
separator = join;
|
|
520
|
+
}
|
|
521
|
+
if (separator !== "") {
|
|
522
|
+
res = `
|
|
523
|
+
${indentation}${res}
|
|
524
|
+
${originalIndentation}`;
|
|
525
|
+
}
|
|
526
|
+
stack.pop();
|
|
527
|
+
return `{${res}}`;
|
|
528
|
+
}
|
|
529
|
+
case "number":
|
|
530
|
+
return isFinite(value) ? String(value) : fail ? fail(value) : "null";
|
|
531
|
+
case "boolean":
|
|
532
|
+
return value === true ? "true" : "false";
|
|
533
|
+
case "undefined":
|
|
534
|
+
return void 0;
|
|
535
|
+
case "bigint":
|
|
536
|
+
if (bigint) {
|
|
537
|
+
return String(value);
|
|
538
|
+
}
|
|
539
|
+
// fallthrough
|
|
540
|
+
default:
|
|
541
|
+
return fail ? fail(value) : void 0;
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
function stringifySimple(key, value, stack) {
|
|
545
|
+
switch (typeof value) {
|
|
546
|
+
case "string":
|
|
547
|
+
return strEscape(value);
|
|
548
|
+
case "object": {
|
|
549
|
+
if (value === null) {
|
|
550
|
+
return "null";
|
|
551
|
+
}
|
|
552
|
+
if (typeof value.toJSON === "function") {
|
|
553
|
+
value = value.toJSON(key);
|
|
554
|
+
if (typeof value !== "object") {
|
|
555
|
+
return stringifySimple(key, value, stack);
|
|
556
|
+
}
|
|
557
|
+
if (value === null) {
|
|
558
|
+
return "null";
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
if (stack.indexOf(value) !== -1) {
|
|
562
|
+
return circularValue;
|
|
563
|
+
}
|
|
564
|
+
let res = "";
|
|
565
|
+
const hasLength = value.length !== void 0;
|
|
566
|
+
if (hasLength && Array.isArray(value)) {
|
|
567
|
+
if (value.length === 0) {
|
|
568
|
+
return "[]";
|
|
569
|
+
}
|
|
570
|
+
if (maximumDepth < stack.length + 1) {
|
|
571
|
+
return '"[Array]"';
|
|
572
|
+
}
|
|
573
|
+
stack.push(value);
|
|
574
|
+
const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
|
|
575
|
+
let i = 0;
|
|
576
|
+
for (; i < maximumValuesToStringify - 1; i++) {
|
|
577
|
+
const tmp2 = stringifySimple(String(i), value[i], stack);
|
|
578
|
+
res += tmp2 !== void 0 ? tmp2 : "null";
|
|
579
|
+
res += ",";
|
|
580
|
+
}
|
|
581
|
+
const tmp = stringifySimple(String(i), value[i], stack);
|
|
582
|
+
res += tmp !== void 0 ? tmp : "null";
|
|
583
|
+
if (value.length - 1 > maximumBreadth) {
|
|
584
|
+
const removedKeys = value.length - maximumBreadth - 1;
|
|
585
|
+
res += `,"... ${getItemCount(removedKeys)} not stringified"`;
|
|
586
|
+
}
|
|
587
|
+
stack.pop();
|
|
588
|
+
return `[${res}]`;
|
|
589
|
+
}
|
|
590
|
+
let keys = Object.keys(value);
|
|
591
|
+
const keyLength = keys.length;
|
|
592
|
+
if (keyLength === 0) {
|
|
593
|
+
return "{}";
|
|
594
|
+
}
|
|
595
|
+
if (maximumDepth < stack.length + 1) {
|
|
596
|
+
return '"[Object]"';
|
|
597
|
+
}
|
|
598
|
+
let separator = "";
|
|
599
|
+
let maximumPropertiesToStringify = Math.min(keyLength, maximumBreadth);
|
|
600
|
+
if (hasLength && isTypedArrayWithEntries(value)) {
|
|
601
|
+
res += stringifyTypedArray(value, ",", maximumBreadth);
|
|
602
|
+
keys = keys.slice(value.length);
|
|
603
|
+
maximumPropertiesToStringify -= value.length;
|
|
604
|
+
separator = ",";
|
|
605
|
+
}
|
|
606
|
+
if (deterministic) {
|
|
607
|
+
keys = sort(keys, comparator);
|
|
608
|
+
}
|
|
609
|
+
stack.push(value);
|
|
610
|
+
for (let i = 0; i < maximumPropertiesToStringify; i++) {
|
|
611
|
+
const key2 = keys[i];
|
|
612
|
+
const tmp = stringifySimple(key2, value[key2], stack);
|
|
613
|
+
if (tmp !== void 0) {
|
|
614
|
+
res += `${separator}${strEscape(key2)}:${tmp}`;
|
|
615
|
+
separator = ",";
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
if (keyLength > maximumBreadth) {
|
|
619
|
+
const removedKeys = keyLength - maximumBreadth;
|
|
620
|
+
res += `${separator}"...":"${getItemCount(removedKeys)} not stringified"`;
|
|
621
|
+
}
|
|
622
|
+
stack.pop();
|
|
623
|
+
return `{${res}}`;
|
|
624
|
+
}
|
|
625
|
+
case "number":
|
|
626
|
+
return isFinite(value) ? String(value) : fail ? fail(value) : "null";
|
|
627
|
+
case "boolean":
|
|
628
|
+
return value === true ? "true" : "false";
|
|
629
|
+
case "undefined":
|
|
630
|
+
return void 0;
|
|
631
|
+
case "bigint":
|
|
632
|
+
if (bigint) {
|
|
633
|
+
return String(value);
|
|
634
|
+
}
|
|
635
|
+
// fallthrough
|
|
636
|
+
default:
|
|
637
|
+
return fail ? fail(value) : void 0;
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
function stringify2(value, replacer, space) {
|
|
641
|
+
if (arguments.length > 1) {
|
|
642
|
+
let spacer = "";
|
|
643
|
+
if (typeof space === "number") {
|
|
644
|
+
spacer = " ".repeat(Math.min(space, 10));
|
|
645
|
+
} else if (typeof space === "string") {
|
|
646
|
+
spacer = space.slice(0, 10);
|
|
647
|
+
}
|
|
648
|
+
if (replacer != null) {
|
|
649
|
+
if (typeof replacer === "function") {
|
|
650
|
+
return stringifyFnReplacer("", { "": value }, [], replacer, spacer, "");
|
|
651
|
+
}
|
|
652
|
+
if (Array.isArray(replacer)) {
|
|
653
|
+
return stringifyArrayReplacer("", value, [], getUniqueReplacerSet(replacer), spacer, "");
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
if (spacer.length !== 0) {
|
|
657
|
+
return stringifyIndent("", value, [], spacer, "");
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
return stringifySimple("", value, []);
|
|
661
|
+
}
|
|
662
|
+
return stringify2;
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
});
|
|
666
|
+
|
|
667
|
+
// types/enum/EHttpStatusCode.ts
|
|
668
|
+
var EHttpStatusCode = /* @__PURE__ */ ((EHttpStatusCode2) => {
|
|
669
|
+
EHttpStatusCode2[EHttpStatusCode2["CONTINUE"] = 100] = "CONTINUE";
|
|
670
|
+
EHttpStatusCode2[EHttpStatusCode2["SWITCHING_PROTOCOLS"] = 101] = "SWITCHING_PROTOCOLS";
|
|
671
|
+
EHttpStatusCode2[EHttpStatusCode2["PROCESSING"] = 102] = "PROCESSING";
|
|
672
|
+
EHttpStatusCode2[EHttpStatusCode2["OK"] = 200] = "OK";
|
|
673
|
+
EHttpStatusCode2[EHttpStatusCode2["CREATED"] = 201] = "CREATED";
|
|
674
|
+
EHttpStatusCode2[EHttpStatusCode2["ACCEPTED"] = 202] = "ACCEPTED";
|
|
675
|
+
EHttpStatusCode2[EHttpStatusCode2["NON_AUTHORITATIVE_INFORMATION"] = 203] = "NON_AUTHORITATIVE_INFORMATION";
|
|
676
|
+
EHttpStatusCode2[EHttpStatusCode2["NO_CONTENT"] = 204] = "NO_CONTENT";
|
|
677
|
+
EHttpStatusCode2[EHttpStatusCode2["RESET_CONTENT"] = 205] = "RESET_CONTENT";
|
|
678
|
+
EHttpStatusCode2[EHttpStatusCode2["PARTIAL_CONTENT"] = 206] = "PARTIAL_CONTENT";
|
|
679
|
+
EHttpStatusCode2[EHttpStatusCode2["MULTI_STATUS"] = 207] = "MULTI_STATUS";
|
|
680
|
+
EHttpStatusCode2[EHttpStatusCode2["ALREADY_REPORTED"] = 208] = "ALREADY_REPORTED";
|
|
681
|
+
EHttpStatusCode2[EHttpStatusCode2["IM_USED"] = 226] = "IM_USED";
|
|
682
|
+
EHttpStatusCode2[EHttpStatusCode2["MULTIPLE_CHOICES"] = 300] = "MULTIPLE_CHOICES";
|
|
683
|
+
EHttpStatusCode2[EHttpStatusCode2["MOVED_PERMANENTLY"] = 301] = "MOVED_PERMANENTLY";
|
|
684
|
+
EHttpStatusCode2[EHttpStatusCode2["FOUND"] = 302] = "FOUND";
|
|
685
|
+
EHttpStatusCode2[EHttpStatusCode2["SEE_OTHER"] = 303] = "SEE_OTHER";
|
|
686
|
+
EHttpStatusCode2[EHttpStatusCode2["NOT_MODIFIED"] = 304] = "NOT_MODIFIED";
|
|
687
|
+
EHttpStatusCode2[EHttpStatusCode2["USE_PROXY"] = 305] = "USE_PROXY";
|
|
688
|
+
EHttpStatusCode2[EHttpStatusCode2["SWITCH_PROXY"] = 306] = "SWITCH_PROXY";
|
|
689
|
+
EHttpStatusCode2[EHttpStatusCode2["TEMPORARY_REDIRECT"] = 307] = "TEMPORARY_REDIRECT";
|
|
690
|
+
EHttpStatusCode2[EHttpStatusCode2["PERMANENT_REDIRECT"] = 308] = "PERMANENT_REDIRECT";
|
|
691
|
+
EHttpStatusCode2[EHttpStatusCode2["BAD_REQUEST"] = 400] = "BAD_REQUEST";
|
|
692
|
+
EHttpStatusCode2[EHttpStatusCode2["UNAUTHORIZED"] = 401] = "UNAUTHORIZED";
|
|
693
|
+
EHttpStatusCode2[EHttpStatusCode2["PAYMENT_REQUIRED"] = 402] = "PAYMENT_REQUIRED";
|
|
694
|
+
EHttpStatusCode2[EHttpStatusCode2["FORBIDDEN"] = 403] = "FORBIDDEN";
|
|
695
|
+
EHttpStatusCode2[EHttpStatusCode2["NOT_FOUND"] = 404] = "NOT_FOUND";
|
|
696
|
+
EHttpStatusCode2[EHttpStatusCode2["METHOD_NOT_ALLOWED"] = 405] = "METHOD_NOT_ALLOWED";
|
|
697
|
+
EHttpStatusCode2[EHttpStatusCode2["NOT_ACCEPTABLE"] = 406] = "NOT_ACCEPTABLE";
|
|
698
|
+
EHttpStatusCode2[EHttpStatusCode2["PROXY_AUTHENTICATION_REQUIRED"] = 407] = "PROXY_AUTHENTICATION_REQUIRED";
|
|
699
|
+
EHttpStatusCode2[EHttpStatusCode2["REQUEST_TIMEOUT"] = 408] = "REQUEST_TIMEOUT";
|
|
700
|
+
EHttpStatusCode2[EHttpStatusCode2["CONFLICT"] = 409] = "CONFLICT";
|
|
701
|
+
EHttpStatusCode2[EHttpStatusCode2["GONE"] = 410] = "GONE";
|
|
702
|
+
EHttpStatusCode2[EHttpStatusCode2["LENGTH_REQUIRED"] = 411] = "LENGTH_REQUIRED";
|
|
703
|
+
EHttpStatusCode2[EHttpStatusCode2["PRECONDITION_FAILED"] = 412] = "PRECONDITION_FAILED";
|
|
704
|
+
EHttpStatusCode2[EHttpStatusCode2["PAYLOAD_TOO_LARGE"] = 413] = "PAYLOAD_TOO_LARGE";
|
|
705
|
+
EHttpStatusCode2[EHttpStatusCode2["URI_TOO_LONG"] = 414] = "URI_TOO_LONG";
|
|
706
|
+
EHttpStatusCode2[EHttpStatusCode2["UNSUPPORTED_MEDIA_TYPE"] = 415] = "UNSUPPORTED_MEDIA_TYPE";
|
|
707
|
+
EHttpStatusCode2[EHttpStatusCode2["RANGE_NOT_SATISFIABLE"] = 416] = "RANGE_NOT_SATISFIABLE";
|
|
708
|
+
EHttpStatusCode2[EHttpStatusCode2["EXPECTATION_FAILED"] = 417] = "EXPECTATION_FAILED";
|
|
709
|
+
EHttpStatusCode2[EHttpStatusCode2["I_AM_A_TEAPOT"] = 418] = "I_AM_A_TEAPOT";
|
|
710
|
+
EHttpStatusCode2[EHttpStatusCode2["MISDIRECTED_REQUEST"] = 421] = "MISDIRECTED_REQUEST";
|
|
711
|
+
EHttpStatusCode2[EHttpStatusCode2["UNPROCESSABLE_ENTITY"] = 422] = "UNPROCESSABLE_ENTITY";
|
|
712
|
+
EHttpStatusCode2[EHttpStatusCode2["LOCKED"] = 423] = "LOCKED";
|
|
713
|
+
EHttpStatusCode2[EHttpStatusCode2["FAILED_DEPENDENCY"] = 424] = "FAILED_DEPENDENCY";
|
|
714
|
+
EHttpStatusCode2[EHttpStatusCode2["UPGRADE_REQUIRED"] = 426] = "UPGRADE_REQUIRED";
|
|
715
|
+
EHttpStatusCode2[EHttpStatusCode2["PRECONDITION_REQUIRED"] = 428] = "PRECONDITION_REQUIRED";
|
|
716
|
+
EHttpStatusCode2[EHttpStatusCode2["TOO_MANY_REQUESTS"] = 429] = "TOO_MANY_REQUESTS";
|
|
717
|
+
EHttpStatusCode2[EHttpStatusCode2["REQUEST_HEADER_FIELDS_TOO_LARGE"] = 431] = "REQUEST_HEADER_FIELDS_TOO_LARGE";
|
|
718
|
+
EHttpStatusCode2[EHttpStatusCode2["UNAVAILABLE_FOR_LEGAL_REASONS"] = 451] = "UNAVAILABLE_FOR_LEGAL_REASONS";
|
|
719
|
+
EHttpStatusCode2[EHttpStatusCode2["INTERNAL_SERVER_ERROR"] = 500] = "INTERNAL_SERVER_ERROR";
|
|
720
|
+
EHttpStatusCode2[EHttpStatusCode2["NOT_IMPLEMENTED"] = 501] = "NOT_IMPLEMENTED";
|
|
721
|
+
EHttpStatusCode2[EHttpStatusCode2["BAD_GATEWAY"] = 502] = "BAD_GATEWAY";
|
|
722
|
+
EHttpStatusCode2[EHttpStatusCode2["SERVICE_UNAVAILABLE"] = 503] = "SERVICE_UNAVAILABLE";
|
|
723
|
+
EHttpStatusCode2[EHttpStatusCode2["GATEWAY_TIMEOUT"] = 504] = "GATEWAY_TIMEOUT";
|
|
724
|
+
EHttpStatusCode2[EHttpStatusCode2["HTTP_VERSION_NOT_SUPPORTED"] = 505] = "HTTP_VERSION_NOT_SUPPORTED";
|
|
725
|
+
EHttpStatusCode2[EHttpStatusCode2["VARIANT_ALSO_NEGOTIATES"] = 506] = "VARIANT_ALSO_NEGOTIATES";
|
|
726
|
+
EHttpStatusCode2[EHttpStatusCode2["INSUFFICIENT_STORAGE"] = 507] = "INSUFFICIENT_STORAGE";
|
|
727
|
+
EHttpStatusCode2[EHttpStatusCode2["LOOP_DETECTED"] = 508] = "LOOP_DETECTED";
|
|
728
|
+
EHttpStatusCode2[EHttpStatusCode2["NOT_EXTENDED"] = 510] = "NOT_EXTENDED";
|
|
729
|
+
EHttpStatusCode2[EHttpStatusCode2["NETWORK_AUTHENTICATION_REQUIRED"] = 511] = "NETWORK_AUTHENTICATION_REQUIRED";
|
|
730
|
+
return EHttpStatusCode2;
|
|
731
|
+
})(EHttpStatusCode || {});
|
|
732
|
+
|
|
733
|
+
// types/enum/ELocale.ts
|
|
734
|
+
var ELocale = /* @__PURE__ */ ((ELocale2) => {
|
|
735
|
+
ELocale2["English"] = "en";
|
|
736
|
+
ELocale2["Spanish"] = "es";
|
|
737
|
+
ELocale2["Turkish"] = "tr";
|
|
738
|
+
return ELocale2;
|
|
739
|
+
})(ELocale || {});
|
|
740
|
+
|
|
741
|
+
// types/enum/EPayLinkStatus.ts
|
|
742
|
+
var EPayLinkStatus = /* @__PURE__ */ ((EPayLinkStatus2) => {
|
|
743
|
+
EPayLinkStatus2[EPayLinkStatus2["Active"] = 0] = "Active";
|
|
744
|
+
EPayLinkStatus2[EPayLinkStatus2["Paid"] = 1] = "Paid";
|
|
745
|
+
EPayLinkStatus2[EPayLinkStatus2["Expired"] = 2] = "Expired";
|
|
746
|
+
return EPayLinkStatus2;
|
|
747
|
+
})(EPayLinkStatus || {});
|
|
748
|
+
|
|
749
|
+
// types/primitives/ApiToken.ts
|
|
750
|
+
import { make } from "ts-brand";
|
|
751
|
+
var ApiToken = make();
|
|
752
|
+
|
|
753
|
+
// types/primitives/BigNumberString.ts
|
|
754
|
+
import { make as make2 } from "ts-brand";
|
|
755
|
+
var BigNumberString = make2();
|
|
756
|
+
|
|
757
|
+
// types/primitives/Base64String.ts
|
|
758
|
+
import { make as make3 } from "ts-brand";
|
|
759
|
+
var Base64String = make3();
|
|
760
|
+
|
|
761
|
+
// types/primitives/DecimalAmount.ts
|
|
762
|
+
import { make as make4 } from "ts-brand";
|
|
763
|
+
var DecimalAmount = make4();
|
|
764
|
+
|
|
765
|
+
// types/primitives/EVMAccountAddress.ts
|
|
766
|
+
import { make as make5 } from "ts-brand";
|
|
767
|
+
var EVMAccountAddress = make5();
|
|
768
|
+
|
|
769
|
+
// types/primitives/EVMContractAddress.ts
|
|
770
|
+
import { make as make6 } from "ts-brand";
|
|
771
|
+
var EVMContractAddress = make6();
|
|
772
|
+
|
|
773
|
+
// types/primitives/HexString.ts
|
|
774
|
+
import { make as make7 } from "ts-brand";
|
|
775
|
+
var HexString = make7();
|
|
776
|
+
|
|
777
|
+
// types/primitives/ISO8601DateString.ts
|
|
778
|
+
import { make as make8 } from "ts-brand";
|
|
779
|
+
var ISO8601DateString = make8();
|
|
780
|
+
|
|
781
|
+
// types/primitives/JSONWebToken.ts
|
|
782
|
+
import { make as make9 } from "ts-brand";
|
|
783
|
+
var JsonWebToken = make9();
|
|
784
|
+
|
|
785
|
+
// types/primitives/JSONString.ts
|
|
786
|
+
import { make as make10 } from "ts-brand";
|
|
787
|
+
var JSONString = make10();
|
|
788
|
+
|
|
789
|
+
// types/primitives/MillisecondTimestamp.ts
|
|
790
|
+
import { make as make11 } from "ts-brand";
|
|
791
|
+
var MillisecondTimestamp = make11();
|
|
792
|
+
|
|
793
|
+
// types/primitives/PayLinkId.ts
|
|
794
|
+
import { make as make12 } from "ts-brand";
|
|
795
|
+
var PayLinkId = make12();
|
|
796
|
+
|
|
797
|
+
// types/primitives/PayLinkPaymentId.ts
|
|
798
|
+
import { make as make13 } from "ts-brand";
|
|
799
|
+
var PayLinkPaymentId = make13();
|
|
800
|
+
|
|
801
|
+
// types/primitives/RelayerTransactionId.ts
|
|
802
|
+
import { make as make14 } from "ts-brand";
|
|
803
|
+
var RelayerTransactionId = make14();
|
|
804
|
+
|
|
805
|
+
// types/primitives/Signature.ts
|
|
806
|
+
import { make as make15 } from "ts-brand";
|
|
807
|
+
var Signature = make15();
|
|
808
|
+
|
|
809
|
+
// types/primitives/TransactionHash.ts
|
|
810
|
+
import { make as make16 } from "ts-brand";
|
|
811
|
+
var TransactionHash = make16();
|
|
812
|
+
|
|
813
|
+
// types/primitives/UnixTimestamp.ts
|
|
814
|
+
import { make as make17 } from "ts-brand";
|
|
815
|
+
var UnixTimestamp = make17();
|
|
816
|
+
|
|
817
|
+
// types/primitives/URLString.ts
|
|
818
|
+
import { make as make18 } from "ts-brand";
|
|
819
|
+
var URLString = make18();
|
|
820
|
+
|
|
821
|
+
// types/primitives/USDCAmount.ts
|
|
822
|
+
import { make as make19 } from "ts-brand";
|
|
823
|
+
var USDCAmount = make19();
|
|
824
|
+
|
|
825
|
+
// types/primitives/UserId.ts
|
|
826
|
+
import { make as make20 } from "ts-brand";
|
|
827
|
+
var UserId = make20();
|
|
828
|
+
|
|
829
|
+
// types/primitives/Username.ts
|
|
830
|
+
import { make as make21 } from "ts-brand";
|
|
831
|
+
var Username = make21();
|
|
832
|
+
|
|
833
|
+
// types/errors/BaseError.ts
|
|
834
|
+
var BaseError = class extends Error {
|
|
835
|
+
constructor(src, errorType) {
|
|
836
|
+
super(src.message);
|
|
837
|
+
this.name = errorType;
|
|
838
|
+
this.stack = src.stack;
|
|
839
|
+
Object.setPrototypeOf(this, this.constructor.prototype);
|
|
840
|
+
}
|
|
841
|
+
// Helper method to get error details
|
|
842
|
+
getErrorDetails() {
|
|
843
|
+
return {
|
|
844
|
+
name: this.name,
|
|
845
|
+
message: this.message,
|
|
846
|
+
errorCode: this.errorCode,
|
|
847
|
+
errorType: this.errorType,
|
|
848
|
+
stack: this.stack
|
|
849
|
+
};
|
|
850
|
+
}
|
|
851
|
+
};
|
|
852
|
+
|
|
853
|
+
// types/errors/AjaxError.ts
|
|
854
|
+
var AjaxError = class _AjaxError extends BaseError {
|
|
855
|
+
errorCode = "ERR_AJAX";
|
|
856
|
+
errorType = "AjaxError";
|
|
857
|
+
httpStatus = 500 /* INTERNAL_SERVER_ERROR */;
|
|
858
|
+
constructor(src) {
|
|
859
|
+
super(src, "AjaxError");
|
|
860
|
+
}
|
|
861
|
+
// Static factory method
|
|
862
|
+
static fromError(src) {
|
|
863
|
+
return new _AjaxError(src);
|
|
864
|
+
}
|
|
865
|
+
// Static type guard method
|
|
866
|
+
static isError(error) {
|
|
867
|
+
return error instanceof _AjaxError;
|
|
868
|
+
}
|
|
869
|
+
};
|
|
870
|
+
|
|
871
|
+
// types/errors/ProxyError.ts
|
|
872
|
+
var ProxyError = class _ProxyError extends BaseError {
|
|
873
|
+
errorCode = "ERR_PROXY";
|
|
874
|
+
errorType = "ProxyError";
|
|
875
|
+
httpStatus = 500 /* INTERNAL_SERVER_ERROR */;
|
|
876
|
+
constructor(src) {
|
|
877
|
+
super(src, "ProxyError");
|
|
878
|
+
}
|
|
879
|
+
// Static factory method
|
|
880
|
+
static fromError(src) {
|
|
881
|
+
return new _ProxyError(src);
|
|
882
|
+
}
|
|
883
|
+
// Static type guard method
|
|
884
|
+
static isError(error) {
|
|
885
|
+
return error instanceof _ProxyError;
|
|
886
|
+
}
|
|
887
|
+
};
|
|
888
|
+
|
|
889
|
+
// types/errors/RetryError.ts
|
|
890
|
+
var RetryError = class _RetryError extends BaseError {
|
|
891
|
+
errorCode = "ERR_RETRY";
|
|
892
|
+
errorType = "REtryError";
|
|
893
|
+
httpStatus = 418 /* I_AM_A_TEAPOT */;
|
|
894
|
+
constructor(src) {
|
|
895
|
+
super(src, "RetryError");
|
|
896
|
+
}
|
|
897
|
+
// Static factory method
|
|
898
|
+
static fromError(src) {
|
|
899
|
+
return new _RetryError(src);
|
|
900
|
+
}
|
|
901
|
+
// Static type guard method
|
|
902
|
+
static isError(error) {
|
|
903
|
+
return error instanceof _RetryError;
|
|
904
|
+
}
|
|
905
|
+
};
|
|
906
|
+
|
|
907
|
+
// types/errors/ValidationError.ts
|
|
908
|
+
var ValidationError = class _ValidationError extends BaseError {
|
|
909
|
+
errorCode = "ERR_VALIDATION";
|
|
910
|
+
errorType = "ValidationError";
|
|
911
|
+
httpStatus = 400 /* BAD_REQUEST */;
|
|
912
|
+
constructor(src) {
|
|
913
|
+
super(src, "ValidationError");
|
|
914
|
+
}
|
|
915
|
+
// Static factory method
|
|
916
|
+
static fromError(src) {
|
|
917
|
+
return new _ValidationError(src);
|
|
918
|
+
}
|
|
919
|
+
// Static type guard method
|
|
920
|
+
static isError(error) {
|
|
921
|
+
return error instanceof _ValidationError;
|
|
922
|
+
}
|
|
923
|
+
};
|
|
924
|
+
|
|
925
|
+
// types/models/OAuthTokenModel.ts
|
|
926
|
+
var OAuthTokenModel = class {
|
|
927
|
+
constructor(access_token, token_type, expires_in) {
|
|
928
|
+
this.access_token = access_token;
|
|
929
|
+
this.token_type = token_type;
|
|
930
|
+
this.expires_in = expires_in;
|
|
931
|
+
}
|
|
932
|
+
};
|
|
933
|
+
|
|
934
|
+
// utils/AjaxUtils.ts
|
|
935
|
+
import { ResultAsync } from "neverthrow";
|
|
936
|
+
function isJsonBody(data) {
|
|
937
|
+
return typeof data === "object" && data !== null && !(data instanceof ArrayBuffer) && !(data instanceof Blob) && !(data instanceof FormData) && !(data instanceof URLSearchParams) && !ArrayBuffer.isView(data) && typeof data.getReader !== "function";
|
|
938
|
+
}
|
|
939
|
+
function bodyToRequestInit(data) {
|
|
940
|
+
if (data === void 0 || data === null) {
|
|
941
|
+
return {};
|
|
942
|
+
}
|
|
943
|
+
if (isJsonBody(data)) {
|
|
944
|
+
return {
|
|
945
|
+
body: JSON.stringify(data),
|
|
946
|
+
headers: {
|
|
947
|
+
"Content-Type": "application/json"
|
|
948
|
+
}
|
|
949
|
+
};
|
|
950
|
+
}
|
|
951
|
+
return { body: data };
|
|
952
|
+
}
|
|
953
|
+
var AjaxUtils = class {
|
|
954
|
+
defaultToken = "";
|
|
955
|
+
setDefaultToken(token) {
|
|
956
|
+
this.defaultToken = token;
|
|
957
|
+
}
|
|
958
|
+
get(url, config) {
|
|
959
|
+
return this.doFetch(url, this.mergeConfig(config, { method: "GET" }));
|
|
960
|
+
}
|
|
961
|
+
post(url, data, config) {
|
|
962
|
+
const { body, headers } = bodyToRequestInit(data);
|
|
963
|
+
const init = { method: "POST" };
|
|
964
|
+
if (body !== void 0) init.body = body;
|
|
965
|
+
if (headers !== void 0) init.headers = headers;
|
|
966
|
+
return this.doFetch(url, this.mergeConfig(config, init));
|
|
967
|
+
}
|
|
968
|
+
put(url, data, config) {
|
|
969
|
+
const { body, headers } = bodyToRequestInit(data);
|
|
970
|
+
return this.doFetch(
|
|
971
|
+
url,
|
|
972
|
+
this.mergeConfig(config, { method: "PUT", body, headers })
|
|
973
|
+
);
|
|
974
|
+
}
|
|
975
|
+
delete(url, config) {
|
|
976
|
+
return this.doFetch(url, this.mergeConfig(config, { method: "DELETE" }));
|
|
977
|
+
}
|
|
978
|
+
mergeConfig(config, init) {
|
|
979
|
+
const headers = new Headers(init.headers);
|
|
980
|
+
if (config?.headers) {
|
|
981
|
+
const c = new Headers(config.headers);
|
|
982
|
+
c.forEach((v, k) => headers.set(k, v));
|
|
983
|
+
}
|
|
984
|
+
if (this.defaultToken) {
|
|
985
|
+
headers.set("Authorization", `Bearer ${this.defaultToken}`);
|
|
986
|
+
}
|
|
987
|
+
return {
|
|
988
|
+
...config,
|
|
989
|
+
...init,
|
|
990
|
+
headers
|
|
991
|
+
};
|
|
992
|
+
}
|
|
993
|
+
doFetch(url, init) {
|
|
994
|
+
return ResultAsync.fromPromise(
|
|
995
|
+
(async () => {
|
|
996
|
+
const res = await fetch(url, init);
|
|
997
|
+
if (!res.ok) {
|
|
998
|
+
const text = await res.text();
|
|
999
|
+
throw new Error(
|
|
1000
|
+
`HTTP ${res.status} ${res.statusText}${text ? `: ${text}` : ""}`
|
|
1001
|
+
);
|
|
1002
|
+
}
|
|
1003
|
+
const contentType = res.headers.get("content-type") ?? "";
|
|
1004
|
+
if (contentType.toLowerCase().includes("application/json")) {
|
|
1005
|
+
return await res.json();
|
|
1006
|
+
}
|
|
1007
|
+
return await res.text();
|
|
1008
|
+
})(),
|
|
1009
|
+
(e) => AjaxError.fromError(e)
|
|
1010
|
+
);
|
|
1011
|
+
}
|
|
1012
|
+
};
|
|
1013
|
+
|
|
1014
|
+
// utils/ITimeUtils.ts
|
|
1015
|
+
var ITimeUtilsType = /* @__PURE__ */ Symbol.for("ITimeUtils");
|
|
1016
|
+
|
|
1017
|
+
// utils/ObjectUtils.ts
|
|
1018
|
+
import { okAsync, ResultAsync as ResultAsync2 } from "neverthrow";
|
|
1019
|
+
|
|
1020
|
+
// ../../node_modules/safe-stable-stringify/esm/wrapper.js
|
|
1021
|
+
var import__ = __toESM(require_safe_stable_stringify(), 1);
|
|
1022
|
+
var configure = import__.default.configure;
|
|
1023
|
+
var wrapper_default = import__.default;
|
|
1024
|
+
|
|
1025
|
+
// utils/ObjectUtils.ts
|
|
1026
|
+
var ObjectUtils = class _ObjectUtils {
|
|
1027
|
+
// Taken from https://stackoverflow.com/questions/27936772/how-to-deep-merge-instead-of-shallow-merge
|
|
1028
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1029
|
+
static mergeDeep(...objects) {
|
|
1030
|
+
const isObject = (obj) => obj && typeof obj === "object";
|
|
1031
|
+
return objects.reduce((prev, obj) => {
|
|
1032
|
+
Object.keys(obj).forEach((key) => {
|
|
1033
|
+
const pVal = prev[key];
|
|
1034
|
+
const oVal = obj[key];
|
|
1035
|
+
if (Array.isArray(pVal) && Array.isArray(oVal)) {
|
|
1036
|
+
prev[key] = pVal.concat(...oVal);
|
|
1037
|
+
} else if (isObject(pVal) && isObject(oVal)) {
|
|
1038
|
+
prev[key] = _ObjectUtils.mergeDeep(pVal, oVal);
|
|
1039
|
+
} else {
|
|
1040
|
+
prev[key] = oVal;
|
|
1041
|
+
}
|
|
1042
|
+
});
|
|
1043
|
+
return prev;
|
|
1044
|
+
}, {});
|
|
1045
|
+
}
|
|
1046
|
+
/**
|
|
1047
|
+
* This method is an improvement on JSON.stringify. It uses a stable stringify method so that objects will always generate the same
|
|
1048
|
+
* hash, and it support a few non-serializeable types that are useful, such as BigInt, Map, and Set. The output is correct JSON
|
|
1049
|
+
* but uses markup to support the non-native types and must be deserialized with the deserialize() method to get the same object
|
|
1050
|
+
* back.
|
|
1051
|
+
* @param obj
|
|
1052
|
+
* @returns
|
|
1053
|
+
*/
|
|
1054
|
+
static serialize(obj) {
|
|
1055
|
+
return JSONString(
|
|
1056
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1057
|
+
wrapper_default(obj, (_key, value) => {
|
|
1058
|
+
if (value instanceof Error) {
|
|
1059
|
+
return {
|
|
1060
|
+
dataType: "Error",
|
|
1061
|
+
value: {
|
|
1062
|
+
name: value.name || "Error",
|
|
1063
|
+
message: value.message || "Unknown error",
|
|
1064
|
+
stack: value.stack || void 0
|
|
1065
|
+
}
|
|
1066
|
+
};
|
|
1067
|
+
} else if (value instanceof Map) {
|
|
1068
|
+
return {
|
|
1069
|
+
dataType: "Map",
|
|
1070
|
+
value: Array.from(value.entries())
|
|
1071
|
+
// or with spread: value: [...value]
|
|
1072
|
+
};
|
|
1073
|
+
} else if (value instanceof Set) {
|
|
1074
|
+
return {
|
|
1075
|
+
dataType: "Set",
|
|
1076
|
+
value: [...value]
|
|
1077
|
+
};
|
|
1078
|
+
} else if (value instanceof BigInt) {
|
|
1079
|
+
return {
|
|
1080
|
+
dataType: "BigInt",
|
|
1081
|
+
value: value.toString()
|
|
1082
|
+
};
|
|
1083
|
+
} else if (typeof value == "bigint") {
|
|
1084
|
+
return {
|
|
1085
|
+
dataType: "bigint",
|
|
1086
|
+
value: BigInt(value).toString()
|
|
1087
|
+
};
|
|
1088
|
+
} else {
|
|
1089
|
+
return value;
|
|
1090
|
+
}
|
|
1091
|
+
})
|
|
1092
|
+
);
|
|
1093
|
+
}
|
|
1094
|
+
static deserialize(json) {
|
|
1095
|
+
return ResultAsync2.fromPromise(
|
|
1096
|
+
Promise.resolve(JSON.parse(json)),
|
|
1097
|
+
(e) => ValidationError.fromError(e)
|
|
1098
|
+
).andThen((parsed) => {
|
|
1099
|
+
const processValue = (value) => {
|
|
1100
|
+
if (typeof value === "object" && value !== null && "dataType" in value && "value" in value) {
|
|
1101
|
+
const dataType = value.dataType;
|
|
1102
|
+
const dataValue = value.value;
|
|
1103
|
+
if (dataType === "Error") {
|
|
1104
|
+
const errorData = dataValue;
|
|
1105
|
+
const error = new Error(errorData.message || "Unknown error");
|
|
1106
|
+
error.name = errorData.name || "Error";
|
|
1107
|
+
if (errorData.stack) {
|
|
1108
|
+
error.stack = errorData.stack;
|
|
1109
|
+
}
|
|
1110
|
+
return error;
|
|
1111
|
+
} else if (dataType === "Map") {
|
|
1112
|
+
return new Map(dataValue);
|
|
1113
|
+
} else if (dataType === "Set") {
|
|
1114
|
+
return new Set(dataValue);
|
|
1115
|
+
} else if (dataType === "BigInt" || dataType === "bigint") {
|
|
1116
|
+
return BigInt(dataValue);
|
|
1117
|
+
}
|
|
1118
|
+
}
|
|
1119
|
+
if (Array.isArray(value)) {
|
|
1120
|
+
return value.map(processValue);
|
|
1121
|
+
} else if (value && typeof value === "object") {
|
|
1122
|
+
const processed2 = {};
|
|
1123
|
+
for (const [key, val] of Object.entries(value)) {
|
|
1124
|
+
processed2[key] = processValue(val);
|
|
1125
|
+
}
|
|
1126
|
+
return processed2;
|
|
1127
|
+
}
|
|
1128
|
+
return value;
|
|
1129
|
+
};
|
|
1130
|
+
const processed = processValue(parsed);
|
|
1131
|
+
return okAsync(processed);
|
|
1132
|
+
});
|
|
1133
|
+
}
|
|
1134
|
+
static deserializeUnsafe(json) {
|
|
1135
|
+
return JSON.parse(json, (_key, value) => {
|
|
1136
|
+
if (typeof value === "object" && value !== null) {
|
|
1137
|
+
if (value.dataType === "Error") {
|
|
1138
|
+
const errorData = value.value;
|
|
1139
|
+
const error = new Error(errorData.message || "Unknown error");
|
|
1140
|
+
error.name = errorData.name || "Error";
|
|
1141
|
+
if (errorData.stack) {
|
|
1142
|
+
error.stack = errorData.stack;
|
|
1143
|
+
}
|
|
1144
|
+
return error;
|
|
1145
|
+
} else if (value.dataType === "Map") {
|
|
1146
|
+
return new Map(value.value);
|
|
1147
|
+
} else if (value.dataType === "Set") {
|
|
1148
|
+
return new Set(value.value);
|
|
1149
|
+
} else if (value.dataType === "BigInt") {
|
|
1150
|
+
return BigInt(value.value);
|
|
1151
|
+
} else if (value.dataType === "bigint") {
|
|
1152
|
+
return BigInt(value.value);
|
|
1153
|
+
}
|
|
1154
|
+
}
|
|
1155
|
+
return value;
|
|
1156
|
+
});
|
|
1157
|
+
}
|
|
1158
|
+
/**
|
|
1159
|
+
* This object will convert an object with a Prototype into a generic object. This can be done by nulling the prototype but that's not
|
|
1160
|
+
* really possible in Typescript, so we we do it differently by cloning the object. This means this is also one way of doing a deep
|
|
1161
|
+
* copy of an object, but it will fail and instanceof() check.
|
|
1162
|
+
* @param obj
|
|
1163
|
+
* @returns
|
|
1164
|
+
*/
|
|
1165
|
+
static toGenericObject(obj) {
|
|
1166
|
+
return _ObjectUtils.deserialize(_ObjectUtils.serialize(obj));
|
|
1167
|
+
}
|
|
1168
|
+
static removeNullValues(array) {
|
|
1169
|
+
function notEmpty(value) {
|
|
1170
|
+
if (value === null || value === void 0) return false;
|
|
1171
|
+
return true;
|
|
1172
|
+
}
|
|
1173
|
+
return array.filter(notEmpty);
|
|
1174
|
+
}
|
|
1175
|
+
static getEnumKeyByValue(enumObj, value) {
|
|
1176
|
+
return Object.keys(enumObj).find((key) => enumObj[key] === value) || "Undefined";
|
|
1177
|
+
}
|
|
1178
|
+
static getEnumKeyByValueSafely(enumObj, value) {
|
|
1179
|
+
const stringKeys = Object.keys(enumObj).filter((key) => isNaN(Number(key)));
|
|
1180
|
+
for (const key of stringKeys) {
|
|
1181
|
+
if (enumObj[key] === value) {
|
|
1182
|
+
return key;
|
|
1183
|
+
}
|
|
1184
|
+
}
|
|
1185
|
+
return "Undefined";
|
|
1186
|
+
}
|
|
1187
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1188
|
+
static convertBigIntsToStrings(input) {
|
|
1189
|
+
if (typeof input === "bigint") {
|
|
1190
|
+
return input.toString();
|
|
1191
|
+
}
|
|
1192
|
+
if (Array.isArray(input)) {
|
|
1193
|
+
return input.map((i) => {
|
|
1194
|
+
return this.convertBigIntsToStrings(i);
|
|
1195
|
+
});
|
|
1196
|
+
}
|
|
1197
|
+
if (input && typeof input === "object") {
|
|
1198
|
+
const result = {};
|
|
1199
|
+
for (const [key, value] of Object.entries(input)) {
|
|
1200
|
+
result[key] = this.convertBigIntsToStrings(value);
|
|
1201
|
+
}
|
|
1202
|
+
return result;
|
|
1203
|
+
}
|
|
1204
|
+
return input;
|
|
1205
|
+
}
|
|
1206
|
+
};
|
|
1207
|
+
|
|
1208
|
+
// utils/TimeUtils.ts
|
|
1209
|
+
import { injectable } from "inversify";
|
|
1210
|
+
var _TimeUtils_decorators, _init;
|
|
1211
|
+
_TimeUtils_decorators = [injectable()];
|
|
1212
|
+
var TimeUtils = class {
|
|
1213
|
+
lastBlockchainCheck;
|
|
1214
|
+
lastBlockchainTimestamp;
|
|
1215
|
+
constructor() {
|
|
1216
|
+
}
|
|
1217
|
+
getUnixNow() {
|
|
1218
|
+
return UnixTimestamp(Math.floor(Date.now() / 1e3));
|
|
1219
|
+
}
|
|
1220
|
+
getMillisecondNow() {
|
|
1221
|
+
return MillisecondTimestamp(Date.now());
|
|
1222
|
+
}
|
|
1223
|
+
getISO8601TimeString(time = MillisecondTimestamp(Date.now())) {
|
|
1224
|
+
return ISO8601DateString(new Date(time).toISOString());
|
|
1225
|
+
}
|
|
1226
|
+
convertTimestampToISOString(unixTimestamp) {
|
|
1227
|
+
const date = new Date(unixTimestamp * 1e3);
|
|
1228
|
+
return ISO8601DateString(date.toISOString());
|
|
1229
|
+
}
|
|
1230
|
+
convertISOStringToTimestamp(isoString) {
|
|
1231
|
+
const date = new Date(isoString);
|
|
1232
|
+
return UnixTimestamp(Math.floor(date.getTime() / 1e3));
|
|
1233
|
+
}
|
|
1234
|
+
getUnixTodayStart() {
|
|
1235
|
+
const date = /* @__PURE__ */ new Date();
|
|
1236
|
+
date.setHours(0, 0, 0, 0);
|
|
1237
|
+
return UnixTimestamp(Math.floor(date.getTime() / 1e3));
|
|
1238
|
+
}
|
|
1239
|
+
getUnixTodayEnd() {
|
|
1240
|
+
const date = /* @__PURE__ */ new Date();
|
|
1241
|
+
date.setHours(23, 59, 59, 999);
|
|
1242
|
+
return UnixTimestamp(Math.floor(date.getTime() / 1e3));
|
|
1243
|
+
}
|
|
1244
|
+
getStartOfMonth() {
|
|
1245
|
+
const startOfMonth = new Date(
|
|
1246
|
+
(/* @__PURE__ */ new Date()).getFullYear(),
|
|
1247
|
+
(/* @__PURE__ */ new Date()).getMonth(),
|
|
1248
|
+
1
|
|
1249
|
+
).getTime();
|
|
1250
|
+
return UnixTimestamp(Math.floor(startOfMonth / 1e3));
|
|
1251
|
+
}
|
|
1252
|
+
};
|
|
1253
|
+
_init = __decoratorStart(null);
|
|
1254
|
+
TimeUtils = __decorateElement(_init, 0, "TimeUtils", _TimeUtils_decorators, TimeUtils);
|
|
1255
|
+
__runInitializers(_init, 1, TimeUtils);
|
|
1256
|
+
|
|
1257
|
+
// utils/x402Utils.ts
|
|
1258
|
+
function x402ResolveRequestUrl(input) {
|
|
1259
|
+
if (typeof input === "string") return input;
|
|
1260
|
+
if (input instanceof URL) return input.toString();
|
|
1261
|
+
return input.url;
|
|
1262
|
+
}
|
|
1263
|
+
function x402Base64EncodeUtf8(input) {
|
|
1264
|
+
if (typeof btoa === "function") {
|
|
1265
|
+
return Base64String(btoa(unescape(encodeURIComponent(input))));
|
|
1266
|
+
}
|
|
1267
|
+
const B = globalThis.Buffer;
|
|
1268
|
+
if (B) {
|
|
1269
|
+
return Base64String(B.from(input, "utf8").toString("base64"));
|
|
1270
|
+
}
|
|
1271
|
+
throw new Error("No base64 encoder available in this environment.");
|
|
1272
|
+
}
|
|
1273
|
+
function x402Base64DecodeUtf8(input) {
|
|
1274
|
+
if (typeof atob === "function") {
|
|
1275
|
+
return decodeURIComponent(escape(atob(input)));
|
|
1276
|
+
}
|
|
1277
|
+
const B = globalThis.Buffer;
|
|
1278
|
+
if (B) {
|
|
1279
|
+
return B.from(input, "base64").toString("utf8");
|
|
1280
|
+
}
|
|
1281
|
+
throw new Error("No base64 decoder available in this environment.");
|
|
1282
|
+
}
|
|
1283
|
+
function x402ParseJsonOrBase64Json(raw) {
|
|
1284
|
+
const trimmed = raw.trim();
|
|
1285
|
+
if (trimmed.startsWith("{") || trimmed.startsWith("[")) {
|
|
1286
|
+
return JSON.parse(trimmed);
|
|
1287
|
+
}
|
|
1288
|
+
try {
|
|
1289
|
+
const decoded = x402Base64DecodeUtf8(Base64String(trimmed));
|
|
1290
|
+
return JSON.parse(decoded);
|
|
1291
|
+
} catch {
|
|
1292
|
+
const unquoted = trimmed.replace(/^"+|"+$/g, "");
|
|
1293
|
+
if (unquoted.startsWith("{") || unquoted.startsWith("[")) {
|
|
1294
|
+
return JSON.parse(unquoted);
|
|
1295
|
+
}
|
|
1296
|
+
const decoded = x402Base64DecodeUtf8(Base64String(unquoted));
|
|
1297
|
+
return JSON.parse(decoded);
|
|
1298
|
+
}
|
|
1299
|
+
}
|
|
1300
|
+
function x402NormalizeAcceptedPayments(req) {
|
|
1301
|
+
const candidates = [];
|
|
1302
|
+
if (req.accepted != null) {
|
|
1303
|
+
if (Array.isArray(req.accepted)) candidates.push(...req.accepted);
|
|
1304
|
+
else candidates.push(req.accepted);
|
|
1305
|
+
}
|
|
1306
|
+
if (req.paymentRequirements != null) {
|
|
1307
|
+
if (Array.isArray(req.paymentRequirements))
|
|
1308
|
+
candidates.push(...req.paymentRequirements);
|
|
1309
|
+
}
|
|
1310
|
+
return candidates.filter(Boolean).map((c) => c);
|
|
1311
|
+
}
|
|
1312
|
+
function x402GetChainIdFromNetwork(network) {
|
|
1313
|
+
const m = /^eip155:(\d+)$/.exec(network);
|
|
1314
|
+
if (!m) return null;
|
|
1315
|
+
const n = Number(m[1]);
|
|
1316
|
+
return Number.isFinite(n) ? n : null;
|
|
1317
|
+
}
|
|
1318
|
+
function x402IsUsdcOnBase(chainId, asset) {
|
|
1319
|
+
const a = asset.toLowerCase();
|
|
1320
|
+
if (chainId === 8453 && a === "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913")
|
|
1321
|
+
return true;
|
|
1322
|
+
return false;
|
|
1323
|
+
}
|
|
1324
|
+
|
|
1325
|
+
// index.ts
|
|
1326
|
+
async function resultAsyncToPromise(resultAsync) {
|
|
1327
|
+
const result = await resultAsync;
|
|
1328
|
+
if (result.isErr()) {
|
|
1329
|
+
throw result.error;
|
|
1330
|
+
}
|
|
1331
|
+
return result.value;
|
|
1332
|
+
}
|
|
1333
|
+
export {
|
|
1334
|
+
AjaxError,
|
|
1335
|
+
AjaxUtils,
|
|
1336
|
+
ApiToken,
|
|
1337
|
+
Base64String,
|
|
1338
|
+
BaseError,
|
|
1339
|
+
BigNumberString,
|
|
1340
|
+
DecimalAmount,
|
|
1341
|
+
EHttpStatusCode,
|
|
1342
|
+
ELocale,
|
|
1343
|
+
EPayLinkStatus,
|
|
1344
|
+
EVMAccountAddress,
|
|
1345
|
+
EVMContractAddress,
|
|
1346
|
+
HexString,
|
|
1347
|
+
ISO8601DateString,
|
|
1348
|
+
ITimeUtilsType,
|
|
1349
|
+
JSONString,
|
|
1350
|
+
JsonWebToken,
|
|
1351
|
+
MillisecondTimestamp,
|
|
1352
|
+
OAuthTokenModel,
|
|
1353
|
+
ObjectUtils,
|
|
1354
|
+
PayLinkId,
|
|
1355
|
+
PayLinkPaymentId,
|
|
1356
|
+
ProxyError,
|
|
1357
|
+
RelayerTransactionId,
|
|
1358
|
+
RetryError,
|
|
1359
|
+
Signature,
|
|
1360
|
+
TimeUtils,
|
|
1361
|
+
TransactionHash,
|
|
1362
|
+
URLString,
|
|
1363
|
+
USDCAmount,
|
|
1364
|
+
UnixTimestamp,
|
|
1365
|
+
UserId,
|
|
1366
|
+
Username,
|
|
1367
|
+
ValidationError,
|
|
1368
|
+
resultAsyncToPromise,
|
|
1369
|
+
x402Base64DecodeUtf8,
|
|
1370
|
+
x402Base64EncodeUtf8,
|
|
1371
|
+
x402GetChainIdFromNetwork,
|
|
1372
|
+
x402IsUsdcOnBase,
|
|
1373
|
+
x402NormalizeAcceptedPayments,
|
|
1374
|
+
x402ParseJsonOrBase64Json,
|
|
1375
|
+
x402ResolveRequestUrl
|
|
1376
|
+
};
|
|
1377
|
+
//# sourceMappingURL=index.js.map
|