@twin.org/api-rest-client 0.0.2-next.9 → 0.0.3-next.2

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.
@@ -0,0 +1,4 @@
1
+ // Copyright 2024 IOTA Stiftung.
2
+ // SPDX-License-Identifier: Apache-2.0.
3
+ export * from "./informationRestClient.js";
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,cAAc,4BAA4B,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nexport * from \"./informationRestClient.js\";\n"]}
@@ -1,24 +1,28 @@
1
- 'use strict';
2
-
3
- var apiCore = require('@twin.org/api-core');
4
- var core = require('@twin.org/core');
5
-
6
1
  // Copyright 2024 IOTA Stiftung.
7
2
  // SPDX-License-Identifier: Apache-2.0.
3
+ import { BaseRestClient } from "@twin.org/api-core";
4
+ import { NotSupportedError } from "@twin.org/core";
8
5
  /**
9
6
  * The client to connect to the information service.
10
7
  */
11
- class InformationClient extends apiCore.BaseRestClient {
8
+ export class InformationRestClient extends BaseRestClient {
12
9
  /**
13
10
  * Runtime name for the class.
14
11
  */
15
- CLASS_NAME = "InformationClient";
12
+ static CLASS_NAME = "InformationRestClient";
16
13
  /**
17
- * Create a new instance of InformationClient.
14
+ * Create a new instance of InformationRestClient.
18
15
  * @param config The configuration for the client.
19
16
  */
20
17
  constructor(config) {
21
- super("InformationClient", config, "");
18
+ super("InformationRestClient", config, "");
19
+ }
20
+ /**
21
+ * Returns the class name of the component.
22
+ * @returns The class name of the component.
23
+ */
24
+ className() {
25
+ return InformationRestClient.CLASS_NAME;
22
26
  }
23
27
  /**
24
28
  * Get the server root.
@@ -68,7 +72,7 @@ class InformationClient extends apiCore.BaseRestClient {
68
72
  * @returns Nothing.
69
73
  */
70
74
  async setComponentHealth(name, status, details) {
71
- throw new core.NotSupportedError(this.CLASS_NAME, "\"setComponentHealth\"");
75
+ throw new NotSupportedError(InformationRestClient.CLASS_NAME, "\"setComponentHealth\"");
72
76
  }
73
77
  /**
74
78
  * Remove the status of a component.
@@ -76,8 +80,7 @@ class InformationClient extends apiCore.BaseRestClient {
76
80
  * @returns Nothing.
77
81
  */
78
82
  async removeComponentHealth(name) {
79
- throw new core.NotSupportedError(this.CLASS_NAME, "\"removeComponentHealth\"");
83
+ throw new NotSupportedError(InformationRestClient.CLASS_NAME, "\"removeComponentHealth\"");
80
84
  }
81
85
  }
82
-
83
- exports.InformationClient = InformationClient;
86
+ //# sourceMappingURL=informationRestClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"informationRestClient.js","sourceRoot":"","sources":["../../src/informationRestClient.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAcpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAGnD;;GAEG;AACH,MAAM,OAAO,qBAAsB,SAAQ,cAAc;IACxD;;OAEG;IACI,MAAM,CAAU,UAAU,2BAA2C;IAE5E;;;OAGG;IACH,YAAY,MAA6B;QACxC,KAAK,0BAAkC,MAAM,EAAE,EAAE,CAAC,CAAC;IACpD,CAAC;IAED;;;OAGG;IACI,SAAS;QACf,OAAO,qBAAqB,CAAC,UAAU,CAAC;IACzC,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,IAAI;QAChB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,KAAK,CAAyC,GAAG,EAAE,KAAK,CAAC,CAAC;QACtF,OAAO,QAAQ,CAAC,IAAI,CAAC;IACtB,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,IAAI;QAChB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,KAAK,CAAyC,OAAO,EAAE,KAAK,CAAC,CAAC;QAC1F,OAAO,QAAQ,CAAC,IAAI,CAAC;IACtB,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,OAAO;QACnB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,KAAK,CAChC,cAAc,EACd,KAAK,CACL,CAAC;QACF,OAAO,QAAQ,CAAC,IAAI,CAAC;IACtB,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,IAAI;QAChB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,KAAK,CAAyC,OAAO,EAAE,KAAK,CAAC,CAAC;QAC1F,OAAO,QAAQ,CAAC,IAAI,CAAC;IACtB,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,MAAM;QAClB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,KAAK,CAA2C,SAAS,EAAE,KAAK,CAAC,CAAC;QAC9F,OAAO,QAAQ,CAAC,IAAI,CAAC;IACtB,CAAC;IAED;;;;;;OAMG;IACI,KAAK,CAAC,kBAAkB,CAC9B,IAAY,EACZ,MAAoB,EACpB,OAAgB;QAEhB,MAAM,IAAI,iBAAiB,CAAC,qBAAqB,CAAC,UAAU,2BAA+B,CAAC;IAC7F,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,qBAAqB,CAAC,IAAY;QAC9C,MAAM,IAAI,iBAAiB,CAAC,qBAAqB,CAAC,UAAU,8BAAkC,CAAC;IAChG,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { BaseRestClient } from \"@twin.org/api-core\";\nimport type {\n\tHealthStatus,\n\tIBaseRestClientConfig,\n\tIHealthInfo,\n\tIInformationComponent,\n\tINoContentRequest,\n\tIServerFavIconResponse,\n\tIServerHealthResponse,\n\tIServerInfo,\n\tIServerInfoResponse,\n\tIServerRootResponse,\n\tIServerSpecResponse\n} from \"@twin.org/api-models\";\nimport { NotSupportedError } from \"@twin.org/core\";\nimport { nameof } from \"@twin.org/nameof\";\n\n/**\n * The client to connect to the information service.\n */\nexport class InformationRestClient extends BaseRestClient implements IInformationComponent {\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<InformationRestClient>();\n\n\t/**\n\t * Create a new instance of InformationRestClient.\n\t * @param config The configuration for the client.\n\t */\n\tconstructor(config: IBaseRestClientConfig) {\n\t\tsuper(nameof<InformationRestClient>(), config, \"\");\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 InformationRestClient.CLASS_NAME;\n\t}\n\n\t/**\n\t * Get the server root.\n\t * @returns The root root.\n\t */\n\tpublic async root(): Promise<string> {\n\t\tconst response = await this.fetch<INoContentRequest, IServerRootResponse>(\"/\", \"GET\");\n\t\treturn response.body;\n\t}\n\n\t/**\n\t * Get the server information.\n\t * @returns The service information.\n\t */\n\tpublic async info(): Promise<IServerInfo> {\n\t\tconst response = await this.fetch<INoContentRequest, IServerInfoResponse>(\"/info\", \"GET\");\n\t\treturn response.body;\n\t}\n\n\t/**\n\t * Get the favicon.\n\t * @returns The favicon.\n\t */\n\tpublic async favicon(): Promise<Uint8Array | undefined> {\n\t\tconst response = await this.fetch<INoContentRequest, IServerFavIconResponse>(\n\t\t\t\"/favicon.ico\",\n\t\t\t\"GET\"\n\t\t);\n\t\treturn response.body;\n\t}\n\n\t/**\n\t * Get the OpenAPI spec.\n\t * @returns The OpenAPI spec.\n\t */\n\tpublic async spec(): Promise<unknown> {\n\t\tconst response = await this.fetch<INoContentRequest, IServerSpecResponse>(\"/spec\", \"GET\");\n\t\treturn response.body;\n\t}\n\n\t/**\n\t * Get the server health.\n\t * @returns The service health.\n\t */\n\tpublic async health(): Promise<IHealthInfo> {\n\t\tconst response = await this.fetch<INoContentRequest, IServerHealthResponse>(\"/health\", \"GET\");\n\t\treturn response.body;\n\t}\n\n\t/**\n\t * Set the status of a component.\n\t * @param name The component name.\n\t * @param status The status of the component.\n\t * @param details The details for the status.\n\t * @returns Nothing.\n\t */\n\tpublic async setComponentHealth(\n\t\tname: string,\n\t\tstatus: HealthStatus,\n\t\tdetails?: string\n\t): Promise<void> {\n\t\tthrow new NotSupportedError(InformationRestClient.CLASS_NAME, nameof(\"setComponentHealth\"));\n\t}\n\n\t/**\n\t * Remove the status of a component.\n\t * @param name The component name.\n\t * @returns Nothing.\n\t */\n\tpublic async removeComponentHealth(name: string): Promise<void> {\n\t\tthrow new NotSupportedError(InformationRestClient.CLASS_NAME, nameof(\"removeComponentHealth\"));\n\t}\n}\n"]}
@@ -1 +1 @@
1
- export * from "./informationClient";
1
+ export * from "./informationRestClient.js";
@@ -3,16 +3,21 @@ import type { HealthStatus, IBaseRestClientConfig, IHealthInfo, IInformationComp
3
3
  /**
4
4
  * The client to connect to the information service.
5
5
  */
6
- export declare class InformationClient extends BaseRestClient implements IInformationComponent {
6
+ export declare class InformationRestClient extends BaseRestClient implements IInformationComponent {
7
7
  /**
8
8
  * Runtime name for the class.
9
9
  */
10
- readonly CLASS_NAME: string;
10
+ static readonly CLASS_NAME: string;
11
11
  /**
12
- * Create a new instance of InformationClient.
12
+ * Create a new instance of InformationRestClient.
13
13
  * @param config The configuration for the client.
14
14
  */
15
15
  constructor(config: IBaseRestClientConfig);
16
+ /**
17
+ * Returns the class name of the component.
18
+ * @returns The class name of the component.
19
+ */
20
+ className(): string;
16
21
  /**
17
22
  * Get the server root.
18
23
  * @returns The root root.
package/docs/changelog.md CHANGED
@@ -1,5 +1,107 @@
1
1
  # @twin.org/api-rest-client - Changelog
2
2
 
3
+ ## [0.0.3-next.2](https://github.com/twinfoundation/api/compare/api-rest-client-v0.0.3-next.1...api-rest-client-v0.0.3-next.2) (2025-11-12)
4
+
5
+
6
+ ### Miscellaneous Chores
7
+
8
+ * **api-rest-client:** Synchronize repo versions
9
+
10
+
11
+ ### Dependencies
12
+
13
+ * The following workspace dependencies were updated
14
+ * dependencies
15
+ * @twin.org/api-core bumped from 0.0.3-next.1 to 0.0.3-next.2
16
+ * @twin.org/api-models bumped from 0.0.3-next.1 to 0.0.3-next.2
17
+
18
+ ## [0.0.3-next.1](https://github.com/twinfoundation/api/compare/api-rest-client-v0.0.3-next.0...api-rest-client-v0.0.3-next.1) (2025-11-10)
19
+
20
+
21
+ ### Features
22
+
23
+ * add context id features ([#42](https://github.com/twinfoundation/api/issues/42)) ([0186055](https://github.com/twinfoundation/api/commit/0186055c48afde842a4254b4df9ac9249c40fe40))
24
+ * add root, favicon routes ([71da1c3](https://github.com/twinfoundation/api/commit/71da1c3a93c349588aff7084d1d8d6a29a277da8))
25
+ * add validate-locales ([cdba610](https://github.com/twinfoundation/api/commit/cdba610a0acb5022d2e3ce729732e6646a297e5e))
26
+ * eslint migration to flat config ([0dd5820](https://github.com/twinfoundation/api/commit/0dd5820e3af97350fd08b8d226f4a6c1a9246805))
27
+ * update dependencies ([1171dc4](https://github.com/twinfoundation/api/commit/1171dc416a9481737f6a640e3cf30145768f37e9))
28
+ * update framework core ([d8eebf2](https://github.com/twinfoundation/api/commit/d8eebf267fa2a0abaa84e58590496e9d20490cfa))
29
+ * update IComponent signatures ([915ce37](https://github.com/twinfoundation/api/commit/915ce37712326ab4aa6869c350eabaa4622e8430))
30
+ * use shared store mechanism ([#19](https://github.com/twinfoundation/api/issues/19)) ([32116df](https://github.com/twinfoundation/api/commit/32116df3b4380a30137f5056f242a5c99afa2df9))
31
+
32
+
33
+ ### Bug Fixes
34
+
35
+ * use correct format for log messaging ([1d28474](https://github.com/twinfoundation/api/commit/1d284744589aa7875327ccc053446f655f2a7f62))
36
+
37
+
38
+ ### Dependencies
39
+
40
+ * The following workspace dependencies were updated
41
+ * dependencies
42
+ * @twin.org/api-core bumped from 0.0.3-next.0 to 0.0.3-next.1
43
+ * @twin.org/api-models bumped from 0.0.3-next.0 to 0.0.3-next.1
44
+
45
+ ## [0.0.2-next.13](https://github.com/twinfoundation/api/compare/api-rest-client-v0.0.2-next.12...api-rest-client-v0.0.2-next.13) (2025-10-09)
46
+
47
+
48
+ ### Miscellaneous Chores
49
+
50
+ * **api-rest-client:** Synchronize repo versions
51
+
52
+
53
+ ### Dependencies
54
+
55
+ * The following workspace dependencies were updated
56
+ * dependencies
57
+ * @twin.org/api-core bumped from 0.0.2-next.12 to 0.0.2-next.13
58
+ * @twin.org/api-models bumped from 0.0.2-next.12 to 0.0.2-next.13
59
+
60
+ ## [0.0.2-next.12](https://github.com/twinfoundation/api/compare/api-rest-client-v0.0.2-next.11...api-rest-client-v0.0.2-next.12) (2025-10-09)
61
+
62
+
63
+ ### Features
64
+
65
+ * add validate-locales ([cdba610](https://github.com/twinfoundation/api/commit/cdba610a0acb5022d2e3ce729732e6646a297e5e))
66
+
67
+
68
+ ### Dependencies
69
+
70
+ * The following workspace dependencies were updated
71
+ * dependencies
72
+ * @twin.org/api-core bumped from 0.0.2-next.11 to 0.0.2-next.12
73
+ * @twin.org/api-models bumped from 0.0.2-next.11 to 0.0.2-next.12
74
+
75
+ ## [0.0.2-next.11](https://github.com/twinfoundation/api/compare/api-rest-client-v0.0.2-next.10...api-rest-client-v0.0.2-next.11) (2025-09-29)
76
+
77
+
78
+ ### Features
79
+
80
+ * update IComponent signatures ([915ce37](https://github.com/twinfoundation/api/commit/915ce37712326ab4aa6869c350eabaa4622e8430))
81
+
82
+
83
+ ### Dependencies
84
+
85
+ * The following workspace dependencies were updated
86
+ * dependencies
87
+ * @twin.org/api-core bumped from 0.0.2-next.10 to 0.0.2-next.11
88
+ * @twin.org/api-models bumped from 0.0.2-next.10 to 0.0.2-next.11
89
+
90
+ ## [0.0.2-next.10](https://github.com/twinfoundation/api/compare/api-rest-client-v0.0.2-next.9...api-rest-client-v0.0.2-next.10) (2025-09-23)
91
+
92
+
93
+ ### Miscellaneous Chores
94
+
95
+ * **api-rest-client:** Synchronize repo versions
96
+
97
+
98
+ ### Dependencies
99
+
100
+ * The following workspace dependencies were updated
101
+ * dependencies
102
+ * @twin.org/api-core bumped from 0.0.2-next.9 to 0.0.2-next.10
103
+ * @twin.org/api-models bumped from 0.0.2-next.9 to 0.0.2-next.10
104
+
3
105
  ## [0.0.2-next.9](https://github.com/twinfoundation/api/compare/api-rest-client-v0.0.2-next.8...api-rest-client-v0.0.2-next.9) (2025-08-29)
4
106
 
5
107
 
@@ -1,4 +1,4 @@
1
- # Class: InformationClient
1
+ # Class: InformationRestClient
2
2
 
3
3
  The client to connect to the information service.
4
4
 
@@ -14,9 +14,9 @@ The client to connect to the information service.
14
14
 
15
15
  ### Constructor
16
16
 
17
- > **new InformationClient**(`config`): `InformationClient`
17
+ > **new InformationRestClient**(`config`): `InformationRestClient`
18
18
 
19
- Create a new instance of InformationClient.
19
+ Create a new instance of InformationRestClient.
20
20
 
21
21
  #### Parameters
22
22
 
@@ -28,7 +28,7 @@ The configuration for the client.
28
28
 
29
29
  #### Returns
30
30
 
31
- `InformationClient`
31
+ `InformationRestClient`
32
32
 
33
33
  #### Overrides
34
34
 
@@ -38,15 +38,29 @@ 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
+ ## Methods
46
+
47
+ ### className()
48
+
49
+ > **className**(): `string`
50
+
51
+ Returns the class name of the component.
52
+
53
+ #### Returns
54
+
55
+ `string`
56
+
57
+ The class name of the component.
58
+
45
59
  #### Implementation of
46
60
 
47
- `IInformationComponent.CLASS_NAME`
61
+ `IInformationComponent.className`
48
62
 
49
- ## Methods
63
+ ***
50
64
 
51
65
  ### root()
52
66
 
@@ -86,13 +100,13 @@ The service information.
86
100
 
87
101
  ### favicon()
88
102
 
89
- > **favicon**(): `Promise`\<`undefined` \| `Uint8Array`\<`ArrayBufferLike`\>\>
103
+ > **favicon**(): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\> \| `undefined`\>
90
104
 
91
105
  Get the favicon.
92
106
 
93
107
  #### Returns
94
108
 
95
- `Promise`\<`undefined` \| `Uint8Array`\<`ArrayBufferLike`\>\>
109
+ `Promise`\<`Uint8Array`\<`ArrayBufferLike`\> \| `undefined`\>
96
110
 
97
111
  The favicon.
98
112
 
@@ -2,4 +2,4 @@
2
2
 
3
3
  ## Classes
4
4
 
5
- - [InformationClient](classes/InformationClient.md)
5
+ - [InformationRestClient](classes/InformationRestClient.md)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/api-rest-client",
3
- "version": "0.0.2-next.9",
3
+ "version": "0.0.3-next.2",
4
4
  "description": "Information contract implementation which can connect to REST endpoints",
5
5
  "repository": {
6
6
  "type": "git",
@@ -14,27 +14,37 @@
14
14
  "node": ">=20.0.0"
15
15
  },
16
16
  "dependencies": {
17
- "@twin.org/api-core": "0.0.2-next.9",
18
- "@twin.org/api-models": "0.0.2-next.9",
17
+ "@twin.org/api-core": "0.0.3-next.2",
18
+ "@twin.org/api-models": "0.0.3-next.2",
19
19
  "@twin.org/core": "next",
20
20
  "@twin.org/nameof": "next",
21
21
  "@twin.org/web": "next"
22
22
  },
23
- "main": "./dist/cjs/index.cjs",
24
- "module": "./dist/esm/index.mjs",
23
+ "main": "./dist/es/index.js",
25
24
  "types": "./dist/types/index.d.ts",
26
25
  "exports": {
27
26
  ".": {
28
27
  "types": "./dist/types/index.d.ts",
29
- "require": "./dist/cjs/index.cjs",
30
- "import": "./dist/esm/index.mjs"
28
+ "import": "./dist/es/index.js",
29
+ "default": "./dist/es/index.js"
31
30
  }
32
31
  },
33
32
  "files": [
34
- "dist/cjs",
35
- "dist/esm",
33
+ "dist/es",
36
34
  "dist/types",
37
35
  "locales",
38
36
  "docs"
39
- ]
37
+ ],
38
+ "keywords": [
39
+ "twin",
40
+ "trade",
41
+ "iota",
42
+ "framework",
43
+ "blockchain",
44
+ "api"
45
+ ],
46
+ "bugs": {
47
+ "url": "git+https://github.com/twinfoundation/api/issues"
48
+ },
49
+ "homepage": "https://twindev.org"
40
50
  }
@@ -1,81 +0,0 @@
1
- import { BaseRestClient } from '@twin.org/api-core';
2
- import { NotSupportedError } from '@twin.org/core';
3
-
4
- // Copyright 2024 IOTA Stiftung.
5
- // SPDX-License-Identifier: Apache-2.0.
6
- /**
7
- * The client to connect to the information service.
8
- */
9
- class InformationClient extends BaseRestClient {
10
- /**
11
- * Runtime name for the class.
12
- */
13
- CLASS_NAME = "InformationClient";
14
- /**
15
- * Create a new instance of InformationClient.
16
- * @param config The configuration for the client.
17
- */
18
- constructor(config) {
19
- super("InformationClient", config, "");
20
- }
21
- /**
22
- * Get the server root.
23
- * @returns The root root.
24
- */
25
- async root() {
26
- const response = await this.fetch("/", "GET");
27
- return response.body;
28
- }
29
- /**
30
- * Get the server information.
31
- * @returns The service information.
32
- */
33
- async info() {
34
- const response = await this.fetch("/info", "GET");
35
- return response.body;
36
- }
37
- /**
38
- * Get the favicon.
39
- * @returns The favicon.
40
- */
41
- async favicon() {
42
- const response = await this.fetch("/favicon.ico", "GET");
43
- return response.body;
44
- }
45
- /**
46
- * Get the OpenAPI spec.
47
- * @returns The OpenAPI spec.
48
- */
49
- async spec() {
50
- const response = await this.fetch("/spec", "GET");
51
- return response.body;
52
- }
53
- /**
54
- * Get the server health.
55
- * @returns The service health.
56
- */
57
- async health() {
58
- const response = await this.fetch("/health", "GET");
59
- return response.body;
60
- }
61
- /**
62
- * Set the status of a component.
63
- * @param name The component name.
64
- * @param status The status of the component.
65
- * @param details The details for the status.
66
- * @returns Nothing.
67
- */
68
- async setComponentHealth(name, status, details) {
69
- throw new NotSupportedError(this.CLASS_NAME, "\"setComponentHealth\"");
70
- }
71
- /**
72
- * Remove the status of a component.
73
- * @param name The component name.
74
- * @returns Nothing.
75
- */
76
- async removeComponentHealth(name) {
77
- throw new NotSupportedError(this.CLASS_NAME, "\"removeComponentHealth\"");
78
- }
79
- }
80
-
81
- export { InformationClient };