@twin.org/api-service 0.0.3-next.20 → 0.0.3-next.21

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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # TWIN API Service
2
2
 
3
- Implementation of the information service.
3
+ This package provides information and hosting service implementations with generated REST route handlers.
4
4
 
5
5
  ## Installation
6
6
 
package/docs/changelog.md CHANGED
@@ -1,4 +1,18 @@
1
- # @twin.org/api-service - Changelog
1
+ # Changelog
2
+
3
+ ## [0.0.3-next.21](https://github.com/twinfoundation/api/compare/api-service-v0.0.3-next.20...api-service-v0.0.3-next.21) (2026-03-11)
4
+
5
+
6
+ ### Miscellaneous Chores
7
+
8
+ * **api-service:** Synchronize repo versions
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.20 to 0.0.3-next.21
2
16
 
3
17
  ## [0.0.3-next.20](https://github.com/twinfoundation/api/compare/api-service-v0.0.3-next.19...api-service-v0.0.3-next.20) (2026-02-09)
4
18
 
package/docs/examples.md CHANGED
@@ -1 +1,74 @@
1
- # @twin.org/api-service - Examples
1
+ # Service Examples
2
+
3
+ These snippets demonstrate how to configure service-level URL generation and expose operational information for monitoring.
4
+
5
+ ## InformationService
6
+
7
+ ```typescript
8
+ import { InformationService } from '@twin.org/api-service';
9
+
10
+ const infoService = new InformationService({
11
+ config: {
12
+ serverInfo: {
13
+ name: 'Twin API',
14
+ version: '1.2.0'
15
+ }
16
+ }
17
+ });
18
+
19
+ await infoService.start();
20
+ console.log(infoService.className()); // InformationService
21
+
22
+ const root = await infoService.root();
23
+ const info = await infoService.info();
24
+ const favicon = await infoService.favicon();
25
+
26
+ console.log(root); // Twin API - 1.2.0
27
+ console.log(info.version); // 1.2.0
28
+ console.log((favicon?.byteLength ?? 0) > 0); // true
29
+ ```
30
+
31
+ ```typescript
32
+ import { InformationService } from '@twin.org/api-service';
33
+
34
+ const infoService = new InformationService({
35
+ config: {
36
+ serverInfo: {
37
+ name: 'Twin API',
38
+ version: '1.2.0'
39
+ }
40
+ }
41
+ });
42
+
43
+ const spec = await infoService.spec();
44
+ const live = await infoService.livez();
45
+ const health = await infoService.health();
46
+
47
+ await infoService.setComponentHealth('queue', 'ok');
48
+ await infoService.removeComponentHealth('queue');
49
+
50
+ console.log(typeof spec); // undefined
51
+ console.log(live); // true
52
+ console.log(health.status); // ok
53
+ ```
54
+
55
+ ## HostingService
56
+
57
+ ```typescript
58
+ import { HostingService } from '@twin.org/api-service';
59
+
60
+ const hostingService = new HostingService({
61
+ config: {
62
+ localOrigin: 'http://localhost:3000',
63
+ publicOrigin: 'https://api.example.org'
64
+ }
65
+ });
66
+
67
+ console.log(hostingService.className()); // HostingService
68
+
69
+ const publicOrigin = await hostingService.getPublicOrigin('http://localhost:3000/users');
70
+ const usersUrl = await hostingService.buildPublicUrl('http://localhost:3000/users');
71
+
72
+ console.log(publicOrigin); // https://api.example.org
73
+ console.log(usersUrl); // https://api.example.org/users
74
+ ```
@@ -10,12 +10,6 @@ Options for the IHostingService constructor.
10
10
 
11
11
  The tenant admin component type.
12
12
 
13
- #### Default
14
-
15
- ```ts
16
- tenant-admin
17
- ```
18
-
19
13
  ***
20
14
 
21
15
  ### config
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@twin.org/api-service",
3
- "version": "0.0.3-next.20",
4
- "description": "Information contract implementation and REST endpoint definitions",
3
+ "version": "0.0.3-next.21",
4
+ "description": "Information and hosting service implementations with generated REST route handlers.",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/twinfoundation/api.git",
@@ -14,7 +14,7 @@
14
14
  "node": ">=20.0.0"
15
15
  },
16
16
  "dependencies": {
17
- "@twin.org/api-models": "0.0.3-next.20",
17
+ "@twin.org/api-models": "0.0.3-next.21",
18
18
  "@twin.org/context": "next",
19
19
  "@twin.org/core": "next",
20
20
  "@twin.org/nameof": "next",