@twin.org/api-models 0.0.3-next.3 → 0.0.3-next.30
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 +105 -0
- package/dist/es/helpers/httpUrlHelper.js.map +1 -0
- package/dist/es/index.js +13 -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 +21 -0
- package/dist/es/models/httpContextIdKeys.js.map +1 -0
- package/dist/es/models/protocol/IHttpRequestContext.js.map +1 -1
- package/dist/es/models/protocol/IHttpRequestPathParams.js.map +1 -1
- package/dist/es/models/protocol/IHttpRequestQuery.js.map +1 -1
- 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/services/IHealthComponent.js +2 -0
- package/dist/es/models/services/IHealthComponent.js.map +1 -0
- package/dist/es/models/services/IHostingComponent.js +2 -0
- package/dist/es/models/services/IHostingComponent.js.map +1 -0
- package/dist/es/models/services/IInformationComponent.js.map +1 -1
- 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/es/models/services/IUrlTransformerComponent.js +2 -0
- package/dist/es/models/services/IUrlTransformerComponent.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 +55 -0
- package/dist/types/index.d.ts +13 -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 +21 -0
- package/dist/types/models/protocol/IHttpRequestContext.d.ts +4 -0
- package/dist/types/models/protocol/IHttpRequestPathParams.d.ts +1 -1
- package/dist/types/models/protocol/IHttpRequestQuery.d.ts +1 -1
- 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 +14 -4
- package/dist/types/models/server/IRestRouteProcessor.d.ts +7 -2
- package/dist/types/models/server/IWebServer.d.ts +7 -1
- package/dist/types/models/services/IHealthComponent.d.ts +14 -0
- package/dist/types/models/services/IHostingComponent.d.ts +24 -0
- package/dist/types/models/services/IInformationComponent.d.ts +10 -17
- package/dist/types/models/services/ITenant.d.ts +33 -0
- package/dist/types/models/services/ITenantAdminComponent.d.ts +63 -0
- package/dist/types/models/services/IUrlTransformerComponent.d.ts +66 -0
- package/docs/changelog.md +278 -58
- 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 +197 -0
- package/docs/reference/classes/TooManyRequestsError.md +67 -0
- package/docs/reference/index.md +14 -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 +33 -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/IHostingComponent.md +73 -0
- package/docs/reference/interfaces/IHttpRequest.md +8 -8
- package/docs/reference/interfaces/IHttpRequestContext.md +12 -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/IRestRoute.md +47 -23
- package/docs/reference/interfaces/IRestRouteExample.md +3 -3
- package/docs/reference/interfaces/IRestRouteProcessor.md +49 -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 +17 -5
- package/docs/reference/interfaces/ISocketRoute.md +38 -14
- package/docs/reference/interfaces/ISocketRouteProcessor.md +42 -22
- package/docs/reference/interfaces/ISocketServerRequest.md +17 -17
- package/docs/reference/interfaces/ITag.md +2 -2
- package/docs/reference/interfaces/ITenant.md +59 -0
- package/docs/reference/interfaces/ITenantAdminComponent.md +193 -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/IUrlTransformerComponent.md +229 -0
- package/docs/reference/interfaces/IWebServer.md +34 -4
- package/docs/reference/interfaces/IWebServerOptions.md +12 -12
- package/docs/reference/type-aliases/HttpContextIdKeys.md +5 -0
- package/docs/reference/variables/HttpContextIdKeys.md +25 -0
- package/package.json +2 -2
- 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,193 @@
|
|
|
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
|
+
Nothing.
|
|
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
|
+
Nothing.
|
|
152
|
+
|
|
153
|
+
#### Throws
|
|
154
|
+
|
|
155
|
+
Error if the tenant is not found.
|
|
156
|
+
|
|
157
|
+
***
|
|
158
|
+
|
|
159
|
+
### query() {#query}
|
|
160
|
+
|
|
161
|
+
> **query**(`options?`, `cursor?`, `limit?`): `Promise`\<\{ `tenants`: [`ITenant`](ITenant.md)[]; `cursor?`: `string`; \}\>
|
|
162
|
+
|
|
163
|
+
Query tenants with pagination.
|
|
164
|
+
|
|
165
|
+
#### Parameters
|
|
166
|
+
|
|
167
|
+
##### options?
|
|
168
|
+
|
|
169
|
+
Optional query options.
|
|
170
|
+
|
|
171
|
+
###### isNodeTenant?
|
|
172
|
+
|
|
173
|
+
`boolean`
|
|
174
|
+
|
|
175
|
+
Whether to filter for node admin tenants.
|
|
176
|
+
|
|
177
|
+
##### cursor?
|
|
178
|
+
|
|
179
|
+
`string`
|
|
180
|
+
|
|
181
|
+
The cursor to start from.
|
|
182
|
+
|
|
183
|
+
##### limit?
|
|
184
|
+
|
|
185
|
+
`number`
|
|
186
|
+
|
|
187
|
+
The maximum number of tenants to return.
|
|
188
|
+
|
|
189
|
+
#### Returns
|
|
190
|
+
|
|
191
|
+
`Promise`\<\{ `tenants`: [`ITenant`](ITenant.md)[]; `cursor?`: `string`; \}\>
|
|
192
|
+
|
|
193
|
+
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
|
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
# Interface: IUrlTransformerComponent
|
|
2
|
+
|
|
3
|
+
The URL transformer component for encrypting and decrypting URL parameters.
|
|
4
|
+
|
|
5
|
+
## Extends
|
|
6
|
+
|
|
7
|
+
- `IComponent`
|
|
8
|
+
|
|
9
|
+
## Methods
|
|
10
|
+
|
|
11
|
+
### addEncryptedQueryParamToUrl() {#addencryptedqueryparamtourl}
|
|
12
|
+
|
|
13
|
+
> **addEncryptedQueryParamToUrl**(`url`, `id`, `value`): `Promise`\<`string`\>
|
|
14
|
+
|
|
15
|
+
Encrypt a named token value and append it as a query parameter to the given URL.
|
|
16
|
+
The URL param name is resolved from the configured token name dictionary using the id.
|
|
17
|
+
|
|
18
|
+
#### Parameters
|
|
19
|
+
|
|
20
|
+
##### url
|
|
21
|
+
|
|
22
|
+
`string`
|
|
23
|
+
|
|
24
|
+
The URL to append the encrypted token to.
|
|
25
|
+
|
|
26
|
+
##### id
|
|
27
|
+
|
|
28
|
+
`string`
|
|
29
|
+
|
|
30
|
+
The logical token identifier (e.g. "tenant").
|
|
31
|
+
|
|
32
|
+
##### value
|
|
33
|
+
|
|
34
|
+
`string`
|
|
35
|
+
|
|
36
|
+
The value to encrypt and add.
|
|
37
|
+
|
|
38
|
+
#### Returns
|
|
39
|
+
|
|
40
|
+
`Promise`\<`string`\>
|
|
41
|
+
|
|
42
|
+
The URL with the encrypted token added as a query parameter.
|
|
43
|
+
|
|
44
|
+
***
|
|
45
|
+
|
|
46
|
+
### getEncryptedQueryParam() {#getencryptedqueryparam}
|
|
47
|
+
|
|
48
|
+
> **getEncryptedQueryParam**(`queryParams`, `id`): `Promise`\<`string` \| `undefined`\>
|
|
49
|
+
|
|
50
|
+
Get a named token value from the query parameters.
|
|
51
|
+
The URL param name is resolved from the configured token name dictionary using the id.
|
|
52
|
+
|
|
53
|
+
#### Parameters
|
|
54
|
+
|
|
55
|
+
##### queryParams
|
|
56
|
+
|
|
57
|
+
[`IHttpRequestQuery`](IHttpRequestQuery.md) \| `undefined`
|
|
58
|
+
|
|
59
|
+
The HTTP request query containing the parameters.
|
|
60
|
+
|
|
61
|
+
##### id
|
|
62
|
+
|
|
63
|
+
`string`
|
|
64
|
+
|
|
65
|
+
The logical token identifier (e.g. "tenant").
|
|
66
|
+
|
|
67
|
+
#### Returns
|
|
68
|
+
|
|
69
|
+
`Promise`\<`string` \| `undefined`\>
|
|
70
|
+
|
|
71
|
+
The decrypted token value if it exists.
|
|
72
|
+
|
|
73
|
+
***
|
|
74
|
+
|
|
75
|
+
### addEncryptedParamsToUrl() {#addencryptedparamstourl}
|
|
76
|
+
|
|
77
|
+
> **addEncryptedParamsToUrl**(`url`, `params`): `Promise`\<`string`\>
|
|
78
|
+
|
|
79
|
+
Add encrypted key/value pairs to a URL's query string.
|
|
80
|
+
Existing query parameters on the URL are preserved; the provided params are
|
|
81
|
+
merged in and then encrypted before being written back to the URL.
|
|
82
|
+
|
|
83
|
+
#### Parameters
|
|
84
|
+
|
|
85
|
+
##### url
|
|
86
|
+
|
|
87
|
+
`string`
|
|
88
|
+
|
|
89
|
+
The base URL to add parameters to.
|
|
90
|
+
|
|
91
|
+
##### params
|
|
92
|
+
|
|
93
|
+
[`IHttpRequestQuery`](IHttpRequestQuery.md)
|
|
94
|
+
|
|
95
|
+
The key/value pairs to encrypt and append.
|
|
96
|
+
|
|
97
|
+
#### Returns
|
|
98
|
+
|
|
99
|
+
`Promise`\<`string`\>
|
|
100
|
+
|
|
101
|
+
The URL with the encrypted parameters added.
|
|
102
|
+
|
|
103
|
+
***
|
|
104
|
+
|
|
105
|
+
### getDecryptedParamsFromQueryParams() {#getdecryptedparamsfromqueryparams}
|
|
106
|
+
|
|
107
|
+
> **getDecryptedParamsFromQueryParams**(`queryParams`, `keys`): `Promise`\<[`IHttpRequestQuery`](IHttpRequestQuery.md)\>
|
|
108
|
+
|
|
109
|
+
Decrypt specified keys from a query parameter object and return their plain-text values.
|
|
110
|
+
|
|
111
|
+
#### Parameters
|
|
112
|
+
|
|
113
|
+
##### queryParams
|
|
114
|
+
|
|
115
|
+
[`IHttpRequestQuery`](IHttpRequestQuery.md) \| `undefined`
|
|
116
|
+
|
|
117
|
+
The HTTP request query containing the encrypted parameters.
|
|
118
|
+
|
|
119
|
+
##### keys
|
|
120
|
+
|
|
121
|
+
`string`[]
|
|
122
|
+
|
|
123
|
+
The keys to decrypt.
|
|
124
|
+
|
|
125
|
+
#### Returns
|
|
126
|
+
|
|
127
|
+
`Promise`\<[`IHttpRequestQuery`](IHttpRequestQuery.md)\>
|
|
128
|
+
|
|
129
|
+
A map of the decrypted key/value pairs that were present.
|
|
130
|
+
|
|
131
|
+
***
|
|
132
|
+
|
|
133
|
+
### encryptQueryParams() {#encryptqueryparams}
|
|
134
|
+
|
|
135
|
+
> **encryptQueryParams**(`httpRequestQuery`, `keys`): `Promise`\<`void`\>
|
|
136
|
+
|
|
137
|
+
Encrypt query parameters using the URL transformer's encryption mechanism.
|
|
138
|
+
|
|
139
|
+
#### Parameters
|
|
140
|
+
|
|
141
|
+
##### httpRequestQuery
|
|
142
|
+
|
|
143
|
+
[`IHttpRequestQuery`](IHttpRequestQuery.md) \| `undefined`
|
|
144
|
+
|
|
145
|
+
The HTTP request query containing the parameters to encrypt.
|
|
146
|
+
|
|
147
|
+
##### keys
|
|
148
|
+
|
|
149
|
+
`string`[]
|
|
150
|
+
|
|
151
|
+
The keys of the parameters to encrypt.
|
|
152
|
+
|
|
153
|
+
#### Returns
|
|
154
|
+
|
|
155
|
+
`Promise`\<`void`\>
|
|
156
|
+
|
|
157
|
+
A promise that resolves when the query parameters have been encrypted.
|
|
158
|
+
|
|
159
|
+
***
|
|
160
|
+
|
|
161
|
+
### decryptQueryParams() {#decryptqueryparams}
|
|
162
|
+
|
|
163
|
+
> **decryptQueryParams**(`httpRequestQuery`, `keys`): `Promise`\<`void`\>
|
|
164
|
+
|
|
165
|
+
Decrypt query parameters using the URL transformer's encryption mechanism.
|
|
166
|
+
|
|
167
|
+
#### Parameters
|
|
168
|
+
|
|
169
|
+
##### httpRequestQuery
|
|
170
|
+
|
|
171
|
+
[`IHttpRequestQuery`](IHttpRequestQuery.md) \| `undefined`
|
|
172
|
+
|
|
173
|
+
The HTTP request query containing the encrypted values.
|
|
174
|
+
|
|
175
|
+
##### keys
|
|
176
|
+
|
|
177
|
+
`string`[]
|
|
178
|
+
|
|
179
|
+
The keys of the parameters to decrypt.
|
|
180
|
+
|
|
181
|
+
#### Returns
|
|
182
|
+
|
|
183
|
+
`Promise`\<`void`\>
|
|
184
|
+
|
|
185
|
+
A promise that resolves when the query parameters have been decrypted.
|
|
186
|
+
|
|
187
|
+
***
|
|
188
|
+
|
|
189
|
+
### encryptParam() {#encryptparam}
|
|
190
|
+
|
|
191
|
+
> **encryptParam**(`paramValue`): `Promise`\<`string`\>
|
|
192
|
+
|
|
193
|
+
Encrypt a parameter value.
|
|
194
|
+
|
|
195
|
+
#### Parameters
|
|
196
|
+
|
|
197
|
+
##### paramValue
|
|
198
|
+
|
|
199
|
+
`string`
|
|
200
|
+
|
|
201
|
+
The value of the parameter to encrypt.
|
|
202
|
+
|
|
203
|
+
#### Returns
|
|
204
|
+
|
|
205
|
+
`Promise`\<`string`\>
|
|
206
|
+
|
|
207
|
+
A promise that resolves to the encrypted value of the parameter.
|
|
208
|
+
|
|
209
|
+
***
|
|
210
|
+
|
|
211
|
+
### decryptParam() {#decryptparam}
|
|
212
|
+
|
|
213
|
+
> **decryptParam**(`encryptedValue`): `Promise`\<`string`\>
|
|
214
|
+
|
|
215
|
+
Decrypt a parameter value.
|
|
216
|
+
|
|
217
|
+
#### Parameters
|
|
218
|
+
|
|
219
|
+
##### encryptedValue
|
|
220
|
+
|
|
221
|
+
`string`
|
|
222
|
+
|
|
223
|
+
The encrypted value of the parameter.
|
|
224
|
+
|
|
225
|
+
#### Returns
|
|
226
|
+
|
|
227
|
+
`Promise`\<`string`\>
|
|
228
|
+
|
|
229
|
+
A promise that resolves to the decrypted value of the parameter.
|
|
@@ -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
|
|
|
@@ -70,7 +74,7 @@ Nothing.
|
|
|
70
74
|
|
|
71
75
|
***
|
|
72
76
|
|
|
73
|
-
### start()
|
|
77
|
+
### start() {#start}
|
|
74
78
|
|
|
75
79
|
> **start**(): `Promise`\<`void`\>
|
|
76
80
|
|
|
@@ -82,9 +86,13 @@ Start the server.
|
|
|
82
86
|
|
|
83
87
|
Nothing.
|
|
84
88
|
|
|
89
|
+
#### Overrides
|
|
90
|
+
|
|
91
|
+
`IComponent.start`
|
|
92
|
+
|
|
85
93
|
***
|
|
86
94
|
|
|
87
|
-
### stop()
|
|
95
|
+
### stop() {#stop}
|
|
88
96
|
|
|
89
97
|
> **stop**(): `Promise`\<`void`\>
|
|
90
98
|
|
|
@@ -95,3 +103,25 @@ Stop the server.
|
|
|
95
103
|
`Promise`\<`void`\>
|
|
96
104
|
|
|
97
105
|
Nothing.
|
|
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
|
|
|
@@ -0,0 +1,25 @@
|
|
|
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.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/api-models",
|
|
3
|
-
"version": "0.0.3-next.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.0.3-next.30",
|
|
4
|
+
"description": "Shared API contracts, route types, and response models used across services and clients.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/twinfoundation/api.git",
|
|
@@ -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"]}
|