@twin.org/logging-models 0.0.1-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.
Files changed (36) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +21 -0
  3. package/dist/cjs/index.cjs +157 -0
  4. package/dist/esm/index.mjs +152 -0
  5. package/dist/types/connectors/multiLoggingConnector.d.ts +52 -0
  6. package/dist/types/connectors/silentLoggingConnector.d.ts +46 -0
  7. package/dist/types/factories/loggingConnectorFactory.d.ts +6 -0
  8. package/dist/types/helpers/logEntryHelper.d.ts +12 -0
  9. package/dist/types/index.d.ts +13 -0
  10. package/dist/types/models/ILogEntry.d.ts +33 -0
  11. package/dist/types/models/ILoggingComponent.d.ts +36 -0
  12. package/dist/types/models/ILoggingConnector.d.ts +38 -0
  13. package/dist/types/models/ILoggingLevelsConfig.d.ts +10 -0
  14. package/dist/types/models/IMultiLoggingConnectorConstructorOptions.d.ts +14 -0
  15. package/dist/types/models/api/ILoggingCreateRequest.d.ts +10 -0
  16. package/dist/types/models/api/ILoggingListRequest.d.ts +35 -0
  17. package/dist/types/models/api/ILoggingListResponse.d.ts +19 -0
  18. package/dist/types/models/logLevel.d.ts +4 -0
  19. package/docs/changelog.md +5 -0
  20. package/docs/examples.md +1 -0
  21. package/docs/reference/classes/LogEntryHelper.md +35 -0
  22. package/docs/reference/classes/MultiLoggingConnector.md +128 -0
  23. package/docs/reference/classes/SilentLoggingConnector.md +118 -0
  24. package/docs/reference/index.md +26 -0
  25. package/docs/reference/interfaces/ILogEntry.md +55 -0
  26. package/docs/reference/interfaces/ILoggingComponent.md +86 -0
  27. package/docs/reference/interfaces/ILoggingConnector.md +80 -0
  28. package/docs/reference/interfaces/ILoggingCreateRequest.md +11 -0
  29. package/docs/reference/interfaces/ILoggingLevelsConfig.md +11 -0
  30. package/docs/reference/interfaces/ILoggingListRequest.md +47 -0
  31. package/docs/reference/interfaces/ILoggingListResponse.md +23 -0
  32. package/docs/reference/interfaces/IMultiLoggingConnectorConstructorOptions.md +19 -0
  33. package/docs/reference/type-aliases/LogLevel.md +5 -0
  34. package/docs/reference/variables/LoggingConnectorFactory.md +5 -0
  35. package/locales/en.json +3 -0
  36. package/package.json +39 -0
