@3sixty/auditable-item-graph-rest-client 0.0.0-stage → 0.20.0-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/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
- # Temporary Holding Version
1
+ # 3Sixty Auditable Item Graph REST Client
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
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","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,CAAC;AAEjE;;GAEG;AACH,MAAM,OAAO,4BACZ,SAAQ,cAAc;IAGtB;;OAEG;IACI,MAAM,CAAU,UAAU,GAAW,8BAA8B,CAAC;IAE3E;;;OAGG;IACH,YAAY,MAA6B;QACxC,KAAK,CAAC,8BAA8B,EAAE,MAAM,EAAE,sBAAsB,CAAC,CAAC;IAC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AI,EAAE,EAAE,CAAC,CAAC;QAEtE,MAAM,IAAI,CAAC,KAAK,CACf,YAAY,EACZ,UAAU,CAAC,MAAM,EACjB;YACC,UAAU,EAAE,EAAE,EAAE,EAAE;SAClB,CACD,CAAC;IACH,CAAC;IAED;;;;;;;;;;;;;;;OAeG;IACI,KAAK,CAAC,KAAK,CACjB,OAKC,EACD,UAAuD,EACvD,OAA+E,EAC/E,gBAAgC,EAChC,UAAgD,EAChD,MAAe,EACf,KAAc;QAKd,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,KAAK,CAG/B,GAAG,EAAE,UAAU,CAAC,GAAG,EAAE;YACtB,OAAO,EAAE;gBACR,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC,MAAM;aACtC;YACD,KAAK,EAAE;gBACN,EAAE,EAAE,OAAO,EAAE,EAAE;gBACf,MAAM,EAAE,OAAO,EAAE,MAAM;gBACvB,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC;gBACxC,aAAa,EAAE,mBAAmB,CAAC,aAAa,CAAC,OAAO,EAAE,aAAa,CAAC;gBACxE,UAAU,EAAE,mBAAmB,CAAC,cAAc,CAAC,UAAU,CAAC;gBAC1D,OAAO;gBACP,gBAAgB;gBAChB,UAAU,EAAE,mBAAmB,CAAC,aAAa,CAAC,UAAU,CAAC;gBACzD,MAAM;gBACN,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC;aAC3B;SACD,CAAC,CAAC;QAEH,OAAO;YACN,OAAO,EAAE,QAAQ,CAAC,IAAI;YACtB,MAAM,EAAE,gBAAgB,CAAC,aAAa,CAAC,QAAQ,CAAC,OAAO,CAAC;SACxD,CAAC;IACH,CAAC;CACD","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { BaseRestClient } from \"@3sixty/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\";\n\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 = \"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(\"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, \"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, \"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, \"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, \"id\", id);\n\t\tGuards.integer(AuditableItemGraphRestClient.CLASS_NAME, \"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, \"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, \"vertex\", vertex);\n\t\tGuards.stringValue(AuditableItemGraphRestClient.CLASS_NAME, \"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, \"partial\", partial);\n\t\tGuards.stringValue(AuditableItemGraphRestClient.CLASS_NAME, \"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, \"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"]}
@@ -0,0 +1,4 @@
1
+ // Copyright 2024 IOTA Stiftung.
2
+ // SPDX-License-Identifier: Apache-2.0.
3
+ export * from "./auditableItemGraphRestClient.js";
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","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"]}