@twin.org/api-rest-client 0.0.2-next.9 → 0.0.3-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.
- package/dist/es/index.js +4 -0
- package/dist/es/index.js.map +1 -0
- package/dist/{cjs/index.cjs → es/informationRestClient.js} +28 -13
- package/dist/es/informationRestClient.js.map +1 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/{informationClient.d.ts → informationRestClient.d.ts} +13 -3
- package/docs/changelog.md +248 -0
- package/docs/reference/classes/{InformationClient.md → InformationRestClient.md} +41 -9
- package/docs/reference/index.md +1 -1
- package/locales/en.json +7 -1
- package/package.json +20 -10
- package/dist/esm/index.mjs +0 -81
package/dist/es/index.js
ADDED
|
@@ -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
|
|
8
|
+
export class InformationRestClient extends BaseRestClient {
|
|
12
9
|
/**
|
|
13
10
|
* Runtime name for the class.
|
|
14
11
|
*/
|
|
15
|
-
CLASS_NAME = "
|
|
12
|
+
static CLASS_NAME = "InformationRestClient";
|
|
16
13
|
/**
|
|
17
|
-
* Create a new instance of
|
|
14
|
+
* Create a new instance of InformationRestClient.
|
|
18
15
|
* @param config The configuration for the client.
|
|
19
16
|
*/
|
|
20
17
|
constructor(config) {
|
|
21
|
-
super("
|
|
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.
|
|
@@ -52,6 +56,14 @@ class InformationClient extends apiCore.BaseRestClient {
|
|
|
52
56
|
const response = await this.fetch("/spec", "GET");
|
|
53
57
|
return response.body;
|
|
54
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* Is the server live.
|
|
61
|
+
* @returns True if the server is live.
|
|
62
|
+
*/
|
|
63
|
+
async livez() {
|
|
64
|
+
const response = await this.fetch("/livez", "GET");
|
|
65
|
+
return response.body === "ok";
|
|
66
|
+
}
|
|
55
67
|
/**
|
|
56
68
|
* Get the server health.
|
|
57
69
|
* @returns The service health.
|
|
@@ -68,7 +80,9 @@ class InformationClient extends apiCore.BaseRestClient {
|
|
|
68
80
|
* @returns Nothing.
|
|
69
81
|
*/
|
|
70
82
|
async setComponentHealth(name, status, details) {
|
|
71
|
-
throw new
|
|
83
|
+
throw new NotSupportedError(InformationRestClient.CLASS_NAME, "notSupportedOnClient", {
|
|
84
|
+
methodName: "setComponentHealth"
|
|
85
|
+
});
|
|
72
86
|
}
|
|
73
87
|
/**
|
|
74
88
|
* Remove the status of a component.
|
|
@@ -76,8 +90,9 @@ class InformationClient extends apiCore.BaseRestClient {
|
|
|
76
90
|
* @returns Nothing.
|
|
77
91
|
*/
|
|
78
92
|
async removeComponentHealth(name) {
|
|
79
|
-
throw new
|
|
93
|
+
throw new NotSupportedError(InformationRestClient.CLASS_NAME, "notSupportedOnClient", {
|
|
94
|
+
methodName: "removeComponentHealth"
|
|
95
|
+
});
|
|
80
96
|
}
|
|
81
97
|
}
|
|
82
|
-
|
|
83
|
-
exports.InformationClient = InformationClient;
|
|
98
|
+
//# 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;AAepD,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,KAAK;QACjB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,KAAK,CAA0C,QAAQ,EAAE,KAAK,CAAC,CAAC;QAC5F,OAAO,QAAQ,CAAC,IAAI,KAAK,IAAI,CAAC;IAC/B,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,EAAE,sBAAsB,EAAE;YACrF,UAAU,EAAE,oBAAoB;SAChC,CAAC,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,qBAAqB,CAAC,IAAY;QAC9C,MAAM,IAAI,iBAAiB,CAAC,qBAAqB,CAAC,UAAU,EAAE,sBAAsB,EAAE;YACrF,UAAU,EAAE,uBAAuB;SACnC,CAAC,CAAC;IACJ,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\tIServerLivezResponse,\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 * Is the server live.\n\t * @returns True if the server is live.\n\t */\n\tpublic async livez(): Promise<boolean> {\n\t\tconst response = await this.fetch<INoContentRequest, IServerLivezResponse>(\"/livez\", \"GET\");\n\t\treturn response.body === \"ok\";\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, \"notSupportedOnClient\", {\n\t\t\tmethodName: \"setComponentHealth\"\n\t\t});\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, \"notSupportedOnClient\", {\n\t\t\tmethodName: \"removeComponentHealth\"\n\t\t});\n\t}\n}\n"]}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./
|
|
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
|
|
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
|
|
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.
|
|
@@ -33,6 +38,11 @@ export declare class InformationClient extends BaseRestClient implements IInform
|
|
|
33
38
|
* @returns The OpenAPI spec.
|
|
34
39
|
*/
|
|
35
40
|
spec(): Promise<unknown>;
|
|
41
|
+
/**
|
|
42
|
+
* Is the server live.
|
|
43
|
+
* @returns True if the server is live.
|
|
44
|
+
*/
|
|
45
|
+
livez(): Promise<boolean>;
|
|
36
46
|
/**
|
|
37
47
|
* Get the server health.
|
|
38
48
|
* @returns The service health.
|
package/docs/changelog.md
CHANGED
|
@@ -1,5 +1,253 @@
|
|
|
1
1
|
# @twin.org/api-rest-client - Changelog
|
|
2
2
|
|
|
3
|
+
## [0.0.3-next.10](https://github.com/twinfoundation/api/compare/api-rest-client-v0.0.3-next.9...api-rest-client-v0.0.3-next.10) (2026-01-05)
|
|
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.9 to 0.0.3-next.10
|
|
16
|
+
* @twin.org/api-models bumped from 0.0.3-next.9 to 0.0.3-next.10
|
|
17
|
+
|
|
18
|
+
## [0.0.3-next.9](https://github.com/twinfoundation/api/compare/api-rest-client-v0.0.3-next.8...api-rest-client-v0.0.3-next.9) (2026-01-05)
|
|
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 livez endpoint ([#57](https://github.com/twinfoundation/api/issues/57)) ([ef007db](https://github.com/twinfoundation/api/commit/ef007db8201736dd3053211f849ffd03baaa485e))
|
|
25
|
+
* add root, favicon routes ([71da1c3](https://github.com/twinfoundation/api/commit/71da1c3a93c349588aff7084d1d8d6a29a277da8))
|
|
26
|
+
* add validate-locales ([cdba610](https://github.com/twinfoundation/api/commit/cdba610a0acb5022d2e3ce729732e6646a297e5e))
|
|
27
|
+
* eslint migration to flat config ([0dd5820](https://github.com/twinfoundation/api/commit/0dd5820e3af97350fd08b8d226f4a6c1a9246805))
|
|
28
|
+
* update dependencies ([1171dc4](https://github.com/twinfoundation/api/commit/1171dc416a9481737f6a640e3cf30145768f37e9))
|
|
29
|
+
* update framework core ([d8eebf2](https://github.com/twinfoundation/api/commit/d8eebf267fa2a0abaa84e58590496e9d20490cfa))
|
|
30
|
+
* update IComponent signatures ([915ce37](https://github.com/twinfoundation/api/commit/915ce37712326ab4aa6869c350eabaa4622e8430))
|
|
31
|
+
* use shared store mechanism ([#19](https://github.com/twinfoundation/api/issues/19)) ([32116df](https://github.com/twinfoundation/api/commit/32116df3b4380a30137f5056f242a5c99afa2df9))
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
### Bug Fixes
|
|
35
|
+
|
|
36
|
+
* not supported error handling ([5cc1a50](https://github.com/twinfoundation/api/commit/5cc1a507243f37fda5855acb622b2a3f4d91080f))
|
|
37
|
+
* use correct format for log messaging ([1d28474](https://github.com/twinfoundation/api/commit/1d284744589aa7875327ccc053446f655f2a7f62))
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
### Dependencies
|
|
41
|
+
|
|
42
|
+
* The following workspace dependencies were updated
|
|
43
|
+
* dependencies
|
|
44
|
+
* @twin.org/api-core bumped from 0.0.3-next.8 to 0.0.3-next.9
|
|
45
|
+
* @twin.org/api-models bumped from 0.0.3-next.8 to 0.0.3-next.9
|
|
46
|
+
|
|
47
|
+
## [0.0.3-next.8](https://github.com/twinfoundation/api/compare/api-rest-client-v0.0.3-next.7...api-rest-client-v0.0.3-next.8) (2025-12-17)
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
### Bug Fixes
|
|
51
|
+
|
|
52
|
+
* not supported error handling ([5cc1a50](https://github.com/twinfoundation/api/commit/5cc1a507243f37fda5855acb622b2a3f4d91080f))
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
### Dependencies
|
|
56
|
+
|
|
57
|
+
* The following workspace dependencies were updated
|
|
58
|
+
* dependencies
|
|
59
|
+
* @twin.org/api-core bumped from 0.0.3-next.7 to 0.0.3-next.8
|
|
60
|
+
* @twin.org/api-models bumped from 0.0.3-next.7 to 0.0.3-next.8
|
|
61
|
+
|
|
62
|
+
## [0.0.3-next.7](https://github.com/twinfoundation/api/compare/api-rest-client-v0.0.3-next.6...api-rest-client-v0.0.3-next.7) (2025-11-26)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
### Miscellaneous Chores
|
|
66
|
+
|
|
67
|
+
* **api-rest-client:** Synchronize repo versions
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
### Dependencies
|
|
71
|
+
|
|
72
|
+
* The following workspace dependencies were updated
|
|
73
|
+
* dependencies
|
|
74
|
+
* @twin.org/api-core bumped from 0.0.3-next.6 to 0.0.3-next.7
|
|
75
|
+
* @twin.org/api-models bumped from 0.0.3-next.6 to 0.0.3-next.7
|
|
76
|
+
|
|
77
|
+
## [0.0.3-next.6](https://github.com/twinfoundation/api/compare/api-rest-client-v0.0.3-next.5...api-rest-client-v0.0.3-next.6) (2025-11-20)
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
### Miscellaneous Chores
|
|
81
|
+
|
|
82
|
+
* **api-rest-client:** Synchronize repo versions
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
### Dependencies
|
|
86
|
+
|
|
87
|
+
* The following workspace dependencies were updated
|
|
88
|
+
* dependencies
|
|
89
|
+
* @twin.org/api-core bumped from 0.0.3-next.5 to 0.0.3-next.6
|
|
90
|
+
* @twin.org/api-models bumped from 0.0.3-next.5 to 0.0.3-next.6
|
|
91
|
+
|
|
92
|
+
## [0.0.3-next.5](https://github.com/twinfoundation/api/compare/api-rest-client-v0.0.3-next.4...api-rest-client-v0.0.3-next.5) (2025-11-14)
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
### Miscellaneous Chores
|
|
96
|
+
|
|
97
|
+
* **api-rest-client:** Synchronize repo versions
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
### Dependencies
|
|
101
|
+
|
|
102
|
+
* The following workspace dependencies were updated
|
|
103
|
+
* dependencies
|
|
104
|
+
* @twin.org/api-core bumped from 0.0.3-next.4 to 0.0.3-next.5
|
|
105
|
+
* @twin.org/api-models bumped from 0.0.3-next.4 to 0.0.3-next.5
|
|
106
|
+
|
|
107
|
+
## [0.0.3-next.4](https://github.com/twinfoundation/api/compare/api-rest-client-v0.0.3-next.3...api-rest-client-v0.0.3-next.4) (2025-11-14)
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
### Features
|
|
111
|
+
|
|
112
|
+
* add context id features ([#42](https://github.com/twinfoundation/api/issues/42)) ([0186055](https://github.com/twinfoundation/api/commit/0186055c48afde842a4254b4df9ac9249c40fe40))
|
|
113
|
+
* add root, favicon routes ([71da1c3](https://github.com/twinfoundation/api/commit/71da1c3a93c349588aff7084d1d8d6a29a277da8))
|
|
114
|
+
* add validate-locales ([cdba610](https://github.com/twinfoundation/api/commit/cdba610a0acb5022d2e3ce729732e6646a297e5e))
|
|
115
|
+
* eslint migration to flat config ([0dd5820](https://github.com/twinfoundation/api/commit/0dd5820e3af97350fd08b8d226f4a6c1a9246805))
|
|
116
|
+
* update dependencies ([1171dc4](https://github.com/twinfoundation/api/commit/1171dc416a9481737f6a640e3cf30145768f37e9))
|
|
117
|
+
* update framework core ([d8eebf2](https://github.com/twinfoundation/api/commit/d8eebf267fa2a0abaa84e58590496e9d20490cfa))
|
|
118
|
+
* update IComponent signatures ([915ce37](https://github.com/twinfoundation/api/commit/915ce37712326ab4aa6869c350eabaa4622e8430))
|
|
119
|
+
* use shared store mechanism ([#19](https://github.com/twinfoundation/api/issues/19)) ([32116df](https://github.com/twinfoundation/api/commit/32116df3b4380a30137f5056f242a5c99afa2df9))
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
### Bug Fixes
|
|
123
|
+
|
|
124
|
+
* use correct format for log messaging ([1d28474](https://github.com/twinfoundation/api/commit/1d284744589aa7875327ccc053446f655f2a7f62))
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
### Dependencies
|
|
128
|
+
|
|
129
|
+
* The following workspace dependencies were updated
|
|
130
|
+
* dependencies
|
|
131
|
+
* @twin.org/api-core bumped from 0.0.3-next.3 to 0.0.3-next.4
|
|
132
|
+
* @twin.org/api-models bumped from 0.0.3-next.3 to 0.0.3-next.4
|
|
133
|
+
|
|
134
|
+
## [0.0.3-next.3](https://github.com/twinfoundation/api/compare/api-rest-client-v0.0.3-next.2...api-rest-client-v0.0.3-next.3) (2025-11-14)
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
### Miscellaneous Chores
|
|
138
|
+
|
|
139
|
+
* **api-rest-client:** Synchronize repo versions
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
### Dependencies
|
|
143
|
+
|
|
144
|
+
* The following workspace dependencies were updated
|
|
145
|
+
* dependencies
|
|
146
|
+
* @twin.org/api-core bumped from 0.0.3-next.2 to 0.0.3-next.3
|
|
147
|
+
* @twin.org/api-models bumped from 0.0.3-next.2 to 0.0.3-next.3
|
|
148
|
+
|
|
149
|
+
## [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)
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
### Miscellaneous Chores
|
|
153
|
+
|
|
154
|
+
* **api-rest-client:** Synchronize repo versions
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
### Dependencies
|
|
158
|
+
|
|
159
|
+
* The following workspace dependencies were updated
|
|
160
|
+
* dependencies
|
|
161
|
+
* @twin.org/api-core bumped from 0.0.3-next.1 to 0.0.3-next.2
|
|
162
|
+
* @twin.org/api-models bumped from 0.0.3-next.1 to 0.0.3-next.2
|
|
163
|
+
|
|
164
|
+
## [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)
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
### Features
|
|
168
|
+
|
|
169
|
+
* add context id features ([#42](https://github.com/twinfoundation/api/issues/42)) ([0186055](https://github.com/twinfoundation/api/commit/0186055c48afde842a4254b4df9ac9249c40fe40))
|
|
170
|
+
* add root, favicon routes ([71da1c3](https://github.com/twinfoundation/api/commit/71da1c3a93c349588aff7084d1d8d6a29a277da8))
|
|
171
|
+
* add validate-locales ([cdba610](https://github.com/twinfoundation/api/commit/cdba610a0acb5022d2e3ce729732e6646a297e5e))
|
|
172
|
+
* eslint migration to flat config ([0dd5820](https://github.com/twinfoundation/api/commit/0dd5820e3af97350fd08b8d226f4a6c1a9246805))
|
|
173
|
+
* update dependencies ([1171dc4](https://github.com/twinfoundation/api/commit/1171dc416a9481737f6a640e3cf30145768f37e9))
|
|
174
|
+
* update framework core ([d8eebf2](https://github.com/twinfoundation/api/commit/d8eebf267fa2a0abaa84e58590496e9d20490cfa))
|
|
175
|
+
* update IComponent signatures ([915ce37](https://github.com/twinfoundation/api/commit/915ce37712326ab4aa6869c350eabaa4622e8430))
|
|
176
|
+
* use shared store mechanism ([#19](https://github.com/twinfoundation/api/issues/19)) ([32116df](https://github.com/twinfoundation/api/commit/32116df3b4380a30137f5056f242a5c99afa2df9))
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
### Bug Fixes
|
|
180
|
+
|
|
181
|
+
* use correct format for log messaging ([1d28474](https://github.com/twinfoundation/api/commit/1d284744589aa7875327ccc053446f655f2a7f62))
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
### Dependencies
|
|
185
|
+
|
|
186
|
+
* The following workspace dependencies were updated
|
|
187
|
+
* dependencies
|
|
188
|
+
* @twin.org/api-core bumped from 0.0.3-next.0 to 0.0.3-next.1
|
|
189
|
+
* @twin.org/api-models bumped from 0.0.3-next.0 to 0.0.3-next.1
|
|
190
|
+
|
|
191
|
+
## [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)
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
### Miscellaneous Chores
|
|
195
|
+
|
|
196
|
+
* **api-rest-client:** Synchronize repo versions
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
### Dependencies
|
|
200
|
+
|
|
201
|
+
* The following workspace dependencies were updated
|
|
202
|
+
* dependencies
|
|
203
|
+
* @twin.org/api-core bumped from 0.0.2-next.12 to 0.0.2-next.13
|
|
204
|
+
* @twin.org/api-models bumped from 0.0.2-next.12 to 0.0.2-next.13
|
|
205
|
+
|
|
206
|
+
## [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)
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
### Features
|
|
210
|
+
|
|
211
|
+
* add validate-locales ([cdba610](https://github.com/twinfoundation/api/commit/cdba610a0acb5022d2e3ce729732e6646a297e5e))
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
### Dependencies
|
|
215
|
+
|
|
216
|
+
* The following workspace dependencies were updated
|
|
217
|
+
* dependencies
|
|
218
|
+
* @twin.org/api-core bumped from 0.0.2-next.11 to 0.0.2-next.12
|
|
219
|
+
* @twin.org/api-models bumped from 0.0.2-next.11 to 0.0.2-next.12
|
|
220
|
+
|
|
221
|
+
## [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)
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
### Features
|
|
225
|
+
|
|
226
|
+
* update IComponent signatures ([915ce37](https://github.com/twinfoundation/api/commit/915ce37712326ab4aa6869c350eabaa4622e8430))
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
### Dependencies
|
|
230
|
+
|
|
231
|
+
* The following workspace dependencies were updated
|
|
232
|
+
* dependencies
|
|
233
|
+
* @twin.org/api-core bumped from 0.0.2-next.10 to 0.0.2-next.11
|
|
234
|
+
* @twin.org/api-models bumped from 0.0.2-next.10 to 0.0.2-next.11
|
|
235
|
+
|
|
236
|
+
## [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)
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
### Miscellaneous Chores
|
|
240
|
+
|
|
241
|
+
* **api-rest-client:** Synchronize repo versions
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
### Dependencies
|
|
245
|
+
|
|
246
|
+
* The following workspace dependencies were updated
|
|
247
|
+
* dependencies
|
|
248
|
+
* @twin.org/api-core bumped from 0.0.2-next.9 to 0.0.2-next.10
|
|
249
|
+
* @twin.org/api-models bumped from 0.0.2-next.9 to 0.0.2-next.10
|
|
250
|
+
|
|
3
251
|
## [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
252
|
|
|
5
253
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Class:
|
|
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
|
|
17
|
+
> **new InformationRestClient**(`config`): `InformationRestClient`
|
|
18
18
|
|
|
19
|
-
Create a new instance of
|
|
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
|
-
`
|
|
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.
|
|
61
|
+
`IInformationComponent.className`
|
|
48
62
|
|
|
49
|
-
|
|
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`\<`
|
|
103
|
+
> **favicon**(): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\> \| `undefined`\>
|
|
90
104
|
|
|
91
105
|
Get the favicon.
|
|
92
106
|
|
|
93
107
|
#### Returns
|
|
94
108
|
|
|
95
|
-
`Promise`\<`
|
|
109
|
+
`Promise`\<`Uint8Array`\<`ArrayBufferLike`\> \| `undefined`\>
|
|
96
110
|
|
|
97
111
|
The favicon.
|
|
98
112
|
|
|
@@ -120,6 +134,24 @@ The OpenAPI spec.
|
|
|
120
134
|
|
|
121
135
|
***
|
|
122
136
|
|
|
137
|
+
### livez()
|
|
138
|
+
|
|
139
|
+
> **livez**(): `Promise`\<`boolean`\>
|
|
140
|
+
|
|
141
|
+
Is the server live.
|
|
142
|
+
|
|
143
|
+
#### Returns
|
|
144
|
+
|
|
145
|
+
`Promise`\<`boolean`\>
|
|
146
|
+
|
|
147
|
+
True if the server is live.
|
|
148
|
+
|
|
149
|
+
#### Implementation of
|
|
150
|
+
|
|
151
|
+
`IInformationComponent.livez`
|
|
152
|
+
|
|
153
|
+
***
|
|
154
|
+
|
|
123
155
|
### health()
|
|
124
156
|
|
|
125
157
|
> **health**(): `Promise`\<`IHealthInfo`\>
|
package/docs/reference/index.md
CHANGED
package/locales/en.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/api-rest-client",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3-next.10",
|
|
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.
|
|
18
|
-
"@twin.org/api-models": "0.0.
|
|
17
|
+
"@twin.org/api-core": "0.0.3-next.10",
|
|
18
|
+
"@twin.org/api-models": "0.0.3-next.10",
|
|
19
19
|
"@twin.org/core": "next",
|
|
20
20
|
"@twin.org/nameof": "next",
|
|
21
21
|
"@twin.org/web": "next"
|
|
22
22
|
},
|
|
23
|
-
"main": "./dist/
|
|
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
|
-
"
|
|
30
|
-
"
|
|
28
|
+
"import": "./dist/es/index.js",
|
|
29
|
+
"default": "./dist/es/index.js"
|
|
31
30
|
}
|
|
32
31
|
},
|
|
33
32
|
"files": [
|
|
34
|
-
"dist/
|
|
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
|
}
|
package/dist/esm/index.mjs
DELETED
|
@@ -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 };
|