@twin.org/auditable-item-graph-rest-client 0.0.1-next.9 → 0.0.2-next.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/dist/cjs/index.cjs +30 -32
- package/dist/esm/index.mjs +31 -33
- package/dist/types/auditableItemGraphClient.d.ts +59 -36
- package/docs/changelog.md +191 -1
- package/docs/reference/classes/AuditableItemGraphClient.md +124 -32
- package/package.json +5 -5
package/dist/cjs/index.cjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var apiCore = require('@twin.org/api-core');
|
|
4
|
+
var apiModels = require('@twin.org/api-models');
|
|
4
5
|
var core = require('@twin.org/core');
|
|
5
6
|
var web = require('@twin.org/web');
|
|
6
7
|
|
|
@@ -23,31 +24,27 @@ class AuditableItemGraphClient extends apiCore.BaseRestClient {
|
|
|
23
24
|
}
|
|
24
25
|
/**
|
|
25
26
|
* Create a new graph vertex.
|
|
26
|
-
* @param
|
|
27
|
-
* @param
|
|
28
|
-
* @param
|
|
29
|
-
* @param
|
|
27
|
+
* @param vertex The vertex to create.
|
|
28
|
+
* @param vertex.annotationObject The annotation object for the vertex as JSON-LD.
|
|
29
|
+
* @param vertex.aliases Alternative aliases that can be used to identify the vertex.
|
|
30
|
+
* @param vertex.resources The resources attached to the vertex.
|
|
31
|
+
* @param vertex.edges The edges connected to the vertex.
|
|
30
32
|
* @returns The id of the new graph item.
|
|
31
33
|
*/
|
|
32
|
-
async create(
|
|
34
|
+
async create(vertex) {
|
|
33
35
|
const response = await this.fetch("/", "POST", {
|
|
34
|
-
body:
|
|
35
|
-
vertexObject,
|
|
36
|
-
aliases,
|
|
37
|
-
resources,
|
|
38
|
-
edges
|
|
39
|
-
}
|
|
36
|
+
body: vertex
|
|
40
37
|
});
|
|
41
38
|
return response.headers[web.HeaderTypes.Location];
|
|
42
39
|
}
|
|
43
40
|
/**
|
|
44
41
|
* Get a graph vertex.
|
|
45
42
|
* @param id The id of the vertex to get.
|
|
46
|
-
* @returns The vertex if found.
|
|
47
43
|
* @param options Additional options for the get operation.
|
|
48
44
|
* @param options.includeDeleted Whether to include deleted/updated aliases, resource, edges, defaults to false.
|
|
49
45
|
* @param options.includeChangesets Whether to include the changesets of the vertex, defaults to false.
|
|
50
46
|
* @param options.verifySignatureDepth How many signatures to verify, defaults to "none".
|
|
47
|
+
* @returns The vertex if found.
|
|
51
48
|
* @throws NotFoundError if the vertex is not found.
|
|
52
49
|
*/
|
|
53
50
|
async get(id, options) {
|
|
@@ -69,42 +66,41 @@ class AuditableItemGraphClient extends apiCore.BaseRestClient {
|
|
|
69
66
|
}
|
|
70
67
|
/**
|
|
71
68
|
* Update a graph vertex.
|
|
72
|
-
* @param
|
|
73
|
-
* @param
|
|
74
|
-
* @param
|
|
75
|
-
* @param
|
|
76
|
-
* @param
|
|
69
|
+
* @param vertex The vertex to update.
|
|
70
|
+
* @param vertex.id The id of the vertex to update.
|
|
71
|
+
* @param vertex.annotationObject The annotation object for the vertex as JSON-LD.
|
|
72
|
+
* @param vertex.aliases Alternative aliases that can be used to identify the vertex.
|
|
73
|
+
* @param vertex.resources The resources attached to the vertex.
|
|
74
|
+
* @param vertex.edges The edges connected to the vertex.
|
|
77
75
|
* @returns Nothing.
|
|
78
76
|
*/
|
|
79
|
-
async update(
|
|
80
|
-
core.Guards.
|
|
77
|
+
async update(vertex) {
|
|
78
|
+
core.Guards.object(this.CLASS_NAME, "vertex", vertex);
|
|
79
|
+
core.Guards.stringValue(this.CLASS_NAME, "vertex.id", vertex.id);
|
|
80
|
+
const { id, ...rest } = vertex;
|
|
81
81
|
await this.fetch("/:id", "PUT", {
|
|
82
82
|
pathParams: {
|
|
83
83
|
id
|
|
84
84
|
},
|
|
85
|
-
body:
|
|
86
|
-
vertexObject,
|
|
87
|
-
aliases,
|
|
88
|
-
resources,
|
|
89
|
-
edges
|
|
90
|
-
}
|
|
85
|
+
body: rest
|
|
91
86
|
});
|
|
92
87
|
}
|
|
93
88
|
/**
|
|
94
|
-
* Remove the
|
|
89
|
+
* Remove the verifiable storage for an item, not supported on client.
|
|
95
90
|
* @param id The id of the vertex to get.
|
|
96
91
|
* @returns Nothing.
|
|
97
92
|
* @throws NotFoundError if the vertex is not found.
|
|
98
|
-
* @internal
|
|
99
93
|
*/
|
|
100
|
-
async
|
|
101
|
-
throw new core.NotSupportedError(this.CLASS_NAME, "
|
|
94
|
+
async removeVerifiable(id) {
|
|
95
|
+
throw new core.NotSupportedError(this.CLASS_NAME, "removeVerifiable");
|
|
102
96
|
}
|
|
103
97
|
/**
|
|
104
98
|
* Query the graph for vertices.
|
|
105
99
|
* @param options The query options.
|
|
106
100
|
* @param options.id The optional id to look for.
|
|
107
101
|
* @param options.idMode Look in id, alias or both, defaults to both.
|
|
102
|
+
* @param options.resourceTypes Include vertices with specific resource types.
|
|
103
|
+
* @param conditions Conditions to use in the query.
|
|
108
104
|
* @param orderBy The order for the results, defaults to created.
|
|
109
105
|
* @param orderByDirection The direction for the order, defaults to descending.
|
|
110
106
|
* @param properties The properties to return, if not provided defaults to id, created, aliases and object.
|
|
@@ -112,7 +108,7 @@ class AuditableItemGraphClient extends apiCore.BaseRestClient {
|
|
|
112
108
|
* @param pageSize The maximum number of entities in a page.
|
|
113
109
|
* @returns The entities, which can be partial if a limited keys list was provided.
|
|
114
110
|
*/
|
|
115
|
-
async query(options, orderBy, orderByDirection, properties, cursor, pageSize) {
|
|
111
|
+
async query(options, conditions, orderBy, orderByDirection, properties, cursor, pageSize) {
|
|
116
112
|
const response = await this.fetch("/", "GET", {
|
|
117
113
|
headers: {
|
|
118
114
|
[web.HeaderTypes.Accept]: web.MimeTypes.JsonLd
|
|
@@ -120,11 +116,13 @@ class AuditableItemGraphClient extends apiCore.BaseRestClient {
|
|
|
120
116
|
query: {
|
|
121
117
|
id: options?.id,
|
|
122
118
|
idMode: options?.idMode,
|
|
119
|
+
resourceTypes: apiModels.HttpParameterHelper.arrayToString(options?.resourceTypes),
|
|
120
|
+
conditions: apiModels.HttpParameterHelper.objectToString(conditions),
|
|
123
121
|
orderBy,
|
|
124
122
|
orderByDirection,
|
|
125
|
-
properties: properties
|
|
123
|
+
properties: apiModels.HttpParameterHelper.arrayToString(properties),
|
|
126
124
|
cursor,
|
|
127
|
-
pageSize
|
|
125
|
+
pageSize: core.Coerce.integer(pageSize)
|
|
128
126
|
}
|
|
129
127
|
});
|
|
130
128
|
return response.body;
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { BaseRestClient } from '@twin.org/api-core';
|
|
2
|
-
import {
|
|
2
|
+
import { HttpParameterHelper } from '@twin.org/api-models';
|
|
3
|
+
import { Guards, NotSupportedError, Coerce } from '@twin.org/core';
|
|
3
4
|
import { HeaderTypes, MimeTypes } from '@twin.org/web';
|
|
4
5
|
|
|
5
6
|
// Copyright 2024 IOTA Stiftung.
|
|
@@ -21,31 +22,27 @@ class AuditableItemGraphClient extends BaseRestClient {
|
|
|
21
22
|
}
|
|
22
23
|
/**
|
|
23
24
|
* Create a new graph vertex.
|
|
24
|
-
* @param
|
|
25
|
-
* @param
|
|
26
|
-
* @param
|
|
27
|
-
* @param
|
|
25
|
+
* @param vertex The vertex to create.
|
|
26
|
+
* @param vertex.annotationObject The annotation object for the vertex as JSON-LD.
|
|
27
|
+
* @param vertex.aliases Alternative aliases that can be used to identify the vertex.
|
|
28
|
+
* @param vertex.resources The resources attached to the vertex.
|
|
29
|
+
* @param vertex.edges The edges connected to the vertex.
|
|
28
30
|
* @returns The id of the new graph item.
|
|
29
31
|
*/
|
|
30
|
-
async create(
|
|
32
|
+
async create(vertex) {
|
|
31
33
|
const response = await this.fetch("/", "POST", {
|
|
32
|
-
body:
|
|
33
|
-
vertexObject,
|
|
34
|
-
aliases,
|
|
35
|
-
resources,
|
|
36
|
-
edges
|
|
37
|
-
}
|
|
34
|
+
body: vertex
|
|
38
35
|
});
|
|
39
36
|
return response.headers[HeaderTypes.Location];
|
|
40
37
|
}
|
|
41
38
|
/**
|
|
42
39
|
* Get a graph vertex.
|
|
43
40
|
* @param id The id of the vertex to get.
|
|
44
|
-
* @returns The vertex if found.
|
|
45
41
|
* @param options Additional options for the get operation.
|
|
46
42
|
* @param options.includeDeleted Whether to include deleted/updated aliases, resource, edges, defaults to false.
|
|
47
43
|
* @param options.includeChangesets Whether to include the changesets of the vertex, defaults to false.
|
|
48
44
|
* @param options.verifySignatureDepth How many signatures to verify, defaults to "none".
|
|
45
|
+
* @returns The vertex if found.
|
|
49
46
|
* @throws NotFoundError if the vertex is not found.
|
|
50
47
|
*/
|
|
51
48
|
async get(id, options) {
|
|
@@ -67,42 +64,41 @@ class AuditableItemGraphClient extends BaseRestClient {
|
|
|
67
64
|
}
|
|
68
65
|
/**
|
|
69
66
|
* Update a graph vertex.
|
|
70
|
-
* @param
|
|
71
|
-
* @param
|
|
72
|
-
* @param
|
|
73
|
-
* @param
|
|
74
|
-
* @param
|
|
67
|
+
* @param vertex The vertex to update.
|
|
68
|
+
* @param vertex.id The id of the vertex to update.
|
|
69
|
+
* @param vertex.annotationObject The annotation object for the vertex as JSON-LD.
|
|
70
|
+
* @param vertex.aliases Alternative aliases that can be used to identify the vertex.
|
|
71
|
+
* @param vertex.resources The resources attached to the vertex.
|
|
72
|
+
* @param vertex.edges The edges connected to the vertex.
|
|
75
73
|
* @returns Nothing.
|
|
76
74
|
*/
|
|
77
|
-
async update(
|
|
78
|
-
Guards.
|
|
75
|
+
async update(vertex) {
|
|
76
|
+
Guards.object(this.CLASS_NAME, "vertex", vertex);
|
|
77
|
+
Guards.stringValue(this.CLASS_NAME, "vertex.id", vertex.id);
|
|
78
|
+
const { id, ...rest } = vertex;
|
|
79
79
|
await this.fetch("/:id", "PUT", {
|
|
80
80
|
pathParams: {
|
|
81
81
|
id
|
|
82
82
|
},
|
|
83
|
-
body:
|
|
84
|
-
vertexObject,
|
|
85
|
-
aliases,
|
|
86
|
-
resources,
|
|
87
|
-
edges
|
|
88
|
-
}
|
|
83
|
+
body: rest
|
|
89
84
|
});
|
|
90
85
|
}
|
|
91
86
|
/**
|
|
92
|
-
* Remove the
|
|
87
|
+
* Remove the verifiable storage for an item, not supported on client.
|
|
93
88
|
* @param id The id of the vertex to get.
|
|
94
89
|
* @returns Nothing.
|
|
95
90
|
* @throws NotFoundError if the vertex is not found.
|
|
96
|
-
* @internal
|
|
97
91
|
*/
|
|
98
|
-
async
|
|
99
|
-
throw new NotSupportedError(this.CLASS_NAME, "
|
|
92
|
+
async removeVerifiable(id) {
|
|
93
|
+
throw new NotSupportedError(this.CLASS_NAME, "removeVerifiable");
|
|
100
94
|
}
|
|
101
95
|
/**
|
|
102
96
|
* Query the graph for vertices.
|
|
103
97
|
* @param options The query options.
|
|
104
98
|
* @param options.id The optional id to look for.
|
|
105
99
|
* @param options.idMode Look in id, alias or both, defaults to both.
|
|
100
|
+
* @param options.resourceTypes Include vertices with specific resource types.
|
|
101
|
+
* @param conditions Conditions to use in the query.
|
|
106
102
|
* @param orderBy The order for the results, defaults to created.
|
|
107
103
|
* @param orderByDirection The direction for the order, defaults to descending.
|
|
108
104
|
* @param properties The properties to return, if not provided defaults to id, created, aliases and object.
|
|
@@ -110,7 +106,7 @@ class AuditableItemGraphClient extends BaseRestClient {
|
|
|
110
106
|
* @param pageSize The maximum number of entities in a page.
|
|
111
107
|
* @returns The entities, which can be partial if a limited keys list was provided.
|
|
112
108
|
*/
|
|
113
|
-
async query(options, orderBy, orderByDirection, properties, cursor, pageSize) {
|
|
109
|
+
async query(options, conditions, orderBy, orderByDirection, properties, cursor, pageSize) {
|
|
114
110
|
const response = await this.fetch("/", "GET", {
|
|
115
111
|
headers: {
|
|
116
112
|
[HeaderTypes.Accept]: MimeTypes.JsonLd
|
|
@@ -118,11 +114,13 @@ class AuditableItemGraphClient extends BaseRestClient {
|
|
|
118
114
|
query: {
|
|
119
115
|
id: options?.id,
|
|
120
116
|
idMode: options?.idMode,
|
|
117
|
+
resourceTypes: HttpParameterHelper.arrayToString(options?.resourceTypes),
|
|
118
|
+
conditions: HttpParameterHelper.objectToString(conditions),
|
|
121
119
|
orderBy,
|
|
122
120
|
orderByDirection,
|
|
123
|
-
properties: properties
|
|
121
|
+
properties: HttpParameterHelper.arrayToString(properties),
|
|
124
122
|
cursor,
|
|
125
|
-
pageSize
|
|
123
|
+
pageSize: Coerce.integer(pageSize)
|
|
126
124
|
}
|
|
127
125
|
});
|
|
128
126
|
return response.body;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { BaseRestClient } from "@twin.org/api-core";
|
|
2
|
-
import type
|
|
2
|
+
import { type IBaseRestClientConfig } from "@twin.org/api-models";
|
|
3
3
|
import type { IAuditableItemGraphComponent, IAuditableItemGraphVertex, IAuditableItemGraphVertexList, VerifyDepth } from "@twin.org/auditable-item-graph-models";
|
|
4
4
|
import type { IJsonLdNodeObject } from "@twin.org/data-json-ld";
|
|
5
|
-
import type { SortDirection } from "@twin.org/entity";
|
|
5
|
+
import type { IComparator, SortDirection } from "@twin.org/entity";
|
|
6
6
|
/**
|
|
7
7
|
* Client for performing auditable item graph through to REST endpoints.
|
|
8
8
|
*/
|
|
@@ -18,32 +18,38 @@ export declare class AuditableItemGraphClient extends BaseRestClient implements
|
|
|
18
18
|
constructor(config: IBaseRestClientConfig);
|
|
19
19
|
/**
|
|
20
20
|
* Create a new graph vertex.
|
|
21
|
-
* @param
|
|
22
|
-
* @param
|
|
23
|
-
* @param
|
|
24
|
-
* @param
|
|
21
|
+
* @param vertex The vertex to create.
|
|
22
|
+
* @param vertex.annotationObject The annotation object for the vertex as JSON-LD.
|
|
23
|
+
* @param vertex.aliases Alternative aliases that can be used to identify the vertex.
|
|
24
|
+
* @param vertex.resources The resources attached to the vertex.
|
|
25
|
+
* @param vertex.edges The edges connected to the vertex.
|
|
25
26
|
* @returns The id of the new graph item.
|
|
26
27
|
*/
|
|
27
|
-
create(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
28
|
+
create(vertex: {
|
|
29
|
+
annotationObject?: IJsonLdNodeObject;
|
|
30
|
+
aliases?: {
|
|
31
|
+
id: string;
|
|
32
|
+
aliasFormat?: string;
|
|
33
|
+
annotationObject?: IJsonLdNodeObject;
|
|
34
|
+
}[];
|
|
35
|
+
resources?: {
|
|
36
|
+
id?: string;
|
|
37
|
+
resourceObject?: IJsonLdNodeObject;
|
|
38
|
+
}[];
|
|
39
|
+
edges?: {
|
|
40
|
+
id: string;
|
|
41
|
+
edgeRelationships: string[];
|
|
42
|
+
annotationObject?: IJsonLdNodeObject;
|
|
43
|
+
}[];
|
|
44
|
+
}): Promise<string>;
|
|
39
45
|
/**
|
|
40
46
|
* Get a graph vertex.
|
|
41
47
|
* @param id The id of the vertex to get.
|
|
42
|
-
* @returns The vertex if found.
|
|
43
48
|
* @param options Additional options for the get operation.
|
|
44
49
|
* @param options.includeDeleted Whether to include deleted/updated aliases, resource, edges, defaults to false.
|
|
45
50
|
* @param options.includeChangesets Whether to include the changesets of the vertex, defaults to false.
|
|
46
51
|
* @param options.verifySignatureDepth How many signatures to verify, defaults to "none".
|
|
52
|
+
* @returns The vertex if found.
|
|
47
53
|
* @throws NotFoundError if the vertex is not found.
|
|
48
54
|
*/
|
|
49
55
|
get(id: string, options?: {
|
|
@@ -53,30 +59,46 @@ export declare class AuditableItemGraphClient extends BaseRestClient implements
|
|
|
53
59
|
}): Promise<IAuditableItemGraphVertex>;
|
|
54
60
|
/**
|
|
55
61
|
* Update a graph vertex.
|
|
56
|
-
* @param
|
|
57
|
-
* @param
|
|
58
|
-
* @param
|
|
59
|
-
* @param
|
|
60
|
-
* @param
|
|
62
|
+
* @param vertex The vertex to update.
|
|
63
|
+
* @param vertex.id The id of the vertex to update.
|
|
64
|
+
* @param vertex.annotationObject The annotation object for the vertex as JSON-LD.
|
|
65
|
+
* @param vertex.aliases Alternative aliases that can be used to identify the vertex.
|
|
66
|
+
* @param vertex.resources The resources attached to the vertex.
|
|
67
|
+
* @param vertex.edges The edges connected to the vertex.
|
|
61
68
|
* @returns Nothing.
|
|
62
69
|
*/
|
|
63
|
-
update(
|
|
64
|
-
id: string;
|
|
65
|
-
aliasFormat?: string;
|
|
66
|
-
aliasObject?: IJsonLdNodeObject;
|
|
67
|
-
}[], resources?: {
|
|
70
|
+
update(vertex: {
|
|
68
71
|
id: string;
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
72
|
+
annotationObject?: IJsonLdNodeObject;
|
|
73
|
+
aliases?: {
|
|
74
|
+
id: string;
|
|
75
|
+
aliasFormat?: string;
|
|
76
|
+
annotationObject?: IJsonLdNodeObject;
|
|
77
|
+
}[];
|
|
78
|
+
resources?: {
|
|
79
|
+
id?: string;
|
|
80
|
+
resourceObject?: IJsonLdNodeObject;
|
|
81
|
+
}[];
|
|
82
|
+
edges?: {
|
|
83
|
+
id: string;
|
|
84
|
+
edgeRelationships: string[];
|
|
85
|
+
annotationObject?: IJsonLdNodeObject;
|
|
86
|
+
}[];
|
|
87
|
+
}): Promise<void>;
|
|
88
|
+
/**
|
|
89
|
+
* Remove the verifiable storage for an item, not supported on client.
|
|
90
|
+
* @param id The id of the vertex to get.
|
|
91
|
+
* @returns Nothing.
|
|
92
|
+
* @throws NotFoundError if the vertex is not found.
|
|
93
|
+
*/
|
|
94
|
+
removeVerifiable(id: string): Promise<void>;
|
|
75
95
|
/**
|
|
76
96
|
* Query the graph for vertices.
|
|
77
97
|
* @param options The query options.
|
|
78
98
|
* @param options.id The optional id to look for.
|
|
79
99
|
* @param options.idMode Look in id, alias or both, defaults to both.
|
|
100
|
+
* @param options.resourceTypes Include vertices with specific resource types.
|
|
101
|
+
* @param conditions Conditions to use in the query.
|
|
80
102
|
* @param orderBy The order for the results, defaults to created.
|
|
81
103
|
* @param orderByDirection The direction for the order, defaults to descending.
|
|
82
104
|
* @param properties The properties to return, if not provided defaults to id, created, aliases and object.
|
|
@@ -87,5 +109,6 @@ export declare class AuditableItemGraphClient extends BaseRestClient implements
|
|
|
87
109
|
query(options?: {
|
|
88
110
|
id?: string;
|
|
89
111
|
idMode?: "id" | "alias" | "both";
|
|
90
|
-
|
|
112
|
+
resourceTypes?: string[];
|
|
113
|
+
}, conditions?: IComparator[], orderBy?: keyof Pick<IAuditableItemGraphVertex, "dateCreated" | "dateModified">, orderByDirection?: SortDirection, properties?: (keyof IAuditableItemGraphVertex)[], cursor?: string, pageSize?: number): Promise<IAuditableItemGraphVertexList>;
|
|
91
114
|
}
|
package/docs/changelog.md
CHANGED
|
@@ -1,5 +1,195 @@
|
|
|
1
1
|
# @twin.org/auditable-item-graph-rest-client - Changelog
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## [0.0.2-next.1](https://github.com/twinfoundation/auditable-item-graph/compare/auditable-item-graph-rest-client-v0.0.2-next.0...auditable-item-graph-rest-client-v0.0.2-next.1) (2025-07-21)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* rest client expose remove verifiable ([a22a743](https://github.com/twinfoundation/auditable-item-graph/commit/a22a743ddc39377630ea0a51ca3f6e97890832c9))
|
|
9
|
+
* update dependencies ([6986689](https://github.com/twinfoundation/auditable-item-graph/commit/698668957a1fcb7f85ce2f117914d5980043924f))
|
|
10
|
+
* use shared store mechanism ([#10](https://github.com/twinfoundation/auditable-item-graph/issues/10)) ([da035e5](https://github.com/twinfoundation/auditable-item-graph/commit/da035e5eb8f157482b4eb2bdbc689c6c0647ff7d))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* only include alias in index if not deleted ([#6](https://github.com/twinfoundation/auditable-item-graph/issues/6)) ([5da3c41](https://github.com/twinfoundation/auditable-item-graph/commit/5da3c419fafa2afefd34b1c570d103012b888a75))
|
|
16
|
+
* query params force coercion ([2dd9afe](https://github.com/twinfoundation/auditable-item-graph/commit/2dd9afe9ec37e2a91c110317fe289f7495c187a0))
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Dependencies
|
|
20
|
+
|
|
21
|
+
* The following workspace dependencies were updated
|
|
22
|
+
* dependencies
|
|
23
|
+
* @twin.org/auditable-item-graph-models bumped from 0.0.2-next.0 to 0.0.2-next.1
|
|
24
|
+
|
|
25
|
+
## 0.0.1 (2025-07-09)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
### Features
|
|
29
|
+
|
|
30
|
+
* release to production ([0ce06f7](https://github.com/twinfoundation/auditable-item-graph/commit/0ce06f7825aa72d04b7a2ffd8c98cb56290b9d16))
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
### Dependencies
|
|
34
|
+
|
|
35
|
+
* The following workspace dependencies were updated
|
|
36
|
+
* dependencies
|
|
37
|
+
* @twin.org/auditable-item-graph-models bumped from ^0.0.0 to ^0.0.1
|
|
38
|
+
|
|
39
|
+
## [0.0.1-next.44](https://github.com/twinfoundation/auditable-item-graph/compare/auditable-item-graph-rest-client-v0.0.1-next.43...auditable-item-graph-rest-client-v0.0.1-next.44) (2025-06-20)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
### Bug Fixes
|
|
43
|
+
|
|
44
|
+
* query params force coercion ([2dd9afe](https://github.com/twinfoundation/auditable-item-graph/commit/2dd9afe9ec37e2a91c110317fe289f7495c187a0))
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
### Dependencies
|
|
48
|
+
|
|
49
|
+
* The following workspace dependencies were updated
|
|
50
|
+
* dependencies
|
|
51
|
+
* @twin.org/auditable-item-graph-models bumped from 0.0.1-next.43 to 0.0.1-next.44
|
|
52
|
+
|
|
53
|
+
## [0.0.1-next.43](https://github.com/twinfoundation/auditable-item-graph/compare/auditable-item-graph-rest-client-v0.0.1-next.42...auditable-item-graph-rest-client-v0.0.1-next.43) (2025-06-17)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
### Miscellaneous Chores
|
|
57
|
+
|
|
58
|
+
* **auditable-item-graph-rest-client:** Synchronize repo versions
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
### Dependencies
|
|
62
|
+
|
|
63
|
+
* The following workspace dependencies were updated
|
|
64
|
+
* dependencies
|
|
65
|
+
* @twin.org/auditable-item-graph-models bumped from 0.0.1-next.42 to 0.0.1-next.43
|
|
66
|
+
|
|
67
|
+
## [0.0.1-next.42](https://github.com/twinfoundation/auditable-item-graph/compare/auditable-item-graph-rest-client-v0.0.1-next.41...auditable-item-graph-rest-client-v0.0.1-next.42) (2025-06-12)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
### Features
|
|
71
|
+
|
|
72
|
+
* update dependencies ([6986689](https://github.com/twinfoundation/auditable-item-graph/commit/698668957a1fcb7f85ce2f117914d5980043924f))
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
### Dependencies
|
|
76
|
+
|
|
77
|
+
* The following workspace dependencies were updated
|
|
78
|
+
* dependencies
|
|
79
|
+
* @twin.org/auditable-item-graph-models bumped from 0.0.1-next.41 to 0.0.1-next.42
|
|
80
|
+
|
|
81
|
+
## [0.0.1-next.41](https://github.com/twinfoundation/auditable-item-graph/compare/auditable-item-graph-rest-client-v0.0.1-next.40...auditable-item-graph-rest-client-v0.0.1-next.41) (2025-06-03)
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
### Miscellaneous Chores
|
|
85
|
+
|
|
86
|
+
* **auditable-item-graph-rest-client:** Synchronize repo versions
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
### Dependencies
|
|
90
|
+
|
|
91
|
+
* The following workspace dependencies were updated
|
|
92
|
+
* dependencies
|
|
93
|
+
* @twin.org/auditable-item-graph-models bumped from 0.0.1-next.40 to 0.0.1-next.41
|
|
94
|
+
|
|
95
|
+
## [0.0.1-next.40](https://github.com/twinfoundation/auditable-item-graph/compare/auditable-item-graph-rest-client-v0.0.1-next.39...auditable-item-graph-rest-client-v0.0.1-next.40) (2025-05-28)
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
### Miscellaneous Chores
|
|
99
|
+
|
|
100
|
+
* **auditable-item-graph-rest-client:** Synchronize repo versions
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
### Dependencies
|
|
104
|
+
|
|
105
|
+
* The following workspace dependencies were updated
|
|
106
|
+
* dependencies
|
|
107
|
+
* @twin.org/auditable-item-graph-models bumped from 0.0.1-next.39 to 0.0.1-next.40
|
|
108
|
+
|
|
109
|
+
## [0.0.1-next.39](https://github.com/twinfoundation/auditable-item-graph/compare/auditable-item-graph-rest-client-v0.0.1-next.38...auditable-item-graph-rest-client-v0.0.1-next.39) (2025-05-08)
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
### Miscellaneous Chores
|
|
113
|
+
|
|
114
|
+
* **auditable-item-graph-rest-client:** Synchronize repo versions
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
### Dependencies
|
|
118
|
+
|
|
119
|
+
* The following workspace dependencies were updated
|
|
120
|
+
* dependencies
|
|
121
|
+
* @twin.org/auditable-item-graph-models bumped from 0.0.1-next.38 to 0.0.1-next.39
|
|
122
|
+
|
|
123
|
+
## [0.0.1-next.38](https://github.com/twinfoundation/auditable-item-graph/compare/auditable-item-graph-rest-client-v0.0.1-next.37...auditable-item-graph-rest-client-v0.0.1-next.38) (2025-04-17)
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
### Features
|
|
127
|
+
|
|
128
|
+
* use shared store mechanism ([#10](https://github.com/twinfoundation/auditable-item-graph/issues/10)) ([da035e5](https://github.com/twinfoundation/auditable-item-graph/commit/da035e5eb8f157482b4eb2bdbc689c6c0647ff7d))
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
### Dependencies
|
|
132
|
+
|
|
133
|
+
* The following workspace dependencies were updated
|
|
134
|
+
* dependencies
|
|
135
|
+
* @twin.org/auditable-item-graph-models bumped from 0.0.1-next.37 to 0.0.1-next.38
|
|
136
|
+
|
|
137
|
+
## [0.0.1-next.37](https://github.com/twinfoundation/auditable-item-graph/compare/auditable-item-graph-rest-client-v0.0.1-next.36...auditable-item-graph-rest-client-v0.0.1-next.37) (2025-04-11)
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
### Bug Fixes
|
|
141
|
+
|
|
142
|
+
* only include alias in index if not deleted ([#6](https://github.com/twinfoundation/auditable-item-graph/issues/6)) ([5da3c41](https://github.com/twinfoundation/auditable-item-graph/commit/5da3c419fafa2afefd34b1c570d103012b888a75))
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
### Dependencies
|
|
146
|
+
|
|
147
|
+
* The following workspace dependencies were updated
|
|
148
|
+
* dependencies
|
|
149
|
+
* @twin.org/auditable-item-graph-models bumped from 0.0.1-next.36 to 0.0.1-next.37
|
|
150
|
+
|
|
151
|
+
## [0.0.1-next.36](https://github.com/twinfoundation/auditable-item-graph/compare/auditable-item-graph-rest-client-v0.0.1-next.35...auditable-item-graph-rest-client-v0.0.1-next.36) (2025-04-11)
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
### Bug Fixes
|
|
155
|
+
|
|
156
|
+
* only include alias in index if not deleted ([#6](https://github.com/twinfoundation/auditable-item-graph/issues/6)) ([5da3c41](https://github.com/twinfoundation/auditable-item-graph/commit/5da3c419fafa2afefd34b1c570d103012b888a75))
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
### Dependencies
|
|
160
|
+
|
|
161
|
+
* The following workspace dependencies were updated
|
|
162
|
+
* dependencies
|
|
163
|
+
* @twin.org/auditable-item-graph-models bumped from 0.0.1-next.35 to 0.0.1-next.36
|
|
164
|
+
|
|
165
|
+
## [0.0.1-next.35](https://github.com/twinfoundation/auditable-item-graph/compare/auditable-item-graph-rest-client-v0.0.1-next.34...auditable-item-graph-rest-client-v0.0.1-next.35) (2025-04-10)
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
### Miscellaneous Chores
|
|
169
|
+
|
|
170
|
+
* **auditable-item-graph-rest-client:** Synchronize repo versions
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
### Dependencies
|
|
174
|
+
|
|
175
|
+
* The following workspace dependencies were updated
|
|
176
|
+
* dependencies
|
|
177
|
+
* @twin.org/auditable-item-graph-models bumped from 0.0.1-next.34 to 0.0.1-next.35
|
|
178
|
+
|
|
179
|
+
## [0.0.1-next.34](https://github.com/twinfoundation/auditable-item-graph/compare/auditable-item-graph-rest-client-v0.0.1-next.33...auditable-item-graph-rest-client-v0.0.1-next.34) (2025-03-28)
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
### Miscellaneous Chores
|
|
183
|
+
|
|
184
|
+
* **auditable-item-graph-rest-client:** Synchronize repo versions
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
### Dependencies
|
|
188
|
+
|
|
189
|
+
* The following workspace dependencies were updated
|
|
190
|
+
* dependencies
|
|
191
|
+
* @twin.org/auditable-item-graph-models bumped from 0.0.1-next.33 to 0.0.1-next.34
|
|
192
|
+
|
|
193
|
+
## v0.0.1-next.33
|
|
4
194
|
|
|
5
195
|
- Initial Release
|
|
@@ -12,21 +12,23 @@ Client for performing auditable item graph through to REST endpoints.
|
|
|
12
12
|
|
|
13
13
|
## Constructors
|
|
14
14
|
|
|
15
|
-
###
|
|
15
|
+
### Constructor
|
|
16
16
|
|
|
17
|
-
> **new AuditableItemGraphClient**(`config`):
|
|
17
|
+
> **new AuditableItemGraphClient**(`config`): `AuditableItemGraphClient`
|
|
18
18
|
|
|
19
19
|
Create a new instance of AuditableItemGraphClient.
|
|
20
20
|
|
|
21
21
|
#### Parameters
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
##### config
|
|
24
|
+
|
|
25
|
+
`IBaseRestClientConfig`
|
|
24
26
|
|
|
25
27
|
The configuration for the client.
|
|
26
28
|
|
|
27
29
|
#### Returns
|
|
28
30
|
|
|
29
|
-
|
|
31
|
+
`AuditableItemGraphClient`
|
|
30
32
|
|
|
31
33
|
#### Overrides
|
|
32
34
|
|
|
@@ -48,25 +50,37 @@ Runtime name for the class.
|
|
|
48
50
|
|
|
49
51
|
### create()
|
|
50
52
|
|
|
51
|
-
> **create**(`
|
|
53
|
+
> **create**(`vertex`): `Promise`\<`string`\>
|
|
52
54
|
|
|
53
55
|
Create a new graph vertex.
|
|
54
56
|
|
|
55
57
|
#### Parameters
|
|
56
58
|
|
|
57
|
-
|
|
59
|
+
##### vertex
|
|
60
|
+
|
|
61
|
+
The vertex to create.
|
|
62
|
+
|
|
63
|
+
###### annotationObject?
|
|
64
|
+
|
|
65
|
+
`IJsonLdNodeObject`
|
|
58
66
|
|
|
59
|
-
The object for the vertex.
|
|
67
|
+
The annotation object for the vertex as JSON-LD.
|
|
60
68
|
|
|
61
|
-
|
|
69
|
+
###### aliases?
|
|
70
|
+
|
|
71
|
+
`object`[]
|
|
62
72
|
|
|
63
73
|
Alternative aliases that can be used to identify the vertex.
|
|
64
74
|
|
|
65
|
-
|
|
75
|
+
###### resources?
|
|
76
|
+
|
|
77
|
+
`object`[]
|
|
66
78
|
|
|
67
79
|
The resources attached to the vertex.
|
|
68
80
|
|
|
69
|
-
|
|
81
|
+
###### edges?
|
|
82
|
+
|
|
83
|
+
`object`[]
|
|
70
84
|
|
|
71
85
|
The edges connected to the vertex.
|
|
72
86
|
|
|
@@ -84,29 +98,37 @@ The id of the new graph item.
|
|
|
84
98
|
|
|
85
99
|
### get()
|
|
86
100
|
|
|
87
|
-
> **get**(`id`, `options
|
|
101
|
+
> **get**(`id`, `options?`): `Promise`\<`IAuditableItemGraphVertex`\>
|
|
88
102
|
|
|
89
103
|
Get a graph vertex.
|
|
90
104
|
|
|
91
105
|
#### Parameters
|
|
92
106
|
|
|
93
|
-
|
|
107
|
+
##### id
|
|
108
|
+
|
|
109
|
+
`string`
|
|
94
110
|
|
|
95
111
|
The id of the vertex to get.
|
|
96
112
|
|
|
97
|
-
|
|
113
|
+
##### options?
|
|
98
114
|
|
|
99
115
|
Additional options for the get operation.
|
|
100
116
|
|
|
101
|
-
|
|
117
|
+
###### includeDeleted?
|
|
118
|
+
|
|
119
|
+
`boolean`
|
|
102
120
|
|
|
103
121
|
Whether to include deleted/updated aliases, resource, edges, defaults to false.
|
|
104
122
|
|
|
105
|
-
|
|
123
|
+
###### includeChangesets?
|
|
124
|
+
|
|
125
|
+
`boolean`
|
|
106
126
|
|
|
107
127
|
Whether to include the changesets of the vertex, defaults to false.
|
|
108
128
|
|
|
109
|
-
|
|
129
|
+
###### verifySignatureDepth?
|
|
130
|
+
|
|
131
|
+
`VerifyDepth`
|
|
110
132
|
|
|
111
133
|
How many signatures to verify, defaults to "none".
|
|
112
134
|
|
|
@@ -128,29 +150,43 @@ NotFoundError if the vertex is not found.
|
|
|
128
150
|
|
|
129
151
|
### update()
|
|
130
152
|
|
|
131
|
-
> **update**(`
|
|
153
|
+
> **update**(`vertex`): `Promise`\<`void`\>
|
|
132
154
|
|
|
133
155
|
Update a graph vertex.
|
|
134
156
|
|
|
135
157
|
#### Parameters
|
|
136
158
|
|
|
137
|
-
|
|
159
|
+
##### vertex
|
|
160
|
+
|
|
161
|
+
The vertex to update.
|
|
162
|
+
|
|
163
|
+
###### id
|
|
164
|
+
|
|
165
|
+
`string`
|
|
138
166
|
|
|
139
167
|
The id of the vertex to update.
|
|
140
168
|
|
|
141
|
-
|
|
169
|
+
###### annotationObject?
|
|
142
170
|
|
|
143
|
-
|
|
171
|
+
`IJsonLdNodeObject`
|
|
144
172
|
|
|
145
|
-
|
|
173
|
+
The annotation object for the vertex as JSON-LD.
|
|
174
|
+
|
|
175
|
+
###### aliases?
|
|
176
|
+
|
|
177
|
+
`object`[]
|
|
146
178
|
|
|
147
179
|
Alternative aliases that can be used to identify the vertex.
|
|
148
180
|
|
|
149
|
-
|
|
181
|
+
###### resources?
|
|
182
|
+
|
|
183
|
+
`object`[]
|
|
150
184
|
|
|
151
185
|
The resources attached to the vertex.
|
|
152
186
|
|
|
153
|
-
|
|
187
|
+
###### edges?
|
|
188
|
+
|
|
189
|
+
`object`[]
|
|
154
190
|
|
|
155
191
|
The edges connected to the vertex.
|
|
156
192
|
|
|
@@ -166,43 +202,99 @@ Nothing.
|
|
|
166
202
|
|
|
167
203
|
***
|
|
168
204
|
|
|
205
|
+
### removeVerifiable()
|
|
206
|
+
|
|
207
|
+
> **removeVerifiable**(`id`): `Promise`\<`void`\>
|
|
208
|
+
|
|
209
|
+
Remove the verifiable storage for an item, not supported on client.
|
|
210
|
+
|
|
211
|
+
#### Parameters
|
|
212
|
+
|
|
213
|
+
##### id
|
|
214
|
+
|
|
215
|
+
`string`
|
|
216
|
+
|
|
217
|
+
The id of the vertex to get.
|
|
218
|
+
|
|
219
|
+
#### Returns
|
|
220
|
+
|
|
221
|
+
`Promise`\<`void`\>
|
|
222
|
+
|
|
223
|
+
Nothing.
|
|
224
|
+
|
|
225
|
+
#### Throws
|
|
226
|
+
|
|
227
|
+
NotFoundError if the vertex is not found.
|
|
228
|
+
|
|
229
|
+
#### Implementation of
|
|
230
|
+
|
|
231
|
+
`IAuditableItemGraphComponent.removeVerifiable`
|
|
232
|
+
|
|
233
|
+
***
|
|
234
|
+
|
|
169
235
|
### query()
|
|
170
236
|
|
|
171
|
-
> **query**(`options
|
|
237
|
+
> **query**(`options?`, `conditions?`, `orderBy?`, `orderByDirection?`, `properties?`, `cursor?`, `pageSize?`): `Promise`\<`IAuditableItemGraphVertexList`\>
|
|
172
238
|
|
|
173
239
|
Query the graph for vertices.
|
|
174
240
|
|
|
175
241
|
#### Parameters
|
|
176
242
|
|
|
177
|
-
|
|
243
|
+
##### options?
|
|
178
244
|
|
|
179
245
|
The query options.
|
|
180
246
|
|
|
181
|
-
|
|
247
|
+
###### id?
|
|
248
|
+
|
|
249
|
+
`string`
|
|
182
250
|
|
|
183
251
|
The optional id to look for.
|
|
184
252
|
|
|
185
|
-
|
|
253
|
+
###### idMode?
|
|
254
|
+
|
|
255
|
+
`"id"` \| `"alias"` \| `"both"`
|
|
186
256
|
|
|
187
257
|
Look in id, alias or both, defaults to both.
|
|
188
258
|
|
|
189
|
-
|
|
259
|
+
###### resourceTypes?
|
|
260
|
+
|
|
261
|
+
`string`[]
|
|
262
|
+
|
|
263
|
+
Include vertices with specific resource types.
|
|
264
|
+
|
|
265
|
+
##### conditions?
|
|
266
|
+
|
|
267
|
+
`IComparator`[]
|
|
268
|
+
|
|
269
|
+
Conditions to use in the query.
|
|
270
|
+
|
|
271
|
+
##### orderBy?
|
|
190
272
|
|
|
191
273
|
The order for the results, defaults to created.
|
|
192
274
|
|
|
193
|
-
|
|
275
|
+
`"dateCreated"` | `"dateModified"`
|
|
276
|
+
|
|
277
|
+
##### orderByDirection?
|
|
278
|
+
|
|
279
|
+
`SortDirection`
|
|
194
280
|
|
|
195
281
|
The direction for the order, defaults to descending.
|
|
196
282
|
|
|
197
|
-
|
|
283
|
+
##### properties?
|
|
284
|
+
|
|
285
|
+
keyof `IAuditableItemGraphVertex`[]
|
|
198
286
|
|
|
199
287
|
The properties to return, if not provided defaults to id, created, aliases and object.
|
|
200
288
|
|
|
201
|
-
|
|
289
|
+
##### cursor?
|
|
290
|
+
|
|
291
|
+
`string`
|
|
202
292
|
|
|
203
293
|
The cursor to request the next page of entities.
|
|
204
294
|
|
|
205
|
-
|
|
295
|
+
##### pageSize?
|
|
296
|
+
|
|
297
|
+
`number`
|
|
206
298
|
|
|
207
299
|
The maximum number of entities in a page.
|
|
208
300
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/auditable-item-graph-rest-client",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2-next.1",
|
|
4
4
|
"description": "Auditable Item Graph contract implementation which can connect to REST endpoints",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@twin.org/api-core": "next",
|
|
18
18
|
"@twin.org/api-models": "next",
|
|
19
|
-
"@twin.org/auditable-item-graph-models": "0.0.
|
|
19
|
+
"@twin.org/auditable-item-graph-models": "0.0.2-next.1",
|
|
20
20
|
"@twin.org/core": "next",
|
|
21
21
|
"@twin.org/data-json-ld": "next",
|
|
22
22
|
"@twin.org/entity": "next",
|
|
@@ -29,11 +29,11 @@
|
|
|
29
29
|
"types": "./dist/types/index.d.ts",
|
|
30
30
|
"exports": {
|
|
31
31
|
".": {
|
|
32
|
+
"types": "./dist/types/index.d.ts",
|
|
32
33
|
"require": "./dist/cjs/index.cjs",
|
|
33
|
-
"import": "./dist/esm/index.mjs"
|
|
34
|
-
"types": "./dist/types/index.d.ts"
|
|
34
|
+
"import": "./dist/esm/index.mjs"
|
|
35
35
|
},
|
|
36
|
-
"./locales": "./locales"
|
|
36
|
+
"./locales/*.json": "./locales/*.json"
|
|
37
37
|
},
|
|
38
38
|
"files": [
|
|
39
39
|
"dist/cjs",
|