@orion-js/services 4.0.0-next.3 → 4.0.0-next.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +442 -801
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -5
- package/dist/index.d.ts +7 -5
- package/dist/index.js +452 -791
- package/dist/index.js.map +1 -1
- package/package.json +2 -3
package/dist/index.js
CHANGED
|
@@ -1,827 +1,488 @@
|
|
|
1
|
-
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
return hasOwn.call(map, key) ? map[key] : void 0;
|
|
46
|
-
} : function(map, key) {
|
|
47
|
-
return map[key];
|
|
48
|
-
}
|
|
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 __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
8
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
9
|
+
}) : x)(function(x) {
|
|
10
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
11
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
12
|
+
});
|
|
13
|
+
var __commonJS = (cb, mod) => function __require2() {
|
|
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
|
+
|
|
33
|
+
// ../../node_modules/.pnpm/object-hash@2.2.0/node_modules/object-hash/index.js
|
|
34
|
+
var require_object_hash = __commonJS({
|
|
35
|
+
"../../node_modules/.pnpm/object-hash@2.2.0/node_modules/object-hash/index.js"(exports, module) {
|
|
36
|
+
"use strict";
|
|
37
|
+
var crypto2 = __require("crypto");
|
|
38
|
+
exports = module.exports = objectHash;
|
|
39
|
+
function objectHash(object, options) {
|
|
40
|
+
options = applyDefaults(object, options);
|
|
41
|
+
return hash2(object, options);
|
|
42
|
+
}
|
|
43
|
+
exports.sha1 = function(object) {
|
|
44
|
+
return objectHash(object);
|
|
49
45
|
};
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
function
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
if (!IsUndefined(propertyKey) && !IsPropertyKey(propertyKey))
|
|
82
|
-
throw new TypeError();
|
|
83
|
-
OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, propertyKey);
|
|
84
|
-
}
|
|
85
|
-
return decorator;
|
|
86
|
-
}
|
|
87
|
-
exporter("metadata", metadata);
|
|
88
|
-
function defineMetadata(metadataKey, metadataValue, target, propertyKey) {
|
|
89
|
-
if (!IsObject(target))
|
|
90
|
-
throw new TypeError();
|
|
91
|
-
if (!IsUndefined(propertyKey))
|
|
92
|
-
propertyKey = ToPropertyKey(propertyKey);
|
|
93
|
-
return OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, propertyKey);
|
|
94
|
-
}
|
|
95
|
-
exporter("defineMetadata", defineMetadata);
|
|
96
|
-
function hasMetadata(metadataKey, target, propertyKey) {
|
|
97
|
-
if (!IsObject(target))
|
|
98
|
-
throw new TypeError();
|
|
99
|
-
if (!IsUndefined(propertyKey))
|
|
100
|
-
propertyKey = ToPropertyKey(propertyKey);
|
|
101
|
-
return OrdinaryHasMetadata(metadataKey, target, propertyKey);
|
|
102
|
-
}
|
|
103
|
-
exporter("hasMetadata", hasMetadata);
|
|
104
|
-
function hasOwnMetadata(metadataKey, target, propertyKey) {
|
|
105
|
-
if (!IsObject(target))
|
|
106
|
-
throw new TypeError();
|
|
107
|
-
if (!IsUndefined(propertyKey))
|
|
108
|
-
propertyKey = ToPropertyKey(propertyKey);
|
|
109
|
-
return OrdinaryHasOwnMetadata(metadataKey, target, propertyKey);
|
|
110
|
-
}
|
|
111
|
-
exporter("hasOwnMetadata", hasOwnMetadata);
|
|
112
|
-
function getMetadata(metadataKey, target, propertyKey) {
|
|
113
|
-
if (!IsObject(target))
|
|
114
|
-
throw new TypeError();
|
|
115
|
-
if (!IsUndefined(propertyKey))
|
|
116
|
-
propertyKey = ToPropertyKey(propertyKey);
|
|
117
|
-
return OrdinaryGetMetadata(metadataKey, target, propertyKey);
|
|
118
|
-
}
|
|
119
|
-
exporter("getMetadata", getMetadata);
|
|
120
|
-
function getOwnMetadata(metadataKey, target, propertyKey) {
|
|
121
|
-
if (!IsObject(target))
|
|
122
|
-
throw new TypeError();
|
|
123
|
-
if (!IsUndefined(propertyKey))
|
|
124
|
-
propertyKey = ToPropertyKey(propertyKey);
|
|
125
|
-
return OrdinaryGetOwnMetadata(metadataKey, target, propertyKey);
|
|
126
|
-
}
|
|
127
|
-
exporter("getOwnMetadata", getOwnMetadata);
|
|
128
|
-
function getMetadataKeys(target, propertyKey) {
|
|
129
|
-
if (!IsObject(target))
|
|
130
|
-
throw new TypeError();
|
|
131
|
-
if (!IsUndefined(propertyKey))
|
|
132
|
-
propertyKey = ToPropertyKey(propertyKey);
|
|
133
|
-
return OrdinaryMetadataKeys(target, propertyKey);
|
|
134
|
-
}
|
|
135
|
-
exporter("getMetadataKeys", getMetadataKeys);
|
|
136
|
-
function getOwnMetadataKeys(target, propertyKey) {
|
|
137
|
-
if (!IsObject(target))
|
|
138
|
-
throw new TypeError();
|
|
139
|
-
if (!IsUndefined(propertyKey))
|
|
140
|
-
propertyKey = ToPropertyKey(propertyKey);
|
|
141
|
-
return OrdinaryOwnMetadataKeys(target, propertyKey);
|
|
142
|
-
}
|
|
143
|
-
exporter("getOwnMetadataKeys", getOwnMetadataKeys);
|
|
144
|
-
function deleteMetadata(metadataKey, target, propertyKey) {
|
|
145
|
-
if (!IsObject(target))
|
|
146
|
-
throw new TypeError();
|
|
147
|
-
if (!IsUndefined(propertyKey))
|
|
148
|
-
propertyKey = ToPropertyKey(propertyKey);
|
|
149
|
-
var metadataMap = GetOrCreateMetadataMap(
|
|
150
|
-
target,
|
|
151
|
-
propertyKey,
|
|
152
|
-
/*Create*/
|
|
153
|
-
false
|
|
154
|
-
);
|
|
155
|
-
if (IsUndefined(metadataMap))
|
|
156
|
-
return false;
|
|
157
|
-
if (!metadataMap.delete(metadataKey))
|
|
158
|
-
return false;
|
|
159
|
-
if (metadataMap.size > 0)
|
|
160
|
-
return true;
|
|
161
|
-
var targetMetadata = Metadata.get(target);
|
|
162
|
-
targetMetadata.delete(propertyKey);
|
|
163
|
-
if (targetMetadata.size > 0)
|
|
164
|
-
return true;
|
|
165
|
-
Metadata.delete(target);
|
|
166
|
-
return true;
|
|
167
|
-
}
|
|
168
|
-
exporter("deleteMetadata", deleteMetadata);
|
|
169
|
-
function DecorateConstructor(decorators, target) {
|
|
170
|
-
for (var i = decorators.length - 1; i >= 0; --i) {
|
|
171
|
-
var decorator = decorators[i];
|
|
172
|
-
var decorated = decorator(target);
|
|
173
|
-
if (!IsUndefined(decorated) && !IsNull(decorated)) {
|
|
174
|
-
if (!IsConstructor(decorated))
|
|
175
|
-
throw new TypeError();
|
|
176
|
-
target = decorated;
|
|
177
|
-
}
|
|
46
|
+
exports.keys = function(object) {
|
|
47
|
+
return objectHash(object, { excludeValues: true, algorithm: "sha1", encoding: "hex" });
|
|
48
|
+
};
|
|
49
|
+
exports.MD5 = function(object) {
|
|
50
|
+
return objectHash(object, { algorithm: "md5", encoding: "hex" });
|
|
51
|
+
};
|
|
52
|
+
exports.keysMD5 = function(object) {
|
|
53
|
+
return objectHash(object, { algorithm: "md5", encoding: "hex", excludeValues: true });
|
|
54
|
+
};
|
|
55
|
+
var hashes = crypto2.getHashes ? crypto2.getHashes().slice() : ["sha1", "md5"];
|
|
56
|
+
hashes.push("passthrough");
|
|
57
|
+
var encodings = ["buffer", "hex", "binary", "base64"];
|
|
58
|
+
function applyDefaults(object, sourceOptions) {
|
|
59
|
+
sourceOptions = sourceOptions || {};
|
|
60
|
+
var options = {};
|
|
61
|
+
options.algorithm = sourceOptions.algorithm || "sha1";
|
|
62
|
+
options.encoding = sourceOptions.encoding || "hex";
|
|
63
|
+
options.excludeValues = sourceOptions.excludeValues ? true : false;
|
|
64
|
+
options.algorithm = options.algorithm.toLowerCase();
|
|
65
|
+
options.encoding = options.encoding.toLowerCase();
|
|
66
|
+
options.ignoreUnknown = sourceOptions.ignoreUnknown !== true ? false : true;
|
|
67
|
+
options.respectType = sourceOptions.respectType === false ? false : true;
|
|
68
|
+
options.respectFunctionNames = sourceOptions.respectFunctionNames === false ? false : true;
|
|
69
|
+
options.respectFunctionProperties = sourceOptions.respectFunctionProperties === false ? false : true;
|
|
70
|
+
options.unorderedArrays = sourceOptions.unorderedArrays !== true ? false : true;
|
|
71
|
+
options.unorderedSets = sourceOptions.unorderedSets === false ? false : true;
|
|
72
|
+
options.unorderedObjects = sourceOptions.unorderedObjects === false ? false : true;
|
|
73
|
+
options.replacer = sourceOptions.replacer || void 0;
|
|
74
|
+
options.excludeKeys = sourceOptions.excludeKeys || void 0;
|
|
75
|
+
if (typeof object === "undefined") {
|
|
76
|
+
throw new Error("Object argument required.");
|
|
178
77
|
}
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
for (var i = decorators.length - 1; i >= 0; --i) {
|
|
183
|
-
var decorator = decorators[i];
|
|
184
|
-
var decorated = decorator(target, propertyKey, descriptor);
|
|
185
|
-
if (!IsUndefined(decorated) && !IsNull(decorated)) {
|
|
186
|
-
if (!IsObject(decorated))
|
|
187
|
-
throw new TypeError();
|
|
188
|
-
descriptor = decorated;
|
|
78
|
+
for (var i = 0; i < hashes.length; ++i) {
|
|
79
|
+
if (hashes[i].toLowerCase() === options.algorithm.toLowerCase()) {
|
|
80
|
+
options.algorithm = hashes[i];
|
|
189
81
|
}
|
|
190
82
|
}
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
function GetOrCreateMetadataMap(O, P, Create) {
|
|
194
|
-
var targetMetadata = Metadata.get(O);
|
|
195
|
-
if (IsUndefined(targetMetadata)) {
|
|
196
|
-
if (!Create)
|
|
197
|
-
return void 0;
|
|
198
|
-
targetMetadata = new _Map();
|
|
199
|
-
Metadata.set(O, targetMetadata);
|
|
83
|
+
if (hashes.indexOf(options.algorithm) === -1) {
|
|
84
|
+
throw new Error('Algorithm "' + options.algorithm + '" not supported. supported values: ' + hashes.join(", "));
|
|
200
85
|
}
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
if (!Create)
|
|
204
|
-
return void 0;
|
|
205
|
-
metadataMap = new _Map();
|
|
206
|
-
targetMetadata.set(P, metadataMap);
|
|
86
|
+
if (encodings.indexOf(options.encoding) === -1 && options.algorithm !== "passthrough") {
|
|
87
|
+
throw new Error('Encoding "' + options.encoding + '" not supported. supported values: ' + encodings.join(", "));
|
|
207
88
|
}
|
|
208
|
-
return
|
|
209
|
-
}
|
|
210
|
-
function OrdinaryHasMetadata(MetadataKey, O, P) {
|
|
211
|
-
var hasOwn2 = OrdinaryHasOwnMetadata(MetadataKey, O, P);
|
|
212
|
-
if (hasOwn2)
|
|
213
|
-
return true;
|
|
214
|
-
var parent = OrdinaryGetPrototypeOf(O);
|
|
215
|
-
if (!IsNull(parent))
|
|
216
|
-
return OrdinaryHasMetadata(MetadataKey, parent, P);
|
|
217
|
-
return false;
|
|
89
|
+
return options;
|
|
218
90
|
}
|
|
219
|
-
function
|
|
220
|
-
|
|
221
|
-
O,
|
|
222
|
-
P,
|
|
223
|
-
/*Create*/
|
|
224
|
-
false
|
|
225
|
-
);
|
|
226
|
-
if (IsUndefined(metadataMap))
|
|
91
|
+
function isNativeFunction(f) {
|
|
92
|
+
if (typeof f !== "function") {
|
|
227
93
|
return false;
|
|
228
|
-
return ToBoolean(metadataMap.has(MetadataKey));
|
|
229
|
-
}
|
|
230
|
-
function OrdinaryGetMetadata(MetadataKey, O, P) {
|
|
231
|
-
var hasOwn2 = OrdinaryHasOwnMetadata(MetadataKey, O, P);
|
|
232
|
-
if (hasOwn2)
|
|
233
|
-
return OrdinaryGetOwnMetadata(MetadataKey, O, P);
|
|
234
|
-
var parent = OrdinaryGetPrototypeOf(O);
|
|
235
|
-
if (!IsNull(parent))
|
|
236
|
-
return OrdinaryGetMetadata(MetadataKey, parent, P);
|
|
237
|
-
return void 0;
|
|
238
|
-
}
|
|
239
|
-
function OrdinaryGetOwnMetadata(MetadataKey, O, P) {
|
|
240
|
-
var metadataMap = GetOrCreateMetadataMap(
|
|
241
|
-
O,
|
|
242
|
-
P,
|
|
243
|
-
/*Create*/
|
|
244
|
-
false
|
|
245
|
-
);
|
|
246
|
-
if (IsUndefined(metadataMap))
|
|
247
|
-
return void 0;
|
|
248
|
-
return metadataMap.get(MetadataKey);
|
|
249
|
-
}
|
|
250
|
-
function OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P) {
|
|
251
|
-
var metadataMap = GetOrCreateMetadataMap(
|
|
252
|
-
O,
|
|
253
|
-
P,
|
|
254
|
-
/*Create*/
|
|
255
|
-
true
|
|
256
|
-
);
|
|
257
|
-
metadataMap.set(MetadataKey, MetadataValue);
|
|
258
|
-
}
|
|
259
|
-
function OrdinaryMetadataKeys(O, P) {
|
|
260
|
-
var ownKeys = OrdinaryOwnMetadataKeys(O, P);
|
|
261
|
-
var parent = OrdinaryGetPrototypeOf(O);
|
|
262
|
-
if (parent === null)
|
|
263
|
-
return ownKeys;
|
|
264
|
-
var parentKeys = OrdinaryMetadataKeys(parent, P);
|
|
265
|
-
if (parentKeys.length <= 0)
|
|
266
|
-
return ownKeys;
|
|
267
|
-
if (ownKeys.length <= 0)
|
|
268
|
-
return parentKeys;
|
|
269
|
-
var set = new _Set();
|
|
270
|
-
var keys = [];
|
|
271
|
-
for (var _i = 0, ownKeys_1 = ownKeys; _i < ownKeys_1.length; _i++) {
|
|
272
|
-
var key = ownKeys_1[_i];
|
|
273
|
-
var hasKey = set.has(key);
|
|
274
|
-
if (!hasKey) {
|
|
275
|
-
set.add(key);
|
|
276
|
-
keys.push(key);
|
|
277
|
-
}
|
|
278
94
|
}
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
var hasKey = set.has(key);
|
|
282
|
-
if (!hasKey) {
|
|
283
|
-
set.add(key);
|
|
284
|
-
keys.push(key);
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
return keys;
|
|
95
|
+
var exp = /^function\s+\w*\s*\(\s*\)\s*{\s+\[native code\]\s+}$/i;
|
|
96
|
+
return exp.exec(Function.prototype.toString.call(f)) != null;
|
|
288
97
|
}
|
|
289
|
-
function
|
|
290
|
-
var
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
false
|
|
296
|
-
);
|
|
297
|
-
if (IsUndefined(metadataMap))
|
|
298
|
-
return keys;
|
|
299
|
-
var keysObj = metadataMap.keys();
|
|
300
|
-
var iterator = GetIterator(keysObj);
|
|
301
|
-
var k = 0;
|
|
302
|
-
while (true) {
|
|
303
|
-
var next = IteratorStep(iterator);
|
|
304
|
-
if (!next) {
|
|
305
|
-
keys.length = k;
|
|
306
|
-
return keys;
|
|
307
|
-
}
|
|
308
|
-
var nextValue = IteratorValue(next);
|
|
309
|
-
try {
|
|
310
|
-
keys[k] = nextValue;
|
|
311
|
-
} catch (e) {
|
|
312
|
-
try {
|
|
313
|
-
IteratorClose(iterator);
|
|
314
|
-
} finally {
|
|
315
|
-
throw e;
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
k++;
|
|
98
|
+
function hash2(object, options) {
|
|
99
|
+
var hashingStream;
|
|
100
|
+
if (options.algorithm !== "passthrough") {
|
|
101
|
+
hashingStream = crypto2.createHash(options.algorithm);
|
|
102
|
+
} else {
|
|
103
|
+
hashingStream = new PassThrough();
|
|
319
104
|
}
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
return 1;
|
|
324
|
-
switch (typeof x) {
|
|
325
|
-
case "undefined":
|
|
326
|
-
return 0;
|
|
327
|
-
case "boolean":
|
|
328
|
-
return 2;
|
|
329
|
-
case "string":
|
|
330
|
-
return 3;
|
|
331
|
-
case "symbol":
|
|
332
|
-
return 4;
|
|
333
|
-
case "number":
|
|
334
|
-
return 5;
|
|
335
|
-
case "object":
|
|
336
|
-
return x === null ? 1 : 6;
|
|
337
|
-
default:
|
|
338
|
-
return 6;
|
|
105
|
+
if (typeof hashingStream.write === "undefined") {
|
|
106
|
+
hashingStream.write = hashingStream.update;
|
|
107
|
+
hashingStream.end = hashingStream.update;
|
|
339
108
|
}
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
function IsNull(x) {
|
|
345
|
-
return x === null;
|
|
346
|
-
}
|
|
347
|
-
function IsSymbol(x) {
|
|
348
|
-
return typeof x === "symbol";
|
|
349
|
-
}
|
|
350
|
-
function IsObject(x) {
|
|
351
|
-
return typeof x === "object" ? x !== null : typeof x === "function";
|
|
352
|
-
}
|
|
353
|
-
function ToPrimitive(input, PreferredType) {
|
|
354
|
-
switch (Type(input)) {
|
|
355
|
-
case 0:
|
|
356
|
-
return input;
|
|
357
|
-
case 1:
|
|
358
|
-
return input;
|
|
359
|
-
case 2:
|
|
360
|
-
return input;
|
|
361
|
-
case 3:
|
|
362
|
-
return input;
|
|
363
|
-
case 4:
|
|
364
|
-
return input;
|
|
365
|
-
case 5:
|
|
366
|
-
return input;
|
|
109
|
+
var hasher = typeHasher(options, hashingStream);
|
|
110
|
+
hasher.dispatch(object);
|
|
111
|
+
if (!hashingStream.update) {
|
|
112
|
+
hashingStream.end("");
|
|
367
113
|
}
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
if (exoticToPrim !== void 0) {
|
|
371
|
-
var result = exoticToPrim.call(input, hint);
|
|
372
|
-
if (IsObject(result))
|
|
373
|
-
throw new TypeError();
|
|
374
|
-
return result;
|
|
114
|
+
if (hashingStream.digest) {
|
|
115
|
+
return hashingStream.digest(options.encoding === "buffer" ? void 0 : options.encoding);
|
|
375
116
|
}
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
if (hint === "string") {
|
|
380
|
-
var toString_1 = O.toString;
|
|
381
|
-
if (IsCallable(toString_1)) {
|
|
382
|
-
var result = toString_1.call(O);
|
|
383
|
-
if (!IsObject(result))
|
|
384
|
-
return result;
|
|
385
|
-
}
|
|
386
|
-
var valueOf = O.valueOf;
|
|
387
|
-
if (IsCallable(valueOf)) {
|
|
388
|
-
var result = valueOf.call(O);
|
|
389
|
-
if (!IsObject(result))
|
|
390
|
-
return result;
|
|
391
|
-
}
|
|
392
|
-
} else {
|
|
393
|
-
var valueOf = O.valueOf;
|
|
394
|
-
if (IsCallable(valueOf)) {
|
|
395
|
-
var result = valueOf.call(O);
|
|
396
|
-
if (!IsObject(result))
|
|
397
|
-
return result;
|
|
398
|
-
}
|
|
399
|
-
var toString_2 = O.toString;
|
|
400
|
-
if (IsCallable(toString_2)) {
|
|
401
|
-
var result = toString_2.call(O);
|
|
402
|
-
if (!IsObject(result))
|
|
403
|
-
return result;
|
|
404
|
-
}
|
|
117
|
+
var buf = hashingStream.read();
|
|
118
|
+
if (options.encoding === "buffer") {
|
|
119
|
+
return buf;
|
|
405
120
|
}
|
|
406
|
-
|
|
407
|
-
}
|
|
408
|
-
function ToBoolean(argument) {
|
|
409
|
-
return !!argument;
|
|
410
|
-
}
|
|
411
|
-
function ToString(argument) {
|
|
412
|
-
return "" + argument;
|
|
413
|
-
}
|
|
414
|
-
function ToPropertyKey(argument) {
|
|
415
|
-
var key = ToPrimitive(
|
|
416
|
-
argument,
|
|
417
|
-
3
|
|
418
|
-
/* String */
|
|
419
|
-
);
|
|
420
|
-
if (IsSymbol(key))
|
|
421
|
-
return key;
|
|
422
|
-
return ToString(key);
|
|
121
|
+
return buf.toString(options.encoding);
|
|
423
122
|
}
|
|
424
|
-
function
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
return typeof argument === "function";
|
|
429
|
-
}
|
|
430
|
-
function IsConstructor(argument) {
|
|
431
|
-
return typeof argument === "function";
|
|
432
|
-
}
|
|
433
|
-
function IsPropertyKey(argument) {
|
|
434
|
-
switch (Type(argument)) {
|
|
435
|
-
case 3:
|
|
436
|
-
return true;
|
|
437
|
-
case 4:
|
|
438
|
-
return true;
|
|
439
|
-
default:
|
|
440
|
-
return false;
|
|
123
|
+
exports.writeToStream = function(object, options, stream) {
|
|
124
|
+
if (typeof stream === "undefined") {
|
|
125
|
+
stream = options;
|
|
126
|
+
options = {};
|
|
441
127
|
}
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
return iterator;
|
|
459
|
-
}
|
|
460
|
-
function IteratorValue(iterResult) {
|
|
461
|
-
return iterResult.value;
|
|
462
|
-
}
|
|
463
|
-
function IteratorStep(iterator) {
|
|
464
|
-
var result = iterator.next();
|
|
465
|
-
return result.done ? false : result;
|
|
466
|
-
}
|
|
467
|
-
function IteratorClose(iterator) {
|
|
468
|
-
var f = iterator["return"];
|
|
469
|
-
if (f)
|
|
470
|
-
f.call(iterator);
|
|
471
|
-
}
|
|
472
|
-
function OrdinaryGetPrototypeOf(O) {
|
|
473
|
-
var proto = Object.getPrototypeOf(O);
|
|
474
|
-
if (typeof O !== "function" || O === functionPrototype)
|
|
475
|
-
return proto;
|
|
476
|
-
if (proto !== functionPrototype)
|
|
477
|
-
return proto;
|
|
478
|
-
var prototype = O.prototype;
|
|
479
|
-
var prototypeProto = prototype && Object.getPrototypeOf(prototype);
|
|
480
|
-
if (prototypeProto == null || prototypeProto === Object.prototype)
|
|
481
|
-
return proto;
|
|
482
|
-
var constructor = prototypeProto.constructor;
|
|
483
|
-
if (typeof constructor !== "function")
|
|
484
|
-
return proto;
|
|
485
|
-
if (constructor === O)
|
|
486
|
-
return proto;
|
|
487
|
-
return constructor;
|
|
488
|
-
}
|
|
489
|
-
function CreateMapPolyfill() {
|
|
490
|
-
var cacheSentinel = {};
|
|
491
|
-
var arraySentinel = [];
|
|
492
|
-
var MapIterator = (
|
|
493
|
-
/** @class */
|
|
494
|
-
function() {
|
|
495
|
-
function MapIterator2(keys, values, selector) {
|
|
496
|
-
this._index = 0;
|
|
497
|
-
this._keys = keys;
|
|
498
|
-
this._values = values;
|
|
499
|
-
this._selector = selector;
|
|
128
|
+
options = applyDefaults(object, options);
|
|
129
|
+
return typeHasher(options, stream).dispatch(object);
|
|
130
|
+
};
|
|
131
|
+
function typeHasher(options, writeTo, context) {
|
|
132
|
+
context = context || [];
|
|
133
|
+
var write = function(str) {
|
|
134
|
+
if (writeTo.update) {
|
|
135
|
+
return writeTo.update(str, "utf8");
|
|
136
|
+
} else {
|
|
137
|
+
return writeTo.write(str, "utf8");
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
return {
|
|
141
|
+
dispatch: function(value) {
|
|
142
|
+
if (options.replacer) {
|
|
143
|
+
value = options.replacer(value);
|
|
500
144
|
}
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
MapIterator2.prototype[iteratorSymbol] = function() {
|
|
505
|
-
return this;
|
|
506
|
-
};
|
|
507
|
-
MapIterator2.prototype.next = function() {
|
|
508
|
-
var index = this._index;
|
|
509
|
-
if (index >= 0 && index < this._keys.length) {
|
|
510
|
-
var result = this._selector(this._keys[index], this._values[index]);
|
|
511
|
-
if (index + 1 >= this._keys.length) {
|
|
512
|
-
this._index = -1;
|
|
513
|
-
this._keys = arraySentinel;
|
|
514
|
-
this._values = arraySentinel;
|
|
515
|
-
} else {
|
|
516
|
-
this._index++;
|
|
517
|
-
}
|
|
518
|
-
return { value: result, done: false };
|
|
519
|
-
}
|
|
520
|
-
return { value: void 0, done: true };
|
|
521
|
-
};
|
|
522
|
-
MapIterator2.prototype.throw = function(error) {
|
|
523
|
-
if (this._index >= 0) {
|
|
524
|
-
this._index = -1;
|
|
525
|
-
this._keys = arraySentinel;
|
|
526
|
-
this._values = arraySentinel;
|
|
527
|
-
}
|
|
528
|
-
throw error;
|
|
529
|
-
};
|
|
530
|
-
MapIterator2.prototype.return = function(value) {
|
|
531
|
-
if (this._index >= 0) {
|
|
532
|
-
this._index = -1;
|
|
533
|
-
this._keys = arraySentinel;
|
|
534
|
-
this._values = arraySentinel;
|
|
535
|
-
}
|
|
536
|
-
return { value, done: true };
|
|
537
|
-
};
|
|
538
|
-
return MapIterator2;
|
|
539
|
-
}()
|
|
540
|
-
);
|
|
541
|
-
return (
|
|
542
|
-
/** @class */
|
|
543
|
-
function() {
|
|
544
|
-
function Map2() {
|
|
545
|
-
this._keys = [];
|
|
546
|
-
this._values = [];
|
|
547
|
-
this._cacheKey = cacheSentinel;
|
|
548
|
-
this._cacheIndex = -2;
|
|
145
|
+
var type = typeof value;
|
|
146
|
+
if (value === null) {
|
|
147
|
+
type = "null";
|
|
549
148
|
}
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
);
|
|
570
|
-
return
|
|
571
|
-
}
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
return this;
|
|
580
|
-
};
|
|
581
|
-
Map2.prototype.delete = function(key) {
|
|
582
|
-
var index = this._find(
|
|
583
|
-
key,
|
|
584
|
-
/*insert*/
|
|
585
|
-
false
|
|
586
|
-
);
|
|
587
|
-
if (index >= 0) {
|
|
588
|
-
var size = this._keys.length;
|
|
589
|
-
for (var i = index + 1; i < size; i++) {
|
|
590
|
-
this._keys[i - 1] = this._keys[i];
|
|
591
|
-
this._values[i - 1] = this._values[i];
|
|
592
|
-
}
|
|
593
|
-
this._keys.length--;
|
|
594
|
-
this._values.length--;
|
|
595
|
-
if (key === this._cacheKey) {
|
|
596
|
-
this._cacheKey = cacheSentinel;
|
|
597
|
-
this._cacheIndex = -2;
|
|
598
|
-
}
|
|
599
|
-
return true;
|
|
149
|
+
return this["_" + type](value);
|
|
150
|
+
},
|
|
151
|
+
_object: function(object) {
|
|
152
|
+
var pattern = /\[object (.*)\]/i;
|
|
153
|
+
var objString = Object.prototype.toString.call(object);
|
|
154
|
+
var objType = pattern.exec(objString);
|
|
155
|
+
if (!objType) {
|
|
156
|
+
objType = "unknown:[" + objString + "]";
|
|
157
|
+
} else {
|
|
158
|
+
objType = objType[1];
|
|
159
|
+
}
|
|
160
|
+
objType = objType.toLowerCase();
|
|
161
|
+
var objectNumber = null;
|
|
162
|
+
if ((objectNumber = context.indexOf(object)) >= 0) {
|
|
163
|
+
return this.dispatch("[CIRCULAR:" + objectNumber + "]");
|
|
164
|
+
} else {
|
|
165
|
+
context.push(object);
|
|
166
|
+
}
|
|
167
|
+
if (typeof Buffer !== "undefined" && Buffer.isBuffer && Buffer.isBuffer(object)) {
|
|
168
|
+
write("buffer:");
|
|
169
|
+
return write(object);
|
|
170
|
+
}
|
|
171
|
+
if (objType !== "object" && objType !== "function" && objType !== "asyncfunction") {
|
|
172
|
+
if (this["_" + objType]) {
|
|
173
|
+
this["_" + objType](object);
|
|
174
|
+
} else if (options.ignoreUnknown) {
|
|
175
|
+
return write("[" + objType + "]");
|
|
176
|
+
} else {
|
|
177
|
+
throw new Error('Unknown object type "' + objType + '"');
|
|
600
178
|
}
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
this._values.length = 0;
|
|
606
|
-
this._cacheKey = cacheSentinel;
|
|
607
|
-
this._cacheIndex = -2;
|
|
608
|
-
};
|
|
609
|
-
Map2.prototype.keys = function() {
|
|
610
|
-
return new MapIterator(this._keys, this._values, getKey);
|
|
611
|
-
};
|
|
612
|
-
Map2.prototype.values = function() {
|
|
613
|
-
return new MapIterator(this._keys, this._values, getValue);
|
|
614
|
-
};
|
|
615
|
-
Map2.prototype.entries = function() {
|
|
616
|
-
return new MapIterator(this._keys, this._values, getEntry);
|
|
617
|
-
};
|
|
618
|
-
Map2.prototype["@@iterator"] = function() {
|
|
619
|
-
return this.entries();
|
|
620
|
-
};
|
|
621
|
-
Map2.prototype[iteratorSymbol] = function() {
|
|
622
|
-
return this.entries();
|
|
623
|
-
};
|
|
624
|
-
Map2.prototype._find = function(key, insert) {
|
|
625
|
-
if (this._cacheKey !== key) {
|
|
626
|
-
this._cacheIndex = this._keys.indexOf(this._cacheKey = key);
|
|
179
|
+
} else {
|
|
180
|
+
var keys = Object.keys(object);
|
|
181
|
+
if (options.unorderedObjects) {
|
|
182
|
+
keys = keys.sort();
|
|
627
183
|
}
|
|
628
|
-
if (
|
|
629
|
-
|
|
630
|
-
this._keys.push(key);
|
|
631
|
-
this._values.push(void 0);
|
|
184
|
+
if (options.respectType !== false && !isNativeFunction(object)) {
|
|
185
|
+
keys.splice(0, 0, "prototype", "__proto__", "constructor");
|
|
632
186
|
}
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
187
|
+
if (options.excludeKeys) {
|
|
188
|
+
keys = keys.filter(function(key) {
|
|
189
|
+
return !options.excludeKeys(key);
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
write("object:" + keys.length + ":");
|
|
193
|
+
var self = this;
|
|
194
|
+
return keys.forEach(function(key) {
|
|
195
|
+
self.dispatch(key);
|
|
196
|
+
write(":");
|
|
197
|
+
if (!options.excludeValues) {
|
|
198
|
+
self.dispatch(object[key]);
|
|
199
|
+
}
|
|
200
|
+
write(",");
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
},
|
|
204
|
+
_array: function(arr, unordered) {
|
|
205
|
+
unordered = typeof unordered !== "undefined" ? unordered : options.unorderedArrays !== false;
|
|
206
|
+
var self = this;
|
|
207
|
+
write("array:" + arr.length + ":");
|
|
208
|
+
if (!unordered || arr.length <= 1) {
|
|
209
|
+
return arr.forEach(function(entry) {
|
|
210
|
+
return self.dispatch(entry);
|
|
211
|
+
});
|
|
654
212
|
}
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
213
|
+
var contextAdditions = [];
|
|
214
|
+
var entries = arr.map(function(entry) {
|
|
215
|
+
var strm = new PassThrough();
|
|
216
|
+
var localContext = context.slice();
|
|
217
|
+
var hasher = typeHasher(options, strm, localContext);
|
|
218
|
+
hasher.dispatch(entry);
|
|
219
|
+
contextAdditions = contextAdditions.concat(localContext.slice(context.length));
|
|
220
|
+
return strm.read().toString();
|
|
661
221
|
});
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
};
|
|
689
|
-
return Set2;
|
|
690
|
-
}()
|
|
691
|
-
);
|
|
692
|
-
}
|
|
693
|
-
function CreateWeakMapPolyfill() {
|
|
694
|
-
var UUID_SIZE = 16;
|
|
695
|
-
var keys = HashMap.create();
|
|
696
|
-
var rootKey = CreateUniqueKey();
|
|
697
|
-
return (
|
|
698
|
-
/** @class */
|
|
699
|
-
function() {
|
|
700
|
-
function WeakMap2() {
|
|
701
|
-
this._key = CreateUniqueKey();
|
|
222
|
+
context = context.concat(contextAdditions);
|
|
223
|
+
entries.sort();
|
|
224
|
+
return this._array(entries, false);
|
|
225
|
+
},
|
|
226
|
+
_date: function(date) {
|
|
227
|
+
return write("date:" + date.toJSON());
|
|
228
|
+
},
|
|
229
|
+
_symbol: function(sym) {
|
|
230
|
+
return write("symbol:" + sym.toString());
|
|
231
|
+
},
|
|
232
|
+
_error: function(err) {
|
|
233
|
+
return write("error:" + err.toString());
|
|
234
|
+
},
|
|
235
|
+
_boolean: function(bool) {
|
|
236
|
+
return write("bool:" + bool.toString());
|
|
237
|
+
},
|
|
238
|
+
_string: function(string) {
|
|
239
|
+
write("string:" + string.length + ":");
|
|
240
|
+
write(string.toString());
|
|
241
|
+
},
|
|
242
|
+
_function: function(fn) {
|
|
243
|
+
write("fn:");
|
|
244
|
+
if (isNativeFunction(fn)) {
|
|
245
|
+
this.dispatch("[native]");
|
|
246
|
+
} else {
|
|
247
|
+
this.dispatch(fn.toString());
|
|
702
248
|
}
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
return
|
|
740
|
-
}
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
249
|
+
if (options.respectFunctionNames !== false) {
|
|
250
|
+
this.dispatch("function-name:" + String(fn.name));
|
|
251
|
+
}
|
|
252
|
+
if (options.respectFunctionProperties) {
|
|
253
|
+
this._object(fn);
|
|
254
|
+
}
|
|
255
|
+
},
|
|
256
|
+
_number: function(number) {
|
|
257
|
+
return write("number:" + number.toString());
|
|
258
|
+
},
|
|
259
|
+
_xml: function(xml) {
|
|
260
|
+
return write("xml:" + xml.toString());
|
|
261
|
+
},
|
|
262
|
+
_null: function() {
|
|
263
|
+
return write("Null");
|
|
264
|
+
},
|
|
265
|
+
_undefined: function() {
|
|
266
|
+
return write("Undefined");
|
|
267
|
+
},
|
|
268
|
+
_regexp: function(regex) {
|
|
269
|
+
return write("regex:" + regex.toString());
|
|
270
|
+
},
|
|
271
|
+
_uint8array: function(arr) {
|
|
272
|
+
write("uint8array:");
|
|
273
|
+
return this.dispatch(Array.prototype.slice.call(arr));
|
|
274
|
+
},
|
|
275
|
+
_uint8clampedarray: function(arr) {
|
|
276
|
+
write("uint8clampedarray:");
|
|
277
|
+
return this.dispatch(Array.prototype.slice.call(arr));
|
|
278
|
+
},
|
|
279
|
+
_int8array: function(arr) {
|
|
280
|
+
write("uint8array:");
|
|
281
|
+
return this.dispatch(Array.prototype.slice.call(arr));
|
|
282
|
+
},
|
|
283
|
+
_uint16array: function(arr) {
|
|
284
|
+
write("uint16array:");
|
|
285
|
+
return this.dispatch(Array.prototype.slice.call(arr));
|
|
286
|
+
},
|
|
287
|
+
_int16array: function(arr) {
|
|
288
|
+
write("uint16array:");
|
|
289
|
+
return this.dispatch(Array.prototype.slice.call(arr));
|
|
290
|
+
},
|
|
291
|
+
_uint32array: function(arr) {
|
|
292
|
+
write("uint32array:");
|
|
293
|
+
return this.dispatch(Array.prototype.slice.call(arr));
|
|
294
|
+
},
|
|
295
|
+
_int32array: function(arr) {
|
|
296
|
+
write("uint32array:");
|
|
297
|
+
return this.dispatch(Array.prototype.slice.call(arr));
|
|
298
|
+
},
|
|
299
|
+
_float32array: function(arr) {
|
|
300
|
+
write("float32array:");
|
|
301
|
+
return this.dispatch(Array.prototype.slice.call(arr));
|
|
302
|
+
},
|
|
303
|
+
_float64array: function(arr) {
|
|
304
|
+
write("float64array:");
|
|
305
|
+
return this.dispatch(Array.prototype.slice.call(arr));
|
|
306
|
+
},
|
|
307
|
+
_arraybuffer: function(arr) {
|
|
308
|
+
write("arraybuffer:");
|
|
309
|
+
return this.dispatch(new Uint8Array(arr));
|
|
310
|
+
},
|
|
311
|
+
_url: function(url) {
|
|
312
|
+
return write("url:" + url.toString(), "utf8");
|
|
313
|
+
},
|
|
314
|
+
_map: function(map) {
|
|
315
|
+
write("map:");
|
|
316
|
+
var arr = Array.from(map);
|
|
317
|
+
return this._array(arr, options.unorderedSets !== false);
|
|
318
|
+
},
|
|
319
|
+
_set: function(set) {
|
|
320
|
+
write("set:");
|
|
321
|
+
var arr = Array.from(set);
|
|
322
|
+
return this._array(arr, options.unorderedSets !== false);
|
|
323
|
+
},
|
|
324
|
+
_file: function(file) {
|
|
325
|
+
write("file:");
|
|
326
|
+
return this.dispatch([file.name, file.size, file.type, file.lastModfied]);
|
|
327
|
+
},
|
|
328
|
+
_blob: function() {
|
|
329
|
+
if (options.ignoreUnknown) {
|
|
330
|
+
return write("[blob]");
|
|
331
|
+
}
|
|
332
|
+
throw Error('Hashing Blob objects is currently not supported\n(see https://github.com/puleos/object-hash/issues/26)\nUse "options.replacer" or "options.ignoreUnknown"\n');
|
|
333
|
+
},
|
|
334
|
+
_domwindow: function() {
|
|
335
|
+
return write("domwindow");
|
|
336
|
+
},
|
|
337
|
+
_bigint: function(number) {
|
|
338
|
+
return write("bigint:" + number.toString());
|
|
339
|
+
},
|
|
340
|
+
/* Node.js standard native objects */
|
|
341
|
+
_process: function() {
|
|
342
|
+
return write("process");
|
|
343
|
+
},
|
|
344
|
+
_timer: function() {
|
|
345
|
+
return write("timer");
|
|
346
|
+
},
|
|
347
|
+
_pipe: function() {
|
|
348
|
+
return write("pipe");
|
|
349
|
+
},
|
|
350
|
+
_tcp: function() {
|
|
351
|
+
return write("tcp");
|
|
352
|
+
},
|
|
353
|
+
_udp: function() {
|
|
354
|
+
return write("udp");
|
|
355
|
+
},
|
|
356
|
+
_tty: function() {
|
|
357
|
+
return write("tty");
|
|
358
|
+
},
|
|
359
|
+
_statwatcher: function() {
|
|
360
|
+
return write("statwatcher");
|
|
361
|
+
},
|
|
362
|
+
_securecontext: function() {
|
|
363
|
+
return write("securecontext");
|
|
364
|
+
},
|
|
365
|
+
_connection: function() {
|
|
366
|
+
return write("connection");
|
|
367
|
+
},
|
|
368
|
+
_zlib: function() {
|
|
369
|
+
return write("zlib");
|
|
370
|
+
},
|
|
371
|
+
_context: function() {
|
|
372
|
+
return write("context");
|
|
373
|
+
},
|
|
374
|
+
_nodescript: function() {
|
|
375
|
+
return write("nodescript");
|
|
376
|
+
},
|
|
377
|
+
_httpparser: function() {
|
|
378
|
+
return write("httpparser");
|
|
379
|
+
},
|
|
380
|
+
_dataview: function() {
|
|
381
|
+
return write("dataview");
|
|
382
|
+
},
|
|
383
|
+
_signal: function() {
|
|
384
|
+
return write("signal");
|
|
385
|
+
},
|
|
386
|
+
_fsevent: function() {
|
|
387
|
+
return write("fsevent");
|
|
388
|
+
},
|
|
389
|
+
_tlswrap: function() {
|
|
390
|
+
return write("tlswrap");
|
|
785
391
|
}
|
|
786
|
-
|
|
787
|
-
}
|
|
392
|
+
};
|
|
788
393
|
}
|
|
789
|
-
function
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
394
|
+
function PassThrough() {
|
|
395
|
+
return {
|
|
396
|
+
buf: "",
|
|
397
|
+
write: function(b) {
|
|
398
|
+
this.buf += b;
|
|
399
|
+
},
|
|
400
|
+
end: function(b) {
|
|
401
|
+
this.buf += b;
|
|
402
|
+
},
|
|
403
|
+
read: function() {
|
|
404
|
+
return this.buf;
|
|
405
|
+
}
|
|
406
|
+
};
|
|
793
407
|
}
|
|
794
|
-
}
|
|
795
|
-
})
|
|
408
|
+
}
|
|
409
|
+
});
|
|
796
410
|
|
|
797
|
-
//
|
|
798
|
-
|
|
799
|
-
import
|
|
800
|
-
|
|
801
|
-
|
|
411
|
+
// ../helpers/dist/index.js
|
|
412
|
+
var import_object_hash = __toESM(require_object_hash(), 1);
|
|
413
|
+
import crypto from "crypto";
|
|
414
|
+
var UNMISTAKABLE_CHARS = "23456789ABCDEFGHJKLMNPQRSTWXYZabcdefghjkmnopqrstuvwxyz";
|
|
415
|
+
var hexString = function(digits) {
|
|
416
|
+
var numBytes = Math.ceil(digits / 2);
|
|
417
|
+
var bytes;
|
|
418
|
+
try {
|
|
419
|
+
bytes = crypto.randomBytes(numBytes);
|
|
420
|
+
} catch (e) {
|
|
421
|
+
bytes = crypto.pseudoRandomBytes(numBytes);
|
|
422
|
+
}
|
|
423
|
+
var result = bytes.toString("hex");
|
|
424
|
+
return result.substring(0, digits);
|
|
425
|
+
};
|
|
426
|
+
var fraction = function() {
|
|
427
|
+
var numerator = parseInt(hexString(8), 16);
|
|
428
|
+
return numerator * 23283064365386963e-26;
|
|
429
|
+
};
|
|
430
|
+
var choice = function(arrayOrString) {
|
|
431
|
+
var index = Math.floor(fraction() * arrayOrString.length);
|
|
432
|
+
if (typeof arrayOrString === "string") return arrayOrString.substr(index, 1);
|
|
433
|
+
else return arrayOrString[index];
|
|
434
|
+
};
|
|
435
|
+
var randomString = function(charsCount, alphabet) {
|
|
436
|
+
var digits = [];
|
|
437
|
+
for (var i = 0; i < charsCount; i++) {
|
|
438
|
+
digits[i] = choice(alphabet);
|
|
439
|
+
}
|
|
440
|
+
return digits.join("");
|
|
441
|
+
};
|
|
442
|
+
function generateId(charsCount, chars = UNMISTAKABLE_CHARS) {
|
|
443
|
+
if (!charsCount) {
|
|
444
|
+
charsCount = 17;
|
|
445
|
+
}
|
|
446
|
+
return randomString(charsCount, chars);
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
// src/di.ts
|
|
450
|
+
var instances = /* @__PURE__ */ new Map();
|
|
451
|
+
var serviceMetadata = /* @__PURE__ */ new WeakMap();
|
|
452
|
+
var injectionMetadata = /* @__PURE__ */ new WeakMap();
|
|
453
|
+
function Service() {
|
|
454
|
+
return (_target, context) => {
|
|
455
|
+
serviceMetadata.set(context, {
|
|
456
|
+
id: generateId(12),
|
|
457
|
+
name: context.name
|
|
458
|
+
});
|
|
459
|
+
};
|
|
460
|
+
}
|
|
461
|
+
function Inject(getDependency) {
|
|
462
|
+
return (_, context) => {
|
|
463
|
+
context.addInitializer(function() {
|
|
464
|
+
const metadata = injectionMetadata.get(this) || {};
|
|
465
|
+
metadata[context.name] = getDependency;
|
|
466
|
+
injectionMetadata.set(this, metadata);
|
|
467
|
+
});
|
|
468
|
+
};
|
|
469
|
+
}
|
|
470
|
+
function getInstance(token) {
|
|
471
|
+
if (!instances.has(token)) {
|
|
472
|
+
const instance = new token();
|
|
473
|
+
instances.set(token, instance);
|
|
474
|
+
const injections = injectionMetadata.get(instance);
|
|
475
|
+
if (injections) {
|
|
476
|
+
for (const [propertyKey, getDependency] of Object.entries(injections)) {
|
|
477
|
+
instance[propertyKey] = getInstance(getDependency());
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
return instances.get(token);
|
|
802
482
|
}
|
|
803
483
|
export {
|
|
804
|
-
Container2 as Container,
|
|
805
484
|
Inject,
|
|
806
485
|
Service,
|
|
807
486
|
getInstance
|
|
808
487
|
};
|
|
809
|
-
/*! Bundled license information:
|
|
810
|
-
|
|
811
|
-
reflect-metadata/Reflect.js:
|
|
812
|
-
(*! *****************************************************************************
|
|
813
|
-
Copyright (C) Microsoft. All rights reserved.
|
|
814
|
-
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
815
|
-
this file except in compliance with the License. You may obtain a copy of the
|
|
816
|
-
License at http://www.apache.org/licenses/LICENSE-2.0
|
|
817
|
-
|
|
818
|
-
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
819
|
-
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
|
820
|
-
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
|
821
|
-
MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
822
|
-
|
|
823
|
-
See the Apache Version 2.0 License for specific language governing permissions
|
|
824
|
-
and limitations under the License.
|
|
825
|
-
***************************************************************************** *)
|
|
826
|
-
*/
|
|
827
488
|
//# sourceMappingURL=index.js.map
|