@twin.org/logging-service 0.0.1-next.8 → 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.cjs +5 -11
- package/dist/esm/index.mjs +5 -11
- package/dist/types/loggingService.d.ts +0 -1
- package/docs/changelog.md +71 -1
- package/docs/open-api/spec.json +413 -402
- package/docs/reference/classes/LoggingService.md +5 -9
- package/docs/reference/functions/generateRestRoutesLogging.md +2 -2
- package/package.json +9 -9
package/dist/cjs/index.cjs
CHANGED
|
@@ -194,7 +194,6 @@ class LoggingService {
|
|
|
194
194
|
* @param pageSize The maximum number of entities in a page.
|
|
195
195
|
* @returns All the entities for the storage matching the conditions,
|
|
196
196
|
* and a cursor which can be used to request more entities.
|
|
197
|
-
* @throws NotImplementedError if the implementation does not support retrieval.
|
|
198
197
|
*/
|
|
199
198
|
async query(level, source, timeStart, timeEnd, cursor, pageSize) {
|
|
200
199
|
const condition = {
|
|
@@ -229,16 +228,11 @@ class LoggingService {
|
|
|
229
228
|
value: timeEnd
|
|
230
229
|
});
|
|
231
230
|
}
|
|
232
|
-
|
|
233
|
-
{
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
], undefined, cursor, pageSize);
|
|
238
|
-
return {
|
|
239
|
-
entities: result.entities,
|
|
240
|
-
cursor: result.cursor
|
|
241
|
-
};
|
|
231
|
+
if (core.Is.function(this._loggingConnector?.query)) {
|
|
232
|
+
const result = await this._loggingConnector.query(condition, [{ property: "ts", sortDirection: entity.SortDirection.Descending }], undefined, cursor, pageSize);
|
|
233
|
+
return { entities: result.entities, cursor: result.cursor };
|
|
234
|
+
}
|
|
235
|
+
return { entities: [] };
|
|
242
236
|
}
|
|
243
237
|
}
|
|
244
238
|
|
package/dist/esm/index.mjs
CHANGED
|
@@ -192,7 +192,6 @@ class LoggingService {
|
|
|
192
192
|
* @param pageSize The maximum number of entities in a page.
|
|
193
193
|
* @returns All the entities for the storage matching the conditions,
|
|
194
194
|
* and a cursor which can be used to request more entities.
|
|
195
|
-
* @throws NotImplementedError if the implementation does not support retrieval.
|
|
196
195
|
*/
|
|
197
196
|
async query(level, source, timeStart, timeEnd, cursor, pageSize) {
|
|
198
197
|
const condition = {
|
|
@@ -227,16 +226,11 @@ class LoggingService {
|
|
|
227
226
|
value: timeEnd
|
|
228
227
|
});
|
|
229
228
|
}
|
|
230
|
-
|
|
231
|
-
{
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
], undefined, cursor, pageSize);
|
|
236
|
-
return {
|
|
237
|
-
entities: result.entities,
|
|
238
|
-
cursor: result.cursor
|
|
239
|
-
};
|
|
229
|
+
if (Is.function(this._loggingConnector?.query)) {
|
|
230
|
+
const result = await this._loggingConnector.query(condition, [{ property: "ts", sortDirection: SortDirection.Descending }], undefined, cursor, pageSize);
|
|
231
|
+
return { entities: result.entities, cursor: result.cursor };
|
|
232
|
+
}
|
|
233
|
+
return { entities: [] };
|
|
240
234
|
}
|
|
241
235
|
}
|
|
242
236
|
|
|
@@ -33,7 +33,6 @@ export declare class LoggingService implements ILoggingComponent {
|
|
|
33
33
|
* @param pageSize The maximum number of entities in a page.
|
|
34
34
|
* @returns All the entities for the storage matching the conditions,
|
|
35
35
|
* and a cursor which can be used to request more entities.
|
|
36
|
-
* @throws NotImplementedError if the implementation does not support retrieval.
|
|
37
36
|
*/
|
|
38
37
|
query(level?: LogLevel, source?: string, timeStart?: number, timeEnd?: number, cursor?: string, pageSize?: number): Promise<{
|
|
39
38
|
/**
|
package/docs/changelog.md
CHANGED
|
@@ -1,5 +1,75 @@
|
|
|
1
1
|
# @twin.org/logging-service - Changelog
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## 0.0.1 (2025-07-03)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* release to production ([3458161](https://github.com/twinfoundation/logging/commit/3458161b4bb530f86e4d1fe06123d885cdcb114d))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Dependencies
|
|
12
|
+
|
|
13
|
+
* The following workspace dependencies were updated
|
|
14
|
+
* dependencies
|
|
15
|
+
* @twin.org/logging-models bumped from ^0.0.0 to ^0.0.1
|
|
16
|
+
|
|
17
|
+
## [0.0.1-next.16](https://github.com/twinfoundation/logging/compare/logging-service-v0.0.1-next.15...logging-service-v0.0.1-next.16) (2025-06-20)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* query params force coercion ([71c5329](https://github.com/twinfoundation/logging/commit/71c53292d300acae0369bd7937c5ca3ab5430689))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Dependencies
|
|
26
|
+
|
|
27
|
+
* The following workspace dependencies were updated
|
|
28
|
+
* dependencies
|
|
29
|
+
* @twin.org/logging-models bumped from 0.0.1-next.15 to 0.0.1-next.16
|
|
30
|
+
|
|
31
|
+
## [0.0.1-next.15](https://github.com/twinfoundation/logging/compare/logging-service-v0.0.1-next.14...logging-service-v0.0.1-next.15) (2025-06-12)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
### Features
|
|
35
|
+
|
|
36
|
+
* update dependencies ([976fc06](https://github.com/twinfoundation/logging/commit/976fc06976c4899769486b7cb2e827c407d7fc89))
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
### Dependencies
|
|
40
|
+
|
|
41
|
+
* The following workspace dependencies were updated
|
|
42
|
+
* dependencies
|
|
43
|
+
* @twin.org/logging-models bumped from 0.0.1-next.14 to 0.0.1-next.15
|
|
44
|
+
|
|
45
|
+
## [0.0.1-next.14](https://github.com/twinfoundation/logging/compare/logging-service-v0.0.1-next.13...logging-service-v0.0.1-next.14) (2025-04-17)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
### Features
|
|
49
|
+
|
|
50
|
+
* use shared store mechanism ([#20](https://github.com/twinfoundation/logging/issues/20)) ([bbacd31](https://github.com/twinfoundation/logging/commit/bbacd31af991d82d84294ad432a40830692880ca))
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
### Dependencies
|
|
54
|
+
|
|
55
|
+
* The following workspace dependencies were updated
|
|
56
|
+
* dependencies
|
|
57
|
+
* @twin.org/logging-models bumped from 0.0.1-next.13 to 0.0.1-next.14
|
|
58
|
+
|
|
59
|
+
## [0.0.1-next.13](https://github.com/twinfoundation/logging/compare/logging-service-v0.0.1-next.12...logging-service-v0.0.1-next.13) (2025-03-28)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
### Miscellaneous Chores
|
|
63
|
+
|
|
64
|
+
* **logging-service:** Synchronize repo versions
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
### Dependencies
|
|
68
|
+
|
|
69
|
+
* The following workspace dependencies were updated
|
|
70
|
+
* dependencies
|
|
71
|
+
* @twin.org/logging-models bumped from 0.0.1-next.12 to 0.0.1-next.13
|
|
72
|
+
|
|
73
|
+
## v0.0.1-next.12
|
|
4
74
|
|
|
5
75
|
- Initial Release
|
package/docs/open-api/spec.json
CHANGED
|
@@ -1,403 +1,414 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
2
|
+
"openapi": "3.1.0",
|
|
3
|
+
"info": {
|
|
4
|
+
"title": "TWIN - Test Endpoints",
|
|
5
|
+
"description": "REST API for TWIN - Test Endpoints.",
|
|
6
|
+
"version": "1.0.0",
|
|
7
|
+
"license": {
|
|
8
|
+
"name": "Apache 2.0 License",
|
|
9
|
+
"url": "https://opensource.org/licenses/Apache-2.0"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"servers": [
|
|
13
|
+
{
|
|
14
|
+
"url": "https://localhost"
|
|
15
|
+
}
|
|
16
|
+
],
|
|
17
|
+
"tags": [
|
|
18
|
+
{
|
|
19
|
+
"name": "Logging",
|
|
20
|
+
"description": "Endpoints which are modelled to access a logging contract."
|
|
21
|
+
}
|
|
22
|
+
],
|
|
23
|
+
"paths": {
|
|
24
|
+
"/logging": {
|
|
25
|
+
"post": {
|
|
26
|
+
"operationId": "loggingEntryCreate",
|
|
27
|
+
"summary": "Create a log entry",
|
|
28
|
+
"tags": [
|
|
29
|
+
"Logging"
|
|
30
|
+
],
|
|
31
|
+
"security": [
|
|
32
|
+
{
|
|
33
|
+
"jwtBearerAuthScheme": []
|
|
34
|
+
}
|
|
35
|
+
],
|
|
36
|
+
"requestBody": {
|
|
37
|
+
"description": "Create a new log entry.",
|
|
38
|
+
"required": true,
|
|
39
|
+
"content": {
|
|
40
|
+
"application/json": {
|
|
41
|
+
"schema": {
|
|
42
|
+
"$ref": "#/components/schemas/LogEntry"
|
|
43
|
+
},
|
|
44
|
+
"examples": {
|
|
45
|
+
"loggingEntryCreateInfoExample": {
|
|
46
|
+
"value": {
|
|
47
|
+
"level": "info",
|
|
48
|
+
"message": "This is an information message",
|
|
49
|
+
"source": "source",
|
|
50
|
+
"ts": 1715252922273
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
"loggingEntryCreateErrorExample": {
|
|
54
|
+
"value": {
|
|
55
|
+
"level": "info",
|
|
56
|
+
"message": "This is an error message",
|
|
57
|
+
"source": "source",
|
|
58
|
+
"ts": 1715252922273,
|
|
59
|
+
"error": {
|
|
60
|
+
"name": "GeneralError",
|
|
61
|
+
"message": "component.error",
|
|
62
|
+
"properties": {
|
|
63
|
+
"foo": "bar"
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
"responses": {
|
|
73
|
+
"204": {
|
|
74
|
+
"description": "The rest request ended in success with no data."
|
|
75
|
+
},
|
|
76
|
+
"400": {
|
|
77
|
+
"description": "The server cannot process the request, see the content for more details.",
|
|
78
|
+
"content": {
|
|
79
|
+
"application/json": {
|
|
80
|
+
"schema": {
|
|
81
|
+
"$ref": "#/components/schemas/Error"
|
|
82
|
+
},
|
|
83
|
+
"examples": {
|
|
84
|
+
"exampleResponse": {
|
|
85
|
+
"value": {
|
|
86
|
+
"name": "GeneralError",
|
|
87
|
+
"message": "component.error",
|
|
88
|
+
"properties": {
|
|
89
|
+
"foo": "bar"
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
"401": {
|
|
98
|
+
"description": "You are not authorized to use the API or no credentials were supplied, see the content for more details.",
|
|
99
|
+
"content": {
|
|
100
|
+
"application/json": {
|
|
101
|
+
"schema": {
|
|
102
|
+
"$ref": "#/components/schemas/Error"
|
|
103
|
+
},
|
|
104
|
+
"examples": {
|
|
105
|
+
"exampleResponse": {
|
|
106
|
+
"value": {
|
|
107
|
+
"name": "UnauthorizedError",
|
|
108
|
+
"message": "component.error"
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
"500": {
|
|
116
|
+
"description": "The server has encountered a situation it does not know how to handle, see the content for more details.",
|
|
117
|
+
"content": {
|
|
118
|
+
"application/json": {
|
|
119
|
+
"schema": {
|
|
120
|
+
"$ref": "#/components/schemas/Error"
|
|
121
|
+
},
|
|
122
|
+
"examples": {
|
|
123
|
+
"exampleResponse": {
|
|
124
|
+
"value": {
|
|
125
|
+
"name": "InternalServerError",
|
|
126
|
+
"message": "component.error"
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
"get": {
|
|
136
|
+
"operationId": "loggingListEntries",
|
|
137
|
+
"summary": "Get a list of the log entries",
|
|
138
|
+
"tags": [
|
|
139
|
+
"Logging"
|
|
140
|
+
],
|
|
141
|
+
"parameters": [
|
|
142
|
+
{
|
|
143
|
+
"name": "level",
|
|
144
|
+
"description": "The level of the log entries to retrieve.",
|
|
145
|
+
"in": "query",
|
|
146
|
+
"required": false,
|
|
147
|
+
"schema": {
|
|
148
|
+
"$ref": "#/components/schemas/LogLevel"
|
|
149
|
+
},
|
|
150
|
+
"example": "info"
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
"name": "source",
|
|
154
|
+
"description": "The source of the log entries to retrieve.",
|
|
155
|
+
"in": "query",
|
|
156
|
+
"required": false,
|
|
157
|
+
"schema": {
|
|
158
|
+
"type": "string"
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
"name": "timeStart",
|
|
163
|
+
"description": "The start time of the metrics to retrieve as a timestamp in ms.",
|
|
164
|
+
"in": "query",
|
|
165
|
+
"required": false,
|
|
166
|
+
"schema": {
|
|
167
|
+
"type": [
|
|
168
|
+
"number",
|
|
169
|
+
"string"
|
|
170
|
+
]
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
"name": "timeEnd",
|
|
175
|
+
"description": "The end time of the metrics to retrieve as a timestamp in ms.",
|
|
176
|
+
"in": "query",
|
|
177
|
+
"required": false,
|
|
178
|
+
"schema": {
|
|
179
|
+
"type": [
|
|
180
|
+
"number",
|
|
181
|
+
"string"
|
|
182
|
+
]
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
"name": "cursor",
|
|
187
|
+
"description": "The optional cursor to get next chunk.",
|
|
188
|
+
"in": "query",
|
|
189
|
+
"required": false,
|
|
190
|
+
"schema": {
|
|
191
|
+
"type": "string"
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
"name": "pageSize",
|
|
196
|
+
"description": "The maximum number of entities in a page.",
|
|
197
|
+
"in": "query",
|
|
198
|
+
"required": false,
|
|
199
|
+
"schema": {
|
|
200
|
+
"type": [
|
|
201
|
+
"number",
|
|
202
|
+
"string"
|
|
203
|
+
]
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
],
|
|
207
|
+
"security": [
|
|
208
|
+
{
|
|
209
|
+
"jwtBearerAuthScheme": []
|
|
210
|
+
}
|
|
211
|
+
],
|
|
212
|
+
"responses": {
|
|
213
|
+
"200": {
|
|
214
|
+
"description": "Response for log entry list request.",
|
|
215
|
+
"content": {
|
|
216
|
+
"application/json": {
|
|
217
|
+
"schema": {
|
|
218
|
+
"$ref": "#/components/schemas/LoggingListResponse"
|
|
219
|
+
},
|
|
220
|
+
"examples": {
|
|
221
|
+
"listResponseExample": {
|
|
222
|
+
"value": {
|
|
223
|
+
"entities": [
|
|
224
|
+
{
|
|
225
|
+
"level": "info",
|
|
226
|
+
"message": "This is an information message",
|
|
227
|
+
"source": "source",
|
|
228
|
+
"ts": 1715252922273
|
|
229
|
+
}
|
|
230
|
+
],
|
|
231
|
+
"cursor": "1"
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
},
|
|
238
|
+
"400": {
|
|
239
|
+
"description": "The server cannot process the request, see the content for more details.",
|
|
240
|
+
"content": {
|
|
241
|
+
"application/json": {
|
|
242
|
+
"schema": {
|
|
243
|
+
"$ref": "#/components/schemas/Error"
|
|
244
|
+
},
|
|
245
|
+
"examples": {
|
|
246
|
+
"exampleResponse": {
|
|
247
|
+
"value": {
|
|
248
|
+
"name": "GeneralError",
|
|
249
|
+
"message": "component.error",
|
|
250
|
+
"properties": {
|
|
251
|
+
"foo": "bar"
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
},
|
|
259
|
+
"401": {
|
|
260
|
+
"description": "You are not authorized to use the API or no credentials were supplied, see the content for more details.",
|
|
261
|
+
"content": {
|
|
262
|
+
"application/json": {
|
|
263
|
+
"schema": {
|
|
264
|
+
"$ref": "#/components/schemas/Error"
|
|
265
|
+
},
|
|
266
|
+
"examples": {
|
|
267
|
+
"exampleResponse": {
|
|
268
|
+
"value": {
|
|
269
|
+
"name": "UnauthorizedError",
|
|
270
|
+
"message": "component.error"
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
},
|
|
277
|
+
"500": {
|
|
278
|
+
"description": "The server has encountered a situation it does not know how to handle, see the content for more details.",
|
|
279
|
+
"content": {
|
|
280
|
+
"application/json": {
|
|
281
|
+
"schema": {
|
|
282
|
+
"$ref": "#/components/schemas/Error"
|
|
283
|
+
},
|
|
284
|
+
"examples": {
|
|
285
|
+
"exampleResponse": {
|
|
286
|
+
"value": {
|
|
287
|
+
"name": "InternalServerError",
|
|
288
|
+
"message": "component.error"
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
},
|
|
299
|
+
"components": {
|
|
300
|
+
"schemas": {
|
|
301
|
+
"Error": {
|
|
302
|
+
"type": "object",
|
|
303
|
+
"properties": {
|
|
304
|
+
"name": {
|
|
305
|
+
"type": "string",
|
|
306
|
+
"description": "The name for the error."
|
|
307
|
+
},
|
|
308
|
+
"message": {
|
|
309
|
+
"type": "string",
|
|
310
|
+
"description": "The message for the error."
|
|
311
|
+
},
|
|
312
|
+
"source": {
|
|
313
|
+
"type": "string",
|
|
314
|
+
"description": "The source of the error."
|
|
315
|
+
},
|
|
316
|
+
"properties": {
|
|
317
|
+
"type": "object",
|
|
318
|
+
"additionalProperties": {},
|
|
319
|
+
"description": "Any additional information for the error."
|
|
320
|
+
},
|
|
321
|
+
"stack": {
|
|
322
|
+
"type": "string",
|
|
323
|
+
"description": "The stack trace for the error."
|
|
324
|
+
},
|
|
325
|
+
"inner": {
|
|
326
|
+
"$ref": "#/components/schemas/Error"
|
|
327
|
+
}
|
|
328
|
+
},
|
|
329
|
+
"required": [
|
|
330
|
+
"name",
|
|
331
|
+
"message"
|
|
332
|
+
],
|
|
333
|
+
"additionalProperties": false,
|
|
334
|
+
"description": "Model to describe serialized error."
|
|
335
|
+
},
|
|
336
|
+
"LogEntry": {
|
|
337
|
+
"type": "object",
|
|
338
|
+
"properties": {
|
|
339
|
+
"level": {
|
|
340
|
+
"$ref": "#/components/schemas/LogLevel"
|
|
341
|
+
},
|
|
342
|
+
"source": {
|
|
343
|
+
"type": "string",
|
|
344
|
+
"description": "The source of the log entry."
|
|
345
|
+
},
|
|
346
|
+
"ts": {
|
|
347
|
+
"type": "number",
|
|
348
|
+
"description": "The timestamp of the log entry, if left blank will be populated by the connector."
|
|
349
|
+
},
|
|
350
|
+
"message": {
|
|
351
|
+
"type": "string",
|
|
352
|
+
"description": "The message."
|
|
353
|
+
},
|
|
354
|
+
"error": {
|
|
355
|
+
"$ref": "#/components/schemas/Error"
|
|
356
|
+
},
|
|
357
|
+
"data": {
|
|
358
|
+
"type": "object",
|
|
359
|
+
"additionalProperties": {},
|
|
360
|
+
"description": "Optional data for the message."
|
|
361
|
+
}
|
|
362
|
+
},
|
|
363
|
+
"required": [
|
|
364
|
+
"level",
|
|
365
|
+
"source",
|
|
366
|
+
"message"
|
|
367
|
+
],
|
|
368
|
+
"additionalProperties": false,
|
|
369
|
+
"description": "Interface describing a log entry."
|
|
370
|
+
},
|
|
371
|
+
"LogLevel": {
|
|
372
|
+
"type": "string",
|
|
373
|
+
"enum": [
|
|
374
|
+
"info",
|
|
375
|
+
"error",
|
|
376
|
+
"warn",
|
|
377
|
+
"trace",
|
|
378
|
+
"debug"
|
|
379
|
+
],
|
|
380
|
+
"description": "Log level."
|
|
381
|
+
},
|
|
382
|
+
"LoggingListResponse": {
|
|
383
|
+
"type": "object",
|
|
384
|
+
"properties": {
|
|
385
|
+
"entities": {
|
|
386
|
+
"type": "array",
|
|
387
|
+
"description": "The entities, which can be partial if a limited keys list was provided.",
|
|
388
|
+
"prefixItems": [
|
|
389
|
+
{
|
|
390
|
+
"$ref": "#/components/schemas/LogEntry"
|
|
391
|
+
}
|
|
392
|
+
]
|
|
393
|
+
},
|
|
394
|
+
"cursor": {
|
|
395
|
+
"type": "string",
|
|
396
|
+
"description": "An optional cursor, when defined can be used to call find to get more entities."
|
|
397
|
+
}
|
|
398
|
+
},
|
|
399
|
+
"required": [
|
|
400
|
+
"entities"
|
|
401
|
+
],
|
|
402
|
+
"additionalProperties": false,
|
|
403
|
+
"description": "The response payload."
|
|
404
|
+
}
|
|
405
|
+
},
|
|
406
|
+
"securitySchemes": {
|
|
407
|
+
"jwtBearerAuthScheme": {
|
|
408
|
+
"type": "http",
|
|
409
|
+
"scheme": "bearer",
|
|
410
|
+
"bearerFormat": "JWT"
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
}
|
|
@@ -8,9 +8,9 @@ Service for performing logging operations to a connector.
|
|
|
8
8
|
|
|
9
9
|
## Constructors
|
|
10
10
|
|
|
11
|
-
###
|
|
11
|
+
### Constructor
|
|
12
12
|
|
|
13
|
-
> **new LoggingService**(`options
|
|
13
|
+
> **new LoggingService**(`options?`): `LoggingService`
|
|
14
14
|
|
|
15
15
|
Create a new instance of LoggingService.
|
|
16
16
|
|
|
@@ -24,7 +24,7 @@ The options for the connector.
|
|
|
24
24
|
|
|
25
25
|
#### Returns
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
`LoggingService`
|
|
28
28
|
|
|
29
29
|
## Properties
|
|
30
30
|
|
|
@@ -76,7 +76,7 @@ Nothing.
|
|
|
76
76
|
|
|
77
77
|
### query()
|
|
78
78
|
|
|
79
|
-
> **query**(`level
|
|
79
|
+
> **query**(`level?`, `source?`, `timeStart?`, `timeEnd?`, `cursor?`, `pageSize?`): `Promise`\<\{ `entities`: `ILogEntry`[]; `cursor?`: `string`; \}\>
|
|
80
80
|
|
|
81
81
|
Query the log entries.
|
|
82
82
|
|
|
@@ -120,15 +120,11 @@ The maximum number of entities in a page.
|
|
|
120
120
|
|
|
121
121
|
#### Returns
|
|
122
122
|
|
|
123
|
-
`Promise`\<\{ `entities`: `ILogEntry`[]; `cursor
|
|
123
|
+
`Promise`\<\{ `entities`: `ILogEntry`[]; `cursor?`: `string`; \}\>
|
|
124
124
|
|
|
125
125
|
All the entities for the storage matching the conditions,
|
|
126
126
|
and a cursor which can be used to request more entities.
|
|
127
127
|
|
|
128
|
-
#### Throws
|
|
129
|
-
|
|
130
|
-
NotImplementedError if the implementation does not support retrieval.
|
|
131
|
-
|
|
132
128
|
#### Implementation of
|
|
133
129
|
|
|
134
130
|
`ILoggingComponent.query`
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Function: generateRestRoutesLogging()
|
|
2
2
|
|
|
3
|
-
> **generateRestRoutesLogging**(`baseRouteName`, `componentName`): `IRestRoute`[]
|
|
3
|
+
> **generateRestRoutesLogging**(`baseRouteName`, `componentName`): `IRestRoute`\<`any`, `any`\>[]
|
|
4
4
|
|
|
5
5
|
The REST routes for logging.
|
|
6
6
|
|
|
@@ -20,6 +20,6 @@ The name of the component to use in the routes stored in the ComponentFactory.
|
|
|
20
20
|
|
|
21
21
|
## Returns
|
|
22
22
|
|
|
23
|
-
`IRestRoute`[]
|
|
23
|
+
`IRestRoute`\<`any`, `any`\>[]
|
|
24
24
|
|
|
25
25
|
The generated routes.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/logging-service",
|
|
3
|
-
"version": "0.0.1
|
|
3
|
+
"version": "0.0.1",
|
|
4
4
|
"description": "Logging contract implementation and REST endpoint definitions",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -14,21 +14,21 @@
|
|
|
14
14
|
"node": ">=20.0.0"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@twin.org/api-models": "
|
|
18
|
-
"@twin.org/core": "
|
|
19
|
-
"@twin.org/entity": "
|
|
20
|
-
"@twin.org/logging-models": "0.0.1
|
|
21
|
-
"@twin.org/nameof": "
|
|
22
|
-
"@twin.org/web": "
|
|
17
|
+
"@twin.org/api-models": "^0.0.1",
|
|
18
|
+
"@twin.org/core": "^0.0.1",
|
|
19
|
+
"@twin.org/entity": "^0.0.1",
|
|
20
|
+
"@twin.org/logging-models": "^0.0.1",
|
|
21
|
+
"@twin.org/nameof": "^0.0.1",
|
|
22
|
+
"@twin.org/web": "^0.0.1"
|
|
23
23
|
},
|
|
24
24
|
"main": "./dist/cjs/index.cjs",
|
|
25
25
|
"module": "./dist/esm/index.mjs",
|
|
26
26
|
"types": "./dist/types/index.d.ts",
|
|
27
27
|
"exports": {
|
|
28
28
|
".": {
|
|
29
|
+
"types": "./dist/types/index.d.ts",
|
|
29
30
|
"require": "./dist/cjs/index.cjs",
|
|
30
|
-
"import": "./dist/esm/index.mjs"
|
|
31
|
-
"types": "./dist/types/index.d.ts"
|
|
31
|
+
"import": "./dist/esm/index.mjs"
|
|
32
32
|
},
|
|
33
33
|
"./locales/*.json": "./locales/*.json"
|
|
34
34
|
},
|