@3sixty/api-service 0.0.0-stage → 0.20.0-next.1

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 (71) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +24 -2
  3. package/dist/es/healthApplicationTask.js +151 -0
  4. package/dist/es/healthApplicationTask.js.map +1 -0
  5. package/dist/es/healthRoutes.js +125 -0
  6. package/dist/es/healthRoutes.js.map +1 -0
  7. package/dist/es/healthService.js +308 -0
  8. package/dist/es/healthService.js.map +1 -0
  9. package/dist/es/index.js +15 -0
  10. package/dist/es/index.js.map +1 -0
  11. package/dist/es/informationRoutes.js +298 -0
  12. package/dist/es/informationRoutes.js.map +1 -0
  13. package/dist/es/informationService.js +123 -0
  14. package/dist/es/informationService.js.map +1 -0
  15. package/dist/es/models/IHealthServiceConfig.js +4 -0
  16. package/dist/es/models/IHealthServiceConfig.js.map +1 -0
  17. package/dist/es/models/IHealthServiceConstructorOptions.js +2 -0
  18. package/dist/es/models/IHealthServiceConstructorOptions.js.map +1 -0
  19. package/dist/es/models/IInformationServiceConfig.js +2 -0
  20. package/dist/es/models/IInformationServiceConfig.js.map +1 -0
  21. package/dist/es/models/IInformationServiceConstructorOptions.js +2 -0
  22. package/dist/es/models/IInformationServiceConstructorOptions.js.map +1 -0
  23. package/dist/es/models/IPlatformServiceConfig.js +4 -0
  24. package/dist/es/models/IPlatformServiceConfig.js.map +1 -0
  25. package/dist/es/models/IPlatformServiceConstructorOptions.js +2 -0
  26. package/dist/es/models/IPlatformServiceConstructorOptions.js.map +1 -0
  27. package/dist/es/platformService.js +211 -0
  28. package/dist/es/platformService.js.map +1 -0
  29. package/dist/es/restEntryPoints.js +20 -0
  30. package/dist/es/restEntryPoints.js.map +1 -0
  31. package/dist/types/healthApplicationTask.d.ts +20 -0
  32. package/dist/types/healthRoutes.d.ts +20 -0
  33. package/dist/types/healthService.d.ts +42 -0
  34. package/dist/types/index.d.ts +12 -0
  35. package/dist/types/informationRoutes.d.ts +60 -0
  36. package/dist/types/informationService.d.ts +60 -0
  37. package/dist/types/models/IHealthServiceConfig.d.ts +37 -0
  38. package/dist/types/models/IHealthServiceConstructorOptions.d.ts +15 -0
  39. package/dist/types/models/IInformationServiceConfig.d.ts +18 -0
  40. package/dist/types/models/IInformationServiceConstructorOptions.d.ts +10 -0
  41. package/dist/types/models/IPlatformServiceConfig.d.ts +10 -0
  42. package/dist/types/models/IPlatformServiceConstructorOptions.d.ts +19 -0
  43. package/dist/types/platformService.d.ts +57 -0
  44. package/dist/types/restEntryPoints.d.ts +5 -0
  45. package/docs/changelog.md +17 -0
  46. package/docs/examples.md +74 -0
  47. package/docs/open-api/spec.json +712 -0
  48. package/docs/reference/classes/HealthService.md +127 -0
  49. package/docs/reference/classes/InformationService.md +179 -0
  50. package/docs/reference/classes/PlatformService.md +209 -0
  51. package/docs/reference/functions/generateRestRoutesHealth.md +25 -0
  52. package/docs/reference/functions/generateRestRoutesInformation.md +25 -0
  53. package/docs/reference/functions/serverFavIcon.md +31 -0
  54. package/docs/reference/functions/serverHealth.md +31 -0
  55. package/docs/reference/functions/serverInfo.md +31 -0
  56. package/docs/reference/functions/serverLivez.md +31 -0
  57. package/docs/reference/functions/serverReadyz.md +31 -0
  58. package/docs/reference/functions/serverRoot.md +31 -0
  59. package/docs/reference/functions/serverSpec.md +31 -0
  60. package/docs/reference/index.md +34 -0
  61. package/docs/reference/interfaces/IHealthServiceConfig.md +79 -0
  62. package/docs/reference/interfaces/IHealthServiceConstructorOptions.md +25 -0
  63. package/docs/reference/interfaces/IInformationServiceConfig.md +27 -0
  64. package/docs/reference/interfaces/IInformationServiceConstructorOptions.md +11 -0
  65. package/docs/reference/interfaces/IPlatformServiceConfig.md +17 -0
  66. package/docs/reference/interfaces/IPlatformServiceConstructorOptions.md +33 -0
  67. package/docs/reference/variables/restEntryPoints.md +5 -0
  68. package/docs/reference/variables/tagsHealth.md +5 -0
  69. package/docs/reference/variables/tagsInformation.md +5 -0
  70. package/locales/en.json +14 -0
  71. package/package.json +57 -5
