@prosopo/cli 3.6.74 → 3.6.76
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/.turbo/turbo-build$colon$cjs.log +37 -27
- package/.turbo/turbo-build$colon$tsc.log +27 -27
- package/.turbo/turbo-build.log +30 -27
- package/CHANGELOG.md +33 -0
- package/dist/RateLimiter.js +118 -118
- package/dist/_virtual/_rolldown/runtime.js +3 -0
- package/dist/argv.js +37 -36
- package/dist/bundle/decodeBehavior-BnJdECMR.js +233 -0
- package/dist/bundle/decodeSimd-hDznYwxo.js +218 -0
- package/dist/bundle/i18nBackend-C078WszN.js +3553 -0
- package/dist/bundle/i18nFrontend-pIqw8hl9.js +850 -0
- package/dist/bundle/i18next-q3w8LsnI.js +1213 -0
- package/dist/bundle/node-ponyfill-BXKwLYwg.js +1534 -0
- package/dist/bundle/provider.cli.bundle.js +102280 -131300
- package/dist/bundle/src-DhRyWllF.js +1880 -0
- package/dist/cjs/RateLimiter.cjs +118 -118
- package/dist/cjs/_virtual/_rolldown/runtime.cjs +23 -0
- package/dist/cjs/argv.cjs +41 -38
- package/dist/cjs/cli.cjs +32 -43
- package/dist/cjs/commands/ensureExternalIndexes.cjs +26 -27
- package/dist/cjs/commands/ensureIndexes.cjs +24 -25
- package/dist/cjs/commands/index.cjs +18 -20
- package/dist/cjs/commands/migrateAbuserScoreThreshold.cjs +54 -65
- package/dist/cjs/commands/providerSetDataset.cjs +45 -59
- package/dist/cjs/commands/siteKeyRegister.cjs +93 -105
- package/dist/cjs/commands/siteKeyRegisterApi.cjs +84 -102
- package/dist/cjs/commands/storeCaptchasExternally.cjs +24 -24
- package/dist/cjs/commands/updateSpamEmailDomains.cjs +42 -49
- package/dist/cjs/commands/validators.cjs +18 -37
- package/dist/cjs/commands/version.cjs +14 -15
- package/dist/cjs/files.cjs +32 -30
- package/dist/cjs/index.cjs +15 -17
- package/dist/cjs/process.env.cjs +14 -25
- package/dist/cjs/prosopo.config.cjs +108 -132
- package/dist/cjs/reloader.cjs +54 -63
- package/dist/cjs/start.cjs +59 -81
- package/dist/cli.js +27 -37
- package/dist/commands/ensureExternalIndexes.js +24 -26
- package/dist/commands/ensureIndexes.js +22 -24
- package/dist/commands/index.js +10 -20
- package/dist/commands/migrateAbuserScoreThreshold.js +52 -64
- package/dist/commands/providerSetDataset.js +41 -41
- package/dist/commands/siteKeyRegister.js +90 -103
- package/dist/commands/siteKeyRegisterApi.js +82 -101
- package/dist/commands/storeCaptchasExternally.js +22 -23
- package/dist/commands/updateSpamEmailDomains.js +40 -48
- package/dist/commands/validators.js +15 -37
- package/dist/commands/version.js +13 -15
- package/dist/files.js +28 -30
- package/dist/index.js +5 -16
- package/dist/process.env.js +14 -28
- package/dist/prosopo.config.js +108 -131
- package/dist/reloader.js +49 -61
- package/dist/start.js +57 -79
- package/package.json +16 -16
- package/dist/bundle/decodeBehavior-Btp_pZCR.js +0 -224
- package/dist/bundle/decodeSimd-Cz4sdHHN.js +0 -212
- package/dist/bundle/i18nBackend-BiuZSvrn.js +0 -5366
- package/dist/bundle/index-DUVLsNmB.js +0 -2371
|
@@ -0,0 +1,1880 @@
|
|
|
1
|
+
import { a as e, c as t, i as n, o as r, s as i } from "./provider.cli.bundle.js";
|
|
2
|
+
//#region ../../node_modules/mmdb-lib/lib/utils.js
|
|
3
|
+
var a = /* @__PURE__ */ n(((e) => {
|
|
4
|
+
Object.defineProperty(e, "__esModule", { value: !0 }), e.default = {
|
|
5
|
+
assert: (e, t) => {
|
|
6
|
+
if (!e) throw Error(t);
|
|
7
|
+
},
|
|
8
|
+
legacyErrorMessage: "Maxmind v2 module has changed API.\nUpgrade instructions can be found here: https://github.com/runk/node-maxmind/wiki/Migration-guide\nIf you want to use legacy library then explicitly install maxmind@1"
|
|
9
|
+
};
|
|
10
|
+
})), o = /* @__PURE__ */ n(((e) => {
|
|
11
|
+
var t = e && e.__importDefault || function(e) {
|
|
12
|
+
return e && e.__esModule ? e : { default: e };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(e, "__esModule", { value: !0 });
|
|
15
|
+
var n = t(a());
|
|
16
|
+
n.default.assert(typeof BigInt < "u", "Apparently you are using old version of node. Please upgrade to node 10.4.x or above.");
|
|
17
|
+
var r;
|
|
18
|
+
(function(e) {
|
|
19
|
+
e[e.Extended = 0] = "Extended", e[e.Pointer = 1] = "Pointer", e[e.Utf8String = 2] = "Utf8String", e[e.Double = 3] = "Double", e[e.Bytes = 4] = "Bytes", e[e.Uint16 = 5] = "Uint16", e[e.Uint32 = 6] = "Uint32", e[e.Map = 7] = "Map", e[e.Int32 = 8] = "Int32", e[e.Uint64 = 9] = "Uint64", e[e.Uint128 = 10] = "Uint128", e[e.Array = 11] = "Array", e[e.Container = 12] = "Container", e[e.EndMarker = 13] = "EndMarker", e[e.Boolean = 14] = "Boolean", e[e.Float = 15] = "Float";
|
|
20
|
+
})(r ||= {});
|
|
21
|
+
var i = [
|
|
22
|
+
0,
|
|
23
|
+
2048,
|
|
24
|
+
526336,
|
|
25
|
+
0
|
|
26
|
+
], o = {
|
|
27
|
+
get: () => void 0,
|
|
28
|
+
set: () => void 0
|
|
29
|
+
}, s = (e, t) => ({
|
|
30
|
+
value: e,
|
|
31
|
+
offset: t
|
|
32
|
+
});
|
|
33
|
+
e.default = class {
|
|
34
|
+
constructor(e, t = 0, r = o) {
|
|
35
|
+
this.telemetry = {}, n.default.assert(!!e, "Database buffer is required"), this.db = e, this.baseOffset = t, this.cache = r;
|
|
36
|
+
}
|
|
37
|
+
decode(e) {
|
|
38
|
+
let t, n = this.db[e++], i = n >> 5;
|
|
39
|
+
if (i === r.Pointer) return t = this.decodePointer(n, e), s(this.decodeFast(t.value).value, t.offset);
|
|
40
|
+
if (i === r.Extended) {
|
|
41
|
+
if (t = this.db[e] + 7, t < 8) throw Error("Invalid Extended Type at offset " + e + " val " + t);
|
|
42
|
+
i = t, e++;
|
|
43
|
+
}
|
|
44
|
+
let a = this.sizeFromCtrlByte(n, e);
|
|
45
|
+
return this.decodeByType(i, a.offset, a.value);
|
|
46
|
+
}
|
|
47
|
+
decodeFast(e) {
|
|
48
|
+
let t = this.cache.get(e);
|
|
49
|
+
if (t) return t;
|
|
50
|
+
let n = this.decode(e);
|
|
51
|
+
return this.cache.set(e, n), n;
|
|
52
|
+
}
|
|
53
|
+
decodeByType(e, t, n) {
|
|
54
|
+
let i = t + n;
|
|
55
|
+
switch (e) {
|
|
56
|
+
case r.Utf8String: return s(this.decodeString(t, n), i);
|
|
57
|
+
case r.Map: return this.decodeMap(n, t);
|
|
58
|
+
case r.Uint32: return s(this.decodeUint(t, n), i);
|
|
59
|
+
case r.Double: return s(this.decodeDouble(t), i);
|
|
60
|
+
case r.Array: return this.decodeArray(n, t);
|
|
61
|
+
case r.Boolean: return s(this.decodeBoolean(n), t);
|
|
62
|
+
case r.Float: return s(this.decodeFloat(t), i);
|
|
63
|
+
case r.Bytes: return s(this.decodeBytes(t, n), i);
|
|
64
|
+
case r.Uint16: return s(this.decodeUint(t, n), i);
|
|
65
|
+
case r.Int32: return s(this.decodeInt32(t, n), i);
|
|
66
|
+
case r.Uint64: return s(this.decodeUint(t, n), i);
|
|
67
|
+
case r.Uint128: return s(this.decodeUint(t, n), i);
|
|
68
|
+
}
|
|
69
|
+
throw Error("Unknown type " + e + " at offset " + t);
|
|
70
|
+
}
|
|
71
|
+
sizeFromCtrlByte(e, t) {
|
|
72
|
+
let n = e & 31;
|
|
73
|
+
return n < 29 ? s(n, t) : n === 29 ? s(29 + this.db[t], t + 1) : n === 30 ? s(285 + this.db.readUInt16BE(t), t + 2) : s(65821 + this.db.readUIntBE(t, 3), t + 3);
|
|
74
|
+
}
|
|
75
|
+
decodeBytes(e, t) {
|
|
76
|
+
return this.db.subarray(e, e + t);
|
|
77
|
+
}
|
|
78
|
+
decodePointer(e, t) {
|
|
79
|
+
let n = e >> 3 & 3, r = this.baseOffset + i[n], a = 0;
|
|
80
|
+
return a = n === 0 ? (e & 7) << 8 | this.db[t] : n === 1 ? (e & 7) << 16 | this.db.readUInt16BE(t) : n === 2 ? (e & 7) << 24 | this.db.readUIntBE(t, 3) : this.db.readUInt32BE(t), t += n + 1, s(r + a, t);
|
|
81
|
+
}
|
|
82
|
+
decodeArray(e, t) {
|
|
83
|
+
let n, r = Array(e);
|
|
84
|
+
for (let i = 0; i < e; i++) n = this.decode(t), t = n.offset, r[i] = n.value;
|
|
85
|
+
return s(r, t);
|
|
86
|
+
}
|
|
87
|
+
decodeBoolean(e) {
|
|
88
|
+
return e !== 0;
|
|
89
|
+
}
|
|
90
|
+
decodeDouble(e) {
|
|
91
|
+
return this.db.readDoubleBE(e);
|
|
92
|
+
}
|
|
93
|
+
decodeFloat(e) {
|
|
94
|
+
return this.db.readFloatBE(e);
|
|
95
|
+
}
|
|
96
|
+
decodeMap(e, t) {
|
|
97
|
+
let n, r, i = {};
|
|
98
|
+
for (let a = 0; a < e; a++) n = this.decode(t), r = n.value, n = this.decode(n.offset), t = n.offset, i[r] = n.value;
|
|
99
|
+
return s(i, t);
|
|
100
|
+
}
|
|
101
|
+
decodeInt32(e, t) {
|
|
102
|
+
return t === 0 ? 0 : t < 4 ? this.db.readUIntBE(e, t) : this.db.readInt32BE(e);
|
|
103
|
+
}
|
|
104
|
+
decodeUint(e, t) {
|
|
105
|
+
return t === 0 ? 0 : t <= 6 ? this.db.readUIntBE(e, t) : t == 8 ? this.db.readBigUInt64BE(e).toString() : t > 16 ? 0 : this.decodeBigUint(e, t);
|
|
106
|
+
}
|
|
107
|
+
decodeString(e, t) {
|
|
108
|
+
return this.db.toString("utf8", e, e + t);
|
|
109
|
+
}
|
|
110
|
+
decodeBigUint(e, t) {
|
|
111
|
+
let n = 0n;
|
|
112
|
+
for (let r = 0; r < t; r++) n <<= 8n, n |= BigInt(this.db.readUInt8(e + r));
|
|
113
|
+
return n.toString();
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
})), s = /* @__PURE__ */ n(((e) => {
|
|
117
|
+
var t = e && e.__importDefault || function(e) {
|
|
118
|
+
return e && e.__esModule ? e : { default: e };
|
|
119
|
+
};
|
|
120
|
+
Object.defineProperty(e, "__esModule", { value: !0 });
|
|
121
|
+
var n = t(i("net")), r = (e) => {
|
|
122
|
+
let t = e.split(".", 4);
|
|
123
|
+
return [
|
|
124
|
+
parseInt(t[0]),
|
|
125
|
+
parseInt(t[1]),
|
|
126
|
+
parseInt(t[2]),
|
|
127
|
+
parseInt(t[3])
|
|
128
|
+
];
|
|
129
|
+
}, a = (e) => {
|
|
130
|
+
let t = parseInt(e, 10).toString(16);
|
|
131
|
+
return t.length === 2 ? t : "0" + t;
|
|
132
|
+
}, o = (e) => {
|
|
133
|
+
let t = [
|
|
134
|
+
0,
|
|
135
|
+
0,
|
|
136
|
+
0,
|
|
137
|
+
0,
|
|
138
|
+
0,
|
|
139
|
+
0,
|
|
140
|
+
0,
|
|
141
|
+
0,
|
|
142
|
+
0,
|
|
143
|
+
0,
|
|
144
|
+
0,
|
|
145
|
+
0,
|
|
146
|
+
0,
|
|
147
|
+
0,
|
|
148
|
+
0,
|
|
149
|
+
0
|
|
150
|
+
], n, r, i, [o, s] = (e.indexOf(".") > -1 ? e.replace(/(\d+)\.(\d+)\.(\d+)\.(\d+)/, (e, t, n, r, i) => a(t) + a(n) + ":" + a(r) + a(i)) : e).split("::", 2);
|
|
151
|
+
if (o) for (r = o.split(":"), n = 0; n < r.length; n++) i = parseInt(r[n], 16), t[n * 2] = i >> 8, t[n * 2 + 1] = i & 255;
|
|
152
|
+
if (s) {
|
|
153
|
+
r = s.split(":");
|
|
154
|
+
let e = 16 - r.length * 2;
|
|
155
|
+
for (n = 0; n < r.length; n++) i = parseInt(r[n], 16), t[e + n * 2] = i >> 8, t[e + (n * 2 + 1)] = i & 255;
|
|
156
|
+
}
|
|
157
|
+
return t;
|
|
158
|
+
};
|
|
159
|
+
e.default = {
|
|
160
|
+
bitAt: (e, t) => {
|
|
161
|
+
let n = t >> 3, r = 7 ^ t & 7;
|
|
162
|
+
return e[n] >>> r & 1;
|
|
163
|
+
},
|
|
164
|
+
parse: (e) => e.indexOf(":") === -1 ? r(e) : o(e),
|
|
165
|
+
validate: (e) => {
|
|
166
|
+
let t = n.default.isIP(e);
|
|
167
|
+
return t === 4 || t === 6;
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
})), c = /* @__PURE__ */ n(((e) => {
|
|
171
|
+
var t = e && e.__importDefault || function(e) {
|
|
172
|
+
return e && e.__esModule ? e : { default: e };
|
|
173
|
+
};
|
|
174
|
+
Object.defineProperty(e, "__esModule", { value: !0 }), e.isLegacyFormat = e.parseMetadata = void 0;
|
|
175
|
+
var n = t(o()), r = t(a()), i = Buffer.from("ABCDEF4D61784D696E642E636F6D", "hex");
|
|
176
|
+
e.parseMetadata = (t) => {
|
|
177
|
+
let i = s(t), a = new n.default(t, i).decode(i).value;
|
|
178
|
+
if (!a) throw Error((0, e.isLegacyFormat)(t) ? r.default.legacyErrorMessage : "Cannot parse binary database");
|
|
179
|
+
return r.default.assert([
|
|
180
|
+
24,
|
|
181
|
+
28,
|
|
182
|
+
32
|
|
183
|
+
].indexOf(a.record_size) > -1, "Unsupported record size"), {
|
|
184
|
+
binaryFormatMajorVersion: a.binary_format_major_version,
|
|
185
|
+
binaryFormatMinorVersion: a.binary_format_minor_version,
|
|
186
|
+
buildEpoch: /* @__PURE__ */ new Date(a.build_epoch * 1e3),
|
|
187
|
+
databaseType: a.database_type,
|
|
188
|
+
description: a.description,
|
|
189
|
+
ipVersion: a.ip_version,
|
|
190
|
+
languages: a.languages,
|
|
191
|
+
nodeByteSize: a.record_size / 4,
|
|
192
|
+
nodeCount: a.node_count,
|
|
193
|
+
recordSize: a.record_size,
|
|
194
|
+
searchTreeSize: a.node_count * a.record_size / 4,
|
|
195
|
+
treeDepth: 2 ** (a.ip_version + 1)
|
|
196
|
+
};
|
|
197
|
+
};
|
|
198
|
+
var s = (e) => {
|
|
199
|
+
let t = 0, n = e.length - 1, r = i.length - 1;
|
|
200
|
+
for (; t <= r && n-- > 0;) t += e[n] === i[r - t] ? 1 : -t;
|
|
201
|
+
return n + t;
|
|
202
|
+
};
|
|
203
|
+
e.isLegacyFormat = (e) => {
|
|
204
|
+
for (let t = 0; t < 20; t++) {
|
|
205
|
+
let n = e.slice(e.length - 3 - t, e.length - t);
|
|
206
|
+
if (n[0] === 255 && n[1] === 255 && n[2] === 255) return !0;
|
|
207
|
+
}
|
|
208
|
+
return !1;
|
|
209
|
+
};
|
|
210
|
+
})), l = /* @__PURE__ */ n(((e) => {
|
|
211
|
+
Object.defineProperty(e, "__esModule", { value: !0 });
|
|
212
|
+
var t = (e) => (t) => e.readUIntBE(t + 3, 3), n = (e) => (t) => e.readUIntBE(t, 3), r = (e) => (t) => (e[t + 3] & 240) << 20 | e.readUIntBE(t, 3), i = (e) => (t) => (e[t + 3] & 15) << 24 | e.readUIntBE(t + 4, 3), a = (e) => (t) => e.readUInt32BE(t), o = (e) => (t) => e.readUInt32BE(t + 4);
|
|
213
|
+
e.default = (e, s) => {
|
|
214
|
+
switch (s) {
|
|
215
|
+
case 24: return {
|
|
216
|
+
left: n(e),
|
|
217
|
+
right: t(e)
|
|
218
|
+
};
|
|
219
|
+
case 28: return {
|
|
220
|
+
left: r(e),
|
|
221
|
+
right: i(e)
|
|
222
|
+
};
|
|
223
|
+
case 32: return {
|
|
224
|
+
left: a(e),
|
|
225
|
+
right: o(e)
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
throw Error("Unsupported record size");
|
|
229
|
+
};
|
|
230
|
+
})), u = /* @__PURE__ */ n(((e) => {
|
|
231
|
+
Object.defineProperty(e, "__esModule", { value: !0 });
|
|
232
|
+
})), d = /* @__PURE__ */ n(((e) => {
|
|
233
|
+
var t = e && e.__createBinding || (Object.create ? (function(e, t, n, r) {
|
|
234
|
+
r === void 0 && (r = n);
|
|
235
|
+
var i = Object.getOwnPropertyDescriptor(t, n);
|
|
236
|
+
(!i || ("get" in i ? !t.__esModule : i.writable || i.configurable)) && (i = {
|
|
237
|
+
enumerable: !0,
|
|
238
|
+
get: function() {
|
|
239
|
+
return t[n];
|
|
240
|
+
}
|
|
241
|
+
}), Object.defineProperty(e, r, i);
|
|
242
|
+
}) : (function(e, t, n, r) {
|
|
243
|
+
r === void 0 && (r = n), e[r] = t[n];
|
|
244
|
+
})), n = e && e.__exportStar || function(e, n) {
|
|
245
|
+
for (var r in e) r !== "default" && !Object.prototype.hasOwnProperty.call(n, r) && t(n, e, r);
|
|
246
|
+
}, r = e && e.__importDefault || function(e) {
|
|
247
|
+
return e && e.__esModule ? e : { default: e };
|
|
248
|
+
};
|
|
249
|
+
Object.defineProperty(e, "__esModule", { value: !0 }), e.Reader = void 0;
|
|
250
|
+
var i = r(o()), a = r(s()), d = c(), f = r(l()), p = 16;
|
|
251
|
+
e.Reader = class {
|
|
252
|
+
constructor(e, t = {}) {
|
|
253
|
+
this.opts = t, this.load(e);
|
|
254
|
+
}
|
|
255
|
+
load(e) {
|
|
256
|
+
if (!Buffer.isBuffer(e)) throw Error(`mmdb-lib expects an instance of Buffer, got: ${typeof e}`);
|
|
257
|
+
this.db = e, this.metadata = (0, d.parseMetadata)(this.db), this.decoder = new i.default(this.db, this.metadata.searchTreeSize + p, this.opts.cache), this.walker = (0, f.default)(this.db, this.metadata.recordSize), this.ipv4StartNodeNumber = this.ipv4Start();
|
|
258
|
+
}
|
|
259
|
+
get(e) {
|
|
260
|
+
let [t] = this.getWithPrefixLength(e);
|
|
261
|
+
return t;
|
|
262
|
+
}
|
|
263
|
+
getWithPrefixLength(e) {
|
|
264
|
+
let [t, n] = this.findAddressInTree(e);
|
|
265
|
+
return [t ? this.resolveDataPointer(t) : null, n];
|
|
266
|
+
}
|
|
267
|
+
findAddressInTree(e) {
|
|
268
|
+
let t = a.default.parse(e), n = this.metadata.nodeCount, r = t.length * 8, i, o = 0, s, c = 0;
|
|
269
|
+
for (t.length === 4 && (o = this.ipv4StartNodeNumber); c < r && o < n; c++) i = a.default.bitAt(t, c), s = o * this.metadata.nodeByteSize, o = i ? this.walker.right(s) : this.walker.left(s);
|
|
270
|
+
return o > n ? [o, c] : [null, c];
|
|
271
|
+
}
|
|
272
|
+
resolveDataPointer(e) {
|
|
273
|
+
let t = e - this.metadata.nodeCount + this.metadata.searchTreeSize;
|
|
274
|
+
return this.decoder.decodeFast(t).value;
|
|
275
|
+
}
|
|
276
|
+
ipv4Start() {
|
|
277
|
+
if (this.metadata.ipVersion === 4) return 0;
|
|
278
|
+
let e = this.metadata.nodeCount, t = 0, n = 0;
|
|
279
|
+
for (; n < 96 && t < e; n++) {
|
|
280
|
+
let e = t * this.metadata.nodeByteSize;
|
|
281
|
+
t = this.walker.left(e);
|
|
282
|
+
}
|
|
283
|
+
return t;
|
|
284
|
+
}
|
|
285
|
+
}, n(u(), e);
|
|
286
|
+
})), f = /* @__PURE__ */ n(((e) => {
|
|
287
|
+
var t = class {
|
|
288
|
+
constructor(e = 0, t = 0, n = !1) {
|
|
289
|
+
this.first = null, this.items = Object.create(null), this.last = null, this.max = e, this.resetTtl = n, this.size = 0, this.ttl = t;
|
|
290
|
+
}
|
|
291
|
+
clear() {
|
|
292
|
+
return this.first = null, this.items = Object.create(null), this.last = null, this.size = 0, this;
|
|
293
|
+
}
|
|
294
|
+
delete(e) {
|
|
295
|
+
if (this.has(e)) {
|
|
296
|
+
let t = this.items[e];
|
|
297
|
+
delete this.items[e], this.size--, t.prev !== null && (t.prev.next = t.next), t.next !== null && (t.next.prev = t.prev), this.first === t && (this.first = t.next), this.last === t && (this.last = t.prev);
|
|
298
|
+
}
|
|
299
|
+
return this;
|
|
300
|
+
}
|
|
301
|
+
entries(e = this.keys()) {
|
|
302
|
+
return e.map((e) => [e, this.get(e)]);
|
|
303
|
+
}
|
|
304
|
+
evict(e = !1) {
|
|
305
|
+
if (e || this.size > 0) {
|
|
306
|
+
let e = this.first;
|
|
307
|
+
delete this.items[e.key], --this.size === 0 ? (this.first = null, this.last = null) : (this.first = e.next, this.first.prev = null);
|
|
308
|
+
}
|
|
309
|
+
return this;
|
|
310
|
+
}
|
|
311
|
+
expiresAt(e) {
|
|
312
|
+
let t;
|
|
313
|
+
return this.has(e) && (t = this.items[e].expiry), t;
|
|
314
|
+
}
|
|
315
|
+
get(e) {
|
|
316
|
+
let t;
|
|
317
|
+
if (this.has(e)) {
|
|
318
|
+
let n = this.items[e];
|
|
319
|
+
this.ttl > 0 && n.expiry <= Date.now() ? this.delete(e) : (t = n.value, this.set(e, t, !0));
|
|
320
|
+
}
|
|
321
|
+
return t;
|
|
322
|
+
}
|
|
323
|
+
has(e) {
|
|
324
|
+
return e in this.items;
|
|
325
|
+
}
|
|
326
|
+
keys() {
|
|
327
|
+
let e = [], t = this.first;
|
|
328
|
+
for (; t !== null;) e.push(t.key), t = t.next;
|
|
329
|
+
return e;
|
|
330
|
+
}
|
|
331
|
+
setWithEvicted(e, t, n = this.resetTtl) {
|
|
332
|
+
let r = null;
|
|
333
|
+
if (this.has(e)) this.set(e, t, !0, n);
|
|
334
|
+
else {
|
|
335
|
+
this.max > 0 && this.size === this.max && (r = { ...this.first }, this.evict(!0));
|
|
336
|
+
let n = this.items[e] = {
|
|
337
|
+
expiry: this.ttl > 0 ? Date.now() + this.ttl : this.ttl,
|
|
338
|
+
key: e,
|
|
339
|
+
prev: this.last,
|
|
340
|
+
next: null,
|
|
341
|
+
value: t
|
|
342
|
+
};
|
|
343
|
+
++this.size === 1 ? this.first = n : this.last.next = n, this.last = n;
|
|
344
|
+
}
|
|
345
|
+
return r;
|
|
346
|
+
}
|
|
347
|
+
set(e, t, n = !1, r = this.resetTtl) {
|
|
348
|
+
let i;
|
|
349
|
+
if (n || this.has(e)) {
|
|
350
|
+
if (i = this.items[e], i.value = t, n === !1 && r && (i.expiry = this.ttl > 0 ? Date.now() + this.ttl : this.ttl), this.last !== i) {
|
|
351
|
+
let e = this.last, t = i.next, n = i.prev;
|
|
352
|
+
this.first === i && (this.first = i.next), i.next = null, i.prev = this.last, e.next = i, n !== null && (n.next = t), t !== null && (t.prev = n);
|
|
353
|
+
}
|
|
354
|
+
} else this.max > 0 && this.size === this.max && this.evict(!0), i = this.items[e] = {
|
|
355
|
+
expiry: this.ttl > 0 ? Date.now() + this.ttl : this.ttl,
|
|
356
|
+
key: e,
|
|
357
|
+
prev: this.last,
|
|
358
|
+
next: null,
|
|
359
|
+
value: t
|
|
360
|
+
}, ++this.size === 1 ? this.first = i : this.last.next = i;
|
|
361
|
+
return this.last = i, this;
|
|
362
|
+
}
|
|
363
|
+
values(e = this.keys()) {
|
|
364
|
+
return e.map((e) => this.get(e));
|
|
365
|
+
}
|
|
366
|
+
};
|
|
367
|
+
function n(e = 1e3, n = 0, r = !1) {
|
|
368
|
+
if (isNaN(e) || e < 0) throw TypeError("Invalid max value");
|
|
369
|
+
if (isNaN(n) || n < 0) throw TypeError("Invalid ttl value");
|
|
370
|
+
if (typeof r != "boolean") throw TypeError("Invalid resetTtl value");
|
|
371
|
+
return new t(e, n, r);
|
|
372
|
+
}
|
|
373
|
+
e.LRU = t, e.lru = n;
|
|
374
|
+
})), p = /* @__PURE__ */ n(((e) => {
|
|
375
|
+
var t = e && e.__importDefault || function(e) {
|
|
376
|
+
return e && e.__esModule ? e : { default: e };
|
|
377
|
+
};
|
|
378
|
+
Object.defineProperty(e, "__esModule", { value: !0 });
|
|
379
|
+
var n = t(i("fs")), r = t(i("util"));
|
|
380
|
+
e.default = {
|
|
381
|
+
existsSync: n.default.existsSync,
|
|
382
|
+
readFile: r.default.promisify(n.default.readFile),
|
|
383
|
+
watchFile: n.default.watchFile,
|
|
384
|
+
createReadStream: n.default.createReadStream,
|
|
385
|
+
stat: r.default.promisify(n.default.stat)
|
|
386
|
+
};
|
|
387
|
+
})), m = /* @__PURE__ */ n(((e) => {
|
|
388
|
+
var t = e && e.__importDefault || function(e) {
|
|
389
|
+
return e && e.__esModule ? e : { default: e };
|
|
390
|
+
};
|
|
391
|
+
Object.defineProperty(e, "__esModule", { value: !0 });
|
|
392
|
+
var n = t(i("net")), r = (e) => {
|
|
393
|
+
let t = e.split(".", 4);
|
|
394
|
+
return [
|
|
395
|
+
parseInt(t[0]),
|
|
396
|
+
parseInt(t[1]),
|
|
397
|
+
parseInt(t[2]),
|
|
398
|
+
parseInt(t[3])
|
|
399
|
+
];
|
|
400
|
+
}, a = (e) => (e = parseInt(e, 10).toString(16), e.length === 2 ? e : "0" + e), o = (e) => {
|
|
401
|
+
let t = [
|
|
402
|
+
0,
|
|
403
|
+
0,
|
|
404
|
+
0,
|
|
405
|
+
0,
|
|
406
|
+
0,
|
|
407
|
+
0,
|
|
408
|
+
0,
|
|
409
|
+
0,
|
|
410
|
+
0,
|
|
411
|
+
0,
|
|
412
|
+
0,
|
|
413
|
+
0,
|
|
414
|
+
0,
|
|
415
|
+
0,
|
|
416
|
+
0,
|
|
417
|
+
0
|
|
418
|
+
], n, r, i;
|
|
419
|
+
e.indexOf(".") > -1 && (e = e.replace(/(\d+)\.(\d+)\.(\d+)\.(\d+)/, (e, t, n, r, i) => a(t) + a(n) + ":" + a(r) + a(i)));
|
|
420
|
+
let [o, s] = e.split("::", 2);
|
|
421
|
+
if (o) for (r = o.split(":"), n = 0; n < r.length; n++) i = parseInt(r[n], 16), t[n * 2] = i >> 8, t[n * 2 + 1] = i & 255;
|
|
422
|
+
if (s) {
|
|
423
|
+
r = s.split(":");
|
|
424
|
+
let e = 16 - r.length * 2;
|
|
425
|
+
for (n = 0; n < r.length; n++) i = parseInt(r[n], 16), t[e + n * 2] = i >> 8, t[e + (n * 2 + 1)] = i & 255;
|
|
426
|
+
}
|
|
427
|
+
return t;
|
|
428
|
+
};
|
|
429
|
+
e.default = {
|
|
430
|
+
bitAt: (e, t) => {
|
|
431
|
+
let n = t >> 3, r = 7 ^ t & 7;
|
|
432
|
+
return e[n] >>> r & 1;
|
|
433
|
+
},
|
|
434
|
+
parse: (e) => e.indexOf(":") === -1 ? r(e) : o(e),
|
|
435
|
+
validate: (e) => {
|
|
436
|
+
let t = n.default.isIP(e);
|
|
437
|
+
return t === 4 || t === 6;
|
|
438
|
+
}
|
|
439
|
+
};
|
|
440
|
+
})), h = /* @__PURE__ */ n(((e) => {
|
|
441
|
+
Object.defineProperty(e, "__esModule", { value: !0 }), e.default = (e) => !e || e.length < 3 ? !1 : e[0] === 31 && e[1] === 139 && e[2] === 8;
|
|
442
|
+
})), g = /* @__PURE__ */ n(((e) => {
|
|
443
|
+
Object.defineProperty(e, "__esModule", { value: !0 }), e.default = {
|
|
444
|
+
concat2: (e, t) => e << 8 | t,
|
|
445
|
+
concat3: (e, t, n) => e << 16 | t << 8 | n,
|
|
446
|
+
concat4: (e, t, n, r) => e << 24 | t << 16 | n << 8 | r,
|
|
447
|
+
legacyErrorMessage: "Maxmind v2 module has changed API.\nUpgrade instructions can be found here: https://github.com/runk/node-maxmind/wiki/Migration-guide\nIf you want to use legacy libary then explicitly install maxmind@1"
|
|
448
|
+
};
|
|
449
|
+
})), _ = /* @__PURE__ */ n(((e) => {
|
|
450
|
+
var t = e && e.__createBinding || (Object.create ? (function(e, t, n, r) {
|
|
451
|
+
r === void 0 && (r = n);
|
|
452
|
+
var i = Object.getOwnPropertyDescriptor(t, n);
|
|
453
|
+
(!i || ("get" in i ? !t.__esModule : i.writable || i.configurable)) && (i = {
|
|
454
|
+
enumerable: !0,
|
|
455
|
+
get: function() {
|
|
456
|
+
return t[n];
|
|
457
|
+
}
|
|
458
|
+
}), Object.defineProperty(e, r, i);
|
|
459
|
+
}) : (function(e, t, n, r) {
|
|
460
|
+
r === void 0 && (r = n), e[r] = t[n];
|
|
461
|
+
})), n = e && e.__exportStar || function(e, n) {
|
|
462
|
+
for (var r in e) r !== "default" && !Object.prototype.hasOwnProperty.call(n, r) && t(n, e, r);
|
|
463
|
+
}, r = e && e.__importDefault || function(e) {
|
|
464
|
+
return e && e.__esModule ? e : { default: e };
|
|
465
|
+
};
|
|
466
|
+
Object.defineProperty(e, "__esModule", { value: !0 }), e.Reader = e.validate = e.init = e.openSync = e.open = void 0;
|
|
467
|
+
var a = r(i("assert")), o = d();
|
|
468
|
+
Object.defineProperty(e, "Reader", {
|
|
469
|
+
enumerable: !0,
|
|
470
|
+
get: function() {
|
|
471
|
+
return o.Reader;
|
|
472
|
+
}
|
|
473
|
+
});
|
|
474
|
+
var s = f(), c = r(p()), l = r(m()), u = r(h()), _ = r(g()), v = 512 * 1024 * 1024, y = 8 * 1024 * 1024, b = async (e, t) => new Promise((n, r) => {
|
|
475
|
+
let i = Buffer.allocUnsafe(t), a = 0, o = c.default.createReadStream(e, { highWaterMark: y });
|
|
476
|
+
o.on("data", (e) => {
|
|
477
|
+
if (Buffer.isBuffer(e)) e.copy(i, a), a += e.length;
|
|
478
|
+
else {
|
|
479
|
+
let t = Buffer.from(e);
|
|
480
|
+
t.copy(i, a), a += t.length;
|
|
481
|
+
}
|
|
482
|
+
}), o.on("end", () => {
|
|
483
|
+
o.close(), n(i);
|
|
484
|
+
}), o.on("error", (e) => {
|
|
485
|
+
r(e);
|
|
486
|
+
});
|
|
487
|
+
}), x = async (e) => {
|
|
488
|
+
let t = await c.default.stat(e);
|
|
489
|
+
return t.size < v ? c.default.readFile(e) : b(e, t.size);
|
|
490
|
+
};
|
|
491
|
+
e.open = async (e, t, n) => {
|
|
492
|
+
(0, a.default)(!n, _.default.legacyErrorMessage);
|
|
493
|
+
let r = await x(e);
|
|
494
|
+
if ((0, u.default)(r)) throw Error("Looks like you are passing in a file in gzip format, please use mmdb database instead.");
|
|
495
|
+
let i = (0, s.lru)(t?.cache?.max || 1e4), l = new o.Reader(r, { cache: i });
|
|
496
|
+
if (t && t.watchForUpdates) {
|
|
497
|
+
if (t.watchForUpdatesHook && typeof t.watchForUpdatesHook != "function") throw Error("opts.watchForUpdatesHook should be a function");
|
|
498
|
+
let n = { persistent: t.watchForUpdatesNonPersistent !== !0 };
|
|
499
|
+
c.default.watchFile(e, n, async () => {
|
|
500
|
+
if (!await (async () => {
|
|
501
|
+
for (let t = 0; t < 3; t++) {
|
|
502
|
+
if (c.default.existsSync(e)) return !0;
|
|
503
|
+
await new Promise((e) => setTimeout(e, 500));
|
|
504
|
+
}
|
|
505
|
+
return !1;
|
|
506
|
+
})()) return;
|
|
507
|
+
let n = await x(e);
|
|
508
|
+
i.clear(), l.load(n), t.watchForUpdatesHook && t.watchForUpdatesHook();
|
|
509
|
+
});
|
|
510
|
+
}
|
|
511
|
+
return l;
|
|
512
|
+
}, e.openSync = () => {
|
|
513
|
+
throw Error(_.default.legacyErrorMessage);
|
|
514
|
+
}, e.init = () => {
|
|
515
|
+
throw Error(_.default.legacyErrorMessage);
|
|
516
|
+
}, e.validate = l.default.validate, n(d(), e), e.default = {
|
|
517
|
+
init: e.init,
|
|
518
|
+
open: e.open,
|
|
519
|
+
openSync: e.openSync,
|
|
520
|
+
validate: l.default.validate
|
|
521
|
+
};
|
|
522
|
+
})), v = /* @__PURE__ */ n(((e) => {
|
|
523
|
+
Object.defineProperty(e, "__esModule", { value: !0 }), e.ValueError = e.InvalidDbBufferError = e.BadMethodCallError = e.AddressNotFoundError = void 0, e.AddressNotFoundError = class extends Error {
|
|
524
|
+
constructor(e) {
|
|
525
|
+
super(e), this.name = this.constructor.name;
|
|
526
|
+
}
|
|
527
|
+
}, e.BadMethodCallError = class extends Error {
|
|
528
|
+
constructor(e) {
|
|
529
|
+
super(e), this.name = this.constructor.name;
|
|
530
|
+
}
|
|
531
|
+
}, e.InvalidDbBufferError = class extends Error {
|
|
532
|
+
constructor(e) {
|
|
533
|
+
super(e), this.name = this.constructor.name;
|
|
534
|
+
}
|
|
535
|
+
}, e.ValueError = class extends Error {
|
|
536
|
+
constructor(e) {
|
|
537
|
+
super(e), this.name = this.constructor.name;
|
|
538
|
+
}
|
|
539
|
+
};
|
|
540
|
+
})), y = /* @__PURE__ */ n(((e, t) => {
|
|
541
|
+
var n = i("assert"), r = i("stream").Stream, a = i("util"), o = /^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/;
|
|
542
|
+
function s(e) {
|
|
543
|
+
return e.charAt(0).toUpperCase() + e.slice(1);
|
|
544
|
+
}
|
|
545
|
+
function c(e, t, r, i, o) {
|
|
546
|
+
throw new n.AssertionError({
|
|
547
|
+
message: a.format("%s (%s) is required", e, t),
|
|
548
|
+
actual: o === void 0 ? typeof i : o(i),
|
|
549
|
+
expected: t,
|
|
550
|
+
operator: r || "===",
|
|
551
|
+
stackStartFunction: c.caller
|
|
552
|
+
});
|
|
553
|
+
}
|
|
554
|
+
function l(e) {
|
|
555
|
+
return Object.prototype.toString.call(e).slice(8, -1);
|
|
556
|
+
}
|
|
557
|
+
function u() {}
|
|
558
|
+
var d = {
|
|
559
|
+
bool: { check: function(e) {
|
|
560
|
+
return typeof e == "boolean";
|
|
561
|
+
} },
|
|
562
|
+
func: { check: function(e) {
|
|
563
|
+
return typeof e == "function";
|
|
564
|
+
} },
|
|
565
|
+
string: { check: function(e) {
|
|
566
|
+
return typeof e == "string";
|
|
567
|
+
} },
|
|
568
|
+
object: { check: function(e) {
|
|
569
|
+
return typeof e == "object" && !!e;
|
|
570
|
+
} },
|
|
571
|
+
number: { check: function(e) {
|
|
572
|
+
return typeof e == "number" && !isNaN(e);
|
|
573
|
+
} },
|
|
574
|
+
finite: { check: function(e) {
|
|
575
|
+
return typeof e == "number" && !isNaN(e) && isFinite(e);
|
|
576
|
+
} },
|
|
577
|
+
buffer: {
|
|
578
|
+
check: function(e) {
|
|
579
|
+
return Buffer.isBuffer(e);
|
|
580
|
+
},
|
|
581
|
+
operator: "Buffer.isBuffer"
|
|
582
|
+
},
|
|
583
|
+
array: {
|
|
584
|
+
check: function(e) {
|
|
585
|
+
return Array.isArray(e);
|
|
586
|
+
},
|
|
587
|
+
operator: "Array.isArray"
|
|
588
|
+
},
|
|
589
|
+
stream: {
|
|
590
|
+
check: function(e) {
|
|
591
|
+
return e instanceof r;
|
|
592
|
+
},
|
|
593
|
+
operator: "instanceof",
|
|
594
|
+
actual: l
|
|
595
|
+
},
|
|
596
|
+
date: {
|
|
597
|
+
check: function(e) {
|
|
598
|
+
return e instanceof Date;
|
|
599
|
+
},
|
|
600
|
+
operator: "instanceof",
|
|
601
|
+
actual: l
|
|
602
|
+
},
|
|
603
|
+
regexp: {
|
|
604
|
+
check: function(e) {
|
|
605
|
+
return e instanceof RegExp;
|
|
606
|
+
},
|
|
607
|
+
operator: "instanceof",
|
|
608
|
+
actual: l
|
|
609
|
+
},
|
|
610
|
+
uuid: {
|
|
611
|
+
check: function(e) {
|
|
612
|
+
return typeof e == "string" && o.test(e);
|
|
613
|
+
},
|
|
614
|
+
operator: "isUUID"
|
|
615
|
+
}
|
|
616
|
+
};
|
|
617
|
+
function f(e) {
|
|
618
|
+
var t = Object.keys(d), r = process.env.NODE_NDEBUG ? u : function(e, t) {
|
|
619
|
+
e || c(t, "true", e);
|
|
620
|
+
};
|
|
621
|
+
return t.forEach(function(t) {
|
|
622
|
+
if (e) {
|
|
623
|
+
r[t] = u;
|
|
624
|
+
return;
|
|
625
|
+
}
|
|
626
|
+
var n = d[t];
|
|
627
|
+
r[t] = function(e, r) {
|
|
628
|
+
n.check(e) || c(r, t, n.operator, e, n.actual);
|
|
629
|
+
};
|
|
630
|
+
}), t.forEach(function(t) {
|
|
631
|
+
var n = "optional" + s(t);
|
|
632
|
+
if (e) {
|
|
633
|
+
r[n] = u;
|
|
634
|
+
return;
|
|
635
|
+
}
|
|
636
|
+
var i = d[t];
|
|
637
|
+
r[n] = function(e, n) {
|
|
638
|
+
e != null && (i.check(e) || c(n, t, i.operator, e, i.actual));
|
|
639
|
+
};
|
|
640
|
+
}), t.forEach(function(t) {
|
|
641
|
+
var n = "arrayOf" + s(t);
|
|
642
|
+
if (e) {
|
|
643
|
+
r[n] = u;
|
|
644
|
+
return;
|
|
645
|
+
}
|
|
646
|
+
var i = d[t], a = "[" + t + "]";
|
|
647
|
+
r[n] = function(e, t) {
|
|
648
|
+
Array.isArray(e) || c(t, a, i.operator, e, i.actual);
|
|
649
|
+
var n;
|
|
650
|
+
for (n = 0; n < e.length; n++) i.check(e[n]) || c(t, a, i.operator, e, i.actual);
|
|
651
|
+
};
|
|
652
|
+
}), t.forEach(function(t) {
|
|
653
|
+
var n = "optionalArrayOf" + s(t);
|
|
654
|
+
if (e) {
|
|
655
|
+
r[n] = u;
|
|
656
|
+
return;
|
|
657
|
+
}
|
|
658
|
+
var i = d[t], a = "[" + t + "]";
|
|
659
|
+
r[n] = function(e, t) {
|
|
660
|
+
if (e != null) {
|
|
661
|
+
Array.isArray(e) || c(t, a, i.operator, e, i.actual);
|
|
662
|
+
var n;
|
|
663
|
+
for (n = 0; n < e.length; n++) i.check(e[n]) || c(t, a, i.operator, e, i.actual);
|
|
664
|
+
}
|
|
665
|
+
};
|
|
666
|
+
}), Object.keys(n).forEach(function(t) {
|
|
667
|
+
if (t === "AssertionError") {
|
|
668
|
+
r[t] = n[t];
|
|
669
|
+
return;
|
|
670
|
+
}
|
|
671
|
+
if (e) {
|
|
672
|
+
r[t] = u;
|
|
673
|
+
return;
|
|
674
|
+
}
|
|
675
|
+
r[t] = n[t];
|
|
676
|
+
}), r._setExports = f, r;
|
|
677
|
+
}
|
|
678
|
+
t.exports = f(process.env.NODE_NDEBUG);
|
|
679
|
+
})), b = /* @__PURE__ */ n(((e) => {
|
|
680
|
+
var t = i("assert"), n = i("util");
|
|
681
|
+
e.sprintf = r, e.printf = a, e.fprintf = o;
|
|
682
|
+
function r(e) {
|
|
683
|
+
var r = [
|
|
684
|
+
"([^%]*)",
|
|
685
|
+
"%",
|
|
686
|
+
"(['\\-+ #0]*?)",
|
|
687
|
+
"([1-9]\\d*)?",
|
|
688
|
+
"(\\.([1-9]\\d*))?",
|
|
689
|
+
"[lhjztL]*?",
|
|
690
|
+
"([diouxXfFeEgGaAcCsSp%jr])"
|
|
691
|
+
].join(""), i = new RegExp(r), a = Array.prototype.slice.call(arguments, 1), o, l, u, d, f, p, m, h, g, _ = "", v = 1;
|
|
692
|
+
for (t.equal("string", typeof e); (g = i.exec(e)) !== null;) {
|
|
693
|
+
if (_ += g[1], e = e.substring(g[0].length), o = g[2] || "", l = g[3] || 0, u = g[4] || "", d = g[6], f = !1, m = !1, p = " ", d == "%") {
|
|
694
|
+
_ += "%";
|
|
695
|
+
continue;
|
|
696
|
+
}
|
|
697
|
+
if (a.length === 0) throw Error("too few args to sprintf");
|
|
698
|
+
if (h = a.shift(), v++, o.match(/[\' #]/)) throw Error("unsupported flags: " + o);
|
|
699
|
+
if (u.length > 0) throw Error("non-zero precision not supported");
|
|
700
|
+
switch (o.match(/-/) && (f = !0), o.match(/0/) && (p = "0"), o.match(/\+/) && (m = !0), d) {
|
|
701
|
+
case "s":
|
|
702
|
+
if (h == null) throw Error("argument " + v + ": attempted to print undefined or null as a string");
|
|
703
|
+
_ += s(p, l, f, h.toString());
|
|
704
|
+
break;
|
|
705
|
+
case "d": h = Math.floor(h);
|
|
706
|
+
case "f":
|
|
707
|
+
m = m && h > 0 ? "+" : "", _ += m + s(p, l, f, h.toString());
|
|
708
|
+
break;
|
|
709
|
+
case "x":
|
|
710
|
+
_ += s(p, l, f, h.toString(16));
|
|
711
|
+
break;
|
|
712
|
+
case "j":
|
|
713
|
+
l === 0 && (l = 10), _ += n.inspect(h, !1, l);
|
|
714
|
+
break;
|
|
715
|
+
case "r":
|
|
716
|
+
_ += c(h);
|
|
717
|
+
break;
|
|
718
|
+
default: throw Error("unsupported conversion: " + d);
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
return _ += e, _;
|
|
722
|
+
}
|
|
723
|
+
function a() {
|
|
724
|
+
var e = Array.prototype.slice.call(arguments);
|
|
725
|
+
e.unshift(process.stdout), o.apply(null, e);
|
|
726
|
+
}
|
|
727
|
+
function o(e) {
|
|
728
|
+
var t = Array.prototype.slice.call(arguments, 1);
|
|
729
|
+
return e.write(r.apply(this, t));
|
|
730
|
+
}
|
|
731
|
+
function s(e, t, n, r) {
|
|
732
|
+
for (var i = r; i.length < t;) n ? i += e : i = e + i;
|
|
733
|
+
return i;
|
|
734
|
+
}
|
|
735
|
+
function c(e) {
|
|
736
|
+
var t;
|
|
737
|
+
if (!(e instanceof Error)) throw Error(r("invalid type for %%r: %j", e));
|
|
738
|
+
if (t = "EXCEPTION: " + e.constructor.name + ": " + e.stack, e.cause && typeof e.cause == "function") {
|
|
739
|
+
var n = e.cause();
|
|
740
|
+
n && (t += "\nCaused by: " + c(n));
|
|
741
|
+
}
|
|
742
|
+
return t;
|
|
743
|
+
}
|
|
744
|
+
})), x = /* @__PURE__ */ n(((e) => {
|
|
745
|
+
function t(e) {
|
|
746
|
+
return Array.isArray ? Array.isArray(e) : h(e) === "[object Array]";
|
|
747
|
+
}
|
|
748
|
+
e.isArray = t;
|
|
749
|
+
function n(e) {
|
|
750
|
+
return typeof e == "boolean";
|
|
751
|
+
}
|
|
752
|
+
e.isBoolean = n;
|
|
753
|
+
function r(e) {
|
|
754
|
+
return e === null;
|
|
755
|
+
}
|
|
756
|
+
e.isNull = r;
|
|
757
|
+
function i(e) {
|
|
758
|
+
return e == null;
|
|
759
|
+
}
|
|
760
|
+
e.isNullOrUndefined = i;
|
|
761
|
+
function a(e) {
|
|
762
|
+
return typeof e == "number";
|
|
763
|
+
}
|
|
764
|
+
e.isNumber = a;
|
|
765
|
+
function o(e) {
|
|
766
|
+
return typeof e == "string";
|
|
767
|
+
}
|
|
768
|
+
e.isString = o;
|
|
769
|
+
function s(e) {
|
|
770
|
+
return typeof e == "symbol";
|
|
771
|
+
}
|
|
772
|
+
e.isSymbol = s;
|
|
773
|
+
function c(e) {
|
|
774
|
+
return e === void 0;
|
|
775
|
+
}
|
|
776
|
+
e.isUndefined = c;
|
|
777
|
+
function l(e) {
|
|
778
|
+
return h(e) === "[object RegExp]";
|
|
779
|
+
}
|
|
780
|
+
e.isRegExp = l;
|
|
781
|
+
function u(e) {
|
|
782
|
+
return typeof e == "object" && !!e;
|
|
783
|
+
}
|
|
784
|
+
e.isObject = u;
|
|
785
|
+
function d(e) {
|
|
786
|
+
return h(e) === "[object Date]";
|
|
787
|
+
}
|
|
788
|
+
e.isDate = d;
|
|
789
|
+
function f(e) {
|
|
790
|
+
return h(e) === "[object Error]" || e instanceof Error;
|
|
791
|
+
}
|
|
792
|
+
e.isError = f;
|
|
793
|
+
function p(e) {
|
|
794
|
+
return typeof e == "function";
|
|
795
|
+
}
|
|
796
|
+
e.isFunction = p;
|
|
797
|
+
function m(e) {
|
|
798
|
+
return e === null || typeof e == "boolean" || typeof e == "number" || typeof e == "string" || typeof e == "symbol" || e === void 0;
|
|
799
|
+
}
|
|
800
|
+
e.isPrimitive = m, e.isBuffer = Buffer.isBuffer;
|
|
801
|
+
function h(e) {
|
|
802
|
+
return Object.prototype.toString.call(e);
|
|
803
|
+
}
|
|
804
|
+
})), S = /* @__PURE__ */ n(((e, t) => {
|
|
805
|
+
var n = y(), r = i("util"), a = b(), o = x().isError, s = a.sprintf;
|
|
806
|
+
t.exports = l, l.VError = l, l.SError = u, l.WError = f, l.MultiError = d;
|
|
807
|
+
function c(e) {
|
|
808
|
+
var t, r, i, a, c;
|
|
809
|
+
if (n.object(e, "args"), n.bool(e.strict, "args.strict"), n.array(e.argv, "args.argv"), t = e.argv, t.length === 0) r = {}, i = [];
|
|
810
|
+
else if (o(t[0])) r = { cause: t[0] }, i = t.slice(1);
|
|
811
|
+
else if (typeof t[0] == "object") {
|
|
812
|
+
for (c in r = {}, t[0]) r[c] = t[0][c];
|
|
813
|
+
i = t.slice(1);
|
|
814
|
+
} else n.string(t[0], "first argument to VError, SError, or WError constructor must be a string, object, or Error"), r = {}, i = t;
|
|
815
|
+
return n.object(r), !r.strict && !e.strict && (i = i.map(function(e) {
|
|
816
|
+
return e === null ? "null" : e === void 0 ? "undefined" : e;
|
|
817
|
+
})), a = i.length === 0 ? "" : s.apply(null, i), {
|
|
818
|
+
options: r,
|
|
819
|
+
shortmessage: a
|
|
820
|
+
};
|
|
821
|
+
}
|
|
822
|
+
function l() {
|
|
823
|
+
var e = Array.prototype.slice.call(arguments, 0), t, r, i, a, s, u;
|
|
824
|
+
if (!(this instanceof l)) return t = Object.create(l.prototype), l.apply(t, arguments), t;
|
|
825
|
+
if (r = c({
|
|
826
|
+
argv: e,
|
|
827
|
+
strict: !1
|
|
828
|
+
}), r.options.name && (n.string(r.options.name, "error's \"name\" must be a string"), this.name = r.options.name), this.jse_shortmsg = r.shortmessage, s = r.shortmessage, i = r.options.cause, i && (n.ok(o(i), "cause is not an Error"), this.jse_cause = i, r.options.skipCauseMessage || (s += ": " + i.message)), this.jse_info = {}, r.options.info) for (u in r.options.info) this.jse_info[u] = r.options.info[u];
|
|
829
|
+
return this.message = s, Error.call(this, s), Error.captureStackTrace && (a = r.options.constructorOpt || this.constructor, Error.captureStackTrace(this, a)), this;
|
|
830
|
+
}
|
|
831
|
+
r.inherits(l, Error), l.prototype.name = "VError", l.prototype.toString = function() {
|
|
832
|
+
var e = this.hasOwnProperty("name") && this.name || this.constructor.name || this.constructor.prototype.name;
|
|
833
|
+
return this.message && (e += ": " + this.message), e;
|
|
834
|
+
}, l.prototype.cause = function() {
|
|
835
|
+
var e = l.cause(this);
|
|
836
|
+
return e === null ? void 0 : e;
|
|
837
|
+
}, l.cause = function(e) {
|
|
838
|
+
return n.ok(o(e), "err must be an Error"), o(e.jse_cause) ? e.jse_cause : null;
|
|
839
|
+
}, l.info = function(e) {
|
|
840
|
+
var t, r, i;
|
|
841
|
+
if (n.ok(o(e), "err must be an Error"), r = l.cause(e), t = r === null ? {} : l.info(r), typeof e.jse_info == "object" && e.jse_info !== null) for (i in e.jse_info) t[i] = e.jse_info[i];
|
|
842
|
+
return t;
|
|
843
|
+
}, l.findCauseByName = function(e, t) {
|
|
844
|
+
var r;
|
|
845
|
+
for (n.ok(o(e), "err must be an Error"), n.string(t, "name"), n.ok(t.length > 0, "name cannot be empty"), r = e; r !== null; r = l.cause(r)) if (n.ok(o(r)), r.name == t) return r;
|
|
846
|
+
return null;
|
|
847
|
+
}, l.hasCauseWithName = function(e, t) {
|
|
848
|
+
return l.findCauseByName(e, t) !== null;
|
|
849
|
+
}, l.fullStack = function(e) {
|
|
850
|
+
n.ok(o(e), "err must be an Error");
|
|
851
|
+
var t = l.cause(e);
|
|
852
|
+
return t ? e.stack + "\ncaused by: " + l.fullStack(t) : e.stack;
|
|
853
|
+
}, l.errorFromList = function(e) {
|
|
854
|
+
return n.arrayOfObject(e, "errors"), e.length === 0 ? null : (e.forEach(function(e) {
|
|
855
|
+
n.ok(o(e));
|
|
856
|
+
}), e.length == 1 ? e[0] : new d(e));
|
|
857
|
+
}, l.errorForEach = function(e, t) {
|
|
858
|
+
n.ok(o(e), "err must be an Error"), n.func(t, "func"), e instanceof d ? e.errors().forEach(function(e) {
|
|
859
|
+
t(e);
|
|
860
|
+
}) : t(e);
|
|
861
|
+
};
|
|
862
|
+
function u() {
|
|
863
|
+
var e = Array.prototype.slice.call(arguments, 0), t, n, r;
|
|
864
|
+
return this instanceof u ? (n = c({
|
|
865
|
+
argv: e,
|
|
866
|
+
strict: !0
|
|
867
|
+
}), r = n.options, l.call(this, r, "%s", n.shortmessage), this) : (t = Object.create(u.prototype), u.apply(t, arguments), t);
|
|
868
|
+
}
|
|
869
|
+
r.inherits(u, l);
|
|
870
|
+
function d(e) {
|
|
871
|
+
n.array(e, "list of errors"), n.ok(e.length > 0, "must be at least one error"), this.ase_errors = e, l.call(this, { cause: e[0] }, "first of %d error%s", e.length, e.length == 1 ? "" : "s");
|
|
872
|
+
}
|
|
873
|
+
r.inherits(d, l), d.prototype.name = "MultiError", d.prototype.errors = function() {
|
|
874
|
+
return this.ase_errors.slice(0);
|
|
875
|
+
};
|
|
876
|
+
function f() {
|
|
877
|
+
var e = Array.prototype.slice.call(arguments, 0), t, n, r;
|
|
878
|
+
return this instanceof f ? (n = c({
|
|
879
|
+
argv: e,
|
|
880
|
+
strict: !1
|
|
881
|
+
}), r = n.options, r.skipCauseMessage = !0, l.call(this, r, "%s", n.shortmessage), this) : (t = Object.create(f.prototype), f.apply(t, e), t);
|
|
882
|
+
}
|
|
883
|
+
r.inherits(f, l), f.prototype.name = "WError", f.prototype.toString = function() {
|
|
884
|
+
var e = this.hasOwnProperty("name") && this.name || this.constructor.name || this.constructor.prototype.name;
|
|
885
|
+
return this.message && (e += ": " + this.message), this.jse_cause && this.jse_cause.message && (e += "; caused by " + this.jse_cause.toString()), e;
|
|
886
|
+
}, f.prototype.cause = function(e) {
|
|
887
|
+
return o(e) && (this.jse_cause = e), this.jse_cause;
|
|
888
|
+
};
|
|
889
|
+
})), C = /* @__PURE__ */ n(((e, t) => {
|
|
890
|
+
(function(e, n) {
|
|
891
|
+
typeof define == "function" && define.amd ? define([], function() {
|
|
892
|
+
return n();
|
|
893
|
+
}) : typeof t == "object" && t.exports ? t.exports = n() : e.jsonSchema = n();
|
|
894
|
+
})(e, function() {
|
|
895
|
+
var e = n;
|
|
896
|
+
e.Integer = { type: "integer" };
|
|
897
|
+
var t = {
|
|
898
|
+
String,
|
|
899
|
+
Boolean,
|
|
900
|
+
Number,
|
|
901
|
+
Object,
|
|
902
|
+
Array,
|
|
903
|
+
Date
|
|
904
|
+
};
|
|
905
|
+
e.validate = n;
|
|
906
|
+
function n(e, t) {
|
|
907
|
+
return n(e, t, { changing: !1 });
|
|
908
|
+
}
|
|
909
|
+
e.checkPropertyChange = function(e, t, r) {
|
|
910
|
+
return n(e, t, { changing: r || "property" });
|
|
911
|
+
};
|
|
912
|
+
var n = e._validate = function(e, n, r) {
|
|
913
|
+
r ||= {};
|
|
914
|
+
var i = r.changing;
|
|
915
|
+
function a(e) {
|
|
916
|
+
return e.type || t[e.name] == e && e.name.toLowerCase();
|
|
917
|
+
}
|
|
918
|
+
var o = [];
|
|
919
|
+
function s(e, t, n, l) {
|
|
920
|
+
var u;
|
|
921
|
+
n += n ? typeof l == "number" ? "[" + l + "]" : l === void 0 ? "" : "." + l : l;
|
|
922
|
+
function d(e) {
|
|
923
|
+
o.push({
|
|
924
|
+
property: n,
|
|
925
|
+
message: e
|
|
926
|
+
});
|
|
927
|
+
}
|
|
928
|
+
if ((typeof t != "object" || t instanceof Array) && (n || typeof t != "function") && !(t && a(t))) return typeof t == "function" ? e instanceof t || d("is not an instance of the class/constructor " + t.name) : t && d("Invalid schema/property definition " + t), null;
|
|
929
|
+
i && t.readonly && d("is a readonly field, it can not be changed"), t.extends && s(e, t.extends, n, l);
|
|
930
|
+
function f(e, t) {
|
|
931
|
+
if (e) {
|
|
932
|
+
if (typeof e == "string" && e != "any" && (e == "null" ? t !== null : typeof t != e) && !(t instanceof Array && e == "array") && !(t instanceof Date && e == "date") && !(e == "integer" && t % 1 == 0)) return [{
|
|
933
|
+
property: n,
|
|
934
|
+
message: t + " - " + typeof t + " value found, but a " + e + " is required"
|
|
935
|
+
}];
|
|
936
|
+
if (e instanceof Array) {
|
|
937
|
+
for (var r = [], i = 0; i < e.length && (r = f(e[i], t)).length; i++);
|
|
938
|
+
if (r.length) return r;
|
|
939
|
+
} else if (typeof e == "object") {
|
|
940
|
+
var a = o;
|
|
941
|
+
o = [], s(t, e, n);
|
|
942
|
+
var c = o;
|
|
943
|
+
return o = a, c;
|
|
944
|
+
}
|
|
945
|
+
}
|
|
946
|
+
return [];
|
|
947
|
+
}
|
|
948
|
+
if (e === void 0) t.required && d("is missing and it is required");
|
|
949
|
+
else if (o = o.concat(f(a(t), e)), t.disallow && !f(t.disallow, e).length && d(" disallowed value was matched"), e !== null) {
|
|
950
|
+
if (e instanceof Array) {
|
|
951
|
+
if (t.items) {
|
|
952
|
+
var p = t.items instanceof Array, m = t.items;
|
|
953
|
+
for (l = 0, u = e.length; l < u; l += 1) p && (m = t.items[l]), r.coerce && (e[l] = r.coerce(e[l], m)), o.concat(s(e[l], m, n, l));
|
|
954
|
+
}
|
|
955
|
+
t.minItems && e.length < t.minItems && d("There must be a minimum of " + t.minItems + " in the array"), t.maxItems && e.length > t.maxItems && d("There must be a maximum of " + t.maxItems + " in the array");
|
|
956
|
+
} else (t.properties || t.additionalProperties) && o.concat(c(e, t.properties, n, t.additionalProperties));
|
|
957
|
+
if (t.pattern && typeof e == "string" && !e.match(t.pattern) && d("does not match the regex pattern " + t.pattern), t.maxLength && typeof e == "string" && e.length > t.maxLength && d("may only be " + t.maxLength + " characters long"), t.minLength && typeof e == "string" && e.length < t.minLength && d("must be at least " + t.minLength + " characters long"), t.minimum !== void 0 && typeof e == typeof t.minimum && t.minimum > e && d("must have a minimum value of " + t.minimum), t.maximum !== void 0 && typeof e == typeof t.maximum && t.maximum < e && d("must have a maximum value of " + t.maximum), t.enum) {
|
|
958
|
+
var h = t.enum;
|
|
959
|
+
u = h.length;
|
|
960
|
+
for (var g, _ = 0; _ < u; _++) if (h[_] === e) {
|
|
961
|
+
g = 1;
|
|
962
|
+
break;
|
|
963
|
+
}
|
|
964
|
+
g || d("does not have a value in the enumeration " + h.join(", "));
|
|
965
|
+
}
|
|
966
|
+
typeof t.maxDecimal == "number" && e.toString().match(RegExp("\\.[0-9]{" + (t.maxDecimal + 1) + ",}")) && d("may only have " + t.maxDecimal + " digits of decimal places");
|
|
967
|
+
}
|
|
968
|
+
return null;
|
|
969
|
+
}
|
|
970
|
+
function c(e, t, n, a) {
|
|
971
|
+
if (typeof t == "object") {
|
|
972
|
+
for (var c in (typeof e != "object" || e instanceof Array) && o.push({
|
|
973
|
+
property: n,
|
|
974
|
+
message: "an object is required"
|
|
975
|
+
}), t) if (t.hasOwnProperty(c) && c != "__proto__" && c != "constructor") {
|
|
976
|
+
var l = e.hasOwnProperty(c) ? e[c] : void 0;
|
|
977
|
+
if (l === void 0 && r.existingOnly) continue;
|
|
978
|
+
var u = t[c];
|
|
979
|
+
l === void 0 && u.default && (l = e[c] = u.default), r.coerce && c in e && (l = e[c] = r.coerce(l, u)), s(l, u, n, c);
|
|
980
|
+
}
|
|
981
|
+
}
|
|
982
|
+
for (c in e) {
|
|
983
|
+
if (e.hasOwnProperty(c) && !(c.charAt(0) == "_" && c.charAt(1) == "_") && t && !t[c] && a === !1) if (r.filter) {
|
|
984
|
+
delete e[c];
|
|
985
|
+
continue;
|
|
986
|
+
} else o.push({
|
|
987
|
+
property: n,
|
|
988
|
+
message: "The property " + c + " is not defined in the schema and the schema does not allow additional properties"
|
|
989
|
+
});
|
|
990
|
+
var d = t && t[c] && t[c].requires;
|
|
991
|
+
d && !(d in e) && o.push({
|
|
992
|
+
property: n,
|
|
993
|
+
message: "the presence of the property " + c + " requires that " + d + " also be present"
|
|
994
|
+
}), l = e[c], a && (!(t && typeof t == "object") || !(c in t)) && (r.coerce && (l = e[c] = r.coerce(l, a)), s(l, a, n, c)), !i && l && l.$schema && (o = o.concat(s(l, l.$schema, n, c)));
|
|
995
|
+
}
|
|
996
|
+
return o;
|
|
997
|
+
}
|
|
998
|
+
return n && s(e, n, "", i || ""), !i && e && e.$schema && s(e, e.$schema, "", ""), {
|
|
999
|
+
valid: !o.length,
|
|
1000
|
+
errors: o
|
|
1001
|
+
};
|
|
1002
|
+
};
|
|
1003
|
+
return e.mustBeValid = function(e) {
|
|
1004
|
+
if (!e.valid) throw TypeError(e.errors.map(function(e) {
|
|
1005
|
+
return "for property " + e.property + ": " + e.message;
|
|
1006
|
+
}).join(", \n"));
|
|
1007
|
+
}, e;
|
|
1008
|
+
});
|
|
1009
|
+
})), ee = /* @__PURE__ */ n(((e) => {
|
|
1010
|
+
var t = y();
|
|
1011
|
+
i("util");
|
|
1012
|
+
var n = b(), r = S(), a = C();
|
|
1013
|
+
e.deepCopy = o, e.deepEqual = s, e.isEmpty = c, e.hasKey = l, e.forEachKey = u, e.pluck = d, e.flattenObject = h, e.flattenIter = p, e.validateJsonObject = J, e.validateJsonObjectJS = J, e.randElt = Y, e.extraProperties = oe, e.mergeObjects = se, e.startsWith = g, e.endsWith = _, e.parseInteger = W, e.iso8601 = v, e.rfc1123 = w, e.parseDateTime = T, e.hrtimediff = Z, e.hrtimeDiff = Z, e.hrtimeAccum = $, e.hrtimeAdd = ae, e.hrtimeNanosec = Q, e.hrtimeMicrosec = re, e.hrtimeMillisec = ie;
|
|
1014
|
+
function o(e) {
|
|
1015
|
+
var t, n, r = "__deepCopy";
|
|
1016
|
+
if (e && e[r]) throw Error("attempted deep copy of cyclic object");
|
|
1017
|
+
if (e && e.constructor == Object) {
|
|
1018
|
+
for (n in t = {}, e[r] = !0, e) n != r && (t[n] = o(e[n]));
|
|
1019
|
+
return delete e[r], t;
|
|
1020
|
+
}
|
|
1021
|
+
if (e && e.constructor == Array) {
|
|
1022
|
+
for (t = [], e[r] = !0, n = 0; n < e.length; n++) t.push(o(e[n]));
|
|
1023
|
+
return delete e[r], t;
|
|
1024
|
+
}
|
|
1025
|
+
return e;
|
|
1026
|
+
}
|
|
1027
|
+
function s(e, t) {
|
|
1028
|
+
if (typeof e != typeof t) return !1;
|
|
1029
|
+
if (e === null || t === null || typeof e != "object") return e === t;
|
|
1030
|
+
if (e.constructor != t.constructor) return !1;
|
|
1031
|
+
for (var n in e) if (!(n in t) || !s(e[n], t[n])) return !1;
|
|
1032
|
+
for (n in t) if (!(n in e)) return !1;
|
|
1033
|
+
return !0;
|
|
1034
|
+
}
|
|
1035
|
+
function c(e) {
|
|
1036
|
+
for (var t in e) return !1;
|
|
1037
|
+
return !0;
|
|
1038
|
+
}
|
|
1039
|
+
function l(e, n) {
|
|
1040
|
+
return t.equal(typeof n, "string"), Object.prototype.hasOwnProperty.call(e, n);
|
|
1041
|
+
}
|
|
1042
|
+
function u(e, t) {
|
|
1043
|
+
for (var n in e) l(e, n) && t(n, e[n]);
|
|
1044
|
+
}
|
|
1045
|
+
function d(e, n) {
|
|
1046
|
+
return t.equal(typeof n, "string"), f(e, n);
|
|
1047
|
+
}
|
|
1048
|
+
function f(e, t) {
|
|
1049
|
+
if (!(typeof e != "object" || !e)) {
|
|
1050
|
+
if (e.hasOwnProperty(t)) return e[t];
|
|
1051
|
+
var n = t.indexOf(".");
|
|
1052
|
+
if (n != -1) {
|
|
1053
|
+
var r = t.substr(0, n);
|
|
1054
|
+
if (e.hasOwnProperty(r)) return f(e[r], t.substr(n + 1));
|
|
1055
|
+
}
|
|
1056
|
+
}
|
|
1057
|
+
}
|
|
1058
|
+
function p(e, t, n) {
|
|
1059
|
+
m(e, t, [], n);
|
|
1060
|
+
}
|
|
1061
|
+
function m(e, n, r, i) {
|
|
1062
|
+
var a, o;
|
|
1063
|
+
if (n === 0) {
|
|
1064
|
+
a = r.slice(0), a.push(e), i(a);
|
|
1065
|
+
return;
|
|
1066
|
+
}
|
|
1067
|
+
for (o in t.ok(e !== null), t.equal(typeof e, "object"), t.equal(typeof n, "number"), t.ok(n >= 0), e) a = r.slice(0), a.push(o), m(e[o], n - 1, a, i);
|
|
1068
|
+
}
|
|
1069
|
+
function h(e, n) {
|
|
1070
|
+
if (n === 0) return [e];
|
|
1071
|
+
t.ok(e !== null), t.equal(typeof e, "object"), t.equal(typeof n, "number"), t.ok(n >= 0);
|
|
1072
|
+
var r = [], i;
|
|
1073
|
+
for (i in e) h(e[i], n - 1).forEach(function(e) {
|
|
1074
|
+
r.push([i].concat(e));
|
|
1075
|
+
});
|
|
1076
|
+
return r;
|
|
1077
|
+
}
|
|
1078
|
+
function g(e, t) {
|
|
1079
|
+
return e.substr(0, t.length) == t;
|
|
1080
|
+
}
|
|
1081
|
+
function _(e, t) {
|
|
1082
|
+
return e.substr(e.length - t.length, t.length) == t;
|
|
1083
|
+
}
|
|
1084
|
+
function v(e) {
|
|
1085
|
+
return typeof e == "number" && (e = new Date(e)), t.ok(e.constructor === Date), n.sprintf("%4d-%02d-%02dT%02d:%02d:%02d.%03dZ", e.getUTCFullYear(), e.getUTCMonth() + 1, e.getUTCDate(), e.getUTCHours(), e.getUTCMinutes(), e.getUTCSeconds(), e.getUTCMilliseconds());
|
|
1086
|
+
}
|
|
1087
|
+
var x = [
|
|
1088
|
+
"Jan",
|
|
1089
|
+
"Feb",
|
|
1090
|
+
"Mar",
|
|
1091
|
+
"Apr",
|
|
1092
|
+
"May",
|
|
1093
|
+
"Jun",
|
|
1094
|
+
"Jul",
|
|
1095
|
+
"Aug",
|
|
1096
|
+
"Sep",
|
|
1097
|
+
"Oct",
|
|
1098
|
+
"Nov",
|
|
1099
|
+
"Dec"
|
|
1100
|
+
], ee = [
|
|
1101
|
+
"Sun",
|
|
1102
|
+
"Mon",
|
|
1103
|
+
"Tue",
|
|
1104
|
+
"Wed",
|
|
1105
|
+
"Thu",
|
|
1106
|
+
"Fri",
|
|
1107
|
+
"Sat"
|
|
1108
|
+
];
|
|
1109
|
+
function w(e) {
|
|
1110
|
+
return n.sprintf("%s, %02d %s %04d %02d:%02d:%02d GMT", ee[e.getUTCDay()], e.getUTCDate(), x[e.getUTCMonth()], e.getUTCFullYear(), e.getUTCHours(), e.getUTCMinutes(), e.getUTCSeconds());
|
|
1111
|
+
}
|
|
1112
|
+
function T(e) {
|
|
1113
|
+
var t = +e;
|
|
1114
|
+
return isNaN(t) ? new Date(e) : new Date(t);
|
|
1115
|
+
}
|
|
1116
|
+
var E = 2 ** 53 - 1 || 9007199254740991, D = -(2 ** 53 - 1) || -9007199254740991, O = {
|
|
1117
|
+
base: 10,
|
|
1118
|
+
allowSign: !0,
|
|
1119
|
+
allowPrefix: !1,
|
|
1120
|
+
allowTrailing: !1,
|
|
1121
|
+
allowImprecise: !1,
|
|
1122
|
+
trimWhitespace: !1,
|
|
1123
|
+
leadingZeroIsOctal: !1
|
|
1124
|
+
}, k = 48, A = 57, te = 65, ne = 66, j = 79, M = 84, N = 88, P = 90, F = 97, I = 98, L = 111, R = 116, z = 120, B = 122, V = 48, H = 55, U = 87;
|
|
1125
|
+
function W(e, n) {
|
|
1126
|
+
t.string(e, "str"), t.optionalObject(n, "options");
|
|
1127
|
+
var r = !1, i = O;
|
|
1128
|
+
n && (r = l(n, "base"), i = se(i, n), t.number(i.base, "options.base"), t.ok(i.base >= 2, "options.base >= 2"), t.ok(i.base <= 36, "options.base <= 36"), t.bool(i.allowSign, "options.allowSign"), t.bool(i.allowPrefix, "options.allowPrefix"), t.bool(i.allowTrailing, "options.allowTrailing"), t.bool(i.allowImprecise, "options.allowImprecise"), t.bool(i.trimWhitespace, "options.trimWhitespace"), t.bool(i.leadingZeroIsOctal, "options.leadingZeroIsOctal"), i.leadingZeroIsOctal && t.ok(!r, "\"base\" and \"leadingZeroIsOctal\" are mutually exclusive"));
|
|
1129
|
+
var a, o = -1, s = i.base, c, u = 1, d = 0, f = 0, p = e.length;
|
|
1130
|
+
if (i.trimWhitespace) for (; f < p && K(e.charCodeAt(f));) ++f;
|
|
1131
|
+
for (i.allowSign && (e[f] === "-" ? (f += 1, u = -1) : e[f] === "+" && (f += 1)), e[f] === "0" && (i.allowPrefix && (o = q(e.charCodeAt(f + 1)), o !== -1 && (!r || o === s) && (s = o, f += 2)), o === -1 && i.leadingZeroIsOctal && (s = 8)), c = f; f < p && (a = G(e.charCodeAt(f)), a !== -1 && a < s); ++f) d *= s, d += a;
|
|
1132
|
+
if (c === f) return /* @__PURE__ */ Error("invalid number: " + JSON.stringify(e));
|
|
1133
|
+
if (i.trimWhitespace) for (; f < p && K(e.charCodeAt(f));) ++f;
|
|
1134
|
+
if (f < p && !i.allowTrailing) return /* @__PURE__ */ Error("trailing characters after number: " + JSON.stringify(e.slice(f)));
|
|
1135
|
+
if (d === 0) return 0;
|
|
1136
|
+
var m = d * u;
|
|
1137
|
+
return !i.allowImprecise && (d > E || m < D) ? /* @__PURE__ */ Error("number is outside of the supported range: " + JSON.stringify(e.slice(c, f))) : m;
|
|
1138
|
+
}
|
|
1139
|
+
function G(e) {
|
|
1140
|
+
return e >= k && e <= A ? e - V : e >= te && e <= P ? e - H : e >= F && e <= B ? e - U : -1;
|
|
1141
|
+
}
|
|
1142
|
+
function K(e) {
|
|
1143
|
+
return e === 32 || e >= 9 && e <= 13 || e === 160 || e === 5760 || e === 6158 || e >= 8192 && e <= 8202 || e === 8232 || e === 8233 || e === 8239 || e === 8287 || e === 12288 || e === 65279;
|
|
1144
|
+
}
|
|
1145
|
+
function q(e) {
|
|
1146
|
+
return e === I || e === ne ? 2 : e === L || e === j ? 8 : e === R || e === M ? 10 : e === z || e === N ? 16 : -1;
|
|
1147
|
+
}
|
|
1148
|
+
function J(e, t) {
|
|
1149
|
+
var n = a.validate(t, e);
|
|
1150
|
+
if (n.errors.length === 0) return null;
|
|
1151
|
+
var i = n.errors[0], o = i.property, s = i.message.toLowerCase(), c, l;
|
|
1152
|
+
(c = s.indexOf("the property ")) != -1 && (l = s.indexOf(" is not defined in the schema and the schema does not allow additional properties")) != -1 && (c += 13, o = o === "" ? s.substr(c, l - c) : o + "." + s.substr(c, l - c), s = "unsupported property");
|
|
1153
|
+
var u = new r.VError("property \"%s\": %s", o, s);
|
|
1154
|
+
return u.jsv_details = i, u;
|
|
1155
|
+
}
|
|
1156
|
+
function Y(e) {
|
|
1157
|
+
return t.ok(Array.isArray(e) && e.length > 0, "randElt argument must be a non-empty array"), e[Math.floor(Math.random() * e.length)];
|
|
1158
|
+
}
|
|
1159
|
+
function X(e) {
|
|
1160
|
+
t.ok(e[0] >= 0 && e[1] >= 0, "negative numbers not allowed in hrtimes"), t.ok(e[1] < 1e9, "nanoseconds column overflow");
|
|
1161
|
+
}
|
|
1162
|
+
function Z(e, n) {
|
|
1163
|
+
X(e), X(n), t.ok(e[0] > n[0] || e[0] == n[0] && e[1] >= n[1], "negative differences not allowed");
|
|
1164
|
+
var r = [e[0] - n[0], 0];
|
|
1165
|
+
return e[1] >= n[1] ? r[1] = e[1] - n[1] : (r[0]--, r[1] = 1e9 - (n[1] - e[1])), r;
|
|
1166
|
+
}
|
|
1167
|
+
function Q(e) {
|
|
1168
|
+
return X(e), Math.floor(e[0] * 1e9 + e[1]);
|
|
1169
|
+
}
|
|
1170
|
+
function re(e) {
|
|
1171
|
+
return X(e), Math.floor(e[0] * 1e6 + e[1] / 1e3);
|
|
1172
|
+
}
|
|
1173
|
+
function ie(e) {
|
|
1174
|
+
return X(e), Math.floor(e[0] * 1e3 + e[1] / 1e6);
|
|
1175
|
+
}
|
|
1176
|
+
function $(e, t) {
|
|
1177
|
+
return X(e), X(t), e[1] += t[1], e[1] >= 1e9 && (e[0]++, e[1] -= 1e9), e[0] += t[0], e;
|
|
1178
|
+
}
|
|
1179
|
+
function ae(e, t) {
|
|
1180
|
+
return X(e), $([e[0], e[1]], t);
|
|
1181
|
+
}
|
|
1182
|
+
function oe(e, n) {
|
|
1183
|
+
t.ok(typeof e == "object" && !!e, "obj argument must be a non-null object"), t.ok(Array.isArray(n), "allowed argument must be an array of strings");
|
|
1184
|
+
for (var r = 0; r < n.length; r++) t.ok(typeof n[r] == "string", "allowed argument must be an array of strings");
|
|
1185
|
+
return Object.keys(e).filter(function(e) {
|
|
1186
|
+
return n.indexOf(e) === -1;
|
|
1187
|
+
});
|
|
1188
|
+
}
|
|
1189
|
+
function se(e, t, n) {
|
|
1190
|
+
var r = {}, i;
|
|
1191
|
+
if (n) for (i in n) r[i] = n[i];
|
|
1192
|
+
if (e) for (i in e) r[i] = e[i];
|
|
1193
|
+
if (t) for (i in t) r[i] = t[i];
|
|
1194
|
+
return r;
|
|
1195
|
+
}
|
|
1196
|
+
})), w = /* @__PURE__ */ n(((e, t) => {
|
|
1197
|
+
var n = y(), r = ee(), a = i("util");
|
|
1198
|
+
function o(e, t, n) {
|
|
1199
|
+
Error.captureStackTrace && Error.captureStackTrace(this, o), this.input = e, this.message = t, n !== void 0 && (this.message += " at index " + n);
|
|
1200
|
+
}
|
|
1201
|
+
a.inherits(o, Error);
|
|
1202
|
+
function s(e, t) {
|
|
1203
|
+
return (t + e % t) % t;
|
|
1204
|
+
}
|
|
1205
|
+
function c(e) {
|
|
1206
|
+
var t = (e[0] >> 8) + "." + (e[0] & 255) + ".";
|
|
1207
|
+
return t += (e[1] >> 8) + "." + (e[1] & 255), t;
|
|
1208
|
+
}
|
|
1209
|
+
function l(e) {
|
|
1210
|
+
return !!(typeof e == "object" && Array.isArray(e._fields) && typeof e._attrs == "object");
|
|
1211
|
+
}
|
|
1212
|
+
function u(e) {
|
|
1213
|
+
if (typeof e == "string") return C(e);
|
|
1214
|
+
if (l(e)) return e;
|
|
1215
|
+
throw Error("Invalid argument: Addr or parsable string expected");
|
|
1216
|
+
}
|
|
1217
|
+
function d(e, t, n) {
|
|
1218
|
+
var r, i = null, a = 0;
|
|
1219
|
+
if (t) {
|
|
1220
|
+
var o = null, s = null;
|
|
1221
|
+
for (r = 0; r < e.length; r++) e[r] === 0 ? o === null ? (o = r, s = 1) : s++ : o !== null && (s > a && (i = o, a = s), o = null);
|
|
1222
|
+
o !== null && s > a && (i = o, a = s);
|
|
1223
|
+
}
|
|
1224
|
+
var c = [], l;
|
|
1225
|
+
for (r = 0; r < e.length; r++) {
|
|
1226
|
+
if (i !== null) {
|
|
1227
|
+
if (r === i) {
|
|
1228
|
+
if (a === 8) return ["::"];
|
|
1229
|
+
i === 0 || i + a === e.length ? c.push(":") : c.push("");
|
|
1230
|
+
}
|
|
1231
|
+
if (r >= i && r < i + a) continue;
|
|
1232
|
+
}
|
|
1233
|
+
l = e[r].toString(16), n && l.length != 4 && (l = "0000".slice(l.length) + l), c.push(l);
|
|
1234
|
+
}
|
|
1235
|
+
return c;
|
|
1236
|
+
}
|
|
1237
|
+
function f(e) {
|
|
1238
|
+
var t = [
|
|
1239
|
+
0,
|
|
1240
|
+
0,
|
|
1241
|
+
0,
|
|
1242
|
+
0,
|
|
1243
|
+
0,
|
|
1244
|
+
65535
|
|
1245
|
+
], n;
|
|
1246
|
+
for (n = 0; n < 6; n++) if (e[n] != t[n]) return !1;
|
|
1247
|
+
return !0;
|
|
1248
|
+
}
|
|
1249
|
+
function p(e) {
|
|
1250
|
+
n.number(e), e |= 0, n.ok(e <= 128), n.ok(e >= 0);
|
|
1251
|
+
var t = new _(), r;
|
|
1252
|
+
for (r = 0; e > 16; r++, e -= 16) t._fields[r] = 65535;
|
|
1253
|
+
return e > 0 && (t._fields[r] = 65535 - ((1 << 16 - e) - 1)), t;
|
|
1254
|
+
}
|
|
1255
|
+
function m(e) {
|
|
1256
|
+
if (typeof e == "string") return new v(e);
|
|
1257
|
+
if (e instanceof v) return e;
|
|
1258
|
+
throw Error("Invalid argument: CIDR or parsable string expected");
|
|
1259
|
+
}
|
|
1260
|
+
var h = {
|
|
1261
|
+
format: "auto",
|
|
1262
|
+
zeroElide: !0,
|
|
1263
|
+
zeroPad: !1
|
|
1264
|
+
};
|
|
1265
|
+
function g(e, t) {
|
|
1266
|
+
return e && e.hasOwnProperty(t) ? e[t] : h[t];
|
|
1267
|
+
}
|
|
1268
|
+
function _() {
|
|
1269
|
+
this._fields = [
|
|
1270
|
+
0,
|
|
1271
|
+
0,
|
|
1272
|
+
0,
|
|
1273
|
+
0,
|
|
1274
|
+
0,
|
|
1275
|
+
0,
|
|
1276
|
+
0,
|
|
1277
|
+
0
|
|
1278
|
+
], this._attrs = {};
|
|
1279
|
+
}
|
|
1280
|
+
_.prototype.kind = function() {
|
|
1281
|
+
return b.contains(this) ? "ipv4" : "ipv6";
|
|
1282
|
+
}, _.prototype.toString = function(e) {
|
|
1283
|
+
n.optionalObject(e, "opts");
|
|
1284
|
+
var t = g(e, "format"), r = g(e, "zeroElide"), i = g(e, "zeroPad");
|
|
1285
|
+
switch (n.string(t, "opts.format"), n.bool(r, "opts.zeroElide"), n.bool(i, "opts.zeroPad"), t === "auto" && (t = this._attrs.ipv4Bare ? "v4" : this._attrs.ipv4Mapped ? "v4-mapped" : "v6"), t) {
|
|
1286
|
+
case "v4":
|
|
1287
|
+
if (!b.contains(this)) throw Error("cannot print non-v4 address in dotted quad notation");
|
|
1288
|
+
return c(this._fields.slice(6));
|
|
1289
|
+
case "v4-mapped":
|
|
1290
|
+
if (!b.contains(this)) throw Error("cannot print non-v4 address as a v4-mapped address");
|
|
1291
|
+
var a = d(this._fields.slice(0, 6), r, i);
|
|
1292
|
+
return a.push(c(this._fields.slice(6))), a.join(":");
|
|
1293
|
+
case "v6": return d(this._fields, r, i).join(":");
|
|
1294
|
+
default: throw Error("unrecognized format method \"" + t + "\"");
|
|
1295
|
+
}
|
|
1296
|
+
}, _.prototype.toBuffer = function(e) {
|
|
1297
|
+
if (e !== void 0) {
|
|
1298
|
+
if (!Buffer.isBuffer(e)) throw Error("optional arg must be Buffer");
|
|
1299
|
+
} else e = new Buffer(16);
|
|
1300
|
+
var t;
|
|
1301
|
+
for (t = 0; t < 8; t++) e.writeUInt16BE(this._fields[t], t * 2);
|
|
1302
|
+
return e;
|
|
1303
|
+
}, _.prototype.toLong = function() {
|
|
1304
|
+
if (!b.contains(this)) throw Error("only possible for ipv4-mapped addresses");
|
|
1305
|
+
return (this._fields[6] << 16 >>> 0) + this._fields[7];
|
|
1306
|
+
}, _.prototype.clone = function() {
|
|
1307
|
+
var e = new _();
|
|
1308
|
+
for (var t in e._fields = this._fields.slice(), this._attrs) e._attrs[t] = this._attrs[t];
|
|
1309
|
+
return e;
|
|
1310
|
+
}, _.prototype.offset = function(e) {
|
|
1311
|
+
if (e < -4294967295 || e > 4294967295) throw Error("offsets should be between -4294967295 and 4294967295");
|
|
1312
|
+
var t = this.clone(), n, r;
|
|
1313
|
+
for (n = 7; n >= 0 && (r = t._fields[n] + e, r > 65535 ? (e = r >>> 16, r &= 65535) : r < 0 ? (e = Math.floor(r / 65536), r = s(r, 65536)) : e = 0, t._fields[n] = r, e !== 0); n--) if (n === 0 || n === 6 && this._attrs.ipv4Mapped) return null;
|
|
1314
|
+
return t;
|
|
1315
|
+
}, _.prototype.and = function(e) {
|
|
1316
|
+
e = u(e);
|
|
1317
|
+
var t, n = this.clone();
|
|
1318
|
+
for (t = 0; t < 8; t++) n._fields[t] = n._fields[t] & e._fields[t];
|
|
1319
|
+
return n;
|
|
1320
|
+
}, _.prototype.or = function(e) {
|
|
1321
|
+
e = u(e);
|
|
1322
|
+
var t, n = this.clone();
|
|
1323
|
+
for (t = 0; t < 8; t++) n._fields[t] = n._fields[t] | e._fields[t];
|
|
1324
|
+
return n;
|
|
1325
|
+
}, _.prototype.not = function() {
|
|
1326
|
+
var e, t = this.clone();
|
|
1327
|
+
for (e = 0; e < 8; e++) t._fields[e] = ~t._fields[e] & 65535;
|
|
1328
|
+
return t;
|
|
1329
|
+
}, _.prototype.compare = function(e) {
|
|
1330
|
+
return E(this, e);
|
|
1331
|
+
};
|
|
1332
|
+
function v(e, t) {
|
|
1333
|
+
if (t === void 0) {
|
|
1334
|
+
n.string(e);
|
|
1335
|
+
var r = e.match(/^([a-fA-F0-9:.]+)\/([0-9]+)$/);
|
|
1336
|
+
if (r === null) throw Error("Invalid argument: <addr>/<prefix> expected");
|
|
1337
|
+
e = r[1], t = parseInt(r[2], 10);
|
|
1338
|
+
}
|
|
1339
|
+
if (n.number(t), t |= 0, e = u(e), e._attrs.ipv4Bare && (t += 96), t < 0 || t > 128) throw Error("Invalid prefix length");
|
|
1340
|
+
this._prefix = t, this._mask = p(t), this._addr = e.and(this._mask);
|
|
1341
|
+
}
|
|
1342
|
+
v.prototype.contains = function(e) {
|
|
1343
|
+
return e = u(e), this._addr.compare(e.and(this._mask)) === 0;
|
|
1344
|
+
}, v.prototype.first = function() {
|
|
1345
|
+
return this._prefix >= 127 ? this._addr : this._addr.offset(1);
|
|
1346
|
+
}, v.prototype.last = function() {
|
|
1347
|
+
var e = this._addr.or(this._mask.not());
|
|
1348
|
+
return this._prefix >= 127 ? e : this._addr._attrs.ipv4Mapped ? e.offset(-1) : e;
|
|
1349
|
+
}, v.prototype.broadcast = function() {
|
|
1350
|
+
if (!b.contains(this._addr)) throw Error("Only IPv4 networks have broadcast addresses");
|
|
1351
|
+
return this._addr.or(this._mask.not());
|
|
1352
|
+
}, v.prototype.compare = function(e) {
|
|
1353
|
+
return x(this, e);
|
|
1354
|
+
}, v.prototype.prefixLength = function(e) {
|
|
1355
|
+
switch (n.optionalString(e, "format"), (e === void 0 || e === "auto") && (e = this._addr._attrs.ipv4Bare ? "v4" : "v6"), e) {
|
|
1356
|
+
case "v4":
|
|
1357
|
+
if (!b.contains(this._addr)) throw Error("cannot return v4 prefix length for non-v4 address");
|
|
1358
|
+
return this._prefix - 96;
|
|
1359
|
+
case "v6": return this._prefix;
|
|
1360
|
+
default: throw Error("unrecognized format method \"" + e + "\"");
|
|
1361
|
+
}
|
|
1362
|
+
}, v.prototype.address = function() {
|
|
1363
|
+
return this._addr;
|
|
1364
|
+
}, v.prototype.toString = function(e) {
|
|
1365
|
+
n.optionalObject(e, "opts");
|
|
1366
|
+
var t = g(e, "format");
|
|
1367
|
+
return t === "v4-mapped" && (t = "v6"), this._addr.toString(e) + "/" + this.prefixLength(t);
|
|
1368
|
+
};
|
|
1369
|
+
var b = new v("::ffff:0:0", 96);
|
|
1370
|
+
function x(e, t) {
|
|
1371
|
+
e = m(e), t = m(t);
|
|
1372
|
+
var n = E(e._addr, t._addr);
|
|
1373
|
+
return n === 0 ? t._prefix - e._prefix : n;
|
|
1374
|
+
}
|
|
1375
|
+
function S(e, t) {
|
|
1376
|
+
if (e = u(e), t = u(t), e.compare(t) > 0) throw Error("begin address must be <= end address");
|
|
1377
|
+
this._begin = e, this._end = t;
|
|
1378
|
+
}
|
|
1379
|
+
S.prototype.contains = function(e) {
|
|
1380
|
+
return e = u(e), this._begin.compare(e) <= 0 && this._end.compare(e) >= 0;
|
|
1381
|
+
}, S.prototype.first = function() {
|
|
1382
|
+
return this._begin;
|
|
1383
|
+
}, S.prototype.last = function() {
|
|
1384
|
+
return this._end;
|
|
1385
|
+
};
|
|
1386
|
+
function C(e) {
|
|
1387
|
+
if (typeof e == "string") return w(e);
|
|
1388
|
+
if (typeof e == "number") return T(e);
|
|
1389
|
+
if (typeof e == "object" && l(e)) return e;
|
|
1390
|
+
throw Error("Invalid argument: only string|number allowed");
|
|
1391
|
+
}
|
|
1392
|
+
function w(e) {
|
|
1393
|
+
n.string(e), e = e.toLowerCase();
|
|
1394
|
+
var t = new _(), i = [], a = [], s = null, c = "", l, u;
|
|
1395
|
+
if (e.length > 40) throw new o(e, "Input too long");
|
|
1396
|
+
for (l = 0; l < e.length; l++) if (u = e[l], u === ":") if (l + 1 < e.length && e[l + 1] === ":") {
|
|
1397
|
+
if (s !== null) throw new o(e, "Multiple :: delimiters", l);
|
|
1398
|
+
c !== "" && (i.push(c), c = ""), s = i.length, l++;
|
|
1399
|
+
} else {
|
|
1400
|
+
if (c === "") throw new o(e, "illegal delimiter", l);
|
|
1401
|
+
i.push(c), c = "";
|
|
1402
|
+
}
|
|
1403
|
+
else u === "." ? (a.push(c), c = "") : c += u;
|
|
1404
|
+
if (c !== "") a.length === 0 ? i.push(c) : a.push(c), c = "";
|
|
1405
|
+
else if (s !== i.length || a.length > 0) throw new o(e, "Cannot end with delimiter besides ::");
|
|
1406
|
+
if (a.length === 0) {
|
|
1407
|
+
if (i.length > 8) throw new o(e, "Too many fields");
|
|
1408
|
+
if (i.length < 8 && s === null) throw new o(e, "Too few fields");
|
|
1409
|
+
} else {
|
|
1410
|
+
if (a.length !== 4) throw new o(e, "IPv4 portion must have 4 fields");
|
|
1411
|
+
if (i.length === 0 && s === null && (t._attrs.ipv4Bare = !0, i = ["ffff"], s = 0), i.length > 6) throw new o(e, "Too many fields");
|
|
1412
|
+
if (i.length < 6 && s === null) throw new o(e, "Too few fields");
|
|
1413
|
+
}
|
|
1414
|
+
var d, p;
|
|
1415
|
+
for (l = 0; l < i.length; l++) {
|
|
1416
|
+
if (d = i[l], p = r.parseInteger(d, {
|
|
1417
|
+
base: 16,
|
|
1418
|
+
allowSign: !1
|
|
1419
|
+
}), p instanceof Error || p < 0 || p > 65535) throw new o(e, "Invalid field value: " + d);
|
|
1420
|
+
i[l] = p;
|
|
1421
|
+
}
|
|
1422
|
+
for (l = 0; l < a.length; l++) {
|
|
1423
|
+
if (d = a[l], p = r.parseInteger(d, {
|
|
1424
|
+
base: 10,
|
|
1425
|
+
allowSign: !1
|
|
1426
|
+
}), p instanceof Error || p < 0 || p > 255) throw new o(e, "Invalid field value: " + d);
|
|
1427
|
+
a[l] = p;
|
|
1428
|
+
}
|
|
1429
|
+
if (a.length !== 0 && (i.push(a[0] * 256 + a[1]), i.push(a[2] * 256 + a[3])), i.length < 8 && s !== null) {
|
|
1430
|
+
var m = [];
|
|
1431
|
+
for (l = 0; l < 8 - i.length; l++) m.push(0);
|
|
1432
|
+
i = Array.prototype.concat(i.slice(0, s), m, i.slice(s));
|
|
1433
|
+
}
|
|
1434
|
+
if (a.length !== 0) if (f(i)) t._attrs.ipv4Mapped = !0;
|
|
1435
|
+
else throw new o(e, "invalid dotted-quad notation");
|
|
1436
|
+
return t._fields = i, t;
|
|
1437
|
+
}
|
|
1438
|
+
function T(e) {
|
|
1439
|
+
if (n.number(e), e !== Math.floor(e)) throw Error("Value must be integer");
|
|
1440
|
+
if (e < 0 || e > 4294967295) throw Error("Value must be 32 bit");
|
|
1441
|
+
var t = new _();
|
|
1442
|
+
return t._fields[7] = e & 65535, t._fields[6] = e >>> 16, t._fields[5] = 65535, t._attrs.ipv4Bare = !0, t._attrs.ipv4Mapped = !0, t;
|
|
1443
|
+
}
|
|
1444
|
+
function E(e, t) {
|
|
1445
|
+
e = u(e), t = u(t);
|
|
1446
|
+
var n;
|
|
1447
|
+
for (n = 0; n < 8; n++) if (e._fields[n] < t._fields[n]) return -1;
|
|
1448
|
+
else if (e._fields[n] > t._fields[n]) return 1;
|
|
1449
|
+
return 0;
|
|
1450
|
+
}
|
|
1451
|
+
t.exports = {
|
|
1452
|
+
parse: C,
|
|
1453
|
+
compare: E,
|
|
1454
|
+
createCIDR: function(e, t) {
|
|
1455
|
+
return new v(e, t);
|
|
1456
|
+
},
|
|
1457
|
+
compareCIDR: x,
|
|
1458
|
+
createAddrRange: function(e, t) {
|
|
1459
|
+
return new S(e, t);
|
|
1460
|
+
}
|
|
1461
|
+
};
|
|
1462
|
+
})), T = /* @__PURE__ */ n(((e) => {
|
|
1463
|
+
Object.defineProperty(e, "__esModule", { value: !0 }), e.default = class {
|
|
1464
|
+
constructor(e, t, n) {
|
|
1465
|
+
this.ipAddress = t, this.isAnonymous = !!e.is_anonymous, this.isAnonymousVpn = !!e.is_anonymous_vpn, this.isHostingProvider = !!e.is_hosting_provider, this.isPublicProxy = !!e.is_public_proxy, this.isResidentialProxy = !!e.is_residential_proxy, this.isTorExitNode = !!e.is_tor_exit_node, this.network = n;
|
|
1466
|
+
}
|
|
1467
|
+
};
|
|
1468
|
+
})), E = /* @__PURE__ */ n(((e) => {
|
|
1469
|
+
Object.defineProperty(e, "__esModule", { value: !0 }), e.default = class {
|
|
1470
|
+
constructor(e, t, n) {
|
|
1471
|
+
this.autonomousSystemNumber = e.autonomous_system_number, this.autonomousSystemOrganization = e.autonomous_system_organization, this.ipAddress = t, this.network = n;
|
|
1472
|
+
}
|
|
1473
|
+
};
|
|
1474
|
+
})), D = /* @__PURE__ */ n(((e) => {
|
|
1475
|
+
Object.defineProperty(e, "__esModule", { value: !0 }), e.camelcaseKeys = e.snakeToCamelCase = void 0;
|
|
1476
|
+
function t(e) {
|
|
1477
|
+
return e.replace(/_+(\w?)/g, (e, t, n) => n === 0 ? t : t.toUpperCase());
|
|
1478
|
+
}
|
|
1479
|
+
e.snakeToCamelCase = t;
|
|
1480
|
+
var n = (e) => typeof e == "object" && !!e && !Array.isArray(e) && !(e instanceof RegExp) && !(e instanceof Error) && !(e instanceof Date), r = (e) => e.map((e) => Array.isArray(e) ? r(e) : n(e) ? i(e) : e);
|
|
1481
|
+
function i(e) {
|
|
1482
|
+
if (Array.isArray(e)) return r(e);
|
|
1483
|
+
let a = {};
|
|
1484
|
+
for (let [o, s] of Object.entries(e)) Array.isArray(s) ? a[t(o)] = r(s) : n(s) ? a[t(o)] = i(s) : a[t(o)] = s;
|
|
1485
|
+
return a;
|
|
1486
|
+
}
|
|
1487
|
+
e.camelcaseKeys = i;
|
|
1488
|
+
})), O = /* @__PURE__ */ n(((e) => {
|
|
1489
|
+
Object.defineProperty(e, "__esModule", { value: !0 });
|
|
1490
|
+
var t = D();
|
|
1491
|
+
e.default = class {
|
|
1492
|
+
constructor(e, n, r) {
|
|
1493
|
+
var i, a;
|
|
1494
|
+
let o = (0, t.camelcaseKeys)(e);
|
|
1495
|
+
this.continent = o.continent || void 0, this.country = o.country || void 0, this.maxmind = o.maxmind || void 0, this.registeredCountry = this.setBooleanRegisteredCountry(o.registeredCountry) || void 0, this.representedCountry = o.representedCountry || void 0, this.traits = this.setBooleanTraits(o.traits || {}), (i = this.traits).ipAddress ?? (i.ipAddress = n), (a = this.traits).network ?? (a.network = r);
|
|
1496
|
+
}
|
|
1497
|
+
setBooleanTraits(e) {
|
|
1498
|
+
return [
|
|
1499
|
+
"isAnonymous",
|
|
1500
|
+
"isAnonymousProxy",
|
|
1501
|
+
"isAnonymousVpn",
|
|
1502
|
+
"isAnycast",
|
|
1503
|
+
"isHostingProvider",
|
|
1504
|
+
"isLegitimateProxy",
|
|
1505
|
+
"isPublicProxy",
|
|
1506
|
+
"isResidentialProxy",
|
|
1507
|
+
"isSatelliteProvider",
|
|
1508
|
+
"isTorExitNode"
|
|
1509
|
+
].forEach((t) => {
|
|
1510
|
+
e[t] = !!e[t];
|
|
1511
|
+
}), e;
|
|
1512
|
+
}
|
|
1513
|
+
setBooleanRegisteredCountry(e) {
|
|
1514
|
+
return e && (e.isInEuropeanUnion = !!e.isInEuropeanUnion), e;
|
|
1515
|
+
}
|
|
1516
|
+
};
|
|
1517
|
+
})), k = /* @__PURE__ */ n(((e) => {
|
|
1518
|
+
var t = e && e.__importDefault || function(e) {
|
|
1519
|
+
return e && e.__esModule ? e : { default: e };
|
|
1520
|
+
};
|
|
1521
|
+
Object.defineProperty(e, "__esModule", { value: !0 });
|
|
1522
|
+
var n = D(), r = t(O());
|
|
1523
|
+
e.default = class extends r.default {
|
|
1524
|
+
constructor(e, t, r) {
|
|
1525
|
+
super(e, t, r);
|
|
1526
|
+
let i = (0, n.camelcaseKeys)(e);
|
|
1527
|
+
this.city = i.city || void 0, this.location = i.location || void 0, this.postal = i.postal || void 0, this.subdivisions = i.subdivisions || void 0;
|
|
1528
|
+
}
|
|
1529
|
+
};
|
|
1530
|
+
})), A = /* @__PURE__ */ n(((e) => {
|
|
1531
|
+
Object.defineProperty(e, "__esModule", { value: !0 }), e.default = class {
|
|
1532
|
+
constructor(e, t, n) {
|
|
1533
|
+
this.connectionType = e.connection_type, this.ipAddress = t, this.network = n;
|
|
1534
|
+
}
|
|
1535
|
+
};
|
|
1536
|
+
})), te = /* @__PURE__ */ n(((e) => {
|
|
1537
|
+
Object.defineProperty(e, "__esModule", { value: !0 }), e.default = class {
|
|
1538
|
+
constructor(e, t, n) {
|
|
1539
|
+
this.domain = e.domain, this.ipAddress = t, this.network = n;
|
|
1540
|
+
}
|
|
1541
|
+
};
|
|
1542
|
+
})), ne = /* @__PURE__ */ n(((e) => {
|
|
1543
|
+
var t = e && e.__importDefault || function(e) {
|
|
1544
|
+
return e && e.__esModule ? e : { default: e };
|
|
1545
|
+
};
|
|
1546
|
+
Object.defineProperty(e, "__esModule", { value: !0 });
|
|
1547
|
+
var n = t(k());
|
|
1548
|
+
e.default = class extends n.default {
|
|
1549
|
+
constructor(e, t, n) {
|
|
1550
|
+
super(e, t, n);
|
|
1551
|
+
}
|
|
1552
|
+
};
|
|
1553
|
+
})), j = /* @__PURE__ */ n(((e) => {
|
|
1554
|
+
var t = e && e.__importDefault || function(e) {
|
|
1555
|
+
return e && e.__esModule ? e : { default: e };
|
|
1556
|
+
};
|
|
1557
|
+
Object.defineProperty(e, "__esModule", { value: !0 });
|
|
1558
|
+
var n = t(k());
|
|
1559
|
+
e.default = class extends n.default {
|
|
1560
|
+
constructor(e) {
|
|
1561
|
+
super(e);
|
|
1562
|
+
}
|
|
1563
|
+
};
|
|
1564
|
+
})), M = /* @__PURE__ */ n(((e) => {
|
|
1565
|
+
var t = e && e.__importDefault || function(e) {
|
|
1566
|
+
return e && e.__esModule ? e : { default: e };
|
|
1567
|
+
};
|
|
1568
|
+
Object.defineProperty(e, "__esModule", { value: !0 });
|
|
1569
|
+
var n = t(E());
|
|
1570
|
+
e.default = class extends n.default {
|
|
1571
|
+
constructor(e, t, n) {
|
|
1572
|
+
super(e, t, n), this.isp = e.isp, this.mobileCountryCode = e.mobile_country_code, this.mobileNetworkCode = e.mobile_network_code, this.organization = e.organization;
|
|
1573
|
+
}
|
|
1574
|
+
};
|
|
1575
|
+
})), N = /* @__PURE__ */ n(((e) => {
|
|
1576
|
+
var t = e && e.__importDefault || function(e) {
|
|
1577
|
+
return e && e.__esModule ? e : { default: e };
|
|
1578
|
+
};
|
|
1579
|
+
Object.defineProperty(e, "__esModule", { value: !0 }), e.Isp = e.Insights = e.Enterprise = e.Domain = e.Country = e.ConnectionType = e.City = e.Asn = e.AnonymousIP = void 0, e.AnonymousIP = t(T()).default, e.Asn = t(E()).default, e.City = t(k()).default, e.ConnectionType = t(A()).default, e.Country = t(O()).default, e.Domain = t(te()).default, e.Enterprise = t(ne()).default, e.Insights = t(j()).default, e.Isp = t(M()).default;
|
|
1580
|
+
})), P = /* @__PURE__ */ n(((e) => {
|
|
1581
|
+
var t = e && e.__createBinding || (Object.create ? (function(e, t, n, r) {
|
|
1582
|
+
r === void 0 && (r = n);
|
|
1583
|
+
var i = Object.getOwnPropertyDescriptor(t, n);
|
|
1584
|
+
(!i || ("get" in i ? !t.__esModule : i.writable || i.configurable)) && (i = {
|
|
1585
|
+
enumerable: !0,
|
|
1586
|
+
get: function() {
|
|
1587
|
+
return t[n];
|
|
1588
|
+
}
|
|
1589
|
+
}), Object.defineProperty(e, r, i);
|
|
1590
|
+
}) : (function(e, t, n, r) {
|
|
1591
|
+
r === void 0 && (r = n), e[r] = t[n];
|
|
1592
|
+
})), n = e && e.__setModuleDefault || (Object.create ? (function(e, t) {
|
|
1593
|
+
Object.defineProperty(e, "default", {
|
|
1594
|
+
enumerable: !0,
|
|
1595
|
+
value: t
|
|
1596
|
+
});
|
|
1597
|
+
}) : function(e, t) {
|
|
1598
|
+
e.default = t;
|
|
1599
|
+
}), r = e && e.__importStar || function(e) {
|
|
1600
|
+
if (e && e.__esModule) return e;
|
|
1601
|
+
var r = {};
|
|
1602
|
+
if (e != null) for (var i in e) i !== "default" && Object.prototype.hasOwnProperty.call(e, i) && t(r, e, i);
|
|
1603
|
+
return n(r, e), r;
|
|
1604
|
+
};
|
|
1605
|
+
Object.defineProperty(e, "__esModule", { value: !0 });
|
|
1606
|
+
var i = w(), a = _(), o = v(), s = r(N());
|
|
1607
|
+
e.default = class {
|
|
1608
|
+
constructor(e) {
|
|
1609
|
+
this.mmdbReader = e;
|
|
1610
|
+
}
|
|
1611
|
+
anonymousIP(e) {
|
|
1612
|
+
return this.modelFor(s.AnonymousIP, "GeoIP2-Anonymous-IP", e, "anonymousIP()");
|
|
1613
|
+
}
|
|
1614
|
+
city(e) {
|
|
1615
|
+
return this.modelFor(s.City, "City", e, "city()");
|
|
1616
|
+
}
|
|
1617
|
+
country(e) {
|
|
1618
|
+
return this.modelFor(s.Country, "Country", e, "country()");
|
|
1619
|
+
}
|
|
1620
|
+
asn(e) {
|
|
1621
|
+
return this.modelFor(s.Asn, "ASN", e, "asn()");
|
|
1622
|
+
}
|
|
1623
|
+
connectionType(e) {
|
|
1624
|
+
return this.modelFor(s.ConnectionType, "Connection-Type", e, "connectionType()");
|
|
1625
|
+
}
|
|
1626
|
+
domain(e) {
|
|
1627
|
+
return this.modelFor(s.Domain, "Domain", e, "domain()");
|
|
1628
|
+
}
|
|
1629
|
+
isp(e) {
|
|
1630
|
+
return this.modelFor(s.Isp, "ISP", e, "isp()");
|
|
1631
|
+
}
|
|
1632
|
+
enterprise(e) {
|
|
1633
|
+
return this.modelFor(s.Enterprise, "Enterprise", e, "enterprise()");
|
|
1634
|
+
}
|
|
1635
|
+
getRecord(e, t, n) {
|
|
1636
|
+
let r = this.mmdbReader.metadata.databaseType;
|
|
1637
|
+
if (!a.validate(t)) throw new o.ValueError(`${t} is invalid`);
|
|
1638
|
+
if (!r.includes(e)) throw new o.BadMethodCallError(`The ${n} method cannot be used with the ${r} database`);
|
|
1639
|
+
let [s, c] = this.mmdbReader.getWithPrefixLength(t);
|
|
1640
|
+
if (!s) throw new o.AddressNotFoundError(`The address ${t} is not in the database`);
|
|
1641
|
+
return [s, i.createCIDR(t, c).toString()];
|
|
1642
|
+
}
|
|
1643
|
+
modelFor(e, t, n, r) {
|
|
1644
|
+
let [i, a] = this.getRecord(t, n, r);
|
|
1645
|
+
return new e(i, n, a);
|
|
1646
|
+
}
|
|
1647
|
+
};
|
|
1648
|
+
})), F = /* @__PURE__ */ n(((e) => {
|
|
1649
|
+
var t = e && e.__importDefault || function(e) {
|
|
1650
|
+
return e && e.__esModule ? e : { default: e };
|
|
1651
|
+
};
|
|
1652
|
+
Object.defineProperty(e, "__esModule", { value: !0 });
|
|
1653
|
+
var n = _(), r = v(), i = t(P());
|
|
1654
|
+
e.default = class {
|
|
1655
|
+
static open(e, t) {
|
|
1656
|
+
return n.open(e, t).then((e) => new i.default(e));
|
|
1657
|
+
}
|
|
1658
|
+
static openBuffer(e) {
|
|
1659
|
+
let t;
|
|
1660
|
+
try {
|
|
1661
|
+
t = new n.Reader(e);
|
|
1662
|
+
} catch (e) {
|
|
1663
|
+
throw new r.InvalidDbBufferError(e);
|
|
1664
|
+
}
|
|
1665
|
+
return new i.default(t);
|
|
1666
|
+
}
|
|
1667
|
+
};
|
|
1668
|
+
})), I = /* @__PURE__ */ r({
|
|
1669
|
+
author: () => U,
|
|
1670
|
+
default: () => Q,
|
|
1671
|
+
dependencies: () => Z,
|
|
1672
|
+
description: () => z,
|
|
1673
|
+
devDependencies: () => J,
|
|
1674
|
+
files: () => K,
|
|
1675
|
+
homepage: () => V,
|
|
1676
|
+
keywords: () => G,
|
|
1677
|
+
license: () => W,
|
|
1678
|
+
main: () => B,
|
|
1679
|
+
name: () => L,
|
|
1680
|
+
publishConfig: () => Y,
|
|
1681
|
+
repository: () => H,
|
|
1682
|
+
scripts: () => X,
|
|
1683
|
+
types: () => q,
|
|
1684
|
+
version: () => R
|
|
1685
|
+
}), L, R, z, B, V, H, U, W, G, K, q, J, Y, X, Z, Q, re = e((() => {
|
|
1686
|
+
L = "@maxmind/geoip2-node", R = "5.0.0", z = "Node.js API for GeoIP2 webservice client and database reader", B = "dist/src/index.js", V = "https://github.com/maxmind/GeoIP2-node", H = {
|
|
1687
|
+
type: "git",
|
|
1688
|
+
url: "https://github.com/maxmind/GeoIP2-node.git"
|
|
1689
|
+
}, U = "MaxMind", W = "Apache-2.0", G = [
|
|
1690
|
+
"geoip",
|
|
1691
|
+
"geoip2",
|
|
1692
|
+
"geoip precision",
|
|
1693
|
+
"geoip2 precision",
|
|
1694
|
+
"geolite",
|
|
1695
|
+
"geolite2",
|
|
1696
|
+
"maxmind",
|
|
1697
|
+
"maxminddb",
|
|
1698
|
+
"mmdb"
|
|
1699
|
+
], K = ["dist"], q = "dist/src/index.d.ts", J = {
|
|
1700
|
+
"@types/ip6addr": "^0.2.3",
|
|
1701
|
+
"@types/jest": "^29.2.0",
|
|
1702
|
+
"@types/lodash.set": "^4.3.4",
|
|
1703
|
+
"@types/node": "^20.0.0",
|
|
1704
|
+
"@typescript-eslint/eslint-plugin": "^6.0.0",
|
|
1705
|
+
"@typescript-eslint/parser": "^6.0.0",
|
|
1706
|
+
eslint: "^8.4.1",
|
|
1707
|
+
"eslint-config-prettier": "^9.0.0",
|
|
1708
|
+
"eslint-plugin-prefer-arrow": "^1.2.3",
|
|
1709
|
+
"gh-pages": "^6.0.0",
|
|
1710
|
+
husky: "^8.0.1",
|
|
1711
|
+
jest: "^29.5.0",
|
|
1712
|
+
"lint-staged": "^15.0.1",
|
|
1713
|
+
lodash: "^4.17.11",
|
|
1714
|
+
nock: "^13.0.2",
|
|
1715
|
+
prettier: "^3.0.0",
|
|
1716
|
+
"ts-jest": "^29.1.0",
|
|
1717
|
+
typedoc: "^0.25.0",
|
|
1718
|
+
typescript: "^5.0.2"
|
|
1719
|
+
}, Y = { access: "public" }, X = {
|
|
1720
|
+
build: "rimraf dist && tsc",
|
|
1721
|
+
"build:docs": "rimraf docs && typedoc src/index.ts --out docs --exclude \"**/*.spec.ts\" --readme README.md && ./bin/sanitize-doc-refs.sh",
|
|
1722
|
+
"deploy:docs": "gh-pages -d docs",
|
|
1723
|
+
lint: "eslint -c .eslintrc.js --ext ts,js . --max-warnings=0",
|
|
1724
|
+
"prettier:ts": "prettier --parser typescript --single-quote true --trailing-comma es5 --write 'src/**/*.ts'",
|
|
1725
|
+
"prettier:ci": "prettier --parser typescript --single-quote true --trailing-comma es5 --list-different 'src/**/*.ts'",
|
|
1726
|
+
"prettier:json": "prettier --parser json --write '**/*.json'",
|
|
1727
|
+
setup: "husky install",
|
|
1728
|
+
test: "jest",
|
|
1729
|
+
"test:watch": "jest --watch",
|
|
1730
|
+
prepublishOnly: "npm run build && npm run test && npm run lint && npm run build:docs && npm run deploy:docs"
|
|
1731
|
+
}, Z = {
|
|
1732
|
+
ip6addr: "^0.2.5",
|
|
1733
|
+
maxmind: "^4.2.0"
|
|
1734
|
+
}, Q = {
|
|
1735
|
+
name: L,
|
|
1736
|
+
version: R,
|
|
1737
|
+
description: z,
|
|
1738
|
+
main: B,
|
|
1739
|
+
homepage: V,
|
|
1740
|
+
repository: H,
|
|
1741
|
+
author: U,
|
|
1742
|
+
license: W,
|
|
1743
|
+
private: !1,
|
|
1744
|
+
keywords: G,
|
|
1745
|
+
files: K,
|
|
1746
|
+
types: q,
|
|
1747
|
+
devDependencies: J,
|
|
1748
|
+
"lint-staged": {
|
|
1749
|
+
"*.json": ["prettier --parser json --write"],
|
|
1750
|
+
"*.ts": ["prettier --parser typescript --single-quote true --trailing-comma es5 --write", "eslint -c .eslintrc.js --ext ts,js . --fix --max-warnings=0"]
|
|
1751
|
+
},
|
|
1752
|
+
publishConfig: Y,
|
|
1753
|
+
scripts: X,
|
|
1754
|
+
dependencies: Z
|
|
1755
|
+
};
|
|
1756
|
+
})), ie = /* @__PURE__ */ n(((e) => {
|
|
1757
|
+
var n = e && e.__createBinding || (Object.create ? (function(e, t, n, r) {
|
|
1758
|
+
r === void 0 && (r = n);
|
|
1759
|
+
var i = Object.getOwnPropertyDescriptor(t, n);
|
|
1760
|
+
(!i || ("get" in i ? !t.__esModule : i.writable || i.configurable)) && (i = {
|
|
1761
|
+
enumerable: !0,
|
|
1762
|
+
get: function() {
|
|
1763
|
+
return t[n];
|
|
1764
|
+
}
|
|
1765
|
+
}), Object.defineProperty(e, r, i);
|
|
1766
|
+
}) : (function(e, t, n, r) {
|
|
1767
|
+
r === void 0 && (r = n), e[r] = t[n];
|
|
1768
|
+
})), r = e && e.__setModuleDefault || (Object.create ? (function(e, t) {
|
|
1769
|
+
Object.defineProperty(e, "default", {
|
|
1770
|
+
enumerable: !0,
|
|
1771
|
+
value: t
|
|
1772
|
+
});
|
|
1773
|
+
}) : function(e, t) {
|
|
1774
|
+
e.default = t;
|
|
1775
|
+
}), a = e && e.__importStar || function(e) {
|
|
1776
|
+
if (e && e.__esModule) return e;
|
|
1777
|
+
var t = {};
|
|
1778
|
+
if (e != null) for (var i in e) i !== "default" && Object.prototype.hasOwnProperty.call(e, i) && n(t, e, i);
|
|
1779
|
+
return r(t, e), t;
|
|
1780
|
+
};
|
|
1781
|
+
Object.defineProperty(e, "__esModule", { value: !0 });
|
|
1782
|
+
var o = i("https"), s = _(), c = (re(), t(I).default), l = a(N());
|
|
1783
|
+
e.default = class {
|
|
1784
|
+
constructor(e, t, n) {
|
|
1785
|
+
if (this.timeout = 3e3, this.host = "geoip.maxmind.com", this.accountID = e, this.licenseKey = t, n !== void 0) {
|
|
1786
|
+
if (typeof n == "object") {
|
|
1787
|
+
n.host !== void 0 && (this.host = n.host), n.timeout !== void 0 && (this.timeout = n.timeout);
|
|
1788
|
+
return;
|
|
1789
|
+
}
|
|
1790
|
+
this.timeout = n;
|
|
1791
|
+
}
|
|
1792
|
+
}
|
|
1793
|
+
city(e) {
|
|
1794
|
+
return this.responseFor("city", e, l.City);
|
|
1795
|
+
}
|
|
1796
|
+
country(e) {
|
|
1797
|
+
return this.responseFor("country", e, l.Country);
|
|
1798
|
+
}
|
|
1799
|
+
insights(e) {
|
|
1800
|
+
return this.responseFor("insights", e, l.Insights);
|
|
1801
|
+
}
|
|
1802
|
+
responseFor(e, t, n) {
|
|
1803
|
+
let r = `/geoip/v2.1/${e}/${t}`, i = `https://${this.host}${r}`;
|
|
1804
|
+
if (!s.validate(t)) return Promise.reject({
|
|
1805
|
+
code: "IP_ADDRESS_INVALID",
|
|
1806
|
+
error: "The IP address provided is invalid",
|
|
1807
|
+
url: i
|
|
1808
|
+
});
|
|
1809
|
+
let a = {
|
|
1810
|
+
auth: `${this.accountID}:${this.licenseKey}`,
|
|
1811
|
+
headers: {
|
|
1812
|
+
Accept: "application/json",
|
|
1813
|
+
"User-Agent": `GeoIP2-node/${c.version}`
|
|
1814
|
+
},
|
|
1815
|
+
host: this.host,
|
|
1816
|
+
method: "GET",
|
|
1817
|
+
path: r,
|
|
1818
|
+
timeout: this.timeout
|
|
1819
|
+
};
|
|
1820
|
+
return new Promise((e, t) => {
|
|
1821
|
+
let r = o.request(a, (r) => {
|
|
1822
|
+
let a = "";
|
|
1823
|
+
r.on("data", (e) => {
|
|
1824
|
+
a += e;
|
|
1825
|
+
}), r.on("end", () => {
|
|
1826
|
+
try {
|
|
1827
|
+
a = JSON.parse(a);
|
|
1828
|
+
} catch {
|
|
1829
|
+
return t(this.handleError({}, r, i));
|
|
1830
|
+
}
|
|
1831
|
+
return r.statusCode && r.statusCode !== 200 ? t(this.handleError(a, r, i)) : e(new n(a));
|
|
1832
|
+
});
|
|
1833
|
+
});
|
|
1834
|
+
r.on("error", (e) => t({
|
|
1835
|
+
code: e.code,
|
|
1836
|
+
error: e.message,
|
|
1837
|
+
url: i
|
|
1838
|
+
})), r.end();
|
|
1839
|
+
});
|
|
1840
|
+
}
|
|
1841
|
+
handleError(e, t, n) {
|
|
1842
|
+
return t.statusCode && t.statusCode >= 500 && t.statusCode < 600 ? {
|
|
1843
|
+
code: "SERVER_ERROR",
|
|
1844
|
+
error: `Received a server error with HTTP status code: ${t.statusCode}`,
|
|
1845
|
+
url: n
|
|
1846
|
+
} : t.statusCode && (t.statusCode < 400 || t.statusCode >= 600) ? {
|
|
1847
|
+
code: "HTTP_STATUS_CODE_ERROR",
|
|
1848
|
+
error: `Received an unexpected HTTP status code: ${t.statusCode}`,
|
|
1849
|
+
url: n
|
|
1850
|
+
} : !e.code || !e.error ? {
|
|
1851
|
+
code: "INVALID_RESPONSE_BODY",
|
|
1852
|
+
error: "Received an invalid or unparseable response body",
|
|
1853
|
+
url: n
|
|
1854
|
+
} : Object.assign(Object.assign({}, e), { url: n });
|
|
1855
|
+
}
|
|
1856
|
+
};
|
|
1857
|
+
})), $ = /* @__PURE__ */ n(((e) => {
|
|
1858
|
+
Object.defineProperty(e, "__esModule", { value: !0 });
|
|
1859
|
+
})), ae = /* @__PURE__ */ n(((e) => {
|
|
1860
|
+
var t = e && e.__createBinding || (Object.create ? (function(e, t, n, r) {
|
|
1861
|
+
r === void 0 && (r = n);
|
|
1862
|
+
var i = Object.getOwnPropertyDescriptor(t, n);
|
|
1863
|
+
(!i || ("get" in i ? !t.__esModule : i.writable || i.configurable)) && (i = {
|
|
1864
|
+
enumerable: !0,
|
|
1865
|
+
get: function() {
|
|
1866
|
+
return t[n];
|
|
1867
|
+
}
|
|
1868
|
+
}), Object.defineProperty(e, r, i);
|
|
1869
|
+
}) : (function(e, t, n, r) {
|
|
1870
|
+
r === void 0 && (r = n), e[r] = t[n];
|
|
1871
|
+
})), n = e && e.__exportStar || function(e, n) {
|
|
1872
|
+
for (var r in e) r !== "default" && !Object.prototype.hasOwnProperty.call(n, r) && t(n, e, r);
|
|
1873
|
+
}, r = e && e.__importDefault || function(e) {
|
|
1874
|
+
return e && e.__esModule ? e : { default: e };
|
|
1875
|
+
};
|
|
1876
|
+
Object.defineProperty(e, "__esModule", { value: !0 }), e.WebServiceClient = e.ReaderModel = e.Reader = void 0, e.Reader = r(F()).default, e.WebServiceClient = r(ie()).default, e.ReaderModel = r(P()).default, n($(), e), n(N(), e), n(v(), e);
|
|
1877
|
+
}));
|
|
1878
|
+
//#endregion
|
|
1879
|
+
export default ae();
|
|
1880
|
+
export {};
|