@twin.org/auditable-item-graph-service 0.10.1-next.4 → 0.10.1-next.6
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/es/utils/auditableItemGraphVertexIndexHelper.js +4 -3
- package/dist/es/utils/auditableItemGraphVertexIndexHelper.js.map +1 -1
- package/dist/types/utils/auditableItemGraphVertexIndexHelper.d.ts +1 -0
- package/docs/changelog.md +28 -0
- package/docs/reference/classes/AuditableItemGraphVertexIndexHelper.md +1 -0
- package/package.json +2 -2
|
@@ -9,6 +9,7 @@ export class AuditableItemGraphVertexIndexHelper {
|
|
|
9
9
|
/**
|
|
10
10
|
* Create the index entry for one type and value of a vertex. The value is case folded and
|
|
11
11
|
* hashed, and the id is derived from the content so the same entry always produces the same id.
|
|
12
|
+
* The modification date is excluded from the id as it is optional and changes over time.
|
|
12
13
|
* @param vertexId The id of the vertex the entry refers to.
|
|
13
14
|
* @param type The index type.
|
|
14
15
|
* @param value The index value.
|
|
@@ -23,12 +24,12 @@ export class AuditableItemGraphVertexIndexHelper {
|
|
|
23
24
|
type,
|
|
24
25
|
value: foldedValue ?? value,
|
|
25
26
|
valueHash: AuditableItemGraphVertexIndexHelper.hashValue(foldedValue) ?? "",
|
|
26
|
-
dateCreated
|
|
27
|
-
dateModified
|
|
27
|
+
dateCreated
|
|
28
28
|
};
|
|
29
29
|
return {
|
|
30
30
|
id: Converter.bytesToHex(Blake2b.sum256(ObjectHelper.toBytes(JsonHelper.canonicalize(entry)))),
|
|
31
|
-
...entry
|
|
31
|
+
...entry,
|
|
32
|
+
dateModified
|
|
32
33
|
};
|
|
33
34
|
}
|
|
34
35
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auditableItemGraphVertexIndexHelper.js","sourceRoot":"","sources":["../../../src/utils/auditableItemGraphVertexIndexHelper.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,SAAS,EAAE,EAAE,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACzE,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAG3C;;GAEG;AACH,MAAM,OAAO,mCAAmC;IAC/C
|
|
1
|
+
{"version":3,"file":"auditableItemGraphVertexIndexHelper.js","sourceRoot":"","sources":["../../../src/utils/auditableItemGraphVertexIndexHelper.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,SAAS,EAAE,EAAE,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACzE,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAG3C;;GAEG;AACH,MAAM,OAAO,mCAAmC;IAC/C;;;;;;;;;;OAUG;IACI,MAAM,CAAC,gBAAgB,CAC7B,QAAgB,EAChB,IAAY,EACZ,KAAa,EACb,WAAmB,EACnB,YAAqB;QAErB,MAAM,WAAW,GAAG,mCAAmC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QAEzE,MAAM,KAAK,GAA+D;YACzE,QAAQ;YACR,IAAI;YACJ,KAAK,EAAE,WAAW,IAAI,KAAK;YAC3B,SAAS,EAAE,mCAAmC,CAAC,SAAS,CAAC,WAAW,CAAC,IAAI,EAAE;YAC3E,WAAW;SACX,CAAC;QAEF,OAAO;YACN,EAAE,EAAE,SAAS,CAAC,UAAU,CACvB,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,UAAU,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,CACpE;YACD,GAAG,KAAK;YACR,YAAY;SACZ,CAAC;IACH,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,SAAS,CAAC,KAAc;QACrC,MAAM,MAAM,GAAG,mCAAmC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QACpE,OAAO,EAAE,CAAC,WAAW,CAAC,MAAM,CAAC;YAC5B,CAAC,CAAC,SAAS,CAAC,gBAAgB,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC;YAC3E,CAAC,CAAC,SAAS,CAAC;IACd,CAAC;IAED;;;;;OAKG;IACK,MAAM,CAAC,SAAS,CAAC,KAAc;QACtC,OAAO,EAAE,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;IAChE,CAAC;CACD","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { Converter, Is, JsonHelper, ObjectHelper } from \"@twin.org/core\";\nimport { Blake2b } from \"@twin.org/crypto\";\nimport type { AuditableItemGraphVertexIndex } from \"../entities/auditableItemGraphVertexIndex.js\";\n\n/**\n * Helper methods for building auditable item graph vertex index entries.\n */\nexport class AuditableItemGraphVertexIndexHelper {\n\t/**\n\t * Create the index entry for one type and value of a vertex. The value is case folded and\n\t * hashed, and the id is derived from the content so the same entry always produces the same id.\n\t * The modification date is excluded from the id as it is optional and changes over time.\n\t * @param vertexId The id of the vertex the entry refers to.\n\t * @param type The index type.\n\t * @param value The index value.\n\t * @param dateCreated The creation date of the vertex.\n\t * @param dateModified The modification date of the vertex.\n\t * @returns The index entry.\n\t */\n\tpublic static createIndexEntry(\n\t\tvertexId: string,\n\t\ttype: string,\n\t\tvalue: string,\n\t\tdateCreated: string,\n\t\tdateModified?: string\n\t): AuditableItemGraphVertexIndex {\n\t\tconst foldedValue = AuditableItemGraphVertexIndexHelper.foldValue(value);\n\n\t\tconst entry: Omit<AuditableItemGraphVertexIndex, \"id\" | \"dateModified\"> = {\n\t\t\tvertexId,\n\t\t\ttype,\n\t\t\tvalue: foldedValue ?? value,\n\t\t\tvalueHash: AuditableItemGraphVertexIndexHelper.hashValue(foldedValue) ?? \"\",\n\t\t\tdateCreated\n\t\t};\n\n\t\treturn {\n\t\t\tid: Converter.bytesToHex(\n\t\t\t\tBlake2b.sum256(ObjectHelper.toBytes(JsonHelper.canonicalize(entry)))\n\t\t\t),\n\t\t\t...entry,\n\t\t\tdateModified\n\t\t};\n\t}\n\n\t/**\n\t * Hash an index value so the composite index key has a fixed size whatever the value length.\n\t * The value is case folded first so lookups are case insensitive.\n\t * @param value The value to hash.\n\t * @returns The base64 url encoded Blake2b-160 hash, or undefined when there is no value.\n\t */\n\tpublic static hashValue(value?: string): string | undefined {\n\t\tconst folded = AuditableItemGraphVertexIndexHelper.foldValue(value);\n\t\treturn Is.stringValue(folded)\n\t\t\t? Converter.bytesToBase64Url(Blake2b.sum160(Converter.utf8ToBytes(folded)))\n\t\t\t: undefined;\n\t}\n\n\t/**\n\t * Case fold an index value.\n\t * @param value The value to fold.\n\t * @returns The lower cased value, or undefined when there is no value.\n\t * @internal\n\t */\n\tprivate static foldValue(value?: string): string | undefined {\n\t\treturn Is.stringValue(value) ? value.toLowerCase() : undefined;\n\t}\n}\n"]}
|
|
@@ -6,6 +6,7 @@ export declare class AuditableItemGraphVertexIndexHelper {
|
|
|
6
6
|
/**
|
|
7
7
|
* Create the index entry for one type and value of a vertex. The value is case folded and
|
|
8
8
|
* hashed, and the id is derived from the content so the same entry always produces the same id.
|
|
9
|
+
* The modification date is excluded from the id as it is optional and changes over time.
|
|
9
10
|
* @param vertexId The id of the vertex the entry refers to.
|
|
10
11
|
* @param type The index type.
|
|
11
12
|
* @param value The index value.
|
package/docs/changelog.md
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.10.1-next.6](https://github.com/iotaledger/twin-auditable-item-graph/compare/auditable-item-graph-service-v0.10.1-next.5...auditable-item-graph-service-v0.10.1-next.6) (2026-09-26)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Miscellaneous Chores
|
|
7
|
+
|
|
8
|
+
* **auditable-item-graph-service:** Synchronize repo versions
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Dependencies
|
|
12
|
+
|
|
13
|
+
* The following workspace dependencies were updated
|
|
14
|
+
* dependencies
|
|
15
|
+
* @twin.org/auditable-item-graph-models bumped from 0.10.1-next.5 to 0.10.1-next.6
|
|
16
|
+
|
|
17
|
+
## [0.10.1-next.5](https://github.com/iotaledger/twin-auditable-item-graph/compare/auditable-item-graph-service-v0.10.1-next.4...auditable-item-graph-service-v0.10.1-next.5) (2026-09-25)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* deterministic indexes ([fbd8deb](https://github.com/iotaledger/twin-auditable-item-graph/commit/fbd8deb59b61ce93a3a955900969977904cfeeb5))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Dependencies
|
|
26
|
+
|
|
27
|
+
* The following workspace dependencies were updated
|
|
28
|
+
* dependencies
|
|
29
|
+
* @twin.org/auditable-item-graph-models bumped from 0.10.1-next.4 to 0.10.1-next.5
|
|
30
|
+
|
|
3
31
|
## [0.10.1-next.4](https://github.com/iotaledger/twin-auditable-item-graph/compare/auditable-item-graph-service-v0.10.1-next.3...auditable-item-graph-service-v0.10.1-next.4) (2026-09-24)
|
|
4
32
|
|
|
5
33
|
|
|
@@ -20,6 +20,7 @@ Helper methods for building auditable item graph vertex index entries.
|
|
|
20
20
|
|
|
21
21
|
Create the index entry for one type and value of a vertex. The value is case folded and
|
|
22
22
|
hashed, and the id is derived from the content so the same entry always produces the same id.
|
|
23
|
+
The modification date is excluded from the id as it is optional and changes over time.
|
|
23
24
|
|
|
24
25
|
#### Parameters
|
|
25
26
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/auditable-item-graph-service",
|
|
3
|
-
"version": "0.10.1-next.
|
|
3
|
+
"version": "0.10.1-next.6",
|
|
4
4
|
"description": "Implements graph lifecycle operations and audited change tracking with API route definitions.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@twin.org/api-models": "next",
|
|
18
|
-
"@twin.org/auditable-item-graph-models": "0.10.1-next.
|
|
18
|
+
"@twin.org/auditable-item-graph-models": "0.10.1-next.6",
|
|
19
19
|
"@twin.org/context": "next",
|
|
20
20
|
"@twin.org/core": "next",
|
|
21
21
|
"@twin.org/crypto": "next",
|