@twin.org/logging-models 0.0.1-next.9 → 0.0.2-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.
@@ -65,23 +65,19 @@ class MultiLoggingConnector {
65
65
  * @param pageSize The maximum number of entities in a page.
66
66
  * @returns All the entities for the storage matching the conditions,
67
67
  * and a cursor which can be used to request more entities.
68
- * @throws NotImplementedError if the implementation does not support retrieval.
69
68
  */
70
69
  async query(conditions, sortProperties, properties, cursor, pageSize) {
71
70
  // See if we can find a connector that supports querying.
72
71
  // If it throws anything other than not implemented, we should throw it.
73
72
  for (const loggingConnector of this._loggingConnectors) {
74
- try {
75
- const result = await loggingConnector.query(conditions, sortProperties, properties, cursor, pageSize);
76
- return result;
77
- }
78
- catch (error) {
79
- if (!core.BaseError.isErrorName(error, core.NotImplementedError.CLASS_NAME)) {
80
- throw error;
81
- }
73
+ // eslint-disable-next-line @typescript-eslint/unbound-method
74
+ if (core.Is.function(loggingConnector.query)) {
75
+ return loggingConnector.query(conditions, sortProperties, properties, cursor, pageSize);
82
76
  }
83
77
  }
84
- throw new core.NotImplementedError(this.CLASS_NAME, "query");
78
+ return {
79
+ entities: []
80
+ };
85
81
  }
86
82
  }
87
83
 
@@ -112,7 +108,6 @@ class SilentLoggingConnector {
112
108
  * @param pageSize The maximum number of entities in a page.
113
109
  * @returns All the entities for the storage matching the conditions,
114
110
  * and a cursor which can be used to request more entities.
115
- * @throws NotImplementedError if the implementation does not support retrieval.
116
111
  */
117
112
  async query(conditions, sortProperties, properties, cursor, pageSize) {
118
113
  return {
@@ -1,4 +1,4 @@
1
- import { Factory, Guards, BaseError, NotImplementedError, Is, StringHelper, I18n } from '@twin.org/core';
1
+ import { Factory, Guards, Is, StringHelper, I18n } from '@twin.org/core';
2
2
 
3
3
  // Copyright 2024 IOTA Stiftung.
4
4
  // SPDX-License-Identifier: Apache-2.0.
@@ -63,23 +63,19 @@ class MultiLoggingConnector {
63
63
  * @param pageSize The maximum number of entities in a page.
64
64
  * @returns All the entities for the storage matching the conditions,
65
65
  * and a cursor which can be used to request more entities.
66
- * @throws NotImplementedError if the implementation does not support retrieval.
67
66
  */
68
67
  async query(conditions, sortProperties, properties, cursor, pageSize) {
69
68
  // See if we can find a connector that supports querying.
70
69
  // If it throws anything other than not implemented, we should throw it.
71
70
  for (const loggingConnector of this._loggingConnectors) {
72
- try {
73
- const result = await loggingConnector.query(conditions, sortProperties, properties, cursor, pageSize);
74
- return result;
75
- }
76
- catch (error) {
77
- if (!BaseError.isErrorName(error, NotImplementedError.CLASS_NAME)) {
78
- throw error;
79
- }
71
+ // eslint-disable-next-line @typescript-eslint/unbound-method
72
+ if (Is.function(loggingConnector.query)) {
73
+ return loggingConnector.query(conditions, sortProperties, properties, cursor, pageSize);
80
74
  }
81
75
  }
82
- throw new NotImplementedError(this.CLASS_NAME, "query");
76
+ return {
77
+ entities: []
78
+ };
83
79
  }
84
80
  }
85
81
 
@@ -110,7 +106,6 @@ class SilentLoggingConnector {
110
106
  * @param pageSize The maximum number of entities in a page.
111
107
  * @returns All the entities for the storage matching the conditions,
112
108
  * and a cursor which can be used to request more entities.
113
- * @throws NotImplementedError if the implementation does not support retrieval.
114
109
  */
115
110
  async query(conditions, sortProperties, properties, cursor, pageSize) {
116
111
  return {
@@ -34,7 +34,6 @@ export declare class MultiLoggingConnector implements ILoggingConnector {
34
34
  * @param pageSize The maximum number of entities in a page.
35
35
  * @returns All the entities for the storage matching the conditions,
36
36
  * and a cursor which can be used to request more entities.
37
- * @throws NotImplementedError if the implementation does not support retrieval.
38
37
  */
39
38
  query(conditions?: EntityCondition<ILogEntry>, sortProperties?: {
40
39
  property: keyof Omit<ILogEntry, "error" | "data">;
@@ -28,7 +28,6 @@ export declare class SilentLoggingConnector implements ILoggingConnector {
28
28
  * @param pageSize The maximum number of entities in a page.
29
29
  * @returns All the entities for the storage matching the conditions,
30
30
  * and a cursor which can be used to request more entities.
31
- * @throws NotImplementedError if the implementation does not support retrieval.
32
31
  */
33
32
  query(conditions?: EntityCondition<ILogEntry>, sortProperties?: {
34
33
  property: keyof Omit<ILogEntry, "error" | "data">;
@@ -21,7 +21,6 @@ export interface ILoggingComponent extends IComponent {
21
21
  * @param pageSize The maximum number of entities in a page.
22
22
  * @returns All the entities for the storage matching the conditions,
23
23
  * and a cursor which can be used to request more entities.
24
- * @throws NotImplementedError if the implementation does not support retrieval.
25
24
  */
26
25
  query(level?: LogLevel, source?: string, timeStart?: number, timeEnd?: number, cursor?: string, pageSize?: number): Promise<{
27
26
  /**
@@ -20,9 +20,8 @@ export interface ILoggingConnector extends IComponent {
20
20
  * @param pageSize The maximum number of entities in a page.
21
21
  * @returns All the entities for the storage matching the conditions,
22
22
  * and a cursor which can be used to request more entities.
23
- * @throws NotImplementedError if the implementation does not support retrieval.
24
23
  */
25
- query(conditions?: EntityCondition<ILogEntry>, sortProperties?: {
24
+ query?(conditions?: EntityCondition<ILogEntry>, sortProperties?: {
26
25
  property: keyof Omit<ILogEntry, "error" | "data">;
27
26
  sortDirection: SortDirection;
28
27
  }[], properties?: (keyof ILogEntry)[], cursor?: string, pageSize?: number): Promise<{
@@ -6,7 +6,7 @@ export interface ILoggingListRequest {
6
6
  /**
7
7
  * The query parameters.
8
8
  */
9
- query: {
9
+ query?: {
10
10
  /**
11
11
  * The level of the log entries to retrieve.
12
12
  */
@@ -18,11 +18,11 @@ export interface ILoggingListRequest {
18
18
  /**
19
19
  * The start time of the metrics to retrieve as a timestamp in ms.
20
20
  */
21
- timeStart?: number;
21
+ timeStart?: number | string;
22
22
  /**
23
23
  * The end time of the metrics to retrieve as a timestamp in ms.
24
24
  */
25
- timeEnd?: number;
25
+ timeEnd?: number | string;
26
26
  /**
27
27
  * The optional cursor to get next chunk.
28
28
  */
@@ -30,6 +30,6 @@ export interface ILoggingListRequest {
30
30
  /**
31
31
  * The maximum number of entities in a page.
32
32
  */
33
- pageSize?: number;
33
+ pageSize?: number | string;
34
34
  };
35
35
  }
package/docs/changelog.md CHANGED
@@ -1,5 +1,54 @@
1
1
  # @twin.org/logging-models - Changelog
2
2
 
3
- ## v0.0.1-next.9
3
+ ## [0.0.2-next.1](https://github.com/twinfoundation/logging/compare/logging-models-v0.0.2-next.0...logging-models-v0.0.2-next.1) (2025-08-19)
4
+
5
+
6
+ ### Features
7
+
8
+ * update dependencies ([976fc06](https://github.com/twinfoundation/logging/commit/976fc06976c4899769486b7cb2e827c407d7fc89))
9
+ * update framework core ([aac823c](https://github.com/twinfoundation/logging/commit/aac823c2ead88843618b8a82b308d5a793411764))
10
+ * use shared store mechanism ([#20](https://github.com/twinfoundation/logging/issues/20)) ([bbacd31](https://github.com/twinfoundation/logging/commit/bbacd31af991d82d84294ad432a40830692880ca))
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * query params force coercion ([71c5329](https://github.com/twinfoundation/logging/commit/71c53292d300acae0369bd7937c5ca3ab5430689))
16
+
17
+ ## 0.0.1 (2025-07-03)
18
+
19
+
20
+ ### Features
21
+
22
+ * release to production ([3458161](https://github.com/twinfoundation/logging/commit/3458161b4bb530f86e4d1fe06123d885cdcb114d))
23
+
24
+ ## [0.0.1-next.16](https://github.com/twinfoundation/logging/compare/logging-models-v0.0.1-next.15...logging-models-v0.0.1-next.16) (2025-06-20)
25
+
26
+
27
+ ### Bug Fixes
28
+
29
+ * query params force coercion ([71c5329](https://github.com/twinfoundation/logging/commit/71c53292d300acae0369bd7937c5ca3ab5430689))
30
+
31
+ ## [0.0.1-next.15](https://github.com/twinfoundation/logging/compare/logging-models-v0.0.1-next.14...logging-models-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
+ ## [0.0.1-next.14](https://github.com/twinfoundation/logging/compare/logging-models-v0.0.1-next.13...logging-models-v0.0.1-next.14) (2025-04-17)
39
+
40
+
41
+ ### Features
42
+
43
+ * use shared store mechanism ([#20](https://github.com/twinfoundation/logging/issues/20)) ([bbacd31](https://github.com/twinfoundation/logging/commit/bbacd31af991d82d84294ad432a40830692880ca))
44
+
45
+ ## [0.0.1-next.13](https://github.com/twinfoundation/logging/compare/logging-models-v0.0.1-next.12...logging-models-v0.0.1-next.13) (2025-03-28)
46
+
47
+
48
+ ### Miscellaneous Chores
49
+
50
+ * **logging-models:** Synchronize repo versions
51
+
52
+ ## v0.0.1-next.12
4
53
 
5
54
  - Initial Release
@@ -4,13 +4,13 @@ Helper class for log entry operations.
4
4
 
5
5
  ## Constructors
6
6
 
7
- ### new LogEntryHelper()
7
+ ### Constructor
8
8
 
9
- > **new LogEntryHelper**(): [`LogEntryHelper`](LogEntryHelper.md)
9
+ > **new LogEntryHelper**(): `LogEntryHelper`
10
10
 
11
11
  #### Returns
12
12
 
13
- [`LogEntryHelper`](LogEntryHelper.md)
13
+ `LogEntryHelper`
14
14
 
15
15
  ## Methods
16
16
 
@@ -8,9 +8,9 @@ Class for performing logging operations on multiple connectors.
8
8
 
9
9
  ## Constructors
10
10
 
11
- ### new MultiLoggingConnector()
11
+ ### Constructor
12
12
 
13
- > **new MultiLoggingConnector**(`options`): [`MultiLoggingConnector`](MultiLoggingConnector.md)
13
+ > **new MultiLoggingConnector**(`options`): `MultiLoggingConnector`
14
14
 
15
15
  Create a new instance of MultiLoggingConnector.
16
16
 
@@ -24,7 +24,7 @@ The options for the connector.
24
24
 
25
25
  #### Returns
26
26
 
27
- [`MultiLoggingConnector`](MultiLoggingConnector.md)
27
+ `MultiLoggingConnector`
28
28
 
29
29
  ## Properties
30
30
 
@@ -76,7 +76,7 @@ Nothing.
76
76
 
77
77
  ### query()
78
78
 
79
- > **query**(`conditions`?, `sortProperties`?, `properties`?, `cursor`?, `pageSize`?): `Promise`\<\{ `entities`: `Partial`\<[`ILogEntry`](../interfaces/ILogEntry.md)\>[]; `cursor`: `string`; \}\>
79
+ > **query**(`conditions?`, `sortProperties?`, `properties?`, `cursor?`, `pageSize?`): `Promise`\<\{ `entities`: `Partial`\<[`ILogEntry`](../interfaces/ILogEntry.md)\>[]; `cursor?`: `string`; \}\>
80
80
 
81
81
  Query the log entries.
82
82
 
@@ -114,15 +114,11 @@ The maximum number of entities in a page.
114
114
 
115
115
  #### Returns
116
116
 
117
- `Promise`\<\{ `entities`: `Partial`\<[`ILogEntry`](../interfaces/ILogEntry.md)\>[]; `cursor`: `string`; \}\>
117
+ `Promise`\<\{ `entities`: `Partial`\<[`ILogEntry`](../interfaces/ILogEntry.md)\>[]; `cursor?`: `string`; \}\>
118
118
 
119
119
  All the entities for the storage matching the conditions,
120
120
  and a cursor which can be used to request more entities.
121
121
 
122
- #### Throws
123
-
124
- NotImplementedError if the implementation does not support retrieval.
125
-
126
122
  #### Implementation of
127
123
 
128
124
  [`ILoggingConnector`](../interfaces/ILoggingConnector.md).[`query`](../interfaces/ILoggingConnector.md#query)
@@ -8,13 +8,13 @@ Class for performing logging operations to nowhere.
8
8
 
9
9
  ## Constructors
10
10
 
11
- ### new SilentLoggingConnector()
11
+ ### Constructor
12
12
 
13
- > **new SilentLoggingConnector**(): [`SilentLoggingConnector`](SilentLoggingConnector.md)
13
+ > **new SilentLoggingConnector**(): `SilentLoggingConnector`
14
14
 
15
15
  #### Returns
16
16
 
17
- [`SilentLoggingConnector`](SilentLoggingConnector.md)
17
+ `SilentLoggingConnector`
18
18
 
19
19
  ## Properties
20
20
 
@@ -66,7 +66,7 @@ Nothing.
66
66
 
67
67
  ### query()
68
68
 
69
- > **query**(`conditions`?, `sortProperties`?, `properties`?, `cursor`?, `pageSize`?): `Promise`\<\{ `entities`: `Partial`\<[`ILogEntry`](../interfaces/ILogEntry.md)\>[]; `cursor`: `string`; \}\>
69
+ > **query**(`conditions?`, `sortProperties?`, `properties?`, `cursor?`, `pageSize?`): `Promise`\<\{ `entities`: `Partial`\<[`ILogEntry`](../interfaces/ILogEntry.md)\>[]; `cursor?`: `string`; \}\>
70
70
 
71
71
  Query the log entries.
72
72
 
@@ -104,15 +104,11 @@ The maximum number of entities in a page.
104
104
 
105
105
  #### Returns
106
106
 
107
- `Promise`\<\{ `entities`: `Partial`\<[`ILogEntry`](../interfaces/ILogEntry.md)\>[]; `cursor`: `string`; \}\>
107
+ `Promise`\<\{ `entities`: `Partial`\<[`ILogEntry`](../interfaces/ILogEntry.md)\>[]; `cursor?`: `string`; \}\>
108
108
 
109
109
  All the entities for the storage matching the conditions,
110
110
  and a cursor which can be used to request more entities.
111
111
 
112
- #### Throws
113
-
114
- NotImplementedError if the implementation does not support retrieval.
115
-
116
112
  #### Implementation of
117
113
 
118
114
  [`ILoggingConnector`](../interfaces/ILoggingConnector.md).[`query`](../interfaces/ILoggingConnector.md#query)
@@ -32,7 +32,7 @@ Nothing.
32
32
 
33
33
  ### query()
34
34
 
35
- > **query**(`level`?, `source`?, `timeStart`?, `timeEnd`?, `cursor`?, `pageSize`?): `Promise`\<\{ `entities`: [`ILogEntry`](ILogEntry.md)[]; `cursor`: `string`; \}\>
35
+ > **query**(`level?`, `source?`, `timeStart?`, `timeEnd?`, `cursor?`, `pageSize?`): `Promise`\<\{ `entities`: [`ILogEntry`](ILogEntry.md)[]; `cursor?`: `string`; \}\>
36
36
 
37
37
  Query the log entries.
38
38
 
@@ -76,11 +76,7 @@ The maximum number of entities in a page.
76
76
 
77
77
  #### Returns
78
78
 
79
- `Promise`\<\{ `entities`: [`ILogEntry`](ILogEntry.md)[]; `cursor`: `string`; \}\>
79
+ `Promise`\<\{ `entities`: [`ILogEntry`](ILogEntry.md)[]; `cursor?`: `string`; \}\>
80
80
 
81
81
  All the entities for the storage matching the conditions,
82
82
  and a cursor which can be used to request more entities.
83
-
84
- #### Throws
85
-
86
- NotImplementedError if the implementation does not support retrieval.
@@ -30,9 +30,9 @@ Nothing.
30
30
 
31
31
  ***
32
32
 
33
- ### query()
33
+ ### query()?
34
34
 
35
- > **query**(`conditions`?, `sortProperties`?, `properties`?, `cursor`?, `pageSize`?): `Promise`\<\{ `entities`: `Partial`\<[`ILogEntry`](ILogEntry.md)\>[]; `cursor`: `string`; \}\>
35
+ > `optional` **query**(`conditions?`, `sortProperties?`, `properties?`, `cursor?`, `pageSize?`): `Promise`\<\{ `entities`: `Partial`\<[`ILogEntry`](ILogEntry.md)\>[]; `cursor?`: `string`; \}\>
36
36
 
37
37
  Query the log entries.
38
38
 
@@ -70,11 +70,7 @@ The maximum number of entities in a page.
70
70
 
71
71
  #### Returns
72
72
 
73
- `Promise`\<\{ `entities`: `Partial`\<[`ILogEntry`](ILogEntry.md)\>[]; `cursor`: `string`; \}\>
73
+ `Promise`\<\{ `entities`: `Partial`\<[`ILogEntry`](ILogEntry.md)\>[]; `cursor?`: `string`; \}\>
74
74
 
75
75
  All the entities for the storage matching the conditions,
76
76
  and a cursor which can be used to request more entities.
77
-
78
- #### Throws
79
-
80
- NotImplementedError if the implementation does not support retrieval.
@@ -4,9 +4,9 @@ Get the a list of the log entries.
4
4
 
5
5
  ## Properties
6
6
 
7
- ### query
7
+ ### query?
8
8
 
9
- > **query**: `object`
9
+ > `optional` **query**: `object`
10
10
 
11
11
  The query parameters.
12
12
 
@@ -24,13 +24,13 @@ The source of the log entries to retrieve.
24
24
 
25
25
  #### timeStart?
26
26
 
27
- > `optional` **timeStart**: `number`
27
+ > `optional` **timeStart**: `string` \| `number`
28
28
 
29
29
  The start time of the metrics to retrieve as a timestamp in ms.
30
30
 
31
31
  #### timeEnd?
32
32
 
33
- > `optional` **timeEnd**: `number`
33
+ > `optional` **timeEnd**: `string` \| `number`
34
34
 
35
35
  The end time of the metrics to retrieve as a timestamp in ms.
36
36
 
@@ -42,6 +42,6 @@ The optional cursor to get next chunk.
42
42
 
43
43
  #### pageSize?
44
44
 
45
- > `optional` **pageSize**: `number`
45
+ > `optional` **pageSize**: `string` \| `number`
46
46
 
47
47
  The maximum number of entities in a page.
@@ -1,5 +1,5 @@
1
1
  # Type Alias: LogLevel
2
2
 
3
- > **LogLevel**: `"info"` \| `"error"` \| `"warn"` \| `"trace"` \| `"debug"`
3
+ > **LogLevel** = `"info"` \| `"error"` \| `"warn"` \| `"trace"` \| `"debug"`
4
4
 
5
5
  Log level.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/logging-models",
3
- "version": "0.0.1-next.9",
3
+ "version": "0.0.2-next.1",
4
4
  "description": "Models which define the structure of the logging connectors and services",
5
5
  "repository": {
6
6
  "type": "git",