@adobe/data 0.3.1 → 0.3.2
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/cache/functions/hashing/array-buffer-to-hex.d.ts +1 -0
- package/dist/cache/functions/hashing/array-buffer-to-hex.js +27 -0
- package/dist/cache/functions/hashing/array-buffer-to-hex.js.map +1 -0
- package/dist/cache/functions/hashing/arrayBufferToHex.d.ts +1 -0
- package/dist/cache/functions/hashing/arrayBufferToHex.js +27 -0
- package/dist/cache/functions/hashing/arrayBufferToHex.js.map +1 -0
- package/dist/cache/functions/hashing/blob-to-hash.d.ts +5 -0
- package/dist/cache/functions/hashing/blob-to-hash.js +34 -8
- package/dist/cache/functions/hashing/blob-to-hash.js.map +1 -1
- package/dist/cache/functions/hashing/buffer-to-hash.js +1 -5
- package/dist/cache/functions/hashing/buffer-to-hash.js.map +1 -1
- package/dist/cache/functions/hashing/hashing.test.js +322 -65
- package/dist/cache/functions/hashing/hashing.test.js.map +1 -1
- package/dist/ecs/archetype/create-archetype.test.js +4 -4
- package/dist/ecs/archetype/create-archetype.test.js.map +1 -1
- package/dist/ecs/archetype/delete-row.test.js +3 -3
- package/dist/ecs/archetype/delete-row.test.js.map +1 -1
- package/dist/ecs/database/create-database.js.map +1 -1
- package/dist/ecs/database/transactional-store/create-transactional-store.js +2 -2
- package/dist/ecs/database/transactional-store/create-transactional-store.js.map +1 -1
- package/dist/ecs/database/transactional-store/create-transactional-store.test.js +5 -5
- package/dist/ecs/database/transactional-store/create-transactional-store.test.js.map +1 -1
- package/dist/ecs/entity-location-table/create-entity-location-table.d.ts +7 -0
- package/dist/ecs/entity-location-table/create-entity-location-table.js +14 -3
- package/dist/ecs/entity-location-table/create-entity-location-table.js.map +1 -1
- package/dist/ecs/store/core/select-entities.js +2 -2
- package/dist/ecs/store/core/select-entities.js.map +1 -1
- package/dist/equals.js +17 -11
- package/dist/equals.js.map +1 -1
- package/dist/equals.test.js +47 -0
- package/dist/equals.test.js.map +1 -1
- package/dist/functions/blit.d.ts +9 -0
- package/dist/functions/blit.js +42 -0
- package/dist/functions/blit.js.map +1 -0
- package/dist/functions/copy-view-bytes.d.ts +2 -0
- package/dist/functions/copy-view-bytes.js +29 -0
- package/dist/functions/copy-view-bytes.js.map +1 -0
- package/dist/functions/index.d.ts +3 -0
- package/dist/functions/index.js +3 -0
- package/dist/functions/index.js.map +1 -1
- package/dist/functions/serialization/codec.d.ts +24 -0
- package/dist/functions/serialization/codec.js +48 -0
- package/dist/functions/serialization/codec.js.map +1 -0
- package/dist/functions/serialization/deserialize.d.ts +4 -0
- package/dist/functions/serialization/deserialize.js +15 -0
- package/dist/functions/serialization/deserialize.js.map +1 -0
- package/dist/functions/serialization/index.d.ts +2 -0
- package/dist/functions/serialization/index.js +3 -0
- package/dist/functions/serialization/index.js.map +1 -0
- package/dist/functions/serialization/register-typed-array-codecs.d.ts +1 -0
- package/dist/functions/serialization/register-typed-array-codecs.js +13 -0
- package/dist/functions/serialization/register-typed-array-codecs.js.map +1 -0
- package/dist/functions/serialization/serialization.test.d.ts +1 -0
- package/dist/functions/serialization/serialization.test.js +79 -0
- package/dist/functions/serialization/serialization.test.js.map +1 -0
- package/dist/functions/serialization/serialize.d.ts +4 -0
- package/dist/functions/serialization/serialize.js +19 -0
- package/dist/functions/serialization/serialize.js.map +1 -0
- package/dist/observe/index.d.ts +1 -0
- package/dist/observe/index.js +1 -0
- package/dist/observe/index.js.map +1 -1
- package/dist/observe/observe.test.js +24 -0
- package/dist/observe/observe.test.js.map +1 -1
- package/dist/observe/with-map.d.ts +1 -1
- package/dist/observe/with-map.js +4 -1
- package/dist/observe/with-map.js.map +1 -1
- package/dist/schema/schema.d.ts +5 -1
- package/dist/table/add-row.js +4 -3
- package/dist/table/add-row.js.map +1 -1
- package/dist/table/copy-column-to-gpu-buffer.js +2 -2
- package/dist/table/copy-column-to-gpu-buffer.js.map +1 -1
- package/dist/table/create-table.js +4 -2
- package/dist/table/create-table.js.map +1 -1
- package/dist/table/create-table.test.js +1 -1
- package/dist/table/create-table.test.js.map +1 -1
- package/dist/table/delete-row.js +1 -1
- package/dist/table/delete-row.js.map +1 -1
- package/dist/table/ensure-capacity.d.ts +1 -1
- package/dist/table/ensure-capacity.js +10 -10
- package/dist/table/ensure-capacity.js.map +1 -1
- package/dist/table/select-rows.js +2 -2
- package/dist/table/select-rows.js.map +1 -1
- package/dist/table/table.d.ts +4 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/typed-buffer/create-array-buffer.d.ts +3 -3
- package/dist/typed-buffer/create-array-buffer.js +36 -32
- package/dist/typed-buffer/create-array-buffer.js.map +1 -1
- package/dist/typed-buffer/create-const-buffer.d.ts +3 -1
- package/dist/typed-buffer/create-const-buffer.js +30 -28
- package/dist/typed-buffer/create-const-buffer.js.map +1 -1
- package/dist/typed-buffer/create-const-buffer.test.js +18 -46
- package/dist/typed-buffer/create-const-buffer.test.js.map +1 -1
- package/dist/typed-buffer/create-number-buffer.d.ts +2 -6
- package/dist/typed-buffer/create-number-buffer.js +40 -33
- package/dist/typed-buffer/create-number-buffer.js.map +1 -1
- package/dist/typed-buffer/create-struct-buffer.d.ts +3 -7
- package/dist/typed-buffer/create-struct-buffer.js +58 -41
- package/dist/typed-buffer/create-struct-buffer.js.map +1 -1
- package/dist/typed-buffer/create-typed-buffer.d.ts +2 -5
- package/dist/typed-buffer/create-typed-buffer.js +16 -8
- package/dist/typed-buffer/create-typed-buffer.js.map +1 -1
- package/dist/typed-buffer/is-typed-buffer.d.ts +2 -0
- package/dist/typed-buffer/is-typed-buffer.js +5 -0
- package/dist/typed-buffer/is-typed-buffer.js.map +1 -0
- package/dist/typed-buffer/is-typed-buffer.test.d.ts +1 -0
- package/dist/typed-buffer/is-typed-buffer.test.js +26 -0
- package/dist/typed-buffer/is-typed-buffer.test.js.map +1 -0
- package/dist/typed-buffer/register-typed-buffer-codecs.d.ts +1 -0
- package/dist/typed-buffer/register-typed-buffer-codecs.js +80 -0
- package/dist/typed-buffer/register-typed-buffer-codecs.js.map +1 -0
- package/dist/typed-buffer/typed-buffer-equals.d.ts +2 -0
- package/dist/typed-buffer/typed-buffer-equals.js +20 -0
- package/dist/typed-buffer/typed-buffer-equals.js.map +1 -0
- package/dist/typed-buffer/typed-buffer-equals.test.d.ts +1 -0
- package/dist/typed-buffer/typed-buffer-equals.test.js +234 -0
- package/dist/typed-buffer/typed-buffer-equals.test.js.map +1 -0
- package/dist/typed-buffer/typed-buffer.d.ts +18 -8
- package/dist/typed-buffer/typed-buffer.js +6 -1
- package/dist/typed-buffer/typed-buffer.js.map +1 -1
- package/dist/typed-buffer/typed-buffer.test.js +30 -66
- package/dist/typed-buffer/typed-buffer.test.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function arrayBufferToHex(buffer: ArrayBuffer): string;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/*MIT License
|
|
2
|
+
|
|
3
|
+
© Copyright 2025 Adobe. All rights reserved.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.*/
|
|
22
|
+
export function arrayBufferToHex(buffer) {
|
|
23
|
+
return [...new Uint8Array(buffer)]
|
|
24
|
+
.map((x) => x.toString(16).padStart(2, "0"))
|
|
25
|
+
.join("");
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=array-buffer-to-hex.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"array-buffer-to-hex.js","sourceRoot":"","sources":["../../../../src/cache/functions/hashing/array-buffer-to-hex.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;WAoBW;AACX,MAAM,UAAU,gBAAgB,CAAC,MAAmB;IAChD,OAAO,CAAC,GAAG,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC;SAC7B,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;SAC3C,IAAI,CAAC,EAAE,CAAC,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function arrayBufferToHex(buffer: ArrayBuffer): string;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/*MIT License
|
|
2
|
+
|
|
3
|
+
© Copyright 2025 Adobe. All rights reserved.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.*/
|
|
22
|
+
export function arrayBufferToHex(buffer) {
|
|
23
|
+
return [...new Uint8Array(buffer)]
|
|
24
|
+
.map((x) => x.toString(16).padStart(2, "0"))
|
|
25
|
+
.join("");
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=arrayBufferToHex.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arrayBufferToHex.js","sourceRoot":"","sources":["../../../../src/cache/functions/hashing/arrayBufferToHex.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;WAoBW;AACX,MAAM,UAAU,gBAAgB,CAAC,MAAmB;IAChD,OAAO,CAAC,GAAG,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC;SAC7B,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;SAC3C,IAAI,CAAC,EAAE,CAAC,CAAC;AAClB,CAAC"}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Converts a Blob to a hash using the blob content and type using SHA-256.
|
|
3
3
|
*/
|
|
4
|
+
/**
|
|
5
|
+
* Converts a Blob to a SHA-256 hash.
|
|
6
|
+
* • Uses the streaming `crypto.DigestStream` API when present (no large buffers).
|
|
7
|
+
* • Falls back to the original buffer-based approach otherwise.
|
|
8
|
+
*/
|
|
4
9
|
export declare function blobToHash(blob: Blob): Promise<string>;
|
|
@@ -19,26 +19,52 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
19
19
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
20
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
21
|
SOFTWARE.*/
|
|
22
|
+
import { arrayBufferToHex } from "./array-buffer-to-hex.js";
|
|
22
23
|
import { bufferToHash } from "./buffer-to-hash.js";
|
|
23
24
|
/**
|
|
24
25
|
* Converts a Blob to a hash using the blob content and type using SHA-256.
|
|
25
26
|
*/
|
|
27
|
+
/**
|
|
28
|
+
* Converts a Blob to a SHA-256 hash.
|
|
29
|
+
* • Uses the streaming `crypto.DigestStream` API when present (no large buffers).
|
|
30
|
+
* • Falls back to the original buffer-based approach otherwise.
|
|
31
|
+
*/
|
|
26
32
|
export async function blobToHash(blob) {
|
|
33
|
+
// ── 1. Streamed path
|
|
34
|
+
if ("DigestStream" in crypto) {
|
|
35
|
+
const digestStream = new crypto.DigestStream("SHA-256");
|
|
36
|
+
// Encode the MIME-type as UTF-16LE
|
|
37
|
+
const tCodes = new Uint16Array(blob.type.length);
|
|
38
|
+
for (let i = 0; i < blob.type.length; i++)
|
|
39
|
+
tCodes[i] = blob.type.charCodeAt(i);
|
|
40
|
+
const tBytes = new Uint8Array(tCodes.buffer);
|
|
41
|
+
// Feed type + blob chunks into the hash
|
|
42
|
+
const writer = digestStream.writable.getWriter();
|
|
43
|
+
await writer.write(tBytes);
|
|
44
|
+
const reader = blob.stream().getReader();
|
|
45
|
+
while (true) {
|
|
46
|
+
const { value, done } = await reader.read();
|
|
47
|
+
if (done)
|
|
48
|
+
break;
|
|
49
|
+
await writer.write(value);
|
|
50
|
+
}
|
|
51
|
+
await writer.close();
|
|
52
|
+
const hashBuf = await digestStream.digest;
|
|
53
|
+
return arrayBufferToHex(hashBuf);
|
|
54
|
+
}
|
|
55
|
+
// ── 2. Fallback
|
|
27
56
|
const { type } = blob;
|
|
28
|
-
// create a single buffer to hold both the type and the blob
|
|
29
57
|
const typeByteLength = type.length * 2;
|
|
30
58
|
const buffer = new ArrayBuffer(typeByteLength + blob.size);
|
|
31
|
-
//
|
|
59
|
+
// Write the MIME-type (UTF-16LE) into the first part of the buffer
|
|
32
60
|
const charView = new Uint16Array(buffer, 0, type.length);
|
|
33
|
-
for (let i = 0
|
|
61
|
+
for (let i = 0; i < type.length; i++)
|
|
34
62
|
charView[i] = type.charCodeAt(i);
|
|
35
|
-
|
|
36
|
-
// write the blob into the second part of the buffer
|
|
63
|
+
// Append the blob bytes
|
|
37
64
|
const byteView = new Uint8Array(buffer);
|
|
38
65
|
const blobArrayBuffer = await blob.arrayBuffer();
|
|
39
66
|
byteView.set(new Uint8Array(blobArrayBuffer), typeByteLength);
|
|
40
|
-
//
|
|
41
|
-
|
|
42
|
-
return hash;
|
|
67
|
+
// Hash the combined buffer
|
|
68
|
+
return bufferToHash(buffer);
|
|
43
69
|
}
|
|
44
70
|
//# sourceMappingURL=blob-to-hash.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blob-to-hash.js","sourceRoot":"","sources":["../../../../src/cache/functions/hashing/blob-to-hash.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;WAoBW;AACX,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,U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EALINGS IN THE
|
|
21
21
|
SOFTWARE.*/
|
|
22
|
-
|
|
23
|
-
return [...new Uint8Array(buffer)]
|
|
24
|
-
.map((x) => x.toString(16).padStart(2, "0"))
|
|
25
|
-
.join("");
|
|
26
|
-
}
|
|
22
|
+
import { arrayBufferToHex } from "./array-buffer-to-hex.js";
|
|
27
23
|
/**
|
|
28
24
|
* Converts an ArrayBuffer to a hash using SHA-256.
|
|
29
25
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buffer-to-hash.js","sourceRoot":"","sources":["../../../../src/cache/functions/hashing/buffer-to-hash.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;WAoBW;AACX,
|
|
1
|
+
{"version":3,"file":"buffer-to-hash.js","sourceRoot":"","sources":["../../../../src/cache/functions/hashing/buffer-to-hash.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;WAoBW;AACX,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5D;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,MAAmB;IACpD,OAAO,gBAAgB,CAAC,MAAM,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;AACzE,CAAC"}
|
|
@@ -21,75 +21,332 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
21
21
|
SOFTWARE.*/
|
|
22
22
|
import { blobToHash } from "./blob-to-hash.js";
|
|
23
23
|
import { jsonToHash } from "./json-to-hash.js";
|
|
24
|
-
import { describe, expect, it } from "vitest";
|
|
24
|
+
import { describe, expect, it, vi, beforeEach, afterEach } from "vitest";
|
|
25
25
|
describe("test hashing", () => {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
45, 255, 128, 0, 1, 33, 33, 85, 129, 250, 245, 12, 33, 89, 7,
|
|
31
|
-
]),
|
|
32
|
-
]),
|
|
33
|
-
new Blob([
|
|
34
|
-
new Uint8Array([
|
|
35
|
-
45, 255, 128, 0, 1, 33, 33, 85, 129, 250, 245, 12, 33, 89, 8,
|
|
36
|
-
]),
|
|
37
|
-
]),
|
|
38
|
-
new Blob(["long text sample here"]),
|
|
39
|
-
new Blob(["long text sample here."]),
|
|
40
|
-
new Blob(["a"]),
|
|
41
|
-
new Blob(["b"]),
|
|
42
|
-
new Blob(["a"], { type: "octet/binary" }),
|
|
43
|
-
new Blob(["a"], { type: "text/plain" }),
|
|
44
|
-
// empty blobs should work
|
|
45
|
-
new Blob([""]),
|
|
46
|
-
new Blob([""], { type: "octet/binary" }),
|
|
47
|
-
new Blob([""], { type: "text/plain" }),
|
|
48
|
-
];
|
|
49
|
-
const hashPromises = blobs.map((blob) => blobToHash(blob));
|
|
50
|
-
const hashes = await Promise.all(hashPromises);
|
|
51
|
-
const unique = new Set(hashes);
|
|
52
|
-
const collisions = hashes.length - unique.size;
|
|
53
|
-
expect(collisions).toBe(0);
|
|
26
|
+
let originalCrypto;
|
|
27
|
+
beforeEach(() => {
|
|
28
|
+
// Store original crypto for restoration
|
|
29
|
+
originalCrypto = crypto;
|
|
54
30
|
});
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
const unique = new Set(hashes);
|
|
64
|
-
expect(unique.size).toBe(1);
|
|
31
|
+
afterEach(() => {
|
|
32
|
+
// Restore original crypto
|
|
33
|
+
Object.defineProperty(window, 'crypto', {
|
|
34
|
+
value: originalCrypto,
|
|
35
|
+
writable: true,
|
|
36
|
+
configurable: true
|
|
37
|
+
});
|
|
38
|
+
vi.restoreAllMocks();
|
|
65
39
|
});
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
40
|
+
describe("blobToHash", () => {
|
|
41
|
+
it("should avoid collisions based on content and type", async () => {
|
|
42
|
+
const blobs = [
|
|
43
|
+
new Blob([
|
|
44
|
+
new Uint8Array([
|
|
45
|
+
45, 255, 128, 0, 1, 33, 33, 85, 129, 250, 245, 12, 33, 89, 7,
|
|
46
|
+
]),
|
|
47
|
+
]),
|
|
48
|
+
new Blob([
|
|
49
|
+
new Uint8Array([
|
|
50
|
+
45, 255, 128, 0, 1, 33, 33, 85, 129, 250, 245, 12, 33, 89, 8,
|
|
51
|
+
]),
|
|
52
|
+
]),
|
|
53
|
+
new Blob(["long text sample here"]),
|
|
54
|
+
new Blob(["long text sample here."]),
|
|
55
|
+
new Blob(["a"]),
|
|
56
|
+
new Blob(["b"]),
|
|
57
|
+
new Blob(["a"], { type: "octet/binary" }),
|
|
58
|
+
new Blob(["a"], { type: "text/plain" }),
|
|
59
|
+
// empty blobs should work
|
|
60
|
+
new Blob([""]),
|
|
61
|
+
new Blob([""], { type: "octet/binary" }),
|
|
62
|
+
new Blob([""], { type: "text/plain" }),
|
|
63
|
+
];
|
|
64
|
+
const hashPromises = blobs.map((blob) => blobToHash(blob));
|
|
65
|
+
const hashes = await Promise.all(hashPromises);
|
|
66
|
+
const unique = new Set(hashes);
|
|
67
|
+
const collisions = hashes.length - unique.size;
|
|
68
|
+
expect(collisions).toBe(0);
|
|
69
|
+
});
|
|
70
|
+
it("should generate consistent hashes", async () => {
|
|
71
|
+
const blobs = [
|
|
72
|
+
new Blob(["long text sample here"], { type: "text/plain" }),
|
|
73
|
+
new Blob(["long text sample here"], { type: "text/plain" }),
|
|
74
|
+
new Blob(["long text sample here"], { type: "text/plain" }),
|
|
75
|
+
];
|
|
76
|
+
const hashPromises = blobs.map((blob) => blobToHash(blob));
|
|
77
|
+
const hashes = await Promise.all(hashPromises);
|
|
78
|
+
const unique = new Set(hashes);
|
|
79
|
+
expect(unique.size).toBe(1);
|
|
80
|
+
});
|
|
81
|
+
it("should handle large blobs efficiently", async () => {
|
|
82
|
+
// Create a large blob (1MB) to test streaming performance
|
|
83
|
+
const largeData = new Uint8Array(1024 * 1024);
|
|
84
|
+
for (let i = 0; i < largeData.length; i++) {
|
|
85
|
+
largeData[i] = i % 256;
|
|
86
|
+
}
|
|
87
|
+
const largeBlob = new Blob([largeData], { type: "application/octet-stream" });
|
|
88
|
+
const startTime = performance.now();
|
|
89
|
+
const hash = await blobToHash(largeBlob);
|
|
90
|
+
const endTime = performance.now();
|
|
91
|
+
expect(hash).toBeDefined();
|
|
92
|
+
expect(hash.length).toBe(64); // SHA-256 hex string length
|
|
93
|
+
expect(endTime - startTime).toBeLessThan(5000); // Should complete within 5 seconds
|
|
94
|
+
});
|
|
95
|
+
it("should handle blobs with complex MIME types", async () => {
|
|
96
|
+
const complexTypes = [
|
|
97
|
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
98
|
+
"image/svg+xml; charset=utf-8",
|
|
99
|
+
"text/html; charset=ISO-8859-1",
|
|
100
|
+
"application/json; version=2.0",
|
|
101
|
+
"multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW"
|
|
102
|
+
];
|
|
103
|
+
const blobs = complexTypes.map(type => new Blob(["test content"], { type }));
|
|
104
|
+
const hashPromises = blobs.map((blob) => blobToHash(blob));
|
|
105
|
+
const hashes = await Promise.all(hashPromises);
|
|
106
|
+
// All should be unique due to different MIME types
|
|
107
|
+
const unique = new Set(hashes);
|
|
108
|
+
expect(unique.size).toBe(complexTypes.length);
|
|
109
|
+
});
|
|
110
|
+
it("should handle empty MIME types", async () => {
|
|
111
|
+
const emptyTypeBlob = new Blob(["content"], { type: "" });
|
|
112
|
+
const hash = await blobToHash(emptyTypeBlob);
|
|
113
|
+
expect(hash).toBeDefined();
|
|
114
|
+
expect(hash.length).toBe(64);
|
|
115
|
+
});
|
|
116
|
+
it("should handle unicode MIME types", async () => {
|
|
117
|
+
const unicodeTypes = [
|
|
118
|
+
"text/plain; charset=utf-8",
|
|
119
|
+
"application/json; charset=utf-16",
|
|
120
|
+
"text/html; charset=iso-8859-1"
|
|
121
|
+
];
|
|
122
|
+
const blobs = unicodeTypes.map(type => new Blob(["test content"], { type }));
|
|
123
|
+
const hashPromises = blobs.map((blob) => blobToHash(blob));
|
|
124
|
+
const hashes = await Promise.all(hashPromises);
|
|
125
|
+
// All should be unique
|
|
126
|
+
const unique = new Set(hashes);
|
|
127
|
+
expect(unique.size).toBe(unicodeTypes.length);
|
|
128
|
+
});
|
|
129
|
+
it("should handle very large MIME types", async () => {
|
|
130
|
+
// Test with extremely long MIME type
|
|
131
|
+
const longMimeType = "application/" + "x".repeat(1000) + "; charset=utf-8";
|
|
132
|
+
const blob = new Blob(["test content"], { type: longMimeType });
|
|
133
|
+
const hash = await blobToHash(blob);
|
|
134
|
+
expect(hash).toBeDefined();
|
|
135
|
+
expect(hash.length).toBe(64);
|
|
136
|
+
});
|
|
137
|
+
it("should handle blobs with special characters in MIME type", async () => {
|
|
138
|
+
const specialMimeTypes = [
|
|
139
|
+
"text/plain; charset=utf-8; boundary=\"----=_NextPart_000_0001_01C12345.ABCDEF12\"",
|
|
140
|
+
"application/json; version=\"2.0\"; encoding=\"utf-8\"",
|
|
141
|
+
"multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW; charset=utf-8"
|
|
142
|
+
];
|
|
143
|
+
const blobs = specialMimeTypes.map(type => new Blob(["test content"], { type }));
|
|
144
|
+
const hashPromises = blobs.map((blob) => blobToHash(blob));
|
|
145
|
+
const hashes = await Promise.all(hashPromises);
|
|
146
|
+
// All should be unique
|
|
147
|
+
const unique = new Set(hashes);
|
|
148
|
+
expect(unique.size).toBe(specialMimeTypes.length);
|
|
149
|
+
});
|
|
150
|
+
describe("streaming path (DigestStream)", () => {
|
|
151
|
+
it("should use DigestStream when available", async () => {
|
|
152
|
+
// Mock DigestStream to verify it's being used
|
|
153
|
+
const mockDigestStream = {
|
|
154
|
+
writable: {
|
|
155
|
+
getWriter: vi.fn().mockReturnValue({
|
|
156
|
+
write: vi.fn().mockResolvedValue(undefined),
|
|
157
|
+
close: vi.fn().mockResolvedValue(undefined)
|
|
158
|
+
})
|
|
159
|
+
},
|
|
160
|
+
digest: Promise.resolve(new ArrayBuffer(32))
|
|
161
|
+
};
|
|
162
|
+
const mockCrypto = {
|
|
163
|
+
...originalCrypto,
|
|
164
|
+
DigestStream: vi.fn().mockImplementation(() => mockDigestStream)
|
|
165
|
+
};
|
|
166
|
+
Object.defineProperty(window, 'crypto', {
|
|
167
|
+
value: mockCrypto,
|
|
168
|
+
writable: true,
|
|
169
|
+
configurable: true
|
|
170
|
+
});
|
|
171
|
+
const blob = new Blob(["test content"], { type: "text/plain" });
|
|
172
|
+
await blobToHash(blob);
|
|
173
|
+
expect(mockCrypto.DigestStream).toHaveBeenCalledWith("SHA-256");
|
|
174
|
+
expect(mockDigestStream.writable.getWriter).toHaveBeenCalled();
|
|
175
|
+
});
|
|
176
|
+
it("should handle streaming errors gracefully", async () => {
|
|
177
|
+
const mockDigestStream = {
|
|
178
|
+
writable: {
|
|
179
|
+
getWriter: vi.fn().mockReturnValue({
|
|
180
|
+
write: vi.fn().mockRejectedValue(new Error("Stream write error")),
|
|
181
|
+
close: vi.fn().mockResolvedValue(undefined)
|
|
182
|
+
})
|
|
183
|
+
},
|
|
184
|
+
digest: Promise.resolve(new ArrayBuffer(32))
|
|
185
|
+
};
|
|
186
|
+
const mockCrypto = {
|
|
187
|
+
...originalCrypto,
|
|
188
|
+
DigestStream: vi.fn().mockImplementation(() => mockDigestStream)
|
|
189
|
+
};
|
|
190
|
+
Object.defineProperty(window, 'crypto', {
|
|
191
|
+
value: mockCrypto,
|
|
192
|
+
writable: true,
|
|
193
|
+
configurable: true
|
|
194
|
+
});
|
|
195
|
+
const blob = new Blob(["test content"], { type: "text/plain" });
|
|
196
|
+
await expect(blobToHash(blob)).rejects.toThrow("Stream write error");
|
|
197
|
+
});
|
|
198
|
+
it("should handle DigestStream digest errors", async () => {
|
|
199
|
+
const mockDigestStream = {
|
|
200
|
+
writable: {
|
|
201
|
+
getWriter: vi.fn().mockReturnValue({
|
|
202
|
+
write: vi.fn().mockResolvedValue(undefined),
|
|
203
|
+
close: vi.fn().mockResolvedValue(undefined)
|
|
204
|
+
})
|
|
205
|
+
},
|
|
206
|
+
get digest() {
|
|
207
|
+
return Promise.reject(new Error("Digest error"));
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
const mockCrypto = {
|
|
211
|
+
...originalCrypto,
|
|
212
|
+
DigestStream: vi.fn().mockImplementation(() => mockDigestStream)
|
|
213
|
+
};
|
|
214
|
+
Object.defineProperty(window, 'crypto', {
|
|
215
|
+
value: mockCrypto,
|
|
216
|
+
writable: true,
|
|
217
|
+
configurable: true
|
|
218
|
+
});
|
|
219
|
+
const blob = new Blob(["test content"], { type: "text/plain" });
|
|
220
|
+
// Handle the unhandled rejection by catching it
|
|
221
|
+
try {
|
|
222
|
+
await blobToHash(blob);
|
|
223
|
+
// If we get here, the test should fail
|
|
224
|
+
expect(true).toBe(false);
|
|
225
|
+
}
|
|
226
|
+
catch (error) {
|
|
227
|
+
expect(error).toBeInstanceOf(Error);
|
|
228
|
+
expect(error.message).toBe("Digest error");
|
|
229
|
+
}
|
|
230
|
+
});
|
|
231
|
+
});
|
|
232
|
+
describe("fallback path (buffer-based)", () => {
|
|
233
|
+
it("should fall back to buffer-based approach when DigestStream unavailable", async () => {
|
|
234
|
+
// Remove DigestStream from crypto but keep subtle
|
|
235
|
+
const mockCrypto = {
|
|
236
|
+
...originalCrypto,
|
|
237
|
+
subtle: originalCrypto.subtle
|
|
238
|
+
};
|
|
239
|
+
delete mockCrypto.DigestStream;
|
|
240
|
+
Object.defineProperty(window, 'crypto', {
|
|
241
|
+
value: mockCrypto,
|
|
242
|
+
writable: true,
|
|
243
|
+
configurable: true
|
|
244
|
+
});
|
|
245
|
+
const blob = new Blob(["test content"], { type: "text/plain" });
|
|
246
|
+
const hash = await blobToHash(blob);
|
|
247
|
+
expect(hash).toBeDefined();
|
|
248
|
+
expect(hash.length).toBe(64);
|
|
249
|
+
});
|
|
250
|
+
it("should handle buffer-based approach with large blobs", async () => {
|
|
251
|
+
// Remove DigestStream from crypto but keep subtle
|
|
252
|
+
const mockCrypto = {
|
|
253
|
+
...originalCrypto,
|
|
254
|
+
subtle: originalCrypto.subtle
|
|
255
|
+
};
|
|
256
|
+
delete mockCrypto.DigestStream;
|
|
257
|
+
Object.defineProperty(window, 'crypto', {
|
|
258
|
+
value: mockCrypto,
|
|
259
|
+
writable: true,
|
|
260
|
+
configurable: true
|
|
261
|
+
});
|
|
262
|
+
// Create a moderately large blob
|
|
263
|
+
const data = new Uint8Array(100 * 1024); // 100KB
|
|
264
|
+
for (let i = 0; i < data.length; i++) {
|
|
265
|
+
data[i] = i % 256;
|
|
266
|
+
}
|
|
267
|
+
const blob = new Blob([data], { type: "application/octet-stream" });
|
|
268
|
+
const hash = await blobToHash(blob);
|
|
269
|
+
expect(hash).toBeDefined();
|
|
270
|
+
expect(hash.length).toBe(64);
|
|
271
|
+
});
|
|
272
|
+
});
|
|
273
|
+
it("should produce same hash regardless of path used", async () => {
|
|
274
|
+
const testBlob = new Blob(["test content"], { type: "text/plain" });
|
|
275
|
+
// Test with streaming path (if available)
|
|
276
|
+
const streamingHash = await blobToHash(testBlob);
|
|
277
|
+
// Test with fallback path
|
|
278
|
+
const mockCrypto = {
|
|
279
|
+
...originalCrypto,
|
|
280
|
+
subtle: originalCrypto.subtle
|
|
281
|
+
};
|
|
282
|
+
delete mockCrypto.DigestStream;
|
|
283
|
+
Object.defineProperty(window, 'crypto', {
|
|
284
|
+
value: mockCrypto,
|
|
285
|
+
writable: true,
|
|
286
|
+
configurable: true
|
|
287
|
+
});
|
|
288
|
+
const fallbackHash = await blobToHash(testBlob);
|
|
289
|
+
// Both should produce the same hash for the same input
|
|
290
|
+
expect(streamingHash).toBe(fallbackHash);
|
|
291
|
+
});
|
|
292
|
+
it("should produce identical hashes for multiple test cases", async () => {
|
|
293
|
+
const testCases = [
|
|
294
|
+
{ content: "simple text", type: "text/plain" },
|
|
295
|
+
{ content: "complex content with special chars: !@#$%^&*()", type: "application/json" },
|
|
296
|
+
{ content: "", type: "text/plain" },
|
|
297
|
+
{ content: "a", type: "" },
|
|
298
|
+
{ content: "very long content ".repeat(100), type: "text/html; charset=utf-8" }
|
|
299
|
+
];
|
|
300
|
+
for (const testCase of testCases) {
|
|
301
|
+
const blob = new Blob([testCase.content], { type: testCase.type });
|
|
302
|
+
// Get streaming hash
|
|
303
|
+
const streamingHash = await blobToHash(blob);
|
|
304
|
+
// Get fallback hash
|
|
305
|
+
const mockCrypto = {
|
|
306
|
+
...originalCrypto,
|
|
307
|
+
subtle: originalCrypto.subtle
|
|
308
|
+
};
|
|
309
|
+
delete mockCrypto.DigestStream;
|
|
310
|
+
Object.defineProperty(window, 'crypto', {
|
|
311
|
+
value: mockCrypto,
|
|
312
|
+
writable: true,
|
|
313
|
+
configurable: true
|
|
314
|
+
});
|
|
315
|
+
const fallbackHash = await blobToHash(blob);
|
|
316
|
+
// Verify they match
|
|
317
|
+
expect(streamingHash).toBe(fallbackHash);
|
|
318
|
+
}
|
|
319
|
+
});
|
|
82
320
|
});
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
321
|
+
describe("jsonToHash", () => {
|
|
322
|
+
it("should avoid collisions", async () => {
|
|
323
|
+
const values = [
|
|
324
|
+
"foo",
|
|
325
|
+
{ a: 1 },
|
|
326
|
+
{},
|
|
327
|
+
[],
|
|
328
|
+
{ a: 2 },
|
|
329
|
+
null,
|
|
330
|
+
"",
|
|
331
|
+
{ alpha: "bravo" },
|
|
332
|
+
];
|
|
333
|
+
const hashPromises = values.map((value) => jsonToHash(value));
|
|
334
|
+
const hashes = await Promise.all(hashPromises);
|
|
335
|
+
const unique = new Set(hashes);
|
|
336
|
+
const collisions = hashes.length - unique.size;
|
|
337
|
+
expect(collisions).toBe(0);
|
|
338
|
+
});
|
|
339
|
+
it("should generate consistent hashes", async () => {
|
|
340
|
+
const values = [
|
|
341
|
+
{ a: 1, b: 2, foo: "bar" },
|
|
342
|
+
{ a: 1, b: 2, foo: "bar" },
|
|
343
|
+
{ a: 1, b: 2, foo: "bar" },
|
|
344
|
+
];
|
|
345
|
+
const hashPromises = values.map((value) => jsonToHash(value));
|
|
346
|
+
const hashes = await Promise.all(hashPromises);
|
|
347
|
+
const unique = new Set(hashes);
|
|
348
|
+
expect(unique.size).toBe(1);
|
|
349
|
+
});
|
|
93
350
|
});
|
|
94
351
|
});
|
|
95
352
|
//# sourceMappingURL=hashing.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hashing.test.js","sourceRoot":"","sources":["../../../../src/cache/functions/hashing/hashing.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;WAoBW;AACX,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAE9C,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;IAC5B,EAAE,CAAC,8DAA8D,EAAE,KAAK,IAAI,EAAE;QAC5E,MAAM,KAAK,GAAG;YACZ,IAAI,IAAI,CAAC;gBACP,IAAI,UAAU,CAAC;oBACb,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC;iBAC7D,C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AC;YAC9D,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;YAC/C,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC;YAC/B,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC9B,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -35,7 +35,7 @@ describe('createArchetype', () => {
|
|
|
35
35
|
const archetype = createArchetype(components, id, entityLocationTable);
|
|
36
36
|
// Verify basic properties
|
|
37
37
|
expect(archetype.id).toBe(id);
|
|
38
|
-
expect(archetype.
|
|
38
|
+
expect(archetype.rowCount).toBe(0);
|
|
39
39
|
expect(archetype.components).toEqual(new Set(['id', 'value']));
|
|
40
40
|
expect(archetype.columns).toHaveProperty('id');
|
|
41
41
|
expect(archetype.columns).toHaveProperty('value');
|
|
@@ -51,13 +51,13 @@ describe('createArchetype', () => {
|
|
|
51
51
|
// Create first entity
|
|
52
52
|
const entity1 = archetype.insert({ value: 42 });
|
|
53
53
|
expect(entity1).toBe(0); // First entity should have id 0
|
|
54
|
-
expect(archetype.
|
|
54
|
+
expect(archetype.rowCount).toBe(1);
|
|
55
55
|
expect(archetype.columns.id.get(0)).toBe(0);
|
|
56
56
|
expect(archetype.columns.value.get(0)).toBe(42);
|
|
57
57
|
// Create second entity
|
|
58
58
|
const entity2 = archetype.insert({ value: 100 });
|
|
59
59
|
expect(entity2).toBe(1); // Second entity should have id 1
|
|
60
|
-
expect(archetype.
|
|
60
|
+
expect(archetype.rowCount).toBe(2);
|
|
61
61
|
expect(archetype.columns.id.get(1)).toBe(1);
|
|
62
62
|
expect(archetype.columns.value.get(1)).toBe(100);
|
|
63
63
|
// Verify entity locations in EntityLocationTable
|
|
@@ -88,7 +88,7 @@ describe('createArchetype', () => {
|
|
|
88
88
|
level: 5,
|
|
89
89
|
});
|
|
90
90
|
expect(entity).toBe(0);
|
|
91
|
-
expect(archetype.
|
|
91
|
+
expect(archetype.rowCount).toBe(1);
|
|
92
92
|
expect(archetype.columns.health.get(0)).toBe(100);
|
|
93
93
|
expect(archetype.columns.mana.get(0)).toBe(50);
|
|
94
94
|
expect(archetype.columns.level.get(0)).toBe(5);
|