velocious 1.0.643 → 1.0.645
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/README.md +21 -10
- package/build/authorization/ability.js +36 -13
- package/build/background-jobs/adapter.js +9 -0
- package/build/background-jobs/main.js +35 -10
- package/build/background-jobs/store.js +217 -38
- package/build/background-jobs/types.js +15 -0
- package/build/configuration-types.js +1 -1
- package/build/configuration.js +45 -9
- package/build/database/drivers/base-column.js +8 -0
- package/build/database/drivers/mssql/sql/update.js +1 -3
- package/build/database/drivers/mysql/sql/update.js +1 -3
- package/build/database/drivers/pgsql/column.js +22 -0
- package/build/database/drivers/pgsql/sql/update.js +1 -3
- package/build/database/drivers/sqlite/sql/alter-table.js +11 -1
- package/build/database/drivers/sqlite/sql/update.js +1 -3
- package/build/database/query/index.js +2 -2
- package/build/database/query/model-class-query.js +26 -10
- package/build/database/query/preloader/has-many.js +4 -1
- package/build/database/query/query-data.js +2 -1
- package/build/database/query/update-base.js +14 -0
- package/build/database/query/with-count.js +3 -1
- package/build/database/record/acts-as-list.js +37 -13
- package/build/database/record/attachments/store.js +336 -26
- package/build/database/record/auditing.js +6 -3
- package/build/database/record/index.js +197 -42
- package/build/database/record/instance-relationships/belongs-to.js +2 -1
- package/build/database/record/validators/uniqueness.js +8 -5
- package/build/environment-handlers/node/cli/commands/generate/frontend-models.js +24 -8
- package/build/frontend-model-controller.js +136 -53
- package/build/frontend-model-resource/base-resource.js +87 -37
- package/build/frontend-model-resource/velocious-attachment-resource.js +98 -31
- package/build/frontend-models/base.js +307 -59
- package/build/frontend-models/preloader.js +6 -3
- package/build/frontend-models/query.js +15 -6
- package/build/frontend-models/resource-definition.js +21 -2
- package/build/frontend-models/use-destroyed-event.js +1 -1
- package/build/frontend-models/use-model-class-event.js +2 -2
- package/build/frontend-models/use-updated-event.js +1 -1
- package/build/frontend-models/websocket-channel.js +256 -93
- package/build/frontend-models/websocket-publishers.js +218 -18
- package/build/http-server/client/websocket-session.js +13 -1
- package/build/http-server/websocket-channel.js +15 -2
- package/build/src/authorization/ability.d.ts +9 -3
- package/build/src/authorization/ability.d.ts.map +1 -1
- package/build/src/authorization/ability.js +33 -14
- package/build/src/background-jobs/adapter.d.ts +6 -0
- package/build/src/background-jobs/adapter.d.ts.map +1 -1
- package/build/src/background-jobs/adapter.js +9 -1
- package/build/src/background-jobs/main.d.ts +6 -0
- package/build/src/background-jobs/main.d.ts.map +1 -1
- package/build/src/background-jobs/main.js +34 -11
- package/build/src/background-jobs/store.d.ts +66 -12
- package/build/src/background-jobs/store.d.ts.map +1 -1
- package/build/src/background-jobs/store.js +191 -35
- package/build/src/background-jobs/types.d.ts +55 -0
- package/build/src/background-jobs/types.d.ts.map +1 -1
- package/build/src/background-jobs/types.js +16 -1
- package/build/src/configuration-types.d.ts +3 -3
- package/build/src/configuration-types.d.ts.map +1 -1
- package/build/src/configuration-types.js +2 -2
- package/build/src/configuration.d.ts +18 -8
- package/build/src/configuration.d.ts.map +1 -1
- package/build/src/configuration.js +38 -7
- package/build/src/database/drivers/base-column.d.ts +5 -0
- package/build/src/database/drivers/base-column.d.ts.map +1 -1
- package/build/src/database/drivers/base-column.js +8 -1
- package/build/src/database/drivers/mssql/sql/update.d.ts.map +1 -1
- package/build/src/database/drivers/mssql/sql/update.js +2 -4
- package/build/src/database/drivers/mysql/sql/update.d.ts.map +1 -1
- package/build/src/database/drivers/mysql/sql/update.js +2 -4
- package/build/src/database/drivers/pgsql/column.d.ts +5 -0
- package/build/src/database/drivers/pgsql/column.d.ts.map +1 -1
- package/build/src/database/drivers/pgsql/column.js +19 -1
- package/build/src/database/drivers/pgsql/sql/update.d.ts.map +1 -1
- package/build/src/database/drivers/pgsql/sql/update.js +2 -4
- package/build/src/database/drivers/sqlite/sql/alter-table.d.ts.map +1 -1
- package/build/src/database/drivers/sqlite/sql/alter-table.js +6 -2
- package/build/src/database/drivers/sqlite/sql/update.d.ts.map +1 -1
- package/build/src/database/drivers/sqlite/sql/update.js +2 -4
- package/build/src/database/query/index.d.ts +4 -4
- package/build/src/database/query/index.d.ts.map +1 -1
- package/build/src/database/query/index.js +3 -3
- package/build/src/database/query/model-class-query.d.ts +8 -2
- package/build/src/database/query/model-class-query.d.ts.map +1 -1
- package/build/src/database/query/model-class-query.js +25 -11
- package/build/src/database/query/preloader/has-many.d.ts.map +1 -1
- package/build/src/database/query/preloader/has-many.js +4 -2
- package/build/src/database/query/query-data.d.ts.map +1 -1
- package/build/src/database/query/query-data.js +3 -2
- package/build/src/database/query/update-base.d.ts +7 -0
- package/build/src/database/query/update-base.d.ts.map +1 -1
- package/build/src/database/query/update-base.js +13 -1
- package/build/src/database/query/with-count.d.ts.map +1 -1
- package/build/src/database/query/with-count.js +3 -2
- package/build/src/database/record/acts-as-list.d.ts.map +1 -1
- package/build/src/database/record/acts-as-list.js +35 -14
- package/build/src/database/record/attachments/store.d.ts +67 -0
- package/build/src/database/record/attachments/store.d.ts.map +1 -1
- package/build/src/database/record/attachments/store.js +301 -25
- package/build/src/database/record/auditing.d.ts.map +1 -1
- package/build/src/database/record/auditing.js +7 -4
- package/build/src/database/record/index.d.ts +78 -26
- package/build/src/database/record/index.d.ts.map +1 -1
- package/build/src/database/record/index.js +171 -42
- package/build/src/database/record/instance-relationships/belongs-to.d.ts.map +1 -1
- package/build/src/database/record/instance-relationships/belongs-to.js +3 -2
- package/build/src/database/record/validators/uniqueness.d.ts.map +1 -1
- package/build/src/database/record/validators/uniqueness.js +8 -6
- package/build/src/environment-handlers/node/cli/commands/generate/frontend-models.d.ts +4 -4
- package/build/src/environment-handlers/node/cli/commands/generate/frontend-models.d.ts.map +1 -1
- package/build/src/environment-handlers/node/cli/commands/generate/frontend-models.js +24 -12
- package/build/src/frontend-model-controller.d.ts +29 -8
- package/build/src/frontend-model-controller.d.ts.map +1 -1
- package/build/src/frontend-model-controller.js +122 -51
- package/build/src/frontend-model-resource/base-resource.d.ts +51 -24
- package/build/src/frontend-model-resource/base-resource.d.ts.map +1 -1
- package/build/src/frontend-model-resource/base-resource.js +83 -37
- package/build/src/frontend-model-resource/velocious-attachment-resource.d.ts +45 -26
- package/build/src/frontend-model-resource/velocious-attachment-resource.d.ts.map +1 -1
- package/build/src/frontend-model-resource/velocious-attachment-resource.js +89 -31
- package/build/src/frontend-models/base.d.ts +53 -20
- package/build/src/frontend-models/base.d.ts.map +1 -1
- package/build/src/frontend-models/base.js +275 -59
- package/build/src/frontend-models/preloader.d.ts.map +1 -1
- package/build/src/frontend-models/preloader.js +6 -4
- package/build/src/frontend-models/query.d.ts +2 -2
- package/build/src/frontend-models/query.d.ts.map +1 -1
- package/build/src/frontend-models/query.js +14 -7
- package/build/src/frontend-models/resource-definition.d.ts.map +1 -1
- package/build/src/frontend-models/resource-definition.js +20 -3
- package/build/src/frontend-models/use-destroyed-event.d.ts +1 -1
- package/build/src/frontend-models/use-destroyed-event.d.ts.map +1 -1
- package/build/src/frontend-models/use-destroyed-event.js +2 -2
- package/build/src/frontend-models/use-model-class-event.d.ts +2 -2
- package/build/src/frontend-models/use-model-class-event.d.ts.map +1 -1
- package/build/src/frontend-models/use-model-class-event.js +3 -3
- package/build/src/frontend-models/use-updated-event.d.ts +1 -1
- package/build/src/frontend-models/use-updated-event.d.ts.map +1 -1
- package/build/src/frontend-models/use-updated-event.js +2 -2
- package/build/src/frontend-models/websocket-channel.d.ts +60 -41
- package/build/src/frontend-models/websocket-channel.d.ts.map +1 -1
- package/build/src/frontend-models/websocket-channel.js +225 -85
- package/build/src/frontend-models/websocket-publishers.d.ts +9 -0
- package/build/src/frontend-models/websocket-publishers.d.ts.map +1 -1
- package/build/src/frontend-models/websocket-publishers.js +190 -19
- package/build/src/http-server/client/websocket-session.d.ts.map +1 -1
- package/build/src/http-server/client/websocket-session.js +11 -2
- package/build/src/http-server/websocket-channel.d.ts +20 -8
- package/build/src/http-server/websocket-channel.d.ts.map +1 -1
- package/build/src/http-server/websocket-channel.js +15 -3
- package/build/src/sync/assets/cache.d.ts +288 -0
- package/build/src/sync/assets/cache.d.ts.map +1 -0
- package/build/src/sync/assets/cache.js +883 -0
- package/build/src/sync/assets/types.d.ts +199 -0
- package/build/src/sync/assets/types.d.ts.map +1 -0
- package/build/src/sync/assets/types.js +56 -0
- package/build/src/sync/sync-api-client.d.ts.map +1 -1
- package/build/src/sync/sync-api-client.js +4 -3
- package/build/src/sync/sync-client.d.ts.map +1 -1
- package/build/src/sync/sync-client.js +3 -2
- package/build/src/sync/sync-envelope-replay-service.d.ts.map +1 -1
- package/build/src/sync/sync-envelope-replay-service.js +6 -5
- package/build/src/sync/sync-publisher.d.ts.map +1 -1
- package/build/src/sync/sync-publisher.js +4 -3
- package/build/src/testing/browser-frontend-model-event-hook-scenarios.d.ts +2 -2
- package/build/src/testing/browser-frontend-model-event-hook-scenarios.d.ts.map +1 -1
- package/build/src/testing/browser-frontend-model-event-hook-scenarios.js +3 -3
- package/build/src/testing/test-profiler.d.ts +4 -4
- package/build/src/testing/test-profiler.d.ts.map +1 -1
- package/build/src/testing/test-profiler.js +3 -3
- package/build/src/testing/test-runner.d.ts +279 -117
- package/build/src/testing/test-runner.d.ts.map +1 -1
- package/build/src/testing/test-runner.js +503 -933
- package/build/src/testing/test.d.ts +11 -72
- package/build/src/testing/test.d.ts.map +1 -1
- package/build/src/testing/test.js +131 -284
- package/build/src/testing/velocious-attempt-executor.d.ts +54 -0
- package/build/src/testing/velocious-attempt-executor.d.ts.map +1 -0
- package/build/src/testing/velocious-attempt-executor.js +408 -0
- package/build/src/testing/velocious-runner-reporter.d.ts +67 -0
- package/build/src/testing/velocious-runner-reporter.d.ts.map +1 -0
- package/build/src/testing/velocious-runner-reporter.js +240 -0
- package/build/src/testing/velocious-suite-hook-executor.d.ts +19 -0
- package/build/src/testing/velocious-suite-hook-executor.d.ts.map +1 -0
- package/build/src/testing/velocious-suite-hook-executor.js +41 -0
- package/build/src/testing/velocious-test-arguments.d.ts +39 -0
- package/build/src/testing/velocious-test-arguments.d.ts.map +1 -0
- package/build/src/testing/velocious-test-arguments.js +55 -0
- package/build/src/utils/model-primary-key.d.ts +73 -0
- package/build/src/utils/model-primary-key.d.ts.map +1 -0
- package/build/src/utils/model-primary-key.js +144 -0
- package/build/src/utils/sha256-bytes-hex.d.ts +7 -0
- package/build/src/utils/sha256-bytes-hex.d.ts.map +1 -0
- package/build/src/utils/sha256-bytes-hex.js +117 -0
- package/build/src/utils/sha256-hex.d.ts +2 -4
- package/build/src/utils/sha256-hex.d.ts.map +1 -1
- package/build/src/utils/sha256-hex.js +6 -120
- package/build/sync/assets/cache.js +998 -0
- package/build/sync/assets/types.js +62 -0
- package/build/sync/sync-api-client.js +3 -2
- package/build/sync/sync-client.js +2 -1
- package/build/sync/sync-envelope-replay-service.js +5 -4
- package/build/sync/sync-publisher.js +3 -2
- package/build/testing/browser-frontend-model-event-hook-scenarios.js +2 -2
- package/build/testing/test-profiler.js +2 -2
- package/build/testing/test-runner.js +496 -990
- package/build/testing/test.js +164 -306
- package/build/testing/velocious-attempt-executor.js +441 -0
- package/build/testing/velocious-runner-reporter.js +264 -0
- package/build/testing/velocious-suite-hook-executor.js +43 -0
- package/build/testing/velocious-test-arguments.js +64 -0
- package/build/tsconfig.tsbuildinfo +1 -1
- package/build/utils/model-primary-key.js +171 -0
- package/build/utils/sha256-bytes-hex.js +132 -0
- package/build/utils/sha256-hex.js +7 -135
- package/package.json +5 -4
- package/src/authorization/ability.js +36 -13
- package/src/background-jobs/adapter.js +9 -0
- package/src/background-jobs/main.js +35 -10
- package/src/background-jobs/store.js +217 -38
- package/src/background-jobs/types.js +15 -0
- package/src/configuration-types.js +1 -1
- package/src/configuration.js +45 -9
- package/src/database/drivers/base-column.js +8 -0
- package/src/database/drivers/mssql/sql/update.js +1 -3
- package/src/database/drivers/mysql/sql/update.js +1 -3
- package/src/database/drivers/pgsql/column.js +22 -0
- package/src/database/drivers/pgsql/sql/update.js +1 -3
- package/src/database/drivers/sqlite/sql/alter-table.js +11 -1
- package/src/database/drivers/sqlite/sql/update.js +1 -3
- package/src/database/query/index.js +2 -2
- package/src/database/query/model-class-query.js +26 -10
- package/src/database/query/preloader/has-many.js +4 -1
- package/src/database/query/query-data.js +2 -1
- package/src/database/query/update-base.js +14 -0
- package/src/database/query/with-count.js +3 -1
- package/src/database/record/acts-as-list.js +37 -13
- package/src/database/record/attachments/store.js +336 -26
- package/src/database/record/auditing.js +6 -3
- package/src/database/record/index.js +197 -42
- package/src/database/record/instance-relationships/belongs-to.js +2 -1
- package/src/database/record/validators/uniqueness.js +8 -5
- package/src/environment-handlers/node/cli/commands/generate/frontend-models.js +24 -8
- package/src/frontend-model-controller.js +136 -53
- package/src/frontend-model-resource/base-resource.js +87 -37
- package/src/frontend-model-resource/velocious-attachment-resource.js +98 -31
- package/src/frontend-models/base.js +307 -59
- package/src/frontend-models/preloader.js +6 -3
- package/src/frontend-models/query.js +15 -6
- package/src/frontend-models/resource-definition.js +21 -2
- package/src/frontend-models/use-destroyed-event.js +1 -1
- package/src/frontend-models/use-model-class-event.js +2 -2
- package/src/frontend-models/use-updated-event.js +1 -1
- package/src/frontend-models/websocket-channel.js +256 -93
- package/src/frontend-models/websocket-publishers.js +218 -18
- package/src/http-server/client/websocket-session.js +13 -1
- package/src/http-server/websocket-channel.js +15 -2
- package/src/sync/assets/cache.js +998 -0
- package/src/sync/assets/types.js +62 -0
- package/src/sync/sync-api-client.js +3 -2
- package/src/sync/sync-client.js +2 -1
- package/src/sync/sync-envelope-replay-service.js +5 -4
- package/src/sync/sync-publisher.js +3 -2
- package/src/testing/browser-frontend-model-event-hook-scenarios.js +2 -2
- package/src/testing/test-profiler.js +2 -2
- package/src/testing/test-runner.js +496 -990
- package/src/testing/test.js +164 -306
- package/src/testing/velocious-attempt-executor.js +441 -0
- package/src/testing/velocious-runner-reporter.js +264 -0
- package/src/testing/velocious-suite-hook-executor.js +43 -0
- package/src/testing/velocious-test-arguments.js +64 -0
- package/src/utils/model-primary-key.js +171 -0
- package/src/utils/sha256-bytes-hex.js +132 -0
- package/src/utils/sha256-hex.js +7 -135
- package/build/src/testing/testing-package-adapter.d.ts +0 -9
- package/build/src/testing/testing-package-adapter.d.ts.map +0 -1
- package/build/src/testing/testing-package-adapter.js +0 -69
- package/build/testing/testing-package-adapter.js +0 -76
- package/src/testing/testing-package-adapter.js +0 -76
package/src/utils/sha256-hex.js
CHANGED
|
@@ -1,141 +1,13 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
|
|
3
|
+
import sha256BytesHex from "./sha256-bytes-hex.js"
|
|
4
|
+
|
|
1
5
|
/**
|
|
2
6
|
* Computes SHA-256 without importing Node-only crypto modules, keeping this
|
|
3
|
-
* module safe for Expo/browser bundles.
|
|
4
|
-
* pure-JavaScript SHA-256 derived from FIPS 180-4, using only 32-bit unsigned
|
|
5
|
-
* integer arithmetic.
|
|
7
|
+
* module safe for Expo/browser bundles.
|
|
6
8
|
* @param {string} message - UTF-8 message.
|
|
7
|
-
* @returns {string}
|
|
9
|
+
* @returns {string} Hex digest.
|
|
8
10
|
*/
|
|
9
11
|
export default function sha256Hex(message) {
|
|
10
|
-
|
|
11
|
-
const padded = [...bytes]
|
|
12
|
-
const bitLength = bytes.length * 8
|
|
13
|
-
const hash = [...SHA256_INITIAL_HASH]
|
|
14
|
-
/** @type {number[]} */
|
|
15
|
-
const words = new Array(64)
|
|
16
|
-
|
|
17
|
-
padded.push(0x80)
|
|
18
|
-
while (padded.length % 64 !== 56) padded.push(0)
|
|
19
|
-
|
|
20
|
-
const highLength = Math.floor(bitLength / 0x100000000)
|
|
21
|
-
const lowLength = bitLength >>> 0
|
|
22
|
-
|
|
23
|
-
for (const value of [highLength, lowLength]) {
|
|
24
|
-
padded.push((value >>> 24) & 0xff, (value >>> 16) & 0xff, (value >>> 8) & 0xff, value & 0xff)
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
for (let offset = 0; offset < padded.length; offset += 64) {
|
|
28
|
-
for (let i = 0; i < 16; i++) {
|
|
29
|
-
const index = offset + (i * 4)
|
|
30
|
-
|
|
31
|
-
words[i] = (((padded[index] || 0) << 24) | ((padded[index + 1] || 0) << 16) | ((padded[index + 2] || 0) << 8) | (padded[index + 3] || 0)) >>> 0
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
for (let i = 16; i < 64; i++) {
|
|
35
|
-
const s0 = rotateRight(words[i - 15], 7) ^ rotateRight(words[i - 15], 18) ^ (words[i - 15] >>> 3)
|
|
36
|
-
const s1 = rotateRight(words[i - 2], 17) ^ rotateRight(words[i - 2], 19) ^ (words[i - 2] >>> 10)
|
|
37
|
-
|
|
38
|
-
words[i] = add32(words[i - 16], s0, words[i - 7], s1)
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
let [a, b, c, d, e, f, g, h] = hash
|
|
42
|
-
|
|
43
|
-
for (let i = 0; i < 64; i++) {
|
|
44
|
-
const s1 = rotateRight(e, 6) ^ rotateRight(e, 11) ^ rotateRight(e, 25)
|
|
45
|
-
const ch = (e & f) ^ ((~e) & g)
|
|
46
|
-
const temp1 = add32(h, s1, ch, SHA256_K[i], words[i])
|
|
47
|
-
const s0 = rotateRight(a, 2) ^ rotateRight(a, 13) ^ rotateRight(a, 22)
|
|
48
|
-
const maj = (a & b) ^ (a & c) ^ (b & c)
|
|
49
|
-
const temp2 = add32(s0, maj)
|
|
50
|
-
|
|
51
|
-
h = g
|
|
52
|
-
g = f
|
|
53
|
-
f = e
|
|
54
|
-
e = add32(d, temp1)
|
|
55
|
-
d = c
|
|
56
|
-
c = b
|
|
57
|
-
b = a
|
|
58
|
-
a = add32(temp1, temp2)
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
hash[0] = add32(hash[0], a)
|
|
62
|
-
hash[1] = add32(hash[1], b)
|
|
63
|
-
hash[2] = add32(hash[2], c)
|
|
64
|
-
hash[3] = add32(hash[3], d)
|
|
65
|
-
hash[4] = add32(hash[4], e)
|
|
66
|
-
hash[5] = add32(hash[5], f)
|
|
67
|
-
hash[6] = add32(hash[6], g)
|
|
68
|
-
hash[7] = add32(hash[7], h)
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
return hash.map((value) => value.toString(16).padStart(8, "0")).join("")
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
const SHA256_INITIAL_HASH = [
|
|
75
|
-
0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a,
|
|
76
|
-
0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19
|
|
77
|
-
]
|
|
78
|
-
|
|
79
|
-
const SHA256_K = [
|
|
80
|
-
0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5,
|
|
81
|
-
0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
|
|
82
|
-
0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,
|
|
83
|
-
0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
|
|
84
|
-
0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc,
|
|
85
|
-
0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
|
|
86
|
-
0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7,
|
|
87
|
-
0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
|
|
88
|
-
0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,
|
|
89
|
-
0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
|
|
90
|
-
0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3,
|
|
91
|
-
0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
|
|
92
|
-
0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5,
|
|
93
|
-
0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
|
|
94
|
-
0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,
|
|
95
|
-
0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
|
|
96
|
-
]
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Converts a string to UTF-8 bytes.
|
|
100
|
-
* @param {string} value - String value.
|
|
101
|
-
* @returns {number[]} - UTF-8 bytes.
|
|
102
|
-
*/
|
|
103
|
-
function utf8Bytes(value) {
|
|
104
|
-
/** @type {number[]} */
|
|
105
|
-
const bytes = []
|
|
106
|
-
|
|
107
|
-
for (const character of value) {
|
|
108
|
-
const codePoint = /** @type {number} */ (character.codePointAt(0))
|
|
109
|
-
|
|
110
|
-
if (codePoint <= 0x7f) {
|
|
111
|
-
bytes.push(codePoint)
|
|
112
|
-
} else if (codePoint <= 0x7ff) {
|
|
113
|
-
bytes.push(0xc0 | (codePoint >>> 6), 0x80 | (codePoint & 0x3f))
|
|
114
|
-
} else if (codePoint <= 0xffff) {
|
|
115
|
-
bytes.push(0xe0 | (codePoint >>> 12), 0x80 | ((codePoint >>> 6) & 0x3f), 0x80 | (codePoint & 0x3f))
|
|
116
|
-
} else {
|
|
117
|
-
bytes.push(0xf0 | (codePoint >>> 18), 0x80 | ((codePoint >>> 12) & 0x3f), 0x80 | ((codePoint >>> 6) & 0x3f), 0x80 | (codePoint & 0x3f))
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
return bytes
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* Adds unsigned 32-bit integers.
|
|
126
|
-
* @param {...number} values - Values to add.
|
|
127
|
-
* @returns {number} - Unsigned 32-bit result.
|
|
128
|
-
*/
|
|
129
|
-
function add32(...values) {
|
|
130
|
-
return values.reduce((sum, value) => (sum + value) >>> 0, 0)
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* Rotates a 32-bit integer right.
|
|
135
|
-
* @param {number} value - Value to rotate.
|
|
136
|
-
* @param {number} bits - Bit count.
|
|
137
|
-
* @returns {number} - Rotated value.
|
|
138
|
-
*/
|
|
139
|
-
function rotateRight(value, bits) {
|
|
140
|
-
return (value >>> bits) | (value << (32 - bits))
|
|
12
|
+
return sha256BytesHex(new TextEncoder().encode(message))
|
|
141
13
|
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { defaultTestContext } from "@velocious/testing";
|
|
2
|
-
export type TestingPackageSuite = (typeof defaultTestContext.registry.suites)[number];
|
|
3
|
-
/**
|
|
4
|
-
* Makes newly imported public-package suites visible to the Velocious runner.
|
|
5
|
-
* @param {import("./test-runner.js").TestsArgument} tests - Velocious root test tree.
|
|
6
|
-
* @returns {void}
|
|
7
|
-
*/
|
|
8
|
-
export declare function synchronizeTestingPackageTests(tests: import("./test-runner.js").TestsArgument): void;
|
|
9
|
-
//# sourceMappingURL=testing-package-adapter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"testing-package-adapter.d.ts","sourceRoot":"","sources":["../../../src/testing/testing-package-adapter.js"],"names":[],"mappings":"AAEA,OAAO,EAAC,kBAAkB,EAAC,MAAM,oBAAoB,CAAA;AAEjD,YAA+D,mBAAmB,GAAxE,CAAC,OAAO,kBAAkB,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAqB;AA0DtF;;;;GAIG;AACH,wBAAgB,8BAA8B,CAAC,KAAK,EAHzC,OAAO,kBAAkB,EAAE,aAGc,GAFvC,IAAI,CAUhB"}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
import { defaultTestContext } from "@velocious/testing";
|
|
3
|
-
/** @typedef {(typeof defaultTestContext.registry.suites)[number]} TestingPackageSuite */
|
|
4
|
-
/** @type {WeakSet<TestingPackageSuite>} */
|
|
5
|
-
const synchronizedSuites = new WeakSet();
|
|
6
|
-
/**
|
|
7
|
-
* Converts public-package declaration options to the legacy runner contract.
|
|
8
|
-
* @param {TestingPackageSuite["options"]} options - Public declaration options.
|
|
9
|
-
* @returns {import("./test-runner.js").TestArgs} - Velocious runner arguments.
|
|
10
|
-
*/
|
|
11
|
-
function runnerArguments(options) {
|
|
12
|
-
const args = { ...options };
|
|
13
|
-
if (args.retry === undefined && typeof args.retries === "number")
|
|
14
|
-
args.retry = args.retries;
|
|
15
|
-
if (args.timeoutSeconds === undefined && typeof args.timeoutMs === "number") {
|
|
16
|
-
args.timeoutSeconds = args.timeoutMs / 1000;
|
|
17
|
-
}
|
|
18
|
-
return args;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Converts one public package suite to the Velocious runner's tree shape.
|
|
22
|
-
* @param {TestingPackageSuite} suite - Public suite declaration.
|
|
23
|
-
* @param {import("./test-runner.js").TestArgs} inheritedArgs - Arguments inherited from the parent scope.
|
|
24
|
-
* @returns {import("./test-runner.js").TestsArgument} - Velocious test tree.
|
|
25
|
-
*/
|
|
26
|
-
function runnerSuite(suite, inheritedArgs) {
|
|
27
|
-
/** @type {Record<string, import("./test-runner.js").TestData>} */
|
|
28
|
-
const suiteTests = {};
|
|
29
|
-
/** @type {Record<string, import("./test-runner.js").TestsArgument>} */
|
|
30
|
-
const nestedSuites = {};
|
|
31
|
-
const suiteArgs = { ...inheritedArgs, ...runnerArguments(suite.options) };
|
|
32
|
-
for (const test of suite.tests) {
|
|
33
|
-
suiteTests[test.name] = {
|
|
34
|
-
args: { ...suiteArgs, ...runnerArguments(test.options) },
|
|
35
|
-
filePath: test.location.filePath,
|
|
36
|
-
function: test.callback,
|
|
37
|
-
line: test.location.line
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
for (const nestedSuite of suite.suites)
|
|
41
|
-
nestedSuites[nestedSuite.name] = runnerSuite(nestedSuite, suiteArgs);
|
|
42
|
-
return {
|
|
43
|
-
afterAlls: suite.hooks.afterAll.map((hook) => ({ callback: hook.callback })),
|
|
44
|
-
afterEaches: suite.hooks.afterEach.map((hook) => ({ callback: hook.callback })),
|
|
45
|
-
args: suiteArgs,
|
|
46
|
-
beforeAlls: suite.hooks.beforeAll.map((hook) => ({ callback: hook.callback })),
|
|
47
|
-
beforeEaches: suite.hooks.beforeEach.map((hook) => ({ callback: hook.callback })),
|
|
48
|
-
filePath: suite.location.filePath,
|
|
49
|
-
line: suite.location.line,
|
|
50
|
-
subs: nestedSuites,
|
|
51
|
-
tests: suiteTests
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Makes newly imported public-package suites visible to the Velocious runner.
|
|
56
|
-
* @param {import("./test-runner.js").TestsArgument} tests - Velocious root test tree.
|
|
57
|
-
* @returns {void}
|
|
58
|
-
*/
|
|
59
|
-
export function synchronizeTestingPackageTests(tests) {
|
|
60
|
-
for (const suite of defaultTestContext.registry.suites) {
|
|
61
|
-
if (synchronizedSuites.has(suite))
|
|
62
|
-
continue;
|
|
63
|
-
if (tests.subs[suite.name])
|
|
64
|
-
throw new Error(`Duplicate test description: ${suite.name}`);
|
|
65
|
-
tests.subs[suite.name] = runnerSuite(suite, tests.args);
|
|
66
|
-
synchronizedSuites.add(suite);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdGluZy1wYWNrYWdlLWFkYXB0ZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvdGVzdGluZy90ZXN0aW5nLXBhY2thZ2UtYWRhcHRlci5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxZQUFZO0FBRVosT0FBTyxFQUFDLGtCQUFrQixFQUFDLE1BQU0sb0JBQW9CLENBQUE7QUFFckQseUZBQXlGO0FBRXpGLDJDQUEyQztBQUMzQyxNQUFNLGtCQUFrQixHQUFHLElBQUksT0FBTyxFQUFFLENBQUE7QUFFeEM7Ozs7R0FJRztBQUNILFNBQVMsZUFBZSxDQUFDLE9BQU87SUFDOUIsTUFBTSxJQUFJLEdBQUcsRUFBQyxHQUFHLE9BQU8sRUFBQyxDQU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4dC5yZWdpc3RyeS5zdWl0ZXMpIHtcbiAgICBpZiAoc3luY2hyb25pemVkU3VpdGVzLmhhcyhzdWl0ZSkpIGNvbnRpbnVlXG4gICAgaWYgKHRlc3RzLnN1YnNbc3VpdGUubmFtZV0pIHRocm93IG5ldyBFcnJvcihgRHVwbGljYXRlIHRlc3QgZGVzY3JpcHRpb246ICR7c3VpdGUubmFtZX1gKVxuXG4gICAgdGVzdHMuc3Vic1tzdWl0ZS5uYW1lXSA9IHJ1bm5lclN1aXRlKHN1aXRlLCB0ZXN0cy5hcmdzKVxuICAgIHN5bmNocm9uaXplZFN1aXRlcy5hZGQoc3VpdGUpXG4gIH1cbn1cbiJdfQ==
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
|
|
3
|
-
import {defaultTestContext} from "@velocious/testing"
|
|
4
|
-
|
|
5
|
-
/** @typedef {(typeof defaultTestContext.registry.suites)[number]} TestingPackageSuite */
|
|
6
|
-
|
|
7
|
-
/** @type {WeakSet<TestingPackageSuite>} */
|
|
8
|
-
const synchronizedSuites = new WeakSet()
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Converts public-package declaration options to the legacy runner contract.
|
|
12
|
-
* @param {TestingPackageSuite["options"]} options - Public declaration options.
|
|
13
|
-
* @returns {import("./test-runner.js").TestArgs} - Velocious runner arguments.
|
|
14
|
-
*/
|
|
15
|
-
function runnerArguments(options) {
|
|
16
|
-
const args = {...options}
|
|
17
|
-
|
|
18
|
-
if (args.retry === undefined && typeof args.retries === "number") args.retry = args.retries
|
|
19
|
-
if (args.timeoutSeconds === undefined && typeof args.timeoutMs === "number") {
|
|
20
|
-
args.timeoutSeconds = args.timeoutMs / 1000
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
return args
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Converts one public package suite to the Velocious runner's tree shape.
|
|
28
|
-
* @param {TestingPackageSuite} suite - Public suite declaration.
|
|
29
|
-
* @param {import("./test-runner.js").TestArgs} inheritedArgs - Arguments inherited from the parent scope.
|
|
30
|
-
* @returns {import("./test-runner.js").TestsArgument} - Velocious test tree.
|
|
31
|
-
*/
|
|
32
|
-
function runnerSuite(suite, inheritedArgs) {
|
|
33
|
-
/** @type {Record<string, import("./test-runner.js").TestData>} */
|
|
34
|
-
const suiteTests = {}
|
|
35
|
-
/** @type {Record<string, import("./test-runner.js").TestsArgument>} */
|
|
36
|
-
const nestedSuites = {}
|
|
37
|
-
const suiteArgs = {...inheritedArgs, ...runnerArguments(suite.options)}
|
|
38
|
-
|
|
39
|
-
for (const test of suite.tests) {
|
|
40
|
-
suiteTests[test.name] = {
|
|
41
|
-
args: {...suiteArgs, ...runnerArguments(test.options)},
|
|
42
|
-
filePath: test.location.filePath,
|
|
43
|
-
function: test.callback,
|
|
44
|
-
line: test.location.line
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
for (const nestedSuite of suite.suites) nestedSuites[nestedSuite.name] = runnerSuite(nestedSuite, suiteArgs)
|
|
49
|
-
|
|
50
|
-
return {
|
|
51
|
-
afterAlls: suite.hooks.afterAll.map((hook) => ({callback: hook.callback})),
|
|
52
|
-
afterEaches: suite.hooks.afterEach.map((hook) => ({callback: hook.callback})),
|
|
53
|
-
args: suiteArgs,
|
|
54
|
-
beforeAlls: suite.hooks.beforeAll.map((hook) => ({callback: hook.callback})),
|
|
55
|
-
beforeEaches: suite.hooks.beforeEach.map((hook) => ({callback: hook.callback})),
|
|
56
|
-
filePath: suite.location.filePath,
|
|
57
|
-
line: suite.location.line,
|
|
58
|
-
subs: nestedSuites,
|
|
59
|
-
tests: suiteTests
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Makes newly imported public-package suites visible to the Velocious runner.
|
|
65
|
-
* @param {import("./test-runner.js").TestsArgument} tests - Velocious root test tree.
|
|
66
|
-
* @returns {void}
|
|
67
|
-
*/
|
|
68
|
-
export function synchronizeTestingPackageTests(tests) {
|
|
69
|
-
for (const suite of defaultTestContext.registry.suites) {
|
|
70
|
-
if (synchronizedSuites.has(suite)) continue
|
|
71
|
-
if (tests.subs[suite.name]) throw new Error(`Duplicate test description: ${suite.name}`)
|
|
72
|
-
|
|
73
|
-
tests.subs[suite.name] = runnerSuite(suite, tests.args)
|
|
74
|
-
synchronizedSuites.add(suite)
|
|
75
|
-
}
|
|
76
|
-
}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
|
|
3
|
-
import {defaultTestContext} from "@velocious/testing"
|
|
4
|
-
|
|
5
|
-
/** @typedef {(typeof defaultTestContext.registry.suites)[number]} TestingPackageSuite */
|
|
6
|
-
|
|
7
|
-
/** @type {WeakSet<TestingPackageSuite>} */
|
|
8
|
-
const synchronizedSuites = new WeakSet()
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Converts public-package declaration options to the legacy runner contract.
|
|
12
|
-
* @param {TestingPackageSuite["options"]} options - Public declaration options.
|
|
13
|
-
* @returns {import("./test-runner.js").TestArgs} - Velocious runner arguments.
|
|
14
|
-
*/
|
|
15
|
-
function runnerArguments(options) {
|
|
16
|
-
const args = {...options}
|
|
17
|
-
|
|
18
|
-
if (args.retry === undefined && typeof args.retries === "number") args.retry = args.retries
|
|
19
|
-
if (args.timeoutSeconds === undefined && typeof args.timeoutMs === "number") {
|
|
20
|
-
args.timeoutSeconds = args.timeoutMs / 1000
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
return args
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Converts one public package suite to the Velocious runner's tree shape.
|
|
28
|
-
* @param {TestingPackageSuite} suite - Public suite declaration.
|
|
29
|
-
* @param {import("./test-runner.js").TestArgs} inheritedArgs - Arguments inherited from the parent scope.
|
|
30
|
-
* @returns {import("./test-runner.js").TestsArgument} - Velocious test tree.
|
|
31
|
-
*/
|
|
32
|
-
function runnerSuite(suite, inheritedArgs) {
|
|
33
|
-
/** @type {Record<string, import("./test-runner.js").TestData>} */
|
|
34
|
-
const suiteTests = {}
|
|
35
|
-
/** @type {Record<string, import("./test-runner.js").TestsArgument>} */
|
|
36
|
-
const nestedSuites = {}
|
|
37
|
-
const suiteArgs = {...inheritedArgs, ...runnerArguments(suite.options)}
|
|
38
|
-
|
|
39
|
-
for (const test of suite.tests) {
|
|
40
|
-
suiteTests[test.name] = {
|
|
41
|
-
args: {...suiteArgs, ...runnerArguments(test.options)},
|
|
42
|
-
filePath: test.location.filePath,
|
|
43
|
-
function: test.callback,
|
|
44
|
-
line: test.location.line
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
for (const nestedSuite of suite.suites) nestedSuites[nestedSuite.name] = runnerSuite(nestedSuite, suiteArgs)
|
|
49
|
-
|
|
50
|
-
return {
|
|
51
|
-
afterAlls: suite.hooks.afterAll.map((hook) => ({callback: hook.callback})),
|
|
52
|
-
afterEaches: suite.hooks.afterEach.map((hook) => ({callback: hook.callback})),
|
|
53
|
-
args: suiteArgs,
|
|
54
|
-
beforeAlls: suite.hooks.beforeAll.map((hook) => ({callback: hook.callback})),
|
|
55
|
-
beforeEaches: suite.hooks.beforeEach.map((hook) => ({callback: hook.callback})),
|
|
56
|
-
filePath: suite.location.filePath,
|
|
57
|
-
line: suite.location.line,
|
|
58
|
-
subs: nestedSuites,
|
|
59
|
-
tests: suiteTests
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Makes newly imported public-package suites visible to the Velocious runner.
|
|
65
|
-
* @param {import("./test-runner.js").TestsArgument} tests - Velocious root test tree.
|
|
66
|
-
* @returns {void}
|
|
67
|
-
*/
|
|
68
|
-
export function synchronizeTestingPackageTests(tests) {
|
|
69
|
-
for (const suite of defaultTestContext.registry.suites) {
|
|
70
|
-
if (synchronizedSuites.has(suite)) continue
|
|
71
|
-
if (tests.subs[suite.name]) throw new Error(`Duplicate test description: ${suite.name}`)
|
|
72
|
-
|
|
73
|
-
tests.subs[suite.name] = runnerSuite(suite, tests.args)
|
|
74
|
-
synchronizedSuites.add(suite)
|
|
75
|
-
}
|
|
76
|
-
}
|