@twin.org/auditable-item-stream-service 0.0.2-next.5 → 0.0.3-next.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/auditableItemStreamRoutes.js +1283 -0
- package/dist/es/auditableItemStreamRoutes.js.map +1 -0
- package/dist/es/auditableItemStreamService.js +979 -0
- package/dist/es/auditableItemStreamService.js.map +1 -0
- package/dist/es/entities/auditableItemStream.js +91 -0
- package/dist/es/entities/auditableItemStream.js.map +1 -0
- package/dist/es/entities/auditableItemStreamEntry.js +91 -0
- package/dist/es/entities/auditableItemStreamEntry.js.map +1 -0
- package/dist/es/index.js +11 -0
- package/dist/es/index.js.map +1 -0
- package/dist/es/models/IAuditableItemStreamServiceConfig.js +4 -0
- package/dist/es/models/IAuditableItemStreamServiceConfig.js.map +1 -0
- package/dist/es/models/IAuditableItemStreamServiceConstructorOptions.js +2 -0
- package/dist/es/models/IAuditableItemStreamServiceConstructorOptions.js.map +1 -0
- package/dist/es/models/IAuditableItemStreamServiceContext.js +2 -0
- package/dist/es/models/IAuditableItemStreamServiceContext.js.map +1 -0
- package/dist/es/restEntryPoints.js +10 -0
- package/dist/es/restEntryPoints.js.map +1 -0
- package/dist/es/schema.js +13 -0
- package/dist/es/schema.js.map +1 -0
- package/dist/types/auditableItemStreamRoutes.d.ts +17 -1
- package/dist/types/auditableItemStreamService.d.ts +29 -28
- package/dist/types/entities/auditableItemStream.d.ts +5 -5
- package/dist/types/entities/auditableItemStreamEntry.d.ts +1 -1
- package/dist/types/index.d.ts +8 -8
- package/dist/types/models/IAuditableItemStreamServiceConstructorOptions.d.ts +1 -1
- package/dist/types/models/IAuditableItemStreamServiceContext.d.ts +3 -6
- package/docs/changelog.md +161 -0
- package/docs/open-api/spec.json +491 -93
- package/docs/reference/classes/AuditableItemStream.md +8 -8
- package/docs/reference/classes/AuditableItemStreamEntry.md +2 -2
- package/docs/reference/classes/AuditableItemStreamService.md +35 -95
- package/docs/reference/functions/auditableItemStreamListEntriesNoStream.md +31 -0
- package/docs/reference/functions/auditableItemStreamListEntryObjectsNoStream.md +31 -0
- package/docs/reference/index.md +2 -0
- package/package.json +7 -8
- package/dist/cjs/index.cjs +0 -2249
- package/dist/esm/index.mjs +0 -2231
|
@@ -0,0 +1,1283 @@
|
|
|
1
|
+
// Copyright 2024 IOTA Stiftung.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
3
|
+
import { HttpParameterHelper } from "@twin.org/api-models";
|
|
4
|
+
import { AuditableItemStreamContexts, AuditableItemStreamTypes } from "@twin.org/auditable-item-stream-models";
|
|
5
|
+
import { Coerce, ComponentFactory, Guards, Is } from "@twin.org/core";
|
|
6
|
+
import { SchemaOrgContexts, SchemaOrgTypes } from "@twin.org/standards-schema-org";
|
|
7
|
+
import { HeaderHelper, HeaderTypes, HttpStatusCode, MimeTypes } from "@twin.org/web";
|
|
8
|
+
/**
|
|
9
|
+
* The source used when communicating about these routes.
|
|
10
|
+
*/
|
|
11
|
+
const ROUTES_SOURCE = "auditableItemStreamRoutes";
|
|
12
|
+
/**
|
|
13
|
+
* The tag to associate with the routes.
|
|
14
|
+
*/
|
|
15
|
+
export const tagsAuditableItemStream = [
|
|
16
|
+
{
|
|
17
|
+
name: "Auditable Item Stream",
|
|
18
|
+
description: "Endpoints which are modelled to access an auditable item stream contract."
|
|
19
|
+
}
|
|
20
|
+
];
|
|
21
|
+
/**
|
|
22
|
+
* The REST routes for auditable item stream.
|
|
23
|
+
* @param baseRouteName Prefix to prepend to the paths.
|
|
24
|
+
* @param componentName The name of the component to use in the routes stored in the ComponentFactory.
|
|
25
|
+
* @returns The generated routes.
|
|
26
|
+
*/
|
|
27
|
+
export function generateRestRoutesAuditableItemStream(baseRouteName, componentName) {
|
|
28
|
+
const createRoute = {
|
|
29
|
+
operationId: "auditableItemStreamCreate",
|
|
30
|
+
summary: "Create a new stream",
|
|
31
|
+
tag: tagsAuditableItemStream[0].name,
|
|
32
|
+
method: "POST",
|
|
33
|
+
path: `${baseRouteName}/`,
|
|
34
|
+
handler: async (httpRequestContext, request) => auditableItemStreamCreate(httpRequestContext, componentName, request),
|
|
35
|
+
requestType: {
|
|
36
|
+
type: "IAuditableItemStreamCreateRequest",
|
|
37
|
+
examples: [
|
|
38
|
+
{
|
|
39
|
+
id: "auditableItemStreamCreateRequestExample",
|
|
40
|
+
request: {
|
|
41
|
+
body: {
|
|
42
|
+
annotationObject: {
|
|
43
|
+
"@context": "https://schema.org",
|
|
44
|
+
"@type": "Note",
|
|
45
|
+
content: "This is a simple note"
|
|
46
|
+
},
|
|
47
|
+
entries: [
|
|
48
|
+
{
|
|
49
|
+
entryObject: {
|
|
50
|
+
"@context": "https://schema.org",
|
|
51
|
+
"@type": "Event",
|
|
52
|
+
startDate: "2011-04-09T20:00:00Z",
|
|
53
|
+
description: "A description of the event"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
]
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
]
|
|
61
|
+
},
|
|
62
|
+
responseType: [
|
|
63
|
+
{
|
|
64
|
+
type: "ICreatedResponse",
|
|
65
|
+
examples: [
|
|
66
|
+
{
|
|
67
|
+
id: "auditableItemStreamCreateResponseExample",
|
|
68
|
+
description: "The response when a new stream is created.",
|
|
69
|
+
response: {
|
|
70
|
+
statusCode: HttpStatusCode.created,
|
|
71
|
+
headers: {
|
|
72
|
+
[HeaderTypes.Location]: "ais%3A1234567890"
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
]
|
|
77
|
+
}
|
|
78
|
+
]
|
|
79
|
+
};
|
|
80
|
+
const getRoute = {
|
|
81
|
+
operationId: "auditableItemStreamGet",
|
|
82
|
+
summary: "Get a stream",
|
|
83
|
+
tag: tagsAuditableItemStream[0].name,
|
|
84
|
+
method: "GET",
|
|
85
|
+
path: `${baseRouteName}/:id`,
|
|
86
|
+
handler: async (httpRequestContext, request) => auditableItemStreamGet(httpRequestContext, componentName, request),
|
|
87
|
+
requestType: {
|
|
88
|
+
type: "IAuditableItemStreamGetRequest",
|
|
89
|
+
examples: [
|
|
90
|
+
{
|
|
91
|
+
id: "auditableItemStreamGetRequestExample",
|
|
92
|
+
request: {
|
|
93
|
+
headers: {
|
|
94
|
+
[HeaderTypes.Accept]: MimeTypes.Json
|
|
95
|
+
},
|
|
96
|
+
pathParams: {
|
|
97
|
+
id: "ais:1234567890"
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
]
|
|
102
|
+
},
|
|
103
|
+
responseType: [
|
|
104
|
+
{
|
|
105
|
+
type: "IAuditableItemStreamGetResponse",
|
|
106
|
+
examples: [
|
|
107
|
+
{
|
|
108
|
+
id: "auditableItemStreamGetResponseExample",
|
|
109
|
+
response: {
|
|
110
|
+
body: {
|
|
111
|
+
"@context": [
|
|
112
|
+
AuditableItemStreamContexts.Context,
|
|
113
|
+
AuditableItemStreamContexts.ContextCommon
|
|
114
|
+
],
|
|
115
|
+
type: AuditableItemStreamTypes.Stream,
|
|
116
|
+
id: "ais:1234567890",
|
|
117
|
+
dateCreated: "2024-08-22T11:55:16.271Z",
|
|
118
|
+
dateModified: "2024-08-22T11:55:16.271Z",
|
|
119
|
+
annotationObject: {
|
|
120
|
+
"@context": "https://schema.org",
|
|
121
|
+
"@type": "Note",
|
|
122
|
+
content: "This is a simple note"
|
|
123
|
+
},
|
|
124
|
+
organizationIdentity: "did:iota:1234567890",
|
|
125
|
+
proofId: "0101010101010101010101010101010101010101010101010101010101010101",
|
|
126
|
+
immutableInterval: 10,
|
|
127
|
+
numberOfItems: 1,
|
|
128
|
+
entries: [
|
|
129
|
+
{
|
|
130
|
+
"@context": [
|
|
131
|
+
AuditableItemStreamContexts.Context,
|
|
132
|
+
AuditableItemStreamContexts.ContextCommon
|
|
133
|
+
],
|
|
134
|
+
type: AuditableItemStreamTypes.StreamEntry,
|
|
135
|
+
id: "tst:1234567890",
|
|
136
|
+
dateCreated: "2024-08-22T11:55:16.271Z",
|
|
137
|
+
proofId: "0101010101010101010101010101010101010101010101010101010101010101",
|
|
138
|
+
index: 0,
|
|
139
|
+
entryObject: {
|
|
140
|
+
"@context": "https://schema.org",
|
|
141
|
+
"@type": "Event",
|
|
142
|
+
startDate: "2011-04-09T20:00:00Z",
|
|
143
|
+
description: "A description of the event"
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
]
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
]
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
type: "IAuditableItemStreamGetResponse",
|
|
154
|
+
mimeType: MimeTypes.JsonLd,
|
|
155
|
+
examples: [
|
|
156
|
+
{
|
|
157
|
+
id: "auditableItemStreamJsonLdGetResponseExample",
|
|
158
|
+
response: {
|
|
159
|
+
headers: {
|
|
160
|
+
[HeaderTypes.ContentType]: MimeTypes.JsonLd
|
|
161
|
+
},
|
|
162
|
+
body: {
|
|
163
|
+
"@context": [
|
|
164
|
+
AuditableItemStreamContexts.Context,
|
|
165
|
+
AuditableItemStreamContexts.ContextCommon
|
|
166
|
+
],
|
|
167
|
+
type: AuditableItemStreamTypes.Stream,
|
|
168
|
+
id: "ais:1234567890",
|
|
169
|
+
dateCreated: "2024-08-22T11:55:16.271Z",
|
|
170
|
+
dateModified: "2024-08-22T11:55:16.271Z",
|
|
171
|
+
annotationObject: {
|
|
172
|
+
"@context": "https://schema.org",
|
|
173
|
+
"@type": "Note",
|
|
174
|
+
content: "This is a simple note"
|
|
175
|
+
},
|
|
176
|
+
organizationIdentity: "did:iota:1234567890",
|
|
177
|
+
proofId: "0101010101010101010101010101010101010101010101010101010101010101",
|
|
178
|
+
immutableInterval: 10,
|
|
179
|
+
numberOfItems: 1,
|
|
180
|
+
entries: [
|
|
181
|
+
{
|
|
182
|
+
"@context": [
|
|
183
|
+
AuditableItemStreamContexts.Context,
|
|
184
|
+
AuditableItemStreamContexts.ContextCommon
|
|
185
|
+
],
|
|
186
|
+
type: AuditableItemStreamTypes.StreamEntry,
|
|
187
|
+
id: "tst:1234567890",
|
|
188
|
+
dateCreated: "2024-08-22T11:55:16.271Z",
|
|
189
|
+
proofId: "0101010101010101010101010101010101010101010101010101010101010101",
|
|
190
|
+
index: 0,
|
|
191
|
+
entryObject: {
|
|
192
|
+
"@context": "https://schema.org",
|
|
193
|
+
"@type": "Event",
|
|
194
|
+
startDate: "2011-04-09T20:00:00Z",
|
|
195
|
+
description: "A description of the event"
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
]
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
]
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
type: "INotFoundResponse"
|
|
206
|
+
}
|
|
207
|
+
]
|
|
208
|
+
};
|
|
209
|
+
const updateRoute = {
|
|
210
|
+
operationId: "auditableItemStreamUpdate",
|
|
211
|
+
summary: "Update a stream",
|
|
212
|
+
tag: tagsAuditableItemStream[0].name,
|
|
213
|
+
method: "PUT",
|
|
214
|
+
path: `${baseRouteName}/:id`,
|
|
215
|
+
handler: async (httpRequestContext, request) => auditableItemStreamUpdate(httpRequestContext, componentName, request),
|
|
216
|
+
requestType: {
|
|
217
|
+
type: "IAuditableItemStreamUpdateRequest",
|
|
218
|
+
examples: [
|
|
219
|
+
{
|
|
220
|
+
id: "auditableItemStreamUpdateRequestExample",
|
|
221
|
+
request: {
|
|
222
|
+
pathParams: {
|
|
223
|
+
id: "ais:1234567890"
|
|
224
|
+
},
|
|
225
|
+
body: {
|
|
226
|
+
annotationObject: {
|
|
227
|
+
"@context": "https://schema.org",
|
|
228
|
+
"@type": "Note",
|
|
229
|
+
content: "This is a simple note"
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
]
|
|
235
|
+
},
|
|
236
|
+
responseType: [
|
|
237
|
+
{
|
|
238
|
+
type: "INoContentResponse"
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
type: "INotFoundResponse"
|
|
242
|
+
}
|
|
243
|
+
]
|
|
244
|
+
};
|
|
245
|
+
const deleteRoute = {
|
|
246
|
+
operationId: "auditableItemStreamDelete",
|
|
247
|
+
summary: "Delete a stream",
|
|
248
|
+
tag: tagsAuditableItemStream[0].name,
|
|
249
|
+
method: "DELETE",
|
|
250
|
+
path: `${baseRouteName}/:id`,
|
|
251
|
+
handler: async (httpRequestContext, request) => auditableItemStreamDelete(httpRequestContext, componentName, request),
|
|
252
|
+
requestType: {
|
|
253
|
+
type: "IAuditableItemStreamDeleteRequest",
|
|
254
|
+
examples: [
|
|
255
|
+
{
|
|
256
|
+
id: "auditableItemStreamDeleteRequestExample",
|
|
257
|
+
request: {
|
|
258
|
+
pathParams: {
|
|
259
|
+
id: "ais:1234567890"
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
]
|
|
264
|
+
},
|
|
265
|
+
responseType: [
|
|
266
|
+
{
|
|
267
|
+
type: "INoContentResponse"
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
type: "INotFoundResponse"
|
|
271
|
+
}
|
|
272
|
+
]
|
|
273
|
+
};
|
|
274
|
+
const listRoute = {
|
|
275
|
+
operationId: "auditableItemStreamList",
|
|
276
|
+
summary: "Query streams",
|
|
277
|
+
tag: tagsAuditableItemStream[0].name,
|
|
278
|
+
method: "GET",
|
|
279
|
+
path: `${baseRouteName}/`,
|
|
280
|
+
handler: async (httpRequestContext, request) => auditableItemStreamList(httpRequestContext, componentName, request),
|
|
281
|
+
requestType: {
|
|
282
|
+
type: "IAuditableItemStreamListRequest",
|
|
283
|
+
examples: [
|
|
284
|
+
{
|
|
285
|
+
id: "IAuditableItemStreamListAllRequest",
|
|
286
|
+
request: {}
|
|
287
|
+
}
|
|
288
|
+
]
|
|
289
|
+
},
|
|
290
|
+
responseType: [
|
|
291
|
+
{
|
|
292
|
+
type: "IAuditableItemStreamListResponse",
|
|
293
|
+
examples: [
|
|
294
|
+
{
|
|
295
|
+
id: "auditableItemStreamListResponseExample",
|
|
296
|
+
response: {
|
|
297
|
+
body: {
|
|
298
|
+
"@context": [
|
|
299
|
+
SchemaOrgContexts.Context,
|
|
300
|
+
AuditableItemStreamContexts.Context,
|
|
301
|
+
AuditableItemStreamContexts.ContextCommon
|
|
302
|
+
],
|
|
303
|
+
type: [SchemaOrgTypes.ItemList, AuditableItemStreamTypes.StreamList],
|
|
304
|
+
[SchemaOrgTypes.ItemListElement]: [
|
|
305
|
+
{
|
|
306
|
+
"@context": [
|
|
307
|
+
AuditableItemStreamContexts.Context,
|
|
308
|
+
AuditableItemStreamContexts.ContextCommon
|
|
309
|
+
],
|
|
310
|
+
type: AuditableItemStreamTypes.Stream,
|
|
311
|
+
id: "ais:1234567890",
|
|
312
|
+
dateCreated: "2024-08-22T11:55:16.271Z",
|
|
313
|
+
dateModified: "2024-08-22T11:55:16.271Z",
|
|
314
|
+
annotationObject: {
|
|
315
|
+
"@context": "https://schema.org",
|
|
316
|
+
"@type": "Note",
|
|
317
|
+
content: "This is a simple note"
|
|
318
|
+
},
|
|
319
|
+
organizationIdentity: "did:iota:1234567890",
|
|
320
|
+
proofId: "0101010101010101010101010101010101010101010101010101010101010101",
|
|
321
|
+
immutableInterval: 10,
|
|
322
|
+
numberOfItems: 0
|
|
323
|
+
}
|
|
324
|
+
]
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
]
|
|
329
|
+
},
|
|
330
|
+
{
|
|
331
|
+
type: "IAuditableItemStreamListResponse",
|
|
332
|
+
mimeType: MimeTypes.JsonLd,
|
|
333
|
+
examples: [
|
|
334
|
+
{
|
|
335
|
+
id: "auditableItemStreamJsonLdListResponseExample",
|
|
336
|
+
response: {
|
|
337
|
+
headers: {
|
|
338
|
+
[HeaderTypes.ContentType]: MimeTypes.JsonLd
|
|
339
|
+
},
|
|
340
|
+
body: {
|
|
341
|
+
"@context": [
|
|
342
|
+
SchemaOrgContexts.Context,
|
|
343
|
+
AuditableItemStreamContexts.Context,
|
|
344
|
+
AuditableItemStreamContexts.ContextCommon
|
|
345
|
+
],
|
|
346
|
+
type: [SchemaOrgTypes.ItemList, AuditableItemStreamTypes.StreamList],
|
|
347
|
+
[SchemaOrgTypes.ItemListElement]: [
|
|
348
|
+
{
|
|
349
|
+
"@context": [
|
|
350
|
+
AuditableItemStreamContexts.Context,
|
|
351
|
+
AuditableItemStreamContexts.ContextCommon
|
|
352
|
+
],
|
|
353
|
+
type: AuditableItemStreamTypes.Stream,
|
|
354
|
+
id: "ais:1234567890",
|
|
355
|
+
dateCreated: "2024-08-22T11:55:16.271Z",
|
|
356
|
+
dateModified: "2024-08-22T11:55:16.271Z",
|
|
357
|
+
annotationObject: {
|
|
358
|
+
"@context": "https://schema.org",
|
|
359
|
+
"@type": "Note",
|
|
360
|
+
content: "This is a simple note"
|
|
361
|
+
},
|
|
362
|
+
organizationIdentity: "did:iota:1234567890",
|
|
363
|
+
proofId: "0101010101010101010101010101010101010101010101010101010101010101",
|
|
364
|
+
immutableInterval: 10,
|
|
365
|
+
numberOfItems: 0
|
|
366
|
+
}
|
|
367
|
+
]
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
]
|
|
372
|
+
},
|
|
373
|
+
{
|
|
374
|
+
type: "INotFoundResponse"
|
|
375
|
+
}
|
|
376
|
+
]
|
|
377
|
+
};
|
|
378
|
+
const createEntryRoute = {
|
|
379
|
+
operationId: "auditableItemStreamCreateEntry",
|
|
380
|
+
summary: "Create a new stream entry",
|
|
381
|
+
tag: tagsAuditableItemStream[0].name,
|
|
382
|
+
method: "POST",
|
|
383
|
+
path: `${baseRouteName}/:id/entries`,
|
|
384
|
+
handler: async (httpRequestContext, request) => auditableItemStreamCreateEntry(httpRequestContext, componentName, request),
|
|
385
|
+
requestType: {
|
|
386
|
+
type: "IAuditableItemStreamCreateEntryRequest",
|
|
387
|
+
examples: [
|
|
388
|
+
{
|
|
389
|
+
id: "auditableItemStreamCreateEntryRequestExample",
|
|
390
|
+
request: {
|
|
391
|
+
pathParams: {
|
|
392
|
+
id: "ais:1234567890"
|
|
393
|
+
},
|
|
394
|
+
body: {
|
|
395
|
+
entryObject: {
|
|
396
|
+
"@context": "https://schema.org",
|
|
397
|
+
"@type": "Event",
|
|
398
|
+
startDate: "2011-04-09T20:00:00Z",
|
|
399
|
+
description: "A description of the event"
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
]
|
|
405
|
+
},
|
|
406
|
+
responseType: [
|
|
407
|
+
{
|
|
408
|
+
type: "ICreatedResponse",
|
|
409
|
+
examples: [
|
|
410
|
+
{
|
|
411
|
+
id: "auditableItemStreamCreateEntryResponseExample",
|
|
412
|
+
description: "The response when a new stream entry is created.",
|
|
413
|
+
response: {
|
|
414
|
+
statusCode: HttpStatusCode.created,
|
|
415
|
+
headers: {
|
|
416
|
+
[HeaderTypes.Location]: "ais%3A1234567890%3A01010101010"
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
]
|
|
421
|
+
}
|
|
422
|
+
]
|
|
423
|
+
};
|
|
424
|
+
const deleteEntryRoute = {
|
|
425
|
+
operationId: "auditableItemStreamDeleteEntry",
|
|
426
|
+
summary: "Delete an entry from the stream",
|
|
427
|
+
tag: tagsAuditableItemStream[0].name,
|
|
428
|
+
method: "DELETE",
|
|
429
|
+
path: `${baseRouteName}/:id/entries/:entryId`,
|
|
430
|
+
handler: async (httpRequestContext, request) => auditableItemStreamDeleteEntry(httpRequestContext, componentName, request),
|
|
431
|
+
requestType: {
|
|
432
|
+
type: "IAuditableItemStreamDeleteRequest",
|
|
433
|
+
examples: [
|
|
434
|
+
{
|
|
435
|
+
id: "auditableItemStreamDeleteEntryRequestExample",
|
|
436
|
+
request: {
|
|
437
|
+
pathParams: {
|
|
438
|
+
id: "ais:1234567890",
|
|
439
|
+
entryId: "ais:1234567890:01010101010"
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
]
|
|
444
|
+
},
|
|
445
|
+
responseType: [
|
|
446
|
+
{
|
|
447
|
+
type: "INoContentResponse"
|
|
448
|
+
},
|
|
449
|
+
{
|
|
450
|
+
type: "INotFoundResponse"
|
|
451
|
+
}
|
|
452
|
+
]
|
|
453
|
+
};
|
|
454
|
+
const updateEntryRoute = {
|
|
455
|
+
operationId: "auditableItemStreamUpdateEntry",
|
|
456
|
+
summary: "Update a stream entry",
|
|
457
|
+
tag: tagsAuditableItemStream[0].name,
|
|
458
|
+
method: "PUT",
|
|
459
|
+
path: `${baseRouteName}/:id/entries/:entryId`,
|
|
460
|
+
handler: async (httpRequestContext, request) => auditableItemStreamUpdateEntry(httpRequestContext, componentName, request),
|
|
461
|
+
requestType: {
|
|
462
|
+
type: "IAuditableItemStreamUpdateEntryRequest",
|
|
463
|
+
examples: [
|
|
464
|
+
{
|
|
465
|
+
id: "auditableItemStreamUpdateRequestExample",
|
|
466
|
+
request: {
|
|
467
|
+
pathParams: {
|
|
468
|
+
id: "ais:1234567890",
|
|
469
|
+
entryId: "ais:1234567890:01010101010"
|
|
470
|
+
},
|
|
471
|
+
body: {
|
|
472
|
+
entryObject: {
|
|
473
|
+
"@context": "https://schema.org",
|
|
474
|
+
"@type": "Note",
|
|
475
|
+
content: "This is a simple note"
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
]
|
|
481
|
+
},
|
|
482
|
+
responseType: [
|
|
483
|
+
{
|
|
484
|
+
type: "INoContentResponse"
|
|
485
|
+
},
|
|
486
|
+
{
|
|
487
|
+
type: "INotFoundResponse"
|
|
488
|
+
}
|
|
489
|
+
]
|
|
490
|
+
};
|
|
491
|
+
const getEntryRoute = {
|
|
492
|
+
operationId: "auditableItemStreamGetEntry",
|
|
493
|
+
summary: "Get a stream entry",
|
|
494
|
+
tag: tagsAuditableItemStream[0].name,
|
|
495
|
+
method: "GET",
|
|
496
|
+
path: `${baseRouteName}/:id/entries/:entryId`,
|
|
497
|
+
handler: async (httpRequestContext, request) => auditableItemStreamGetEntry(httpRequestContext, componentName, request),
|
|
498
|
+
requestType: {
|
|
499
|
+
type: "IAuditableItemStreamGetEntryRequest",
|
|
500
|
+
examples: [
|
|
501
|
+
{
|
|
502
|
+
id: "auditableItemStreamGetEntryRequestExample",
|
|
503
|
+
request: {
|
|
504
|
+
pathParams: {
|
|
505
|
+
id: "ais:1234567890",
|
|
506
|
+
entryId: "ais:1234567890:01010101010"
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
]
|
|
511
|
+
},
|
|
512
|
+
responseType: [
|
|
513
|
+
{
|
|
514
|
+
type: "IAuditableItemStreamGetEntryResponse",
|
|
515
|
+
examples: [
|
|
516
|
+
{
|
|
517
|
+
id: "auditableItemStreamGetEntryResponseExample",
|
|
518
|
+
response: {
|
|
519
|
+
body: {
|
|
520
|
+
"@context": [
|
|
521
|
+
AuditableItemStreamContexts.Context,
|
|
522
|
+
AuditableItemStreamContexts.ContextCommon
|
|
523
|
+
],
|
|
524
|
+
type: AuditableItemStreamTypes.StreamEntry,
|
|
525
|
+
id: "tst:1234567890",
|
|
526
|
+
dateCreated: "2024-08-22T11:55:16.271Z",
|
|
527
|
+
proofId: "0101010101010101010101010101010101010101010101010101010101010101",
|
|
528
|
+
index: 0,
|
|
529
|
+
entryObject: {
|
|
530
|
+
"@context": "https://schema.org",
|
|
531
|
+
"@type": "Event",
|
|
532
|
+
startDate: "2011-04-09T20:00:00Z",
|
|
533
|
+
description: "A description of the event"
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
]
|
|
539
|
+
},
|
|
540
|
+
{
|
|
541
|
+
type: "IAuditableItemStreamGetEntryResponse",
|
|
542
|
+
mimeType: MimeTypes.JsonLd,
|
|
543
|
+
examples: [
|
|
544
|
+
{
|
|
545
|
+
id: "auditableItemStreamJsonLdGetEntryResponseExample",
|
|
546
|
+
response: {
|
|
547
|
+
headers: {
|
|
548
|
+
[HeaderTypes.ContentType]: MimeTypes.JsonLd
|
|
549
|
+
},
|
|
550
|
+
body: {
|
|
551
|
+
"@context": [
|
|
552
|
+
AuditableItemStreamContexts.Context,
|
|
553
|
+
AuditableItemStreamContexts.ContextCommon
|
|
554
|
+
],
|
|
555
|
+
type: AuditableItemStreamTypes.StreamEntry,
|
|
556
|
+
id: "tst:1234567890",
|
|
557
|
+
dateCreated: "2024-08-22T11:55:16.271Z",
|
|
558
|
+
proofId: "0101010101010101010101010101010101010101010101010101010101010101",
|
|
559
|
+
index: 0,
|
|
560
|
+
entryObject: {
|
|
561
|
+
"@context": "https://schema.org",
|
|
562
|
+
"@type": "Event",
|
|
563
|
+
startDate: "2011-04-09T20:00:00Z",
|
|
564
|
+
description: "A description of the event"
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
]
|
|
570
|
+
},
|
|
571
|
+
{
|
|
572
|
+
type: "INotFoundResponse"
|
|
573
|
+
}
|
|
574
|
+
]
|
|
575
|
+
};
|
|
576
|
+
const getEntryObjectRoute = {
|
|
577
|
+
operationId: "auditableItemStreamGetEntryObject",
|
|
578
|
+
summary: "Get a stream entry object",
|
|
579
|
+
tag: tagsAuditableItemStream[0].name,
|
|
580
|
+
method: "GET",
|
|
581
|
+
path: `${baseRouteName}/:id/entries/:entryId/object`,
|
|
582
|
+
handler: async (httpRequestContext, request) => auditableItemStreamGetEntryObject(httpRequestContext, componentName, request),
|
|
583
|
+
requestType: {
|
|
584
|
+
type: "IAuditableItemStreamGetEntryRequest",
|
|
585
|
+
examples: [
|
|
586
|
+
{
|
|
587
|
+
id: "auditableItemStreamGetEntryObjectRequestExample",
|
|
588
|
+
request: {
|
|
589
|
+
pathParams: {
|
|
590
|
+
id: "ais:1234567890",
|
|
591
|
+
entryId: "ais:1234567890:01010101010"
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
]
|
|
596
|
+
},
|
|
597
|
+
responseType: [
|
|
598
|
+
{
|
|
599
|
+
type: "IAuditableItemStreamGetEntryObjectResponse",
|
|
600
|
+
examples: [
|
|
601
|
+
{
|
|
602
|
+
id: "auditableItemStreamGetEntryObjectResponseExample",
|
|
603
|
+
response: {
|
|
604
|
+
body: {
|
|
605
|
+
"@context": "https://schema.org",
|
|
606
|
+
"@type": "Event",
|
|
607
|
+
startDate: "2011-04-09T20:00:00Z",
|
|
608
|
+
description: "A description of the event"
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
]
|
|
613
|
+
},
|
|
614
|
+
{
|
|
615
|
+
type: "INotFoundResponse"
|
|
616
|
+
}
|
|
617
|
+
]
|
|
618
|
+
};
|
|
619
|
+
const listEntriesRoute = {
|
|
620
|
+
operationId: "auditableItemStreamListEntries",
|
|
621
|
+
summary: "Get the entry objects in a stream",
|
|
622
|
+
tag: tagsAuditableItemStream[0].name,
|
|
623
|
+
method: "GET",
|
|
624
|
+
path: `${baseRouteName}/:id/entries`,
|
|
625
|
+
handler: async (httpRequestContext, request) => auditableItemStreamListEntries(httpRequestContext, componentName, request),
|
|
626
|
+
requestType: {
|
|
627
|
+
type: "IAuditableItemStreamListEntriesRequest",
|
|
628
|
+
examples: [
|
|
629
|
+
{
|
|
630
|
+
id: "auditableItemStreamListEntriesRequestExample",
|
|
631
|
+
request: {
|
|
632
|
+
pathParams: {
|
|
633
|
+
id: "ais:1234567890"
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
]
|
|
638
|
+
},
|
|
639
|
+
responseType: [
|
|
640
|
+
{
|
|
641
|
+
type: "IAuditableItemStreamListEntriesResponse",
|
|
642
|
+
examples: [
|
|
643
|
+
{
|
|
644
|
+
id: "auditableItemStreamListEntriesResponseExample",
|
|
645
|
+
response: {
|
|
646
|
+
body: {
|
|
647
|
+
"@context": [
|
|
648
|
+
SchemaOrgContexts.Context,
|
|
649
|
+
AuditableItemStreamContexts.Context,
|
|
650
|
+
AuditableItemStreamContexts.ContextCommon
|
|
651
|
+
],
|
|
652
|
+
type: [SchemaOrgTypes.ItemList, AuditableItemStreamTypes.StreamEntryList],
|
|
653
|
+
[SchemaOrgTypes.ItemListElement]: [
|
|
654
|
+
{
|
|
655
|
+
"@context": [
|
|
656
|
+
AuditableItemStreamContexts.Context,
|
|
657
|
+
AuditableItemStreamContexts.ContextCommon
|
|
658
|
+
],
|
|
659
|
+
type: AuditableItemStreamTypes.StreamEntry,
|
|
660
|
+
id: "tst:1234567890",
|
|
661
|
+
dateCreated: "2024-08-22T11:55:16.271Z",
|
|
662
|
+
proofId: "0101010101010101010101010101010101010101010101010101010101010101",
|
|
663
|
+
index: 0,
|
|
664
|
+
entryObject: {
|
|
665
|
+
"@context": "https://schema.org",
|
|
666
|
+
"@type": "Event",
|
|
667
|
+
startDate: "2011-04-09T20:00:00Z",
|
|
668
|
+
description: "A description of the event"
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
]
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
]
|
|
676
|
+
},
|
|
677
|
+
{
|
|
678
|
+
type: "IAuditableItemStreamListEntriesResponse",
|
|
679
|
+
mimeType: MimeTypes.JsonLd,
|
|
680
|
+
examples: [
|
|
681
|
+
{
|
|
682
|
+
id: "auditableItemStreamJsonLdListEntriesResponseExample",
|
|
683
|
+
response: {
|
|
684
|
+
headers: {
|
|
685
|
+
[HeaderTypes.ContentType]: MimeTypes.JsonLd
|
|
686
|
+
},
|
|
687
|
+
body: {
|
|
688
|
+
"@context": [
|
|
689
|
+
SchemaOrgContexts.Context,
|
|
690
|
+
AuditableItemStreamContexts.Context,
|
|
691
|
+
AuditableItemStreamContexts.ContextCommon
|
|
692
|
+
],
|
|
693
|
+
type: [SchemaOrgTypes.ItemList, AuditableItemStreamTypes.StreamEntryList],
|
|
694
|
+
[SchemaOrgTypes.ItemListElement]: [
|
|
695
|
+
{
|
|
696
|
+
"@context": [
|
|
697
|
+
AuditableItemStreamContexts.Context,
|
|
698
|
+
AuditableItemStreamContexts.ContextCommon
|
|
699
|
+
],
|
|
700
|
+
type: AuditableItemStreamTypes.StreamEntry,
|
|
701
|
+
id: "tst:1234567890",
|
|
702
|
+
dateCreated: "2024-08-22T11:55:16.271Z",
|
|
703
|
+
proofId: "0101010101010101010101010101010101010101010101010101010101010101",
|
|
704
|
+
index: 0,
|
|
705
|
+
entryObject: {
|
|
706
|
+
"@context": "https://schema.org",
|
|
707
|
+
"@type": "Event",
|
|
708
|
+
startDate: "2011-04-09T20:00:00Z",
|
|
709
|
+
description: "A description of the event"
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
]
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
]
|
|
717
|
+
},
|
|
718
|
+
{
|
|
719
|
+
type: "INotFoundResponse"
|
|
720
|
+
}
|
|
721
|
+
]
|
|
722
|
+
};
|
|
723
|
+
const listEntriesNoStreamRoute = {
|
|
724
|
+
operationId: "auditableItemStreamListEntriesNoStream",
|
|
725
|
+
summary: "Get the entry objects for all streams",
|
|
726
|
+
tag: tagsAuditableItemStream[0].name,
|
|
727
|
+
method: "GET",
|
|
728
|
+
path: `${baseRouteName}/entries`,
|
|
729
|
+
handler: async (httpRequestContext, request) => auditableItemStreamListEntriesNoStream(httpRequestContext, componentName, request),
|
|
730
|
+
requestType: {
|
|
731
|
+
type: "IAuditableItemStreamListEntriesNoStreamRequest",
|
|
732
|
+
examples: [
|
|
733
|
+
{
|
|
734
|
+
id: "auditableItemStreamListEntriesNoStreamRequestExample",
|
|
735
|
+
request: {}
|
|
736
|
+
}
|
|
737
|
+
]
|
|
738
|
+
},
|
|
739
|
+
responseType: [
|
|
740
|
+
{
|
|
741
|
+
type: "IAuditableItemStreamListEntriesResponse",
|
|
742
|
+
examples: [
|
|
743
|
+
{
|
|
744
|
+
id: "auditableItemStreamListEntriesNoStreamResponseExample",
|
|
745
|
+
response: {
|
|
746
|
+
body: {
|
|
747
|
+
"@context": [
|
|
748
|
+
SchemaOrgContexts.Context,
|
|
749
|
+
AuditableItemStreamContexts.Context,
|
|
750
|
+
AuditableItemStreamContexts.ContextCommon
|
|
751
|
+
],
|
|
752
|
+
type: [SchemaOrgTypes.ItemList, AuditableItemStreamTypes.StreamEntryList],
|
|
753
|
+
[SchemaOrgTypes.ItemListElement]: [
|
|
754
|
+
{
|
|
755
|
+
"@context": [
|
|
756
|
+
AuditableItemStreamContexts.Context,
|
|
757
|
+
AuditableItemStreamContexts.ContextCommon
|
|
758
|
+
],
|
|
759
|
+
type: AuditableItemStreamTypes.StreamEntry,
|
|
760
|
+
id: "tst:1234567890",
|
|
761
|
+
dateCreated: "2024-08-22T11:55:16.271Z",
|
|
762
|
+
proofId: "0101010101010101010101010101010101010101010101010101010101010101",
|
|
763
|
+
index: 0,
|
|
764
|
+
entryObject: {
|
|
765
|
+
"@context": "https://schema.org",
|
|
766
|
+
"@type": "Event",
|
|
767
|
+
startDate: "2011-04-09T20:00:00Z",
|
|
768
|
+
description: "A description of the event"
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
]
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
]
|
|
776
|
+
},
|
|
777
|
+
{
|
|
778
|
+
type: "IAuditableItemStreamListEntriesResponse",
|
|
779
|
+
mimeType: MimeTypes.JsonLd,
|
|
780
|
+
examples: [
|
|
781
|
+
{
|
|
782
|
+
id: "auditableItemStreamJsonLdListEntriesNoStreamResponseExample",
|
|
783
|
+
response: {
|
|
784
|
+
headers: {
|
|
785
|
+
[HeaderTypes.ContentType]: MimeTypes.JsonLd
|
|
786
|
+
},
|
|
787
|
+
body: {
|
|
788
|
+
"@context": [
|
|
789
|
+
SchemaOrgContexts.Context,
|
|
790
|
+
AuditableItemStreamContexts.Context,
|
|
791
|
+
AuditableItemStreamContexts.ContextCommon
|
|
792
|
+
],
|
|
793
|
+
type: [SchemaOrgTypes.ItemList, AuditableItemStreamTypes.StreamEntryList],
|
|
794
|
+
[SchemaOrgTypes.ItemListElement]: [
|
|
795
|
+
{
|
|
796
|
+
"@context": [
|
|
797
|
+
AuditableItemStreamContexts.Context,
|
|
798
|
+
AuditableItemStreamContexts.ContextCommon
|
|
799
|
+
],
|
|
800
|
+
type: AuditableItemStreamTypes.StreamEntry,
|
|
801
|
+
id: "tst:1234567890",
|
|
802
|
+
dateCreated: "2024-08-22T11:55:16.271Z",
|
|
803
|
+
proofId: "0101010101010101010101010101010101010101010101010101010101010101",
|
|
804
|
+
index: 0,
|
|
805
|
+
entryObject: {
|
|
806
|
+
"@context": "https://schema.org",
|
|
807
|
+
"@type": "Event",
|
|
808
|
+
startDate: "2011-04-09T20:00:00Z",
|
|
809
|
+
description: "A description of the event"
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
]
|
|
813
|
+
}
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
]
|
|
817
|
+
},
|
|
818
|
+
{
|
|
819
|
+
type: "INotFoundResponse"
|
|
820
|
+
}
|
|
821
|
+
]
|
|
822
|
+
};
|
|
823
|
+
const listEntryObjectsRoute = {
|
|
824
|
+
operationId: "auditableItemStreamListEntryObjects",
|
|
825
|
+
summary: "Get the entry objects in a stream",
|
|
826
|
+
tag: tagsAuditableItemStream[0].name,
|
|
827
|
+
method: "GET",
|
|
828
|
+
path: `${baseRouteName}/:id/entries/objects`,
|
|
829
|
+
handler: async (httpRequestContext, request) => auditableItemStreamListEntryObjects(httpRequestContext, componentName, request),
|
|
830
|
+
requestType: {
|
|
831
|
+
type: "IAuditableItemStreamListEntryObjectsRequest",
|
|
832
|
+
examples: [
|
|
833
|
+
{
|
|
834
|
+
id: "auditableItemStreamListEntryObjectsRequestExample",
|
|
835
|
+
request: {
|
|
836
|
+
pathParams: {
|
|
837
|
+
id: "ais:1234567890"
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
}
|
|
841
|
+
]
|
|
842
|
+
},
|
|
843
|
+
responseType: [
|
|
844
|
+
{
|
|
845
|
+
type: "IAuditableItemStreamListEntryObjectsResponse",
|
|
846
|
+
examples: [
|
|
847
|
+
{
|
|
848
|
+
id: "auditableItemStreamListEntryObjectsResponseExample",
|
|
849
|
+
response: {
|
|
850
|
+
body: {
|
|
851
|
+
"@context": [
|
|
852
|
+
SchemaOrgContexts.Context,
|
|
853
|
+
AuditableItemStreamContexts.Context,
|
|
854
|
+
AuditableItemStreamContexts.ContextCommon
|
|
855
|
+
],
|
|
856
|
+
type: [SchemaOrgTypes.ItemList, AuditableItemStreamTypes.StreamEntryObjectList],
|
|
857
|
+
[SchemaOrgTypes.ItemListElement]: [
|
|
858
|
+
{
|
|
859
|
+
"@context": "https://schema.org",
|
|
860
|
+
"@type": "Event",
|
|
861
|
+
startDate: "2011-04-09T20:00:00Z",
|
|
862
|
+
description: "A description of the event"
|
|
863
|
+
}
|
|
864
|
+
]
|
|
865
|
+
}
|
|
866
|
+
}
|
|
867
|
+
}
|
|
868
|
+
]
|
|
869
|
+
},
|
|
870
|
+
{
|
|
871
|
+
type: "INotFoundResponse"
|
|
872
|
+
}
|
|
873
|
+
]
|
|
874
|
+
};
|
|
875
|
+
const listEntryObjectsNoStreamRoute = {
|
|
876
|
+
operationId: "auditableItemStreamListEntryObjectsNoStream",
|
|
877
|
+
summary: "Get the entry objects for all streams",
|
|
878
|
+
tag: tagsAuditableItemStream[0].name,
|
|
879
|
+
method: "GET",
|
|
880
|
+
path: `${baseRouteName}/entries/objects`,
|
|
881
|
+
handler: async (httpRequestContext, request) => auditableItemStreamListEntryObjectsNoStream(httpRequestContext, componentName, request),
|
|
882
|
+
requestType: {
|
|
883
|
+
type: "IAuditableItemStreamListEntryObjectsNoStreamRequest",
|
|
884
|
+
examples: [
|
|
885
|
+
{
|
|
886
|
+
id: "auditableItemStreamListEntryObjectsNoStreamRequestExample",
|
|
887
|
+
request: {}
|
|
888
|
+
}
|
|
889
|
+
]
|
|
890
|
+
},
|
|
891
|
+
responseType: [
|
|
892
|
+
{
|
|
893
|
+
type: "IAuditableItemStreamListEntryObjectsResponse",
|
|
894
|
+
examples: [
|
|
895
|
+
{
|
|
896
|
+
id: "auditableItemStreamListEntryObjectsNoStreamResponseExample",
|
|
897
|
+
response: {
|
|
898
|
+
body: {
|
|
899
|
+
"@context": [
|
|
900
|
+
SchemaOrgContexts.Context,
|
|
901
|
+
AuditableItemStreamContexts.Context,
|
|
902
|
+
AuditableItemStreamContexts.ContextCommon
|
|
903
|
+
],
|
|
904
|
+
type: [SchemaOrgTypes.ItemList, AuditableItemStreamTypes.StreamEntryObjectList],
|
|
905
|
+
[SchemaOrgTypes.ItemListElement]: [
|
|
906
|
+
{
|
|
907
|
+
"@context": "https://schema.org",
|
|
908
|
+
"@type": "Event",
|
|
909
|
+
startDate: "2011-04-09T20:00:00Z",
|
|
910
|
+
description: "A description of the event"
|
|
911
|
+
}
|
|
912
|
+
]
|
|
913
|
+
}
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
]
|
|
917
|
+
},
|
|
918
|
+
{
|
|
919
|
+
type: "INotFoundResponse"
|
|
920
|
+
}
|
|
921
|
+
]
|
|
922
|
+
};
|
|
923
|
+
return [
|
|
924
|
+
createRoute,
|
|
925
|
+
getRoute,
|
|
926
|
+
updateRoute,
|
|
927
|
+
deleteRoute,
|
|
928
|
+
listRoute,
|
|
929
|
+
createEntryRoute,
|
|
930
|
+
getEntryRoute,
|
|
931
|
+
getEntryObjectRoute,
|
|
932
|
+
deleteEntryRoute,
|
|
933
|
+
updateEntryRoute,
|
|
934
|
+
listEntriesRoute,
|
|
935
|
+
listEntriesNoStreamRoute,
|
|
936
|
+
listEntryObjectsRoute,
|
|
937
|
+
listEntryObjectsNoStreamRoute
|
|
938
|
+
];
|
|
939
|
+
}
|
|
940
|
+
/**
|
|
941
|
+
* Create the stream.
|
|
942
|
+
* @param httpRequestContext The request context for the API.
|
|
943
|
+
* @param componentName The name of the component to use in the routes.
|
|
944
|
+
* @param request The request.
|
|
945
|
+
* @returns The response object with additional http response properties.
|
|
946
|
+
*/
|
|
947
|
+
export async function auditableItemStreamCreate(httpRequestContext, componentName, request) {
|
|
948
|
+
Guards.object(ROUTES_SOURCE, "request", request);
|
|
949
|
+
Guards.object(ROUTES_SOURCE, "request.body", request.body);
|
|
950
|
+
const component = ComponentFactory.get(componentName);
|
|
951
|
+
const id = await component.create({
|
|
952
|
+
annotationObject: request.body.annotationObject,
|
|
953
|
+
entries: request.body.entries
|
|
954
|
+
}, {
|
|
955
|
+
immutableInterval: request.body?.immutableInterval
|
|
956
|
+
});
|
|
957
|
+
return {
|
|
958
|
+
statusCode: HttpStatusCode.created,
|
|
959
|
+
headers: {
|
|
960
|
+
[HeaderTypes.Location]: id
|
|
961
|
+
}
|
|
962
|
+
};
|
|
963
|
+
}
|
|
964
|
+
/**
|
|
965
|
+
* Get the stream.
|
|
966
|
+
* @param httpRequestContext The request context for the API.
|
|
967
|
+
* @param componentName The name of the component to use in the routes.
|
|
968
|
+
* @param request The request.
|
|
969
|
+
* @returns The response object with additional http response properties.
|
|
970
|
+
*/
|
|
971
|
+
export async function auditableItemStreamGet(httpRequestContext, componentName, request) {
|
|
972
|
+
Guards.object(ROUTES_SOURCE, "request", request);
|
|
973
|
+
Guards.object(ROUTES_SOURCE, "request.pathParams", request.pathParams);
|
|
974
|
+
Guards.stringValue(ROUTES_SOURCE, "request.pathParams.id", request.pathParams.id);
|
|
975
|
+
const component = ComponentFactory.get(componentName);
|
|
976
|
+
const result = await component.get(request.pathParams.id, {
|
|
977
|
+
includeEntries: Coerce.boolean(request.query?.includeEntries),
|
|
978
|
+
includeDeleted: Coerce.boolean(request.query?.includeDeleted),
|
|
979
|
+
verifyStream: Coerce.boolean(request.query?.verifyStream),
|
|
980
|
+
verifyEntries: Coerce.boolean(request.query?.verifyEntries)
|
|
981
|
+
});
|
|
982
|
+
return {
|
|
983
|
+
headers: {
|
|
984
|
+
[HeaderTypes.ContentType]: request.headers?.[HeaderTypes.Accept] === MimeTypes.JsonLd
|
|
985
|
+
? MimeTypes.JsonLd
|
|
986
|
+
: MimeTypes.Json
|
|
987
|
+
},
|
|
988
|
+
body: result
|
|
989
|
+
};
|
|
990
|
+
}
|
|
991
|
+
/**
|
|
992
|
+
* Update the stream.
|
|
993
|
+
* @param httpRequestContext The request context for the API.
|
|
994
|
+
* @param componentName The name of the component to use in the routes.
|
|
995
|
+
* @param request The request.
|
|
996
|
+
* @returns The response object with additional http response properties.
|
|
997
|
+
*/
|
|
998
|
+
export async function auditableItemStreamUpdate(httpRequestContext, componentName, request) {
|
|
999
|
+
Guards.object(ROUTES_SOURCE, "request", request);
|
|
1000
|
+
Guards.object(ROUTES_SOURCE, "request.pathParams", request.pathParams);
|
|
1001
|
+
Guards.stringValue(ROUTES_SOURCE, "request.pathParams.id", request.pathParams.id);
|
|
1002
|
+
Guards.object(ROUTES_SOURCE, "request.body", request.body);
|
|
1003
|
+
const component = ComponentFactory.get(componentName);
|
|
1004
|
+
await component.update({
|
|
1005
|
+
id: request.pathParams.id,
|
|
1006
|
+
annotationObject: request.body.annotationObject
|
|
1007
|
+
});
|
|
1008
|
+
return {
|
|
1009
|
+
statusCode: HttpStatusCode.noContent
|
|
1010
|
+
};
|
|
1011
|
+
}
|
|
1012
|
+
/**
|
|
1013
|
+
* Delete the stream.
|
|
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 auditableItemStreamDelete(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
|
+
const component = ComponentFactory.get(componentName);
|
|
1024
|
+
await component.remove(request.pathParams.id);
|
|
1025
|
+
return {
|
|
1026
|
+
statusCode: HttpStatusCode.noContent
|
|
1027
|
+
};
|
|
1028
|
+
}
|
|
1029
|
+
/**
|
|
1030
|
+
* Query the stream.
|
|
1031
|
+
* @param httpRequestContext The request context for the API.
|
|
1032
|
+
* @param componentName The name of the component to use in the routes.
|
|
1033
|
+
* @param request The request.
|
|
1034
|
+
* @returns The response object with additional http response properties.
|
|
1035
|
+
*/
|
|
1036
|
+
export async function auditableItemStreamList(httpRequestContext, componentName, request) {
|
|
1037
|
+
Guards.object(ROUTES_SOURCE, "request", request);
|
|
1038
|
+
Guards.object(ROUTES_SOURCE, "request.query", request.query);
|
|
1039
|
+
const hostingComponent = ComponentFactory.get(httpRequestContext.hostingComponentType ?? "hosting");
|
|
1040
|
+
const component = ComponentFactory.get(componentName);
|
|
1041
|
+
const result = await component.query(HttpParameterHelper.objectFromString(request.query?.conditions), request.query?.orderBy, request.query?.orderByDirection, HttpParameterHelper.arrayFromString(request.query?.properties), request.query?.cursor, Coerce.integer(request.query?.limit));
|
|
1042
|
+
const headers = {
|
|
1043
|
+
[HeaderTypes.ContentType]: request.headers?.[HeaderTypes.Accept] === MimeTypes.JsonLd ? MimeTypes.JsonLd : MimeTypes.Json
|
|
1044
|
+
};
|
|
1045
|
+
if (Is.stringValue(result.cursor)) {
|
|
1046
|
+
headers[HeaderTypes.Link] = HeaderHelper.createLinkHeader(await hostingComponent.buildPublicUrl(httpRequestContext.serverRequest.url), { cursor: result.cursor }, "next");
|
|
1047
|
+
}
|
|
1048
|
+
return {
|
|
1049
|
+
headers,
|
|
1050
|
+
body: result.entries
|
|
1051
|
+
};
|
|
1052
|
+
}
|
|
1053
|
+
/**
|
|
1054
|
+
* Create the stream entry.
|
|
1055
|
+
* @param httpRequestContext The request context for the API.
|
|
1056
|
+
* @param componentName The name of the component to use in the routes.
|
|
1057
|
+
* @param request The request.
|
|
1058
|
+
* @returns The response object with additional http response properties.
|
|
1059
|
+
*/
|
|
1060
|
+
export async function auditableItemStreamCreateEntry(httpRequestContext, componentName, request) {
|
|
1061
|
+
Guards.object(ROUTES_SOURCE, "request", request);
|
|
1062
|
+
Guards.object(ROUTES_SOURCE, "request.pathParams", request.pathParams);
|
|
1063
|
+
Guards.object(ROUTES_SOURCE, "request.body", request.body);
|
|
1064
|
+
Guards.stringValue(ROUTES_SOURCE, "request.pathParams.id", request.pathParams.id);
|
|
1065
|
+
Guards.objectValue(ROUTES_SOURCE, "request.body.entryObject", request.body.entryObject);
|
|
1066
|
+
const component = ComponentFactory.get(componentName);
|
|
1067
|
+
const id = await component.createEntry(request.pathParams.id, request.body.entryObject);
|
|
1068
|
+
return {
|
|
1069
|
+
statusCode: HttpStatusCode.created,
|
|
1070
|
+
headers: {
|
|
1071
|
+
[HeaderTypes.Location]: id
|
|
1072
|
+
}
|
|
1073
|
+
};
|
|
1074
|
+
}
|
|
1075
|
+
/**
|
|
1076
|
+
* Get the stream.
|
|
1077
|
+
* @param httpRequestContext The request context for the API.
|
|
1078
|
+
* @param componentName The name of the component to use in the routes.
|
|
1079
|
+
* @param request The request.
|
|
1080
|
+
* @returns The response object with additional http response properties.
|
|
1081
|
+
*/
|
|
1082
|
+
export async function auditableItemStreamDeleteEntry(httpRequestContext, componentName, request) {
|
|
1083
|
+
Guards.object(ROUTES_SOURCE, "request", request);
|
|
1084
|
+
Guards.object(ROUTES_SOURCE, "request.pathParams", request.pathParams);
|
|
1085
|
+
Guards.stringValue(ROUTES_SOURCE, "request.pathParams.id", request.pathParams.id);
|
|
1086
|
+
Guards.stringValue(ROUTES_SOURCE, "request.pathParams.entryId", request.pathParams.entryId);
|
|
1087
|
+
const component = ComponentFactory.get(componentName);
|
|
1088
|
+
await component.removeEntry(request.pathParams.id, request.pathParams.entryId);
|
|
1089
|
+
return {
|
|
1090
|
+
statusCode: HttpStatusCode.noContent
|
|
1091
|
+
};
|
|
1092
|
+
}
|
|
1093
|
+
/**
|
|
1094
|
+
* Update the stream entry.
|
|
1095
|
+
* @param httpRequestContext The request context for the API.
|
|
1096
|
+
* @param componentName The name of the component to use in the routes.
|
|
1097
|
+
* @param request The request.
|
|
1098
|
+
* @returns The response object with additional http response properties.
|
|
1099
|
+
*/
|
|
1100
|
+
export async function auditableItemStreamUpdateEntry(httpRequestContext, componentName, request) {
|
|
1101
|
+
Guards.object(ROUTES_SOURCE, "request", request);
|
|
1102
|
+
Guards.object(ROUTES_SOURCE, "request.pathParams", request.pathParams);
|
|
1103
|
+
Guards.objectValue(ROUTES_SOURCE, "request.body", request.body);
|
|
1104
|
+
Guards.stringValue(ROUTES_SOURCE, "request.pathParams.id", request.pathParams.id);
|
|
1105
|
+
Guards.stringValue(ROUTES_SOURCE, "request.pathParams.entryId", request.pathParams.entryId);
|
|
1106
|
+
Guards.objectValue(ROUTES_SOURCE, "request.body.entryObject", request.body.entryObject);
|
|
1107
|
+
const component = ComponentFactory.get(componentName);
|
|
1108
|
+
await component.updateEntry(request.pathParams.id, request.pathParams.entryId, request.body.entryObject);
|
|
1109
|
+
return {
|
|
1110
|
+
statusCode: HttpStatusCode.noContent
|
|
1111
|
+
};
|
|
1112
|
+
}
|
|
1113
|
+
/**
|
|
1114
|
+
* Get a stream entry.
|
|
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 auditableItemStreamGetEntry(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
|
+
Guards.stringValue(ROUTES_SOURCE, "request.pathParams.entryId", request.pathParams.entryId);
|
|
1125
|
+
const component = ComponentFactory.get(componentName);
|
|
1126
|
+
const result = await component.getEntry(request.pathParams.id, request.pathParams.entryId, {
|
|
1127
|
+
verifyEntry: Coerce.boolean(request.query?.verifyEntry)
|
|
1128
|
+
});
|
|
1129
|
+
return {
|
|
1130
|
+
headers: {
|
|
1131
|
+
[HeaderTypes.ContentType]: request.headers?.[HeaderTypes.Accept] === MimeTypes.JsonLd
|
|
1132
|
+
? MimeTypes.JsonLd
|
|
1133
|
+
: MimeTypes.Json
|
|
1134
|
+
},
|
|
1135
|
+
body: result
|
|
1136
|
+
};
|
|
1137
|
+
}
|
|
1138
|
+
/**
|
|
1139
|
+
* Get a stream entry object.
|
|
1140
|
+
* @param httpRequestContext The request context for the API.
|
|
1141
|
+
* @param componentName The name of the component to use in the routes.
|
|
1142
|
+
* @param request The request.
|
|
1143
|
+
* @returns The response object with additional http response properties.
|
|
1144
|
+
*/
|
|
1145
|
+
export async function auditableItemStreamGetEntryObject(httpRequestContext, componentName, request) {
|
|
1146
|
+
Guards.object(ROUTES_SOURCE, "request", request);
|
|
1147
|
+
Guards.object(ROUTES_SOURCE, "request.pathParams", request.pathParams);
|
|
1148
|
+
Guards.stringValue(ROUTES_SOURCE, "request.pathParams.id", request.pathParams.id);
|
|
1149
|
+
Guards.stringValue(ROUTES_SOURCE, "request.pathParams.entryId", request.pathParams.entryId);
|
|
1150
|
+
const component = ComponentFactory.get(componentName);
|
|
1151
|
+
const result = await component.getEntryObject(request.pathParams.id, request.pathParams.entryId);
|
|
1152
|
+
return {
|
|
1153
|
+
headers: {
|
|
1154
|
+
[HeaderTypes.ContentType]: request.headers?.[HeaderTypes.Accept] === MimeTypes.JsonLd
|
|
1155
|
+
? MimeTypes.JsonLd
|
|
1156
|
+
: MimeTypes.Json
|
|
1157
|
+
},
|
|
1158
|
+
body: result
|
|
1159
|
+
};
|
|
1160
|
+
}
|
|
1161
|
+
/**
|
|
1162
|
+
* Query the stream.
|
|
1163
|
+
* @param httpRequestContext The request context for the API.
|
|
1164
|
+
* @param componentName The name of the component to use in the routes.
|
|
1165
|
+
* @param request The request.
|
|
1166
|
+
* @returns The response object with additional http response properties.
|
|
1167
|
+
*/
|
|
1168
|
+
export async function auditableItemStreamListEntries(httpRequestContext, componentName, request) {
|
|
1169
|
+
Guards.object(ROUTES_SOURCE, "request", request);
|
|
1170
|
+
Guards.object(ROUTES_SOURCE, "request.pathParams", request.pathParams);
|
|
1171
|
+
Guards.stringValue(ROUTES_SOURCE, "request.pathParams.id", request.pathParams.id);
|
|
1172
|
+
const hostingComponent = ComponentFactory.get(httpRequestContext.hostingComponentType ?? "hosting");
|
|
1173
|
+
const component = ComponentFactory.get(componentName);
|
|
1174
|
+
const result = await component.getEntries(request.pathParams.id, {
|
|
1175
|
+
conditions: HttpParameterHelper.objectFromString(request.query?.conditions),
|
|
1176
|
+
includeDeleted: Coerce.boolean(request.query?.includeDeleted),
|
|
1177
|
+
verifyEntries: Coerce.boolean(request.query?.verifyEntries),
|
|
1178
|
+
order: request.query?.order,
|
|
1179
|
+
limit: Coerce.integer(request.query?.limit),
|
|
1180
|
+
cursor: request.query?.cursor
|
|
1181
|
+
});
|
|
1182
|
+
const headers = {
|
|
1183
|
+
[HeaderTypes.ContentType]: request.headers?.[HeaderTypes.Accept] === MimeTypes.JsonLd ? MimeTypes.JsonLd : MimeTypes.Json
|
|
1184
|
+
};
|
|
1185
|
+
if (Is.stringValue(result.cursor)) {
|
|
1186
|
+
headers[HeaderTypes.Link] = HeaderHelper.createLinkHeader(await hostingComponent.buildPublicUrl(httpRequestContext.serverRequest.url), { cursor: result.cursor }, "next");
|
|
1187
|
+
}
|
|
1188
|
+
return {
|
|
1189
|
+
headers,
|
|
1190
|
+
body: result.entries
|
|
1191
|
+
};
|
|
1192
|
+
}
|
|
1193
|
+
/**
|
|
1194
|
+
* Query the stream.
|
|
1195
|
+
* @param httpRequestContext The request context for the API.
|
|
1196
|
+
* @param componentName The name of the component to use in the routes.
|
|
1197
|
+
* @param request The request.
|
|
1198
|
+
* @returns The response object with additional http response properties.
|
|
1199
|
+
*/
|
|
1200
|
+
export async function auditableItemStreamListEntriesNoStream(httpRequestContext, componentName, request) {
|
|
1201
|
+
Guards.object(ROUTES_SOURCE, "request", request);
|
|
1202
|
+
const hostingComponent = ComponentFactory.get(httpRequestContext.hostingComponentType ?? "hosting");
|
|
1203
|
+
const component = ComponentFactory.get(componentName);
|
|
1204
|
+
const result = await component.getEntries(undefined, {
|
|
1205
|
+
conditions: HttpParameterHelper.objectFromString(request.query?.conditions),
|
|
1206
|
+
includeDeleted: Coerce.boolean(request.query?.includeDeleted),
|
|
1207
|
+
verifyEntries: Coerce.boolean(request.query?.verifyEntries),
|
|
1208
|
+
order: request.query?.order,
|
|
1209
|
+
limit: Coerce.integer(request.query?.limit),
|
|
1210
|
+
cursor: request.query?.cursor
|
|
1211
|
+
});
|
|
1212
|
+
const headers = {
|
|
1213
|
+
[HeaderTypes.ContentType]: request.headers?.[HeaderTypes.Accept] === MimeTypes.JsonLd ? MimeTypes.JsonLd : MimeTypes.Json
|
|
1214
|
+
};
|
|
1215
|
+
if (Is.stringValue(result.cursor)) {
|
|
1216
|
+
headers[HeaderTypes.Link] = HeaderHelper.createLinkHeader(await hostingComponent.buildPublicUrl(httpRequestContext.serverRequest.url), { cursor: result.cursor }, "next");
|
|
1217
|
+
}
|
|
1218
|
+
return {
|
|
1219
|
+
headers,
|
|
1220
|
+
body: result.entries
|
|
1221
|
+
};
|
|
1222
|
+
}
|
|
1223
|
+
/**
|
|
1224
|
+
* Query the stream objects.
|
|
1225
|
+
* @param httpRequestContext The request context for the API.
|
|
1226
|
+
* @param componentName The name of the component to use in the routes.
|
|
1227
|
+
* @param request The request.
|
|
1228
|
+
* @returns The response object with additional http response properties.
|
|
1229
|
+
*/
|
|
1230
|
+
export async function auditableItemStreamListEntryObjects(httpRequestContext, componentName, request) {
|
|
1231
|
+
Guards.object(ROUTES_SOURCE, "request", request);
|
|
1232
|
+
Guards.object(ROUTES_SOURCE, "request.pathParams", request.pathParams);
|
|
1233
|
+
Guards.stringValue(ROUTES_SOURCE, "request.pathParams.id", request.pathParams.id);
|
|
1234
|
+
const hostingComponent = ComponentFactory.get(httpRequestContext.hostingComponentType ?? "hosting");
|
|
1235
|
+
const component = ComponentFactory.get(componentName);
|
|
1236
|
+
const result = await component.getEntryObjects(request.pathParams.id, {
|
|
1237
|
+
conditions: HttpParameterHelper.objectFromString(request.query?.conditions),
|
|
1238
|
+
includeDeleted: Coerce.boolean(request.query?.includeDeleted),
|
|
1239
|
+
order: request.query?.order,
|
|
1240
|
+
limit: Coerce.integer(request.query?.limit),
|
|
1241
|
+
cursor: request.query?.cursor
|
|
1242
|
+
});
|
|
1243
|
+
const headers = {
|
|
1244
|
+
[HeaderTypes.ContentType]: request.headers?.[HeaderTypes.Accept] === MimeTypes.JsonLd ? MimeTypes.JsonLd : MimeTypes.Json
|
|
1245
|
+
};
|
|
1246
|
+
if (Is.stringValue(result.cursor)) {
|
|
1247
|
+
headers[HeaderTypes.Link] = HeaderHelper.createLinkHeader(await hostingComponent.buildPublicUrl(httpRequestContext.serverRequest.url), { cursor: result.cursor }, "next");
|
|
1248
|
+
}
|
|
1249
|
+
return {
|
|
1250
|
+
headers,
|
|
1251
|
+
body: result.entries
|
|
1252
|
+
};
|
|
1253
|
+
}
|
|
1254
|
+
/**
|
|
1255
|
+
* Query the stream objects.
|
|
1256
|
+
* @param httpRequestContext The request context for the API.
|
|
1257
|
+
* @param componentName The name of the component to use in the routes.
|
|
1258
|
+
* @param request The request.
|
|
1259
|
+
* @returns The response object with additional http response properties.
|
|
1260
|
+
*/
|
|
1261
|
+
export async function auditableItemStreamListEntryObjectsNoStream(httpRequestContext, componentName, request) {
|
|
1262
|
+
Guards.object(ROUTES_SOURCE, "request", request);
|
|
1263
|
+
const hostingComponent = ComponentFactory.get(httpRequestContext.hostingComponentType ?? "hosting");
|
|
1264
|
+
const component = ComponentFactory.get(componentName);
|
|
1265
|
+
const result = await component.getEntryObjects(undefined, {
|
|
1266
|
+
conditions: HttpParameterHelper.objectFromString(request.query?.conditions),
|
|
1267
|
+
includeDeleted: Coerce.boolean(request.query?.includeDeleted),
|
|
1268
|
+
order: request.query?.order,
|
|
1269
|
+
limit: Coerce.integer(request.query?.limit),
|
|
1270
|
+
cursor: request.query?.cursor
|
|
1271
|
+
});
|
|
1272
|
+
const headers = {
|
|
1273
|
+
[HeaderTypes.ContentType]: request.headers?.[HeaderTypes.Accept] === MimeTypes.JsonLd ? MimeTypes.JsonLd : MimeTypes.Json
|
|
1274
|
+
};
|
|
1275
|
+
if (Is.stringValue(result.cursor)) {
|
|
1276
|
+
headers[HeaderTypes.Link] = HeaderHelper.createLinkHeader(await hostingComponent.buildPublicUrl(httpRequestContext.serverRequest.url), { cursor: result.cursor }, "next");
|
|
1277
|
+
}
|
|
1278
|
+
return {
|
|
1279
|
+
headers,
|
|
1280
|
+
body: result.entries
|
|
1281
|
+
};
|
|
1282
|
+
}
|
|
1283
|
+
//# sourceMappingURL=auditableItemStreamRoutes.js.map
|