@@ -0,0 +1,127 @@
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
+ A promise that resolves when the initial health check timers have been scheduled.
76
+
77
+ #### Throws
78
+
79
+ GeneralError if an exclude clone component is not a valid regular expression.
80
+
81
+ #### Implementation of
82
+
83
+ `IHealthComponent.start`
84
+
85
+ ***
86
+
87
+ ### stop() {#stop}
88
+
89
+ > **stop**(`nodeLoggingComponentType?`): `Promise`\<`void`\>
90
+
91
+ The component needs to be stopped when the node is closed.
92
+
93
+ #### Parameters
94
+
95
+ ##### nodeLoggingComponentType?
96
+
97
+ `string`
98
+
99
+ The node logging component type.
100
+
101
+ #### Returns
102
+
103
+ `Promise`\<`void`\>
104
+
105
+ A promise that resolves when the health check timers have been cancelled.
106
+
107
+ #### Implementation of
108
+
109
+ `IHealthComponent.stop`
110
+
111
+ ***
112
+
113
+ ### healthStatus() {#healthstatus}
114
+
115
+ > **healthStatus**(): `Promise`\<\{ `status`: `HealthStatus`; `components`: `IHealth`[]; \}\>
116
+
117
+ Get the server health.
118
+
119
+ #### Returns
120
+
121
+ `Promise`\<\{ `status`: `HealthStatus`; `components`: `IHealth`[]; \}\>
122
+
123
+ The service health.
124
+
125
+ #### Implementation of
126
+
127
+ `IHealthComponent.healthStatus`
@@ -0,0 +1,179 @@
1
+ # Class: InformationService
2
+
3
+ The information service for the server.
4
+
5
+ ## Implements
6
+
7
+ - `IInformationComponent`
8
+
9
+ ## Constructors
10
+
11
+ ### Constructor
12
+
13
+ > **new InformationService**(`options`): `InformationService`
14
+
15
+ Create a new instance of InformationService.
16
+
17
+ #### Parameters
18
+
19
+ ##### options
20
+
21
+ [`IInformationServiceConstructorOptions`](../interfaces/IInformationServiceConstructorOptions.md)
22
+
23
+ The options to create the service.
24
+
25
+ #### Returns
26
+
27
+ `InformationService`
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
+ `IInformationComponent.className`
54
+
55
+ ***
56
+
57
+ ### start() {#start}
58
+
59
+ > **start**(): `Promise`\<`void`\>
60
+
61
+ The service needs to be started when the application is initialized.
62
+
63
+ #### Returns
64
+
65
+ `Promise`\<`void`\>
66
+
67
+ A promise that resolves when the OpenAPI spec and favicon have been loaded from disk.
68
+
69
+ #### Implementation of
70
+
71
+ `IInformationComponent.start`
72
+
73
+ ***
74
+
75
+ ### root() {#root}
76
+
77
+ > **root**(): `Promise`\<`string`\>
78
+
79
+ Get the root information.
80
+
81
+ #### Returns
82
+
83
+ `Promise`\<`string`\>
84
+
85
+ The root information.
86
+
87
+ #### Implementation of
88
+
89
+ `IInformationComponent.root`
90
+
91
+ ***
92
+
93
+ ### info() {#info}
94
+
95
+ > **info**(): `Promise`\<`IServerInfo`\>
96
+
97
+ Get the server information.
98
+
99
+ #### Returns
100
+
101
+ `Promise`\<`IServerInfo`\>
102
+
103
+ The service information.
104
+
105
+ #### Implementation of
106
+
107
+ `IInformationComponent.info`
108
+
109
+ ***
110
+
111
+ ### favicon() {#favicon}
112
+
113
+ > **favicon**(): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\> \| `undefined`\>
114
+
115
+ Get the favicon.
116
+
117
+ #### Returns
118
+
119
+ `Promise`\<`Uint8Array`\<`ArrayBufferLike`\> \| `undefined`\>
120
+
121
+ The favicon.
122
+
123
+ #### Implementation of
124
+
125
+ `IInformationComponent.favicon`
126
+
127
+ ***
128
+
129
+ ### spec() {#spec}
130
+
131
+ > **spec**(): `Promise`\<`unknown`\>
132
+
133
+ Get the OpenAPI spec.
134
+
135
+ #### Returns
136
+
137
+ `Promise`\<`unknown`\>
138
+
139
+ The OpenAPI spec.
140
+
141
+ #### Implementation of
142
+
143
+ `IInformationComponent.spec`
144
+
145
+ ***
146
+
147
+ ### livez() {#livez}
148
+
149
+ > **livez**(): `Promise`\<\{ `status`: `"alive"` \| `"dead"`; \}\>
150
+
151
+ Is the server live.
152
+
153
+ #### Returns
154
+
155
+ `Promise`\<\{ `status`: `"alive"` \| `"dead"`; \}\>
156
+
157
+ The liveness status of the server.
158
+
159
+ #### Implementation of
160
+
161
+ `IInformationComponent.livez`
162
+
163
+ ***
164
+
165
+ ### readyz() {#readyz}
166
+
167
+ > **readyz**(): `Promise`\<\{ `status`: `"ready"` \| `"not ready"`; \}\>
168
+
169
+ Is the server ready.
170
+
171
+ #### Returns
172
+
173
+ `Promise`\<\{ `status`: `"ready"` \| `"not ready"`; \}\>
174
+
175
+ The readyz status of the server.
176
+
177
+ #### Implementation of
178
+
179
+ `IInformationComponent.readyz`
@@ -0,0 +1,209 @@
1
+ # Class: PlatformService
2
+
3
+ Service for performing platform operations.
4
+
5
+ ## Implements
6
+
7
+ - `IPlatformComponent`
8
+
9
+ ## Constructors
10
+
11
+ ### Constructor
12
+
13
+ > **new PlatformService**(`options?`): `PlatformService`
14
+
15
+ Create a new instance of PlatformService.
16
+
17
+ #### Parameters
18
+
19
+ ##### options?
20
+
21
+ [`IPlatformServiceConstructorOptions`](../interfaces/IPlatformServiceConstructorOptions.md)
22
+
23
+ The options for the connector.
24
+
25
+ #### Returns
26
+
27
+ `PlatformService`
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
+ `IPlatformComponent.className`
54
+
55
+ ***
56
+
57
+ ### isMultiTenant() {#ismultitenant}
58
+
59
+ > **isMultiTenant**(): `boolean`
60
+
61
+ Indicates whether the component is running in a multi-tenant environment.
62
+
63
+ #### Returns
64
+
65
+ `boolean`
66
+
67
+ True if the component is running in a multi-tenant environment, false otherwise.
68
+
69
+ #### Implementation of
70
+
71
+ `IPlatformComponent.isMultiTenant`
72
+
73
+ ***
74
+
75
+ ### execute() {#execute}
76
+
77
+ > **execute**(`method`): `Promise`\<`void`\>
78
+
79
+ Execute a method, if single tenant will run once, if multi-tenant will run for each tenant.
80
+
81
+ #### Parameters
82
+
83
+ ##### method
84
+
85
+ () => `Promise`\<`void`\> \| `Promise`\<`boolean` \| `undefined`\>
86
+
87
+ The method to run for each tenant, returning false will stop any further iterations.
88
+
89
+ #### Returns
90
+
91
+ `Promise`\<`void`\>
92
+
93
+ A promise that resolves when the method has been executed for all applicable tenants.
94
+
95
+ #### Implementation of
96
+
97
+ `IPlatformComponent.execute`
98
+
99
+ ***
100
+
101
+ ### getLocalOriginContext() {#getlocalorigincontext}
102
+
103
+ > **getLocalOriginContext**(`url`): `Promise`\<`IContextIds` \| `undefined`\>
104
+
105
+ Get the local origin context IDs for the given URL.
106
+
107
+ #### Parameters
108
+
109
+ ##### url
110
+
111
+ `string`
112
+
113
+ The URL to check.
114
+
115
+ #### Returns
116
+
117
+ `Promise`\<`IContextIds` \| `undefined`\>
118
+
119
+ A promise that resolves to the context IDs if the URL is a local origin, undefined otherwise.
120
+
121
+ #### Implementation of
122
+
123
+ `IPlatformComponent.getLocalOriginContext`
124
+
125
+ ***
126
+
127
+ ### registerTenantEventCallback() {#registertenanteventcallback}
128
+
129
+ > **registerTenantEventCallback**(`callbackId`, `callback`): `void`
130
+
131
+ Registers a callback to be invoked when a tenant event occurs.
132
+
133
+ #### Parameters
134
+
135
+ ##### callbackId
136
+
137
+ `string`
138
+
139
+ A unique identifier for the callback.
140
+
141
+ ##### callback
142
+
143
+ `TenantEventCallback`
144
+
145
+ The callback to invoke when a tenant event occurs.
146
+
147
+ #### Returns
148
+
149
+ `void`
150
+
151
+ #### Implementation of
152
+
153
+ `IPlatformComponent.registerTenantEventCallback`
154
+
155
+ ***
156
+
157
+ ### unregisterTenantEventCallback() {#unregistertenanteventcallback}
158
+
159
+ > **unregisterTenantEventCallback**(`callbackId`): `void`
160
+
161
+ Unregisters a previously registered tenant event callback.
162
+
163
+ #### Parameters
164
+
165
+ ##### callbackId
166
+
167
+ `string`
168
+
169
+ The identifier of the callback to unregister.
170
+
171
+ #### Returns
172
+
173
+ `void`
174
+
175
+ #### Implementation of
176
+
177
+ `IPlatformComponent.unregisterTenantEventCallback`
178
+
179
+ ***
180
+
181
+ ### fireTenantEvent() {#firetenantevent}
182
+
183
+ > **fireTenantEvent**(`tenantId`, `eventType`): `Promise`\<`void`\>
184
+
185
+ Fires all registered tenant event callbacks.
186
+
187
+ #### Parameters
188
+
189
+ ##### tenantId
190
+
191
+ `string`
192
+
193
+ The ID of the tenant for which the event occurred.
194
+
195
+ ##### eventType
196
+
197
+ `TenantEventType`
198
+
199
+ The type of event that occurred.
200
+
201
+ #### Returns
202
+
203
+ `Promise`\<`void`\>
204
+
205
+ A promise that resolves when all callbacks have been invoked.
206
+
207
+ #### Implementation of
208
+
209
+ `IPlatformComponent.fireTenantEvent`
@@ -0,0 +1,25 @@
1
+ # Function: generateRestRoutesHealth()
2
+
3
+ > **generateRestRoutesHealth**(`baseRouteName`, `componentName`): `IRestRoute`\<`any`, `any`\>[]
4
+
5
+ The REST routes for server health.
6
+
7
+ ## Parameters
8
+
9
+ ### baseRouteName
10
+
11
+ `string`
12
+
13
+ Prefix to prepend to the paths.
14
+
15
+ ### componentName
16
+
17
+ `string`
18
+
19
+ The name of the component to use in the routes stored in the ComponentFactory.
20
+
21
+ ## Returns
22
+
23
+ `IRestRoute`\<`any`, `any`\>[]
24
+
25
+ The generated routes.
@@ -0,0 +1,25 @@
1
+ # Function: generateRestRoutesInformation()
2
+
3
+ > **generateRestRoutesInformation**(`baseRouteName`, `componentName`): `IRestRoute`\<`any`, `any`\>[]
4
+
5
+ The REST routes for server information.
6
+
7
+ ## Parameters
8
+
9
+ ### baseRouteName
10
+
11
+ `string`
12
+
13
+ Prefix to prepend to the paths.
14
+
15
+ ### componentName
16
+
17
+ `string`
18
+
19
+ The name of the component to use in the routes stored in the ComponentFactory.
20
+
21
+ ## Returns
22
+
23
+ `IRestRoute`\<`any`, `any`\>[]
24
+
25
+ The generated routes.
@@ -0,0 +1,31 @@
1
+ # Function: serverFavIcon()
2
+
3
+ > **serverFavIcon**(`httpRequestContext`, `componentName`, `request`): `Promise`\<`IServerFavIconResponse`\>
4
+
5
+ Get the favicon for the server.
6
+
7
+ ## Parameters
8
+
9
+ ### httpRequestContext
10
+
11
+ `IHttpRequestContext`
12
+
13
+ The request context for the API.
14
+
15
+ ### componentName
16
+
17
+ `string`
18
+
19
+ The name of the component to use in the routes.
20
+
21
+ ### request
22
+
23
+ `INoContentRequest`
24
+
25
+ The request.
26
+
27
+ ## Returns
28
+
29
+ `Promise`\<`IServerFavIconResponse`\>
30
+
31
+ The response object with additional http response properties.
@@ -0,0 +1,31 @@
1
+ # Function: serverHealth()
2
+
3
+ > **serverHealth**(`httpRequestContext`, `componentName`, `request`): `Promise`\<`IServerHealthResponse`\>
4
+
5
+ Get the health for the server.
6
+
7
+ ## Parameters
8
+
9
+ ### httpRequestContext
10
+
11
+ `IHttpRequestContext`
12
+
13
+ The request context for the API.
14
+
15
+ ### componentName
16
+
17
+ `string`
18
+
19
+ The name of the component to use in the routes.
20
+
21
+ ### request
22
+
23
+ `INoContentRequest`
24
+
25
+ The request.
26
+
27
+ ## Returns
28
+
29
+ `Promise`\<`IServerHealthResponse`\>
30
+
31
+ The response object with additional http response properties.
@@ -0,0 +1,31 @@
1
+ # Function: serverInfo()
2
+
3
+ > **serverInfo**(`httpRequestContext`, `componentName`, `request`): `Promise`\<`IServerInfoResponse`\>
4
+
5
+ Get the information for the server.
6
+
7
+ ## Parameters
8
+
9
+ ### httpRequestContext
10
+
11
+ `IHttpRequestContext`
12
+
13
+ The request context for the API.
14
+
15
+ ### componentName
16
+
17
+ `string`
18
+
19
+ The name of the component to use in the routes.
20
+
21
+ ### request
22
+
23
+ `INoContentRequest`
24
+
25
+ The request.
26
+
27
+ ## Returns
28
+
29
+ `Promise`\<`IServerInfoResponse`\>
30
+
31
+ The response object with additional http response properties.
@@ -0,0 +1,31 @@
1
+ # Function: serverLivez()
2
+
3
+ > **serverLivez**(`httpRequestContext`, `componentName`, `request`): `Promise`\<`IServerLivezResponse`\>
4
+
5
+ Get the livez for the server.
6
+
7
+ ## Parameters
8
+
9
+ ### httpRequestContext
10
+
11
+ `IHttpRequestContext`
12
+
13
+ The request context for the API.
14
+
15
+ ### componentName
16
+
17
+ `string`
18
+
19
+ The name of the component to use in the routes.
20
+
21
+ ### request
22
+
23
+ `INoContentRequest`
24
+
25
+ The request.
26
+
27
+ ## Returns
28
+
29
+ `Promise`\<`IServerLivezResponse`\>
30
+
31
+ The response object with additional http response properties.
@@ -0,0 +1,31 @@
1
+ # Function: serverReadyz()
2
+
3
+ > **serverReadyz**(`httpRequestContext`, `componentName`, `request`): `Promise`\<`IServerReadyzResponse`\>
4
+
5
+ Get the readyz for the server.
6
+
7
+ ## Parameters
8
+
9
+ ### httpRequestContext
10
+
11
+ `IHttpRequestContext`
12
+
13
+ The request context for the API.
14
+
15
+ ### componentName
16
+
17
+ `string`
18
+
19
+ The name of the component to use in the routes.
20
+
21
+ ### request
22
+
23
+ `INoContentRequest`
24
+
25
+ The request.
26
+
27
+ ## Returns
28
+
29
+ `Promise`\<`IServerReadyzResponse`\>
30
+
31
+ The response object with additional http response properties.