@twin.org/api-service 0.0.3-next.29 → 0.0.3-next.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/dist/es/healthRoutes.js +108 -0
  2. package/dist/es/healthRoutes.js.map +1 -0
  3. package/dist/es/healthService.js +136 -0
  4. package/dist/es/healthService.js.map +1 -0
  5. package/dist/es/hostingService.js +1 -209
  6. package/dist/es/hostingService.js.map +1 -1
  7. package/dist/es/index.js +7 -0
  8. package/dist/es/index.js.map +1 -1
  9. package/dist/es/informationRoutes.js +31 -65
  10. package/dist/es/informationRoutes.js.map +1 -1
  11. package/dist/es/informationService.js +9 -85
  12. package/dist/es/informationService.js.map +1 -1
  13. package/dist/es/models/IHealthServiceConfig.js +4 -0
  14. package/dist/es/models/IHealthServiceConfig.js.map +1 -0
  15. package/dist/es/models/IHealthServiceConstructorOptions.js +2 -0
  16. package/dist/es/models/IHealthServiceConstructorOptions.js.map +1 -0
  17. package/dist/es/models/IHostingServiceConfig.js.map +1 -1
  18. package/dist/es/models/IHostingServiceConstructorOptions.js.map +1 -1
  19. package/dist/es/models/IUrlTransformerServiceConfig.js +4 -0
  20. package/dist/es/models/IUrlTransformerServiceConfig.js.map +1 -0
  21. package/dist/es/models/IUrlTransformerServiceConstructorOptions.js +2 -0
  22. package/dist/es/models/IUrlTransformerServiceConstructorOptions.js.map +1 -0
  23. package/dist/es/restEntryPoints.js +7 -0
  24. package/dist/es/restEntryPoints.js.map +1 -1
  25. package/dist/es/urlTransformerService.js +220 -0
  26. package/dist/es/urlTransformerService.js.map +1 -0
  27. package/dist/types/healthRoutes.d.ts +20 -0
  28. package/dist/types/healthService.d.ts +42 -0
  29. package/dist/types/hostingService.d.ts +1 -62
  30. package/dist/types/index.d.ts +7 -0
  31. package/dist/types/informationRoutes.d.ts +3 -3
  32. package/dist/types/informationService.d.ts +9 -21
  33. package/dist/types/models/IHealthServiceConfig.d.ts +10 -0
  34. package/dist/types/models/IHealthServiceConstructorOptions.d.ts +10 -0
  35. package/dist/types/models/IHostingServiceConfig.d.ts +0 -10
  36. package/dist/types/models/IHostingServiceConstructorOptions.d.ts +1 -6
  37. package/dist/types/models/IUrlTransformerServiceConfig.d.ts +19 -0
  38. package/dist/types/models/IUrlTransformerServiceConstructorOptions.d.ts +15 -0
  39. package/dist/types/urlTransformerService.d.ts +81 -0
  40. package/docs/changelog.md +28 -0
  41. package/docs/reference/classes/HealthService.md +123 -0
  42. package/docs/reference/classes/HostingService.md +0 -266
  43. package/docs/reference/classes/InformationService.md +8 -84
  44. package/docs/reference/classes/UrlTransformerService.md +321 -0
  45. package/docs/reference/functions/generateRestRoutesHealth.md +25 -0
  46. package/docs/reference/functions/serverReadyz.md +31 -0
  47. package/docs/reference/index.md +10 -1
  48. package/docs/reference/interfaces/IHealthServiceConfig.md +17 -0
  49. package/docs/reference/interfaces/IHealthServiceConstructorOptions.md +11 -0
  50. package/docs/reference/interfaces/IHostingServiceConfig.md +0 -28
  51. package/docs/reference/interfaces/IHostingServiceConstructorOptions.md +1 -15
  52. package/docs/reference/interfaces/IUrlTransformerServiceConfig.md +32 -0
  53. package/docs/reference/interfaces/IUrlTransformerServiceConstructorOptions.md +25 -0
  54. package/docs/reference/variables/tagsHealth.md +5 -0
  55. package/locales/en.json +6 -3
  56. package/package.json +4 -2