@@ -0,0 +1,80 @@
1
+ # Interface: ILoggingConnector
2
+
3
+ Interface describing a logging connector.
4
+
5
+ ## Extends
6
+
7
+ - `IComponent`
8
+
9
+ ## Methods
10
+
11
+ ### log()
12
+
13
+ > **log**(`logEntry`): `Promise`\<`void`\>
14
+
15
+ Log an entry to the connector.
16
+
17
+ #### Parameters
18
+
19
+ ##### logEntry
20
+
21
+ [`ILogEntry`](ILogEntry.md)
22
+
23
+ The entry to log.
24
+
25
+ #### Returns
26
+
27
+ `Promise`\<`void`\>
28
+
29
+ Nothing.
30
+
31
+ ***
32
+
33
+ ### query()
34
+
35
+ > **query**(`conditions`?, `sortProperties`?, `properties`?, `cursor`?, `pageSize`?): `Promise`\<\{ `entities`: `Partial`\<[`ILogEntry`](ILogEntry.md)\>[]; `cursor`: `string`; \}\>
36
+
37
+ Query the log entries.
38
+
39
+ #### Parameters
40
+
41
+ ##### conditions?
42
+
43
+ `EntityCondition`\<[`ILogEntry`](ILogEntry.md)\>
44
+
45
+ The conditions to match for the entities.
46
+
47
+ ##### sortProperties?
48
+
49
+ `object`[]
50
+
51
+ The optional sort order.
52
+
53
+ ##### properties?
54
+
55
+ keyof [`ILogEntry`](ILogEntry.md)[]
56
+
57
+ The optional keys to return, defaults to all.
58
+
59
+ ##### cursor?
60
+
61
+ `string`
62
+
63
+ The cursor to request the next page of entities.
64
+
65
+ ##### pageSize?
66
+
67
+ `number`
68
+
69
+ The maximum number of entities in a page.
70
+
71
+ #### Returns
72
+
73
+ `Promise`\<\{ `entities`: `Partial`\<[`ILogEntry`](ILogEntry.md)\>[]; `cursor`: `string`; \}\>
74
+
75
+ All the entities for the storage matching the conditions,
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.
@@ -0,0 +1,11 @@
1
+ # Interface: ILoggingCreateRequest
2
+
3
+ Create a new log entry.
4
+
5
+ ## Properties
6
+
7
+ ### body
8
+
9
+ > **body**: [`ILogEntry`](ILogEntry.md)
10
+
11
+ The data to be used in the create.
@@ -0,0 +1,11 @@
1
+ # Interface: ILoggingLevelsConfig
2
+
3
+ Configuration for the logging connectors to specify the levels to display.
4
+
5
+ ## Properties
6
+
7
+ ### levels?
8
+
9
+ > `optional` **levels**: [`LogLevel`](../type-aliases/LogLevel.md)[]
10
+
11
+ The log levels to display, will default to all.
@@ -0,0 +1,47 @@
1
+ # Interface: ILoggingListRequest
2
+
3
+ Get the a list of the log entries.
4
+
5
+ ## Properties
6
+
7
+ ### query
8
+
9
+ > **query**: `object`
10
+
11
+ The query parameters.
12
+
13
+ #### level?
14
+
15
+ > `optional` **level**: [`LogLevel`](../type-aliases/LogLevel.md)
16
+
17
+ The level of the log entries to retrieve.
18
+
19
+ #### source?
20
+
21
+ > `optional` **source**: `string`
22
+
23
+ The source of the log entries to retrieve.
24
+
25
+ #### timeStart?
26
+
27
+ > `optional` **timeStart**: `number`
28
+
29
+ The start time of the metrics to retrieve as a timestamp in ms.
30
+
31
+ #### timeEnd?
32
+
33
+ > `optional` **timeEnd**: `number`
34
+
35
+ The end time of the metrics to retrieve as a timestamp in ms.
36
+
37
+ #### cursor?
38
+
39
+ > `optional` **cursor**: `string`
40
+
41
+ The optional cursor to get next chunk.
42
+
43
+ #### pageSize?
44
+
45
+ > `optional` **pageSize**: `number`
46
+
47
+ The maximum number of entities in a page.
@@ -0,0 +1,23 @@
1
+ # Interface: ILoggingListResponse
2
+
3
+ Response for log entry list request.
4
+
5
+ ## Properties
6
+
7
+ ### body
8
+
9
+ > **body**: `object`
10
+
11
+ The response payload.
12
+
13
+ #### entities
14
+
15
+ > **entities**: [`ILogEntry`](ILogEntry.md)[]
16
+
17
+ The entities, which can be partial if a limited keys list was provided.
18
+
19
+ #### cursor?
20
+
21
+ > `optional` **cursor**: `string`
22
+
23
+ An optional cursor, when defined can be used to call find to get more entities.
@@ -0,0 +1,19 @@
1
+ # Interface: IMultiLoggingConnectorConstructorOptions
2
+
3
+ Options for the multi logging connector.
4
+
5
+ ## Properties
6
+
7
+ ### loggingConnectorTypes
8
+
9
+ > **loggingConnectorTypes**: `string`[]
10
+
11
+ The logging connectors to multiplex.
12
+
13
+ ***
14
+
15
+ ### config?
16
+
17
+ > `optional` **config**: [`ILoggingLevelsConfig`](ILoggingLevelsConfig.md)
18
+
19
+ The configuration for the logging connector.
@@ -0,0 +1,5 @@
1
+ # Type Alias: LogLevel
2
+
3
+ > **LogLevel**: `"info"` \| `"error"` \| `"warn"` \| `"trace"` \| `"debug"`
4
+
5
+ Log level.
@@ -0,0 +1,5 @@
1
+ # Variable: LoggingConnectorFactory
2
+
3
+ > `const` **LoggingConnectorFactory**: `Factory`\<[`ILoggingConnector`](../interfaces/ILoggingConnector.md)\>
4
+
5
+ Factory for creating logging connectors.
@@ -0,0 +1,3 @@
1
+ {
2
+ "error": {}
3
+ }
package/package.json ADDED
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "@twin.org/logging-models",
3
+ "version": "0.0.1-next.10",
4
+ "description": "Models which define the structure of the logging connectors and services",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/twinfoundation/logging.git",
8
+ "directory": "packages/logging-models"
9
+ },
10
+ "author": "martyn.janes@iota.org",
11
+ "license": "Apache-2.0",
12
+ "type": "module",
13
+ "engines": {
14
+ "node": ">=20.0.0"
15
+ },
16
+ "dependencies": {
17
+ "@twin.org/core": "next",
18
+ "@twin.org/entity": "next",
19
+ "@twin.org/nameof": "next"
20
+ },
21
+ "main": "./dist/cjs/index.cjs",
22
+ "module": "./dist/esm/index.mjs",
23
+ "types": "./dist/types/index.d.ts",
24
+ "exports": {
25
+ ".": {
26
+ "types": "./dist/types/index.d.ts",
27
+ "require": "./dist/cjs/index.cjs",
28
+ "import": "./dist/esm/index.mjs"
29
+ },
30
+ "./locales/*.json": "./locales/*.json"
31
+ },
32
+ "files": [
33
+ "dist/cjs",
34
+ "dist/esm",
35
+ "dist/types",
36
+ "locales",
37
+ "docs"
38
+ ]
39
+ }