@twin.org/logging-rest-client 0.0.2-next.1 → 0.0.2-next.3
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 +9 -14
- package/dist/esm/index.mjs +10 -15
- package/dist/types/index.d.ts +1 -1
- package/dist/types/{loggingClient.d.ts → loggingRestClient.d.ts} +5 -5
- package/docs/changelog.md +28 -0
- package/docs/reference/classes/{LoggingClient.md → LoggingRestClient.md} +8 -12
- package/docs/reference/index.md +1 -1
- package/package.json +15 -3
package/dist/cjs/index.cjs
CHANGED
|
@@ -8,22 +8,17 @@ var core = require('@twin.org/core');
|
|
|
8
8
|
/**
|
|
9
9
|
* Client for performing logging through to REST endpoints.
|
|
10
10
|
*/
|
|
11
|
-
class
|
|
11
|
+
class LoggingRestClient extends apiCore.BaseRestClient {
|
|
12
12
|
/**
|
|
13
13
|
* Runtime name for the class.
|
|
14
|
-
* @internal
|
|
15
14
|
*/
|
|
16
|
-
static
|
|
17
|
-
/**
|
|
18
|
-
* Runtime name for the class.
|
|
19
|
-
*/
|
|
20
|
-
CLASS_NAME = LoggingClient._CLASS_NAME;
|
|
15
|
+
static CLASS_NAME = "LoggingRestClient";
|
|
21
16
|
/**
|
|
22
17
|
* Create a new instance of LoggingClient.
|
|
23
18
|
* @param config The configuration for the client.
|
|
24
19
|
*/
|
|
25
20
|
constructor(config) {
|
|
26
|
-
super(
|
|
21
|
+
super(LoggingRestClient.CLASS_NAME, config, "logging");
|
|
27
22
|
}
|
|
28
23
|
/**
|
|
29
24
|
* Log an entry to the connector.
|
|
@@ -31,7 +26,7 @@ class LoggingClient extends apiCore.BaseRestClient {
|
|
|
31
26
|
* @returns Nothing.
|
|
32
27
|
*/
|
|
33
28
|
async log(logEntry) {
|
|
34
|
-
core.Guards.object(
|
|
29
|
+
core.Guards.object(LoggingRestClient.CLASS_NAME, "logEntry", logEntry);
|
|
35
30
|
await this.fetch("/", "POST", {
|
|
36
31
|
body: logEntry
|
|
37
32
|
});
|
|
@@ -42,12 +37,12 @@ class LoggingClient extends apiCore.BaseRestClient {
|
|
|
42
37
|
* @param source The source of the log entries.
|
|
43
38
|
* @param timeStart The inclusive time as the start of the log entries.
|
|
44
39
|
* @param timeEnd The inclusive time as the end of the log entries.
|
|
45
|
-
* @param cursor The cursor to request the next
|
|
46
|
-
* @param
|
|
40
|
+
* @param cursor The cursor to request the next chunk of entities.
|
|
41
|
+
* @param limit Limit the number of entities to return.
|
|
47
42
|
* @returns All the entities for the storage matching the conditions,
|
|
48
43
|
* and a cursor which can be used to request more entities.
|
|
49
44
|
*/
|
|
50
|
-
async query(level, source, timeStart, timeEnd, cursor,
|
|
45
|
+
async query(level, source, timeStart, timeEnd, cursor, limit) {
|
|
51
46
|
const response = await this.fetch("/", "GET", {
|
|
52
47
|
query: {
|
|
53
48
|
level,
|
|
@@ -55,11 +50,11 @@ class LoggingClient extends apiCore.BaseRestClient {
|
|
|
55
50
|
timeStart,
|
|
56
51
|
timeEnd,
|
|
57
52
|
cursor,
|
|
58
|
-
|
|
53
|
+
limit: core.Coerce.string(limit)
|
|
59
54
|
}
|
|
60
55
|
});
|
|
61
56
|
return response.body;
|
|
62
57
|
}
|
|
63
58
|
}
|
|
64
59
|
|
|
65
|
-
exports.
|
|
60
|
+
exports.LoggingRestClient = LoggingRestClient;
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,27 +1,22 @@
|
|
|
1
1
|
import { BaseRestClient } from '@twin.org/api-core';
|
|
2
|
-
import { Guards } from '@twin.org/core';
|
|
2
|
+
import { Guards, Coerce } from '@twin.org/core';
|
|
3
3
|
|
|
4
4
|
// Copyright 2024 IOTA Stiftung.
|
|
5
5
|
// SPDX-License-Identifier: Apache-2.0.
|
|
6
6
|
/**
|
|
7
7
|
* Client for performing logging through to REST endpoints.
|
|
8
8
|
*/
|
|
9
|
-
class
|
|
9
|
+
class LoggingRestClient extends BaseRestClient {
|
|
10
10
|
/**
|
|
11
11
|
* Runtime name for the class.
|
|
12
|
-
* @internal
|
|
13
12
|
*/
|
|
14
|
-
static
|
|
15
|
-
/**
|
|
16
|
-
* Runtime name for the class.
|
|
17
|
-
*/
|
|
18
|
-
CLASS_NAME = LoggingClient._CLASS_NAME;
|
|
13
|
+
static CLASS_NAME = "LoggingRestClient";
|
|
19
14
|
/**
|
|
20
15
|
* Create a new instance of LoggingClient.
|
|
21
16
|
* @param config The configuration for the client.
|
|
22
17
|
*/
|
|
23
18
|
constructor(config) {
|
|
24
|
-
super(
|
|
19
|
+
super(LoggingRestClient.CLASS_NAME, config, "logging");
|
|
25
20
|
}
|
|
26
21
|
/**
|
|
27
22
|
* Log an entry to the connector.
|
|
@@ -29,7 +24,7 @@ class LoggingClient extends BaseRestClient {
|
|
|
29
24
|
* @returns Nothing.
|
|
30
25
|
*/
|
|
31
26
|
async log(logEntry) {
|
|
32
|
-
Guards.object(
|
|
27
|
+
Guards.object(LoggingRestClient.CLASS_NAME, "logEntry", logEntry);
|
|
33
28
|
await this.fetch("/", "POST", {
|
|
34
29
|
body: logEntry
|
|
35
30
|
});
|
|
@@ -40,12 +35,12 @@ class LoggingClient extends BaseRestClient {
|
|
|
40
35
|
* @param source The source of the log entries.
|
|
41
36
|
* @param timeStart The inclusive time as the start of the log entries.
|
|
42
37
|
* @param timeEnd The inclusive time as the end of the log entries.
|
|
43
|
-
* @param cursor The cursor to request the next
|
|
44
|
-
* @param
|
|
38
|
+
* @param cursor The cursor to request the next chunk of entities.
|
|
39
|
+
* @param limit Limit the number of entities to return.
|
|
45
40
|
* @returns All the entities for the storage matching the conditions,
|
|
46
41
|
* and a cursor which can be used to request more entities.
|
|
47
42
|
*/
|
|
48
|
-
async query(level, source, timeStart, timeEnd, cursor,
|
|
43
|
+
async query(level, source, timeStart, timeEnd, cursor, limit) {
|
|
49
44
|
const response = await this.fetch("/", "GET", {
|
|
50
45
|
query: {
|
|
51
46
|
level,
|
|
@@ -53,11 +48,11 @@ class LoggingClient extends BaseRestClient {
|
|
|
53
48
|
timeStart,
|
|
54
49
|
timeEnd,
|
|
55
50
|
cursor,
|
|
56
|
-
|
|
51
|
+
limit: Coerce.string(limit)
|
|
57
52
|
}
|
|
58
53
|
});
|
|
59
54
|
return response.body;
|
|
60
55
|
}
|
|
61
56
|
}
|
|
62
57
|
|
|
63
|
-
export {
|
|
58
|
+
export { LoggingRestClient };
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./
|
|
1
|
+
export * from "./loggingRestClient";
|
|
@@ -4,11 +4,11 @@ import type { ILogEntry, ILoggingComponent, LogLevel } from "@twin.org/logging-m
|
|
|
4
4
|
/**
|
|
5
5
|
* Client for performing logging through to REST endpoints.
|
|
6
6
|
*/
|
|
7
|
-
export declare class
|
|
7
|
+
export declare class LoggingRestClient extends BaseRestClient implements ILoggingComponent {
|
|
8
8
|
/**
|
|
9
9
|
* Runtime name for the class.
|
|
10
10
|
*/
|
|
11
|
-
readonly CLASS_NAME: string;
|
|
11
|
+
static readonly CLASS_NAME: string;
|
|
12
12
|
/**
|
|
13
13
|
* Create a new instance of LoggingClient.
|
|
14
14
|
* @param config The configuration for the client.
|
|
@@ -26,12 +26,12 @@ export declare class LoggingClient extends BaseRestClient implements ILoggingCom
|
|
|
26
26
|
* @param source The source of the log entries.
|
|
27
27
|
* @param timeStart The inclusive time as the start of the log entries.
|
|
28
28
|
* @param timeEnd The inclusive time as the end of the log entries.
|
|
29
|
-
* @param cursor The cursor to request the next
|
|
30
|
-
* @param
|
|
29
|
+
* @param cursor The cursor to request the next chunk of entities.
|
|
30
|
+
* @param limit Limit the number of entities to return.
|
|
31
31
|
* @returns All the entities for the storage matching the conditions,
|
|
32
32
|
* and a cursor which can be used to request more entities.
|
|
33
33
|
*/
|
|
34
|
-
query(level?: LogLevel, source?: string, timeStart?: number, timeEnd?: number, cursor?: string,
|
|
34
|
+
query(level?: LogLevel, source?: string, timeStart?: number, timeEnd?: number, cursor?: string, limit?: number): Promise<{
|
|
35
35
|
/**
|
|
36
36
|
* The entities, which can be partial if a limited keys list was provided.
|
|
37
37
|
*/
|
package/docs/changelog.md
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# @twin.org/logging-rest-client - Changelog
|
|
2
2
|
|
|
3
|
+
## [0.0.2-next.3](https://github.com/twinfoundation/logging/compare/logging-rest-client-v0.0.2-next.2...logging-rest-client-v0.0.2-next.3) (2025-10-09)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* add validate-locales ([df53f13](https://github.com/twinfoundation/logging/commit/df53f1331394f2f9333e91e4995a88dded90e484))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Dependencies
|
|
12
|
+
|
|
13
|
+
* The following workspace dependencies were updated
|
|
14
|
+
* dependencies
|
|
15
|
+
* @twin.org/logging-models bumped from 0.0.2-next.2 to 0.0.2-next.3
|
|
16
|
+
|
|
17
|
+
## [0.0.2-next.2](https://github.com/twinfoundation/logging/compare/logging-rest-client-v0.0.2-next.1...logging-rest-client-v0.0.2-next.2) (2025-08-29)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* eslint migration to flat config ([1f9fdde](https://github.com/twinfoundation/logging/commit/1f9fddedfdcce9942afed431d9460a0f22092744))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Dependencies
|
|
26
|
+
|
|
27
|
+
* The following workspace dependencies were updated
|
|
28
|
+
* dependencies
|
|
29
|
+
* @twin.org/logging-models bumped from 0.0.2-next.1 to 0.0.2-next.2
|
|
30
|
+
|
|
3
31
|
## [0.0.2-next.1](https://github.com/twinfoundation/logging/compare/logging-rest-client-v0.0.2-next.0...logging-rest-client-v0.0.2-next.1) (2025-08-19)
|
|
4
32
|
|
|
5
33
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Class:
|
|
1
|
+
# Class: LoggingRestClient
|
|
2
2
|
|
|
3
3
|
Client for performing logging through to REST endpoints.
|
|
4
4
|
|
|
@@ -14,7 +14,7 @@ Client for performing logging through to REST endpoints.
|
|
|
14
14
|
|
|
15
15
|
### Constructor
|
|
16
16
|
|
|
17
|
-
> **new
|
|
17
|
+
> **new LoggingRestClient**(`config`): `LoggingRestClient`
|
|
18
18
|
|
|
19
19
|
Create a new instance of LoggingClient.
|
|
20
20
|
|
|
@@ -28,7 +28,7 @@ The configuration for the client.
|
|
|
28
28
|
|
|
29
29
|
#### Returns
|
|
30
30
|
|
|
31
|
-
`
|
|
31
|
+
`LoggingRestClient`
|
|
32
32
|
|
|
33
33
|
#### Overrides
|
|
34
34
|
|
|
@@ -38,14 +38,10 @@ The configuration for the client.
|
|
|
38
38
|
|
|
39
39
|
### CLASS\_NAME
|
|
40
40
|
|
|
41
|
-
> `readonly` **CLASS\_NAME**: `string`
|
|
41
|
+
> `readonly` `static` **CLASS\_NAME**: `string`
|
|
42
42
|
|
|
43
43
|
Runtime name for the class.
|
|
44
44
|
|
|
45
|
-
#### Implementation of
|
|
46
|
-
|
|
47
|
-
`ILoggingComponent.CLASS_NAME`
|
|
48
|
-
|
|
49
45
|
## Methods
|
|
50
46
|
|
|
51
47
|
### log()
|
|
@@ -76,7 +72,7 @@ Nothing.
|
|
|
76
72
|
|
|
77
73
|
### query()
|
|
78
74
|
|
|
79
|
-
> **query**(`level?`, `source?`, `timeStart?`, `timeEnd?`, `cursor?`, `
|
|
75
|
+
> **query**(`level?`, `source?`, `timeStart?`, `timeEnd?`, `cursor?`, `limit?`): `Promise`\<\{ `entities`: `ILogEntry`[]; `cursor?`: `string`; \}\>
|
|
80
76
|
|
|
81
77
|
Query the log entries.
|
|
82
78
|
|
|
@@ -110,13 +106,13 @@ The inclusive time as the end of the log entries.
|
|
|
110
106
|
|
|
111
107
|
`string`
|
|
112
108
|
|
|
113
|
-
The cursor to request the next
|
|
109
|
+
The cursor to request the next chunk of entities.
|
|
114
110
|
|
|
115
|
-
#####
|
|
111
|
+
##### limit?
|
|
116
112
|
|
|
117
113
|
`number`
|
|
118
114
|
|
|
119
|
-
|
|
115
|
+
Limit the number of entities to return.
|
|
120
116
|
|
|
121
117
|
#### Returns
|
|
122
118
|
|
package/docs/reference/index.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/logging-rest-client",
|
|
3
|
-
"version": "0.0.2-next.
|
|
3
|
+
"version": "0.0.2-next.3",
|
|
4
4
|
"description": "Logging contract implementation which can connect to REST endpoints",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"@twin.org/api-models": "next",
|
|
19
19
|
"@twin.org/core": "next",
|
|
20
20
|
"@twin.org/entity": "next",
|
|
21
|
-
"@twin.org/logging-models": "0.0.2-next.
|
|
21
|
+
"@twin.org/logging-models": "0.0.2-next.3",
|
|
22
22
|
"@twin.org/nameof": "next"
|
|
23
23
|
},
|
|
24
24
|
"main": "./dist/cjs/index.cjs",
|
|
@@ -38,5 +38,17 @@
|
|
|
38
38
|
"dist/types",
|
|
39
39
|
"locales",
|
|
40
40
|
"docs"
|
|
41
|
-
]
|
|
41
|
+
],
|
|
42
|
+
"keywords": [
|
|
43
|
+
"twin",
|
|
44
|
+
"trade",
|
|
45
|
+
"iota",
|
|
46
|
+
"framework",
|
|
47
|
+
"blockchain",
|
|
48
|
+
"logging"
|
|
49
|
+
],
|
|
50
|
+
"bugs": {
|
|
51
|
+
"url": "git+https://github.com/twinfoundation/logging/issues"
|
|
52
|
+
},
|
|
53
|
+
"homepage": "https://twindev.org"
|
|
42
54
|
}
|