package/docs/changelog.md CHANGED
@@ -1,5 +1,33 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.0.3-next.31](https://github.com/twinfoundation/twin-api/compare/api-service-v0.0.3-next.30...api-service-v0.0.3-next.31) (2026-05-06)
4
+
5
+
6
+ ### Features
7
+
8
+ * update health format ([cfbfbbb](https://github.com/twinfoundation/twin-api/commit/cfbfbbb2e9afbd2574ffd2446ad51e4217437951))
9
+
10
+
11
+ ### Dependencies
12
+
13
+ * The following workspace dependencies were updated
14
+ * dependencies
15
+ * @twin.org/api-models bumped from 0.0.3-next.30 to 0.0.3-next.31
16
+
17
+ ## [0.0.3-next.30](https://github.com/twinfoundation/twin-api/compare/api-service-v0.0.3-next.29...api-service-v0.0.3-next.30) (2026-05-05)
18
+
19
+
20
+ ### Features
21
+
22
+ * separate service responsibilities ([#116](https://github.com/twinfoundation/twin-api/issues/116)) ([2234648](https://github.com/twinfoundation/twin-api/commit/2234648de4a2de5b7356aadde328f40470bc12e3))
23
+
24
+
25
+ ### Dependencies
26
+
27
+ * The following workspace dependencies were updated
28
+ * dependencies
29
+ * @twin.org/api-models bumped from 0.0.3-next.29 to 0.0.3-next.30
30
+
3
31
  ## [0.0.3-next.29](https://github.com/twinfoundation/twin-api/compare/api-service-v0.0.3-next.28...api-service-v0.0.3-next.29) (2026-05-01)
4
32
 
5
33
 
@@ -0,0 +1,123 @@
1
+ # Class: HealthService
2
+
3
+ The health service for the server.
4
+
5
+ ## Implements
6
+
7
+ - `IHealthComponent`
8
+
9
+ ## Constructors
10
+
11
+ ### Constructor
12
+
13
+ > **new HealthService**(`options?`): `HealthService`
14
+
15
+ Create a new instance of HealthService.
16
+
17
+ #### Parameters
18
+
19
+ ##### options?
20
+
21
+ [`IHealthServiceConstructorOptions`](../interfaces/IHealthServiceConstructorOptions.md)
22
+
23
+ The constructor options.
24
+
25
+ #### Returns
26
+
27
+ `HealthService`
28
+
29
+ ## Properties
30
+
31
+ ### CLASS\_NAME {#class_name}
32
+
33
+ > `readonly` `static` **CLASS\_NAME**: `string`
34
+
35
+ Runtime name for the class.
36
+
37
+ ## Methods
38
+
39
+ ### className() {#classname}
40
+
41
+ > **className**(): `string`
42
+
43
+ Returns the class name of the component.
44
+
45
+ #### Returns
46
+
47
+ `string`
48
+
49
+ The class name of the component.
50
+
51
+ #### Implementation of
52
+
53
+ `IHealthComponent.className`
54
+
55
+ ***
56
+
57
+ ### start() {#start}
58
+
59
+ > **start**(`nodeLoggingComponentType?`): `Promise`\<`void`\>
60
+
61
+ The component needs to be started when the node is initialized.
62
+
63
+ #### Parameters
64
+
65
+ ##### nodeLoggingComponentType?
66
+
67
+ `string`
68
+
69
+ The node logging component type.
70
+
71
+ #### Returns
72
+
73
+ `Promise`\<`void`\>
74
+
75
+ Nothing.
76
+
77
+ #### Implementation of
78
+
79
+ `IHealthComponent.start`
80
+
81
+ ***
82
+
83
+ ### stop() {#stop}
84
+
85
+ > **stop**(`nodeLoggingComponentType?`): `Promise`\<`void`\>
86
+
87
+ The component needs to be stopped when the node is closed.
88
+
89
+ #### Parameters
90
+
91
+ ##### nodeLoggingComponentType?
92
+
93
+ `string`
94
+
95
+ The node logging component type.
96
+
97
+ #### Returns
98
+
99
+ `Promise`\<`void`\>
100
+
101
+ Nothing.
102
+
103
+ #### Implementation of
104
+
105
+ `IHealthComponent.stop`
106
+
107
+ ***
108
+
109
+ ### healthStatus() {#healthstatus}
110
+
111
+ > **healthStatus**(): `Promise`\<\{ `status`: `HealthStatus`; `components`: `IHealth`[]; \}\>
112
+
113
+ Get the server health.
114
+
115
+ #### Returns
116
+
117
+ `Promise`\<\{ `status`: `HealthStatus`; `components`: `IHealth`[]; \}\>
118
+
119
+ The service health.
120
+
121
+ #### Implementation of
122
+
123
+ `IHealthComponent.healthStatus`
@@ -54,32 +54,6 @@ The class name of the component.
54
54
 
55
55
  ***
56
56
 
57
- ### start() {#start}
58
-
59
- > **start**(`nodeLoggingComponentType?`): `Promise`\<`void`\>
60
-
61
- The component needs to be started when the node is initialized.
62
-
63
- #### Parameters
64
-
65
- ##### nodeLoggingComponentType?
66
-
67
- `string`
68
-
69
- The node logging component type.
70
-
71
- #### Returns
72
-
73
- `Promise`\<`void`\>
74
-
75
- Nothing.
76
-
77
- #### Implementation of
78
-
79
- `IHostingComponent.start`
80
-
81
- ***
82
-
83
57
  ### getPublicOrigin() {#getpublicorigin}
84
58
 
85
59
  > **getPublicOrigin**(`serverRequestUrl?`): `Promise`\<`string`\>
@@ -155,243 +129,3 @@ The full url based on the public origin.
155
129
  #### Implementation of
156
130
 
157
131
  `IHostingComponent.buildPublicUrl`
158
-
159
- ***
160
-
161
- ### addEncryptedParamsToUrl() {#addencryptedparamstourl}
162
-
163
- > **addEncryptedParamsToUrl**(`url`, `params`): `Promise`\<`string`\>
164
-
165
- Add encrypted key/value pairs to a URL's query string.
166
- Existing query parameters on the URL are preserved; the provided params are
167
- merged in and then encrypted before being written back to the URL.
168
-
169
- #### Parameters
170
-
171
- ##### url
172
-
173
- `string`
174
-
175
- The base URL to add parameters to.
176
-
177
- ##### params
178
-
179
- `IHttpRequestQuery`
180
-
181
- The key/value pairs to encrypt and append.
182
-
183
- #### Returns
184
-
185
- `Promise`\<`string`\>
186
-
187
- The URL with the encrypted parameters added.
188
-
189
- #### Implementation of
190
-
191
- `IHostingComponent.addEncryptedParamsToUrl`
192
-
193
- ***
194
-
195
- ### getDecryptedParamsFromQueryParams() {#getdecryptedparamsfromqueryparams}
196
-
197
- > **getDecryptedParamsFromQueryParams**(`queryParams`, `keys`): `Promise`\<`IHttpRequestQuery`\>
198
-
199
- Decrypt specified keys from a query parameter object and return their plain-text values.
200
-
201
- #### Parameters
202
-
203
- ##### queryParams
204
-
205
- `IHttpRequestQuery` \| `undefined`
206
-
207
- The HTTP request query containing the encrypted parameters.
208
-
209
- ##### keys
210
-
211
- `string`[]
212
-
213
- The keys to decrypt.
214
-
215
- #### Returns
216
-
217
- `Promise`\<`IHttpRequestQuery`\>
218
-
219
- A map of the decrypted key/value pairs that were present.
220
-
221
- #### Implementation of
222
-
223
- `IHostingComponent.getDecryptedParamsFromQueryParams`
224
-
225
- ***
226
-
227
- ### addTenantTokenToUrl() {#addtenanttokentourl}
228
-
229
- > **addTenantTokenToUrl**(`url`, `tenantId`): `Promise`\<`string`\>
230
-
231
- Encrypt the tenant id and append it as a query parameter to the given URL.
232
-
233
- #### Parameters
234
-
235
- ##### url
236
-
237
- `string`
238
-
239
- The URL to append the encrypted tenant token to.
240
-
241
- ##### tenantId
242
-
243
- `string`
244
-
245
- The tenant identifier to encrypt and add.
246
-
247
- #### Returns
248
-
249
- `Promise`\<`string`\>
250
-
251
- The URL with the encrypted tenant token added as a query parameter.
252
-
253
- #### Implementation of
254
-
255
- `IHostingComponent.addTenantTokenToUrl`
256
-
257
- ***
258
-
259
- ### getTenantTokenFromQueryParams() {#gettenanttokenfromqueryparams}
260
-
261
- > **getTenantTokenFromQueryParams**(`queryParams`): `Promise`\<`string` \| `undefined`\>
262
-
263
- Get the tenant token from the query parameters.
264
-
265
- #### Parameters
266
-
267
- ##### queryParams
268
-
269
- `IHttpRequestQuery` \| `undefined`
270
-
271
- The HTTP request query containing the parameters.
272
-
273
- #### Returns
274
-
275
- `Promise`\<`string` \| `undefined`\>
276
-
277
- The tenant token if it exists.
278
-
279
- #### Implementation of
280
-
281
- `IHostingComponent.getTenantTokenFromQueryParams`
282
-
283
- ***
284
-
285
- ### encryptQueryParams() {#encryptqueryparams}
286
-
287
- > **encryptQueryParams**(`httpRequestQuery`, `keys`): `Promise`\<`void`\>
288
-
289
- Encrypt query parameters using the hosting component's encryption mechanism.
290
-
291
- #### Parameters
292
-
293
- ##### httpRequestQuery
294
-
295
- `IHttpRequestQuery` \| `undefined`
296
-
297
- The HTTP request query containing the parameters to encrypt.
298
-
299
- ##### keys
300
-
301
- `string`[]
302
-
303
- The keys of the parameters to encrypt.
304
-
305
- #### Returns
306
-
307
- `Promise`\<`void`\>
308
-
309
- A promise that resolves when the query parameters have been encrypted.
310
-
311
- #### Implementation of
312
-
313
- `IHostingComponent.encryptQueryParams`
314
-
315
- ***
316
-
317
- ### decryptQueryParams() {#decryptqueryparams}
318
-
319
- > **decryptQueryParams**(`httpRequestQuery`, `keys`): `Promise`\<`void`\>
320
-
321
- Decrypt query parameters using the hosting component's encryption mechanism.
322
-
323
- #### Parameters
324
-
325
- ##### httpRequestQuery
326
-
327
- `IHttpRequestQuery` \| `undefined`
328
-
329
- The HTTP request query containing the encrypted values.
330
-
331
- ##### keys
332
-
333
- `string`[]
334
-
335
- The keys of the parameters to decrypt.
336
-
337
- #### Returns
338
-
339
- `Promise`\<`void`\>
340
-
341
- A promise that resolves when the query parameters have been decrypted.
342
-
343
- #### Implementation of
344
-
345
- `IHostingComponent.decryptQueryParams`
346
-
347
- ***
348
-
349
- ### encryptParam() {#encryptparam}
350
-
351
- > **encryptParam**(`paramValue`): `Promise`\<`string`\>
352
-
353
- Encrypt a parameter value using the hosting component's encryption mechanism.
354
-
355
- #### Parameters
356
-
357
- ##### paramValue
358
-
359
- `string`
360
-
361
- The value of the parameter to encrypt.
362
-
363
- #### Returns
364
-
365
- `Promise`\<`string`\>
366
-
367
- A promise that resolves to the encrypted value of the parameter.
368
-
369
- #### Implementation of
370
-
371
- `IHostingComponent.encryptParam`
372
-
373
- ***
374
-
375
- ### decryptParam() {#decryptparam}
376
-
377
- > **decryptParam**(`encryptedValue`): `Promise`\<`string`\>
378
-
379
- Decrypt a parameter value using the hosting component's encryption mechanism.
380
-
381
- #### Parameters
382
-
383
- ##### encryptedValue
384
-
385
- `string`
386
-
387
- The encrypted value of the parameter.
388
-
389
- #### Returns
390
-
391
- `Promise`\<`string`\>
392
-
393
- A promise that resolves to the decrypted value of the parameter.
394
-
395
- #### Implementation of
396
-
397
- `IHostingComponent.decryptParam`
@@ -146,13 +146,13 @@ The OpenAPI spec.
146
146
 
147
147
  ### livez() {#livez}
148
148
 
149
- > **livez**(): `Promise`\<`boolean`\>
149
+ > **livez**(): `Promise`\<\{ `status`: `"alive"` \| `"dead"`; \}\>
150
150
 
151
151
  Is the server live.
152
152
 
153
153
  #### Returns
154
154
 
155
- `Promise`\<`boolean`\>
155
+ `Promise`\<\{ `status`: `"alive"` \| `"dead"`; \}\>
156
156
 
157
157
  True if the server is live.
158
158
 
@@ -162,94 +162,18 @@ True if the server is live.
162
162
 
163
163
  ***
164
164
 
165
- ### health() {#health}
165
+ ### readyz() {#readyz}
166
166
 
167
- > **health**(): `Promise`\<`IHealthInfo`\>
167
+ > **readyz**(): `Promise`\<\{ `status`: `"ready"` \| `"not ready"`; \}\>
168
168
 
169
- Get the server health.
169
+ Is the server ready.
170
170
 
171
171
  #### Returns
172
172
 
173
- `Promise`\<`IHealthInfo`\>
173
+ `Promise`\<\{ `status`: `"ready"` \| `"not ready"`; \}\>
174
174
 
175
- The service health.
175
+ The readyz status of the server.
176
176
 
177
177
  #### Implementation of
178
178
 
179
- `IInformationComponent.health`
180
-
181
- ***
182
-
183
- ### setComponentHealth() {#setcomponenthealth}
184
-
185
- > **setComponentHealth**(`name`, `status`, `details?`, `tenantId?`): `Promise`\<`void`\>
186
-
187
- Set the status of a component.
188
-
189
- #### Parameters
190
-
191
- ##### name
192
-
193
- `string`
194
-
195
- The component name.
196
-
197
- ##### status
198
-
199
- `HealthStatus`
200
-
201
- The status of the component.
202
-
203
- ##### details?
204
-
205
- `string`
206
-
207
- The details for the status.
208
-
209
- ##### tenantId?
210
-
211
- `string`
212
-
213
- The tenant id, optional if the health status is not tenant specific.
214
-
215
- #### Returns
216
-
217
- `Promise`\<`void`\>
218
-
219
- Nothing.
220
-
221
- #### Implementation of
222
-
223
- `IInformationComponent.setComponentHealth`
224
-
225
- ***
226
-
227
- ### removeComponentHealth() {#removecomponenthealth}
228
-
229
- > **removeComponentHealth**(`name`, `tenantId?`): `Promise`\<`void`\>
230
-
231
- Remove the status of a component.
232
-
233
- #### Parameters
234
-
235
- ##### name
236
-
237
- `string`
238
-
239
- The component name.
240
-
241
- ##### tenantId?
242
-
243
- `string`
244
-
245
- The tenant id, optional if the health status is not tenant specific.
246
-
247
- #### Returns
248
-
249
- `Promise`\<`void`\>
250
-
251
- Nothing.
252
-
253
- #### Implementation of
254
-
255
- `IInformationComponent.removeComponentHealth`
179
+ `IInformationComponent.readyz`