@geonosis/document 0.8.0 → 0.9.1
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 +23 -0
- package/README.md +1 -1
- package/dist/store.cjs +5 -4
- package/dist/store.d.cts +1 -1
- package/dist/store.d.ts +1 -1
- package/dist/store.js +5 -2
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# @geonosis/document
|
|
2
2
|
|
|
3
|
+
## 0.9.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- f422aea: Both now ship their LICENSE in the tarball, as every other package already did.
|
|
8
|
+
|
|
9
|
+
## 0.9.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- 17e58a2: The runtime entries reach no Node API except AsyncLocalStorage, which Workers provides.
|
|
14
|
+
|
|
15
|
+
- **`@geonosis/db`**:
|
|
16
|
+
- `appRoleStatements` derives its SCRAM verifier with Web Crypto, so it now returns `Promise<string[]>`.
|
|
17
|
+
- `defineLog`'s `hash` may return a promise.
|
|
18
|
+
- Migrating moves to the node-only entry `@geonosis/db/migrate`: `migrateFolder(connection, folder, { table })`. `Driver` loses `migrate`, and `nodePostgresDriver` loses `migrationsTable`.
|
|
19
|
+
- **`@geonosis/document`**: `hashOf` is async (Web Crypto SHA-256). The hashes it produces are byte-identical.
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- Updated dependencies [17e58a2]
|
|
24
|
+
- @geonosis/db@0.14.0
|
|
25
|
+
|
|
3
26
|
## 0.8.0
|
|
4
27
|
|
|
5
28
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -145,7 +145,7 @@ prose.
|
|
|
145
145
|
A revision carries `tenant, entity, ref, lineage, version, kind, body, actor, reason, at, prevHash,
|
|
146
146
|
hash` (`kind`: `'committed' | 'retired' | 'reinstated'`) plus `compensationOf` (nullable — the
|
|
147
147
|
version an undo compensates). `at` is the DATABASE clock, never the application's. Every revision's
|
|
148
|
-
`hash` is `hashOf` (`core/hash`, exported) over the canonical form of everything but
|
|
148
|
+
`hash` is `hashOf` (`core/hash`, exported; async, a Web Crypto SHA-256) over the canonical form of everything but
|
|
149
149
|
`compensationOf` — `prevHash` is null only at version 1 of a lineage, so the chain is tamper-evident
|
|
150
150
|
from the first write; a consumer's own archive recomputes the SAME `hashOf`/`canonicalOf`, the one
|
|
151
151
|
canonicaliser both sides use.
|
package/dist/store.cjs
CHANGED
|
@@ -35,9 +35,6 @@ __export(store_exports, {
|
|
|
35
35
|
});
|
|
36
36
|
module.exports = __toCommonJS(store_exports);
|
|
37
37
|
|
|
38
|
-
// src/store/hash.ts
|
|
39
|
-
var import_node_crypto = require("crypto");
|
|
40
|
-
|
|
41
38
|
// src/core/canonical.ts
|
|
42
39
|
var KEY_ORDER = new Intl.Collator("en-US");
|
|
43
40
|
var canonicalOf = (input) => {
|
|
@@ -51,7 +48,11 @@ var canonicalOf = (input) => {
|
|
|
51
48
|
};
|
|
52
49
|
|
|
53
50
|
// src/store/hash.ts
|
|
54
|
-
var hashOf = (payload) =>
|
|
51
|
+
var hashOf = async (payload) => {
|
|
52
|
+
const bytes = new TextEncoder().encode(JSON.stringify(canonicalOf(payload)));
|
|
53
|
+
const digest = new Uint8Array(await crypto.subtle.digest("SHA-256", bytes));
|
|
54
|
+
return Array.from(digest, (byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
55
|
+
};
|
|
55
56
|
|
|
56
57
|
// src/core/document.ts
|
|
57
58
|
var fieldPatterns = {
|
package/dist/store.d.cts
CHANGED
|
@@ -5,7 +5,7 @@ import { EntityColumns, EntityName, FreezeRegister, TenantPolicyNames, SessionSe
|
|
|
5
5
|
export { AggregateRow, ENTITY_PLACEHOLDERS as DOCUMENT_MIGRATION_PLACEHOLDERS } from '@geonosis/db';
|
|
6
6
|
|
|
7
7
|
/** sha256 hex over the canonical JSON of `payload` — no whitespace, keys sorted recursively. */
|
|
8
|
-
declare const hashOf: (payload: unknown) => string
|
|
8
|
+
declare const hashOf: (payload: unknown) => Promise<string>;
|
|
9
9
|
|
|
10
10
|
declare const DEFAULT_DOCUMENT_TABLE = "documents";
|
|
11
11
|
declare const DEFAULT_REVISIONS_TABLE = "document_revisions";
|
package/dist/store.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { EntityColumns, EntityName, FreezeRegister, TenantPolicyNames, SessionSe
|
|
|
5
5
|
export { AggregateRow, ENTITY_PLACEHOLDERS as DOCUMENT_MIGRATION_PLACEHOLDERS } from '@geonosis/db';
|
|
6
6
|
|
|
7
7
|
/** sha256 hex over the canonical JSON of `payload` — no whitespace, keys sorted recursively. */
|
|
8
|
-
declare const hashOf: (payload: unknown) => string
|
|
8
|
+
declare const hashOf: (payload: unknown) => Promise<string>;
|
|
9
9
|
|
|
10
10
|
declare const DEFAULT_DOCUMENT_TABLE = "documents";
|
|
11
11
|
declare const DEFAULT_REVISIONS_TABLE = "document_revisions";
|
package/dist/store.js
CHANGED
|
@@ -20,8 +20,11 @@ import {
|
|
|
20
20
|
} from "./chunk-NA3DLROL.js";
|
|
21
21
|
|
|
22
22
|
// src/store/hash.ts
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
var hashOf = async (payload) => {
|
|
24
|
+
const bytes = new TextEncoder().encode(JSON.stringify(canonicalOf(payload)));
|
|
25
|
+
const digest = new Uint8Array(await crypto.subtle.digest("SHA-256", bytes));
|
|
26
|
+
return Array.from(digest, (byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
27
|
+
};
|
|
25
28
|
|
|
26
29
|
// src/surface/table.ts
|
|
27
30
|
var doorFor = (store, name) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geonosis/document",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.1",
|
|
4
4
|
"types": "./dist/index.d.ts",
|
|
5
5
|
"description": "The abstract Document: an entity-first base every kind of paper-trail record extends, a derived entity registry whose name union keeps every consumer map total, and per-entity body versioning — engine-free, SQL-free, the pure core the store, the workflows and the wire contract build on.",
|
|
6
6
|
"keywords": [
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"dependencies": {
|
|
61
61
|
"@standard-schema/spec": "^1.1.0",
|
|
62
62
|
"better-result": "^3.0.0",
|
|
63
|
-
"@geonosis/db": "^0.
|
|
63
|
+
"@geonosis/db": "^0.14.1",
|
|
64
64
|
"@geonosis/workflows": "^0.6.0"
|
|
65
65
|
},
|
|
66
66
|
"peerDependencies": {
|