@orion-js/services 4.0.0-next.2 → 4.0.0-next.4
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/LICENSE +21 -0
- package/dist/index.cjs +443 -818
- 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 +451 -808
- package/dist/index.js.map +1 -1
- package/package.json +2 -3
package/dist/index.js
CHANGED
|
@@ -1,845 +1,488 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
1
2
|
var __defProp = Object.defineProperty;
|
|
2
|
-
var
|
|
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
|
+
));
|
|
3
32
|
|
|
4
|
-
// node_modules/.pnpm/
|
|
5
|
-
var
|
|
6
|
-
(
|
|
7
|
-
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
function makeExporter(target, previous) {
|
|
17
|
-
return function(key, value) {
|
|
18
|
-
if (typeof target[key] !== "function") {
|
|
19
|
-
Object.defineProperty(target, key, {
|
|
20
|
-
configurable: true,
|
|
21
|
-
writable: true,
|
|
22
|
-
value
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
if (previous) previous(key, value);
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
__name(makeExporter, "makeExporter");
|
|
29
|
-
})(function(exporter) {
|
|
30
|
-
var hasOwn = Object.prototype.hasOwnProperty;
|
|
31
|
-
var supportsSymbol = typeof Symbol === "function";
|
|
32
|
-
var toPrimitiveSymbol = supportsSymbol && typeof Symbol.toPrimitive !== "undefined" ? Symbol.toPrimitive : "@@toPrimitive";
|
|
33
|
-
var iteratorSymbol = supportsSymbol && typeof Symbol.iterator !== "undefined" ? Symbol.iterator : "@@iterator";
|
|
34
|
-
var supportsCreate = typeof Object.create === "function";
|
|
35
|
-
var supportsProto = {
|
|
36
|
-
__proto__: []
|
|
37
|
-
} instanceof Array;
|
|
38
|
-
var downLevel = !supportsCreate && !supportsProto;
|
|
39
|
-
var HashMap = {
|
|
40
|
-
// create an object in dictionary mode (a.k.a. "slow" mode in v8)
|
|
41
|
-
create: supportsCreate ? function() {
|
|
42
|
-
return MakeDictionary(/* @__PURE__ */ Object.create(null));
|
|
43
|
-
} : supportsProto ? function() {
|
|
44
|
-
return MakeDictionary({
|
|
45
|
-
__proto__: null
|
|
46
|
-
});
|
|
47
|
-
} : function() {
|
|
48
|
-
return MakeDictionary({});
|
|
49
|
-
},
|
|
50
|
-
has: downLevel ? function(map, key) {
|
|
51
|
-
return hasOwn.call(map, key);
|
|
52
|
-
} : function(map, key) {
|
|
53
|
-
return key in map;
|
|
54
|
-
},
|
|
55
|
-
get: downLevel ? function(map, key) {
|
|
56
|
-
return hasOwn.call(map, key) ? map[key] : void 0;
|
|
57
|
-
} : function(map, key) {
|
|
58
|
-
return map[key];
|
|
59
|
-
}
|
|
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);
|
|
60
45
|
};
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
function
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
__name(metadata, "metadata");
|
|
93
|
-
exporter("metadata", metadata);
|
|
94
|
-
function defineMetadata(metadataKey, metadataValue, target, propertyKey) {
|
|
95
|
-
if (!IsObject(target)) throw new TypeError();
|
|
96
|
-
if (!IsUndefined(propertyKey)) propertyKey = ToPropertyKey(propertyKey);
|
|
97
|
-
return OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, propertyKey);
|
|
98
|
-
}
|
|
99
|
-
__name(defineMetadata, "defineMetadata");
|
|
100
|
-
exporter("defineMetadata", defineMetadata);
|
|
101
|
-
function hasMetadata(metadataKey, target, propertyKey) {
|
|
102
|
-
if (!IsObject(target)) throw new TypeError();
|
|
103
|
-
if (!IsUndefined(propertyKey)) propertyKey = ToPropertyKey(propertyKey);
|
|
104
|
-
return OrdinaryHasMetadata(metadataKey, target, propertyKey);
|
|
105
|
-
}
|
|
106
|
-
__name(hasMetadata, "hasMetadata");
|
|
107
|
-
exporter("hasMetadata", hasMetadata);
|
|
108
|
-
function hasOwnMetadata(metadataKey, target, propertyKey) {
|
|
109
|
-
if (!IsObject(target)) throw new TypeError();
|
|
110
|
-
if (!IsUndefined(propertyKey)) propertyKey = ToPropertyKey(propertyKey);
|
|
111
|
-
return OrdinaryHasOwnMetadata(metadataKey, target, propertyKey);
|
|
112
|
-
}
|
|
113
|
-
__name(hasOwnMetadata, "hasOwnMetadata");
|
|
114
|
-
exporter("hasOwnMetadata", hasOwnMetadata);
|
|
115
|
-
function getMetadata(metadataKey, target, propertyKey) {
|
|
116
|
-
if (!IsObject(target)) throw new TypeError();
|
|
117
|
-
if (!IsUndefined(propertyKey)) propertyKey = ToPropertyKey(propertyKey);
|
|
118
|
-
return OrdinaryGetMetadata(metadataKey, target, propertyKey);
|
|
119
|
-
}
|
|
120
|
-
__name(getMetadata, "getMetadata");
|
|
121
|
-
exporter("getMetadata", getMetadata);
|
|
122
|
-
function getOwnMetadata(metadataKey, target, propertyKey) {
|
|
123
|
-
if (!IsObject(target)) throw new TypeError();
|
|
124
|
-
if (!IsUndefined(propertyKey)) propertyKey = ToPropertyKey(propertyKey);
|
|
125
|
-
return OrdinaryGetOwnMetadata(metadataKey, target, propertyKey);
|
|
126
|
-
}
|
|
127
|
-
__name(getOwnMetadata, "getOwnMetadata");
|
|
128
|
-
exporter("getOwnMetadata", getOwnMetadata);
|
|
129
|
-
function getMetadataKeys(target, propertyKey) {
|
|
130
|
-
if (!IsObject(target)) throw new TypeError();
|
|
131
|
-
if (!IsUndefined(propertyKey)) propertyKey = ToPropertyKey(propertyKey);
|
|
132
|
-
return OrdinaryMetadataKeys(target, propertyKey);
|
|
133
|
-
}
|
|
134
|
-
__name(getMetadataKeys, "getMetadataKeys");
|
|
135
|
-
exporter("getMetadataKeys", getMetadataKeys);
|
|
136
|
-
function getOwnMetadataKeys(target, propertyKey) {
|
|
137
|
-
if (!IsObject(target)) throw new TypeError();
|
|
138
|
-
if (!IsUndefined(propertyKey)) propertyKey = ToPropertyKey(propertyKey);
|
|
139
|
-
return OrdinaryOwnMetadataKeys(target, propertyKey);
|
|
140
|
-
}
|
|
141
|
-
__name(getOwnMetadataKeys, "getOwnMetadataKeys");
|
|
142
|
-
exporter("getOwnMetadataKeys", getOwnMetadataKeys);
|
|
143
|
-
function deleteMetadata(metadataKey, target, propertyKey) {
|
|
144
|
-
if (!IsObject(target)) throw new TypeError();
|
|
145
|
-
if (!IsUndefined(propertyKey)) propertyKey = ToPropertyKey(propertyKey);
|
|
146
|
-
var metadataMap = GetOrCreateMetadataMap(
|
|
147
|
-
target,
|
|
148
|
-
propertyKey,
|
|
149
|
-
/*Create*/
|
|
150
|
-
false
|
|
151
|
-
);
|
|
152
|
-
if (IsUndefined(metadataMap)) return false;
|
|
153
|
-
if (!metadataMap.delete(metadataKey)) return false;
|
|
154
|
-
if (metadataMap.size > 0) return true;
|
|
155
|
-
var targetMetadata = Metadata.get(target);
|
|
156
|
-
targetMetadata.delete(propertyKey);
|
|
157
|
-
if (targetMetadata.size > 0) return true;
|
|
158
|
-
Metadata.delete(target);
|
|
159
|
-
return true;
|
|
160
|
-
}
|
|
161
|
-
__name(deleteMetadata, "deleteMetadata");
|
|
162
|
-
exporter("deleteMetadata", deleteMetadata);
|
|
163
|
-
function DecorateConstructor(decorators, target) {
|
|
164
|
-
for (var i = decorators.length - 1; i >= 0; --i) {
|
|
165
|
-
var decorator = decorators[i];
|
|
166
|
-
var decorated = decorator(target);
|
|
167
|
-
if (!IsUndefined(decorated) && !IsNull(decorated)) {
|
|
168
|
-
if (!IsConstructor(decorated)) throw new TypeError();
|
|
169
|
-
target = decorated;
|
|
170
|
-
}
|
|
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.");
|
|
171
77
|
}
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
function DecorateProperty(decorators, target, propertyKey, descriptor) {
|
|
176
|
-
for (var i = decorators.length - 1; i >= 0; --i) {
|
|
177
|
-
var decorator = decorators[i];
|
|
178
|
-
var decorated = decorator(target, propertyKey, descriptor);
|
|
179
|
-
if (!IsUndefined(decorated) && !IsNull(decorated)) {
|
|
180
|
-
if (!IsObject(decorated)) throw new TypeError();
|
|
181
|
-
descriptor = decorated;
|
|
78
|
+
for (var i = 0; i < hashes.length; ++i) {
|
|
79
|
+
if (hashes[i].toLowerCase() === options.algorithm.toLowerCase()) {
|
|
80
|
+
options.algorithm = hashes[i];
|
|
182
81
|
}
|
|
183
82
|
}
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
__name(DecorateProperty, "DecorateProperty");
|
|
187
|
-
function GetOrCreateMetadataMap(O, P, Create) {
|
|
188
|
-
var targetMetadata = Metadata.get(O);
|
|
189
|
-
if (IsUndefined(targetMetadata)) {
|
|
190
|
-
if (!Create) return void 0;
|
|
191
|
-
targetMetadata = new _Map();
|
|
192
|
-
Metadata.set(O, targetMetadata);
|
|
83
|
+
if (hashes.indexOf(options.algorithm) === -1) {
|
|
84
|
+
throw new Error('Algorithm "' + options.algorithm + '" not supported. supported values: ' + hashes.join(", "));
|
|
193
85
|
}
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
if (!Create) return void 0;
|
|
197
|
-
metadataMap = new _Map();
|
|
198
|
-
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(", "));
|
|
199
88
|
}
|
|
200
|
-
return
|
|
201
|
-
}
|
|
202
|
-
__name(GetOrCreateMetadataMap, "GetOrCreateMetadataMap");
|
|
203
|
-
function OrdinaryHasMetadata(MetadataKey, O, P) {
|
|
204
|
-
var hasOwn2 = OrdinaryHasOwnMetadata(MetadataKey, O, P);
|
|
205
|
-
if (hasOwn2) return true;
|
|
206
|
-
var parent = OrdinaryGetPrototypeOf(O);
|
|
207
|
-
if (!IsNull(parent)) return OrdinaryHasMetadata(MetadataKey, parent, P);
|
|
208
|
-
return false;
|
|
89
|
+
return options;
|
|
209
90
|
}
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
O,
|
|
214
|
-
P,
|
|
215
|
-
/*Create*/
|
|
216
|
-
false
|
|
217
|
-
);
|
|
218
|
-
if (IsUndefined(metadataMap)) return false;
|
|
219
|
-
return ToBoolean(metadataMap.has(MetadataKey));
|
|
220
|
-
}
|
|
221
|
-
__name(OrdinaryHasOwnMetadata, "OrdinaryHasOwnMetadata");
|
|
222
|
-
function OrdinaryGetMetadata(MetadataKey, O, P) {
|
|
223
|
-
var hasOwn2 = OrdinaryHasOwnMetadata(MetadataKey, O, P);
|
|
224
|
-
if (hasOwn2) return OrdinaryGetOwnMetadata(MetadataKey, O, P);
|
|
225
|
-
var parent = OrdinaryGetPrototypeOf(O);
|
|
226
|
-
if (!IsNull(parent)) return OrdinaryGetMetadata(MetadataKey, parent, P);
|
|
227
|
-
return void 0;
|
|
228
|
-
}
|
|
229
|
-
__name(OrdinaryGetMetadata, "OrdinaryGetMetadata");
|
|
230
|
-
function OrdinaryGetOwnMetadata(MetadataKey, O, P) {
|
|
231
|
-
var metadataMap = GetOrCreateMetadataMap(
|
|
232
|
-
O,
|
|
233
|
-
P,
|
|
234
|
-
/*Create*/
|
|
235
|
-
false
|
|
236
|
-
);
|
|
237
|
-
if (IsUndefined(metadataMap)) return void 0;
|
|
238
|
-
return metadataMap.get(MetadataKey);
|
|
239
|
-
}
|
|
240
|
-
__name(OrdinaryGetOwnMetadata, "OrdinaryGetOwnMetadata");
|
|
241
|
-
function OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P) {
|
|
242
|
-
var metadataMap = GetOrCreateMetadataMap(
|
|
243
|
-
O,
|
|
244
|
-
P,
|
|
245
|
-
/*Create*/
|
|
246
|
-
true
|
|
247
|
-
);
|
|
248
|
-
metadataMap.set(MetadataKey, MetadataValue);
|
|
249
|
-
}
|
|
250
|
-
__name(OrdinaryDefineOwnMetadata, "OrdinaryDefineOwnMetadata");
|
|
251
|
-
function OrdinaryMetadataKeys(O, P) {
|
|
252
|
-
var ownKeys = OrdinaryOwnMetadataKeys(O, P);
|
|
253
|
-
var parent = OrdinaryGetPrototypeOf(O);
|
|
254
|
-
if (parent === null) return ownKeys;
|
|
255
|
-
var parentKeys = OrdinaryMetadataKeys(parent, P);
|
|
256
|
-
if (parentKeys.length <= 0) return ownKeys;
|
|
257
|
-
if (ownKeys.length <= 0) return parentKeys;
|
|
258
|
-
var set = new _Set();
|
|
259
|
-
var keys = [];
|
|
260
|
-
for (var _i = 0, ownKeys_1 = ownKeys; _i < ownKeys_1.length; _i++) {
|
|
261
|
-
var key = ownKeys_1[_i];
|
|
262
|
-
var hasKey = set.has(key);
|
|
263
|
-
if (!hasKey) {
|
|
264
|
-
set.add(key);
|
|
265
|
-
keys.push(key);
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
for (var _a = 0, parentKeys_1 = parentKeys; _a < parentKeys_1.length; _a++) {
|
|
269
|
-
var key = parentKeys_1[_a];
|
|
270
|
-
var hasKey = set.has(key);
|
|
271
|
-
if (!hasKey) {
|
|
272
|
-
set.add(key);
|
|
273
|
-
keys.push(key);
|
|
274
|
-
}
|
|
91
|
+
function isNativeFunction(f) {
|
|
92
|
+
if (typeof f !== "function") {
|
|
93
|
+
return false;
|
|
275
94
|
}
|
|
276
|
-
|
|
95
|
+
var exp = /^function\s+\w*\s*\(\s*\)\s*{\s+\[native code\]\s+}$/i;
|
|
96
|
+
return exp.exec(Function.prototype.toString.call(f)) != null;
|
|
277
97
|
}
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
/*Create*/
|
|
285
|
-
false
|
|
286
|
-
);
|
|
287
|
-
if (IsUndefined(metadataMap)) return keys;
|
|
288
|
-
var keysObj = metadataMap.keys();
|
|
289
|
-
var iterator = GetIterator(keysObj);
|
|
290
|
-
var k = 0;
|
|
291
|
-
while (true) {
|
|
292
|
-
var next = IteratorStep(iterator);
|
|
293
|
-
if (!next) {
|
|
294
|
-
keys.length = k;
|
|
295
|
-
return keys;
|
|
296
|
-
}
|
|
297
|
-
var nextValue = IteratorValue(next);
|
|
298
|
-
try {
|
|
299
|
-
keys[k] = nextValue;
|
|
300
|
-
} catch (e) {
|
|
301
|
-
try {
|
|
302
|
-
IteratorClose(iterator);
|
|
303
|
-
} finally {
|
|
304
|
-
throw e;
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
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();
|
|
308
104
|
}
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
if (x === null) return 1;
|
|
313
|
-
switch (typeof x) {
|
|
314
|
-
case "undefined":
|
|
315
|
-
return 0;
|
|
316
|
-
case "boolean":
|
|
317
|
-
return 2;
|
|
318
|
-
case "string":
|
|
319
|
-
return 3;
|
|
320
|
-
case "symbol":
|
|
321
|
-
return 4;
|
|
322
|
-
case "number":
|
|
323
|
-
return 5;
|
|
324
|
-
case "object":
|
|
325
|
-
return x === null ? 1 : 6;
|
|
326
|
-
default:
|
|
327
|
-
return 6;
|
|
105
|
+
if (typeof hashingStream.write === "undefined") {
|
|
106
|
+
hashingStream.write = hashingStream.update;
|
|
107
|
+
hashingStream.end = hashingStream.update;
|
|
328
108
|
}
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
}
|
|
334
|
-
__name(IsUndefined, "IsUndefined");
|
|
335
|
-
function IsNull(x) {
|
|
336
|
-
return x === null;
|
|
337
|
-
}
|
|
338
|
-
__name(IsNull, "IsNull");
|
|
339
|
-
function IsSymbol(x) {
|
|
340
|
-
return typeof x === "symbol";
|
|
341
|
-
}
|
|
342
|
-
__name(IsSymbol, "IsSymbol");
|
|
343
|
-
function IsObject(x) {
|
|
344
|
-
return typeof x === "object" ? x !== null : typeof x === "function";
|
|
345
|
-
}
|
|
346
|
-
__name(IsObject, "IsObject");
|
|
347
|
-
function ToPrimitive(input, PreferredType) {
|
|
348
|
-
switch (Type(input)) {
|
|
349
|
-
case 0:
|
|
350
|
-
return input;
|
|
351
|
-
case 1:
|
|
352
|
-
return input;
|
|
353
|
-
case 2:
|
|
354
|
-
return input;
|
|
355
|
-
case 3:
|
|
356
|
-
return input;
|
|
357
|
-
case 4:
|
|
358
|
-
return input;
|
|
359
|
-
case 5:
|
|
360
|
-
return input;
|
|
109
|
+
var hasher = typeHasher(options, hashingStream);
|
|
110
|
+
hasher.dispatch(object);
|
|
111
|
+
if (!hashingStream.update) {
|
|
112
|
+
hashingStream.end("");
|
|
361
113
|
}
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
if (exoticToPrim !== void 0) {
|
|
365
|
-
var result = exoticToPrim.call(input, hint);
|
|
366
|
-
if (IsObject(result)) throw new TypeError();
|
|
367
|
-
return result;
|
|
114
|
+
if (hashingStream.digest) {
|
|
115
|
+
return hashingStream.digest(options.encoding === "buffer" ? void 0 : options.encoding);
|
|
368
116
|
}
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
function OrdinaryToPrimitive(O, hint) {
|
|
373
|
-
if (hint === "string") {
|
|
374
|
-
var toString_1 = O.toString;
|
|
375
|
-
if (IsCallable(toString_1)) {
|
|
376
|
-
var result = toString_1.call(O);
|
|
377
|
-
if (!IsObject(result)) return result;
|
|
378
|
-
}
|
|
379
|
-
var valueOf = O.valueOf;
|
|
380
|
-
if (IsCallable(valueOf)) {
|
|
381
|
-
var result = valueOf.call(O);
|
|
382
|
-
if (!IsObject(result)) return result;
|
|
383
|
-
}
|
|
384
|
-
} else {
|
|
385
|
-
var valueOf = O.valueOf;
|
|
386
|
-
if (IsCallable(valueOf)) {
|
|
387
|
-
var result = valueOf.call(O);
|
|
388
|
-
if (!IsObject(result)) return result;
|
|
389
|
-
}
|
|
390
|
-
var toString_2 = O.toString;
|
|
391
|
-
if (IsCallable(toString_2)) {
|
|
392
|
-
var result = toString_2.call(O);
|
|
393
|
-
if (!IsObject(result)) return result;
|
|
394
|
-
}
|
|
117
|
+
var buf = hashingStream.read();
|
|
118
|
+
if (options.encoding === "buffer") {
|
|
119
|
+
return buf;
|
|
395
120
|
}
|
|
396
|
-
|
|
397
|
-
}
|
|
398
|
-
__name(OrdinaryToPrimitive, "OrdinaryToPrimitive");
|
|
399
|
-
function ToBoolean(argument) {
|
|
400
|
-
return !!argument;
|
|
401
|
-
}
|
|
402
|
-
__name(ToBoolean, "ToBoolean");
|
|
403
|
-
function ToString(argument) {
|
|
404
|
-
return "" + argument;
|
|
405
|
-
}
|
|
406
|
-
__name(ToString, "ToString");
|
|
407
|
-
function ToPropertyKey(argument) {
|
|
408
|
-
var key = ToPrimitive(
|
|
409
|
-
argument,
|
|
410
|
-
3
|
|
411
|
-
/* String */
|
|
412
|
-
);
|
|
413
|
-
if (IsSymbol(key)) return key;
|
|
414
|
-
return ToString(key);
|
|
415
|
-
}
|
|
416
|
-
__name(ToPropertyKey, "ToPropertyKey");
|
|
417
|
-
function IsArray(argument) {
|
|
418
|
-
return Array.isArray ? Array.isArray(argument) : argument instanceof Object ? argument instanceof Array : Object.prototype.toString.call(argument) === "[object Array]";
|
|
121
|
+
return buf.toString(options.encoding);
|
|
419
122
|
}
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
__name(IsCallable, "IsCallable");
|
|
425
|
-
function IsConstructor(argument) {
|
|
426
|
-
return typeof argument === "function";
|
|
427
|
-
}
|
|
428
|
-
__name(IsConstructor, "IsConstructor");
|
|
429
|
-
function IsPropertyKey(argument) {
|
|
430
|
-
switch (Type(argument)) {
|
|
431
|
-
case 3:
|
|
432
|
-
return true;
|
|
433
|
-
case 4:
|
|
434
|
-
return true;
|
|
435
|
-
default:
|
|
436
|
-
return false;
|
|
123
|
+
exports.writeToStream = function(object, options, stream) {
|
|
124
|
+
if (typeof stream === "undefined") {
|
|
125
|
+
stream = options;
|
|
126
|
+
options = {};
|
|
437
127
|
}
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
__name(GetIterator, "GetIterator");
|
|
455
|
-
function IteratorValue(iterResult) {
|
|
456
|
-
return iterResult.value;
|
|
457
|
-
}
|
|
458
|
-
__name(IteratorValue, "IteratorValue");
|
|
459
|
-
function IteratorStep(iterator) {
|
|
460
|
-
var result = iterator.next();
|
|
461
|
-
return result.done ? false : result;
|
|
462
|
-
}
|
|
463
|
-
__name(IteratorStep, "IteratorStep");
|
|
464
|
-
function IteratorClose(iterator) {
|
|
465
|
-
var f = iterator["return"];
|
|
466
|
-
if (f) f.call(iterator);
|
|
467
|
-
}
|
|
468
|
-
__name(IteratorClose, "IteratorClose");
|
|
469
|
-
function OrdinaryGetPrototypeOf(O) {
|
|
470
|
-
var proto = Object.getPrototypeOf(O);
|
|
471
|
-
if (typeof O !== "function" || O === functionPrototype) return proto;
|
|
472
|
-
if (proto !== functionPrototype) return proto;
|
|
473
|
-
var prototype = O.prototype;
|
|
474
|
-
var prototypeProto = prototype && Object.getPrototypeOf(prototype);
|
|
475
|
-
if (prototypeProto == null || prototypeProto === Object.prototype) return proto;
|
|
476
|
-
var constructor = prototypeProto.constructor;
|
|
477
|
-
if (typeof constructor !== "function") return proto;
|
|
478
|
-
if (constructor === O) return proto;
|
|
479
|
-
return constructor;
|
|
480
|
-
}
|
|
481
|
-
__name(OrdinaryGetPrototypeOf, "OrdinaryGetPrototypeOf");
|
|
482
|
-
function CreateMapPolyfill() {
|
|
483
|
-
var cacheSentinel = {};
|
|
484
|
-
var arraySentinel = [];
|
|
485
|
-
var MapIterator = (
|
|
486
|
-
/** @class */
|
|
487
|
-
function() {
|
|
488
|
-
function MapIterator2(keys, values, selector) {
|
|
489
|
-
this._index = 0;
|
|
490
|
-
this._keys = keys;
|
|
491
|
-
this._values = values;
|
|
492
|
-
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);
|
|
493
144
|
}
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
};
|
|
498
|
-
MapIterator2.prototype[iteratorSymbol] = function() {
|
|
499
|
-
return this;
|
|
500
|
-
};
|
|
501
|
-
MapIterator2.prototype.next = function() {
|
|
502
|
-
var index = this._index;
|
|
503
|
-
if (index >= 0 && index < this._keys.length) {
|
|
504
|
-
var result = this._selector(this._keys[index], this._values[index]);
|
|
505
|
-
if (index + 1 >= this._keys.length) {
|
|
506
|
-
this._index = -1;
|
|
507
|
-
this._keys = arraySentinel;
|
|
508
|
-
this._values = arraySentinel;
|
|
509
|
-
} else {
|
|
510
|
-
this._index++;
|
|
511
|
-
}
|
|
512
|
-
return {
|
|
513
|
-
value: result,
|
|
514
|
-
done: false
|
|
515
|
-
};
|
|
516
|
-
}
|
|
517
|
-
return {
|
|
518
|
-
value: void 0,
|
|
519
|
-
done: true
|
|
520
|
-
};
|
|
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 {
|
|
537
|
-
value,
|
|
538
|
-
done: true
|
|
539
|
-
};
|
|
540
|
-
};
|
|
541
|
-
return MapIterator2;
|
|
542
|
-
}()
|
|
543
|
-
);
|
|
544
|
-
return (
|
|
545
|
-
/** @class */
|
|
546
|
-
function() {
|
|
547
|
-
function Map1() {
|
|
548
|
-
this._keys = [];
|
|
549
|
-
this._values = [];
|
|
550
|
-
this._cacheKey = cacheSentinel;
|
|
551
|
-
this._cacheIndex = -2;
|
|
145
|
+
var type = typeof value;
|
|
146
|
+
if (value === null) {
|
|
147
|
+
type = "null";
|
|
552
148
|
}
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
);
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
this._values[index] = value;
|
|
583
|
-
return this;
|
|
584
|
-
};
|
|
585
|
-
Map1.prototype.delete = function(key) {
|
|
586
|
-
var index = this._find(
|
|
587
|
-
key,
|
|
588
|
-
/*insert*/
|
|
589
|
-
false
|
|
590
|
-
);
|
|
591
|
-
if (index >= 0) {
|
|
592
|
-
var size = this._keys.length;
|
|
593
|
-
for (var i = index + 1; i < size; i++) {
|
|
594
|
-
this._keys[i - 1] = this._keys[i];
|
|
595
|
-
this._values[i - 1] = this._values[i];
|
|
596
|
-
}
|
|
597
|
-
this._keys.length--;
|
|
598
|
-
this._values.length--;
|
|
599
|
-
if (key === this._cacheKey) {
|
|
600
|
-
this._cacheKey = cacheSentinel;
|
|
601
|
-
this._cacheIndex = -2;
|
|
602
|
-
}
|
|
603
|
-
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 + '"');
|
|
604
178
|
}
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
this._values.length = 0;
|
|
610
|
-
this._cacheKey = cacheSentinel;
|
|
611
|
-
this._cacheIndex = -2;
|
|
612
|
-
};
|
|
613
|
-
Map1.prototype.keys = function() {
|
|
614
|
-
return new MapIterator(this._keys, this._values, getKey);
|
|
615
|
-
};
|
|
616
|
-
Map1.prototype.values = function() {
|
|
617
|
-
return new MapIterator(this._keys, this._values, getValue);
|
|
618
|
-
};
|
|
619
|
-
Map1.prototype.entries = function() {
|
|
620
|
-
return new MapIterator(this._keys, this._values, getEntry);
|
|
621
|
-
};
|
|
622
|
-
Map1.prototype["@@iterator"] = function() {
|
|
623
|
-
return this.entries();
|
|
624
|
-
};
|
|
625
|
-
Map1.prototype[iteratorSymbol] = function() {
|
|
626
|
-
return this.entries();
|
|
627
|
-
};
|
|
628
|
-
Map1.prototype._find = function(key, insert) {
|
|
629
|
-
if (this._cacheKey !== key) {
|
|
630
|
-
this._cacheIndex = this._keys.indexOf(this._cacheKey = key);
|
|
179
|
+
} else {
|
|
180
|
+
var keys = Object.keys(object);
|
|
181
|
+
if (options.unorderedObjects) {
|
|
182
|
+
keys = keys.sort();
|
|
631
183
|
}
|
|
632
|
-
if (
|
|
633
|
-
|
|
634
|
-
this._keys.push(key);
|
|
635
|
-
this._values.push(void 0);
|
|
184
|
+
if (options.respectType !== false && !isNativeFunction(object)) {
|
|
185
|
+
keys.splice(0, 0, "prototype", "__proto__", "constructor");
|
|
636
186
|
}
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
key,
|
|
653
|
-
value
|
|
654
|
-
];
|
|
655
|
-
}
|
|
656
|
-
__name(getEntry, "getEntry");
|
|
657
|
-
}
|
|
658
|
-
__name(CreateMapPolyfill, "CreateMapPolyfill");
|
|
659
|
-
function CreateSetPolyfill() {
|
|
660
|
-
return (
|
|
661
|
-
/** @class */
|
|
662
|
-
function() {
|
|
663
|
-
function Set1() {
|
|
664
|
-
this._map = new _Map();
|
|
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
|
+
});
|
|
665
202
|
}
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
return this._map.has(value);
|
|
676
|
-
};
|
|
677
|
-
Set1.prototype.add = function(value) {
|
|
678
|
-
return this._map.set(value, value), this;
|
|
679
|
-
};
|
|
680
|
-
Set1.prototype.delete = function(value) {
|
|
681
|
-
return this._map.delete(value);
|
|
682
|
-
};
|
|
683
|
-
Set1.prototype.clear = function() {
|
|
684
|
-
this._map.clear();
|
|
685
|
-
};
|
|
686
|
-
Set1.prototype.keys = function() {
|
|
687
|
-
return this._map.keys();
|
|
688
|
-
};
|
|
689
|
-
Set1.prototype.values = function() {
|
|
690
|
-
return this._map.values();
|
|
691
|
-
};
|
|
692
|
-
Set1.prototype.entries = function() {
|
|
693
|
-
return this._map.entries();
|
|
694
|
-
};
|
|
695
|
-
Set1.prototype["@@iterator"] = function() {
|
|
696
|
-
return this.keys();
|
|
697
|
-
};
|
|
698
|
-
Set1.prototype[iteratorSymbol] = function() {
|
|
699
|
-
return this.keys();
|
|
700
|
-
};
|
|
701
|
-
return Set1;
|
|
702
|
-
}()
|
|
703
|
-
);
|
|
704
|
-
}
|
|
705
|
-
__name(CreateSetPolyfill, "CreateSetPolyfill");
|
|
706
|
-
function CreateWeakMapPolyfill() {
|
|
707
|
-
var UUID_SIZE = 16;
|
|
708
|
-
var keys = HashMap.create();
|
|
709
|
-
var rootKey = CreateUniqueKey();
|
|
710
|
-
return (
|
|
711
|
-
/** @class */
|
|
712
|
-
function() {
|
|
713
|
-
function WeakMap1() {
|
|
714
|
-
this._key = CreateUniqueKey();
|
|
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
|
+
});
|
|
715
212
|
}
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
var
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
);
|
|
723
|
-
return
|
|
724
|
-
};
|
|
725
|
-
WeakMap1.prototype.get = function(target) {
|
|
726
|
-
var table = GetOrCreateWeakMapTable(
|
|
727
|
-
target,
|
|
728
|
-
/*create*/
|
|
729
|
-
false
|
|
730
|
-
);
|
|
731
|
-
return table !== void 0 ? HashMap.get(table, this._key) : void 0;
|
|
732
|
-
};
|
|
733
|
-
WeakMap1.prototype.set = function(target, value) {
|
|
734
|
-
var table = GetOrCreateWeakMapTable(
|
|
735
|
-
target,
|
|
736
|
-
/*create*/
|
|
737
|
-
true
|
|
738
|
-
);
|
|
739
|
-
table[this._key] = value;
|
|
740
|
-
return this;
|
|
741
|
-
};
|
|
742
|
-
WeakMap1.prototype.delete = function(target) {
|
|
743
|
-
var table = GetOrCreateWeakMapTable(
|
|
744
|
-
target,
|
|
745
|
-
/*create*/
|
|
746
|
-
false
|
|
747
|
-
);
|
|
748
|
-
return table !== void 0 ? delete table[this._key] : false;
|
|
749
|
-
};
|
|
750
|
-
WeakMap1.prototype.clear = function() {
|
|
751
|
-
this._key = CreateUniqueKey();
|
|
752
|
-
};
|
|
753
|
-
return WeakMap1;
|
|
754
|
-
}()
|
|
755
|
-
);
|
|
756
|
-
function CreateUniqueKey() {
|
|
757
|
-
var key;
|
|
758
|
-
do
|
|
759
|
-
key = "@@WeakMap@@" + CreateUUID();
|
|
760
|
-
while (HashMap.has(keys, key));
|
|
761
|
-
keys[key] = true;
|
|
762
|
-
return key;
|
|
763
|
-
}
|
|
764
|
-
__name(CreateUniqueKey, "CreateUniqueKey");
|
|
765
|
-
function GetOrCreateWeakMapTable(target, create) {
|
|
766
|
-
if (!hasOwn.call(target, rootKey)) {
|
|
767
|
-
if (!create) return void 0;
|
|
768
|
-
Object.defineProperty(target, rootKey, {
|
|
769
|
-
value: HashMap.create()
|
|
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();
|
|
770
221
|
});
|
|
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());
|
|
248
|
+
}
|
|
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");
|
|
771
391
|
}
|
|
772
|
-
|
|
773
|
-
}
|
|
774
|
-
__name(GetOrCreateWeakMapTable, "GetOrCreateWeakMapTable");
|
|
775
|
-
function FillRandomBytes(buffer, size) {
|
|
776
|
-
for (var i = 0; i < size; ++i) buffer[i] = Math.random() * 255 | 0;
|
|
777
|
-
return buffer;
|
|
778
|
-
}
|
|
779
|
-
__name(FillRandomBytes, "FillRandomBytes");
|
|
780
|
-
function GenRandomBytes(size) {
|
|
781
|
-
if (typeof Uint8Array === "function") {
|
|
782
|
-
if (typeof crypto !== "undefined") return crypto.getRandomValues(new Uint8Array(size));
|
|
783
|
-
if (typeof msCrypto !== "undefined") return msCrypto.getRandomValues(new Uint8Array(size));
|
|
784
|
-
return FillRandomBytes(new Uint8Array(size), size);
|
|
785
|
-
}
|
|
786
|
-
return FillRandomBytes(new Array(size), size);
|
|
787
|
-
}
|
|
788
|
-
__name(GenRandomBytes, "GenRandomBytes");
|
|
789
|
-
function CreateUUID() {
|
|
790
|
-
var data = GenRandomBytes(UUID_SIZE);
|
|
791
|
-
data[6] = data[6] & 79 | 64;
|
|
792
|
-
data[8] = data[8] & 191 | 128;
|
|
793
|
-
var result = "";
|
|
794
|
-
for (var offset = 0; offset < UUID_SIZE; ++offset) {
|
|
795
|
-
var byte = data[offset];
|
|
796
|
-
if (offset === 4 || offset === 6 || offset === 8) result += "-";
|
|
797
|
-
if (byte < 16) result += "0";
|
|
798
|
-
result += byte.toString(16).toLowerCase();
|
|
799
|
-
}
|
|
800
|
-
return result;
|
|
801
|
-
}
|
|
802
|
-
__name(CreateUUID, "CreateUUID");
|
|
392
|
+
};
|
|
803
393
|
}
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
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
|
+
};
|
|
809
407
|
}
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
})(Reflect2 || (Reflect2 = {}));
|
|
408
|
+
}
|
|
409
|
+
});
|
|
813
410
|
|
|
814
|
-
//
|
|
815
|
-
|
|
816
|
-
import
|
|
817
|
-
|
|
818
|
-
|
|
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);
|
|
819
482
|
}
|
|
820
|
-
__name(getInstance, "getInstance");
|
|
821
483
|
export {
|
|
822
|
-
Container2 as Container,
|
|
823
484
|
Inject,
|
|
824
485
|
Service,
|
|
825
486
|
getInstance
|
|
826
487
|
};
|
|
827
|
-
/*! Bundled license information:
|
|
828
|
-
|
|
829
|
-
reflect-metadata/Reflect.js:
|
|
830
|
-
(*! *****************************************************************************
|
|
831
|
-
Copyright (C) Microsoft. All rights reserved.
|
|
832
|
-
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
833
|
-
this file except in compliance with the License. You may obtain a copy of the
|
|
834
|
-
License at http://www.apache.org/licenses/LICENSE-2.0
|
|
835
|
-
|
|
836
|
-
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
837
|
-
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
|
838
|
-
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
|
839
|
-
MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
840
|
-
|
|
841
|
-
See the Apache Version 2.0 License for specific language governing permissions
|
|
842
|
-
and limitations under the License.
|
|
843
|
-
***************************************************************************** *)
|
|
844
|
-
*/
|
|
845
488
|
//# sourceMappingURL=index.js.map
|