@twin.org/logging-models 0.0.1-next.10 → 0.0.1-next.11
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 +6 -11
- package/dist/esm/index.mjs +7 -12
- package/dist/types/connectors/multiLoggingConnector.d.ts +0 -1
- package/dist/types/connectors/silentLoggingConnector.d.ts +0 -1
- package/dist/types/models/ILoggingComponent.d.ts +0 -1
- package/dist/types/models/ILoggingConnector.d.ts +1 -2
- package/docs/changelog.md +1 -1
- package/docs/reference/classes/MultiLoggingConnector.md +0 -4
- package/docs/reference/classes/SilentLoggingConnector.md +0 -4
- package/docs/reference/interfaces/ILoggingComponent.md +0 -4
- package/docs/reference/interfaces/ILoggingConnector.md +2 -6
- package/package.json +1 -1
package/dist/cjs/index.cjs
CHANGED
@@ -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
|
-
|
75
|
-
|
76
|
-
return
|
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
|
-
|
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 {
|
package/dist/esm/index.mjs
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Factory, Guards,
|
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
|
-
|
73
|
-
|
74
|
-
return
|
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
|
-
|
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<{
|
package/docs/changelog.md
CHANGED
@@ -119,10 +119,6 @@ The maximum number of entities in a page.
|
|
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)
|
@@ -109,10 +109,6 @@ The maximum number of entities in a page.
|
|
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)
|
@@ -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
|
|
@@ -74,7 +74,3 @@ The maximum number of entities in a page.
|
|
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.
|