@twin.org/api-models 0.0.3-next.5 → 0.0.3-next.51
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 +1 -1
- package/dist/es/errors/forbiddenError.js +23 -0
- package/dist/es/errors/forbiddenError.js.map +1 -0
- package/dist/es/errors/tooManyRequestsError.js +25 -0
- package/dist/es/errors/tooManyRequestsError.js.map +1 -0
- package/dist/es/helpers/httpErrorHelper.js +34 -20
- package/dist/es/helpers/httpErrorHelper.js.map +1 -1
- package/dist/es/helpers/httpUrlHelper.js +141 -0
- package/dist/es/helpers/httpUrlHelper.js.map +1 -0
- package/dist/es/index.js +12 -4
- package/dist/es/index.js.map +1 -1
- package/dist/es/models/api/IServerHealthResponse.js.map +1 -1
- package/dist/es/models/api/IServerLivezResponse.js +2 -0
- package/dist/es/models/api/IServerLivezResponse.js.map +1 -0
- package/dist/es/models/api/IServerReadyzResponse.js +2 -0
- package/dist/es/models/api/IServerReadyzResponse.js.map +1 -0
- package/dist/es/models/api/IServerRootResponse.js +0 -2
- package/dist/es/models/api/IServerRootResponse.js.map +1 -1
- package/dist/es/models/config/IBaseRestClientConfig.js.map +1 -1
- package/dist/es/models/httpContextIdKeys.js +33 -0
- package/dist/es/models/httpContextIdKeys.js.map +1 -0
- package/dist/es/models/protocol/IHttpServerRequest.js.map +1 -1
- package/dist/es/models/responses/errors/IConflictResponse.js.map +1 -1
- package/dist/es/models/responses/errors/INotImplementedResponse.js +2 -0
- package/dist/es/models/responses/errors/INotImplementedResponse.js.map +1 -0
- package/dist/es/models/responses/errors/ITooManyRequestsResponse.js +2 -0
- package/dist/es/models/responses/errors/ITooManyRequestsResponse.js.map +1 -0
- package/dist/es/models/routes/IBaseRoute.js.map +1 -1
- package/dist/es/models/server/IBaseRouteProcessor.js.map +1 -1
- package/dist/es/models/server/IRestRouteProcessor.js.map +1 -1
- package/dist/es/models/server/ISocketRouteProcessor.js.map +1 -1
- package/dist/es/models/server/IWebServer.js.map +1 -1
- package/dist/es/models/server/IWebServerOptions.js.map +1 -1
- package/dist/es/models/services/IHealthComponent.js +2 -0
- package/dist/es/models/services/IHealthComponent.js.map +1 -0
- package/dist/es/models/services/IInformationComponent.js.map +1 -1
- package/dist/es/models/services/IPlatformComponent.js +2 -0
- package/dist/es/models/services/IPlatformComponent.js.map +1 -0
- package/dist/es/models/services/ITenant.js +4 -0
- package/dist/es/models/services/ITenant.js.map +1 -0
- package/dist/es/models/services/ITenantAdminComponent.js +2 -0
- package/dist/es/models/services/ITenantAdminComponent.js.map +1 -0
- package/dist/types/errors/forbiddenError.d.ts +20 -0
- package/dist/types/errors/tooManyRequestsError.d.ts +22 -0
- package/dist/types/helpers/httpErrorHelper.d.ts +6 -0
- package/dist/types/helpers/httpUrlHelper.d.ts +70 -0
- package/dist/types/index.d.ts +12 -4
- package/dist/types/models/api/IServerHealthResponse.d.ts +6 -3
- package/dist/types/models/api/IServerLivezResponse.d.ts +16 -0
- package/dist/types/models/api/IServerReadyzResponse.d.ts +16 -0
- package/dist/types/models/api/IServerRootResponse.d.ts +7 -0
- package/dist/types/models/config/IBaseRestClientConfig.d.ts +16 -0
- package/dist/types/models/httpContextIdKeys.d.ts +33 -0
- package/dist/types/models/protocol/IHttpServerRequest.d.ts +4 -4
- package/dist/types/models/responses/errors/IConflictResponse.d.ts +1 -6
- package/dist/types/models/responses/errors/INotImplementedResponse.d.ts +15 -0
- package/dist/types/models/responses/errors/ITooManyRequestsResponse.d.ts +15 -0
- package/dist/types/models/routes/IBaseRoute.d.ts +9 -1
- package/dist/types/models/server/IBaseRouteProcessor.d.ts +10 -4
- package/dist/types/models/server/IRestRouteProcessor.d.ts +5 -2
- package/dist/types/models/server/IWebServer.d.ts +10 -4
- package/dist/types/models/server/IWebServerOptions.d.ts +5 -0
- package/dist/types/models/services/IHealthComponent.d.ts +14 -0
- package/dist/types/models/services/IInformationComponent.d.ts +10 -17
- package/dist/types/models/services/IPlatformComponent.d.ts +24 -0
- package/dist/types/models/services/ITenant.d.ts +37 -0
- package/dist/types/models/services/ITenantAdminComponent.d.ts +70 -0
- package/docs/changelog.md +415 -74
- package/docs/examples.md +200 -1
- package/docs/reference/classes/ForbiddenError.md +55 -0
- package/docs/reference/classes/HttpErrorHelper.md +14 -2
- package/docs/reference/classes/HttpParameterHelper.md +4 -4
- package/docs/reference/classes/HttpUrlHelper.md +259 -0
- package/docs/reference/classes/TooManyRequestsError.md +67 -0
- package/docs/reference/index.md +13 -5
- package/docs/reference/interfaces/IAcceptedResponse.md +2 -2
- package/docs/reference/interfaces/IBadRequestResponse.md +2 -2
- package/docs/reference/interfaces/IBaseRestClientConfig.md +57 -9
- package/docs/reference/interfaces/IBaseRoute.md +25 -9
- package/docs/reference/interfaces/IBaseRouteEntryPoint.md +4 -4
- package/docs/reference/interfaces/IBaseRouteProcessor.md +21 -13
- package/docs/reference/interfaces/IBaseSocketClientConfig.md +7 -7
- package/docs/reference/interfaces/IConflictResponse.md +3 -11
- package/docs/reference/interfaces/ICreatedResponse.md +2 -2
- package/docs/reference/interfaces/IForbiddenResponse.md +2 -2
- package/docs/reference/interfaces/IHealthComponent.md +21 -0
- package/docs/reference/interfaces/IHttpRequest.md +8 -8
- package/docs/reference/interfaces/IHttpRequestContext.md +4 -4
- package/docs/reference/interfaces/IHttpRequestPathParams.md +1 -1
- package/docs/reference/interfaces/IHttpRequestQuery.md +1 -1
- package/docs/reference/interfaces/IHttpResponse.md +6 -6
- package/docs/reference/interfaces/IHttpServerRequest.md +14 -14
- package/docs/reference/interfaces/IInformationComponent.md +14 -56
- package/docs/reference/interfaces/IInternalServerErrorResponse.md +2 -2
- package/docs/reference/interfaces/IMimeTypeProcessor.md +2 -2
- package/docs/reference/interfaces/INoContentRequest.md +8 -8
- package/docs/reference/interfaces/INoContentResponse.md +1 -1
- package/docs/reference/interfaces/INotFoundResponse.md +3 -3
- package/docs/reference/interfaces/INotImplementedResponse.md +19 -0
- package/docs/reference/interfaces/IOkResponse.md +1 -1
- package/docs/reference/interfaces/IPlatformComponent.md +65 -0
- package/docs/reference/interfaces/IRestRoute.md +47 -23
- package/docs/reference/interfaces/IRestRouteExample.md +3 -3
- package/docs/reference/interfaces/IRestRouteProcessor.md +31 -19
- package/docs/reference/interfaces/IRestRouteRequestExample.md +4 -4
- package/docs/reference/interfaces/IRestRouteResponseAttachmentOptions.md +6 -6
- package/docs/reference/interfaces/IRestRouteResponseExample.md +4 -4
- package/docs/reference/interfaces/IRestRouteResponseOptions.md +2 -2
- package/docs/reference/interfaces/IServerFavIconResponse.md +7 -7
- package/docs/reference/interfaces/IServerHealthResponse.md +11 -3
- package/docs/reference/interfaces/IServerInfo.md +2 -2
- package/docs/reference/interfaces/IServerInfoResponse.md +1 -1
- package/docs/reference/interfaces/IServerLivezResponse.md +23 -0
- package/docs/reference/interfaces/IServerReadyzResponse.md +23 -0
- package/docs/reference/interfaces/IServerRootResponse.md +13 -1
- package/docs/reference/interfaces/IServerSpecResponse.md +4 -4
- package/docs/reference/interfaces/ISocketRequestContext.md +5 -5
- package/docs/reference/interfaces/ISocketRoute.md +38 -14
- package/docs/reference/interfaces/ISocketRouteProcessor.md +30 -22
- package/docs/reference/interfaces/ISocketServerRequest.md +17 -17
- package/docs/reference/interfaces/ITag.md +2 -2
- package/docs/reference/interfaces/ITenant.md +67 -0
- package/docs/reference/interfaces/ITenantAdminComponent.md +227 -0
- package/docs/reference/interfaces/ITooManyRequestsResponse.md +19 -0
- package/docs/reference/interfaces/IUnauthorizedResponse.md +2 -2
- package/docs/reference/interfaces/IUnprocessableEntityResponse.md +2 -2
- package/docs/reference/interfaces/IWebServer.md +37 -7
- package/docs/reference/interfaces/IWebServerOptions.md +21 -12
- package/docs/reference/type-aliases/HttpContextIdKeys.md +5 -0
- package/docs/reference/variables/HttpContextIdKeys.md +43 -0
- package/package.json +5 -4
- package/dist/es/factories/authenticationGeneratorFactory.js +0 -9
- package/dist/es/factories/authenticationGeneratorFactory.js.map +0 -1
- package/dist/es/models/client/IAuthenticationGenerator.js +0 -2
- package/dist/es/models/client/IAuthenticationGenerator.js.map +0 -1
- package/dist/es/models/services/IHealthInfo.js +0 -2
- package/dist/es/models/services/IHealthInfo.js.map +0 -1
- package/dist/es/models/services/healthStatus.js +0 -21
- package/dist/es/models/services/healthStatus.js.map +0 -1
- package/dist/types/factories/authenticationGeneratorFactory.d.ts +0 -6
- package/dist/types/models/client/IAuthenticationGenerator.d.ts +0 -14
- package/dist/types/models/services/IHealthInfo.d.ts +0 -27
- package/dist/types/models/services/healthStatus.d.ts +0 -21
- package/docs/reference/interfaces/IAuthenticationGenerator.md +0 -35
- package/docs/reference/interfaces/IHealthInfo.md +0 -37
- package/docs/reference/type-aliases/HealthStatus.md +0 -5
- package/docs/reference/variables/AuthenticationGeneratorFactory.md +0 -5
- package/docs/reference/variables/HealthStatus.md +0 -25
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# Interface: ITenant
|
|
2
|
+
|
|
3
|
+
Model defining the tenant.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
### id {#id}
|
|
8
|
+
|
|
9
|
+
> **id**: `string`
|
|
10
|
+
|
|
11
|
+
The unique identifier for the tenant.
|
|
12
|
+
|
|
13
|
+
***
|
|
14
|
+
|
|
15
|
+
### apiKey {#apikey}
|
|
16
|
+
|
|
17
|
+
> **apiKey**: `string`
|
|
18
|
+
|
|
19
|
+
The api key for the tenant.
|
|
20
|
+
|
|
21
|
+
***
|
|
22
|
+
|
|
23
|
+
### label {#label}
|
|
24
|
+
|
|
25
|
+
> **label**: `string`
|
|
26
|
+
|
|
27
|
+
The label of the tenant.
|
|
28
|
+
|
|
29
|
+
***
|
|
30
|
+
|
|
31
|
+
### dateCreated {#datecreated}
|
|
32
|
+
|
|
33
|
+
> **dateCreated**: `string`
|
|
34
|
+
|
|
35
|
+
The date the tenant was created.
|
|
36
|
+
|
|
37
|
+
***
|
|
38
|
+
|
|
39
|
+
### dateModified {#datemodified}
|
|
40
|
+
|
|
41
|
+
> **dateModified**: `string`
|
|
42
|
+
|
|
43
|
+
The date the tenant was modified.
|
|
44
|
+
|
|
45
|
+
***
|
|
46
|
+
|
|
47
|
+
### publicOrigin? {#publicorigin}
|
|
48
|
+
|
|
49
|
+
> `optional` **publicOrigin?**: `string`
|
|
50
|
+
|
|
51
|
+
The public origin available to the public for accessing the API.
|
|
52
|
+
|
|
53
|
+
***
|
|
54
|
+
|
|
55
|
+
### organizationId {#organizationid}
|
|
56
|
+
|
|
57
|
+
> **organizationId**: `string`
|
|
58
|
+
|
|
59
|
+
The organization id for the tenant.
|
|
60
|
+
|
|
61
|
+
***
|
|
62
|
+
|
|
63
|
+
### organizationIdLegacy? {#organizationidlegacy}
|
|
64
|
+
|
|
65
|
+
> `optional` **organizationIdLegacy?**: `string`[]
|
|
66
|
+
|
|
67
|
+
Optional list of organization aliases that can are used for legacy lookups.
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
# Interface: ITenantAdminComponent
|
|
2
|
+
|
|
3
|
+
Configuration for the tenant admin component
|
|
4
|
+
|
|
5
|
+
## Extends
|
|
6
|
+
|
|
7
|
+
- `IComponent`
|
|
8
|
+
|
|
9
|
+
## Methods
|
|
10
|
+
|
|
11
|
+
### create() {#create}
|
|
12
|
+
|
|
13
|
+
> **create**(`tenant`): `Promise`\<`string`\>
|
|
14
|
+
|
|
15
|
+
Create a tenant.
|
|
16
|
+
|
|
17
|
+
#### Parameters
|
|
18
|
+
|
|
19
|
+
##### tenant
|
|
20
|
+
|
|
21
|
+
`Omit`\<[`ITenant`](ITenant.md), `"id"` \| `"dateCreated"` \| `"dateModified"`\> & `object`
|
|
22
|
+
|
|
23
|
+
The tenant to store.
|
|
24
|
+
|
|
25
|
+
#### Returns
|
|
26
|
+
|
|
27
|
+
`Promise`\<`string`\>
|
|
28
|
+
|
|
29
|
+
The tenant id.
|
|
30
|
+
|
|
31
|
+
***
|
|
32
|
+
|
|
33
|
+
### update() {#update}
|
|
34
|
+
|
|
35
|
+
> **update**(`tenant`): `Promise`\<`void`\>
|
|
36
|
+
|
|
37
|
+
Update a tenant.
|
|
38
|
+
|
|
39
|
+
#### Parameters
|
|
40
|
+
|
|
41
|
+
##### tenant
|
|
42
|
+
|
|
43
|
+
`Partial`\<`Omit`\<[`ITenant`](ITenant.md), `"dateCreated"` \| `"dateModified"`\>\>
|
|
44
|
+
|
|
45
|
+
The tenant to update.
|
|
46
|
+
|
|
47
|
+
#### Returns
|
|
48
|
+
|
|
49
|
+
`Promise`\<`void`\>
|
|
50
|
+
|
|
51
|
+
A promise that resolves when the tenant has been updated.
|
|
52
|
+
|
|
53
|
+
***
|
|
54
|
+
|
|
55
|
+
### get() {#get}
|
|
56
|
+
|
|
57
|
+
> **get**(`tenantId`): `Promise`\<[`ITenant`](ITenant.md)\>
|
|
58
|
+
|
|
59
|
+
Get a tenant by its id.
|
|
60
|
+
|
|
61
|
+
#### Parameters
|
|
62
|
+
|
|
63
|
+
##### tenantId
|
|
64
|
+
|
|
65
|
+
`string`
|
|
66
|
+
|
|
67
|
+
The id of the tenant.
|
|
68
|
+
|
|
69
|
+
#### Returns
|
|
70
|
+
|
|
71
|
+
`Promise`\<[`ITenant`](ITenant.md)\>
|
|
72
|
+
|
|
73
|
+
The tenant.
|
|
74
|
+
|
|
75
|
+
#### Throws
|
|
76
|
+
|
|
77
|
+
Error if the tenant is not found.
|
|
78
|
+
|
|
79
|
+
***
|
|
80
|
+
|
|
81
|
+
### getByApiKey() {#getbyapikey}
|
|
82
|
+
|
|
83
|
+
> **getByApiKey**(`apiKey`): `Promise`\<[`ITenant`](ITenant.md)\>
|
|
84
|
+
|
|
85
|
+
Get a tenant by its api key.
|
|
86
|
+
|
|
87
|
+
#### Parameters
|
|
88
|
+
|
|
89
|
+
##### apiKey
|
|
90
|
+
|
|
91
|
+
`string`
|
|
92
|
+
|
|
93
|
+
The api key of the tenant.
|
|
94
|
+
|
|
95
|
+
#### Returns
|
|
96
|
+
|
|
97
|
+
`Promise`\<[`ITenant`](ITenant.md)\>
|
|
98
|
+
|
|
99
|
+
The tenant.
|
|
100
|
+
|
|
101
|
+
#### Throws
|
|
102
|
+
|
|
103
|
+
Error if the tenant is not found.
|
|
104
|
+
|
|
105
|
+
***
|
|
106
|
+
|
|
107
|
+
### getByPublicOrigin() {#getbypublicorigin}
|
|
108
|
+
|
|
109
|
+
> **getByPublicOrigin**(`publicOrigin`): `Promise`\<[`ITenant`](ITenant.md)\>
|
|
110
|
+
|
|
111
|
+
Get a tenant by its public origin.
|
|
112
|
+
|
|
113
|
+
#### Parameters
|
|
114
|
+
|
|
115
|
+
##### publicOrigin
|
|
116
|
+
|
|
117
|
+
`string`
|
|
118
|
+
|
|
119
|
+
The origin of the tenant.
|
|
120
|
+
|
|
121
|
+
#### Returns
|
|
122
|
+
|
|
123
|
+
`Promise`\<[`ITenant`](ITenant.md)\>
|
|
124
|
+
|
|
125
|
+
The tenant.
|
|
126
|
+
|
|
127
|
+
#### Throws
|
|
128
|
+
|
|
129
|
+
Error if the tenant is not found.
|
|
130
|
+
|
|
131
|
+
***
|
|
132
|
+
|
|
133
|
+
### remove() {#remove}
|
|
134
|
+
|
|
135
|
+
> **remove**(`tenantId`): `Promise`\<`void`\>
|
|
136
|
+
|
|
137
|
+
Remove a tenant by its id.
|
|
138
|
+
|
|
139
|
+
#### Parameters
|
|
140
|
+
|
|
141
|
+
##### tenantId
|
|
142
|
+
|
|
143
|
+
`string`
|
|
144
|
+
|
|
145
|
+
The id of the tenant.
|
|
146
|
+
|
|
147
|
+
#### Returns
|
|
148
|
+
|
|
149
|
+
`Promise`\<`void`\>
|
|
150
|
+
|
|
151
|
+
A promise that resolves when the tenant has been removed.
|
|
152
|
+
|
|
153
|
+
#### Throws
|
|
154
|
+
|
|
155
|
+
Error if the tenant is not found.
|
|
156
|
+
|
|
157
|
+
***
|
|
158
|
+
|
|
159
|
+
### getTenantByOrganizationId() {#gettenantbyorganizationid}
|
|
160
|
+
|
|
161
|
+
> **getTenantByOrganizationId**(`organizationId`, `includeLegacy?`): `Promise`\<[`ITenant`](ITenant.md)\>
|
|
162
|
+
|
|
163
|
+
Get a tenant by its organization id, optionally searching legacy ids.
|
|
164
|
+
|
|
165
|
+
#### Parameters
|
|
166
|
+
|
|
167
|
+
##### organizationId
|
|
168
|
+
|
|
169
|
+
`string`
|
|
170
|
+
|
|
171
|
+
The organization id of the tenant.
|
|
172
|
+
|
|
173
|
+
##### includeLegacy?
|
|
174
|
+
|
|
175
|
+
`boolean`
|
|
176
|
+
|
|
177
|
+
Whether to also search the legacy organization id array.
|
|
178
|
+
|
|
179
|
+
#### Returns
|
|
180
|
+
|
|
181
|
+
`Promise`\<[`ITenant`](ITenant.md)\>
|
|
182
|
+
|
|
183
|
+
The tenant.
|
|
184
|
+
|
|
185
|
+
#### Throws
|
|
186
|
+
|
|
187
|
+
Error if the tenant is not found.
|
|
188
|
+
|
|
189
|
+
***
|
|
190
|
+
|
|
191
|
+
### query() {#query}
|
|
192
|
+
|
|
193
|
+
> **query**(`conditions?`, `properties?`, `cursor?`, `limit?`): `Promise`\<\{ `tenants`: [`ITenant`](ITenant.md)[]; `cursor?`: `string`; \}\>
|
|
194
|
+
|
|
195
|
+
Query tenants with pagination.
|
|
196
|
+
|
|
197
|
+
#### Parameters
|
|
198
|
+
|
|
199
|
+
##### conditions?
|
|
200
|
+
|
|
201
|
+
`EntityCondition`\<[`ITenant`](ITenant.md)\>
|
|
202
|
+
|
|
203
|
+
The conditions to filter the tenants.
|
|
204
|
+
|
|
205
|
+
##### properties?
|
|
206
|
+
|
|
207
|
+
keyof [`ITenant`](ITenant.md)[]
|
|
208
|
+
|
|
209
|
+
The properties to include in the returned tenants.
|
|
210
|
+
|
|
211
|
+
##### cursor?
|
|
212
|
+
|
|
213
|
+
`string`
|
|
214
|
+
|
|
215
|
+
The cursor to start from.
|
|
216
|
+
|
|
217
|
+
##### limit?
|
|
218
|
+
|
|
219
|
+
`number`
|
|
220
|
+
|
|
221
|
+
The maximum number of tenants to return.
|
|
222
|
+
|
|
223
|
+
#### Returns
|
|
224
|
+
|
|
225
|
+
`Promise`\<\{ `tenants`: [`ITenant`](ITenant.md)[]; `cursor?`: `string`; \}\>
|
|
226
|
+
|
|
227
|
+
The tenants and the next cursor if more tenants are available.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Interface: ITooManyRequestsResponse
|
|
2
|
+
|
|
3
|
+
The request resulted in too many requests, see the content for more details.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
### statusCode {#statuscode}
|
|
8
|
+
|
|
9
|
+
> **statusCode**: `429`
|
|
10
|
+
|
|
11
|
+
Response status code.
|
|
12
|
+
|
|
13
|
+
***
|
|
14
|
+
|
|
15
|
+
### body {#body}
|
|
16
|
+
|
|
17
|
+
> **body**: `IError`
|
|
18
|
+
|
|
19
|
+
The body which contains the error.
|
|
@@ -4,7 +4,7 @@ You are not authorized to use the API or no credentials were supplied, see the c
|
|
|
4
4
|
|
|
5
5
|
## Properties
|
|
6
6
|
|
|
7
|
-
### statusCode
|
|
7
|
+
### statusCode {#statuscode}
|
|
8
8
|
|
|
9
9
|
> **statusCode**: `401`
|
|
10
10
|
|
|
@@ -12,7 +12,7 @@ Response status code.
|
|
|
12
12
|
|
|
13
13
|
***
|
|
14
14
|
|
|
15
|
-
### body
|
|
15
|
+
### body {#body}
|
|
16
16
|
|
|
17
17
|
> **body**: `IError`
|
|
18
18
|
|
|
@@ -4,7 +4,7 @@ The server cannot process the request, see the content for more details.
|
|
|
4
4
|
|
|
5
5
|
## Properties
|
|
6
6
|
|
|
7
|
-
### statusCode
|
|
7
|
+
### statusCode {#statuscode}
|
|
8
8
|
|
|
9
9
|
> **statusCode**: `422`
|
|
10
10
|
|
|
@@ -12,7 +12,7 @@ Response status code.
|
|
|
12
12
|
|
|
13
13
|
***
|
|
14
14
|
|
|
15
|
-
### body
|
|
15
|
+
### body {#body}
|
|
16
16
|
|
|
17
17
|
> **body**: `IError`
|
|
18
18
|
|
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
Interface describing a web server.
|
|
4
4
|
|
|
5
|
+
## Extends
|
|
6
|
+
|
|
7
|
+
- `IComponent`
|
|
8
|
+
|
|
5
9
|
## Type Parameters
|
|
6
10
|
|
|
7
11
|
### T
|
|
@@ -10,7 +14,7 @@ Interface describing a web server.
|
|
|
10
14
|
|
|
11
15
|
## Methods
|
|
12
16
|
|
|
13
|
-
### getInstance()
|
|
17
|
+
### getInstance() {#getinstance}
|
|
14
18
|
|
|
15
19
|
> **getInstance**(): `T`
|
|
16
20
|
|
|
@@ -24,7 +28,7 @@ The web server instance.
|
|
|
24
28
|
|
|
25
29
|
***
|
|
26
30
|
|
|
27
|
-
### build()
|
|
31
|
+
### build() {#build}
|
|
28
32
|
|
|
29
33
|
> **build**(`restRouteProcessors?`, `restRoutes?`, `socketRouteProcessors?`, `socketRoutes?`, `options?`): `Promise`\<`void`\>
|
|
30
34
|
|
|
@@ -66,11 +70,11 @@ Options for building the server.
|
|
|
66
70
|
|
|
67
71
|
`Promise`\<`void`\>
|
|
68
72
|
|
|
69
|
-
|
|
73
|
+
A promise that resolves when the server is fully built and ready to start.
|
|
70
74
|
|
|
71
75
|
***
|
|
72
76
|
|
|
73
|
-
### start()
|
|
77
|
+
### start() {#start}
|
|
74
78
|
|
|
75
79
|
> **start**(): `Promise`\<`void`\>
|
|
76
80
|
|
|
@@ -80,11 +84,15 @@ Start the server.
|
|
|
80
84
|
|
|
81
85
|
`Promise`\<`void`\>
|
|
82
86
|
|
|
83
|
-
|
|
87
|
+
A promise that resolves when the server is listening for connections.
|
|
88
|
+
|
|
89
|
+
#### Overrides
|
|
90
|
+
|
|
91
|
+
`IComponent.start`
|
|
84
92
|
|
|
85
93
|
***
|
|
86
94
|
|
|
87
|
-
### stop()
|
|
95
|
+
### stop() {#stop}
|
|
88
96
|
|
|
89
97
|
> **stop**(): `Promise`\<`void`\>
|
|
90
98
|
|
|
@@ -94,4 +102,26 @@ Stop the server.
|
|
|
94
102
|
|
|
95
103
|
`Promise`\<`void`\>
|
|
96
104
|
|
|
97
|
-
|
|
105
|
+
A promise that resolves when the server has shut down all connections.
|
|
106
|
+
|
|
107
|
+
#### Overrides
|
|
108
|
+
|
|
109
|
+
`IComponent.stop`
|
|
110
|
+
|
|
111
|
+
***
|
|
112
|
+
|
|
113
|
+
### health() {#health}
|
|
114
|
+
|
|
115
|
+
> **health**(): `Promise`\<`IHealth`[]\>
|
|
116
|
+
|
|
117
|
+
Returns the health status of the component.
|
|
118
|
+
|
|
119
|
+
#### Returns
|
|
120
|
+
|
|
121
|
+
`Promise`\<`IHealth`[]\>
|
|
122
|
+
|
|
123
|
+
The health status of the component, can return multiple entries for elements within the component.
|
|
124
|
+
|
|
125
|
+
#### Overrides
|
|
126
|
+
|
|
127
|
+
`IComponent.health`
|
|
@@ -4,9 +4,9 @@ Options for the web server.
|
|
|
4
4
|
|
|
5
5
|
## Properties
|
|
6
6
|
|
|
7
|
-
### port?
|
|
7
|
+
### port? {#port}
|
|
8
8
|
|
|
9
|
-
> `optional` **port
|
|
9
|
+
> `optional` **port?**: `number`
|
|
10
10
|
|
|
11
11
|
The port to bind the web server to.
|
|
12
12
|
|
|
@@ -18,9 +18,9 @@ The port to bind the web server to.
|
|
|
18
18
|
|
|
19
19
|
***
|
|
20
20
|
|
|
21
|
-
### host?
|
|
21
|
+
### host? {#host}
|
|
22
22
|
|
|
23
|
-
> `optional` **host
|
|
23
|
+
> `optional` **host?**: `string`
|
|
24
24
|
|
|
25
25
|
The address to bind the web server to.
|
|
26
26
|
|
|
@@ -32,9 +32,9 @@ localhost
|
|
|
32
32
|
|
|
33
33
|
***
|
|
34
34
|
|
|
35
|
-
### methods?
|
|
35
|
+
### methods? {#methods}
|
|
36
36
|
|
|
37
|
-
> `optional` **methods
|
|
37
|
+
> `optional` **methods?**: `HttpMethod`[]
|
|
38
38
|
|
|
39
39
|
The methods that the server accepts.
|
|
40
40
|
|
|
@@ -46,25 +46,25 @@ The methods that the server accepts.
|
|
|
46
46
|
|
|
47
47
|
***
|
|
48
48
|
|
|
49
|
-
### allowedHeaders?
|
|
49
|
+
### allowedHeaders? {#allowedheaders}
|
|
50
50
|
|
|
51
|
-
> `optional` **allowedHeaders
|
|
51
|
+
> `optional` **allowedHeaders?**: `string`[]
|
|
52
52
|
|
|
53
53
|
Any additional allowed headers.
|
|
54
54
|
|
|
55
55
|
***
|
|
56
56
|
|
|
57
|
-
### exposedHeaders?
|
|
57
|
+
### exposedHeaders? {#exposedheaders}
|
|
58
58
|
|
|
59
|
-
> `optional` **exposedHeaders
|
|
59
|
+
> `optional` **exposedHeaders?**: `string`[]
|
|
60
60
|
|
|
61
61
|
And additional exposed headers.
|
|
62
62
|
|
|
63
63
|
***
|
|
64
64
|
|
|
65
|
-
### corsOrigins?
|
|
65
|
+
### corsOrigins? {#corsorigins}
|
|
66
66
|
|
|
67
|
-
> `optional` **corsOrigins
|
|
67
|
+
> `optional` **corsOrigins?**: `string` \| `string`[]
|
|
68
68
|
|
|
69
69
|
The allowed CORS domains.
|
|
70
70
|
|
|
@@ -73,3 +73,12 @@ The allowed CORS domains.
|
|
|
73
73
|
```ts
|
|
74
74
|
["*"]
|
|
75
75
|
```
|
|
76
|
+
|
|
77
|
+
***
|
|
78
|
+
|
|
79
|
+
### publicOrigin? {#publicorigin}
|
|
80
|
+
|
|
81
|
+
> `optional` **publicOrigin?**: `string`
|
|
82
|
+
|
|
83
|
+
The public origin of the server, used for constructing the request URL.
|
|
84
|
+
If not provided, it will be determined from the incoming request.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Variable: HttpContextIdKeys
|
|
2
|
+
|
|
3
|
+
> `const` **HttpContextIdKeys**: `object`
|
|
4
|
+
|
|
5
|
+
HTTP definition of some context keys.
|
|
6
|
+
|
|
7
|
+
## Type Declaration
|
|
8
|
+
|
|
9
|
+
### IpAddress {#ipaddress}
|
|
10
|
+
|
|
11
|
+
> `readonly` **IpAddress**: `"ipAddress"` = `"ipAddress"`
|
|
12
|
+
|
|
13
|
+
IP address of the client.
|
|
14
|
+
|
|
15
|
+
### UserAgent {#useragent}
|
|
16
|
+
|
|
17
|
+
> `readonly` **UserAgent**: `"userAgent"` = `"userAgent"`
|
|
18
|
+
|
|
19
|
+
User agent of the client.
|
|
20
|
+
|
|
21
|
+
### CorrelationId {#correlationid}
|
|
22
|
+
|
|
23
|
+
> `readonly` **CorrelationId**: `"correlationId"` = `"correlationId"`
|
|
24
|
+
|
|
25
|
+
Correlation ID of the request.
|
|
26
|
+
|
|
27
|
+
### RemoteRequest {#remoterequest}
|
|
28
|
+
|
|
29
|
+
> `readonly` **RemoteRequest**: `"remoteRequest"` = `"remoteRequest"`
|
|
30
|
+
|
|
31
|
+
Is this a remote request, will be a random UUID if request arrived through a REST endpoint, otherwise undefined.
|
|
32
|
+
|
|
33
|
+
### PublicOrigin {#publicorigin}
|
|
34
|
+
|
|
35
|
+
> `readonly` **PublicOrigin**: `"publicOrigin"` = `"publicOrigin"`
|
|
36
|
+
|
|
37
|
+
Public Origin of the request.
|
|
38
|
+
|
|
39
|
+
### LocalOrigin {#localorigin}
|
|
40
|
+
|
|
41
|
+
> `readonly` **LocalOrigin**: `"localOrigin"` = `"localOrigin"`
|
|
42
|
+
|
|
43
|
+
Local Origin of the request.
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/api-models",
|
|
3
|
-
"version": "0.0.3-next.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.0.3-next.51",
|
|
4
|
+
"description": "Shared API contracts, route types, and response models used across services and clients.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
|
-
"url": "git+https://github.com/
|
|
7
|
+
"url": "git+https://github.com/iotaledger/twin-api.git",
|
|
8
8
|
"directory": "packages/api-models"
|
|
9
9
|
},
|
|
10
10
|
"author": "martyn.janes@iota.org",
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@twin.org/context": "next",
|
|
18
18
|
"@twin.org/core": "next",
|
|
19
|
+
"@twin.org/entity": "next",
|
|
19
20
|
"@twin.org/nameof": "next",
|
|
20
21
|
"@twin.org/web": "next"
|
|
21
22
|
},
|
|
@@ -47,7 +48,7 @@
|
|
|
47
48
|
"schemas"
|
|
48
49
|
],
|
|
49
50
|
"bugs": {
|
|
50
|
-
"url": "git+https://github.com/
|
|
51
|
+
"url": "git+https://github.com/iotaledger/twin-api/issues"
|
|
51
52
|
},
|
|
52
53
|
"homepage": "https://twindev.org"
|
|
53
54
|
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
// Copyright 2024 IOTA Stiftung.
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0.
|
|
3
|
-
import { Factory } from "@twin.org/core";
|
|
4
|
-
/**
|
|
5
|
-
* Factory for creating implementation of authentication generator types.
|
|
6
|
-
*/
|
|
7
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
8
|
-
export const AuthenticationGeneratorFactory = Factory.createFactory("authentication-generator");
|
|
9
|
-
//# sourceMappingURL=authenticationGeneratorFactory.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"authenticationGeneratorFactory.js","sourceRoot":"","sources":["../../../src/factories/authenticationGeneratorFactory.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAGzC;;GAEG;AACH,gEAAgE;AAChE,MAAM,CAAC,MAAM,8BAA8B,GAAG,OAAO,CAAC,aAAa,CAClE,0BAA0B,CAC1B,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { Factory } from \"@twin.org/core\";\nimport type { IAuthenticationGenerator } from \"../models/client/IAuthenticationGenerator.js\";\n\n/**\n * Factory for creating implementation of authentication generator types.\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const AuthenticationGeneratorFactory = Factory.createFactory<IAuthenticationGenerator>(\n\t\"authentication-generator\"\n);\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IAuthenticationGenerator.js","sourceRoot":"","sources":["../../../../src/models/client/IAuthenticationGenerator.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IComponent } from \"@twin.org/core\";\nimport type { IHttpHeaders } from \"@twin.org/web\";\n\n/**\n * Definition for the authentication generator component.\n */\nexport interface IAuthenticationGenerator extends IComponent {\n\t/**\n\t * Adds authentication information to the request headers.\n\t * @param requestHeaders The request headers to add authentication information to.\n\t * @param authData Optional authentication data passed from the request.\n\t * @returns A promise that resolves when the authentication information has been added.\n\t */\n\taddAuthentication(requestHeaders: IHttpHeaders, authData?: unknown): Promise<void>;\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IHealthInfo.js","sourceRoot":"","sources":["../../../../src/models/services/IHealthInfo.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { HealthStatus } from \"./healthStatus.js\";\n\n/**\n * The status of the server.\n */\nexport interface IHealthInfo {\n\t/**\n\t * The status.\n\t */\n\tstatus: HealthStatus;\n\n\t/**\n\t * The status of the components.\n\t */\n\tcomponents?: {\n\t\t/**\n\t\t * The name of the component.\n\t\t */\n\t\tname: string;\n\n\t\t/**\n\t\t * The status of the component.\n\t\t */\n\t\tstatus: HealthStatus;\n\n\t\t/**\n\t\t * The details for the status.\n\t\t */\n\t\tdetails?: string;\n\t}[];\n}\n"]}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
// Copyright 2024 IOTA Stiftung.
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0.
|
|
3
|
-
/**
|
|
4
|
-
* The health status of the component.
|
|
5
|
-
*/
|
|
6
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
7
|
-
export const HealthStatus = {
|
|
8
|
-
/**
|
|
9
|
-
* OK.
|
|
10
|
-
*/
|
|
11
|
-
Ok: "ok",
|
|
12
|
-
/**
|
|
13
|
-
* Warning.
|
|
14
|
-
*/
|
|
15
|
-
Warning: "warning",
|
|
16
|
-
/**
|
|
17
|
-
* Error.
|
|
18
|
-
*/
|
|
19
|
-
Error: "error"
|
|
20
|
-
};
|
|
21
|
-
//# sourceMappingURL=healthStatus.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"healthStatus.js","sourceRoot":"","sources":["../../../../src/models/services/healthStatus.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AAEvC;;GAEG;AACH,gEAAgE;AAChE,MAAM,CAAC,MAAM,YAAY,GAAG;IAC3B;;OAEG;IACH,EAAE,EAAE,IAAI;IAER;;OAEG;IACH,OAAO,EAAE,SAAS;IAElB;;OAEG;IACH,KAAK,EAAE,OAAO;CACL,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * The health status of the component.\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const HealthStatus = {\n\t/**\n\t * OK.\n\t */\n\tOk: \"ok\",\n\n\t/**\n\t * Warning.\n\t */\n\tWarning: \"warning\",\n\n\t/**\n\t * Error.\n\t */\n\tError: \"error\"\n} as const;\n\n/**\n * The health status of the component.\n */\nexport type HealthStatus = (typeof HealthStatus)[keyof typeof HealthStatus];\n"]}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { Factory } from "@twin.org/core";
|
|
2
|
-
import type { IAuthenticationGenerator } from "../models/client/IAuthenticationGenerator.js";
|
|
3
|
-
/**
|
|
4
|
-
* Factory for creating implementation of authentication generator types.
|
|
5
|
-
*/
|
|
6
|
-
export declare const AuthenticationGeneratorFactory: Factory<IAuthenticationGenerator>;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { IComponent } from "@twin.org/core";
|
|
2
|
-
import type { IHttpHeaders } from "@twin.org/web";
|
|
3
|
-
/**
|
|
4
|
-
* Definition for the authentication generator component.
|
|
5
|
-
*/
|
|
6
|
-
export interface IAuthenticationGenerator extends IComponent {
|
|
7
|
-
/**
|
|
8
|
-
* Adds authentication information to the request headers.
|
|
9
|
-
* @param requestHeaders The request headers to add authentication information to.
|
|
10
|
-
* @param authData Optional authentication data passed from the request.
|
|
11
|
-
* @returns A promise that resolves when the authentication information has been added.
|
|
12
|
-
*/
|
|
13
|
-
addAuthentication(requestHeaders: IHttpHeaders, authData?: unknown): Promise<void>;
|
|
14
|
-
}
|