@3sixty/auditable-item-graph-service 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 +201 -0
- package/README.md +26 -2
- package/dist/es/auditableItemGraphRoutes.js +1136 -0
- package/dist/es/auditableItemGraphRoutes.js.map +1 -0
- package/dist/es/auditableItemGraphService.js +1913 -0
- package/dist/es/auditableItemGraphService.js.map +1 -0
- package/dist/es/entities/auditableItemGraphAlias.js +70 -0
- package/dist/es/entities/auditableItemGraphAlias.js.map +1 -0
- package/dist/es/entities/auditableItemGraphChangeset.js +79 -0
- package/dist/es/entities/auditableItemGraphChangeset.js.map +1 -0
- package/dist/es/entities/auditableItemGraphEdge.js +70 -0
- package/dist/es/entities/auditableItemGraphEdge.js.map +1 -0
- package/dist/es/entities/auditableItemGraphPatch.js +45 -0
- package/dist/es/entities/auditableItemGraphPatch.js.map +1 -0
- package/dist/es/entities/auditableItemGraphResource.js +54 -0
- package/dist/es/entities/auditableItemGraphResource.js.map +1 -0
- package/dist/es/entities/auditableItemGraphVertex.js +97 -0
- package/dist/es/entities/auditableItemGraphVertex.js.map +1 -0
- package/dist/es/entities/auditableItemGraphVertexIndex.js +95 -0
- package/dist/es/entities/auditableItemGraphVertexIndex.js.map +1 -0
- package/dist/es/entities/auditableItemGraphVertexV0.js +107 -0
- package/dist/es/entities/auditableItemGraphVertexV0.js.map +1 -0
- package/dist/es/entities/auditableItemGraphVertexV1.js +113 -0
- package/dist/es/entities/auditableItemGraphVertexV1.js.map +1 -0
- package/dist/es/index.js +19 -0
- package/dist/es/index.js.map +1 -0
- package/dist/es/models/IAuditableItemGraphServiceConfig.js +4 -0
- package/dist/es/models/IAuditableItemGraphServiceConfig.js.map +1 -0
- package/dist/es/models/IAuditableItemGraphServiceConstructorOptions.js +2 -0
- package/dist/es/models/IAuditableItemGraphServiceConstructorOptions.js.map +1 -0
- package/dist/es/models/IAuditableItemGraphServiceContext.js +4 -0
- package/dist/es/models/IAuditableItemGraphServiceContext.js.map +1 -0
- package/dist/es/restEntryPoints.js +13 -0
- package/dist/es/restEntryPoints.js.map +1 -0
- package/dist/es/schema.js +27 -0
- package/dist/es/schema.js.map +1 -0
- package/dist/es/utils/auditableItemGraphVertexIndexHelper.js +57 -0
- package/dist/es/utils/auditableItemGraphVertexIndexHelper.js.map +1 -0
- package/dist/types/auditableItemGraphRoutes.d.ts +94 -0
- package/dist/types/auditableItemGraphService.d.ts +164 -0
- package/dist/types/entities/auditableItemGraphAlias.d.ts +34 -0
- package/dist/types/entities/auditableItemGraphChangeset.d.ts +34 -0
- package/dist/types/entities/auditableItemGraphEdge.d.ts +34 -0
- package/dist/types/entities/auditableItemGraphPatch.d.ts +21 -0
- package/dist/types/entities/auditableItemGraphResource.d.ts +26 -0
- package/dist/types/entities/auditableItemGraphVertex.d.ts +50 -0
- package/dist/types/entities/auditableItemGraphVertexIndex.d.ts +39 -0
- package/dist/types/entities/auditableItemGraphVertexV0.d.ts +53 -0
- package/dist/types/entities/auditableItemGraphVertexV1.d.ts +58 -0
- package/dist/types/index.d.ts +16 -0
- package/dist/types/models/IAuditableItemGraphServiceConfig.d.ts +9 -0
- package/dist/types/models/IAuditableItemGraphServiceConstructorOptions.d.ts +38 -0
- package/dist/types/models/IAuditableItemGraphServiceContext.d.ts +17 -0
- package/dist/types/restEntryPoints.d.ts +5 -0
- package/dist/types/schema.d.ts +4 -0
- package/dist/types/utils/auditableItemGraphVertexIndexHelper.d.ts +25 -0
- package/docs/changelog.md +16 -0
- package/docs/examples.md +273 -0
- package/docs/open-api/spec.json +2190 -0
- package/docs/reference/classes/AuditableItemGraphAlias.md +69 -0
- package/docs/reference/classes/AuditableItemGraphChangeset.md +69 -0
- package/docs/reference/classes/AuditableItemGraphEdge.md +69 -0
- package/docs/reference/classes/AuditableItemGraphPatch.md +45 -0
- package/docs/reference/classes/AuditableItemGraphResource.md +53 -0
- package/docs/reference/classes/AuditableItemGraphService.md +539 -0
- package/docs/reference/classes/AuditableItemGraphVertex.md +93 -0
- package/docs/reference/classes/AuditableItemGraphVertexIndex.md +75 -0
- package/docs/reference/classes/AuditableItemGraphVertexIndexHelper.md +84 -0
- package/docs/reference/classes/AuditableItemGraphVertexV0.md +101 -0
- package/docs/reference/classes/AuditableItemGraphVertexV1.md +109 -0
- package/docs/reference/functions/auditableItemGraphChangesetGet.md +31 -0
- package/docs/reference/functions/auditableItemGraphChangesetList.md +31 -0
- package/docs/reference/functions/auditableItemGraphCreate.md +37 -0
- package/docs/reference/functions/auditableItemGraphGet.md +31 -0
- package/docs/reference/functions/auditableItemGraphList.md +31 -0
- package/docs/reference/functions/auditableItemGraphRemoveProof.md +31 -0
- package/docs/reference/functions/auditableItemGraphUpdate.md +31 -0
- package/docs/reference/functions/auditableItemGraphUpdatePartial.md +31 -0
- package/docs/reference/functions/auditableItemGraphVersionGet.md +31 -0
- package/docs/reference/functions/auditableItemGraphVersionList.md +31 -0
- package/docs/reference/functions/generateRestRoutesAuditableItemGraph.md +25 -0
- package/docs/reference/functions/initSchema.md +9 -0
- package/docs/reference/index.md +40 -0
- package/docs/reference/interfaces/IAuditableItemGraphServiceConfig.md +11 -0
- package/docs/reference/interfaces/IAuditableItemGraphServiceConstructorOptions.md +83 -0
- package/docs/reference/variables/restEntryPoints.md +5 -0
- package/docs/reference/variables/tagsAuditableItemGraph.md +5 -0
- package/locales/en.json +34 -0
- package/package.json +64 -5
|
@@ -0,0 +1,1136 @@
|
|
|
1
|
+
// Copyright 2024 IOTA Stiftung.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
3
|
+
import { HttpContextIdKeys, HttpHeaderHelper, HttpParameterHelper, HttpUrlHelper } from "@3sixty/api-models";
|
|
4
|
+
import { AuditableItemGraphContexts, AuditableItemGraphTypes } from "@3sixty/auditable-item-graph-models";
|
|
5
|
+
import { ContextIdStore } from "@3sixty/context";
|
|
6
|
+
import { Coerce, ComponentFactory, Guards } from "@3sixty/core";
|
|
7
|
+
import { SchemaOrgContexts, SchemaOrgTypes } from "@3sixty/standards-schema-org";
|
|
8
|
+
import { HeaderTypes, HttpStatusCode, MimeTypes } from "@3sixty/web";
|
|
9
|
+
/**
|
|
10
|
+
* The source used when communicating about these routes.
|
|
11
|
+
*/
|
|
12
|
+
const ROUTES_SOURCE = "auditableItemGraphRoutes";
|
|
13
|
+
/**
|
|
14
|
+
* The tag to associate with the routes.
|
|
15
|
+
*/
|
|
16
|
+
export const tagsAuditableItemGraph = [
|
|
17
|
+
{
|
|
18
|
+
name: "Auditable Item Graph",
|
|
19
|
+
description: "Endpoints which are modelled to access an auditable item graph contract."
|
|
20
|
+
}
|
|
21
|
+
];
|
|
22
|
+
/**
|
|
23
|
+
* The REST routes for auditable item graph.
|
|
24
|
+
* @param baseRouteName Prefix to prepend to the paths.
|
|
25
|
+
* @param componentName The name of the component to use in the routes stored in the ComponentFactory.
|
|
26
|
+
* @returns The generated routes.
|
|
27
|
+
*/
|
|
28
|
+
export function generateRestRoutesAuditableItemGraph(baseRouteName, componentName) {
|
|
29
|
+
const createRoute = {
|
|
30
|
+
operationId: "auditableItemGraphCreate",
|
|
31
|
+
summary: "Create a new graph vertex",
|
|
32
|
+
tag: tagsAuditableItemGraph[0].name,
|
|
33
|
+
method: "POST",
|
|
34
|
+
path: `${baseRouteName}/`,
|
|
35
|
+
handler: async (httpRequestContext, request) => auditableItemGraphCreate(httpRequestContext, componentName, request, baseRouteName),
|
|
36
|
+
requestType: {
|
|
37
|
+
type: "IAuditableItemGraphCreateRequest",
|
|
38
|
+
examples: [
|
|
39
|
+
{
|
|
40
|
+
id: "auditableItemGraphCreateRequestExample",
|
|
41
|
+
request: {
|
|
42
|
+
body: {
|
|
43
|
+
"@context": [
|
|
44
|
+
AuditableItemGraphContexts.Context,
|
|
45
|
+
AuditableItemGraphContexts.ContextCommon
|
|
46
|
+
],
|
|
47
|
+
type: AuditableItemGraphTypes.Vertex,
|
|
48
|
+
annotationObject: {
|
|
49
|
+
"@context": "https://schema.org",
|
|
50
|
+
"@type": "Note",
|
|
51
|
+
content: "This is a simple note"
|
|
52
|
+
},
|
|
53
|
+
aliases: [
|
|
54
|
+
{
|
|
55
|
+
type: AuditableItemGraphTypes.Alias,
|
|
56
|
+
id: "bar456",
|
|
57
|
+
annotationObject: {
|
|
58
|
+
"@context": "https://schema.org",
|
|
59
|
+
"@type": "Note",
|
|
60
|
+
content: "This is a simple note"
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
type: AuditableItemGraphTypes.Alias,
|
|
65
|
+
id: "foo321",
|
|
66
|
+
annotationObject: {
|
|
67
|
+
"@context": "https://schema.org",
|
|
68
|
+
"@type": "Note",
|
|
69
|
+
content: "This is a simple note"
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
],
|
|
73
|
+
resources: [
|
|
74
|
+
{
|
|
75
|
+
type: AuditableItemGraphTypes.Resource,
|
|
76
|
+
id: "resource1",
|
|
77
|
+
resourceObject: {
|
|
78
|
+
"@context": "https://schema.org",
|
|
79
|
+
"@type": "Note",
|
|
80
|
+
content: "This is a simple note"
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
type: AuditableItemGraphTypes.Resource,
|
|
85
|
+
id: "resource2",
|
|
86
|
+
resourceObject: {
|
|
87
|
+
"@context": "https://schema.org",
|
|
88
|
+
"@type": "Note",
|
|
89
|
+
content: "This is a simple note"
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
],
|
|
93
|
+
edges: [
|
|
94
|
+
{
|
|
95
|
+
type: AuditableItemGraphTypes.Edge,
|
|
96
|
+
targetId: "aig:1234567890",
|
|
97
|
+
edgeRelationships: ["frenemy"],
|
|
98
|
+
annotationObject: {
|
|
99
|
+
"@context": "https://schema.org",
|
|
100
|
+
"@type": "Note",
|
|
101
|
+
content: "This is a simple note"
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
type: AuditableItemGraphTypes.Edge,
|
|
106
|
+
targetId: "aig:45678901234",
|
|
107
|
+
edgeRelationships: ["end"],
|
|
108
|
+
annotationObject: {
|
|
109
|
+
"@context": "https://schema.org",
|
|
110
|
+
"@type": "Note",
|
|
111
|
+
content: "This is a simple note"
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
]
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
]
|
|
119
|
+
},
|
|
120
|
+
responseType: [
|
|
121
|
+
{
|
|
122
|
+
type: "ICreatedResponse",
|
|
123
|
+
examples: [
|
|
124
|
+
{
|
|
125
|
+
id: "auditableItemGraphCreateResponseExample",
|
|
126
|
+
description: "The response when a new graph vertex is created.",
|
|
127
|
+
response: {
|
|
128
|
+
statusCode: HttpStatusCode.created,
|
|
129
|
+
headers: {
|
|
130
|
+
[HeaderTypes.Location]: "aig%3A1234567890"
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
]
|
|
135
|
+
}
|
|
136
|
+
]
|
|
137
|
+
};
|
|
138
|
+
const getRoute = {
|
|
139
|
+
operationId: "auditableItemGraphGet",
|
|
140
|
+
summary: "Get a graph vertex",
|
|
141
|
+
tag: tagsAuditableItemGraph[0].name,
|
|
142
|
+
method: "GET",
|
|
143
|
+
path: `${baseRouteName}/:id`,
|
|
144
|
+
handler: async (httpRequestContext, request) => auditableItemGraphGet(httpRequestContext, componentName, request),
|
|
145
|
+
requestType: {
|
|
146
|
+
type: "IAuditableItemGraphGetRequest",
|
|
147
|
+
examples: [
|
|
148
|
+
{
|
|
149
|
+
id: "auditableItemGraphGetRequestExample",
|
|
150
|
+
request: {
|
|
151
|
+
headers: {
|
|
152
|
+
[HeaderTypes.Accept]: MimeTypes.Json
|
|
153
|
+
},
|
|
154
|
+
pathParams: {
|
|
155
|
+
id: "aig:1234567890"
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
]
|
|
160
|
+
},
|
|
161
|
+
responseType: [
|
|
162
|
+
{
|
|
163
|
+
type: "IAuditableItemGraphGetResponse",
|
|
164
|
+
examples: [
|
|
165
|
+
{
|
|
166
|
+
id: "auditableItemGraphGetResponseExample",
|
|
167
|
+
response: {
|
|
168
|
+
body: {
|
|
169
|
+
"@context": [
|
|
170
|
+
AuditableItemGraphContexts.Context,
|
|
171
|
+
AuditableItemGraphContexts.ContextCommon,
|
|
172
|
+
SchemaOrgContexts.Context
|
|
173
|
+
],
|
|
174
|
+
type: AuditableItemGraphTypes.Vertex,
|
|
175
|
+
id: "aig:1234567890",
|
|
176
|
+
dateCreated: "2024-08-22T11:55:16.271Z",
|
|
177
|
+
dateModified: "2024-08-22T11:55:16.271Z",
|
|
178
|
+
annotationObject: {
|
|
179
|
+
"@context": "https://schema.org",
|
|
180
|
+
"@type": "Note",
|
|
181
|
+
content: "This is a simple note"
|
|
182
|
+
},
|
|
183
|
+
aliases: [
|
|
184
|
+
{
|
|
185
|
+
"@context": [
|
|
186
|
+
AuditableItemGraphContexts.Context,
|
|
187
|
+
AuditableItemGraphContexts.ContextCommon,
|
|
188
|
+
SchemaOrgContexts.Context
|
|
189
|
+
],
|
|
190
|
+
type: AuditableItemGraphTypes.Alias,
|
|
191
|
+
id: "tst:1234567890",
|
|
192
|
+
dateCreated: "2024-08-22T11:55:16.271Z"
|
|
193
|
+
}
|
|
194
|
+
]
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
]
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
type: "IAuditableItemGraphGetResponse",
|
|
202
|
+
mimeType: MimeTypes.JsonLd,
|
|
203
|
+
examples: [
|
|
204
|
+
{
|
|
205
|
+
id: "auditableItemGraphJsonLdGetResponseExample",
|
|
206
|
+
response: {
|
|
207
|
+
headers: {
|
|
208
|
+
[HeaderTypes.ContentType]: MimeTypes.JsonLd
|
|
209
|
+
},
|
|
210
|
+
body: {
|
|
211
|
+
"@context": [
|
|
212
|
+
AuditableItemGraphContexts.Context,
|
|
213
|
+
AuditableItemGraphContexts.ContextCommon,
|
|
214
|
+
SchemaOrgContexts.Context
|
|
215
|
+
],
|
|
216
|
+
type: AuditableItemGraphTypes.Vertex,
|
|
217
|
+
id: "aig:1234567890",
|
|
218
|
+
dateCreated: "2024-08-22T11:55:16.271Z",
|
|
219
|
+
dateModified: "2024-08-22T11:55:16.271Z",
|
|
220
|
+
annotationObject: {
|
|
221
|
+
"@context": "https://schema.org",
|
|
222
|
+
"@type": "Note",
|
|
223
|
+
content: "This is a simple note"
|
|
224
|
+
},
|
|
225
|
+
aliases: [
|
|
226
|
+
{
|
|
227
|
+
"@context": [
|
|
228
|
+
AuditableItemGraphContexts.Context,
|
|
229
|
+
AuditableItemGraphContexts.ContextCommon,
|
|
230
|
+
SchemaOrgContexts.Context
|
|
231
|
+
],
|
|
232
|
+
type: AuditableItemGraphTypes.Alias,
|
|
233
|
+
dateCreated: "2024-08-22T11:55:16.271Z",
|
|
234
|
+
id: "tst:1234567890"
|
|
235
|
+
}
|
|
236
|
+
]
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
]
|
|
241
|
+
}
|
|
242
|
+
]
|
|
243
|
+
};
|
|
244
|
+
const getChangesetRoute = {
|
|
245
|
+
operationId: "auditableItemGraphChangesetGet",
|
|
246
|
+
summary: "Get a graph vertex changeset",
|
|
247
|
+
tag: tagsAuditableItemGraph[0].name,
|
|
248
|
+
method: "GET",
|
|
249
|
+
path: `${baseRouteName}/:id/changesets/:changesetId`,
|
|
250
|
+
handler: async (httpRequestContext, request) => auditableItemGraphChangesetGet(httpRequestContext, componentName, request),
|
|
251
|
+
requestType: {
|
|
252
|
+
type: "IAuditableItemGraphChangesetGetRequest",
|
|
253
|
+
examples: [
|
|
254
|
+
{
|
|
255
|
+
id: "auditableItemGraphChangesetGetRequestExample",
|
|
256
|
+
request: {
|
|
257
|
+
headers: {
|
|
258
|
+
[HeaderTypes.Accept]: MimeTypes.Json
|
|
259
|
+
},
|
|
260
|
+
pathParams: {
|
|
261
|
+
id: "aig:1234567890",
|
|
262
|
+
changesetId: "changeset:1234567890"
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
]
|
|
267
|
+
},
|
|
268
|
+
responseType: [
|
|
269
|
+
{
|
|
270
|
+
type: "IAuditableItemGraphChangesetGetResponse",
|
|
271
|
+
examples: [
|
|
272
|
+
{
|
|
273
|
+
id: "auditableItemGraphChangesetGetResponseExample",
|
|
274
|
+
response: {
|
|
275
|
+
body: {
|
|
276
|
+
"@context": [
|
|
277
|
+
AuditableItemGraphContexts.Context,
|
|
278
|
+
AuditableItemGraphContexts.ContextCommon
|
|
279
|
+
],
|
|
280
|
+
type: AuditableItemGraphTypes.Changeset,
|
|
281
|
+
id: "aig:1234567890",
|
|
282
|
+
dateCreated: "2024-08-22T11:55:16.271Z",
|
|
283
|
+
patches: [
|
|
284
|
+
{
|
|
285
|
+
type: "AuditableItemGraphPatchOperation",
|
|
286
|
+
patchOperation: "add",
|
|
287
|
+
patchPath: "/annotationObject",
|
|
288
|
+
patchValue: {
|
|
289
|
+
"@context": "https://www.w3.org/ns/activitystreams",
|
|
290
|
+
type: "Create",
|
|
291
|
+
actor: { type: "Person", id: "acct:person@example.org", name: "Person" },
|
|
292
|
+
object: { type: "Note", content: "This is a simple note" },
|
|
293
|
+
published: "2015-01-25T12:34:56Z"
|
|
294
|
+
}
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
type: "AuditableItemGraphPatchOperation",
|
|
298
|
+
patchOperation: "add",
|
|
299
|
+
patchPath: "/aliases",
|
|
300
|
+
patchValue: [
|
|
301
|
+
{ id: "foo123", dateCreated: "2015-01-25T12:34:56Z" },
|
|
302
|
+
{ id: "bar456", dateCreated: "2015-01-25T12:34:56Z" }
|
|
303
|
+
]
|
|
304
|
+
}
|
|
305
|
+
],
|
|
306
|
+
verification: {
|
|
307
|
+
"@context": "https://schema.3sixty.global/immutable-proof/",
|
|
308
|
+
type: "ImmutableProofVerification",
|
|
309
|
+
verified: true
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
]
|
|
315
|
+
},
|
|
316
|
+
{
|
|
317
|
+
type: "IAuditableItemGraphChangesetGetResponse",
|
|
318
|
+
mimeType: MimeTypes.JsonLd,
|
|
319
|
+
examples: [
|
|
320
|
+
{
|
|
321
|
+
id: "auditableItemGraphChangesetJsonLdGetResponseExample",
|
|
322
|
+
response: {
|
|
323
|
+
headers: {
|
|
324
|
+
[HeaderTypes.ContentType]: MimeTypes.JsonLd
|
|
325
|
+
},
|
|
326
|
+
body: {
|
|
327
|
+
"@context": [
|
|
328
|
+
AuditableItemGraphContexts.Context,
|
|
329
|
+
AuditableItemGraphContexts.ContextCommon,
|
|
330
|
+
SchemaOrgContexts.Context
|
|
331
|
+
],
|
|
332
|
+
type: AuditableItemGraphTypes.Changeset,
|
|
333
|
+
id: "aig:1234567890",
|
|
334
|
+
dateCreated: "2024-08-22T11:55:16.271Z",
|
|
335
|
+
patches: [
|
|
336
|
+
{
|
|
337
|
+
type: "AuditableItemGraphPatchOperation",
|
|
338
|
+
patchOperation: "add",
|
|
339
|
+
patchPath: "/annotationObject",
|
|
340
|
+
patchValue: {
|
|
341
|
+
"@context": "https://www.w3.org/ns/activitystreams",
|
|
342
|
+
type: "Create",
|
|
343
|
+
actor: { type: "Person", id: "acct:person@example.org", name: "Person" },
|
|
344
|
+
object: { type: "Note", content: "This is a simple note" },
|
|
345
|
+
published: "2015-01-25T12:34:56Z"
|
|
346
|
+
}
|
|
347
|
+
},
|
|
348
|
+
{
|
|
349
|
+
type: "AuditableItemGraphPatchOperation",
|
|
350
|
+
patchOperation: "add",
|
|
351
|
+
patchPath: "/aliases",
|
|
352
|
+
patchValue: [
|
|
353
|
+
{ id: "foo123", dateCreated: "2015-01-25T12:34:56Z" },
|
|
354
|
+
{ id: "bar456", dateCreated: "2015-01-25T12:34:56Z" }
|
|
355
|
+
]
|
|
356
|
+
}
|
|
357
|
+
],
|
|
358
|
+
verification: {
|
|
359
|
+
"@context": "https://schema.3sixty.global/immutable-proof/",
|
|
360
|
+
type: "ImmutableProofVerification",
|
|
361
|
+
verified: true
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
]
|
|
367
|
+
}
|
|
368
|
+
]
|
|
369
|
+
};
|
|
370
|
+
const getChangesetListRoute = {
|
|
371
|
+
operationId: "auditableItemGraphChangesetList",
|
|
372
|
+
summary: "Get a list of graph vertex changesets",
|
|
373
|
+
tag: tagsAuditableItemGraph[0].name,
|
|
374
|
+
method: "GET",
|
|
375
|
+
path: `${baseRouteName}/:id/changesets`,
|
|
376
|
+
handler: async (httpRequestContext, request) => auditableItemGraphChangesetList(httpRequestContext, componentName, request),
|
|
377
|
+
requestType: {
|
|
378
|
+
type: "IAuditableItemGraphChangesetListRequest",
|
|
379
|
+
examples: [
|
|
380
|
+
{
|
|
381
|
+
id: "auditableItemGraphChangesetListRequestExample",
|
|
382
|
+
request: {
|
|
383
|
+
headers: {
|
|
384
|
+
[HeaderTypes.Accept]: MimeTypes.Json
|
|
385
|
+
},
|
|
386
|
+
pathParams: {
|
|
387
|
+
id: "aig:1234567890"
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
]
|
|
392
|
+
},
|
|
393
|
+
responseType: [
|
|
394
|
+
{
|
|
395
|
+
type: "IAuditableItemGraphChangesetListResponse",
|
|
396
|
+
examples: [
|
|
397
|
+
{
|
|
398
|
+
id: "auditableItemGraphChangesetListResponseExample",
|
|
399
|
+
response: {
|
|
400
|
+
body: {
|
|
401
|
+
"@context": [
|
|
402
|
+
SchemaOrgContexts.Context,
|
|
403
|
+
AuditableItemGraphContexts.Context,
|
|
404
|
+
AuditableItemGraphContexts.ContextCommon
|
|
405
|
+
],
|
|
406
|
+
type: [SchemaOrgTypes.ItemList, AuditableItemGraphTypes.ChangesetList],
|
|
407
|
+
[SchemaOrgTypes.ItemListElement]: [
|
|
408
|
+
{
|
|
409
|
+
type: AuditableItemGraphTypes.Changeset,
|
|
410
|
+
id: "aig:1234567890",
|
|
411
|
+
dateCreated: "2024-08-22T11:55:16.271Z",
|
|
412
|
+
patches: [
|
|
413
|
+
{
|
|
414
|
+
type: "AuditableItemGraphPatchOperation",
|
|
415
|
+
patchOperation: "add",
|
|
416
|
+
patchPath: "/annotationObject",
|
|
417
|
+
patchValue: {
|
|
418
|
+
"@context": "https://www.w3.org/ns/activitystreams",
|
|
419
|
+
type: "Create",
|
|
420
|
+
actor: { type: "Person", id: "acct:person@example.org", name: "Person" },
|
|
421
|
+
object: { type: "Note", content: "This is a simple note" },
|
|
422
|
+
published: "2015-01-25T12:34:56Z"
|
|
423
|
+
}
|
|
424
|
+
},
|
|
425
|
+
{
|
|
426
|
+
type: "AuditableItemGraphPatchOperation",
|
|
427
|
+
patchOperation: "add",
|
|
428
|
+
patchPath: "/aliases",
|
|
429
|
+
patchValue: [
|
|
430
|
+
{ id: "foo123", dateCreated: "2015-01-25T12:34:56Z" },
|
|
431
|
+
{ id: "bar456", dateCreated: "2015-01-25T12:34:56Z" }
|
|
432
|
+
]
|
|
433
|
+
}
|
|
434
|
+
],
|
|
435
|
+
verification: {
|
|
436
|
+
"@context": "https://schema.3sixty.global/immutable-proof/",
|
|
437
|
+
type: "ImmutableProofVerification",
|
|
438
|
+
verified: true
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
]
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
]
|
|
446
|
+
},
|
|
447
|
+
{
|
|
448
|
+
type: "IAuditableItemGraphChangesetGetResponse",
|
|
449
|
+
mimeType: MimeTypes.JsonLd,
|
|
450
|
+
examples: [
|
|
451
|
+
{
|
|
452
|
+
id: "auditableItemGraphChangesetJsonLdGetResponseExample",
|
|
453
|
+
response: {
|
|
454
|
+
headers: {
|
|
455
|
+
[HeaderTypes.ContentType]: MimeTypes.JsonLd
|
|
456
|
+
},
|
|
457
|
+
body: {
|
|
458
|
+
"@context": [
|
|
459
|
+
SchemaOrgContexts.Context,
|
|
460
|
+
AuditableItemGraphContexts.Context,
|
|
461
|
+
AuditableItemGraphContexts.ContextCommon,
|
|
462
|
+
SchemaOrgContexts.Context
|
|
463
|
+
],
|
|
464
|
+
type: [SchemaOrgTypes.ItemList, AuditableItemGraphTypes.ChangesetList],
|
|
465
|
+
[SchemaOrgTypes.ItemListElement]: [
|
|
466
|
+
{
|
|
467
|
+
type: AuditableItemGraphTypes.Changeset,
|
|
468
|
+
id: "aig:1234567890",
|
|
469
|
+
dateCreated: "2024-08-22T11:55:16.271Z",
|
|
470
|
+
patches: [
|
|
471
|
+
{
|
|
472
|
+
type: "AuditableItemGraphPatchOperation",
|
|
473
|
+
patchOperation: "add",
|
|
474
|
+
patchPath: "/annotationObject",
|
|
475
|
+
patchValue: {
|
|
476
|
+
"@context": "https://www.w3.org/ns/activitystreams",
|
|
477
|
+
type: "Create",
|
|
478
|
+
actor: { type: "Person", id: "acct:person@example.org", name: "Person" },
|
|
479
|
+
object: { type: "Note", content: "This is a simple note" },
|
|
480
|
+
published: "2015-01-25T12:34:56Z"
|
|
481
|
+
}
|
|
482
|
+
},
|
|
483
|
+
{
|
|
484
|
+
type: "AuditableItemGraphPatchOperation",
|
|
485
|
+
patchOperation: "add",
|
|
486
|
+
patchPath: "/aliases",
|
|
487
|
+
patchValue: [
|
|
488
|
+
{ id: "foo123", dateCreated: "2015-01-25T12:34:56Z" },
|
|
489
|
+
{ id: "bar456", dateCreated: "2015-01-25T12:34:56Z" }
|
|
490
|
+
]
|
|
491
|
+
}
|
|
492
|
+
],
|
|
493
|
+
verification: {
|
|
494
|
+
"@context": "https://schema.3sixty.global/immutable-proof/",
|
|
495
|
+
type: "ImmutableProofVerification",
|
|
496
|
+
verified: true
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
]
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
]
|
|
504
|
+
}
|
|
505
|
+
]
|
|
506
|
+
};
|
|
507
|
+
const getVersionRoute = {
|
|
508
|
+
operationId: "auditableItemGraphVersionGet",
|
|
509
|
+
summary: "Get a graph vertex at a specific version",
|
|
510
|
+
tag: tagsAuditableItemGraph[0].name,
|
|
511
|
+
method: "GET",
|
|
512
|
+
path: `${baseRouteName}/:id/versions/:version`,
|
|
513
|
+
handler: async (httpRequestContext, request) => auditableItemGraphVersionGet(httpRequestContext, componentName, request),
|
|
514
|
+
requestType: {
|
|
515
|
+
type: "IAuditableItemGraphVersionGetRequest",
|
|
516
|
+
examples: [
|
|
517
|
+
{
|
|
518
|
+
id: "auditableItemGraphVersionGetRequestExample",
|
|
519
|
+
request: {
|
|
520
|
+
headers: {
|
|
521
|
+
[HeaderTypes.Accept]: MimeTypes.Json
|
|
522
|
+
},
|
|
523
|
+
pathParams: {
|
|
524
|
+
id: "aig:1234567890",
|
|
525
|
+
version: "1"
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
]
|
|
530
|
+
},
|
|
531
|
+
responseType: [
|
|
532
|
+
{
|
|
533
|
+
type: "IAuditableItemGraphVersionGetResponse",
|
|
534
|
+
examples: [
|
|
535
|
+
{
|
|
536
|
+
id: "auditableItemGraphVersionGetResponseExample",
|
|
537
|
+
response: {
|
|
538
|
+
body: {
|
|
539
|
+
"@context": [
|
|
540
|
+
AuditableItemGraphContexts.Context,
|
|
541
|
+
AuditableItemGraphContexts.ContextCommon,
|
|
542
|
+
SchemaOrgContexts.Context
|
|
543
|
+
],
|
|
544
|
+
type: AuditableItemGraphTypes.Vertex,
|
|
545
|
+
id: "aig:1234567890",
|
|
546
|
+
dateCreated: "2024-08-22T11:55:16.271Z",
|
|
547
|
+
version: 1
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
]
|
|
552
|
+
}
|
|
553
|
+
]
|
|
554
|
+
};
|
|
555
|
+
const getVersionListRoute = {
|
|
556
|
+
operationId: "auditableItemGraphVersionList",
|
|
557
|
+
summary: "Get all versions of a graph vertex",
|
|
558
|
+
tag: tagsAuditableItemGraph[0].name,
|
|
559
|
+
method: "GET",
|
|
560
|
+
path: `${baseRouteName}/:id/versions`,
|
|
561
|
+
handler: async (httpRequestContext, request) => auditableItemGraphVersionList(httpRequestContext, componentName, request),
|
|
562
|
+
requestType: {
|
|
563
|
+
type: "IAuditableItemGraphVersionListRequest",
|
|
564
|
+
examples: [
|
|
565
|
+
{
|
|
566
|
+
id: "auditableItemGraphVersionListRequestExample",
|
|
567
|
+
request: {
|
|
568
|
+
headers: {
|
|
569
|
+
[HeaderTypes.Accept]: MimeTypes.Json
|
|
570
|
+
},
|
|
571
|
+
pathParams: {
|
|
572
|
+
id: "aig:1234567890"
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
},
|
|
576
|
+
{
|
|
577
|
+
id: "auditableItemGraphVersionListAfterRequestExample",
|
|
578
|
+
request: {
|
|
579
|
+
pathParams: {
|
|
580
|
+
id: "aig:1234567890"
|
|
581
|
+
},
|
|
582
|
+
query: {
|
|
583
|
+
after: "2026-04-03T12:00:00Z"
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
]
|
|
588
|
+
},
|
|
589
|
+
responseType: [
|
|
590
|
+
{
|
|
591
|
+
type: "IAuditableItemGraphVersionListResponse",
|
|
592
|
+
examples: [
|
|
593
|
+
{
|
|
594
|
+
id: "auditableItemGraphVersionListResponseExample",
|
|
595
|
+
response: {
|
|
596
|
+
body: {
|
|
597
|
+
"@context": [
|
|
598
|
+
SchemaOrgContexts.Context,
|
|
599
|
+
AuditableItemGraphContexts.Context,
|
|
600
|
+
AuditableItemGraphContexts.ContextCommon
|
|
601
|
+
],
|
|
602
|
+
type: [SchemaOrgTypes.ItemList, AuditableItemGraphTypes.VertexVersionList],
|
|
603
|
+
[SchemaOrgTypes.ItemListElement]: [
|
|
604
|
+
{ version: 0, dateCreated: "2024-08-22T11:55:16.271Z" },
|
|
605
|
+
{ version: 1, dateCreated: "2024-08-22T11:56:00.000Z" },
|
|
606
|
+
{ version: 2, dateCreated: "2024-08-22T11:57:00.000Z" }
|
|
607
|
+
]
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
]
|
|
612
|
+
}
|
|
613
|
+
]
|
|
614
|
+
};
|
|
615
|
+
const updateRoute = {
|
|
616
|
+
operationId: "auditableItemGraphUpdate",
|
|
617
|
+
summary: "Update a graph vertex",
|
|
618
|
+
tag: tagsAuditableItemGraph[0].name,
|
|
619
|
+
method: "PUT",
|
|
620
|
+
path: `${baseRouteName}/:id`,
|
|
621
|
+
handler: async (httpRequestContext, request) => auditableItemGraphUpdate(httpRequestContext, componentName, request),
|
|
622
|
+
requestType: {
|
|
623
|
+
type: "IAuditableItemGraphUpdateRequest",
|
|
624
|
+
examples: [
|
|
625
|
+
{
|
|
626
|
+
id: "auditableItemGraphUpdateRequestExample",
|
|
627
|
+
request: {
|
|
628
|
+
pathParams: {
|
|
629
|
+
id: "aig:1234567890"
|
|
630
|
+
},
|
|
631
|
+
body: {
|
|
632
|
+
"@context": [
|
|
633
|
+
AuditableItemGraphContexts.Context,
|
|
634
|
+
AuditableItemGraphContexts.ContextCommon
|
|
635
|
+
],
|
|
636
|
+
type: AuditableItemGraphTypes.Vertex,
|
|
637
|
+
annotationObject: {
|
|
638
|
+
"@context": "https://schema.org",
|
|
639
|
+
"@type": "Note",
|
|
640
|
+
content: "This is a simple note"
|
|
641
|
+
},
|
|
642
|
+
aliases: [
|
|
643
|
+
{
|
|
644
|
+
type: AuditableItemGraphTypes.Alias,
|
|
645
|
+
id: "bar456",
|
|
646
|
+
annotationObject: {
|
|
647
|
+
"@context": "https://schema.org",
|
|
648
|
+
"@type": "Note",
|
|
649
|
+
content: "This is a simple note"
|
|
650
|
+
}
|
|
651
|
+
},
|
|
652
|
+
{
|
|
653
|
+
type: AuditableItemGraphTypes.Alias,
|
|
654
|
+
id: "foo321",
|
|
655
|
+
annotationObject: {
|
|
656
|
+
"@context": "https://schema.org",
|
|
657
|
+
"@type": "Note",
|
|
658
|
+
content: "This is a simple note"
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
],
|
|
662
|
+
resources: [
|
|
663
|
+
{
|
|
664
|
+
type: AuditableItemGraphTypes.Resource,
|
|
665
|
+
id: "resource1",
|
|
666
|
+
resourceObject: {
|
|
667
|
+
"@context": "https://schema.org",
|
|
668
|
+
"@type": "Note",
|
|
669
|
+
content: "This is a simple note"
|
|
670
|
+
}
|
|
671
|
+
},
|
|
672
|
+
{
|
|
673
|
+
type: AuditableItemGraphTypes.Resource,
|
|
674
|
+
id: "resource2",
|
|
675
|
+
resourceObject: {
|
|
676
|
+
"@context": "https://schema.org",
|
|
677
|
+
"@type": "Note",
|
|
678
|
+
content: "This is a simple note"
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
],
|
|
682
|
+
edges: [
|
|
683
|
+
{
|
|
684
|
+
type: AuditableItemGraphTypes.Edge,
|
|
685
|
+
id: "edge1",
|
|
686
|
+
targetId: "aig:1234567890",
|
|
687
|
+
edgeRelationships: ["frenemy"],
|
|
688
|
+
annotationObject: {
|
|
689
|
+
"@context": "https://schema.org",
|
|
690
|
+
"@type": "Note",
|
|
691
|
+
content: "This is a simple note"
|
|
692
|
+
}
|
|
693
|
+
},
|
|
694
|
+
{
|
|
695
|
+
type: AuditableItemGraphTypes.Edge,
|
|
696
|
+
id: "edge2",
|
|
697
|
+
targetId: "aig:45678901234",
|
|
698
|
+
edgeRelationships: ["end"],
|
|
699
|
+
annotationObject: {
|
|
700
|
+
"@context": "https://schema.org",
|
|
701
|
+
"@type": "Note",
|
|
702
|
+
content: "This is a simple note"
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
]
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
]
|
|
710
|
+
},
|
|
711
|
+
responseType: [
|
|
712
|
+
{
|
|
713
|
+
type: "INoContentResponse"
|
|
714
|
+
}
|
|
715
|
+
]
|
|
716
|
+
};
|
|
717
|
+
const updatePartialRoute = {
|
|
718
|
+
operationId: "auditableItemGraphUpdatePartial",
|
|
719
|
+
summary: "Partially update a graph vertex",
|
|
720
|
+
tag: tagsAuditableItemGraph[0].name,
|
|
721
|
+
method: "PATCH",
|
|
722
|
+
path: `${baseRouteName}/:id`,
|
|
723
|
+
handler: async (httpRequestContext, request) => auditableItemGraphUpdatePartial(httpRequestContext, componentName, request),
|
|
724
|
+
requestType: {
|
|
725
|
+
type: "IAuditableItemGraphUpdatePartialRequest",
|
|
726
|
+
examples: [
|
|
727
|
+
{
|
|
728
|
+
id: "auditableItemGraphUpdatePartialRequestExample",
|
|
729
|
+
request: {
|
|
730
|
+
pathParams: {
|
|
731
|
+
id: "aig:1234567890"
|
|
732
|
+
},
|
|
733
|
+
body: {
|
|
734
|
+
"@context": [
|
|
735
|
+
AuditableItemGraphContexts.Context,
|
|
736
|
+
AuditableItemGraphContexts.ContextCommon
|
|
737
|
+
],
|
|
738
|
+
edgePatches: {
|
|
739
|
+
add: [
|
|
740
|
+
{
|
|
741
|
+
type: AuditableItemGraphTypes.Edge,
|
|
742
|
+
targetId: "aig:45678901234",
|
|
743
|
+
edgeRelationships: ["document"]
|
|
744
|
+
}
|
|
745
|
+
]
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
]
|
|
751
|
+
},
|
|
752
|
+
responseType: [
|
|
753
|
+
{
|
|
754
|
+
type: "INoContentResponse"
|
|
755
|
+
}
|
|
756
|
+
]
|
|
757
|
+
};
|
|
758
|
+
const listRoute = {
|
|
759
|
+
operationId: "auditableItemGraphList",
|
|
760
|
+
summary: "Query graph vertices by id or alias",
|
|
761
|
+
tag: tagsAuditableItemGraph[0].name,
|
|
762
|
+
method: "GET",
|
|
763
|
+
path: `${baseRouteName}/`,
|
|
764
|
+
handler: async (httpRequestContext, request) => auditableItemGraphList(httpRequestContext, componentName, request),
|
|
765
|
+
requestType: {
|
|
766
|
+
type: "IAuditableItemGraphListRequest",
|
|
767
|
+
examples: [
|
|
768
|
+
{
|
|
769
|
+
id: "IAuditableItemGraphListAllRequest",
|
|
770
|
+
request: {}
|
|
771
|
+
},
|
|
772
|
+
{
|
|
773
|
+
id: "IAuditableItemGraphListIdRequest",
|
|
774
|
+
request: {
|
|
775
|
+
query: {
|
|
776
|
+
id: "1234567890"
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
]
|
|
781
|
+
},
|
|
782
|
+
responseType: [
|
|
783
|
+
{
|
|
784
|
+
type: "IAuditableItemGraphListResponse",
|
|
785
|
+
examples: [
|
|
786
|
+
{
|
|
787
|
+
id: "auditableItemGraphListResponseExample",
|
|
788
|
+
response: {
|
|
789
|
+
body: {
|
|
790
|
+
"@context": [
|
|
791
|
+
SchemaOrgContexts.Context,
|
|
792
|
+
AuditableItemGraphContexts.Context,
|
|
793
|
+
AuditableItemGraphContexts.ContextCommon
|
|
794
|
+
],
|
|
795
|
+
type: [SchemaOrgTypes.ItemList, AuditableItemGraphTypes.VertexList],
|
|
796
|
+
[SchemaOrgTypes.ItemListElement]: [
|
|
797
|
+
{
|
|
798
|
+
"@context": [
|
|
799
|
+
AuditableItemGraphContexts.Context,
|
|
800
|
+
AuditableItemGraphContexts.ContextCommon,
|
|
801
|
+
SchemaOrgContexts.Context
|
|
802
|
+
],
|
|
803
|
+
type: AuditableItemGraphTypes.Vertex,
|
|
804
|
+
id: "0101010101010101010101010101010101010101010101010101010101010101",
|
|
805
|
+
dateCreated: "2024-08-22T11:55:16.271Z",
|
|
806
|
+
aliases: [
|
|
807
|
+
{
|
|
808
|
+
"@context": [
|
|
809
|
+
AuditableItemGraphContexts.Context,
|
|
810
|
+
AuditableItemGraphContexts.ContextCommon,
|
|
811
|
+
SchemaOrgContexts.Context
|
|
812
|
+
],
|
|
813
|
+
type: AuditableItemGraphTypes.Alias,
|
|
814
|
+
id: "foo4",
|
|
815
|
+
dateCreated: "2024-08-22T11:55:16.271Z"
|
|
816
|
+
}
|
|
817
|
+
]
|
|
818
|
+
}
|
|
819
|
+
]
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
]
|
|
824
|
+
},
|
|
825
|
+
{
|
|
826
|
+
type: "IAuditableItemGraphListResponse",
|
|
827
|
+
mimeType: MimeTypes.JsonLd,
|
|
828
|
+
examples: [
|
|
829
|
+
{
|
|
830
|
+
id: "auditableItemGraphJsonLdListResponseExample",
|
|
831
|
+
response: {
|
|
832
|
+
headers: {
|
|
833
|
+
[HeaderTypes.ContentType]: MimeTypes.JsonLd
|
|
834
|
+
},
|
|
835
|
+
body: {
|
|
836
|
+
"@context": [
|
|
837
|
+
SchemaOrgContexts.Context,
|
|
838
|
+
AuditableItemGraphContexts.Context,
|
|
839
|
+
AuditableItemGraphContexts.ContextCommon
|
|
840
|
+
],
|
|
841
|
+
type: [SchemaOrgTypes.ItemList, AuditableItemGraphTypes.VertexList],
|
|
842
|
+
[SchemaOrgTypes.ItemListElement]: [
|
|
843
|
+
{
|
|
844
|
+
"@context": [
|
|
845
|
+
AuditableItemGraphContexts.Context,
|
|
846
|
+
AuditableItemGraphContexts.ContextCommon,
|
|
847
|
+
SchemaOrgContexts.Context
|
|
848
|
+
],
|
|
849
|
+
type: AuditableItemGraphTypes.Vertex,
|
|
850
|
+
id: "0101010101010101010101010101010101010101010101010101010101010101",
|
|
851
|
+
dateCreated: "2024-08-22T11:55:16.271Z",
|
|
852
|
+
aliases: [
|
|
853
|
+
{
|
|
854
|
+
"@context": [
|
|
855
|
+
AuditableItemGraphContexts.Context,
|
|
856
|
+
AuditableItemGraphContexts.ContextCommon,
|
|
857
|
+
SchemaOrgContexts.Context
|
|
858
|
+
],
|
|
859
|
+
type: AuditableItemGraphTypes.Alias,
|
|
860
|
+
id: "foo4",
|
|
861
|
+
dateCreated: "2024-08-22T11:55:16.271Z"
|
|
862
|
+
}
|
|
863
|
+
]
|
|
864
|
+
}
|
|
865
|
+
]
|
|
866
|
+
}
|
|
867
|
+
}
|
|
868
|
+
}
|
|
869
|
+
]
|
|
870
|
+
}
|
|
871
|
+
]
|
|
872
|
+
};
|
|
873
|
+
const removeProofRoute = {
|
|
874
|
+
operationId: "auditableItemGraphRemoveProof",
|
|
875
|
+
summary: "Remove the notarization proof from all changesets of a graph vertex",
|
|
876
|
+
tag: tagsAuditableItemGraph[0].name,
|
|
877
|
+
method: "DELETE",
|
|
878
|
+
path: `${baseRouteName}/:id/proof`,
|
|
879
|
+
handler: async (httpRequestContext, request) => auditableItemGraphRemoveProof(httpRequestContext, componentName, request),
|
|
880
|
+
requestType: {
|
|
881
|
+
type: "IAuditableItemGraphRemoveProofRequest",
|
|
882
|
+
examples: [
|
|
883
|
+
{
|
|
884
|
+
id: "auditableItemGraphRemoveProofRequestExample",
|
|
885
|
+
request: {
|
|
886
|
+
pathParams: {
|
|
887
|
+
id: "0101010101010101010101010101010101010101010101010101010101010101"
|
|
888
|
+
}
|
|
889
|
+
}
|
|
890
|
+
}
|
|
891
|
+
]
|
|
892
|
+
},
|
|
893
|
+
responseType: [
|
|
894
|
+
{
|
|
895
|
+
type: "INoContentResponse",
|
|
896
|
+
examples: [
|
|
897
|
+
{
|
|
898
|
+
id: "auditableItemGraphRemoveProofResponseExample",
|
|
899
|
+
response: {
|
|
900
|
+
statusCode: HttpStatusCode.noContent
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
]
|
|
904
|
+
}
|
|
905
|
+
]
|
|
906
|
+
};
|
|
907
|
+
return [
|
|
908
|
+
createRoute,
|
|
909
|
+
getRoute,
|
|
910
|
+
getVersionRoute,
|
|
911
|
+
getVersionListRoute,
|
|
912
|
+
getChangesetRoute,
|
|
913
|
+
getChangesetListRoute,
|
|
914
|
+
updateRoute,
|
|
915
|
+
updatePartialRoute,
|
|
916
|
+
listRoute,
|
|
917
|
+
removeProofRoute
|
|
918
|
+
];
|
|
919
|
+
}
|
|
920
|
+
/**
|
|
921
|
+
* Create the graph vertex.
|
|
922
|
+
* @param httpRequestContext The request context for the API.
|
|
923
|
+
* @param componentName The name of the component to use in the routes.
|
|
924
|
+
* @param request The request.
|
|
925
|
+
* @param baseRouteName The base route name for the API.
|
|
926
|
+
* @returns The response object with additional http response properties.
|
|
927
|
+
*/
|
|
928
|
+
export async function auditableItemGraphCreate(httpRequestContext, componentName, request, baseRouteName) {
|
|
929
|
+
Guards.object(ROUTES_SOURCE, "request", request);
|
|
930
|
+
Guards.object(ROUTES_SOURCE, "request.body", request.body);
|
|
931
|
+
const component = ComponentFactory.get(componentName);
|
|
932
|
+
const id = await component.create(request.body);
|
|
933
|
+
const contextIds = await ContextIdStore.getContextIds();
|
|
934
|
+
const publicOrigin = contextIds?.[HttpContextIdKeys.PublicOrigin];
|
|
935
|
+
const headers = {};
|
|
936
|
+
HttpHeaderHelper.buildId(headers, id, HttpUrlHelper.combineOriginPath(publicOrigin, `${baseRouteName}/:id`));
|
|
937
|
+
return {
|
|
938
|
+
statusCode: HttpStatusCode.created,
|
|
939
|
+
headers
|
|
940
|
+
};
|
|
941
|
+
}
|
|
942
|
+
/**
|
|
943
|
+
* Get the graph vertex.
|
|
944
|
+
* @param httpRequestContext The request context for the API.
|
|
945
|
+
* @param componentName The name of the component to use in the routes.
|
|
946
|
+
* @param request The request.
|
|
947
|
+
* @returns The response object with additional http response properties.
|
|
948
|
+
*/
|
|
949
|
+
export async function auditableItemGraphGet(httpRequestContext, componentName, request) {
|
|
950
|
+
Guards.object(ROUTES_SOURCE, "request", request);
|
|
951
|
+
Guards.object(ROUTES_SOURCE, "request.pathParams", request.pathParams);
|
|
952
|
+
Guards.stringValue(ROUTES_SOURCE, "request.pathParams.id", request.pathParams.id);
|
|
953
|
+
const component = ComponentFactory.get(componentName);
|
|
954
|
+
const result = await component.get(request.pathParams.id, {
|
|
955
|
+
includeDeleted: Coerce.boolean(request.query?.includeDeleted),
|
|
956
|
+
verifySignatureDepth: request.query?.verifySignatureDepth
|
|
957
|
+
});
|
|
958
|
+
const headers = {};
|
|
959
|
+
HttpHeaderHelper.buildJsonContentType(headers, request.headers);
|
|
960
|
+
return {
|
|
961
|
+
headers,
|
|
962
|
+
body: result
|
|
963
|
+
};
|
|
964
|
+
}
|
|
965
|
+
/**
|
|
966
|
+
* Get the graph vertex changeset list.
|
|
967
|
+
* @param httpRequestContext The request context for the API.
|
|
968
|
+
* @param componentName The name of the component to use in the routes.
|
|
969
|
+
* @param request The request.
|
|
970
|
+
* @returns The response object with additional http response properties.
|
|
971
|
+
*/
|
|
972
|
+
export async function auditableItemGraphChangesetList(httpRequestContext, componentName, request) {
|
|
973
|
+
Guards.object(ROUTES_SOURCE, "request", request);
|
|
974
|
+
Guards.object(ROUTES_SOURCE, "request.pathParams", request.pathParams);
|
|
975
|
+
Guards.stringValue(ROUTES_SOURCE, "request.pathParams.id", request.pathParams.id);
|
|
976
|
+
const component = ComponentFactory.get(componentName);
|
|
977
|
+
const result = await component.getChangesets(request.pathParams.id, request.query?.cursor, Coerce.integer(request.query?.limit), {
|
|
978
|
+
verifySignatureDepth: request.query?.verifySignatureDepth
|
|
979
|
+
});
|
|
980
|
+
const headers = {};
|
|
981
|
+
HttpHeaderHelper.buildJsonContentType(headers, request.headers);
|
|
982
|
+
const contextIds = await ContextIdStore.getContextIds();
|
|
983
|
+
HttpHeaderHelper.buildCursor(headers, httpRequestContext.serverRequest.url, contextIds?.[HttpContextIdKeys.PublicOrigin], result.cursor);
|
|
984
|
+
return {
|
|
985
|
+
headers,
|
|
986
|
+
body: result.changesets
|
|
987
|
+
};
|
|
988
|
+
}
|
|
989
|
+
/**
|
|
990
|
+
* Get the graph vertex changeset.
|
|
991
|
+
* @param httpRequestContext The request context for the API.
|
|
992
|
+
* @param componentName The name of the component to use in the routes.
|
|
993
|
+
* @param request The request.
|
|
994
|
+
* @returns The response object with additional http response properties.
|
|
995
|
+
*/
|
|
996
|
+
export async function auditableItemGraphChangesetGet(httpRequestContext, componentName, request) {
|
|
997
|
+
Guards.object(ROUTES_SOURCE, "request", request);
|
|
998
|
+
Guards.object(ROUTES_SOURCE, "request.pathParams", request.pathParams);
|
|
999
|
+
Guards.stringValue(ROUTES_SOURCE, "request.pathParams.id", request.pathParams.id);
|
|
1000
|
+
const component = ComponentFactory.get(componentName);
|
|
1001
|
+
const changesetUrn = `${request.pathParams.id}:changeset:${request.pathParams.changesetId}`;
|
|
1002
|
+
const result = await component.getChangeset(changesetUrn, {
|
|
1003
|
+
verifySignatureDepth: request.query?.verifySignatureDepth
|
|
1004
|
+
});
|
|
1005
|
+
const headers = {};
|
|
1006
|
+
HttpHeaderHelper.buildJsonContentType(headers, request.headers);
|
|
1007
|
+
return {
|
|
1008
|
+
headers,
|
|
1009
|
+
body: result
|
|
1010
|
+
};
|
|
1011
|
+
}
|
|
1012
|
+
/**
|
|
1013
|
+
* Update the graph vertex (PUT - full replacement of vertex state).
|
|
1014
|
+
* @param httpRequestContext The request context for the API.
|
|
1015
|
+
* @param componentName The name of the component to use in the routes.
|
|
1016
|
+
* @param request The request.
|
|
1017
|
+
* @returns The response object with additional http response properties.
|
|
1018
|
+
*/
|
|
1019
|
+
export async function auditableItemGraphUpdate(httpRequestContext, componentName, request) {
|
|
1020
|
+
Guards.object(ROUTES_SOURCE, "request", request);
|
|
1021
|
+
Guards.object(ROUTES_SOURCE, "request.pathParams", request.pathParams);
|
|
1022
|
+
Guards.stringValue(ROUTES_SOURCE, "request.pathParams.id", request.pathParams.id);
|
|
1023
|
+
Guards.object(ROUTES_SOURCE, "request.body", request.body);
|
|
1024
|
+
const component = ComponentFactory.get(componentName);
|
|
1025
|
+
await component.update({ ...request.body, id: request.pathParams.id });
|
|
1026
|
+
return {
|
|
1027
|
+
statusCode: HttpStatusCode.noContent
|
|
1028
|
+
};
|
|
1029
|
+
}
|
|
1030
|
+
/**
|
|
1031
|
+
* Partially update the graph vertex (PATCH - optional scalars; list fields use `{ add, remove }`).
|
|
1032
|
+
* @param httpRequestContext The request context for the API.
|
|
1033
|
+
* @param componentName The name of the component to use in the routes.
|
|
1034
|
+
* @param request The request.
|
|
1035
|
+
* @returns The response object with additional http response properties.
|
|
1036
|
+
*/
|
|
1037
|
+
export async function auditableItemGraphUpdatePartial(httpRequestContext, componentName, request) {
|
|
1038
|
+
Guards.object(ROUTES_SOURCE, "request", request);
|
|
1039
|
+
Guards.object(ROUTES_SOURCE, "request.pathParams", request.pathParams);
|
|
1040
|
+
Guards.stringValue(ROUTES_SOURCE, "request.pathParams.id", request.pathParams.id);
|
|
1041
|
+
Guards.object(ROUTES_SOURCE, "request.body", request.body);
|
|
1042
|
+
const component = ComponentFactory.get(componentName);
|
|
1043
|
+
await component.updatePartial({ ...request.body, id: request.pathParams.id });
|
|
1044
|
+
return {
|
|
1045
|
+
statusCode: HttpStatusCode.noContent
|
|
1046
|
+
};
|
|
1047
|
+
}
|
|
1048
|
+
/**
|
|
1049
|
+
* Query the graph vertices.
|
|
1050
|
+
* @param httpRequestContext The request context for the API.
|
|
1051
|
+
* @param componentName The name of the component to use in the routes.
|
|
1052
|
+
* @param request The request.
|
|
1053
|
+
* @returns The response object with additional http response properties.
|
|
1054
|
+
*/
|
|
1055
|
+
export async function auditableItemGraphList(httpRequestContext, componentName, request) {
|
|
1056
|
+
Guards.object(ROUTES_SOURCE, "request", request);
|
|
1057
|
+
Guards.object(ROUTES_SOURCE, "request.query", request.query);
|
|
1058
|
+
const component = ComponentFactory.get(componentName);
|
|
1059
|
+
const result = await component.query({
|
|
1060
|
+
id: request.query?.id,
|
|
1061
|
+
idMode: request.query?.idMode,
|
|
1062
|
+
idExact: Coerce.boolean(request.query?.idExact),
|
|
1063
|
+
resourceTypes: HttpParameterHelper.arrayFromString(request.query?.resourceTypes)
|
|
1064
|
+
}, HttpParameterHelper.objectFromString(request.query?.conditions), request.query?.orderBy, request.query?.orderByDirection, HttpParameterHelper.arrayFromString(request.query?.properties), request.query?.cursor, Coerce.integer(request.query?.limit));
|
|
1065
|
+
const headers = {};
|
|
1066
|
+
HttpHeaderHelper.buildJsonContentType(headers, request.headers);
|
|
1067
|
+
const contextIds = await ContextIdStore.getContextIds();
|
|
1068
|
+
HttpHeaderHelper.buildCursor(headers, httpRequestContext.serverRequest.url, contextIds?.[HttpContextIdKeys.PublicOrigin], result.cursor);
|
|
1069
|
+
return {
|
|
1070
|
+
headers,
|
|
1071
|
+
body: result.entries
|
|
1072
|
+
};
|
|
1073
|
+
}
|
|
1074
|
+
/**
|
|
1075
|
+
* Get the graph vertex at a specific version.
|
|
1076
|
+
* @param httpRequestContext The request context for the API.
|
|
1077
|
+
* @param componentName The name of the component to use in the routes.
|
|
1078
|
+
* @param request The request.
|
|
1079
|
+
* @returns The response object with additional http response properties.
|
|
1080
|
+
*/
|
|
1081
|
+
export async function auditableItemGraphVersionGet(httpRequestContext, componentName, request) {
|
|
1082
|
+
Guards.object(ROUTES_SOURCE, "request", request);
|
|
1083
|
+
Guards.object(ROUTES_SOURCE, "request.pathParams", request.pathParams);
|
|
1084
|
+
Guards.stringValue(ROUTES_SOURCE, "request.pathParams.id", request.pathParams.id);
|
|
1085
|
+
const version = Coerce.integer(request.pathParams.version);
|
|
1086
|
+
Guards.integer(ROUTES_SOURCE, "request.pathParams.version", version);
|
|
1087
|
+
const component = ComponentFactory.get(componentName);
|
|
1088
|
+
const result = await component.getVersion(request.pathParams.id, version);
|
|
1089
|
+
const headers = {};
|
|
1090
|
+
HttpHeaderHelper.buildJsonContentType(headers, request.headers);
|
|
1091
|
+
return {
|
|
1092
|
+
headers,
|
|
1093
|
+
body: result
|
|
1094
|
+
};
|
|
1095
|
+
}
|
|
1096
|
+
/**
|
|
1097
|
+
* Remove the notarization proof from all changesets of a graph vertex.
|
|
1098
|
+
* @param httpRequestContext The request context for the API.
|
|
1099
|
+
* @param componentName The name of the component to use in the routes.
|
|
1100
|
+
* @param request The request.
|
|
1101
|
+
* @returns The response object with additional http response properties.
|
|
1102
|
+
*/
|
|
1103
|
+
export async function auditableItemGraphRemoveProof(httpRequestContext, componentName, request) {
|
|
1104
|
+
Guards.object(ROUTES_SOURCE, "request", request);
|
|
1105
|
+
Guards.object(ROUTES_SOURCE, "request.pathParams", request.pathParams);
|
|
1106
|
+
Guards.stringValue(ROUTES_SOURCE, "request.pathParams.id", request.pathParams.id);
|
|
1107
|
+
const component = ComponentFactory.get(componentName);
|
|
1108
|
+
await component.removeProof(request.pathParams.id);
|
|
1109
|
+
return {
|
|
1110
|
+
statusCode: HttpStatusCode.noContent
|
|
1111
|
+
};
|
|
1112
|
+
}
|
|
1113
|
+
/**
|
|
1114
|
+
* Get all versions of a graph vertex.
|
|
1115
|
+
* @param httpRequestContext The request context for the API.
|
|
1116
|
+
* @param componentName The name of the component to use in the routes.
|
|
1117
|
+
* @param request The request.
|
|
1118
|
+
* @returns The response object with additional http response properties.
|
|
1119
|
+
*/
|
|
1120
|
+
export async function auditableItemGraphVersionList(httpRequestContext, componentName, request) {
|
|
1121
|
+
Guards.object(ROUTES_SOURCE, "request", request);
|
|
1122
|
+
Guards.object(ROUTES_SOURCE, "request.pathParams", request.pathParams);
|
|
1123
|
+
Guards.stringValue(ROUTES_SOURCE, "request.pathParams.id", request.pathParams.id);
|
|
1124
|
+
const component = ComponentFactory.get(componentName);
|
|
1125
|
+
const result = await component.getVersions(request.pathParams.id, {
|
|
1126
|
+
after: request.query?.after,
|
|
1127
|
+
before: request.query?.before
|
|
1128
|
+
});
|
|
1129
|
+
const headers = {};
|
|
1130
|
+
HttpHeaderHelper.buildJsonContentType(headers, request.headers);
|
|
1131
|
+
return {
|
|
1132
|
+
headers,
|
|
1133
|
+
body: result
|
|
1134
|
+
};
|
|
1135
|
+
}
|
|
1136
|
+
//# sourceMappingURL=auditableItemGraphRoutes.js.map
|