@twin.org/logging-service 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.
@@ -118,7 +118,7 @@ export function generateRestRoutesLogging(baseRouteName, componentName) {
118
118
  * @param httpRequestContext The request context for the API.
119
119
  * @param componentName The name of the component to use in the routes.
120
120
  * @param request The request.
121
- * @returns The response object with additional http response properties.
121
+ * @returns A promise that resolves to a no-content response when the entry has been logged.
122
122
  */
123
123
  export async function loggingCreate(httpRequestContext, componentName, request) {
124
124
  Guards.object(ROUTES_SOURCE, "request", request);
@@ -134,7 +134,7 @@ export async function loggingCreate(httpRequestContext, componentName, request)
134
134
  * @param httpRequestContext The request context for the API.
135
135
  * @param componentName The name of the component to use in the routes.
136
136
  * @param request The request.
137
- * @returns The response object with additional http response properties.
137
+ * @returns A promise that resolves to the matching log entries and an optional pagination cursor.
138
138
  */
139
139
  export async function loggingList(httpRequestContext, componentName, request) {
140
140
  const component = ComponentFactory.get(componentName);
@@ -1 +1 @@
1
- {"version":3,"file":"loggingRoutes.js","sourceRoot":"","sources":["../../src/loggingRoutes.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAQlE,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C;;GAEG;AACH,MAAM,aAAa,GAAG,eAAe,CAAC;AAEtC;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAW;IAClC;QACC,IAAI,EAAE,SAAS;QACf,WAAW,EAAE,4DAA4D;KACzE;CACD,CAAC;AAEF;;;;;GAKG;AACH,MAAM,UAAU,yBAAyB,CACxC,aAAqB,EACrB,aAAqB;IAErB,MAAM,WAAW,GAA0D;QAC1E,WAAW,EAAE,oBAAoB;QACjC,OAAO,EAAE,oBAAoB;QAC7B,GAAG,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI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M,CAAC,OAAO,EAAE,KAAK,EAAE,SAAS,CAAC,EACxC,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,EACtC,OAAO,EAAE,KAAK,EAAE,MAAM,EACtB,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,CACpC,CAAC;IACF,OAAO;QACN,IAAI,EAAE,cAAc;KACpB,CAAC;AACH,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type {\n\tIHttpRequestContext,\n\tINoContentResponse,\n\tIRestRoute,\n\tITag\n} from \"@twin.org/api-models\";\nimport { ComponentFactory, Coerce, Guards } from \"@twin.org/core\";\nimport type {\n\tILoggingComponent,\n\tILoggingCreateRequest,\n\tILoggingListRequest,\n\tILoggingListResponse\n} from \"@twin.org/logging-models\";\nimport { nameof } from \"@twin.org/nameof\";\nimport { HttpStatusCode } from \"@twin.org/web\";\n\n/**\n * The source used when communicating about these routes.\n */\nconst ROUTES_SOURCE = \"loggingRoutes\";\n\n/**\n * The tag to associate with the routes.\n */\nexport const tagsLogging: ITag[] = [\n\t{\n\t\tname: \"Logging\",\n\t\tdescription: \"Endpoints which are modelled to access a logging contract.\"\n\t}\n];\n\n/**\n * The REST routes for logging.\n * @param baseRouteName Prefix to prepend to the paths.\n * @param componentName The name of the component to use in the routes stored in the ComponentFactory.\n * @returns The generated routes.\n */\nexport function generateRestRoutesLogging(\n\tbaseRouteName: string,\n\tcomponentName: string\n): IRestRoute[] {\n\tconst createRoute: IRestRoute<ILoggingCreateRequest, INoContentResponse> = {\n\t\toperationId: \"loggingEntryCreate\",\n\t\tsummary: \"Create a log entry\",\n\t\ttag: tagsLogging[0].name,\n\t\tmethod: \"POST\",\n\t\tpath: `${baseRouteName}/`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tloggingCreate(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<ILoggingCreateRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"loggingEntryCreateInfoExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\tlevel: \"info\",\n\t\t\t\t\t\t\tmessage: \"This is an information message\",\n\t\t\t\t\t\t\tsource: \"source\",\n\t\t\t\t\t\t\tts: 1715252922273\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tid: \"loggingEntryCreateErrorExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\tlevel: \"info\",\n\t\t\t\t\t\t\tmessage: \"This is an error message\",\n\t\t\t\t\t\t\tsource: \"source\",\n\t\t\t\t\t\t\tts: 1715252922273,\n\t\t\t\t\t\t\terror: {\n\t\t\t\t\t\t\t\tname: \"GeneralError\",\n\t\t\t\t\t\t\t\tmessage: \"component.error\",\n\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\tfoo: \"bar\"\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<INoContentResponse>()\n\t\t\t}\n\t\t]\n\t};\n\n\tconst listRoute: IRestRoute<ILoggingListRequest, ILoggingListResponse> = {\n\t\toperationId: \"loggingListEntries\",\n\t\tsummary: \"Get a list of the log entries\",\n\t\ttag: tagsLogging[0].name,\n\t\tmethod: \"GET\",\n\t\tpath: `${baseRouteName}/`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tloggingList(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<ILoggingListRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"loggingListRequestExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tquery: {\n\t\t\t\t\t\t\tlevel: \"info\"\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<ILoggingListResponse>(),\n\t\t\t\texamples: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"listResponseExample\",\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\t\tentities: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tlevel: \"info\",\n\t\t\t\t\t\t\t\t\t\tmessage: \"This is an information message\",\n\t\t\t\t\t\t\t\t\t\tsource: \"source\",\n\t\t\t\t\t\t\t\t\t\tts: 1715252922273\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\tcursor: \"1\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t}\n\t\t]\n\t};\n\n\treturn [createRoute, listRoute];\n}\n\n/**\n * Create a new log entry.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function loggingCreate(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: ILoggingCreateRequest\n): Promise<INoContentResponse> {\n\tGuards.object<ILoggingCreateRequest>(ROUTES_SOURCE, nameof(request), request);\n\tGuards.object<ILoggingCreateRequest[\"body\"]>(ROUTES_SOURCE, nameof(request.body), request.body);\n\tconst component = ComponentFactory.get<ILoggingComponent>(componentName);\n\tawait component.log(request.body);\n\treturn {\n\t\tstatusCode: HttpStatusCode.noContent\n\t};\n}\n\n/**\n * Get a list of the logging entries.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes.\n * @param request The request.\n * @returns The response object with additional http response properties.\n */\nexport async function loggingList(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: ILoggingListRequest\n): Promise<ILoggingListResponse> {\n\tconst component = ComponentFactory.get<ILoggingComponent>(componentName);\n\n\tconst itemsAndCursor = await component.query(\n\t\trequest?.query?.level,\n\t\trequest?.query?.source,\n\t\tCoerce.number(request?.query?.timeStart),\n\t\tCoerce.number(request?.query?.timeEnd),\n\t\trequest?.query?.cursor,\n\t\tCoerce.number(request?.query?.limit)\n\t);\n\treturn {\n\t\tbody: itemsAndCursor\n\t};\n}\n"]}
1
+ {"version":3,"file":"loggingRoutes.js","sourceRoot":"","sources":["../../src/loggingRoutes.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAQlE,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C;;GAEG;AACH,MAAM,aAAa,GAAG,eAAe,CAAC;AAEtC;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAW;IAClC;QACC,IAAI,EAAE,SAAS;QACf,WAAW,EAAE,4DAA4D;KACzE;CACD,CAAC;AAEF;;;;;GAKG;AACH,MAAM,UAAU,yBAAyB,CACxC,aAAqB,EACrB,aAAqB;IAErB,MAAM,WAAW,GAA0D;QAC1E,WAAW,EAAE,oBAAoB;QACjC,OAAO,EAAE,oBAAoB;QAC7B,GAAG,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI;QACxB,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,GAAG,aAAa,GAAG;QACzB,OAAO,EAAE,KAAK,EAAE,kBAAkB,EAAE,OAAO,EAAE,EAAE,CAC9C,aAAa,CAAC,kBAAkB,EAAE,aAAa,EAAE,OAAO,CAAC;QAC1D,WAAW,EAAE;YACZ,IAAI,yBAAiC;YACrC,QAAQ,EAAE;gBACT;oBACC,EAAE,EAAE,+BAA+B;oBACnC,OAAO,EAAE;wBACR,IAAI,EAAE;4BACL,KAAK,EAAE,MAAM;4BACb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.0.\nimport type {\n\tIHttpRequestContext,\n\tINoContentResponse,\n\tIRestRoute,\n\tITag\n} from \"@twin.org/api-models\";\nimport { ComponentFactory, Coerce, Guards } from \"@twin.org/core\";\nimport type {\n\tILoggingComponent,\n\tILoggingCreateRequest,\n\tILoggingListRequest,\n\tILoggingListResponse\n} from \"@twin.org/logging-models\";\nimport { nameof } from \"@twin.org/nameof\";\nimport { HttpStatusCode } from \"@twin.org/web\";\n\n/**\n * The source used when communicating about these routes.\n */\nconst ROUTES_SOURCE = \"loggingRoutes\";\n\n/**\n * The tag to associate with the routes.\n */\nexport const tagsLogging: ITag[] = [\n\t{\n\t\tname: \"Logging\",\n\t\tdescription: \"Endpoints which are modelled to access a logging contract.\"\n\t}\n];\n\n/**\n * The REST routes for logging.\n * @param baseRouteName Prefix to prepend to the paths.\n * @param componentName The name of the component to use in the routes stored in the ComponentFactory.\n * @returns The generated routes.\n */\nexport function generateRestRoutesLogging(\n\tbaseRouteName: string,\n\tcomponentName: string\n): IRestRoute[] {\n\tconst createRoute: IRestRoute<ILoggingCreateRequest, INoContentResponse> = {\n\t\toperationId: \"loggingEntryCreate\",\n\t\tsummary: \"Create a log entry\",\n\t\ttag: tagsLogging[0].name,\n\t\tmethod: \"POST\",\n\t\tpath: `${baseRouteName}/`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tloggingCreate(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<ILoggingCreateRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"loggingEntryCreateInfoExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\tlevel: \"info\",\n\t\t\t\t\t\t\tmessage: \"This is an information message\",\n\t\t\t\t\t\t\tsource: \"source\",\n\t\t\t\t\t\t\tts: 1715252922273\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tid: \"loggingEntryCreateErrorExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\tlevel: \"info\",\n\t\t\t\t\t\t\tmessage: \"This is an error message\",\n\t\t\t\t\t\t\tsource: \"source\",\n\t\t\t\t\t\t\tts: 1715252922273,\n\t\t\t\t\t\t\terror: {\n\t\t\t\t\t\t\t\tname: \"GeneralError\",\n\t\t\t\t\t\t\t\tmessage: \"component.error\",\n\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\tfoo: \"bar\"\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<INoContentResponse>()\n\t\t\t}\n\t\t]\n\t};\n\n\tconst listRoute: IRestRoute<ILoggingListRequest, ILoggingListResponse> = {\n\t\toperationId: \"loggingListEntries\",\n\t\tsummary: \"Get a list of the log entries\",\n\t\ttag: tagsLogging[0].name,\n\t\tmethod: \"GET\",\n\t\tpath: `${baseRouteName}/`,\n\t\thandler: async (httpRequestContext, request) =>\n\t\t\tloggingList(httpRequestContext, componentName, request),\n\t\trequestType: {\n\t\t\ttype: nameof<ILoggingListRequest>(),\n\t\t\texamples: [\n\t\t\t\t{\n\t\t\t\t\tid: \"loggingListRequestExample\",\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tquery: {\n\t\t\t\t\t\t\tlevel: \"info\"\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\tresponseType: [\n\t\t\t{\n\t\t\t\ttype: nameof<ILoggingListResponse>(),\n\t\t\t\texamples: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"listResponseExample\",\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\tbody: {\n\t\t\t\t\t\t\t\tentities: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tlevel: \"info\",\n\t\t\t\t\t\t\t\t\t\tmessage: \"This is an information message\",\n\t\t\t\t\t\t\t\t\t\tsource: \"source\",\n\t\t\t\t\t\t\t\t\t\tts: 1715252922273\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\tcursor: \"1\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t}\n\t\t]\n\t};\n\n\treturn [createRoute, listRoute];\n}\n\n/**\n * Create a new log entry.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes.\n * @param request The request.\n * @returns A promise that resolves to a no-content response when the entry has been logged.\n */\nexport async function loggingCreate(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: ILoggingCreateRequest\n): Promise<INoContentResponse> {\n\tGuards.object<ILoggingCreateRequest>(ROUTES_SOURCE, nameof(request), request);\n\tGuards.object<ILoggingCreateRequest[\"body\"]>(ROUTES_SOURCE, nameof(request.body), request.body);\n\tconst component = ComponentFactory.get<ILoggingComponent>(componentName);\n\tawait component.log(request.body);\n\treturn {\n\t\tstatusCode: HttpStatusCode.noContent\n\t};\n}\n\n/**\n * Get a list of the logging entries.\n * @param httpRequestContext The request context for the API.\n * @param componentName The name of the component to use in the routes.\n * @param request The request.\n * @returns A promise that resolves to the matching log entries and an optional pagination cursor.\n */\nexport async function loggingList(\n\thttpRequestContext: IHttpRequestContext,\n\tcomponentName: string,\n\trequest: ILoggingListRequest\n): Promise<ILoggingListResponse> {\n\tconst component = ComponentFactory.get<ILoggingComponent>(componentName);\n\n\tconst itemsAndCursor = await component.query(\n\t\trequest?.query?.level,\n\t\trequest?.query?.source,\n\t\tCoerce.number(request?.query?.timeStart),\n\t\tCoerce.number(request?.query?.timeEnd),\n\t\trequest?.query?.cursor,\n\t\tCoerce.number(request?.query?.limit)\n\t);\n\treturn {\n\t\tbody: itemsAndCursor\n\t};\n}\n"]}
@@ -33,7 +33,7 @@ export class LoggingService {
33
33
  /**
34
34
  * Log an entry to the connector.
35
35
  * @param logEntry The entry to log.
36
- * @returns Nothing.
36
+ * @returns A promise that resolves when the underlying connector has accepted the entry.
37
37
  */
38
38
  async log(logEntry) {
39
39
  Guards.object(LoggingService.CLASS_NAME, "logEntry", logEntry);
@@ -1 +1 @@
1
- {"version":3,"file":"loggingService.js","sourceRoot":"","sources":["../../src/loggingService.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EACN,kBAAkB,EAClB,eAAe,EACf,aAAa,EAEb,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACN,uBAAuB,EAKvB,MAAM,0BAA0B,CAAC;AAIlC;;GAEG;AACH,MAAM,OAAO,cAAc;IAC1B;;OAEG;IACI,MAAM,CAAU,UAAU,oBAAoC;IAErE;;;OAGG;IACc,iBAAiB,CAAoB;IAEtD;;;OAGG;IACH,YAAY,OAA2C;QACtD,IAAI,CAAC,iBAAiB,GAAG,uBAAuB,CAAC,GAAG,CACnD,OAAO,EAAE,oBAAoB,IAAI,SAAS,CAC1C,CAAC;IACH,CAAC;IAED;;;OAGG;IACI,SAAS;QACf,OAAO,cAAc,CAAC,UAAU,CAAC;IAClC,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,GAAG,CAAC,QAAmB;QACnC,MAAM,CAAC,MAAM,CAAY,cAAc,CAAC,UAAU,cAAoB,QAAQ,CAAC,CAAC;QAEhF,MAAM,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAC5C,CAAC;IAED;;;;;;;;;;OAUG;IACI,KAAK,CAAC,KAAK,CACjB,KAAgB,EAChB,MAAe,EACf,SAAkB,EAClB,OAAgB,EAChB,MAAe,EACf,KAAc;QAWd,MAAM,SAAS,GAAuD;YACrE,UAAU,EAAE,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AU,EAAE,CAAC,EAC7D,SAAS,EACT,MAAM,EACN,KAAK,CACL,CAAC;YAEF,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAuB,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC;QAC5E,CAAC;QAED,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;IACzB,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { Guards, Is } from \"@twin.org/core\";\nimport {\n\tComparisonOperator,\n\tLogicalOperator,\n\tSortDirection,\n\ttype EntityCondition\n} from \"@twin.org/entity\";\nimport {\n\tLoggingConnectorFactory,\n\ttype ILogEntry,\n\ttype ILoggingComponent,\n\ttype ILoggingConnector,\n\ttype LogLevel\n} from \"@twin.org/logging-models\";\nimport { nameof } from \"@twin.org/nameof\";\nimport type { ILoggingServiceConstructorOptions } from \"./models/ILoggingServiceConstructorOptions.js\";\n\n/**\n * Service for performing logging operations to a connector.\n */\nexport class LoggingService implements ILoggingComponent {\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<LoggingService>();\n\n\t/**\n\t * Logging connector used by the service.\n\t * @internal\n\t */\n\tprivate readonly _loggingConnector: ILoggingConnector;\n\n\t/**\n\t * Create a new instance of LoggingService.\n\t * @param options The options for the connector.\n\t */\n\tconstructor(options?: ILoggingServiceConstructorOptions) {\n\t\tthis._loggingConnector = LoggingConnectorFactory.get(\n\t\t\toptions?.loggingConnectorType ?? \"logging\"\n\t\t);\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 LoggingService.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>(LoggingService.CLASS_NAME, nameof(logEntry), logEntry);\n\n\t\tawait this._loggingConnector.log(logEntry);\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 condition: EntityCondition<Omit<ILogEntry, \"error\" | \"data\">> = {\n\t\t\tconditions: [],\n\t\t\tlogicalOperator: LogicalOperator.And\n\t\t};\n\n\t\tif (Is.stringValue(level)) {\n\t\t\tcondition.conditions.push({\n\t\t\t\tproperty: \"level\",\n\t\t\t\tcomparison: ComparisonOperator.Equals,\n\t\t\t\tvalue: level\n\t\t\t});\n\t\t}\n\n\t\tif (Is.stringValue(source)) {\n\t\t\tcondition.conditions.push({\n\t\t\t\tproperty: \"source\",\n\t\t\t\tcomparison: ComparisonOperator.Equals,\n\t\t\t\tvalue: source\n\t\t\t});\n\t\t}\n\n\t\tif (Is.number(timeStart)) {\n\t\t\tcondition.conditions.push({\n\t\t\t\tproperty: \"ts\",\n\t\t\t\tcomparison: ComparisonOperator.GreaterThanOrEqual,\n\t\t\t\tvalue: timeStart\n\t\t\t});\n\t\t}\n\n\t\tif (Is.number(timeEnd)) {\n\t\t\tcondition.conditions.push({\n\t\t\t\tproperty: \"ts\",\n\t\t\t\tcomparison: ComparisonOperator.LessThanOrEqual,\n\t\t\t\tvalue: timeEnd\n\t\t\t});\n\t\t}\n\n\t\tconst queryConnector = this._loggingConnector?.query?.bind(this._loggingConnector);\n\t\tif (Is.function(queryConnector)) {\n\t\t\tconst result = await queryConnector(\n\t\t\t\tcondition,\n\t\t\t\t[{ property: \"ts\", sortDirection: SortDirection.Descending }],\n\t\t\t\tundefined,\n\t\t\t\tcursor,\n\t\t\t\tlimit\n\t\t\t);\n\n\t\t\treturn { entities: result.entities as ILogEntry[], cursor: result.cursor };\n\t\t}\n\n\t\treturn { entities: [] };\n\t}\n}\n"]}
1
+ {"version":3,"file":"loggingService.js","sourceRoot":"","sources":["../../src/loggingService.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EACN,kBAAkB,EAClB,eAAe,EACf,aAAa,EAEb,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACN,uBAAuB,EAKvB,MAAM,0BAA0B,CAAC;AAIlC;;GAEG;AACH,MAAM,OAAO,cAAc;IAC1B;;OAEG;IACI,MAAM,CAAU,UAAU,oBAAoC;IAErE;;;OAGG;IACc,iBAAiB,CAAoB;IAEtD;;;OAGG;IACH,YAAY,OAA2C;QACtD,IAAI,CAAC,iBAAiB,GAAG,uBAAuB,CAAC,GAAG,CACnD,OAAO,EAAE,oBAAoB,IAAI,SAAS,CAC1C,CAAC;IACH,CAAC;IAED;;;OAGG;IACI,SAAS;QACf,OAAO,cAAc,CAAC,UAAU,CAAC;IAClC,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,GAAG,CAAC,QAAmB;QACnC,MAAM,CAAC,MAAM,CAAY,cAAc,CAAC,UAAU,cAAoB,QAAQ,CAAC,CAAC;QAEhF,MAAM,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAC5C,CAAC;IAED;;;;;;;;;;OAUG;IACI,KAAK,CAAC,KAAK,CACjB,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MAAM,MAAM,GAAG,MAAM,cAAc,CAClC,SAAS,EACT,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,aAAa,EAAE,aAAa,CAAC,UAAU,EAAE,CAAC,EAC7D,SAAS,EACT,MAAM,EACN,KAAK,CACL,CAAC;YAEF,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAuB,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC;QAC5E,CAAC;QAED,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;IACzB,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { Guards, Is } from \"@twin.org/core\";\nimport {\n\tComparisonOperator,\n\tLogicalOperator,\n\tSortDirection,\n\ttype EntityCondition\n} from \"@twin.org/entity\";\nimport {\n\tLoggingConnectorFactory,\n\ttype ILogEntry,\n\ttype ILoggingComponent,\n\ttype ILoggingConnector,\n\ttype LogLevel\n} from \"@twin.org/logging-models\";\nimport { nameof } from \"@twin.org/nameof\";\nimport type { ILoggingServiceConstructorOptions } from \"./models/ILoggingServiceConstructorOptions.js\";\n\n/**\n * Service for performing logging operations to a connector.\n */\nexport class LoggingService implements ILoggingComponent {\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<LoggingService>();\n\n\t/**\n\t * Logging connector used by the service.\n\t * @internal\n\t */\n\tprivate readonly _loggingConnector: ILoggingConnector;\n\n\t/**\n\t * Create a new instance of LoggingService.\n\t * @param options The options for the connector.\n\t */\n\tconstructor(options?: ILoggingServiceConstructorOptions) {\n\t\tthis._loggingConnector = LoggingConnectorFactory.get(\n\t\t\toptions?.loggingConnectorType ?? \"logging\"\n\t\t);\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 LoggingService.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 underlying connector has accepted the entry.\n\t */\n\tpublic async log(logEntry: ILogEntry): Promise<void> {\n\t\tGuards.object<ILogEntry>(LoggingService.CLASS_NAME, nameof(logEntry), logEntry);\n\n\t\tawait this._loggingConnector.log(logEntry);\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 condition: EntityCondition<Omit<ILogEntry, \"error\" | \"data\">> = {\n\t\t\tconditions: [],\n\t\t\tlogicalOperator: LogicalOperator.And\n\t\t};\n\n\t\tif (Is.stringValue(level)) {\n\t\t\tcondition.conditions.push({\n\t\t\t\tproperty: \"level\",\n\t\t\t\tcomparison: ComparisonOperator.Equals,\n\t\t\t\tvalue: level\n\t\t\t});\n\t\t}\n\n\t\tif (Is.stringValue(source)) {\n\t\t\tcondition.conditions.push({\n\t\t\t\tproperty: \"source\",\n\t\t\t\tcomparison: ComparisonOperator.Equals,\n\t\t\t\tvalue: source\n\t\t\t});\n\t\t}\n\n\t\tif (Is.number(timeStart)) {\n\t\t\tcondition.conditions.push({\n\t\t\t\tproperty: \"ts\",\n\t\t\t\tcomparison: ComparisonOperator.GreaterThanOrEqual,\n\t\t\t\tvalue: timeStart\n\t\t\t});\n\t\t}\n\n\t\tif (Is.number(timeEnd)) {\n\t\t\tcondition.conditions.push({\n\t\t\t\tproperty: \"ts\",\n\t\t\t\tcomparison: ComparisonOperator.LessThanOrEqual,\n\t\t\t\tvalue: timeEnd\n\t\t\t});\n\t\t}\n\n\t\tconst queryConnector = this._loggingConnector?.query?.bind(this._loggingConnector);\n\t\tif (Is.function(queryConnector)) {\n\t\t\tconst result = await queryConnector(\n\t\t\t\tcondition,\n\t\t\t\t[{ property: \"ts\", sortDirection: SortDirection.Descending }],\n\t\t\t\tundefined,\n\t\t\t\tcursor,\n\t\t\t\tlimit\n\t\t\t);\n\n\t\t\treturn { entities: result.entities as ILogEntry[], cursor: result.cursor };\n\t\t}\n\n\t\treturn { entities: [] };\n\t}\n}\n"]}
@@ -1,4 +1,7 @@
1
1
  import { generateRestRoutesLogging, tagsLogging } from "./loggingRoutes.js";
2
+ /**
3
+ * REST entry points for the logging service.
4
+ */
2
5
  export const restEntryPoints = [
3
6
  {
4
7
  name: "logging",
@@ -1 +1 @@
1
- {"version":3,"file":"restEntryPoints.js","sourceRoot":"","sources":["../../src/restEntryPoints.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,yBAAyB,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAE5E,MAAM,CAAC,MAAM,eAAe,GAA2B;IACtD;QACC,IAAI,EAAE,SAAS;QACf,gBAAgB,EAAE,SAAS;QAC3B,IAAI,EAAE,WAAW;QACjB,cAAc,EAAE,yBAAyB;KACzC;CACD,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IRestRouteEntryPoint } from \"@twin.org/api-models\";\nimport { generateRestRoutesLogging, tagsLogging } from \"./loggingRoutes.js\";\n\nexport const restEntryPoints: IRestRouteEntryPoint[] = [\n\t{\n\t\tname: \"logging\",\n\t\tdefaultBaseRoute: \"logging\",\n\t\ttags: tagsLogging,\n\t\tgenerateRoutes: generateRestRoutesLogging\n\t}\n];\n"]}
1
+ {"version":3,"file":"restEntryPoints.js","sourceRoot":"","sources":["../../src/restEntryPoints.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,yBAAyB,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAE5E;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAA2B;IACtD;QACC,IAAI,EAAE,SAAS;QACf,gBAAgB,EAAE,SAAS;QAC3B,IAAI,EAAE,WAAW;QACjB,cAAc,EAAE,yBAAyB;KACzC;CACD,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IRestRouteEntryPoint } from \"@twin.org/api-models\";\nimport { generateRestRoutesLogging, tagsLogging } from \"./loggingRoutes.js\";\n\n/**\n * REST entry points for the logging service.\n */\nexport const restEntryPoints: IRestRouteEntryPoint[] = [\n\t{\n\t\tname: \"logging\",\n\t\tdefaultBaseRoute: \"logging\",\n\t\ttags: tagsLogging,\n\t\tgenerateRoutes: generateRestRoutesLogging\n\t}\n];\n"]}
@@ -16,7 +16,7 @@ export declare function generateRestRoutesLogging(baseRouteName: string, compone
16
16
  * @param httpRequestContext The request context for the API.
17
17
  * @param componentName The name of the component to use in the routes.
18
18
  * @param request The request.
19
- * @returns The response object with additional http response properties.
19
+ * @returns A promise that resolves to a no-content response when the entry has been logged.
20
20
  */
21
21
  export declare function loggingCreate(httpRequestContext: IHttpRequestContext, componentName: string, request: ILoggingCreateRequest): Promise<INoContentResponse>;
22
22
  /**
@@ -24,6 +24,6 @@ export declare function loggingCreate(httpRequestContext: IHttpRequestContext, c
24
24
  * @param httpRequestContext The request context for the API.
25
25
  * @param componentName The name of the component to use in the routes.
26
26
  * @param request The request.
27
- * @returns The response object with additional http response properties.
27
+ * @returns A promise that resolves to the matching log entries and an optional pagination cursor.
28
28
  */
29
29
  export declare function loggingList(httpRequestContext: IHttpRequestContext, componentName: string, request: ILoggingListRequest): Promise<ILoggingListResponse>;
@@ -21,7 +21,7 @@ export declare class LoggingService implements ILoggingComponent {
21
21
  /**
22
22
  * Log an entry to the connector.
23
23
  * @param logEntry The entry to log.
24
- * @returns Nothing.
24
+ * @returns A promise that resolves when the underlying connector has accepted the entry.
25
25
  */
26
26
  log(logEntry: ILogEntry): Promise<void>;
27
27
  /**
@@ -1,2 +1,5 @@
1
1
  import type { IRestRouteEntryPoint } from "@twin.org/api-models";
2
+ /**
3
+ * REST entry points for the logging service.
4
+ */
2
5
  export declare const restEntryPoints: IRestRouteEntryPoint[];
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-service-v0.0.3-next.7...logging-service-v0.0.3-next.8) (2026-06-19)
4
+
5
+
6
+ ### Miscellaneous Chores
7
+
8
+ * **logging-service:** 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-service-v0.0.3-next.6...logging-service-v0.0.3-next.7) (2026-06-11)
4
18
 
5
19
 
@@ -72,7 +72,7 @@ The entry to log.
72
72
 
73
73
  `Promise`\<`void`\>
74
74
 
75
- Nothing.
75
+ A promise that resolves when the underlying connector has accepted the entry.
76
76
 
77
77
  #### Implementation of
78
78
 
@@ -28,4 +28,4 @@ The request.
28
28
 
29
29
  `Promise`\<`INoContentResponse`\>
30
30
 
31
- The response object with additional http response properties.
31
+ A promise that resolves to a no-content response when the entry has been logged.
@@ -28,4 +28,4 @@ The request.
28
28
 
29
29
  `Promise`\<`ILoggingListResponse`\>
30
30
 
31
- The response object with additional http response properties.
31
+ A promise that resolves to the matching log entries and an optional pagination cursor.
@@ -1,3 +1,5 @@
1
1
  # Variable: restEntryPoints
2
2
 
3
3
  > `const` **restEntryPoints**: `IRestRouteEntryPoint`[]
4
+
5
+ REST entry points for the logging service.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/logging-service",
3
- "version": "0.0.3-next.7",
3
+ "version": "0.0.3-next.8",
4
4
  "description": "Exposes logging operations through service routes and API contracts for server-side integration.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -17,7 +17,7 @@
17
17
  "@twin.org/api-models": "next",
18
18
  "@twin.org/core": "next",
19
19
  "@twin.org/entity": "next",
20
- "@twin.org/logging-models": "0.0.3-next.7",
20
+ "@twin.org/logging-models": "0.0.3-next.8",
21
21
  "@twin.org/nameof": "next",
22
22
  "@twin.org/web": "next"
23
23
  },