@twin.org/logging-rest-client 0.0.3-next.7 → 0.0.3-next.8

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.
@@ -27,7 +27,7 @@ export class LoggingRestClient extends BaseRestClient {
27
27
  /**
28
28
  * Log an entry to the connector.
29
29
  * @param logEntry The entry to log.
30
- * @returns Nothing.
30
+ * @returns A promise that resolves when the REST endpoint has accepted the entry.
31
31
  */
32
32
  async log(logEntry) {
33
33
  Guards.object(LoggingRestClient.CLASS_NAME, "logEntry", logEntry);
@@ -1 +1 @@
1
- {"version":3,"file":"loggingRestClient.js","sourceRoot":"","sources":["../../src/loggingRestClient.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAWhD;;GAEG;AACH,MAAM,OAAO,iBAAkB,SAAQ,cAAc;IACpD;;OAEG;IACI,MAAM,CAAU,UAAU,uBAAuC;IAExE;;;OAGG;IACH,YAAY,MAA6B;QACxC,KAAK,CAAC,iBAAiB,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;IACxD,CAAC;IAED;;;OAGG;IACI,SAAS;QACf,OAAO,iBAAiB,CAAC,UAAU,CAAC;IACrC,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,GAAG,CAAC,QAAmB;QACnC,MAAM,CAAC,MAAM,CAAY,iBAAiB,CAAC,UAAU,cAAoB,QAAQ,CAAC,CAAC;QAEnF,MAAM,IAAI,CAAC,KAAK,CAAqC,GAAG,EAAE,MAAM,EAAE;YACjE,IAAI,EAAE,QAAQ;SACd,CAAC,CAAC;IACJ,CAAC;IAED;;;;;;;;;;OAUG;IACI,KAAK,CAAC,KAAK,CACjB,KAAgB,EAChB,MAAe,EACf,SAAkB,EAClB,OAAgB,EAChB,MAAe,EACf,KAAc;QAWd,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,KAAK,CAA4C,GAAG,EAAE,KAAK,EAAE;YACxF,KAAK,EAAE;gBACN,KAAK;gBACL,MAAM;gBACN,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC;gBACnC,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC;gBAC/B,MAAM;gBACN,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC;aAC3B;SACD,CAAC,CAAC;QAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;IACtB,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { BaseRestClient } from \"@twin.org/api-core\";\nimport type { IBaseRestClientConfig, IOkResponse } from \"@twin.org/api-models\";\nimport { Coerce, Guards } from \"@twin.org/core\";\nimport type {\n\tILogEntry,\n\tILoggingComponent,\n\tILoggingCreateRequest,\n\tILoggingListRequest,\n\tILoggingListResponse,\n\tLogLevel\n} from \"@twin.org/logging-models\";\nimport { nameof } from \"@twin.org/nameof\";\n\n/**\n * Client for performing logging through to REST endpoints.\n */\nexport class LoggingRestClient extends BaseRestClient implements ILoggingComponent {\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<LoggingRestClient>();\n\n\t/**\n\t * Create a new instance of LoggingRestClient.\n\t * @param config The configuration for the client.\n\t */\n\tconstructor(config: IBaseRestClientConfig) {\n\t\tsuper(LoggingRestClient.CLASS_NAME, config, \"logging\");\n\t}\n\n\t/**\n\t * Returns the class name of the component.\n\t * @returns The class name of the component.\n\t */\n\tpublic className(): string {\n\t\treturn LoggingRestClient.CLASS_NAME;\n\t}\n\n\t/**\n\t * Log an entry to the connector.\n\t * @param logEntry The entry to log.\n\t * @returns Nothing.\n\t */\n\tpublic async log(logEntry: ILogEntry): Promise<void> {\n\t\tGuards.object<ILogEntry>(LoggingRestClient.CLASS_NAME, nameof(logEntry), logEntry);\n\n\t\tawait this.fetch<ILoggingCreateRequest, IOkResponse>(\"/\", \"POST\", {\n\t\t\tbody: logEntry\n\t\t});\n\t}\n\n\t/**\n\t * Query the log entries.\n\t * @param level The level of the log entries.\n\t * @param source The source of the log entries.\n\t * @param timeStart The inclusive time as the start of the log entries.\n\t * @param timeEnd The inclusive time as the end of the log entries.\n\t * @param cursor The cursor to request the next chunk of entities.\n\t * @param limit Limit the number of entities to return.\n\t * @returns All the entities for the storage matching the conditions,\n\t * and a cursor which can be used to request more entities.\n\t */\n\tpublic async query(\n\t\tlevel?: LogLevel,\n\t\tsource?: string,\n\t\ttimeStart?: number,\n\t\ttimeEnd?: number,\n\t\tcursor?: string,\n\t\tlimit?: number\n\t): Promise<{\n\t\t/**\n\t\t * The entities, which can be partial if a limited keys list was provided.\n\t\t */\n\t\tentities: ILogEntry[];\n\t\t/**\n\t\t * An optional cursor, when defined can be used to call find to get more entities.\n\t\t */\n\t\tcursor?: string;\n\t}> {\n\t\tconst response = await this.fetch<ILoggingListRequest, ILoggingListResponse>(\"/\", \"GET\", {\n\t\t\tquery: {\n\t\t\t\tlevel,\n\t\t\t\tsource,\n\t\t\t\ttimeStart: Coerce.string(timeStart),\n\t\t\t\ttimeEnd: Coerce.string(timeEnd),\n\t\t\t\tcursor,\n\t\t\t\tlimit: Coerce.string(limit)\n\t\t\t}\n\t\t});\n\n\t\treturn response.body;\n\t}\n}\n"]}
1
+ {"version":3,"file":"loggingRestClient.js","sourceRoot":"","sources":["../../src/loggingRestClient.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAWhD;;GAEG;AACH,MAAM,OAAO,iBAAkB,SAAQ,cAAc;IACpD;;OAEG;IACI,MAAM,CAAU,UAAU,uBAAuC;IAExE;;;OAGG;IACH,YAAY,MAA6B;QACxC,KAAK,CAAC,iBAAiB,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;IACxD,CAAC;IAED;;;OAGG;IACI,SAAS;QACf,OAAO,iBAAiB,CAAC,UAAU,CAAC;IACrC,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,GAAG,CAAC,QAAmB;QACnC,MAAM,CAAC,MAAM,CAAY,iBAAiB,CAAC,UAAU,cAAoB,QAAQ,CAAC,CAAC;QAEnF,MAAM,IAAI,CAAC,KAAK,CAAqC,GAAG,EAAE,MAAM,EAAE;YACjE,IAAI,EAAE,QAAQ;SACd,CAAC,CAAC;IACJ,CAAC;IAED;;;;;;;;;;OAUG;IACI,KAAK,CAAC,KAAK,CACjB,KAAgB,EAChB,MAAe,EACf,SAAkB,EAClB,OAAgB,EAChB,MAAe,EACf,KAAc;QAWd,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,KAAK,CAA4C,GAAG,EAAE,KAAK,EAAE;YACxF,KAAK,EAAE;gBACN,KAAK;gBACL,MAAM;gBACN,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC;gBACnC,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC;gBAC/B,MAAM;gBACN,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC;aAC3B;SACD,CAAC,CAAC;QAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;IACtB,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { BaseRestClient } from \"@twin.org/api-core\";\nimport type { IBaseRestClientConfig, IOkResponse } from \"@twin.org/api-models\";\nimport { Coerce, Guards } from \"@twin.org/core\";\nimport type {\n\tILogEntry,\n\tILoggingComponent,\n\tILoggingCreateRequest,\n\tILoggingListRequest,\n\tILoggingListResponse,\n\tLogLevel\n} from \"@twin.org/logging-models\";\nimport { nameof } from \"@twin.org/nameof\";\n\n/**\n * Client for performing logging through to REST endpoints.\n */\nexport class LoggingRestClient extends BaseRestClient implements ILoggingComponent {\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<LoggingRestClient>();\n\n\t/**\n\t * Create a new instance of LoggingRestClient.\n\t * @param config The configuration for the client.\n\t */\n\tconstructor(config: IBaseRestClientConfig) {\n\t\tsuper(LoggingRestClient.CLASS_NAME, config, \"logging\");\n\t}\n\n\t/**\n\t * Returns the class name of the component.\n\t * @returns The class name of the component.\n\t */\n\tpublic className(): string {\n\t\treturn LoggingRestClient.CLASS_NAME;\n\t}\n\n\t/**\n\t * Log an entry to the connector.\n\t * @param logEntry The entry to log.\n\t * @returns A promise that resolves when the REST endpoint has accepted the entry.\n\t */\n\tpublic async log(logEntry: ILogEntry): Promise<void> {\n\t\tGuards.object<ILogEntry>(LoggingRestClient.CLASS_NAME, nameof(logEntry), logEntry);\n\n\t\tawait this.fetch<ILoggingCreateRequest, IOkResponse>(\"/\", \"POST\", {\n\t\t\tbody: logEntry\n\t\t});\n\t}\n\n\t/**\n\t * Query the log entries.\n\t * @param level The level of the log entries.\n\t * @param source The source of the log entries.\n\t * @param timeStart The inclusive time as the start of the log entries.\n\t * @param timeEnd The inclusive time as the end of the log entries.\n\t * @param cursor The cursor to request the next chunk of entities.\n\t * @param limit Limit the number of entities to return.\n\t * @returns All the entities for the storage matching the conditions,\n\t * and a cursor which can be used to request more entities.\n\t */\n\tpublic async query(\n\t\tlevel?: LogLevel,\n\t\tsource?: string,\n\t\ttimeStart?: number,\n\t\ttimeEnd?: number,\n\t\tcursor?: string,\n\t\tlimit?: number\n\t): Promise<{\n\t\t/**\n\t\t * The entities, which can be partial if a limited keys list was provided.\n\t\t */\n\t\tentities: ILogEntry[];\n\t\t/**\n\t\t * An optional cursor, when defined can be used to call find to get more entities.\n\t\t */\n\t\tcursor?: string;\n\t}> {\n\t\tconst response = await this.fetch<ILoggingListRequest, ILoggingListResponse>(\"/\", \"GET\", {\n\t\t\tquery: {\n\t\t\t\tlevel,\n\t\t\t\tsource,\n\t\t\t\ttimeStart: Coerce.string(timeStart),\n\t\t\t\ttimeEnd: Coerce.string(timeEnd),\n\t\t\t\tcursor,\n\t\t\t\tlimit: Coerce.string(limit)\n\t\t\t}\n\t\t});\n\n\t\treturn response.body;\n\t}\n}\n"]}
@@ -22,7 +22,7 @@ export declare class LoggingRestClient extends BaseRestClient implements ILoggin
22
22
  /**
23
23
  * Log an entry to the connector.
24
24
  * @param logEntry The entry to log.
25
- * @returns Nothing.
25
+ * @returns A promise that resolves when the REST endpoint has accepted the entry.
26
26
  */
27
27
  log(logEntry: ILogEntry): Promise<void>;
28
28
  /**
package/docs/changelog.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.0.3-next.8](https://github.com/iotaledger/twin-logging/compare/logging-rest-client-v0.0.3-next.7...logging-rest-client-v0.0.3-next.8) (2026-06-19)
4
+
5
+
6
+ ### Miscellaneous Chores
7
+
8
+ * **logging-rest-client:** Synchronize repo versions
9
+
10
+
11
+ ### Dependencies
12
+
13
+ * The following workspace dependencies were updated
14
+ * dependencies
15
+ * @twin.org/logging-models bumped from 0.0.3-next.7 to 0.0.3-next.8
16
+
3
17
  ## [0.0.3-next.7](https://github.com/iotaledger/twin-logging/compare/logging-rest-client-v0.0.3-next.6...logging-rest-client-v0.0.3-next.7) (2026-06-11)
4
18
 
5
19
 
@@ -80,7 +80,7 @@ The entry to log.
80
80
 
81
81
  `Promise`\<`void`\>
82
82
 
83
- Nothing.
83
+ A promise that resolves when the REST endpoint has accepted the entry.
84
84
 
85
85
  #### Implementation of
86
86
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/logging-rest-client",
3
- "version": "0.0.3-next.7",
3
+ "version": "0.0.3-next.8",
4
4
  "description": "Provides a client for interacting with logging service endpoints from applications and services.",
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.3-next.7",
21
+ "@twin.org/logging-models": "0.0.3-next.8",
22
22
  "@twin.org/nameof": "next"
23
23
  },
24
24
  "main": "./dist/es/index.js",