@3sixty/auditable-item-graph-service 0.0.0-stage → 0.20.0-next.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/LICENSE +201 -0
- package/README.md +26 -2
- package/dist/es/auditableItemGraphRoutes.js +1136 -0
- package/dist/es/auditableItemGraphRoutes.js.map +1 -0
- package/dist/es/auditableItemGraphService.js +1913 -0
- package/dist/es/auditableItemGraphService.js.map +1 -0
- package/dist/es/entities/auditableItemGraphAlias.js +70 -0
- package/dist/es/entities/auditableItemGraphAlias.js.map +1 -0
- package/dist/es/entities/auditableItemGraphChangeset.js +79 -0
- package/dist/es/entities/auditableItemGraphChangeset.js.map +1 -0
- package/dist/es/entities/auditableItemGraphEdge.js +70 -0
- package/dist/es/entities/auditableItemGraphEdge.js.map +1 -0
- package/dist/es/entities/auditableItemGraphPatch.js +45 -0
- package/dist/es/entities/auditableItemGraphPatch.js.map +1 -0
- package/dist/es/entities/auditableItemGraphResource.js +54 -0
- package/dist/es/entities/auditableItemGraphResource.js.map +1 -0
- package/dist/es/entities/auditableItemGraphVertex.js +97 -0
- package/dist/es/entities/auditableItemGraphVertex.js.map +1 -0
- package/dist/es/entities/auditableItemGraphVertexIndex.js +95 -0
- package/dist/es/entities/auditableItemGraphVertexIndex.js.map +1 -0
- package/dist/es/entities/auditableItemGraphVertexV0.js +107 -0
- package/dist/es/entities/auditableItemGraphVertexV0.js.map +1 -0
- package/dist/es/entities/auditableItemGraphVertexV1.js +113 -0
- package/dist/es/entities/auditableItemGraphVertexV1.js.map +1 -0
- package/dist/es/index.js +19 -0
- package/dist/es/index.js.map +1 -0
- package/dist/es/models/IAuditableItemGraphServiceConfig.js +4 -0
- package/dist/es/models/IAuditableItemGraphServiceConfig.js.map +1 -0
- package/dist/es/models/IAuditableItemGraphServiceConstructorOptions.js +2 -0
- package/dist/es/models/IAuditableItemGraphServiceConstructorOptions.js.map +1 -0
- package/dist/es/models/IAuditableItemGraphServiceContext.js +4 -0
- package/dist/es/models/IAuditableItemGraphServiceContext.js.map +1 -0
- package/dist/es/restEntryPoints.js +13 -0
- package/dist/es/restEntryPoints.js.map +1 -0
- package/dist/es/schema.js +27 -0
- package/dist/es/schema.js.map +1 -0
- package/dist/es/utils/auditableItemGraphVertexIndexHelper.js +57 -0
- package/dist/es/utils/auditableItemGraphVertexIndexHelper.js.map +1 -0
- package/dist/types/auditableItemGraphRoutes.d.ts +94 -0
- package/dist/types/auditableItemGraphService.d.ts +164 -0
- package/dist/types/entities/auditableItemGraphAlias.d.ts +34 -0
- package/dist/types/entities/auditableItemGraphChangeset.d.ts +34 -0
- package/dist/types/entities/auditableItemGraphEdge.d.ts +34 -0
- package/dist/types/entities/auditableItemGraphPatch.d.ts +21 -0
- package/dist/types/entities/auditableItemGraphResource.d.ts +26 -0
- package/dist/types/entities/auditableItemGraphVertex.d.ts +50 -0
- package/dist/types/entities/auditableItemGraphVertexIndex.d.ts +39 -0
- package/dist/types/entities/auditableItemGraphVertexV0.d.ts +53 -0
- package/dist/types/entities/auditableItemGraphVertexV1.d.ts +58 -0
- package/dist/types/index.d.ts +16 -0
- package/dist/types/models/IAuditableItemGraphServiceConfig.d.ts +9 -0
- package/dist/types/models/IAuditableItemGraphServiceConstructorOptions.d.ts +38 -0
- package/dist/types/models/IAuditableItemGraphServiceContext.d.ts +17 -0
- package/dist/types/restEntryPoints.d.ts +5 -0
- package/dist/types/schema.d.ts +4 -0
- package/dist/types/utils/auditableItemGraphVertexIndexHelper.d.ts +25 -0
- package/docs/changelog.md +0 -0
- package/docs/examples.md +273 -0
- package/docs/open-api/spec.json +2190 -0
- package/docs/reference/classes/AuditableItemGraphAlias.md +69 -0
- package/docs/reference/classes/AuditableItemGraphChangeset.md +69 -0
- package/docs/reference/classes/AuditableItemGraphEdge.md +69 -0
- package/docs/reference/classes/AuditableItemGraphPatch.md +45 -0
- package/docs/reference/classes/AuditableItemGraphResource.md +53 -0
- package/docs/reference/classes/AuditableItemGraphService.md +539 -0
- package/docs/reference/classes/AuditableItemGraphVertex.md +93 -0
- package/docs/reference/classes/AuditableItemGraphVertexIndex.md +75 -0
- package/docs/reference/classes/AuditableItemGraphVertexIndexHelper.md +84 -0
- package/docs/reference/classes/AuditableItemGraphVertexV0.md +101 -0
- package/docs/reference/classes/AuditableItemGraphVertexV1.md +109 -0
- package/docs/reference/functions/auditableItemGraphChangesetGet.md +31 -0
- package/docs/reference/functions/auditableItemGraphChangesetList.md +31 -0
- package/docs/reference/functions/auditableItemGraphCreate.md +37 -0
- package/docs/reference/functions/auditableItemGraphGet.md +31 -0
- package/docs/reference/functions/auditableItemGraphList.md +31 -0
- package/docs/reference/functions/auditableItemGraphRemoveProof.md +31 -0
- package/docs/reference/functions/auditableItemGraphUpdate.md +31 -0
- package/docs/reference/functions/auditableItemGraphUpdatePartial.md +31 -0
- package/docs/reference/functions/auditableItemGraphVersionGet.md +31 -0
- package/docs/reference/functions/auditableItemGraphVersionList.md +31 -0
- package/docs/reference/functions/generateRestRoutesAuditableItemGraph.md +25 -0
- package/docs/reference/functions/initSchema.md +9 -0
- package/docs/reference/index.md +40 -0
- package/docs/reference/interfaces/IAuditableItemGraphServiceConfig.md +11 -0
- package/docs/reference/interfaces/IAuditableItemGraphServiceConstructorOptions.md +83 -0
- package/docs/reference/variables/restEntryPoints.md +5 -0
- package/docs/reference/variables/tagsAuditableItemGraph.md +5 -0
- package/locales/en.json +34 -0
- package/package.json +64 -5
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// Copyright 2024 IOTA Stiftung.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
3
|
+
import { EntitySchemaFactory, EntitySchemaHelper } from "@3sixty/entity";
|
|
4
|
+
import { AuditableItemGraphAlias } from "./entities/auditableItemGraphAlias.js";
|
|
5
|
+
import { AuditableItemGraphChangeset } from "./entities/auditableItemGraphChangeset.js";
|
|
6
|
+
import { AuditableItemGraphEdge } from "./entities/auditableItemGraphEdge.js";
|
|
7
|
+
import { AuditableItemGraphPatch } from "./entities/auditableItemGraphPatch.js";
|
|
8
|
+
import { AuditableItemGraphResource } from "./entities/auditableItemGraphResource.js";
|
|
9
|
+
import { AuditableItemGraphVertex } from "./entities/auditableItemGraphVertex.js";
|
|
10
|
+
import { AuditableItemGraphVertexIndex } from "./entities/auditableItemGraphVertexIndex.js";
|
|
11
|
+
import { AuditableItemGraphVertexV0 } from "./entities/auditableItemGraphVertexV0.js";
|
|
12
|
+
import { AuditableItemGraphVertexV1 } from "./entities/auditableItemGraphVertexV1.js";
|
|
13
|
+
/**
|
|
14
|
+
* Initialize the schema for the auditable item graph entity storage connector.
|
|
15
|
+
*/
|
|
16
|
+
export function initSchema() {
|
|
17
|
+
EntitySchemaFactory.register("AuditableItemGraphVertex", () => EntitySchemaHelper.getSchema(AuditableItemGraphVertex));
|
|
18
|
+
EntitySchemaFactory.register("AuditableItemGraphVertexV0", () => EntitySchemaHelper.getSchema(AuditableItemGraphVertexV0));
|
|
19
|
+
EntitySchemaFactory.register("AuditableItemGraphVertexV1", () => EntitySchemaHelper.getSchema(AuditableItemGraphVertexV1));
|
|
20
|
+
EntitySchemaFactory.register("AuditableItemGraphVertexIndex", () => EntitySchemaHelper.getSchema(AuditableItemGraphVertexIndex));
|
|
21
|
+
EntitySchemaFactory.register("AuditableItemGraphAlias", () => EntitySchemaHelper.getSchema(AuditableItemGraphAlias));
|
|
22
|
+
EntitySchemaFactory.register("AuditableItemGraphResource", () => EntitySchemaHelper.getSchema(AuditableItemGraphResource));
|
|
23
|
+
EntitySchemaFactory.register("AuditableItemGraphEdge", () => EntitySchemaHelper.getSchema(AuditableItemGraphEdge));
|
|
24
|
+
EntitySchemaFactory.register("AuditableItemGraphChangeset", () => EntitySchemaHelper.getSchema(AuditableItemGraphChangeset));
|
|
25
|
+
EntitySchemaFactory.register("AuditableItemGraphPatch", () => EntitySchemaHelper.getSchema(AuditableItemGraphPatch));
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/schema.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAChF,OAAO,EAAE,2BAA2B,EAAE,MAAM,2CAA2C,CAAC;AACxF,OAAO,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAC9E,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAChF,OAAO,EAAE,0BAA0B,EAAE,MAAM,0CAA0C,CAAC;AACtF,OAAO,EAAE,wBAAwB,EAAE,MAAM,wCAAwC,CAAC;AAClF,OAAO,EAAE,6BAA6B,EAAE,MAAM,6CAA6C,CAAC;AAC5F,OAAO,EAAE,0BAA0B,EAAE,MAAM,0CAA0C,CAAC;AACtF,OAAO,EAAE,0BAA0B,EAAE,MAAM,0CAA0C,CAAC;AAEtF;;GAEG;AACH,MAAM,UAAU,UAAU;IACzB,mBAAmB,CAAC,QAAQ,6BAAqC,GAAG,EAAE,CACrE,kBAAkB,CAAC,SAAS,CAAC,wBAAwB,CAAC,CACtD,CAAC;IACF,mBAAmB,CAAC,QAAQ,+BAAuC,GAAG,EAAE,CACvE,kBAAkB,CAAC,SAAS,CAAC,0BAA0B,CAAC,CACxD,CAAC;IACF,mBAAmB,CAAC,QAAQ,+BAAuC,GAAG,EAAE,CACvE,kBAAkB,CAAC,SAAS,CAAC,0BAA0B,CAAC,CACxD,CAAC;IACF,mBAAmB,CAAC,QAAQ,kCAA0C,GAAG,EAAE,CAC1E,kBAAkB,CAAC,SAAS,CAAC,6BAA6B,CAAC,CAC3D,CAAC;IACF,mBAAmB,CAAC,QAAQ,4BAAoC,GAAG,EAAE,CACpE,kBAAkB,CAAC,SAAS,CAAC,uBAAuB,CAAC,CACrD,CAAC;IACF,mBAAmB,CAAC,QAAQ,+BAAuC,GAAG,EAAE,CACvE,kBAAkB,CAAC,SAAS,CAAC,0BAA0B,CAAC,CACxD,CAAC;IACF,mBAAmB,CAAC,QAAQ,2BAAmC,GAAG,EAAE,CACnE,kBAAkB,CAAC,SAAS,CAAC,sBAAsB,CAAC,CACpD,CAAC;IACF,mBAAmB,CAAC,QAAQ,gCAAwC,GAAG,EAAE,CACxE,kBAAkB,CAAC,SAAS,CAAC,2BAA2B,CAAC,CACzD,CAAC;IACF,mBAAmB,CAAC,QAAQ,4BAAoC,GAAG,EAAE,CACpE,kBAAkB,CAAC,SAAS,CAAC,uBAAuB,CAAC,CACrD,CAAC;AACH,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { EntitySchemaFactory, EntitySchemaHelper } from \"@3sixty/entity\";\nimport { nameof } from \"@3sixty/nameof\";\nimport { AuditableItemGraphAlias } from \"./entities/auditableItemGraphAlias.js\";\nimport { AuditableItemGraphChangeset } from \"./entities/auditableItemGraphChangeset.js\";\nimport { AuditableItemGraphEdge } from \"./entities/auditableItemGraphEdge.js\";\nimport { AuditableItemGraphPatch } from \"./entities/auditableItemGraphPatch.js\";\nimport { AuditableItemGraphResource } from \"./entities/auditableItemGraphResource.js\";\nimport { AuditableItemGraphVertex } from \"./entities/auditableItemGraphVertex.js\";\nimport { AuditableItemGraphVertexIndex } from \"./entities/auditableItemGraphVertexIndex.js\";\nimport { AuditableItemGraphVertexV0 } from \"./entities/auditableItemGraphVertexV0.js\";\nimport { AuditableItemGraphVertexV1 } from \"./entities/auditableItemGraphVertexV1.js\";\n\n/**\n * Initialize the schema for the auditable item graph entity storage connector.\n */\nexport function initSchema(): void {\n\tEntitySchemaFactory.register(nameof<AuditableItemGraphVertex>(), () =>\n\t\tEntitySchemaHelper.getSchema(AuditableItemGraphVertex)\n\t);\n\tEntitySchemaFactory.register(nameof<AuditableItemGraphVertexV0>(), () =>\n\t\tEntitySchemaHelper.getSchema(AuditableItemGraphVertexV0)\n\t);\n\tEntitySchemaFactory.register(nameof<AuditableItemGraphVertexV1>(), () =>\n\t\tEntitySchemaHelper.getSchema(AuditableItemGraphVertexV1)\n\t);\n\tEntitySchemaFactory.register(nameof<AuditableItemGraphVertexIndex>(), () =>\n\t\tEntitySchemaHelper.getSchema(AuditableItemGraphVertexIndex)\n\t);\n\tEntitySchemaFactory.register(nameof<AuditableItemGraphAlias>(), () =>\n\t\tEntitySchemaHelper.getSchema(AuditableItemGraphAlias)\n\t);\n\tEntitySchemaFactory.register(nameof<AuditableItemGraphResource>(), () =>\n\t\tEntitySchemaHelper.getSchema(AuditableItemGraphResource)\n\t);\n\tEntitySchemaFactory.register(nameof<AuditableItemGraphEdge>(), () =>\n\t\tEntitySchemaHelper.getSchema(AuditableItemGraphEdge)\n\t);\n\tEntitySchemaFactory.register(nameof<AuditableItemGraphChangeset>(), () =>\n\t\tEntitySchemaHelper.getSchema(AuditableItemGraphChangeset)\n\t);\n\tEntitySchemaFactory.register(nameof<AuditableItemGraphPatch>(), () =>\n\t\tEntitySchemaHelper.getSchema(AuditableItemGraphPatch)\n\t);\n}\n"]}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// Copyright 2026 IOTA Stiftung.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
3
|
+
import { Converter, Is, JsonHelper, ObjectHelper } from "@3sixty/core";
|
|
4
|
+
import { Blake2b } from "@3sixty/crypto";
|
|
5
|
+
/**
|
|
6
|
+
* Helper methods for building auditable item graph vertex index entries.
|
|
7
|
+
*/
|
|
8
|
+
export class AuditableItemGraphVertexIndexHelper {
|
|
9
|
+
/**
|
|
10
|
+
* Create the index entry for one type and value of a vertex. The value is case folded and
|
|
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.
|
|
13
|
+
* @param vertexId The id of the vertex the entry refers to.
|
|
14
|
+
* @param type The index type.
|
|
15
|
+
* @param value The index value.
|
|
16
|
+
* @param dateCreated The creation date of the vertex.
|
|
17
|
+
* @param dateModified The modification date of the vertex.
|
|
18
|
+
* @returns The index entry.
|
|
19
|
+
*/
|
|
20
|
+
static createIndexEntry(vertexId, type, value, dateCreated, dateModified) {
|
|
21
|
+
const foldedValue = AuditableItemGraphVertexIndexHelper.foldValue(value);
|
|
22
|
+
const entry = {
|
|
23
|
+
vertexId,
|
|
24
|
+
type,
|
|
25
|
+
value: foldedValue ?? value,
|
|
26
|
+
valueHash: AuditableItemGraphVertexIndexHelper.hashValue(foldedValue) ?? "",
|
|
27
|
+
dateCreated
|
|
28
|
+
};
|
|
29
|
+
return {
|
|
30
|
+
id: Converter.bytesToHex(Blake2b.sum256(ObjectHelper.toBytes(JsonHelper.canonicalize(entry)))),
|
|
31
|
+
...entry,
|
|
32
|
+
dateModified
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Hash an index value so the composite index key has a fixed size whatever the value length.
|
|
37
|
+
* The value is case folded first so lookups are case insensitive.
|
|
38
|
+
* @param value The value to hash.
|
|
39
|
+
* @returns The base64 url encoded Blake2b-160 hash, or undefined when there is no value.
|
|
40
|
+
*/
|
|
41
|
+
static hashValue(value) {
|
|
42
|
+
const folded = AuditableItemGraphVertexIndexHelper.foldValue(value);
|
|
43
|
+
return Is.stringValue(folded)
|
|
44
|
+
? Converter.bytesToBase64Url(Blake2b.sum160(Converter.utf8ToBytes(folded)))
|
|
45
|
+
: undefined;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Case fold an index value.
|
|
49
|
+
* @param value The value to fold.
|
|
50
|
+
* @returns The lower cased value, or undefined when there is no value.
|
|
51
|
+
* @internal
|
|
52
|
+
*/
|
|
53
|
+
static foldValue(value) {
|
|
54
|
+
return Is.stringValue(value) ? value.toLowerCase() : undefined;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=auditableItemGraphVertexIndexHelper.js.map
|
|
@@ -0,0 +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,cAAc,CAAC;AACvE,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAGzC;;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 \"@3sixty/core\";\nimport { Blake2b } from \"@3sixty/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"]}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { type ICreatedResponse, type IHttpRequestContext, type INoContentResponse, type IRestRoute, type ITag } from "@3sixty/api-models";
|
|
2
|
+
import { type IAuditableItemGraphChangesetGetRequest, type IAuditableItemGraphChangesetGetResponse, type IAuditableItemGraphChangesetListRequest, type IAuditableItemGraphChangesetListResponse, type IAuditableItemGraphCreateRequest, type IAuditableItemGraphGetRequest, type IAuditableItemGraphGetResponse, type IAuditableItemGraphListRequest, type IAuditableItemGraphListResponse, type IAuditableItemGraphRemoveProofRequest, type IAuditableItemGraphUpdatePartialRequest, type IAuditableItemGraphUpdateRequest, type IAuditableItemGraphVersionGetRequest, type IAuditableItemGraphVersionGetResponse, type IAuditableItemGraphVersionListRequest, type IAuditableItemGraphVersionListResponse } from "@3sixty/auditable-item-graph-models";
|
|
3
|
+
/**
|
|
4
|
+
* The tag to associate with the routes.
|
|
5
|
+
*/
|
|
6
|
+
export declare const tagsAuditableItemGraph: ITag[];
|
|
7
|
+
/**
|
|
8
|
+
* The REST routes for auditable item graph.
|
|
9
|
+
* @param baseRouteName Prefix to prepend to the paths.
|
|
10
|
+
* @param componentName The name of the component to use in the routes stored in the ComponentFactory.
|
|
11
|
+
* @returns The generated routes.
|
|
12
|
+
*/
|
|
13
|
+
export declare function generateRestRoutesAuditableItemGraph(baseRouteName: string, componentName: string): IRestRoute[];
|
|
14
|
+
/**
|
|
15
|
+
* Create the graph vertex.
|
|
16
|
+
* @param httpRequestContext The request context for the API.
|
|
17
|
+
* @param componentName The name of the component to use in the routes.
|
|
18
|
+
* @param request The request.
|
|
19
|
+
* @param baseRouteName The base route name for the API.
|
|
20
|
+
* @returns The response object with additional http response properties.
|
|
21
|
+
*/
|
|
22
|
+
export declare function auditableItemGraphCreate(httpRequestContext: IHttpRequestContext, componentName: string, request: IAuditableItemGraphCreateRequest, baseRouteName: string): Promise<ICreatedResponse>;
|
|
23
|
+
/**
|
|
24
|
+
* Get the graph vertex.
|
|
25
|
+
* @param httpRequestContext The request context for the API.
|
|
26
|
+
* @param componentName The name of the component to use in the routes.
|
|
27
|
+
* @param request The request.
|
|
28
|
+
* @returns The response object with additional http response properties.
|
|
29
|
+
*/
|
|
30
|
+
export declare function auditableItemGraphGet(httpRequestContext: IHttpRequestContext, componentName: string, request: IAuditableItemGraphGetRequest): Promise<IAuditableItemGraphGetResponse>;
|
|
31
|
+
/**
|
|
32
|
+
* Get the graph vertex changeset list.
|
|
33
|
+
* @param httpRequestContext The request context for the API.
|
|
34
|
+
* @param componentName The name of the component to use in the routes.
|
|
35
|
+
* @param request The request.
|
|
36
|
+
* @returns The response object with additional http response properties.
|
|
37
|
+
*/
|
|
38
|
+
export declare function auditableItemGraphChangesetList(httpRequestContext: IHttpRequestContext, componentName: string, request: IAuditableItemGraphChangesetListRequest): Promise<IAuditableItemGraphChangesetListResponse>;
|
|
39
|
+
/**
|
|
40
|
+
* Get the graph vertex changeset.
|
|
41
|
+
* @param httpRequestContext The request context for the API.
|
|
42
|
+
* @param componentName The name of the component to use in the routes.
|
|
43
|
+
* @param request The request.
|
|
44
|
+
* @returns The response object with additional http response properties.
|
|
45
|
+
*/
|
|
46
|
+
export declare function auditableItemGraphChangesetGet(httpRequestContext: IHttpRequestContext, componentName: string, request: IAuditableItemGraphChangesetGetRequest): Promise<IAuditableItemGraphChangesetGetResponse>;
|
|
47
|
+
/**
|
|
48
|
+
* Update the graph vertex (PUT - full replacement of vertex state).
|
|
49
|
+
* @param httpRequestContext The request context for the API.
|
|
50
|
+
* @param componentName The name of the component to use in the routes.
|
|
51
|
+
* @param request The request.
|
|
52
|
+
* @returns The response object with additional http response properties.
|
|
53
|
+
*/
|
|
54
|
+
export declare function auditableItemGraphUpdate(httpRequestContext: IHttpRequestContext, componentName: string, request: IAuditableItemGraphUpdateRequest): Promise<INoContentResponse>;
|
|
55
|
+
/**
|
|
56
|
+
* Partially update the graph vertex (PATCH - optional scalars; list fields use `{ add, remove }`).
|
|
57
|
+
* @param httpRequestContext The request context for the API.
|
|
58
|
+
* @param componentName The name of the component to use in the routes.
|
|
59
|
+
* @param request The request.
|
|
60
|
+
* @returns The response object with additional http response properties.
|
|
61
|
+
*/
|
|
62
|
+
export declare function auditableItemGraphUpdatePartial(httpRequestContext: IHttpRequestContext, componentName: string, request: IAuditableItemGraphUpdatePartialRequest): Promise<INoContentResponse>;
|
|
63
|
+
/**
|
|
64
|
+
* Query the graph vertices.
|
|
65
|
+
* @param httpRequestContext The request context for the API.
|
|
66
|
+
* @param componentName The name of the component to use in the routes.
|
|
67
|
+
* @param request The request.
|
|
68
|
+
* @returns The response object with additional http response properties.
|
|
69
|
+
*/
|
|
70
|
+
export declare function auditableItemGraphList(httpRequestContext: IHttpRequestContext, componentName: string, request: IAuditableItemGraphListRequest): Promise<IAuditableItemGraphListResponse>;
|
|
71
|
+
/**
|
|
72
|
+
* Get the graph vertex at a specific version.
|
|
73
|
+
* @param httpRequestContext The request context for the API.
|
|
74
|
+
* @param componentName The name of the component to use in the routes.
|
|
75
|
+
* @param request The request.
|
|
76
|
+
* @returns The response object with additional http response properties.
|
|
77
|
+
*/
|
|
78
|
+
export declare function auditableItemGraphVersionGet(httpRequestContext: IHttpRequestContext, componentName: string, request: IAuditableItemGraphVersionGetRequest): Promise<IAuditableItemGraphVersionGetResponse>;
|
|
79
|
+
/**
|
|
80
|
+
* Remove the notarization proof from all changesets of a graph vertex.
|
|
81
|
+
* @param httpRequestContext The request context for the API.
|
|
82
|
+
* @param componentName The name of the component to use in the routes.
|
|
83
|
+
* @param request The request.
|
|
84
|
+
* @returns The response object with additional http response properties.
|
|
85
|
+
*/
|
|
86
|
+
export declare function auditableItemGraphRemoveProof(httpRequestContext: IHttpRequestContext, componentName: string, request: IAuditableItemGraphRemoveProofRequest): Promise<INoContentResponse>;
|
|
87
|
+
/**
|
|
88
|
+
* Get all versions of a graph vertex.
|
|
89
|
+
* @param httpRequestContext The request context for the API.
|
|
90
|
+
* @param componentName The name of the component to use in the routes.
|
|
91
|
+
* @param request The request.
|
|
92
|
+
* @returns The response object with additional http response properties.
|
|
93
|
+
*/
|
|
94
|
+
export declare function auditableItemGraphVersionList(httpRequestContext: IHttpRequestContext, componentName: string, request: IAuditableItemGraphVersionListRequest): Promise<IAuditableItemGraphVersionListResponse>;
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import { type HealthApplicationCallback, type IHealth, type IHealthProviderComponent } from "@3sixty/api-models";
|
|
2
|
+
import { VerifyDepth, type IAuditableItemGraphChangeset, type IAuditableItemGraphChangesetList, type IAuditableItemGraphComponent, type IAuditableItemGraphPartialVertex, type IAuditableItemGraphVertex, type IAuditableItemGraphVertexList, type IAuditableItemGraphVertexVersionList } from "@3sixty/auditable-item-graph-models";
|
|
3
|
+
import { SortDirection, type EntityCondition } from "@3sixty/entity";
|
|
4
|
+
import type { IAuditableItemGraphServiceConstructorOptions } from "./models/IAuditableItemGraphServiceConstructorOptions.js";
|
|
5
|
+
/**
|
|
6
|
+
* Class for performing auditable item graph operations.
|
|
7
|
+
*/
|
|
8
|
+
export declare class AuditableItemGraphService implements IAuditableItemGraphComponent, IHealthProviderComponent {
|
|
9
|
+
/**
|
|
10
|
+
* Runtime name for the class.
|
|
11
|
+
*/
|
|
12
|
+
static readonly CLASS_NAME: string;
|
|
13
|
+
/**
|
|
14
|
+
* The namespace for the service changeset.
|
|
15
|
+
*/
|
|
16
|
+
static readonly NAMESPACE_CHANGESET: string;
|
|
17
|
+
/**
|
|
18
|
+
* The namespace for the service edge.
|
|
19
|
+
*/
|
|
20
|
+
static readonly NAMESPACE_EDGE: string;
|
|
21
|
+
/**
|
|
22
|
+
* Create a new instance of AuditableItemGraphService.
|
|
23
|
+
* @param options The dependencies for the auditable item graph connector.
|
|
24
|
+
*/
|
|
25
|
+
constructor(options?: IAuditableItemGraphServiceConstructorOptions);
|
|
26
|
+
/**
|
|
27
|
+
* Returns the class name of the component.
|
|
28
|
+
* @returns The class name of the component.
|
|
29
|
+
*/
|
|
30
|
+
className(): string;
|
|
31
|
+
/**
|
|
32
|
+
* Runs a set/get/remove cycle against the vertex entity storage using the organisation identity
|
|
33
|
+
* from the current context.
|
|
34
|
+
* @param callback The callback to invoke when a deferred health result is ready.
|
|
35
|
+
* @returns The health status of the service.
|
|
36
|
+
*/
|
|
37
|
+
healthApplication(callback: HealthApplicationCallback): Promise<IHealth[] | undefined>;
|
|
38
|
+
/**
|
|
39
|
+
* Register all AIG metrics with the telemetry component.
|
|
40
|
+
* @returns A promise that resolves when all metrics have been registered.
|
|
41
|
+
*/
|
|
42
|
+
start(): Promise<void>;
|
|
43
|
+
/**
|
|
44
|
+
* Create a new graph vertex.
|
|
45
|
+
* @param vertex The vertex to create.
|
|
46
|
+
* @param vertex.auditMode How the mutations of the vertex are recorded, defaults to audited.
|
|
47
|
+
* @param vertex.annotationObject The annotation object for the vertex as JSON-LD.
|
|
48
|
+
* @param vertex.aliases Alternative aliases that can be used to identify the vertex.
|
|
49
|
+
* @param vertex.resources The resources attached to the vertex.
|
|
50
|
+
* @param vertex.edges The edges connected to the vertex.
|
|
51
|
+
* @returns The id of the new graph item.
|
|
52
|
+
*/
|
|
53
|
+
create(vertex: Omit<IAuditableItemGraphVertex, "id">): Promise<string>;
|
|
54
|
+
/**
|
|
55
|
+
* Update a graph vertex (PUT - full replacement of vertex state).
|
|
56
|
+
* Concurrent updates for the same vertex are serialized via `Mutex` on the vertex id.
|
|
57
|
+
* @param vertex The vertex to update.
|
|
58
|
+
* @returns A promise that resolves when the vertex has been updated.
|
|
59
|
+
* @throws GeneralError If a bypass vertex is being switched back to audited.
|
|
60
|
+
*/
|
|
61
|
+
update(vertex: IAuditableItemGraphVertex): Promise<void>;
|
|
62
|
+
/**
|
|
63
|
+
* Partially update a graph vertex (PATCH - explicit list patches; only defined properties applied).
|
|
64
|
+
* Serialized with `update` via `Mutex` on the same vertex id within this instance.
|
|
65
|
+
* @param partial The partial vertex update.
|
|
66
|
+
* @returns A promise that resolves when the partial update has been applied.
|
|
67
|
+
* @throws GeneralError If a bypass vertex is being switched back to audited.
|
|
68
|
+
*/
|
|
69
|
+
updatePartial(partial: IAuditableItemGraphPartialVertex): Promise<void>;
|
|
70
|
+
/**
|
|
71
|
+
* Get a graph vertex.
|
|
72
|
+
* @param id The id of the vertex to get.
|
|
73
|
+
* @param options Additional options for the get operation.
|
|
74
|
+
* @param options.includeDeleted Whether to include deleted/updated aliases, resource, edges, defaults to false.
|
|
75
|
+
* @param options.verifySignatureDepth How many signatures to verify, defaults to "none".
|
|
76
|
+
* @returns The vertex if found.
|
|
77
|
+
* @throws NotFoundError if the vertex is not found.
|
|
78
|
+
*/
|
|
79
|
+
get(id: string, options?: {
|
|
80
|
+
includeDeleted?: boolean;
|
|
81
|
+
verifySignatureDepth?: VerifyDepth;
|
|
82
|
+
}): Promise<IAuditableItemGraphVertex>;
|
|
83
|
+
/**
|
|
84
|
+
* Get a graph vertex changeset list.
|
|
85
|
+
* @param id The id of the vertex to get.
|
|
86
|
+
* @param cursor The optional cursor to get next chunk.
|
|
87
|
+
* @param limit Limit the number of entities to return.
|
|
88
|
+
* @param options Additional options for the get operation.
|
|
89
|
+
* @param options.verifySignatureDepth How many signatures to verify, defaults to "none".
|
|
90
|
+
* @returns The vertex if found.
|
|
91
|
+
* @throws NotFoundError if the vertex is not found.
|
|
92
|
+
*/
|
|
93
|
+
getChangesets(id: string, cursor?: string, limit?: number, options?: {
|
|
94
|
+
verifySignatureDepth?: VerifyDepth;
|
|
95
|
+
}): Promise<{
|
|
96
|
+
changesets: IAuditableItemGraphChangesetList;
|
|
97
|
+
cursor?: string;
|
|
98
|
+
}>;
|
|
99
|
+
/**
|
|
100
|
+
* Get a graph vertex changeset.
|
|
101
|
+
* @param id The id of the vertex to get.
|
|
102
|
+
* @param options Additional options for the get operation.
|
|
103
|
+
* @param options.verifySignatureDepth How many signatures to verify, defaults to "none".
|
|
104
|
+
* @returns The vertex if found.
|
|
105
|
+
* @throws NotFoundError if the vertex is not found.
|
|
106
|
+
*/
|
|
107
|
+
getChangeset(id: string, options?: {
|
|
108
|
+
verifySignatureDepth?: VerifyDepth;
|
|
109
|
+
}): Promise<IAuditableItemGraphChangeset>;
|
|
110
|
+
/**
|
|
111
|
+
* Get a graph vertex at a specific version.
|
|
112
|
+
* @param id The id of the vertex.
|
|
113
|
+
* @param version The version number to retrieve.
|
|
114
|
+
* @returns The vertex reconstructed at that version.
|
|
115
|
+
* @throws NotFoundError if the vertex or version is not found, a bypass vertex never has versions.
|
|
116
|
+
*/
|
|
117
|
+
getVersion(id: string, version: number): Promise<IAuditableItemGraphVertex>;
|
|
118
|
+
/**
|
|
119
|
+
* Get all versions of a graph vertex.
|
|
120
|
+
* @param id The id of the vertex.
|
|
121
|
+
* @param options Additional options for the operation.
|
|
122
|
+
* @param options.after Only return versions created after this ISO 8601 timestamp (exclusive).
|
|
123
|
+
* @param options.before Only return versions created before this ISO 8601 timestamp (exclusive).
|
|
124
|
+
* @returns The list of vertex versions, a bypass vertex returns a single baseline entry for its
|
|
125
|
+
* current state when that falls within the requested range.
|
|
126
|
+
* @throws NotFoundError if the vertex is not found.
|
|
127
|
+
*/
|
|
128
|
+
getVersions(id: string, options?: {
|
|
129
|
+
after?: string;
|
|
130
|
+
before?: string;
|
|
131
|
+
}): Promise<IAuditableItemGraphVertexVersionList>;
|
|
132
|
+
/**
|
|
133
|
+
* Remove the proof for an item.
|
|
134
|
+
* @param id The id of the vertex to remove the proof from.
|
|
135
|
+
* @returns A promise that resolves when the proof has been removed from all changesets.
|
|
136
|
+
* @throws NotFoundError if the vertex is not found.
|
|
137
|
+
*/
|
|
138
|
+
removeProof(id: string): Promise<void>;
|
|
139
|
+
/**
|
|
140
|
+
* Query the graph for vertices.
|
|
141
|
+
* @param options The query options.
|
|
142
|
+
* @param options.id The optional id to look for.
|
|
143
|
+
* @param options.idMode Look in id, alias or both, defaults to both.
|
|
144
|
+
* @param options.idExact Find only exact matches, default to false meaning partial matching.
|
|
145
|
+
* @param options.resourceTypes Include vertices with specific resource types.
|
|
146
|
+
* @param conditions Conditions to use in the query.
|
|
147
|
+
* @param orderBy The order for the results, defaults to created.
|
|
148
|
+
* @param orderByDirection The direction for the order, defaults to desc.
|
|
149
|
+
* @param properties The properties to return, if not provided defaults to id, created, aliases and object.
|
|
150
|
+
* @param cursor The cursor to request the next chunk of entities.
|
|
151
|
+
* @param limit The maximum number of entities to return, a page can contain fewer so follow
|
|
152
|
+
* the cursor until it is absent to read them all.
|
|
153
|
+
* @returns The entities, which can be partial if a limited keys list was provided.
|
|
154
|
+
*/
|
|
155
|
+
query(options?: {
|
|
156
|
+
id?: string;
|
|
157
|
+
idMode?: "id" | "alias" | "both";
|
|
158
|
+
idExact?: boolean;
|
|
159
|
+
resourceTypes?: string[];
|
|
160
|
+
}, conditions?: EntityCondition<IAuditableItemGraphVertex>, orderBy?: keyof Pick<IAuditableItemGraphVertex, "dateCreated" | "dateModified">, orderByDirection?: SortDirection, properties?: (keyof IAuditableItemGraphVertex)[], cursor?: string, limit?: number): Promise<{
|
|
161
|
+
entries: IAuditableItemGraphVertexList;
|
|
162
|
+
cursor?: string;
|
|
163
|
+
}>;
|
|
164
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { type IJsonLdNodeObject } from "@3sixty/data-json-ld";
|
|
2
|
+
/**
|
|
3
|
+
* Class describing the auditable item graph alias.
|
|
4
|
+
*/
|
|
5
|
+
export declare class AuditableItemGraphAlias {
|
|
6
|
+
/**
|
|
7
|
+
* The alternative alias for the vertex.
|
|
8
|
+
*/
|
|
9
|
+
id: string;
|
|
10
|
+
/**
|
|
11
|
+
* The format of the alias for the vertex.
|
|
12
|
+
*/
|
|
13
|
+
aliasFormat?: string;
|
|
14
|
+
/**
|
|
15
|
+
* The date/time of when the alias was created.
|
|
16
|
+
*/
|
|
17
|
+
dateCreated: string;
|
|
18
|
+
/**
|
|
19
|
+
* The date/time of when the alias was last modified.
|
|
20
|
+
*/
|
|
21
|
+
dateModified?: string;
|
|
22
|
+
/**
|
|
23
|
+
* The timestamp of when the alias was deleted, as we never actually remove items.
|
|
24
|
+
*/
|
|
25
|
+
dateDeleted?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Object to associate with the alias as JSON-LD.
|
|
28
|
+
*/
|
|
29
|
+
annotationObject?: IJsonLdNodeObject;
|
|
30
|
+
/**
|
|
31
|
+
* Whether the alias should be unique across the graph, meaning that no other vertex can have the same alias. Defaults to false.
|
|
32
|
+
*/
|
|
33
|
+
unique?: boolean;
|
|
34
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { AuditableItemGraphPatch } from "./auditableItemGraphPatch.js";
|
|
2
|
+
/**
|
|
3
|
+
* Class describing a set of updates to the vertex.
|
|
4
|
+
*/
|
|
5
|
+
export declare class AuditableItemGraphChangeset {
|
|
6
|
+
/**
|
|
7
|
+
* The id of the changeset.
|
|
8
|
+
*/
|
|
9
|
+
id: string;
|
|
10
|
+
/**
|
|
11
|
+
* The vertex the changeset belongs to.
|
|
12
|
+
*/
|
|
13
|
+
vertexId: string;
|
|
14
|
+
/**
|
|
15
|
+
* The date/time of when the changeset was created.
|
|
16
|
+
*/
|
|
17
|
+
dateCreated: string;
|
|
18
|
+
/**
|
|
19
|
+
* The identity of the user who made the changeset.
|
|
20
|
+
*/
|
|
21
|
+
userIdentity?: string;
|
|
22
|
+
/**
|
|
23
|
+
* The patches in the changeset.
|
|
24
|
+
*/
|
|
25
|
+
patches: AuditableItemGraphPatch[];
|
|
26
|
+
/**
|
|
27
|
+
* The immutable proof id which contains the signature for this changeset.
|
|
28
|
+
*/
|
|
29
|
+
proofId?: string;
|
|
30
|
+
/**
|
|
31
|
+
* The version number of the vertex after this changeset was applied.
|
|
32
|
+
*/
|
|
33
|
+
version?: number;
|
|
34
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { type IJsonLdNodeObject } from "@3sixty/data-json-ld";
|
|
2
|
+
/**
|
|
3
|
+
* Class describing the auditable item graph edge.
|
|
4
|
+
*/
|
|
5
|
+
export declare class AuditableItemGraphEdge {
|
|
6
|
+
/**
|
|
7
|
+
* The id of the edge.
|
|
8
|
+
*/
|
|
9
|
+
id: string;
|
|
10
|
+
/**
|
|
11
|
+
* The date/time of when the edge was created.
|
|
12
|
+
*/
|
|
13
|
+
dateCreated: string;
|
|
14
|
+
/**
|
|
15
|
+
* The date/time of when the edge was last modified.
|
|
16
|
+
*/
|
|
17
|
+
dateModified?: string;
|
|
18
|
+
/**
|
|
19
|
+
* The timestamp of when the edge was deleted, as we never actually remove items.
|
|
20
|
+
*/
|
|
21
|
+
dateDeleted?: string;
|
|
22
|
+
/**
|
|
23
|
+
* The target id of the edge.
|
|
24
|
+
*/
|
|
25
|
+
targetId: string;
|
|
26
|
+
/**
|
|
27
|
+
* The relationships between the two vertices.
|
|
28
|
+
*/
|
|
29
|
+
edgeRelationships: string[];
|
|
30
|
+
/**
|
|
31
|
+
* Object to associate with the edge as JSON-LD.
|
|
32
|
+
*/
|
|
33
|
+
annotationObject?: IJsonLdNodeObject;
|
|
34
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Class describing the auditable item graph patches.
|
|
3
|
+
*/
|
|
4
|
+
export declare class AuditableItemGraphPatch {
|
|
5
|
+
/**
|
|
6
|
+
* The operation for the patch.
|
|
7
|
+
*/
|
|
8
|
+
op: "add" | "remove" | "replace" | "move" | "copy" | "test";
|
|
9
|
+
/**
|
|
10
|
+
* The path for the patch.
|
|
11
|
+
*/
|
|
12
|
+
path: string;
|
|
13
|
+
/**
|
|
14
|
+
* The from for the patch.
|
|
15
|
+
*/
|
|
16
|
+
from?: string;
|
|
17
|
+
/**
|
|
18
|
+
* The value for the patch.
|
|
19
|
+
*/
|
|
20
|
+
value?: unknown;
|
|
21
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type IJsonLdNodeObject } from "@3sixty/data-json-ld";
|
|
2
|
+
/**
|
|
3
|
+
* Class describing the auditable item graph vertex resource.
|
|
4
|
+
*/
|
|
5
|
+
export declare class AuditableItemGraphResource {
|
|
6
|
+
/**
|
|
7
|
+
* The id of the resource.
|
|
8
|
+
*/
|
|
9
|
+
id?: string;
|
|
10
|
+
/**
|
|
11
|
+
* The date/time of when the resource was created.
|
|
12
|
+
*/
|
|
13
|
+
dateCreated: string;
|
|
14
|
+
/**
|
|
15
|
+
* The date/time of when the resource was last modified.
|
|
16
|
+
*/
|
|
17
|
+
dateModified?: string;
|
|
18
|
+
/**
|
|
19
|
+
* The timestamp of when the resource was deleted, as we never actually remove items.
|
|
20
|
+
*/
|
|
21
|
+
dateDeleted?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Object to associate with the resource as JSON-LD.
|
|
24
|
+
*/
|
|
25
|
+
resourceObject?: IJsonLdNodeObject;
|
|
26
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { AuditableItemGraphAuditMode } from "@3sixty/auditable-item-graph-models";
|
|
2
|
+
import { type IJsonLdNodeObject } from "@3sixty/data-json-ld";
|
|
3
|
+
import type { AuditableItemGraphAlias } from "./auditableItemGraphAlias.js";
|
|
4
|
+
import type { AuditableItemGraphEdge } from "./auditableItemGraphEdge.js";
|
|
5
|
+
import type { AuditableItemGraphResource } from "./auditableItemGraphResource.js";
|
|
6
|
+
/**
|
|
7
|
+
* Class describing the auditable item graph vertex.
|
|
8
|
+
*/
|
|
9
|
+
export declare class AuditableItemGraphVertex {
|
|
10
|
+
/**
|
|
11
|
+
* The id of the vertex.
|
|
12
|
+
*/
|
|
13
|
+
id: string;
|
|
14
|
+
/**
|
|
15
|
+
* The identity of the organization which controls the vertex.
|
|
16
|
+
*/
|
|
17
|
+
organizationIdentity: string;
|
|
18
|
+
/**
|
|
19
|
+
* The date/time of when the vertex was created.
|
|
20
|
+
*/
|
|
21
|
+
dateCreated: string;
|
|
22
|
+
/**
|
|
23
|
+
* The date/time of when the vertex was last modified.
|
|
24
|
+
*/
|
|
25
|
+
dateModified?: string;
|
|
26
|
+
/**
|
|
27
|
+
* How the mutations of the vertex are recorded, when absent the vertex behaves as audited.
|
|
28
|
+
*/
|
|
29
|
+
auditMode?: AuditableItemGraphAuditMode;
|
|
30
|
+
/**
|
|
31
|
+
* Object to associate with the vertex as JSON-LD.
|
|
32
|
+
*/
|
|
33
|
+
annotationObject?: IJsonLdNodeObject;
|
|
34
|
+
/**
|
|
35
|
+
* Alternative aliases that can be used to identify the vertex.
|
|
36
|
+
*/
|
|
37
|
+
aliases?: AuditableItemGraphAlias[];
|
|
38
|
+
/**
|
|
39
|
+
* The resources attached to the vertex.
|
|
40
|
+
*/
|
|
41
|
+
resources?: AuditableItemGraphResource[];
|
|
42
|
+
/**
|
|
43
|
+
* Edges connected to the vertex.
|
|
44
|
+
*/
|
|
45
|
+
edges?: AuditableItemGraphEdge[];
|
|
46
|
+
/**
|
|
47
|
+
* The current version of the vertex, incremented on each changeset.
|
|
48
|
+
*/
|
|
49
|
+
version?: number;
|
|
50
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Class describing the auditable item graph vertex index.
|
|
3
|
+
*
|
|
4
|
+
* The composite index is built on a fixed length hash of the value rather than the value itself,
|
|
5
|
+
* so its key stays within the size limit some databases place on an index key however long the
|
|
6
|
+
* value is.
|
|
7
|
+
*/
|
|
8
|
+
export declare class AuditableItemGraphVertexIndex {
|
|
9
|
+
/**
|
|
10
|
+
* The id of the index.
|
|
11
|
+
*/
|
|
12
|
+
id: string;
|
|
13
|
+
/**
|
|
14
|
+
* The id of the vertex this index refers to.
|
|
15
|
+
*/
|
|
16
|
+
vertexId: string;
|
|
17
|
+
/**
|
|
18
|
+
* Index type.
|
|
19
|
+
*/
|
|
20
|
+
type: string;
|
|
21
|
+
/**
|
|
22
|
+
* Index value, case folded so lookups do not depend on the column collation.
|
|
23
|
+
*/
|
|
24
|
+
value: string;
|
|
25
|
+
/**
|
|
26
|
+
* The hash of the value, used for exact lookups.
|
|
27
|
+
*/
|
|
28
|
+
valueHash: string;
|
|
29
|
+
/**
|
|
30
|
+
* The date/time of when the vertex was created, copied so the index can order and page its
|
|
31
|
+
* own matches without reading the vertex.
|
|
32
|
+
*/
|
|
33
|
+
dateCreated: string;
|
|
34
|
+
/**
|
|
35
|
+
* The date/time of when the vertex was last modified, copied so a query ordered by the
|
|
36
|
+
* modified date can also be paged from the index.
|
|
37
|
+
*/
|
|
38
|
+
dateModified?: string;
|
|
39
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { type IJsonLdNodeObject } from "@3sixty/data-json-ld";
|
|
2
|
+
import type { AuditableItemGraphAlias } from "./auditableItemGraphAlias.js";
|
|
3
|
+
import type { AuditableItemGraphEdge } from "./auditableItemGraphEdge.js";
|
|
4
|
+
import type { AuditableItemGraphResource } from "./auditableItemGraphResource.js";
|
|
5
|
+
/**
|
|
6
|
+
* Class describing the auditable item graph vertex, version 0.
|
|
7
|
+
*/
|
|
8
|
+
export declare class AuditableItemGraphVertexV0 {
|
|
9
|
+
/**
|
|
10
|
+
* The id of the vertex.
|
|
11
|
+
*/
|
|
12
|
+
id: string;
|
|
13
|
+
/**
|
|
14
|
+
* The identity of the organization which controls the vertex.
|
|
15
|
+
*/
|
|
16
|
+
organizationIdentity: string;
|
|
17
|
+
/**
|
|
18
|
+
* The date/time of when the vertex was created.
|
|
19
|
+
*/
|
|
20
|
+
dateCreated: string;
|
|
21
|
+
/**
|
|
22
|
+
* The date/time of when the vertex was last modified.
|
|
23
|
+
*/
|
|
24
|
+
dateModified?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Combined alias index for the vertex used for querying.
|
|
27
|
+
*/
|
|
28
|
+
aliasIndex?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Combined resource type index for the vertex used for querying.
|
|
31
|
+
*/
|
|
32
|
+
resourceTypeIndex?: string;
|
|
33
|
+
/**
|
|
34
|
+
* Object to associate with the vertex as JSON-LD.
|
|
35
|
+
*/
|
|
36
|
+
annotationObject?: IJsonLdNodeObject;
|
|
37
|
+
/**
|
|
38
|
+
* Alternative aliases that can be used to identify the vertex.
|
|
39
|
+
*/
|
|
40
|
+
aliases?: AuditableItemGraphAlias[];
|
|
41
|
+
/**
|
|
42
|
+
* The resources attached to the vertex.
|
|
43
|
+
*/
|
|
44
|
+
resources?: AuditableItemGraphResource[];
|
|
45
|
+
/**
|
|
46
|
+
* Edges connected to the vertex.
|
|
47
|
+
*/
|
|
48
|
+
edges?: AuditableItemGraphEdge[];
|
|
49
|
+
/**
|
|
50
|
+
* The current version of the vertex, incremented on each changeset.
|
|
51
|
+
*/
|
|
52
|
+
version?: number;
|
|
53
|
+
}
|