@hyperfrontend/features 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/_dependencies/@hyperfrontend/builder/bundle/dependencies/index.cjs.js +1 -0
- package/_dependencies/@hyperfrontend/builder/bundle/dependencies/index.esm.js +1 -0
- package/_dependencies/@hyperfrontend/builder/bundle/dependencies/worker/index.cjs.js +1 -0
- package/_dependencies/@hyperfrontend/builder/bundle/dependencies/worker/index.esm.js +1 -0
- package/_dependencies/@hyperfrontend/builder/bundle/index.cjs.js +12 -10
- package/_dependencies/@hyperfrontend/builder/bundle/index.esm.js +14 -12
- package/_dependencies/@hyperfrontend/builder/bundle/rollup/index.cjs.js +2 -0
- package/_dependencies/@hyperfrontend/builder/bundle/rollup/index.esm.js +2 -0
- package/_dependencies/@hyperfrontend/builder/bundle/rollup/worker/index.cjs.js +2 -0
- package/_dependencies/@hyperfrontend/builder/bundle/rollup/worker/index.esm.js +2 -0
- package/_dependencies/@hyperfrontend/builder/index.cjs.js +87 -53
- package/_dependencies/@hyperfrontend/builder/index.esm.js +89 -55
- package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/promise/index.cjs.js +4 -0
- package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/promise/index.esm.js +3 -1
- package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/reflect/index.cjs.js +10 -0
- package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/reflect/index.esm.js +6 -0
- package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/timers/index.cjs.js +5 -0
- package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/timers/index.esm.js +5 -1
- package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/typed-arrays/index.cjs.js +2 -2
- package/_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/typed-arrays/index.esm.js +2 -2
- package/_dependencies/@hyperfrontend/network-protocol/browser/channel/index.cjs.js +5 -19
- package/_dependencies/@hyperfrontend/network-protocol/browser/channel/index.esm.js +1 -15
- package/_dependencies/@hyperfrontend/network-protocol/browser/data/index.cjs.js +15 -23
- package/_dependencies/@hyperfrontend/network-protocol/browser/data/index.esm.js +7 -15
- package/_dependencies/@hyperfrontend/network-protocol/browser/packet/index.cjs.js +6 -14
- package/_dependencies/@hyperfrontend/network-protocol/browser/packet/index.esm.js +7 -15
- package/_dependencies/@hyperfrontend/network-protocol/browser/receiver/index.cjs.js +4 -18
- package/_dependencies/@hyperfrontend/network-protocol/browser/receiver/index.esm.js +1 -15
- package/_dependencies/@hyperfrontend/network-protocol/browser/sender/index.cjs.js +5 -19
- package/_dependencies/@hyperfrontend/network-protocol/browser/sender/index.esm.js +2 -16
- package/_dependencies/@hyperfrontend/network-protocol/browser/v1/index.cjs.js +16 -24
- package/_dependencies/@hyperfrontend/network-protocol/browser/v1/index.esm.js +7 -15
- package/_dependencies/@hyperfrontend/network-protocol/browser/v2/index.cjs.js +16 -24
- package/_dependencies/@hyperfrontend/network-protocol/browser/v2/index.esm.js +7 -15
- package/_dependencies/@hyperfrontend/network-protocol/node/channel/index.cjs.js +3 -17
- package/_dependencies/@hyperfrontend/network-protocol/node/channel/index.esm.js +1 -15
- package/_dependencies/@hyperfrontend/network-protocol/node/data/index.cjs.js +6 -14
- package/_dependencies/@hyperfrontend/network-protocol/node/data/index.esm.js +7 -15
- package/_dependencies/@hyperfrontend/network-protocol/node/packet/index.cjs.js +6 -14
- package/_dependencies/@hyperfrontend/network-protocol/node/packet/index.esm.js +7 -15
- package/_dependencies/@hyperfrontend/network-protocol/node/receiver/index.cjs.js +3 -17
- package/_dependencies/@hyperfrontend/network-protocol/node/receiver/index.esm.js +1 -15
- package/_dependencies/@hyperfrontend/network-protocol/node/sender/index.cjs.js +2 -16
- package/_dependencies/@hyperfrontend/network-protocol/node/sender/index.esm.js +2 -16
- package/_dependencies/@hyperfrontend/network-protocol/node/v1/index.cjs.js +6 -14
- package/_dependencies/@hyperfrontend/network-protocol/node/v1/index.esm.js +7 -15
- package/_dependencies/@hyperfrontend/network-protocol/node/v2/index.cjs.js +6 -14
- package/_dependencies/@hyperfrontend/network-protocol/node/v2/index.esm.js +7 -15
- package/_dependencies/@hyperfrontend/nexus/index.cjs.js +49 -19
- package/_dependencies/@hyperfrontend/nexus/index.esm.js +49 -19
- package/_dependencies/@hyperfrontend/project-scope/core/fs/index.cjs.js +62 -0
- package/_dependencies/@hyperfrontend/project-scope/core/fs/index.esm.js +60 -2
- package/_shared/generators/feature/generate-feature-module/index.esm.js +11 -6
- package/_shared/generators/metadata/generate-metadata/index.esm.js +1 -0
- package/_shared/shared/control/index.cjs.js +12 -2
- package/_shared/shared/control/index.esm.js +12 -2
- package/_shared/shared/request/index.cjs.js +91 -0
- package/_shared/shared/request/index.esm.js +88 -0
- package/_shared/shared/shutdown/index.esm.js +12 -0
- package/bin/hf.js +643 -70
- package/bundle/host/index.iife.js +290 -4041
- package/bundle/host/index.iife.min.js +1 -1
- package/bundle/host/index.umd.js +290 -4041
- package/bundle/host/index.umd.min.js +1 -1
- package/bundle/hostee/index.iife.js +215 -2893
- package/bundle/hostee/index.iife.min.js +1 -1
- package/bundle/hostee/index.umd.js +215 -2893
- package/bundle/hostee/index.umd.min.js +1 -1
- package/cli/args.d.ts +2 -0
- package/cli/args.d.ts.map +1 -1
- package/cli/commands/build.d.ts +8 -5
- package/cli/commands/build.d.ts.map +1 -1
- package/cli/commands/dev.d.ts +7 -2
- package/cli/commands/dev.d.ts.map +1 -1
- package/cli/config/resolve.d.ts +3 -1
- package/cli/config/resolve.d.ts.map +1 -1
- package/cli/index.cjs.js +643 -70
- package/cli/index.d.ts +21 -10
- package/cli/index.esm.js +591 -60
- package/cli/usage.d.ts +1 -1
- package/cli/usage.d.ts.map +1 -1
- package/generators/feature/generate-feature-module.d.ts.map +1 -1
- package/generators/index.cjs.js +435 -42
- package/generators/index.d.ts +9 -8
- package/generators/index.esm.js +404 -30
- package/generators/metadata/generate-metadata.d.ts +4 -4
- package/generators/metadata/generate-metadata.d.ts.map +1 -1
- package/generators/shell/connector-types.d.ts +19 -0
- package/generators/shell/connector-types.d.ts.map +1 -0
- package/generators/shell/generate-shell.d.ts +5 -4
- package/generators/shell/generate-shell.d.ts.map +1 -1
- package/generators/shell/schema-type.d.ts +20 -0
- package/generators/shell/schema-type.d.ts.map +1 -0
- package/generators/shell/source-literal.d.ts +28 -0
- package/generators/shell/source-literal.d.ts.map +1 -1
- package/host/create-shell.d.ts +4 -1
- package/host/create-shell.d.ts.map +1 -1
- package/host/display-modes/dialog.d.ts +1 -1
- package/host/display-modes/dialog.d.ts.map +1 -1
- package/host/display-modes/embedded.d.ts +1 -1
- package/host/display-modes/embedded.d.ts.map +1 -1
- package/host/index.cjs.js +150 -30
- package/host/index.d.ts +53 -38
- package/host/index.d.ts.map +1 -1
- package/host/index.esm.js +129 -9
- package/host/lifecycle.d.ts.map +1 -1
- package/host/plugins.d.ts +1 -34
- package/host/plugins.d.ts.map +1 -1
- package/host/types.d.ts +49 -0
- package/host/types.d.ts.map +1 -1
- package/hostee/index.cjs.js +54 -9
- package/hostee/index.d.ts +41 -1
- package/hostee/index.d.ts.map +1 -1
- package/hostee/index.esm.js +51 -6
- package/hostee/lifecycle.d.ts.map +1 -1
- package/hostee/types.d.ts +40 -0
- package/hostee/types.d.ts.map +1 -1
- package/index.cjs.js +32 -1
- package/index.d.ts +89 -3
- package/index.d.ts.map +1 -1
- package/index.esm.js +32 -1
- package/nx/executors/build/index.cjs.js +14975 -137
- package/nx/executors/build/index.esm.js +14935 -115
- package/nx/executors/serve/executor.d.ts.map +1 -1
- package/nx/executors/serve/index.cjs.js +6594 -80
- package/nx/executors/serve/index.esm.js +6529 -44
- package/nx/generators/feature/index.cjs.js +8751 -108
- package/nx/generators/feature/index.esm.js +8711 -81
- package/package.json +15 -5
- package/server/debug-ui/index.d.ts +2 -0
- package/server/debug-ui/index.d.ts.map +1 -0
- package/server/debug-ui/index.html +15 -0
- package/server/debug-ui/index.iife.js +427 -0
- package/server/debug-ui/index.iife.min.js +1 -0
- package/server/dev-server.d.ts.map +1 -1
- package/server/index.cjs.js +78 -10
- package/server/index.esm.js +78 -11
- package/server/module-dir.d.ts +17 -0
- package/server/module-dir.d.ts.map +1 -0
- package/server/module-dir.stub.d.ts +15 -0
- package/server/module-dir.stub.d.ts.map +1 -0
- package/shared/contract.d.ts +1 -1
- package/shared/contract.d.ts.map +1 -1
- package/shared/control.d.ts +4 -0
- package/shared/control.d.ts.map +1 -1
- package/shared/invert-contract.d.ts +20 -0
- package/shared/invert-contract.d.ts.map +1 -0
- package/shared/request.d.ts +68 -0
- package/shared/request.d.ts.map +1 -0
- package/{nx/shared → shared}/shutdown.d.ts +3 -2
- package/shared/shutdown.d.ts.map +1 -0
- package/shared/types.d.ts +72 -1
- package/shared/types.d.ts.map +1 -1
- package/_shared/nx/shared/context/index.cjs.js +0 -18
- package/_shared/nx/shared/context/index.esm.js +0 -16
- package/nx/shared/shutdown.d.ts.map +0 -1
- package/server/debug-ui/bootstrap.d.ts +0 -2
- package/server/debug-ui/bootstrap.d.ts.map +0 -1
|
@@ -8,7 +8,7 @@ import { createSet } from '../../../immutable-api-utils/built-in-copy/set/index.
|
|
|
8
8
|
import { validate } from '../../../json-utils/index.esm.js';
|
|
9
9
|
import { debug, info, log, warn, error } from '../../../immutable-api-utils/built-in-copy/console/index.esm.js';
|
|
10
10
|
import { createUint8Array } from '../../../immutable-api-utils/built-in-copy/typed-arrays/index.esm.js';
|
|
11
|
-
import {
|
|
11
|
+
import { atob, btoa } from '../../../immutable-api-utils/built-in-copy/encoding/index.esm.js';
|
|
12
12
|
import { fromCharCode } from '../../../immutable-api-utils/built-in-copy/string/index.esm.js';
|
|
13
13
|
import '../../../immutable-api-utils/built-in-copy/timers/index.esm.js';
|
|
14
14
|
import '../../../immutable-api-utils/built-in-copy/number/index.esm.js';
|
|
@@ -1293,20 +1293,6 @@ function createReceiverFactory(createDeserializedEncryptedPacket) {
|
|
|
1293
1293
|
};
|
|
1294
1294
|
}
|
|
1295
1295
|
|
|
1296
|
-
createTextEncoder();
|
|
1297
|
-
createTextDecoder('utf8');
|
|
1298
|
-
({
|
|
1299
|
-
SIMPLE: {
|
|
1300
|
-
ARRAY: createUint8Array([104, 101, 108, 108, 111]),
|
|
1301
|
-
},
|
|
1302
|
-
NON_ASCII: {
|
|
1303
|
-
ARRAY: createUint8Array([227, 129, 147, 227, 130, 147, 227, 129, 171, 227, 129, 161, 227, 129, 175]),
|
|
1304
|
-
},
|
|
1305
|
-
EMPTY: {
|
|
1306
|
-
ARRAY: createUint8Array([]),
|
|
1307
|
-
},
|
|
1308
|
-
});
|
|
1309
|
-
|
|
1310
1296
|
function binaryStringToBytes(binaryStr) {
|
|
1311
1297
|
const bytes = createUint8Array(binaryStr.length);
|
|
1312
1298
|
for (let i = 0; i < binaryStr.length; i += 1) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const index_cjs_js$
|
|
3
|
+
const index_cjs_js$1 = require('../../../immutable-api-utils/built-in-copy/array/index.cjs.js');
|
|
4
4
|
const index_cjs_js$3 = require('../../../immutable-api-utils/built-in-copy/error/index.cjs.js');
|
|
5
|
-
const index_cjs_js$
|
|
5
|
+
const index_cjs_js$2 = require('../../../immutable-api-utils/built-in-copy/typed-arrays/index.cjs.js');
|
|
6
6
|
const index_cjs_js = require('../../../immutable-api-utils/built-in-copy/encoding/index.cjs.js');
|
|
7
7
|
require('../../../immutable-api-utils/built-in-copy/string/index.cjs.js');
|
|
8
8
|
const index_cjs_js$4 = require('../../../immutable-api-utils/built-in-copy/object/index.cjs.js');
|
|
@@ -16,22 +16,14 @@ require('../../../immutable-api-utils/built-in-copy/promise/index.cjs.js');
|
|
|
16
16
|
const index_cjs_js$9 = require('../../../immutable-api-utils/built-in-copy/json/index.cjs.js');
|
|
17
17
|
const index_cjs_js$8 = require('../../../json-utils/index.cjs.js');
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
},
|
|
25
|
-
NON_ASCII: {
|
|
26
|
-
ARRAY: index_cjs_js$1.createUint8Array([227, 129, 147, 227, 130, 147, 227, 129, 171, 227, 129, 161, 227, 129, 175]),
|
|
27
|
-
},
|
|
28
|
-
EMPTY: {
|
|
29
|
-
ARRAY: index_cjs_js$1.createUint8Array([]),
|
|
30
|
-
},
|
|
31
|
-
});
|
|
19
|
+
let cachedUtf8Decoder;
|
|
20
|
+
function getUtf8Decoder() {
|
|
21
|
+
cachedUtf8Decoder ??= index_cjs_js.createTextDecoder('utf8');
|
|
22
|
+
return cachedUtf8Decoder;
|
|
23
|
+
}
|
|
32
24
|
|
|
33
25
|
function arrayBufferToUtf8String(uint8Array) {
|
|
34
|
-
return
|
|
26
|
+
return getUtf8Decoder().decode(uint8Array);
|
|
35
27
|
}
|
|
36
28
|
|
|
37
29
|
function utf8StringToUint8Array(text) {
|
|
@@ -42,7 +34,7 @@ const subtle = globalThis.crypto.subtle;
|
|
|
42
34
|
|
|
43
35
|
async function createHash(data, algorithm = 'SHA-256') {
|
|
44
36
|
try {
|
|
45
|
-
return index_cjs_js$
|
|
37
|
+
return index_cjs_js$1.from(index_cjs_js$2.createUint8Array(await subtle.digest(algorithm, utf8StringToUint8Array(data))))
|
|
46
38
|
.map((b) => b.toString(16).padStart(2, '0'))
|
|
47
39
|
.join('');
|
|
48
40
|
}
|
|
@@ -117,7 +109,7 @@ const getType = (target) => {
|
|
|
117
109
|
return 'null';
|
|
118
110
|
const nativeDataType = typeof target;
|
|
119
111
|
if (nativeDataType === 'object') {
|
|
120
|
-
if (index_cjs_js$
|
|
112
|
+
if (index_cjs_js$1.isArray(target))
|
|
121
113
|
return 'array';
|
|
122
114
|
for (const registeredClass of registeredClasses) {
|
|
123
115
|
if (target instanceof registeredClass)
|
|
@@ -224,9 +216,9 @@ const nonCircularDependencyTraversal = (condition, callback, config, key, path,
|
|
|
224
216
|
const traversal = (target, condition, callback, options, state) => {
|
|
225
217
|
if (typeof callback !== 'function')
|
|
226
218
|
throw index_cjs_js$3.createError(errorMessage('callback', 'a function'));
|
|
227
|
-
if (!(typeof options === 'object' && !index_cjs_js$
|
|
219
|
+
if (!(typeof options === 'object' && !index_cjs_js$1.isArray(options)))
|
|
228
220
|
throw index_cjs_js$3.createError(errorMessage('options', 'an object'));
|
|
229
|
-
if (!index_cjs_js$
|
|
221
|
+
if (!index_cjs_js$1.isArray(options.depth))
|
|
230
222
|
throw index_cjs_js$3.createError(errorMessage('options.depth', 'an array'));
|
|
231
223
|
const [startDepth, maxDepth] = options.depth;
|
|
232
224
|
if (startDepth !== void 0 && typeof startDepth !== 'number')
|
|
@@ -335,7 +327,7 @@ function getRandomValues(byteLength) {
|
|
|
335
327
|
if (!byteLength) {
|
|
336
328
|
throw index_cjs_js$3.createError('Cannot generate random values without a byte length.');
|
|
337
329
|
}
|
|
338
|
-
return globalThis.crypto.getRandomValues(index_cjs_js$
|
|
330
|
+
return globalThis.crypto.getRandomValues(index_cjs_js$2.createUint8Array(byteLength));
|
|
339
331
|
}
|
|
340
332
|
|
|
341
333
|
function createEncrypt(utf8StringToUint8Array, getRandomValues, generateKey, subtle) {
|
|
@@ -350,8 +342,8 @@ function createEncrypt(utf8StringToUint8Array, getRandomValues, generateKey, sub
|
|
|
350
342
|
const iv = getRandomValues(12);
|
|
351
343
|
const key = await generateKey(password, salt);
|
|
352
344
|
const encryptedContent = await subtle.encrypt({ ...encryptionConfig, iv: iv }, key, utf8StringToUint8Array(message));
|
|
353
|
-
const buffer = index_cjs_js$
|
|
354
|
-
const result = index_cjs_js$
|
|
345
|
+
const buffer = index_cjs_js$2.createUint8Array(encryptedContent);
|
|
346
|
+
const result = index_cjs_js$2.createUint8Array(salt.byteLength + iv.byteLength + buffer.byteLength);
|
|
355
347
|
result.set(salt, 0);
|
|
356
348
|
result.set(iv, salt.byteLength);
|
|
357
349
|
result.set(buffer, salt.byteLength + iv.byteLength);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { from, isArray } from '../../../immutable-api-utils/built-in-copy/array/index.esm.js';
|
|
2
2
|
import { createError } from '../../../immutable-api-utils/built-in-copy/error/index.esm.js';
|
|
3
3
|
import { createUint8Array } from '../../../immutable-api-utils/built-in-copy/typed-arrays/index.esm.js';
|
|
4
|
-
import {
|
|
4
|
+
import { createTextDecoder, createTextEncoder } from '../../../immutable-api-utils/built-in-copy/encoding/index.esm.js';
|
|
5
5
|
import '../../../immutable-api-utils/built-in-copy/string/index.esm.js';
|
|
6
6
|
import { keys, freeze } from '../../../immutable-api-utils/built-in-copy/object/index.esm.js';
|
|
7
7
|
import { createMap } from '../../../immutable-api-utils/built-in-copy/map/index.esm.js';
|
|
@@ -14,22 +14,14 @@ import '../../../immutable-api-utils/built-in-copy/promise/index.esm.js';
|
|
|
14
14
|
import { stringify, parse } from '../../../immutable-api-utils/built-in-copy/json/index.esm.js';
|
|
15
15
|
import { toJsonSchema } from '../../../json-utils/index.esm.js';
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
},
|
|
23
|
-
NON_ASCII: {
|
|
24
|
-
ARRAY: createUint8Array([227, 129, 147, 227, 130, 147, 227, 129, 171, 227, 129, 161, 227, 129, 175]),
|
|
25
|
-
},
|
|
26
|
-
EMPTY: {
|
|
27
|
-
ARRAY: createUint8Array([]),
|
|
28
|
-
},
|
|
29
|
-
});
|
|
17
|
+
let cachedUtf8Decoder;
|
|
18
|
+
function getUtf8Decoder() {
|
|
19
|
+
cachedUtf8Decoder ??= createTextDecoder('utf8');
|
|
20
|
+
return cachedUtf8Decoder;
|
|
21
|
+
}
|
|
30
22
|
|
|
31
23
|
function arrayBufferToUtf8String(uint8Array) {
|
|
32
|
-
return
|
|
24
|
+
return getUtf8Decoder().decode(uint8Array);
|
|
33
25
|
}
|
|
34
26
|
|
|
35
27
|
function utf8StringToUint8Array(text) {
|
|
@@ -16,22 +16,14 @@ require('../../../immutable-api-utils/built-in-copy/promise/index.cjs.js');
|
|
|
16
16
|
const index_cjs_js$6 = require('../../../json-utils/index.cjs.js');
|
|
17
17
|
const index_cjs_js$7 = require('../../../immutable-api-utils/built-in-copy/json/index.cjs.js');
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
},
|
|
25
|
-
NON_ASCII: {
|
|
26
|
-
ARRAY: index_cjs_js$1.createUint8Array([227, 129, 147, 227, 130, 147, 227, 129, 171, 227, 129, 161, 227, 129, 175]),
|
|
27
|
-
},
|
|
28
|
-
EMPTY: {
|
|
29
|
-
ARRAY: index_cjs_js$1.createUint8Array([]),
|
|
30
|
-
},
|
|
31
|
-
});
|
|
19
|
+
let cachedUtf8Decoder;
|
|
20
|
+
function getUtf8Decoder() {
|
|
21
|
+
cachedUtf8Decoder ??= index_cjs_js.createTextDecoder('utf8');
|
|
22
|
+
return cachedUtf8Decoder;
|
|
23
|
+
}
|
|
32
24
|
|
|
33
25
|
function arrayBufferToUtf8String(uint8Array) {
|
|
34
|
-
return
|
|
26
|
+
return getUtf8Decoder().decode(uint8Array);
|
|
35
27
|
}
|
|
36
28
|
|
|
37
29
|
function binaryStringToBytes(binaryStr) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isArray } from '../../../immutable-api-utils/built-in-copy/array/index.esm.js';
|
|
2
2
|
import { createError } from '../../../immutable-api-utils/built-in-copy/error/index.esm.js';
|
|
3
3
|
import { createUint8Array } from '../../../immutable-api-utils/built-in-copy/typed-arrays/index.esm.js';
|
|
4
|
-
import {
|
|
4
|
+
import { createTextDecoder, atob, btoa, createTextEncoder } from '../../../immutable-api-utils/built-in-copy/encoding/index.esm.js';
|
|
5
5
|
import { fromCharCode } from '../../../immutable-api-utils/built-in-copy/string/index.esm.js';
|
|
6
6
|
import { keys, freeze, typeTag } from '../../../immutable-api-utils/built-in-copy/object/index.esm.js';
|
|
7
7
|
import '../../../immutable-api-utils/built-in-copy/map/index.esm.js';
|
|
@@ -14,22 +14,14 @@ import '../../../immutable-api-utils/built-in-copy/promise/index.esm.js';
|
|
|
14
14
|
import { validate } from '../../../json-utils/index.esm.js';
|
|
15
15
|
import { parse, stringify } from '../../../immutable-api-utils/built-in-copy/json/index.esm.js';
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
},
|
|
23
|
-
NON_ASCII: {
|
|
24
|
-
ARRAY: createUint8Array([227, 129, 147, 227, 130, 147, 227, 129, 171, 227, 129, 161, 227, 129, 175]),
|
|
25
|
-
},
|
|
26
|
-
EMPTY: {
|
|
27
|
-
ARRAY: createUint8Array([]),
|
|
28
|
-
},
|
|
29
|
-
});
|
|
17
|
+
let cachedUtf8Decoder;
|
|
18
|
+
function getUtf8Decoder() {
|
|
19
|
+
cachedUtf8Decoder ??= createTextDecoder('utf8');
|
|
20
|
+
return cachedUtf8Decoder;
|
|
21
|
+
}
|
|
30
22
|
|
|
31
23
|
function arrayBufferToUtf8String(uint8Array) {
|
|
32
|
-
return
|
|
24
|
+
return getUtf8Decoder().decode(uint8Array);
|
|
33
25
|
}
|
|
34
26
|
|
|
35
27
|
function binaryStringToBytes(binaryStr) {
|
|
@@ -9,8 +9,8 @@ require('../../../immutable-api-utils/built-in-copy/math/index.cjs.js');
|
|
|
9
9
|
const index_cjs_js$6 = require('../../../immutable-api-utils/built-in-copy/set/index.cjs.js');
|
|
10
10
|
const index_cjs_js$3 = require('../../../json-utils/index.cjs.js');
|
|
11
11
|
const index_cjs_js$5 = require('../../../immutable-api-utils/built-in-copy/console/index.cjs.js');
|
|
12
|
-
const index_cjs_js$
|
|
13
|
-
const index_cjs_js$
|
|
12
|
+
const index_cjs_js$7 = require('../../../immutable-api-utils/built-in-copy/typed-arrays/index.cjs.js');
|
|
13
|
+
const index_cjs_js$8 = require('../../../immutable-api-utils/built-in-copy/encoding/index.cjs.js');
|
|
14
14
|
require('../../../immutable-api-utils/built-in-copy/string/index.cjs.js');
|
|
15
15
|
require('../../../immutable-api-utils/built-in-copy/timers/index.cjs.js');
|
|
16
16
|
require('../../../immutable-api-utils/built-in-copy/number/index.cjs.js');
|
|
@@ -971,22 +971,8 @@ function createReceiverFactory(createDeserializedEncryptedPacket) {
|
|
|
971
971
|
};
|
|
972
972
|
}
|
|
973
973
|
|
|
974
|
-
index_cjs_js$7.createTextEncoder();
|
|
975
|
-
index_cjs_js$7.createTextDecoder('utf8');
|
|
976
|
-
({
|
|
977
|
-
SIMPLE: {
|
|
978
|
-
ARRAY: index_cjs_js$8.createUint8Array([104, 101, 108, 108, 111]),
|
|
979
|
-
},
|
|
980
|
-
NON_ASCII: {
|
|
981
|
-
ARRAY: index_cjs_js$8.createUint8Array([227, 129, 147, 227, 130, 147, 227, 129, 171, 227, 129, 161, 227, 129, 175]),
|
|
982
|
-
},
|
|
983
|
-
EMPTY: {
|
|
984
|
-
ARRAY: index_cjs_js$8.createUint8Array([]),
|
|
985
|
-
},
|
|
986
|
-
});
|
|
987
|
-
|
|
988
974
|
function binaryStringToBytes(binaryStr) {
|
|
989
|
-
const bytes = index_cjs_js$
|
|
975
|
+
const bytes = index_cjs_js$7.createUint8Array(binaryStr.length);
|
|
990
976
|
for (let i = 0; i < binaryStr.length; i += 1) {
|
|
991
977
|
bytes[i] = binaryStr.charCodeAt(i);
|
|
992
978
|
}
|
|
@@ -1003,7 +989,7 @@ function urlSafeBase64ToBase64(urlSafeBase64) {
|
|
|
1003
989
|
}
|
|
1004
990
|
|
|
1005
991
|
function base64ToUint8Array(base64) {
|
|
1006
|
-
return binaryStringToBytes(index_cjs_js$
|
|
992
|
+
return binaryStringToBytes(index_cjs_js$8.atob(urlSafeBase64ToBase64(base64)));
|
|
1007
993
|
}
|
|
1008
994
|
|
|
1009
995
|
index_cjs_js.freeze({
|
|
@@ -8,7 +8,7 @@ import { createSet } from '../../../immutable-api-utils/built-in-copy/set/index.
|
|
|
8
8
|
import { validate } from '../../../json-utils/index.esm.js';
|
|
9
9
|
import { debug, info, log, warn, error } from '../../../immutable-api-utils/built-in-copy/console/index.esm.js';
|
|
10
10
|
import { createUint8Array } from '../../../immutable-api-utils/built-in-copy/typed-arrays/index.esm.js';
|
|
11
|
-
import {
|
|
11
|
+
import { atob } from '../../../immutable-api-utils/built-in-copy/encoding/index.esm.js';
|
|
12
12
|
import '../../../immutable-api-utils/built-in-copy/string/index.esm.js';
|
|
13
13
|
import '../../../immutable-api-utils/built-in-copy/timers/index.esm.js';
|
|
14
14
|
import '../../../immutable-api-utils/built-in-copy/number/index.esm.js';
|
|
@@ -969,20 +969,6 @@ function createReceiverFactory(createDeserializedEncryptedPacket) {
|
|
|
969
969
|
};
|
|
970
970
|
}
|
|
971
971
|
|
|
972
|
-
createTextEncoder();
|
|
973
|
-
createTextDecoder('utf8');
|
|
974
|
-
({
|
|
975
|
-
SIMPLE: {
|
|
976
|
-
ARRAY: createUint8Array([104, 101, 108, 108, 111]),
|
|
977
|
-
},
|
|
978
|
-
NON_ASCII: {
|
|
979
|
-
ARRAY: createUint8Array([227, 129, 147, 227, 130, 147, 227, 129, 171, 227, 129, 161, 227, 129, 175]),
|
|
980
|
-
},
|
|
981
|
-
EMPTY: {
|
|
982
|
-
ARRAY: createUint8Array([]),
|
|
983
|
-
},
|
|
984
|
-
});
|
|
985
|
-
|
|
986
972
|
function binaryStringToBytes(binaryStr) {
|
|
987
973
|
const bytes = createUint8Array(binaryStr.length);
|
|
988
974
|
for (let i = 0; i < binaryStr.length; i += 1) {
|
|
@@ -9,9 +9,9 @@ require('../../../immutable-api-utils/built-in-copy/math/index.cjs.js');
|
|
|
9
9
|
const index_cjs_js$6 = require('../../../immutable-api-utils/built-in-copy/set/index.cjs.js');
|
|
10
10
|
const index_cjs_js$3 = require('../../../json-utils/index.cjs.js');
|
|
11
11
|
const index_cjs_js$5 = require('../../../immutable-api-utils/built-in-copy/console/index.cjs.js');
|
|
12
|
-
|
|
13
|
-
const index_cjs_js$
|
|
14
|
-
const index_cjs_js$
|
|
12
|
+
require('../../../immutable-api-utils/built-in-copy/typed-arrays/index.cjs.js');
|
|
13
|
+
const index_cjs_js$8 = require('../../../immutable-api-utils/built-in-copy/encoding/index.cjs.js');
|
|
14
|
+
const index_cjs_js$7 = require('../../../immutable-api-utils/built-in-copy/string/index.cjs.js');
|
|
15
15
|
require('../../../immutable-api-utils/built-in-copy/timers/index.cjs.js');
|
|
16
16
|
require('../../../immutable-api-utils/built-in-copy/number/index.cjs.js');
|
|
17
17
|
require('../../../immutable-api-utils/built-in-copy/promise/index.cjs.js');
|
|
@@ -995,20 +995,6 @@ function createSenderFactory(createSerializedEncryptedPacket) {
|
|
|
995
995
|
};
|
|
996
996
|
}
|
|
997
997
|
|
|
998
|
-
index_cjs_js$7.createTextEncoder();
|
|
999
|
-
index_cjs_js$7.createTextDecoder('utf8');
|
|
1000
|
-
({
|
|
1001
|
-
SIMPLE: {
|
|
1002
|
-
ARRAY: index_cjs_js$8.createUint8Array([104, 101, 108, 108, 111]),
|
|
1003
|
-
},
|
|
1004
|
-
NON_ASCII: {
|
|
1005
|
-
ARRAY: index_cjs_js$8.createUint8Array([227, 129, 147, 227, 130, 147, 227, 129, 171, 227, 129, 161, 227, 129, 175]),
|
|
1006
|
-
},
|
|
1007
|
-
EMPTY: {
|
|
1008
|
-
ARRAY: index_cjs_js$8.createUint8Array([]),
|
|
1009
|
-
},
|
|
1010
|
-
});
|
|
1011
|
-
|
|
1012
998
|
function base64ToUrlSafeBase64(base64, { urlSafe, keepPadding }) {
|
|
1013
999
|
if (urlSafe) {
|
|
1014
1000
|
base64 = base64.replaceAll('+', '-').replaceAll('/', '_');
|
|
@@ -1024,13 +1010,13 @@ function base64ToUrlSafeBase64(base64, { urlSafe, keepPadding }) {
|
|
|
1024
1010
|
function bytesToBinaryString(bytes) {
|
|
1025
1011
|
let binary = '';
|
|
1026
1012
|
for (let i = 0; i < bytes.length; i += 1) {
|
|
1027
|
-
binary += index_cjs_js$
|
|
1013
|
+
binary += index_cjs_js$7.fromCharCode(bytes[i]);
|
|
1028
1014
|
}
|
|
1029
1015
|
return binary;
|
|
1030
1016
|
}
|
|
1031
1017
|
|
|
1032
1018
|
function uint8ArrayToBase64(bytes, urlSafe = false, keepPadding = false) {
|
|
1033
|
-
return base64ToUrlSafeBase64(index_cjs_js$
|
|
1019
|
+
return base64ToUrlSafeBase64(index_cjs_js$8.btoa(bytesToBinaryString(bytes)), {
|
|
1034
1020
|
urlSafe,
|
|
1035
1021
|
keepPadding,
|
|
1036
1022
|
});
|
|
@@ -7,8 +7,8 @@ import '../../../immutable-api-utils/built-in-copy/math/index.esm.js';
|
|
|
7
7
|
import { createSet } from '../../../immutable-api-utils/built-in-copy/set/index.esm.js';
|
|
8
8
|
import { validate } from '../../../json-utils/index.esm.js';
|
|
9
9
|
import { debug, info, log, warn, error } from '../../../immutable-api-utils/built-in-copy/console/index.esm.js';
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
10
|
+
import '../../../immutable-api-utils/built-in-copy/typed-arrays/index.esm.js';
|
|
11
|
+
import { btoa } from '../../../immutable-api-utils/built-in-copy/encoding/index.esm.js';
|
|
12
12
|
import { fromCharCode } from '../../../immutable-api-utils/built-in-copy/string/index.esm.js';
|
|
13
13
|
import '../../../immutable-api-utils/built-in-copy/timers/index.esm.js';
|
|
14
14
|
import '../../../immutable-api-utils/built-in-copy/number/index.esm.js';
|
|
@@ -993,20 +993,6 @@ function createSenderFactory(createSerializedEncryptedPacket) {
|
|
|
993
993
|
};
|
|
994
994
|
}
|
|
995
995
|
|
|
996
|
-
createTextEncoder();
|
|
997
|
-
createTextDecoder('utf8');
|
|
998
|
-
({
|
|
999
|
-
SIMPLE: {
|
|
1000
|
-
ARRAY: createUint8Array([104, 101, 108, 108, 111]),
|
|
1001
|
-
},
|
|
1002
|
-
NON_ASCII: {
|
|
1003
|
-
ARRAY: createUint8Array([227, 129, 147, 227, 130, 147, 227, 129, 171, 227, 129, 161, 227, 129, 175]),
|
|
1004
|
-
},
|
|
1005
|
-
EMPTY: {
|
|
1006
|
-
ARRAY: createUint8Array([]),
|
|
1007
|
-
},
|
|
1008
|
-
});
|
|
1009
|
-
|
|
1010
996
|
function base64ToUrlSafeBase64(base64, { urlSafe, keepPadding }) {
|
|
1011
997
|
if (urlSafe) {
|
|
1012
998
|
base64 = base64.replaceAll('+', '-').replaceAll('/', '_');
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const index_cjs_js$
|
|
3
|
+
const index_cjs_js$1 = require('../../../immutable-api-utils/built-in-copy/array/index.cjs.js');
|
|
4
4
|
const index_cjs_js$3 = require('../../../immutable-api-utils/built-in-copy/error/index.cjs.js');
|
|
5
|
-
const index_cjs_js$
|
|
5
|
+
const index_cjs_js$2 = require('../../../immutable-api-utils/built-in-copy/typed-arrays/index.cjs.js');
|
|
6
6
|
const index_cjs_js = require('../../../immutable-api-utils/built-in-copy/encoding/index.cjs.js');
|
|
7
7
|
require('../../../immutable-api-utils/built-in-copy/string/index.cjs.js');
|
|
8
8
|
const index_cjs_js$4 = require('../../../immutable-api-utils/built-in-copy/object/index.cjs.js');
|
|
@@ -17,22 +17,14 @@ const index_cjs_js$8 = require('../../../immutable-api-utils/built-in-copy/json/
|
|
|
17
17
|
const index_cjs_js$9 = require('../../../immutable-api-utils/built-in-copy/console/index.cjs.js');
|
|
18
18
|
const index_cjs_js$a = require('../../../json-utils/index.cjs.js');
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
},
|
|
26
|
-
NON_ASCII: {
|
|
27
|
-
ARRAY: index_cjs_js$1.createUint8Array([227, 129, 147, 227, 130, 147, 227, 129, 171, 227, 129, 161, 227, 129, 175]),
|
|
28
|
-
},
|
|
29
|
-
EMPTY: {
|
|
30
|
-
ARRAY: index_cjs_js$1.createUint8Array([]),
|
|
31
|
-
},
|
|
32
|
-
});
|
|
20
|
+
let cachedUtf8Decoder;
|
|
21
|
+
function getUtf8Decoder() {
|
|
22
|
+
cachedUtf8Decoder ??= index_cjs_js.createTextDecoder('utf8');
|
|
23
|
+
return cachedUtf8Decoder;
|
|
24
|
+
}
|
|
33
25
|
|
|
34
26
|
function arrayBufferToUtf8String(uint8Array) {
|
|
35
|
-
return
|
|
27
|
+
return getUtf8Decoder().decode(uint8Array);
|
|
36
28
|
}
|
|
37
29
|
|
|
38
30
|
function utf8StringToUint8Array(text) {
|
|
@@ -43,7 +35,7 @@ const subtle = globalThis.crypto.subtle;
|
|
|
43
35
|
|
|
44
36
|
async function createHash(data, algorithm = 'SHA-256') {
|
|
45
37
|
try {
|
|
46
|
-
return index_cjs_js$
|
|
38
|
+
return index_cjs_js$1.from(index_cjs_js$2.createUint8Array(await subtle.digest(algorithm, utf8StringToUint8Array(data))))
|
|
47
39
|
.map((b) => b.toString(16).padStart(2, '0'))
|
|
48
40
|
.join('');
|
|
49
41
|
}
|
|
@@ -94,7 +86,7 @@ const getType = (target) => {
|
|
|
94
86
|
return 'null';
|
|
95
87
|
const nativeDataType = typeof target;
|
|
96
88
|
if (nativeDataType === 'object') {
|
|
97
|
-
if (index_cjs_js$
|
|
89
|
+
if (index_cjs_js$1.isArray(target))
|
|
98
90
|
return 'array';
|
|
99
91
|
for (const registeredClass of registeredClasses) {
|
|
100
92
|
if (target instanceof registeredClass)
|
|
@@ -139,9 +131,9 @@ const nonCircularDependencyTraversal = (condition, callback, config, key, path,
|
|
|
139
131
|
const traversal = (target, condition, callback, options, state) => {
|
|
140
132
|
if (typeof callback !== 'function')
|
|
141
133
|
throw index_cjs_js$3.createError(errorMessage('callback', 'a function'));
|
|
142
|
-
if (!(typeof options === 'object' && !index_cjs_js$
|
|
134
|
+
if (!(typeof options === 'object' && !index_cjs_js$1.isArray(options)))
|
|
143
135
|
throw index_cjs_js$3.createError(errorMessage('options', 'an object'));
|
|
144
|
-
if (!index_cjs_js$
|
|
136
|
+
if (!index_cjs_js$1.isArray(options.depth))
|
|
145
137
|
throw index_cjs_js$3.createError(errorMessage('options.depth', 'an array'));
|
|
146
138
|
const [startDepth, maxDepth] = options.depth;
|
|
147
139
|
if (startDepth !== void 0 && typeof startDepth !== 'number')
|
|
@@ -217,7 +209,7 @@ function getRandomValues(byteLength) {
|
|
|
217
209
|
if (!byteLength) {
|
|
218
210
|
throw index_cjs_js$3.createError('Cannot generate random values without a byte length.');
|
|
219
211
|
}
|
|
220
|
-
return globalThis.crypto.getRandomValues(index_cjs_js$
|
|
212
|
+
return globalThis.crypto.getRandomValues(index_cjs_js$2.createUint8Array(byteLength));
|
|
221
213
|
}
|
|
222
214
|
|
|
223
215
|
function createEncrypt(utf8StringToUint8Array, getRandomValues, generateKey, subtle) {
|
|
@@ -232,8 +224,8 @@ function createEncrypt(utf8StringToUint8Array, getRandomValues, generateKey, sub
|
|
|
232
224
|
const iv = getRandomValues(12);
|
|
233
225
|
const key = await generateKey(password, salt);
|
|
234
226
|
const encryptedContent = await subtle.encrypt({ ...encryptionConfig, iv: iv }, key, utf8StringToUint8Array(message));
|
|
235
|
-
const buffer = index_cjs_js$
|
|
236
|
-
const result = index_cjs_js$
|
|
227
|
+
const buffer = index_cjs_js$2.createUint8Array(encryptedContent);
|
|
228
|
+
const result = index_cjs_js$2.createUint8Array(salt.byteLength + iv.byteLength + buffer.byteLength);
|
|
237
229
|
result.set(salt, 0);
|
|
238
230
|
result.set(iv, salt.byteLength);
|
|
239
231
|
result.set(buffer, salt.byteLength + iv.byteLength);
|
|
@@ -635,7 +627,7 @@ function notFnMsg(label) {
|
|
|
635
627
|
function isValidLogger(logger) {
|
|
636
628
|
const l = logger;
|
|
637
629
|
return (getType(l) === 'object' &&
|
|
638
|
-
!index_cjs_js$
|
|
630
|
+
!index_cjs_js$1.isArray(l) &&
|
|
639
631
|
getType(l.error) === 'function' &&
|
|
640
632
|
getType(l.warn) === 'function' &&
|
|
641
633
|
getType(l.log) === 'function' &&
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { from, isArray } from '../../../immutable-api-utils/built-in-copy/array/index.esm.js';
|
|
2
2
|
import { createError } from '../../../immutable-api-utils/built-in-copy/error/index.esm.js';
|
|
3
3
|
import { createUint8Array } from '../../../immutable-api-utils/built-in-copy/typed-arrays/index.esm.js';
|
|
4
|
-
import {
|
|
4
|
+
import { createTextDecoder, createTextEncoder } from '../../../immutable-api-utils/built-in-copy/encoding/index.esm.js';
|
|
5
5
|
import '../../../immutable-api-utils/built-in-copy/string/index.esm.js';
|
|
6
6
|
import { keys, freeze, typeTag } from '../../../immutable-api-utils/built-in-copy/object/index.esm.js';
|
|
7
7
|
import '../../../immutable-api-utils/built-in-copy/map/index.esm.js';
|
|
@@ -15,22 +15,14 @@ import { parse, stringify } from '../../../immutable-api-utils/built-in-copy/jso
|
|
|
15
15
|
import { debug, info, log, warn, error } from '../../../immutable-api-utils/built-in-copy/console/index.esm.js';
|
|
16
16
|
import { validate } from '../../../json-utils/index.esm.js';
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
},
|
|
24
|
-
NON_ASCII: {
|
|
25
|
-
ARRAY: createUint8Array([227, 129, 147, 227, 130, 147, 227, 129, 171, 227, 129, 161, 227, 129, 175]),
|
|
26
|
-
},
|
|
27
|
-
EMPTY: {
|
|
28
|
-
ARRAY: createUint8Array([]),
|
|
29
|
-
},
|
|
30
|
-
});
|
|
18
|
+
let cachedUtf8Decoder;
|
|
19
|
+
function getUtf8Decoder() {
|
|
20
|
+
cachedUtf8Decoder ??= createTextDecoder('utf8');
|
|
21
|
+
return cachedUtf8Decoder;
|
|
22
|
+
}
|
|
31
23
|
|
|
32
24
|
function arrayBufferToUtf8String(uint8Array) {
|
|
33
|
-
return
|
|
25
|
+
return getUtf8Decoder().decode(uint8Array);
|
|
34
26
|
}
|
|
35
27
|
|
|
36
28
|
function utf8StringToUint8Array(text) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const index_cjs_js$
|
|
3
|
+
const index_cjs_js$1 = require('../../../immutable-api-utils/built-in-copy/array/index.cjs.js');
|
|
4
4
|
const index_cjs_js$3 = require('../../../immutable-api-utils/built-in-copy/error/index.cjs.js');
|
|
5
|
-
const index_cjs_js$
|
|
5
|
+
const index_cjs_js$2 = require('../../../immutable-api-utils/built-in-copy/typed-arrays/index.cjs.js');
|
|
6
6
|
const index_cjs_js = require('../../../immutable-api-utils/built-in-copy/encoding/index.cjs.js');
|
|
7
7
|
require('../../../immutable-api-utils/built-in-copy/string/index.cjs.js');
|
|
8
8
|
const index_cjs_js$4 = require('../../../immutable-api-utils/built-in-copy/object/index.cjs.js');
|
|
@@ -17,22 +17,14 @@ const index_cjs_js$8 = require('../../../immutable-api-utils/built-in-copy/json/
|
|
|
17
17
|
const index_cjs_js$9 = require('../../../immutable-api-utils/built-in-copy/console/index.cjs.js');
|
|
18
18
|
const index_cjs_js$a = require('../../../json-utils/index.cjs.js');
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
},
|
|
26
|
-
NON_ASCII: {
|
|
27
|
-
ARRAY: index_cjs_js$1.createUint8Array([227, 129, 147, 227, 130, 147, 227, 129, 171, 227, 129, 161, 227, 129, 175]),
|
|
28
|
-
},
|
|
29
|
-
EMPTY: {
|
|
30
|
-
ARRAY: index_cjs_js$1.createUint8Array([]),
|
|
31
|
-
},
|
|
32
|
-
});
|
|
20
|
+
let cachedUtf8Decoder;
|
|
21
|
+
function getUtf8Decoder() {
|
|
22
|
+
cachedUtf8Decoder ??= index_cjs_js.createTextDecoder('utf8');
|
|
23
|
+
return cachedUtf8Decoder;
|
|
24
|
+
}
|
|
33
25
|
|
|
34
26
|
function arrayBufferToUtf8String(uint8Array) {
|
|
35
|
-
return
|
|
27
|
+
return getUtf8Decoder().decode(uint8Array);
|
|
36
28
|
}
|
|
37
29
|
|
|
38
30
|
function utf8StringToUint8Array(text) {
|
|
@@ -43,7 +35,7 @@ const subtle = globalThis.crypto.subtle;
|
|
|
43
35
|
|
|
44
36
|
async function createHash(data, algorithm = 'SHA-256') {
|
|
45
37
|
try {
|
|
46
|
-
return index_cjs_js$
|
|
38
|
+
return index_cjs_js$1.from(index_cjs_js$2.createUint8Array(await subtle.digest(algorithm, utf8StringToUint8Array(data))))
|
|
47
39
|
.map((b) => b.toString(16).padStart(2, '0'))
|
|
48
40
|
.join('');
|
|
49
41
|
}
|
|
@@ -94,7 +86,7 @@ const getType = (target) => {
|
|
|
94
86
|
return 'null';
|
|
95
87
|
const nativeDataType = typeof target;
|
|
96
88
|
if (nativeDataType === 'object') {
|
|
97
|
-
if (index_cjs_js$
|
|
89
|
+
if (index_cjs_js$1.isArray(target))
|
|
98
90
|
return 'array';
|
|
99
91
|
for (const registeredClass of registeredClasses) {
|
|
100
92
|
if (target instanceof registeredClass)
|
|
@@ -139,9 +131,9 @@ const nonCircularDependencyTraversal = (condition, callback, config, key, path,
|
|
|
139
131
|
const traversal = (target, condition, callback, options, state) => {
|
|
140
132
|
if (typeof callback !== 'function')
|
|
141
133
|
throw index_cjs_js$3.createError(errorMessage('callback', 'a function'));
|
|
142
|
-
if (!(typeof options === 'object' && !index_cjs_js$
|
|
134
|
+
if (!(typeof options === 'object' && !index_cjs_js$1.isArray(options)))
|
|
143
135
|
throw index_cjs_js$3.createError(errorMessage('options', 'an object'));
|
|
144
|
-
if (!index_cjs_js$
|
|
136
|
+
if (!index_cjs_js$1.isArray(options.depth))
|
|
145
137
|
throw index_cjs_js$3.createError(errorMessage('options.depth', 'an array'));
|
|
146
138
|
const [startDepth, maxDepth] = options.depth;
|
|
147
139
|
if (startDepth !== void 0 && typeof startDepth !== 'number')
|
|
@@ -217,7 +209,7 @@ function getRandomValues(byteLength) {
|
|
|
217
209
|
if (!byteLength) {
|
|
218
210
|
throw index_cjs_js$3.createError('Cannot generate random values without a byte length.');
|
|
219
211
|
}
|
|
220
|
-
return globalThis.crypto.getRandomValues(index_cjs_js$
|
|
212
|
+
return globalThis.crypto.getRandomValues(index_cjs_js$2.createUint8Array(byteLength));
|
|
221
213
|
}
|
|
222
214
|
|
|
223
215
|
function createEncrypt(utf8StringToUint8Array, getRandomValues, generateKey, subtle) {
|
|
@@ -232,8 +224,8 @@ function createEncrypt(utf8StringToUint8Array, getRandomValues, generateKey, sub
|
|
|
232
224
|
const iv = getRandomValues(12);
|
|
233
225
|
const key = await generateKey(password, salt);
|
|
234
226
|
const encryptedContent = await subtle.encrypt({ ...encryptionConfig, iv: iv }, key, utf8StringToUint8Array(message));
|
|
235
|
-
const buffer = index_cjs_js$
|
|
236
|
-
const result = index_cjs_js$
|
|
227
|
+
const buffer = index_cjs_js$2.createUint8Array(encryptedContent);
|
|
228
|
+
const result = index_cjs_js$2.createUint8Array(salt.byteLength + iv.byteLength + buffer.byteLength);
|
|
237
229
|
result.set(salt, 0);
|
|
238
230
|
result.set(iv, salt.byteLength);
|
|
239
231
|
result.set(buffer, salt.byteLength + iv.byteLength);
|
|
@@ -575,7 +567,7 @@ function notFnMsg(label) {
|
|
|
575
567
|
function isValidLogger(logger) {
|
|
576
568
|
const l = logger;
|
|
577
569
|
return (getType(l) === 'object' &&
|
|
578
|
-
!index_cjs_js$
|
|
570
|
+
!index_cjs_js$1.isArray(l) &&
|
|
579
571
|
getType(l.error) === 'function' &&
|
|
580
572
|
getType(l.warn) === 'function' &&
|
|
581
573
|
getType(l.log) === 'function' &&
|