@3sixty/auditable-item-graph-rest-client 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/auditableItemGraphRestClient.js +267 -0
- package/dist/es/auditableItemGraphRestClient.js.map +1 -0
- package/dist/es/index.js +4 -0
- package/dist/es/index.js.map +1 -0
- package/dist/types/auditableItemGraphRestClient.d.ts +143 -0
- package/dist/types/index.d.ts +1 -0
- package/docs/changelog.md +0 -0
- package/docs/examples.md +119 -0
- package/docs/reference/classes/AuditableItemGraphRestClient.md +468 -0
- package/docs/reference/index.md +5 -0
- package/locales/en.json +1 -0
- package/package.json +54 -5
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2024 IOTA Stiftung.
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,27 @@
|
|
|
1
|
-
#
|
|
1
|
+
# 3Sixty Auditable Item Graph REST Client
|
|
2
2
|
|
|
3
|
-
This
|
|
3
|
+
This package offers a straightforward client for sending auditable graph requests to compatible HTTP endpoints.
|
|
4
|
+
|
|
5
|
+
It helps applications consume graph, changeset, and query operations without reimplementing request and response handling.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```shell
|
|
10
|
+
npm install @3sixty/auditable-item-graph-rest-client
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Examples
|
|
14
|
+
|
|
15
|
+
Usage of the APIs is shown in the examples [docs/examples.md](docs/examples.md)
|
|
16
|
+
|
|
17
|
+
## Reference
|
|
18
|
+
|
|
19
|
+
Detailed reference documentation for the API can be found in [docs/reference/index.md](docs/reference/index.md)
|
|
20
|
+
|
|
21
|
+
## Changelog
|
|
22
|
+
|
|
23
|
+
The changes between each version can be found in [docs/changelog.md](docs/changelog.md)
|
|
24
|
+
|
|
25
|
+
## Origin
|
|
26
|
+
|
|
27
|
+
This package is derived from the original [iotaledger/twin-auditable-item-graph](https://github.com/iotaledger/twin-auditable-item-graph/tree/next/packages/auditable-item-graph-rest-client) repository.
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
// Copyright 2024 IOTA Stiftung.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
3
|
+
import { BaseRestClient } from "@3sixty/api-core";
|
|
4
|
+
import { HttpHeaderHelper, HttpParameterHelper } from "@3sixty/api-models";
|
|
5
|
+
import { Coerce, Guards, Urn } from "@3sixty/core";
|
|
6
|
+
import { HeaderTypes, HttpMethod, MimeTypes } from "@3sixty/web";
|
|
7
|
+
/**
|
|
8
|
+
* Client for performing auditable item graph through to REST endpoints.
|
|
9
|
+
*/
|
|
10
|
+
export class AuditableItemGraphRestClient extends BaseRestClient {
|
|
11
|
+
/**
|
|
12
|
+
* Runtime name for the class.
|
|
13
|
+
*/
|
|
14
|
+
static CLASS_NAME = "AuditableItemGraphRestClient";
|
|
15
|
+
/**
|
|
16
|
+
* Create a new instance of AuditableItemGraphRestClient.
|
|
17
|
+
* @param config The configuration for the client.
|
|
18
|
+
*/
|
|
19
|
+
constructor(config) {
|
|
20
|
+
super("AuditableItemGraphRestClient", config, "auditable-item-graph");
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Returns the class name of the component.
|
|
24
|
+
* @returns The class name of the component.
|
|
25
|
+
*/
|
|
26
|
+
className() {
|
|
27
|
+
return AuditableItemGraphRestClient.CLASS_NAME;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Create a new graph vertex.
|
|
31
|
+
* @param vertex The vertex to create.
|
|
32
|
+
* @param vertex.annotationObject The annotation object for the vertex as JSON-LD.
|
|
33
|
+
* @param vertex.aliases Alternative aliases that can be used to identify the vertex.
|
|
34
|
+
* @param vertex.resources The resources attached to the vertex.
|
|
35
|
+
* @param vertex.edges The edges connected to the vertex.
|
|
36
|
+
* @returns The id of the new graph item.
|
|
37
|
+
*/
|
|
38
|
+
async create(vertex) {
|
|
39
|
+
const response = await this.fetch("/", HttpMethod.POST, {
|
|
40
|
+
body: vertex
|
|
41
|
+
});
|
|
42
|
+
return HttpHeaderHelper.extractId(response.headers, `${this.getPathPrefix()}/:id`);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Get a graph vertex.
|
|
46
|
+
* @param id The id of the vertex to get.
|
|
47
|
+
* @param options Additional options for the get operation.
|
|
48
|
+
* @param options.includeDeleted Whether to include deleted/updated aliases, resource, edges, defaults to false.
|
|
49
|
+
* @param options.verifySignatureDepth How many signatures to verify, defaults to "none".
|
|
50
|
+
* @returns The vertex if found.
|
|
51
|
+
* @throws NotFoundError if the vertex is not found.
|
|
52
|
+
*/
|
|
53
|
+
async get(id, options) {
|
|
54
|
+
Guards.stringValue(AuditableItemGraphRestClient.CLASS_NAME, "id", id);
|
|
55
|
+
const response = await this.fetch("/:id", HttpMethod.GET, {
|
|
56
|
+
headers: {
|
|
57
|
+
[HeaderTypes.Accept]: MimeTypes.JsonLd
|
|
58
|
+
},
|
|
59
|
+
pathParams: {
|
|
60
|
+
id
|
|
61
|
+
},
|
|
62
|
+
query: {
|
|
63
|
+
includeDeleted: Coerce.string(options?.includeDeleted),
|
|
64
|
+
verifySignatureDepth: options?.verifySignatureDepth
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
return response.body;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Get a graph vertex changeset list.
|
|
71
|
+
* @param id The id of the vertex to get.
|
|
72
|
+
* @param cursor The optional cursor to get next chunk.
|
|
73
|
+
* @param limit Limit the number of entities to return.
|
|
74
|
+
* @param options Additional options for the get operation.
|
|
75
|
+
* @param options.verifySignatureDepth How many signatures to verify, defaults to "none".
|
|
76
|
+
* @returns The changesets if found.
|
|
77
|
+
*/
|
|
78
|
+
async getChangesets(id, cursor, limit, options) {
|
|
79
|
+
Guards.stringValue(AuditableItemGraphRestClient.CLASS_NAME, "id", id);
|
|
80
|
+
const response = await this.fetch("/:id/changesets", HttpMethod.GET, {
|
|
81
|
+
headers: {
|
|
82
|
+
[HeaderTypes.Accept]: MimeTypes.JsonLd
|
|
83
|
+
},
|
|
84
|
+
pathParams: {
|
|
85
|
+
id
|
|
86
|
+
},
|
|
87
|
+
query: {
|
|
88
|
+
cursor,
|
|
89
|
+
limit: Coerce.string(limit),
|
|
90
|
+
verifySignatureDepth: options?.verifySignatureDepth
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
return {
|
|
94
|
+
changesets: response.body,
|
|
95
|
+
cursor: HttpHeaderHelper.extractCursor(response.headers)
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Get a graph vertex changeset.
|
|
100
|
+
* @param id The id of the vertex to get.
|
|
101
|
+
* @param options Additional options for the get operation.
|
|
102
|
+
* @param options.verifySignatureDepth How many signatures to verify, defaults to "none".
|
|
103
|
+
* @returns The changeset if found.
|
|
104
|
+
* @throws NotFoundError if the vertex or changeset is not found.
|
|
105
|
+
*/
|
|
106
|
+
async getChangeset(id, options) {
|
|
107
|
+
Guards.stringValue(AuditableItemGraphRestClient.CLASS_NAME, "id", id);
|
|
108
|
+
const urnParsed = Urn.fromValidString(id);
|
|
109
|
+
const namespaceSpecificParts = urnParsed.namespaceSpecificParts();
|
|
110
|
+
const vertexId = namespaceSpecificParts[0];
|
|
111
|
+
const changesetId = namespaceSpecificParts[2];
|
|
112
|
+
Guards.stringValue(AuditableItemGraphRestClient.CLASS_NAME, "vertexId", vertexId);
|
|
113
|
+
Guards.stringValue(AuditableItemGraphRestClient.CLASS_NAME, "changesetId", changesetId);
|
|
114
|
+
const response = await this.fetch("/:id/changesets/:changesetId", HttpMethod.GET, {
|
|
115
|
+
headers: {
|
|
116
|
+
[HeaderTypes.Accept]: MimeTypes.JsonLd
|
|
117
|
+
},
|
|
118
|
+
pathParams: {
|
|
119
|
+
id: vertexId,
|
|
120
|
+
changesetId
|
|
121
|
+
},
|
|
122
|
+
query: {
|
|
123
|
+
verifySignatureDepth: options?.verifySignatureDepth
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
return response.body;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Get a graph vertex at a specific version.
|
|
130
|
+
* @param id The id of the vertex.
|
|
131
|
+
* @param version The version number to retrieve.
|
|
132
|
+
* @returns The vertex reconstructed at that version.
|
|
133
|
+
* @throws NotFoundError if the vertex or version is not found.
|
|
134
|
+
*/
|
|
135
|
+
async getVersion(id, version) {
|
|
136
|
+
Guards.stringValue(AuditableItemGraphRestClient.CLASS_NAME, "id", id);
|
|
137
|
+
Guards.integer(AuditableItemGraphRestClient.CLASS_NAME, "version", version);
|
|
138
|
+
const urnParsed = Urn.fromValidString(id);
|
|
139
|
+
const vertexId = urnParsed.namespaceSpecific(0);
|
|
140
|
+
Guards.stringValue(AuditableItemGraphRestClient.CLASS_NAME, "vertexId", vertexId);
|
|
141
|
+
const response = await this.fetch("/:id/versions/:version", HttpMethod.GET, {
|
|
142
|
+
headers: {
|
|
143
|
+
[HeaderTypes.Accept]: MimeTypes.JsonLd
|
|
144
|
+
},
|
|
145
|
+
pathParams: {
|
|
146
|
+
id: vertexId,
|
|
147
|
+
version: version.toString()
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
return response.body;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Get all versions of a graph vertex.
|
|
154
|
+
* @param id The id of the vertex.
|
|
155
|
+
* @param options Additional options for the operation.
|
|
156
|
+
* @param options.after Only return versions created after this ISO 8601 timestamp (exclusive).
|
|
157
|
+
* @param options.before Only return versions created before this ISO 8601 timestamp (exclusive).
|
|
158
|
+
* @returns The list of vertex versions.
|
|
159
|
+
* @throws NotFoundError if the vertex is not found.
|
|
160
|
+
*/
|
|
161
|
+
async getVersions(id, options) {
|
|
162
|
+
Guards.stringValue(AuditableItemGraphRestClient.CLASS_NAME, "id", id);
|
|
163
|
+
const response = await this.fetch("/:id/versions", HttpMethod.GET, {
|
|
164
|
+
headers: {
|
|
165
|
+
[HeaderTypes.Accept]: MimeTypes.JsonLd
|
|
166
|
+
},
|
|
167
|
+
pathParams: {
|
|
168
|
+
id
|
|
169
|
+
},
|
|
170
|
+
query: {
|
|
171
|
+
after: options?.after,
|
|
172
|
+
before: options?.before
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
return response.body;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Update a graph vertex (PUT - full replacement of vertex state).
|
|
179
|
+
* The server serializes concurrent updates for the same vertex via `Mutex` on the vertex id;
|
|
180
|
+
* requests load-balanced across replicas can still race.
|
|
181
|
+
* @param vertex The vertex to update.
|
|
182
|
+
* @param vertex.id The id of the vertex to update.
|
|
183
|
+
* @param vertex.annotationObject The annotation object for the vertex as JSON-LD.
|
|
184
|
+
* @param vertex.aliases Alternative aliases that can be used to identify the vertex.
|
|
185
|
+
* @param vertex.resources The resources attached to the vertex.
|
|
186
|
+
* @param vertex.edges The edges connected to the vertex.
|
|
187
|
+
* @returns A promise that resolves when the vertex has been updated.
|
|
188
|
+
*/
|
|
189
|
+
async update(vertex) {
|
|
190
|
+
Guards.object(AuditableItemGraphRestClient.CLASS_NAME, "vertex", vertex);
|
|
191
|
+
Guards.stringValue(AuditableItemGraphRestClient.CLASS_NAME, "vertex.id", vertex.id);
|
|
192
|
+
const { id, ...rest } = vertex;
|
|
193
|
+
await this.fetch("/:id", HttpMethod.PUT, {
|
|
194
|
+
pathParams: {
|
|
195
|
+
id
|
|
196
|
+
},
|
|
197
|
+
body: rest
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Partially update a graph vertex (PATCH - optional scalars; list fields use `{ add, remove }`).
|
|
202
|
+
* @param partial The partial vertex update (must include `id`).
|
|
203
|
+
* @returns A promise that resolves when the partial update has been applied.
|
|
204
|
+
*/
|
|
205
|
+
async updatePartial(partial) {
|
|
206
|
+
Guards.object(AuditableItemGraphRestClient.CLASS_NAME, "partial", partial);
|
|
207
|
+
Guards.stringValue(AuditableItemGraphRestClient.CLASS_NAME, "partial.id", partial.id);
|
|
208
|
+
const { id, ...body } = partial;
|
|
209
|
+
await this.fetch("/:id", HttpMethod.PATCH, {
|
|
210
|
+
pathParams: {
|
|
211
|
+
id
|
|
212
|
+
},
|
|
213
|
+
body
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Remove the notarization proof from all changesets of a graph vertex.
|
|
218
|
+
* @param id The id of the vertex.
|
|
219
|
+
* @returns A promise that resolves when the proof has been removed.
|
|
220
|
+
*/
|
|
221
|
+
async removeProof(id) {
|
|
222
|
+
Guards.stringValue(AuditableItemGraphRestClient.CLASS_NAME, "id", id);
|
|
223
|
+
await this.fetch("/:id/proof", HttpMethod.DELETE, {
|
|
224
|
+
pathParams: { id }
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Query the graph for vertices.
|
|
229
|
+
* @param options The query options.
|
|
230
|
+
* @param options.id The optional id to look for.
|
|
231
|
+
* @param options.idMode Look in id, alias or both, defaults to both.
|
|
232
|
+
* @param options.idExact Find only exact matches, default to false meaning partial matching.
|
|
233
|
+
* @param options.resourceTypes Include vertices with specific resource types.
|
|
234
|
+
* @param conditions Conditions to use in the query.
|
|
235
|
+
* @param orderBy The order for the results, defaults to created.
|
|
236
|
+
* @param orderByDirection The direction for the order, defaults to descending.
|
|
237
|
+
* @param properties The properties to return, if not provided defaults to id, created, aliases and object.
|
|
238
|
+
* @param cursor The cursor to request the next chunk of entities.
|
|
239
|
+
* @param limit The maximum number of entities to return, a page can contain fewer so follow
|
|
240
|
+
* the cursor until it is absent to read them all.
|
|
241
|
+
* @returns The entities, which can be partial if a limited keys list was provided.
|
|
242
|
+
*/
|
|
243
|
+
async query(options, conditions, orderBy, orderByDirection, properties, cursor, limit) {
|
|
244
|
+
const response = await this.fetch("/", HttpMethod.GET, {
|
|
245
|
+
headers: {
|
|
246
|
+
[HeaderTypes.Accept]: MimeTypes.JsonLd
|
|
247
|
+
},
|
|
248
|
+
query: {
|
|
249
|
+
id: options?.id,
|
|
250
|
+
idMode: options?.idMode,
|
|
251
|
+
idExact: Coerce.string(options?.idExact),
|
|
252
|
+
resourceTypes: HttpParameterHelper.arrayToString(options?.resourceTypes),
|
|
253
|
+
conditions: HttpParameterHelper.objectToString(conditions),
|
|
254
|
+
orderBy,
|
|
255
|
+
orderByDirection,
|
|
256
|
+
properties: HttpParameterHelper.arrayToString(properties),
|
|
257
|
+
cursor,
|
|
258
|
+
limit: Coerce.string(limit)
|
|
259
|
+
}
|
|
260
|
+
});
|
|
261
|
+
return {
|
|
262
|
+
entries: response.body,
|
|
263
|
+
cursor: HttpHeaderHelper.extractCursor(response.headers)
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
//# sourceMappingURL=auditableItemGraphRestClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auditableItemGraphRestClient.js","sourceRoot":"","sources":["../../src/auditableItemGraphRestClient.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EACN,gBAAgB,EAChB,mBAAmB,EAInB,MAAM,oBAAoB,CAAC;AA2B5B,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAGnD,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,aAAa,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ixty/api-core\";\nimport {\n\tHttpHeaderHelper,\n\tHttpParameterHelper,\n\ttype IBaseRestClientConfig,\n\ttype ICreatedResponse,\n\ttype INoContentResponse\n} from \"@3sixty/api-models\";\nimport type {\n\tIAuditableItemGraphChangeset,\n\tIAuditableItemGraphChangesetGetRequest,\n\tIAuditableItemGraphChangesetGetResponse,\n\tIAuditableItemGraphChangesetList,\n\tIAuditableItemGraphChangesetListRequest,\n\tIAuditableItemGraphChangesetListResponse,\n\tIAuditableItemGraphComponent,\n\tIAuditableItemGraphCreateRequest,\n\tIAuditableItemGraphGetRequest,\n\tIAuditableItemGraphGetResponse,\n\tIAuditableItemGraphListRequest,\n\tIAuditableItemGraphListResponse,\n\tIAuditableItemGraphPartialVertex,\n\tIAuditableItemGraphRemoveProofRequest,\n\tIAuditableItemGraphUpdatePartialRequest,\n\tIAuditableItemGraphUpdateRequest,\n\tIAuditableItemGraphVersionGetRequest,\n\tIAuditableItemGraphVersionGetResponse,\n\tIAuditableItemGraphVersionListRequest,\n\tIAuditableItemGraphVersionListResponse,\n\tIAuditableItemGraphVertex,\n\tIAuditableItemGraphVertexList,\n\tIAuditableItemGraphVertexVersionList,\n\tVerifyDepth\n} from \"@3sixty/auditable-item-graph-models\";\nimport { Coerce, Guards, Urn } from \"@3sixty/core\";\nimport type { EntityCondition, SortDirection } from \"@3sixty/entity\";\nimport { nameof } from \"@3sixty/nameof\";\nimport { HeaderTypes, HttpMethod, MimeTypes } from \"@3sixty/web\";\n\n/**\n * Client for performing auditable item graph through to REST endpoints.\n */\nexport class AuditableItemGraphRestClient\n\textends BaseRestClient\n\timplements IAuditableItemGraphComponent\n{\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<AuditableItemGraphRestClient>();\n\n\t/**\n\t * Create a new instance of AuditableItemGraphRestClient.\n\t * @param config The configuration for the client.\n\t */\n\tconstructor(config: IBaseRestClientConfig) {\n\t\tsuper(nameof<AuditableItemGraphRestClient>(), config, \"auditable-item-graph\");\n\t}\n\n\t/**\n\t * Returns the class name of the component.\n\t * @returns The class name of the component.\n\t */\n\tpublic className(): string {\n\t\treturn AuditableItemGraphRestClient.CLASS_NAME;\n\t}\n\n\t/**\n\t * Create a new graph vertex.\n\t * @param vertex The vertex to create.\n\t * @param vertex.annotationObject The annotation object for the vertex as JSON-LD.\n\t * @param vertex.aliases Alternative aliases that can be used to identify the vertex.\n\t * @param vertex.resources The resources attached to the vertex.\n\t * @param vertex.edges The edges connected to the vertex.\n\t * @returns The id of the new graph item.\n\t */\n\tpublic async create(vertex: Omit<IAuditableItemGraphVertex, \"id\">): Promise<string> {\n\t\tconst response = await this.fetch<IAuditableItemGraphCreateRequest, ICreatedResponse>(\n\t\t\t\"/\",\n\t\t\tHttpMethod.POST,\n\t\t\t{\n\t\t\t\tbody: vertex\n\t\t\t}\n\t\t);\n\n\t\treturn HttpHeaderHelper.extractId(response.headers, `${this.getPathPrefix()}/:id`);\n\t}\n\n\t/**\n\t * Get a graph vertex.\n\t * @param id The id of the vertex to get.\n\t * @param options Additional options for the get operation.\n\t * @param options.includeDeleted Whether to include deleted/updated aliases, resource, edges, defaults to false.\n\t * @param options.verifySignatureDepth How many signatures to verify, defaults to \"none\".\n\t * @returns The vertex if found.\n\t * @throws NotFoundError if the vertex is not found.\n\t */\n\tpublic async get(\n\t\tid: string,\n\t\toptions?: {\n\t\t\tincludeDeleted?: boolean;\n\t\t\tverifySignatureDepth?: VerifyDepth;\n\t\t}\n\t): Promise<IAuditableItemGraphVertex> {\n\t\tGuards.stringValue(AuditableItemGraphRestClient.CLASS_NAME, nameof(id), id);\n\n\t\tconst response = await this.fetch<\n\t\t\tIAuditableItemGraphGetRequest,\n\t\t\tIAuditableItemGraphGetResponse\n\t\t>(\"/:id\", HttpMethod.GET, {\n\t\t\theaders: {\n\t\t\t\t[HeaderTypes.Accept]: MimeTypes.JsonLd\n\t\t\t},\n\t\t\tpathParams: {\n\t\t\t\tid\n\t\t\t},\n\t\t\tquery: {\n\t\t\t\tincludeDeleted: Coerce.string(options?.includeDeleted),\n\t\t\t\tverifySignatureDepth: options?.verifySignatureDepth\n\t\t\t}\n\t\t});\n\n\t\treturn response.body;\n\t}\n\n\t/**\n\t * Get a graph vertex changeset list.\n\t * @param id The id of the vertex to get.\n\t * @param cursor The optional cursor to get next chunk.\n\t * @param limit Limit the number of entities to return.\n\t * @param options Additional options for the get operation.\n\t * @param options.verifySignatureDepth How many signatures to verify, defaults to \"none\".\n\t * @returns The changesets if found.\n\t */\n\tpublic async getChangesets(\n\t\tid: string,\n\t\tcursor?: string,\n\t\tlimit?: number,\n\t\toptions?: {\n\t\t\tverifySignatureDepth?: VerifyDepth;\n\t\t}\n\t): Promise<{\n\t\tchangesets: IAuditableItemGraphChangesetList;\n\t\tcursor?: string;\n\t}> {\n\t\tGuards.stringValue(AuditableItemGraphRestClient.CLASS_NAME, nameof(id), id);\n\n\t\tconst response = await this.fetch<\n\t\t\tIAuditableItemGraphChangesetListRequest,\n\t\t\tIAuditableItemGraphChangesetListResponse\n\t\t>(\"/:id/changesets\", HttpMethod.GET, {\n\t\t\theaders: {\n\t\t\t\t[HeaderTypes.Accept]: MimeTypes.JsonLd\n\t\t\t},\n\t\t\tpathParams: {\n\t\t\t\tid\n\t\t\t},\n\t\t\tquery: {\n\t\t\t\tcursor,\n\t\t\t\tlimit: Coerce.string(limit),\n\t\t\t\tverifySignatureDepth: options?.verifySignatureDepth\n\t\t\t}\n\t\t});\n\n\t\treturn {\n\t\t\tchangesets: response.body,\n\t\t\tcursor: HttpHeaderHelper.extractCursor(response.headers)\n\t\t};\n\t}\n\n\t/**\n\t * Get a graph vertex changeset.\n\t * @param id The id of the vertex to get.\n\t * @param options Additional options for the get operation.\n\t * @param options.verifySignatureDepth How many signatures to verify, defaults to \"none\".\n\t * @returns The changeset if found.\n\t * @throws NotFoundError if the vertex or changeset is not found.\n\t */\n\tpublic async getChangeset(\n\t\tid: string,\n\t\toptions?: { verifySignatureDepth?: VerifyDepth }\n\t): Promise<IAuditableItemGraphChangeset> {\n\t\tGuards.stringValue(AuditableItemGraphRestClient.CLASS_NAME, nameof(id), id);\n\n\t\tconst urnParsed = Urn.fromValidString(id);\n\t\tconst namespaceSpecificParts = urnParsed.namespaceSpecificParts();\n\t\tconst vertexId = namespaceSpecificParts[0];\n\t\tconst changesetId = namespaceSpecificParts[2];\n\n\t\tGuards.stringValue(AuditableItemGraphRestClient.CLASS_NAME, \"vertexId\", vertexId);\n\t\tGuards.stringValue(AuditableItemGraphRestClient.CLASS_NAME, \"changesetId\", changesetId);\n\n\t\tconst response = await this.fetch<\n\t\t\tIAuditableItemGraphChangesetGetRequest,\n\t\t\tIAuditableItemGraphChangesetGetResponse\n\t\t>(\"/:id/changesets/:changesetId\", HttpMethod.GET, {\n\t\t\theaders: {\n\t\t\t\t[HeaderTypes.Accept]: MimeTypes.JsonLd\n\t\t\t},\n\t\t\tpathParams: {\n\t\t\t\tid: vertexId,\n\t\t\t\tchangesetId\n\t\t\t},\n\t\t\tquery: {\n\t\t\t\tverifySignatureDepth: options?.verifySignatureDepth\n\t\t\t}\n\t\t});\n\n\t\treturn response.body;\n\t}\n\n\t/**\n\t * Get a graph vertex at a specific version.\n\t * @param id The id of the vertex.\n\t * @param version The version number to retrieve.\n\t * @returns The vertex reconstructed at that version.\n\t * @throws NotFoundError if the vertex or version is not found.\n\t */\n\tpublic async getVersion(id: string, version: number): Promise<IAuditableItemGraphVertex> {\n\t\tGuards.stringValue(AuditableItemGraphRestClient.CLASS_NAME, nameof(id), id);\n\t\tGuards.integer(AuditableItemGraphRestClient.CLASS_NAME, nameof(version), version);\n\n\t\tconst urnParsed = Urn.fromValidString(id);\n\t\tconst vertexId = urnParsed.namespaceSpecific(0);\n\n\t\tGuards.stringValue(AuditableItemGraphRestClient.CLASS_NAME, \"vertexId\", vertexId);\n\n\t\tconst response = await this.fetch<\n\t\t\tIAuditableItemGraphVersionGetRequest,\n\t\t\tIAuditableItemGraphVersionGetResponse\n\t\t>(\"/:id/versions/:version\", HttpMethod.GET, {\n\t\t\theaders: {\n\t\t\t\t[HeaderTypes.Accept]: MimeTypes.JsonLd\n\t\t\t},\n\t\t\tpathParams: {\n\t\t\t\tid: vertexId,\n\t\t\t\tversion: version.toString()\n\t\t\t}\n\t\t});\n\n\t\treturn response.body;\n\t}\n\n\t/**\n\t * Get all versions of a graph vertex.\n\t * @param id The id of the vertex.\n\t * @param options Additional options for the operation.\n\t * @param options.after Only return versions created after this ISO 8601 timestamp (exclusive).\n\t * @param options.before Only return versions created before this ISO 8601 timestamp (exclusive).\n\t * @returns The list of vertex versions.\n\t * @throws NotFoundError if the vertex is not found.\n\t */\n\tpublic async getVersions(\n\t\tid: string,\n\t\toptions?: {\n\t\t\tafter?: string;\n\t\t\tbefore?: string;\n\t\t}\n\t): Promise<IAuditableItemGraphVertexVersionList> {\n\t\tGuards.stringValue(AuditableItemGraphRestClient.CLASS_NAME, nameof(id), id);\n\n\t\tconst response = await this.fetch<\n\t\t\tIAuditableItemGraphVersionListRequest,\n\t\t\tIAuditableItemGraphVersionListResponse\n\t\t>(\"/:id/versions\", HttpMethod.GET, {\n\t\t\theaders: {\n\t\t\t\t[HeaderTypes.Accept]: MimeTypes.JsonLd\n\t\t\t},\n\t\t\tpathParams: {\n\t\t\t\tid\n\t\t\t},\n\t\t\tquery: {\n\t\t\t\tafter: options?.after,\n\t\t\t\tbefore: options?.before\n\t\t\t}\n\t\t});\n\n\t\treturn response.body;\n\t}\n\n\t/**\n\t * Update a graph vertex (PUT - full replacement of vertex state).\n\t * The server serializes concurrent updates for the same vertex via `Mutex` on the vertex id;\n\t * requests load-balanced across replicas can still race.\n\t * @param vertex The vertex to update.\n\t * @param vertex.id The id of the vertex to update.\n\t * @param vertex.annotationObject The annotation object for the vertex as JSON-LD.\n\t * @param vertex.aliases Alternative aliases that can be used to identify the vertex.\n\t * @param vertex.resources The resources attached to the vertex.\n\t * @param vertex.edges The edges connected to the vertex.\n\t * @returns A promise that resolves when the vertex has been updated.\n\t */\n\tpublic async update(vertex: IAuditableItemGraphVertex): Promise<void> {\n\t\tGuards.object(AuditableItemGraphRestClient.CLASS_NAME, nameof(vertex), vertex);\n\t\tGuards.stringValue(AuditableItemGraphRestClient.CLASS_NAME, nameof(vertex.id), vertex.id);\n\n\t\tconst { id, ...rest } = vertex;\n\n\t\tawait this.fetch<IAuditableItemGraphUpdateRequest, INoContentResponse>(\"/:id\", HttpMethod.PUT, {\n\t\t\tpathParams: {\n\t\t\t\tid\n\t\t\t},\n\t\t\tbody: rest\n\t\t});\n\t}\n\n\t/**\n\t * Partially update a graph vertex (PATCH - optional scalars; list fields use `{ add, remove }`).\n\t * @param partial The partial vertex update (must include `id`).\n\t * @returns A promise that resolves when the partial update has been applied.\n\t */\n\tpublic async updatePartial(partial: IAuditableItemGraphPartialVertex): Promise<void> {\n\t\tGuards.object(AuditableItemGraphRestClient.CLASS_NAME, nameof(partial), partial);\n\t\tGuards.stringValue(AuditableItemGraphRestClient.CLASS_NAME, nameof(partial.id), partial.id);\n\n\t\tconst { id, ...body } = partial;\n\n\t\tawait this.fetch<IAuditableItemGraphUpdatePartialRequest, INoContentResponse>(\n\t\t\t\"/:id\",\n\t\t\tHttpMethod.PATCH,\n\t\t\t{\n\t\t\t\tpathParams: {\n\t\t\t\t\tid\n\t\t\t\t},\n\t\t\t\tbody\n\t\t\t}\n\t\t);\n\t}\n\n\t/**\n\t * Remove the notarization proof from all changesets of a graph vertex.\n\t * @param id The id of the vertex.\n\t * @returns A promise that resolves when the proof has been removed.\n\t */\n\tpublic async removeProof(id: string): Promise<void> {\n\t\tGuards.stringValue(AuditableItemGraphRestClient.CLASS_NAME, nameof(id), id);\n\n\t\tawait this.fetch<IAuditableItemGraphRemoveProofRequest, INoContentResponse>(\n\t\t\t\"/:id/proof\",\n\t\t\tHttpMethod.DELETE,\n\t\t\t{\n\t\t\t\tpathParams: { id }\n\t\t\t}\n\t\t);\n\t}\n\n\t/**\n\t * Query the graph for vertices.\n\t * @param options The query options.\n\t * @param options.id The optional id to look for.\n\t * @param options.idMode Look in id, alias or both, defaults to both.\n\t * @param options.idExact Find only exact matches, default to false meaning partial matching.\n\t * @param options.resourceTypes Include vertices with specific resource types.\n\t * @param conditions Conditions to use in the query.\n\t * @param orderBy The order for the results, defaults to created.\n\t * @param orderByDirection The direction for the order, defaults to descending.\n\t * @param properties The properties to return, if not provided defaults to id, created, aliases and object.\n\t * @param cursor The cursor to request the next chunk of entities.\n\t * @param limit The maximum number of entities to return, a page can contain fewer so follow\n\t * the cursor until it is absent to read them all.\n\t * @returns The entities, which can be partial if a limited keys list was provided.\n\t */\n\tpublic async query(\n\t\toptions?: {\n\t\t\tid?: string;\n\t\t\tidMode?: \"id\" | \"alias\" | \"both\";\n\t\t\tidExact?: boolean;\n\t\t\tresourceTypes?: string[];\n\t\t},\n\t\tconditions?: EntityCondition<IAuditableItemGraphVertex>,\n\t\torderBy?: keyof Pick<IAuditableItemGraphVertex, \"dateCreated\" | \"dateModified\">,\n\t\torderByDirection?: SortDirection,\n\t\tproperties?: (keyof IAuditableItemGraphVertex)[],\n\t\tcursor?: string,\n\t\tlimit?: number\n\t): Promise<{\n\t\tentries: IAuditableItemGraphVertexList;\n\t\tcursor?: string;\n\t}> {\n\t\tconst response = await this.fetch<\n\t\t\tIAuditableItemGraphListRequest,\n\t\t\tIAuditableItemGraphListResponse\n\t\t>(\"/\", HttpMethod.GET, {\n\t\t\theaders: {\n\t\t\t\t[HeaderTypes.Accept]: MimeTypes.JsonLd\n\t\t\t},\n\t\t\tquery: {\n\t\t\t\tid: options?.id,\n\t\t\t\tidMode: options?.idMode,\n\t\t\t\tidExact: Coerce.string(options?.idExact),\n\t\t\t\tresourceTypes: HttpParameterHelper.arrayToString(options?.resourceTypes),\n\t\t\t\tconditions: HttpParameterHelper.objectToString(conditions),\n\t\t\t\torderBy,\n\t\t\t\torderByDirection,\n\t\t\t\tproperties: HttpParameterHelper.arrayToString(properties),\n\t\t\t\tcursor,\n\t\t\t\tlimit: Coerce.string(limit)\n\t\t\t}\n\t\t});\n\n\t\treturn {\n\t\t\tentries: response.body,\n\t\t\tcursor: HttpHeaderHelper.extractCursor(response.headers)\n\t\t};\n\t}\n}\n"]}
|
package/dist/es/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,cAAc,mCAAmC,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nexport * from \"./auditableItemGraphRestClient.js\";\n"]}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { BaseRestClient } from "@3sixty/api-core";
|
|
2
|
+
import { type IBaseRestClientConfig } from "@3sixty/api-models";
|
|
3
|
+
import type { IAuditableItemGraphChangeset, IAuditableItemGraphChangesetList, IAuditableItemGraphComponent, IAuditableItemGraphPartialVertex, IAuditableItemGraphVertex, IAuditableItemGraphVertexList, IAuditableItemGraphVertexVersionList, VerifyDepth } from "@3sixty/auditable-item-graph-models";
|
|
4
|
+
import type { EntityCondition, SortDirection } from "@3sixty/entity";
|
|
5
|
+
/**
|
|
6
|
+
* Client for performing auditable item graph through to REST endpoints.
|
|
7
|
+
*/
|
|
8
|
+
export declare class AuditableItemGraphRestClient extends BaseRestClient implements IAuditableItemGraphComponent {
|
|
9
|
+
/**
|
|
10
|
+
* Runtime name for the class.
|
|
11
|
+
*/
|
|
12
|
+
static readonly CLASS_NAME: string;
|
|
13
|
+
/**
|
|
14
|
+
* Create a new instance of AuditableItemGraphRestClient.
|
|
15
|
+
* @param config The configuration for the client.
|
|
16
|
+
*/
|
|
17
|
+
constructor(config: IBaseRestClientConfig);
|
|
18
|
+
/**
|
|
19
|
+
* Returns the class name of the component.
|
|
20
|
+
* @returns The class name of the component.
|
|
21
|
+
*/
|
|
22
|
+
className(): string;
|
|
23
|
+
/**
|
|
24
|
+
* Create a new graph vertex.
|
|
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.
|
|
30
|
+
* @returns The id of the new graph item.
|
|
31
|
+
*/
|
|
32
|
+
create(vertex: Omit<IAuditableItemGraphVertex, "id">): Promise<string>;
|
|
33
|
+
/**
|
|
34
|
+
* Get a graph vertex.
|
|
35
|
+
* @param id The id of the vertex to get.
|
|
36
|
+
* @param options Additional options for the get operation.
|
|
37
|
+
* @param options.includeDeleted Whether to include deleted/updated aliases, resource, edges, defaults to false.
|
|
38
|
+
* @param options.verifySignatureDepth How many signatures to verify, defaults to "none".
|
|
39
|
+
* @returns The vertex if found.
|
|
40
|
+
* @throws NotFoundError if the vertex is not found.
|
|
41
|
+
*/
|
|
42
|
+
get(id: string, options?: {
|
|
43
|
+
includeDeleted?: boolean;
|
|
44
|
+
verifySignatureDepth?: VerifyDepth;
|
|
45
|
+
}): Promise<IAuditableItemGraphVertex>;
|
|
46
|
+
/**
|
|
47
|
+
* Get a graph vertex changeset list.
|
|
48
|
+
* @param id The id of the vertex to get.
|
|
49
|
+
* @param cursor The optional cursor to get next chunk.
|
|
50
|
+
* @param limit Limit the number of entities to return.
|
|
51
|
+
* @param options Additional options for the get operation.
|
|
52
|
+
* @param options.verifySignatureDepth How many signatures to verify, defaults to "none".
|
|
53
|
+
* @returns The changesets if found.
|
|
54
|
+
*/
|
|
55
|
+
getChangesets(id: string, cursor?: string, limit?: number, options?: {
|
|
56
|
+
verifySignatureDepth?: VerifyDepth;
|
|
57
|
+
}): Promise<{
|
|
58
|
+
changesets: IAuditableItemGraphChangesetList;
|
|
59
|
+
cursor?: string;
|
|
60
|
+
}>;
|
|
61
|
+
/**
|
|
62
|
+
* Get a graph vertex changeset.
|
|
63
|
+
* @param id The id of the vertex to get.
|
|
64
|
+
* @param options Additional options for the get operation.
|
|
65
|
+
* @param options.verifySignatureDepth How many signatures to verify, defaults to "none".
|
|
66
|
+
* @returns The changeset if found.
|
|
67
|
+
* @throws NotFoundError if the vertex or changeset is not found.
|
|
68
|
+
*/
|
|
69
|
+
getChangeset(id: string, options?: {
|
|
70
|
+
verifySignatureDepth?: VerifyDepth;
|
|
71
|
+
}): Promise<IAuditableItemGraphChangeset>;
|
|
72
|
+
/**
|
|
73
|
+
* Get a graph vertex at a specific version.
|
|
74
|
+
* @param id The id of the vertex.
|
|
75
|
+
* @param version The version number to retrieve.
|
|
76
|
+
* @returns The vertex reconstructed at that version.
|
|
77
|
+
* @throws NotFoundError if the vertex or version is not found.
|
|
78
|
+
*/
|
|
79
|
+
getVersion(id: string, version: number): Promise<IAuditableItemGraphVertex>;
|
|
80
|
+
/**
|
|
81
|
+
* Get all versions of a graph vertex.
|
|
82
|
+
* @param id The id of the vertex.
|
|
83
|
+
* @param options Additional options for the operation.
|
|
84
|
+
* @param options.after Only return versions created after this ISO 8601 timestamp (exclusive).
|
|
85
|
+
* @param options.before Only return versions created before this ISO 8601 timestamp (exclusive).
|
|
86
|
+
* @returns The list of vertex versions.
|
|
87
|
+
* @throws NotFoundError if the vertex is not found.
|
|
88
|
+
*/
|
|
89
|
+
getVersions(id: string, options?: {
|
|
90
|
+
after?: string;
|
|
91
|
+
before?: string;
|
|
92
|
+
}): Promise<IAuditableItemGraphVertexVersionList>;
|
|
93
|
+
/**
|
|
94
|
+
* Update a graph vertex (PUT - full replacement of vertex state).
|
|
95
|
+
* The server serializes concurrent updates for the same vertex via `Mutex` on the vertex id;
|
|
96
|
+
* requests load-balanced across replicas can still race.
|
|
97
|
+
* @param vertex The vertex to update.
|
|
98
|
+
* @param vertex.id The id of the vertex to update.
|
|
99
|
+
* @param vertex.annotationObject The annotation object for the vertex as JSON-LD.
|
|
100
|
+
* @param vertex.aliases Alternative aliases that can be used to identify the vertex.
|
|
101
|
+
* @param vertex.resources The resources attached to the vertex.
|
|
102
|
+
* @param vertex.edges The edges connected to the vertex.
|
|
103
|
+
* @returns A promise that resolves when the vertex has been updated.
|
|
104
|
+
*/
|
|
105
|
+
update(vertex: IAuditableItemGraphVertex): Promise<void>;
|
|
106
|
+
/**
|
|
107
|
+
* Partially update a graph vertex (PATCH - optional scalars; list fields use `{ add, remove }`).
|
|
108
|
+
* @param partial The partial vertex update (must include `id`).
|
|
109
|
+
* @returns A promise that resolves when the partial update has been applied.
|
|
110
|
+
*/
|
|
111
|
+
updatePartial(partial: IAuditableItemGraphPartialVertex): Promise<void>;
|
|
112
|
+
/**
|
|
113
|
+
* Remove the notarization proof from all changesets of a graph vertex.
|
|
114
|
+
* @param id The id of the vertex.
|
|
115
|
+
* @returns A promise that resolves when the proof has been removed.
|
|
116
|
+
*/
|
|
117
|
+
removeProof(id: string): Promise<void>;
|
|
118
|
+
/**
|
|
119
|
+
* Query the graph for vertices.
|
|
120
|
+
* @param options The query options.
|
|
121
|
+
* @param options.id The optional id to look for.
|
|
122
|
+
* @param options.idMode Look in id, alias or both, defaults to both.
|
|
123
|
+
* @param options.idExact Find only exact matches, default to false meaning partial matching.
|
|
124
|
+
* @param options.resourceTypes Include vertices with specific resource types.
|
|
125
|
+
* @param conditions Conditions to use in the query.
|
|
126
|
+
* @param orderBy The order for the results, defaults to created.
|
|
127
|
+
* @param orderByDirection The direction for the order, defaults to descending.
|
|
128
|
+
* @param properties The properties to return, if not provided defaults to id, created, aliases and object.
|
|
129
|
+
* @param cursor The cursor to request the next chunk of entities.
|
|
130
|
+
* @param limit The maximum number of entities to return, a page can contain fewer so follow
|
|
131
|
+
* the cursor until it is absent to read them all.
|
|
132
|
+
* @returns The entities, which can be partial if a limited keys list was provided.
|
|
133
|
+
*/
|
|
134
|
+
query(options?: {
|
|
135
|
+
id?: string;
|
|
136
|
+
idMode?: "id" | "alias" | "both";
|
|
137
|
+
idExact?: boolean;
|
|
138
|
+
resourceTypes?: string[];
|
|
139
|
+
}, conditions?: EntityCondition<IAuditableItemGraphVertex>, orderBy?: keyof Pick<IAuditableItemGraphVertex, "dateCreated" | "dateModified">, orderByDirection?: SortDirection, properties?: (keyof IAuditableItemGraphVertex)[], cursor?: string, limit?: number): Promise<{
|
|
140
|
+
entries: IAuditableItemGraphVertexList;
|
|
141
|
+
cursor?: string;
|
|
142
|
+
}>;
|
|
143
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./auditableItemGraphRestClient.js";
|
|
File without changes
|
package/docs/examples.md
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# Auditable Item Graph REST Client Examples
|
|
2
|
+
|
|
3
|
+
These snippets show practical request flows for creating, reading, updating, and querying graph items through HTTP endpoints.
|
|
4
|
+
|
|
5
|
+
## AuditableItemGraphRestClient
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import { AuditableItemGraphRestClient } from '@3sixty/auditable-item-graph-rest-client';
|
|
9
|
+
|
|
10
|
+
const client = new AuditableItemGraphRestClient({ endpoint: 'http://localhost:8080' });
|
|
11
|
+
|
|
12
|
+
console.log(client.className()); // AuditableItemGraphRestClient
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import { VerifyDepth } from '@3sixty/auditable-item-graph-models';
|
|
17
|
+
import { AuditableItemGraphRestClient } from '@3sixty/auditable-item-graph-rest-client';
|
|
18
|
+
|
|
19
|
+
const client = new AuditableItemGraphRestClient({ endpoint: 'http://localhost:8080' });
|
|
20
|
+
|
|
21
|
+
const id = await client.create({
|
|
22
|
+
annotationObject: {
|
|
23
|
+
'@context': 'https://www.w3.org/ns/activitystreams',
|
|
24
|
+
type: 'Create',
|
|
25
|
+
actor: {
|
|
26
|
+
type: 'Person',
|
|
27
|
+
id: 'acct:alex@example.org',
|
|
28
|
+
name: 'Alex'
|
|
29
|
+
},
|
|
30
|
+
object: {
|
|
31
|
+
type: 'Note',
|
|
32
|
+
content: 'Created through the REST client'
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
aliases: [{ id: 'ticket-2026-0007', aliasFormat: 'externalRef', unique: true }],
|
|
36
|
+
resources: [
|
|
37
|
+
{ resourceObject: { '@context': 'https://schema.org', type: 'Thing', name: 'Asset A' } }
|
|
38
|
+
]
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
const vertex = await client.get(id, {
|
|
42
|
+
includeDeleted: false,
|
|
43
|
+
verifySignatureDepth: VerifyDepth.Current
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
console.log(id); // aig:018f5a6cfd9444d58c7c2d4df1fd0a23
|
|
47
|
+
console.log(vertex.id); // aig:018f5a6cfd9444d58c7c2d4df1fd0a23
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
```typescript
|
|
51
|
+
import { VerifyDepth } from '@3sixty/auditable-item-graph-models';
|
|
52
|
+
import { AuditableItemGraphRestClient } from '@3sixty/auditable-item-graph-rest-client';
|
|
53
|
+
|
|
54
|
+
const client = new AuditableItemGraphRestClient({ endpoint: 'http://localhost:8080' });
|
|
55
|
+
|
|
56
|
+
const id = 'aig:018f5a6cfd9444d58c7c2d4df1fd0a23';
|
|
57
|
+
|
|
58
|
+
await client.update({
|
|
59
|
+
id,
|
|
60
|
+
aliases: [{ id: 'ticket-2026-0007', aliasFormat: 'externalRef' }],
|
|
61
|
+
resources: [
|
|
62
|
+
{
|
|
63
|
+
id: 'resource-1',
|
|
64
|
+
resourceObject: { '@context': 'https://schema.org', type: 'Thing', name: 'Asset A v2' }
|
|
65
|
+
}
|
|
66
|
+
],
|
|
67
|
+
edges: [{ targetId: 'aig:018f5a6cfd9444d58c7c2d4df1fd0999', edgeRelationships: ['dependsOn'] }]
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
const changesetChunk = await client.getChangesets(id, undefined, 20, {
|
|
71
|
+
verifySignatureDepth: VerifyDepth.Current
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
const firstChangeset = changesetChunk.changesets.itemListElement?.[0];
|
|
75
|
+
|
|
76
|
+
if (firstChangeset?.id) {
|
|
77
|
+
const changeset = await client.getChangeset(firstChangeset.id, {
|
|
78
|
+
verifySignatureDepth: VerifyDepth.Current
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
console.log(changeset.id); // aig:018f5a6cfd9444d58c7c2d4df1fd0a23:changeset:018f5a6cfd9444d58c7c2d4df1fd0b10
|
|
82
|
+
}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
```typescript
|
|
86
|
+
import { AuditableItemGraphRestClient } from '@3sixty/auditable-item-graph-rest-client';
|
|
87
|
+
import { ComparisonOperator, SortDirection } from '@3sixty/entity';
|
|
88
|
+
|
|
89
|
+
const client = new AuditableItemGraphRestClient({ endpoint: 'http://localhost:8080' });
|
|
90
|
+
|
|
91
|
+
const result = await client.query(
|
|
92
|
+
{
|
|
93
|
+
id: 'ticket-2026',
|
|
94
|
+
idMode: 'alias',
|
|
95
|
+
idExact: false,
|
|
96
|
+
resourceTypes: ['Thing']
|
|
97
|
+
},
|
|
98
|
+
[
|
|
99
|
+
{
|
|
100
|
+
field: 'dateCreated',
|
|
101
|
+
comparison: ComparisonOperator.GreaterThan,
|
|
102
|
+
value: '2026-01-01T00:00:00.000Z'
|
|
103
|
+
}
|
|
104
|
+
],
|
|
105
|
+
'dateCreated',
|
|
106
|
+
SortDirection.Descending,
|
|
107
|
+
['id', 'dateCreated', 'aliases'],
|
|
108
|
+
undefined,
|
|
109
|
+
10
|
|
110
|
+
);
|
|
111
|
+
|
|
112
|
+
console.log(result.entries.itemListElement?.length ?? 0); // 2
|
|
113
|
+
|
|
114
|
+
try {
|
|
115
|
+
await client.removeVerifiable('aig:018f5a6cfd9444d58c7c2d4df1fd0a23');
|
|
116
|
+
} catch (error) {
|
|
117
|
+
console.log(error instanceof Error ? error.message : 'Unknown error'); // Not supported on client
|
|
118
|
+
}
|
|
119
|
+
```
|
|
@@ -0,0 +1,468 @@
|
|
|
1
|
+
# Class: AuditableItemGraphRestClient
|
|
2
|
+
|
|
3
|
+
Client for performing auditable item graph through to REST endpoints.
|
|
4
|
+
|
|
5
|
+
## Extends
|
|
6
|
+
|
|
7
|
+
- `BaseRestClient`
|
|
8
|
+
|
|
9
|
+
## Implements
|
|
10
|
+
|
|
11
|
+
- `IAuditableItemGraphComponent`
|
|
12
|
+
|
|
13
|
+
## Constructors
|
|
14
|
+
|
|
15
|
+
### Constructor
|
|
16
|
+
|
|
17
|
+
> **new AuditableItemGraphRestClient**(`config`): `AuditableItemGraphRestClient`
|
|
18
|
+
|
|
19
|
+
Create a new instance of AuditableItemGraphRestClient.
|
|
20
|
+
|
|
21
|
+
#### Parameters
|
|
22
|
+
|
|
23
|
+
##### config
|
|
24
|
+
|
|
25
|
+
`IBaseRestClientConfig`
|
|
26
|
+
|
|
27
|
+
The configuration for the client.
|
|
28
|
+
|
|
29
|
+
#### Returns
|
|
30
|
+
|
|
31
|
+
`AuditableItemGraphRestClient`
|
|
32
|
+
|
|
33
|
+
#### Overrides
|
|
34
|
+
|
|
35
|
+
`BaseRestClient.constructor`
|
|
36
|
+
|
|
37
|
+
## Properties
|
|
38
|
+
|
|
39
|
+
### CLASS\_NAME {#class_name}
|
|
40
|
+
|
|
41
|
+
> `readonly` `static` **CLASS\_NAME**: `string`
|
|
42
|
+
|
|
43
|
+
Runtime name for the class.
|
|
44
|
+
|
|
45
|
+
## Methods
|
|
46
|
+
|
|
47
|
+
### className() {#classname}
|
|
48
|
+
|
|
49
|
+
> **className**(): `string`
|
|
50
|
+
|
|
51
|
+
Returns the class name of the component.
|
|
52
|
+
|
|
53
|
+
#### Returns
|
|
54
|
+
|
|
55
|
+
`string`
|
|
56
|
+
|
|
57
|
+
The class name of the component.
|
|
58
|
+
|
|
59
|
+
#### Implementation of
|
|
60
|
+
|
|
61
|
+
`IAuditableItemGraphComponent.className`
|
|
62
|
+
|
|
63
|
+
***
|
|
64
|
+
|
|
65
|
+
### create() {#create}
|
|
66
|
+
|
|
67
|
+
> **create**(`vertex`): `Promise`\<`string`\>
|
|
68
|
+
|
|
69
|
+
Create a new graph vertex.
|
|
70
|
+
|
|
71
|
+
#### Parameters
|
|
72
|
+
|
|
73
|
+
##### vertex
|
|
74
|
+
|
|
75
|
+
`Omit`\<`IAuditableItemGraphVertex`, `"id"`\>
|
|
76
|
+
|
|
77
|
+
The vertex to create.
|
|
78
|
+
|
|
79
|
+
#### Returns
|
|
80
|
+
|
|
81
|
+
`Promise`\<`string`\>
|
|
82
|
+
|
|
83
|
+
The id of the new graph item.
|
|
84
|
+
|
|
85
|
+
#### Implementation of
|
|
86
|
+
|
|
87
|
+
`IAuditableItemGraphComponent.create`
|
|
88
|
+
|
|
89
|
+
***
|
|
90
|
+
|
|
91
|
+
### get() {#get}
|
|
92
|
+
|
|
93
|
+
> **get**(`id`, `options?`): `Promise`\<`IAuditableItemGraphVertex`\>
|
|
94
|
+
|
|
95
|
+
Get a graph vertex.
|
|
96
|
+
|
|
97
|
+
#### Parameters
|
|
98
|
+
|
|
99
|
+
##### id
|
|
100
|
+
|
|
101
|
+
`string`
|
|
102
|
+
|
|
103
|
+
The id of the vertex to get.
|
|
104
|
+
|
|
105
|
+
##### options?
|
|
106
|
+
|
|
107
|
+
Additional options for the get operation.
|
|
108
|
+
|
|
109
|
+
###### includeDeleted?
|
|
110
|
+
|
|
111
|
+
`boolean`
|
|
112
|
+
|
|
113
|
+
Whether to include deleted/updated aliases, resource, edges, defaults to false.
|
|
114
|
+
|
|
115
|
+
###### verifySignatureDepth?
|
|
116
|
+
|
|
117
|
+
`VerifyDepth`
|
|
118
|
+
|
|
119
|
+
How many signatures to verify, defaults to "none".
|
|
120
|
+
|
|
121
|
+
#### Returns
|
|
122
|
+
|
|
123
|
+
`Promise`\<`IAuditableItemGraphVertex`\>
|
|
124
|
+
|
|
125
|
+
The vertex if found.
|
|
126
|
+
|
|
127
|
+
#### Throws
|
|
128
|
+
|
|
129
|
+
NotFoundError if the vertex is not found.
|
|
130
|
+
|
|
131
|
+
#### Implementation of
|
|
132
|
+
|
|
133
|
+
`IAuditableItemGraphComponent.get`
|
|
134
|
+
|
|
135
|
+
***
|
|
136
|
+
|
|
137
|
+
### getChangesets() {#getchangesets}
|
|
138
|
+
|
|
139
|
+
> **getChangesets**(`id`, `cursor?`, `limit?`, `options?`): `Promise`\<\{ `changesets`: `IAuditableItemGraphChangesetList`; `cursor?`: `string`; \}\>
|
|
140
|
+
|
|
141
|
+
Get a graph vertex changeset list.
|
|
142
|
+
|
|
143
|
+
#### Parameters
|
|
144
|
+
|
|
145
|
+
##### id
|
|
146
|
+
|
|
147
|
+
`string`
|
|
148
|
+
|
|
149
|
+
The id of the vertex to get.
|
|
150
|
+
|
|
151
|
+
##### cursor?
|
|
152
|
+
|
|
153
|
+
`string`
|
|
154
|
+
|
|
155
|
+
The optional cursor to get next chunk.
|
|
156
|
+
|
|
157
|
+
##### limit?
|
|
158
|
+
|
|
159
|
+
`number`
|
|
160
|
+
|
|
161
|
+
Limit the number of entities to return.
|
|
162
|
+
|
|
163
|
+
##### options?
|
|
164
|
+
|
|
165
|
+
Additional options for the get operation.
|
|
166
|
+
|
|
167
|
+
###### verifySignatureDepth?
|
|
168
|
+
|
|
169
|
+
`VerifyDepth`
|
|
170
|
+
|
|
171
|
+
How many signatures to verify, defaults to "none".
|
|
172
|
+
|
|
173
|
+
#### Returns
|
|
174
|
+
|
|
175
|
+
`Promise`\<\{ `changesets`: `IAuditableItemGraphChangesetList`; `cursor?`: `string`; \}\>
|
|
176
|
+
|
|
177
|
+
The changesets if found.
|
|
178
|
+
|
|
179
|
+
#### Implementation of
|
|
180
|
+
|
|
181
|
+
`IAuditableItemGraphComponent.getChangesets`
|
|
182
|
+
|
|
183
|
+
***
|
|
184
|
+
|
|
185
|
+
### getChangeset() {#getchangeset}
|
|
186
|
+
|
|
187
|
+
> **getChangeset**(`id`, `options?`): `Promise`\<`IAuditableItemGraphChangeset`\>
|
|
188
|
+
|
|
189
|
+
Get a graph vertex changeset.
|
|
190
|
+
|
|
191
|
+
#### Parameters
|
|
192
|
+
|
|
193
|
+
##### id
|
|
194
|
+
|
|
195
|
+
`string`
|
|
196
|
+
|
|
197
|
+
The id of the vertex to get.
|
|
198
|
+
|
|
199
|
+
##### options?
|
|
200
|
+
|
|
201
|
+
Additional options for the get operation.
|
|
202
|
+
|
|
203
|
+
###### verifySignatureDepth?
|
|
204
|
+
|
|
205
|
+
`VerifyDepth`
|
|
206
|
+
|
|
207
|
+
How many signatures to verify, defaults to "none".
|
|
208
|
+
|
|
209
|
+
#### Returns
|
|
210
|
+
|
|
211
|
+
`Promise`\<`IAuditableItemGraphChangeset`\>
|
|
212
|
+
|
|
213
|
+
The changeset if found.
|
|
214
|
+
|
|
215
|
+
#### Throws
|
|
216
|
+
|
|
217
|
+
NotFoundError if the vertex or changeset is not found.
|
|
218
|
+
|
|
219
|
+
#### Implementation of
|
|
220
|
+
|
|
221
|
+
`IAuditableItemGraphComponent.getChangeset`
|
|
222
|
+
|
|
223
|
+
***
|
|
224
|
+
|
|
225
|
+
### getVersion() {#getversion}
|
|
226
|
+
|
|
227
|
+
> **getVersion**(`id`, `version`): `Promise`\<`IAuditableItemGraphVertex`\>
|
|
228
|
+
|
|
229
|
+
Get a graph vertex at a specific version.
|
|
230
|
+
|
|
231
|
+
#### Parameters
|
|
232
|
+
|
|
233
|
+
##### id
|
|
234
|
+
|
|
235
|
+
`string`
|
|
236
|
+
|
|
237
|
+
The id of the vertex.
|
|
238
|
+
|
|
239
|
+
##### version
|
|
240
|
+
|
|
241
|
+
`number`
|
|
242
|
+
|
|
243
|
+
The version number to retrieve.
|
|
244
|
+
|
|
245
|
+
#### Returns
|
|
246
|
+
|
|
247
|
+
`Promise`\<`IAuditableItemGraphVertex`\>
|
|
248
|
+
|
|
249
|
+
The vertex reconstructed at that version.
|
|
250
|
+
|
|
251
|
+
#### Throws
|
|
252
|
+
|
|
253
|
+
NotFoundError if the vertex or version is not found.
|
|
254
|
+
|
|
255
|
+
#### Implementation of
|
|
256
|
+
|
|
257
|
+
`IAuditableItemGraphComponent.getVersion`
|
|
258
|
+
|
|
259
|
+
***
|
|
260
|
+
|
|
261
|
+
### getVersions() {#getversions}
|
|
262
|
+
|
|
263
|
+
> **getVersions**(`id`, `options?`): `Promise`\<`IAuditableItemGraphVertexVersionList`\>
|
|
264
|
+
|
|
265
|
+
Get all versions of a graph vertex.
|
|
266
|
+
|
|
267
|
+
#### Parameters
|
|
268
|
+
|
|
269
|
+
##### id
|
|
270
|
+
|
|
271
|
+
`string`
|
|
272
|
+
|
|
273
|
+
The id of the vertex.
|
|
274
|
+
|
|
275
|
+
##### options?
|
|
276
|
+
|
|
277
|
+
Additional options for the operation.
|
|
278
|
+
|
|
279
|
+
###### after?
|
|
280
|
+
|
|
281
|
+
`string`
|
|
282
|
+
|
|
283
|
+
Only return versions created after this ISO 8601 timestamp (exclusive).
|
|
284
|
+
|
|
285
|
+
###### before?
|
|
286
|
+
|
|
287
|
+
`string`
|
|
288
|
+
|
|
289
|
+
Only return versions created before this ISO 8601 timestamp (exclusive).
|
|
290
|
+
|
|
291
|
+
#### Returns
|
|
292
|
+
|
|
293
|
+
`Promise`\<`IAuditableItemGraphVertexVersionList`\>
|
|
294
|
+
|
|
295
|
+
The list of vertex versions.
|
|
296
|
+
|
|
297
|
+
#### Throws
|
|
298
|
+
|
|
299
|
+
NotFoundError if the vertex is not found.
|
|
300
|
+
|
|
301
|
+
#### Implementation of
|
|
302
|
+
|
|
303
|
+
`IAuditableItemGraphComponent.getVersions`
|
|
304
|
+
|
|
305
|
+
***
|
|
306
|
+
|
|
307
|
+
### update() {#update}
|
|
308
|
+
|
|
309
|
+
> **update**(`vertex`): `Promise`\<`void`\>
|
|
310
|
+
|
|
311
|
+
Update a graph vertex (PUT - full replacement of vertex state).
|
|
312
|
+
The server serializes concurrent updates for the same vertex via `Mutex` on the vertex id;
|
|
313
|
+
requests load-balanced across replicas can still race.
|
|
314
|
+
|
|
315
|
+
#### Parameters
|
|
316
|
+
|
|
317
|
+
##### vertex
|
|
318
|
+
|
|
319
|
+
`IAuditableItemGraphVertex`
|
|
320
|
+
|
|
321
|
+
The vertex to update.
|
|
322
|
+
|
|
323
|
+
#### Returns
|
|
324
|
+
|
|
325
|
+
`Promise`\<`void`\>
|
|
326
|
+
|
|
327
|
+
A promise that resolves when the vertex has been updated.
|
|
328
|
+
|
|
329
|
+
#### Implementation of
|
|
330
|
+
|
|
331
|
+
`IAuditableItemGraphComponent.update`
|
|
332
|
+
|
|
333
|
+
***
|
|
334
|
+
|
|
335
|
+
### updatePartial() {#updatepartial}
|
|
336
|
+
|
|
337
|
+
> **updatePartial**(`partial`): `Promise`\<`void`\>
|
|
338
|
+
|
|
339
|
+
Partially update a graph vertex (PATCH - optional scalars; list fields use `{ add, remove }`).
|
|
340
|
+
|
|
341
|
+
#### Parameters
|
|
342
|
+
|
|
343
|
+
##### partial
|
|
344
|
+
|
|
345
|
+
`IAuditableItemGraphPartialVertex`
|
|
346
|
+
|
|
347
|
+
The partial vertex update (must include `id`).
|
|
348
|
+
|
|
349
|
+
#### Returns
|
|
350
|
+
|
|
351
|
+
`Promise`\<`void`\>
|
|
352
|
+
|
|
353
|
+
A promise that resolves when the partial update has been applied.
|
|
354
|
+
|
|
355
|
+
#### Implementation of
|
|
356
|
+
|
|
357
|
+
`IAuditableItemGraphComponent.updatePartial`
|
|
358
|
+
|
|
359
|
+
***
|
|
360
|
+
|
|
361
|
+
### removeProof() {#removeproof}
|
|
362
|
+
|
|
363
|
+
> **removeProof**(`id`): `Promise`\<`void`\>
|
|
364
|
+
|
|
365
|
+
Remove the notarization proof from all changesets of a graph vertex.
|
|
366
|
+
|
|
367
|
+
#### Parameters
|
|
368
|
+
|
|
369
|
+
##### id
|
|
370
|
+
|
|
371
|
+
`string`
|
|
372
|
+
|
|
373
|
+
The id of the vertex.
|
|
374
|
+
|
|
375
|
+
#### Returns
|
|
376
|
+
|
|
377
|
+
`Promise`\<`void`\>
|
|
378
|
+
|
|
379
|
+
A promise that resolves when the proof has been removed.
|
|
380
|
+
|
|
381
|
+
#### Implementation of
|
|
382
|
+
|
|
383
|
+
`IAuditableItemGraphComponent.removeProof`
|
|
384
|
+
|
|
385
|
+
***
|
|
386
|
+
|
|
387
|
+
### query() {#query}
|
|
388
|
+
|
|
389
|
+
> **query**(`options?`, `conditions?`, `orderBy?`, `orderByDirection?`, `properties?`, `cursor?`, `limit?`): `Promise`\<\{ `entries`: `IAuditableItemGraphVertexList`; `cursor?`: `string`; \}\>
|
|
390
|
+
|
|
391
|
+
Query the graph for vertices.
|
|
392
|
+
|
|
393
|
+
#### Parameters
|
|
394
|
+
|
|
395
|
+
##### options?
|
|
396
|
+
|
|
397
|
+
The query options.
|
|
398
|
+
|
|
399
|
+
###### id?
|
|
400
|
+
|
|
401
|
+
`string`
|
|
402
|
+
|
|
403
|
+
The optional id to look for.
|
|
404
|
+
|
|
405
|
+
###### idMode?
|
|
406
|
+
|
|
407
|
+
`"id"` \| `"alias"` \| `"both"`
|
|
408
|
+
|
|
409
|
+
Look in id, alias or both, defaults to both.
|
|
410
|
+
|
|
411
|
+
###### idExact?
|
|
412
|
+
|
|
413
|
+
`boolean`
|
|
414
|
+
|
|
415
|
+
Find only exact matches, default to false meaning partial matching.
|
|
416
|
+
|
|
417
|
+
###### resourceTypes?
|
|
418
|
+
|
|
419
|
+
`string`[]
|
|
420
|
+
|
|
421
|
+
Include vertices with specific resource types.
|
|
422
|
+
|
|
423
|
+
##### conditions?
|
|
424
|
+
|
|
425
|
+
`EntityCondition`\<`IAuditableItemGraphVertex`\>
|
|
426
|
+
|
|
427
|
+
Conditions to use in the query.
|
|
428
|
+
|
|
429
|
+
##### orderBy?
|
|
430
|
+
|
|
431
|
+
`"dateCreated"` \| `"dateModified"`
|
|
432
|
+
|
|
433
|
+
The order for the results, defaults to created.
|
|
434
|
+
|
|
435
|
+
##### orderByDirection?
|
|
436
|
+
|
|
437
|
+
`SortDirection`
|
|
438
|
+
|
|
439
|
+
The direction for the order, defaults to descending.
|
|
440
|
+
|
|
441
|
+
##### properties?
|
|
442
|
+
|
|
443
|
+
keyof `IAuditableItemGraphVertex`[]
|
|
444
|
+
|
|
445
|
+
The properties to return, if not provided defaults to id, created, aliases and object.
|
|
446
|
+
|
|
447
|
+
##### cursor?
|
|
448
|
+
|
|
449
|
+
`string`
|
|
450
|
+
|
|
451
|
+
The cursor to request the next chunk of entities.
|
|
452
|
+
|
|
453
|
+
##### limit?
|
|
454
|
+
|
|
455
|
+
`number`
|
|
456
|
+
|
|
457
|
+
The maximum number of entities to return, a page can contain fewer so follow
|
|
458
|
+
the cursor until it is absent to read them all.
|
|
459
|
+
|
|
460
|
+
#### Returns
|
|
461
|
+
|
|
462
|
+
`Promise`\<\{ `entries`: `IAuditableItemGraphVertexList`; `cursor?`: `string`; \}\>
|
|
463
|
+
|
|
464
|
+
The entities, which can be partial if a limited keys list was provided.
|
|
465
|
+
|
|
466
|
+
#### Implementation of
|
|
467
|
+
|
|
468
|
+
`IAuditableItemGraphComponent.query`
|
package/locales/en.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{}
|
package/package.json
CHANGED
|
@@ -1,6 +1,55 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
"name": "@3sixty/auditable-item-graph-rest-client",
|
|
3
|
+
"version": "0.20.0-next.0",
|
|
4
|
+
"description": "Provides a client for interacting with auditable graph endpoints over HTTP.",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/3sixtyglobal/auditable-item-graph.git",
|
|
8
|
+
"directory": "packages/auditable-item-graph-rest-client"
|
|
9
|
+
},
|
|
10
|
+
"author": "martyn.janes@iota.org",
|
|
11
|
+
"license": "Apache-2.0",
|
|
12
|
+
"type": "module",
|
|
13
|
+
"engines": {
|
|
14
|
+
"node": ">=24.0.0"
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@3sixty/api-core": "next",
|
|
18
|
+
"@3sixty/api-models": "next",
|
|
19
|
+
"@3sixty/auditable-item-graph-models": "0.20.0-next.0",
|
|
20
|
+
"@3sixty/core": "next",
|
|
21
|
+
"@3sixty/data-json-ld": "next",
|
|
22
|
+
"@3sixty/entity": "next",
|
|
23
|
+
"@3sixty/immutable-proof-models": "next",
|
|
24
|
+
"@3sixty/nameof": "next",
|
|
25
|
+
"@3sixty/web": "next"
|
|
26
|
+
},
|
|
27
|
+
"main": "./dist/es/index.js",
|
|
28
|
+
"types": "./dist/types/index.d.ts",
|
|
29
|
+
"exports": {
|
|
30
|
+
".": {
|
|
31
|
+
"types": "./dist/types/index.d.ts",
|
|
32
|
+
"import": "./dist/es/index.js",
|
|
33
|
+
"default": "./dist/es/index.js"
|
|
34
|
+
},
|
|
35
|
+
"./locales/*.json": "./locales/*.json"
|
|
36
|
+
},
|
|
37
|
+
"files": [
|
|
38
|
+
"dist/es",
|
|
39
|
+
"dist/types",
|
|
40
|
+
"locales",
|
|
41
|
+
"docs"
|
|
42
|
+
],
|
|
43
|
+
"keywords": [
|
|
44
|
+
"twin",
|
|
45
|
+
"trade",
|
|
46
|
+
"iota",
|
|
47
|
+
"framework",
|
|
48
|
+
"blockchain",
|
|
49
|
+
"auditable-item-graph"
|
|
50
|
+
],
|
|
51
|
+
"bugs": {
|
|
52
|
+
"url": "git+https://github.com/3sixtyglobal/auditable-item-graph/issues"
|
|
53
|
+
},
|
|
54
|
+
"homepage": "https://3sixty.global"
|
|
55
|
+
}
|