@twin.org/api-service 0.0.3-next.27 → 0.0.3-next.29
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/dist/es/hostingService.js +208 -5
- package/dist/es/hostingService.js.map +1 -1
- package/dist/es/models/IHostingServiceConfig.js.map +1 -1
- package/dist/es/models/IHostingServiceConstructorOptions.js.map +1 -1
- package/dist/types/hostingService.d.ts +62 -1
- package/dist/types/models/IHostingServiceConfig.d.ts +10 -0
- package/dist/types/models/IHostingServiceConstructorOptions.d.ts +5 -0
- package/docs/changelog.md +117 -89
- package/docs/reference/classes/HostingService.md +266 -0
- package/docs/reference/interfaces/IHostingServiceConfig.md +28 -0
- package/docs/reference/interfaces/IHostingServiceConstructorOptions.md +14 -0
- package/locales/en.json +10 -1
- package/package.json +3 -2
|
@@ -54,6 +54,32 @@ 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
|
+
|
|
57
83
|
### getPublicOrigin() {#getpublicorigin}
|
|
58
84
|
|
|
59
85
|
> **getPublicOrigin**(`serverRequestUrl?`): `Promise`\<`string`\>
|
|
@@ -129,3 +155,243 @@ The full url based on the public origin.
|
|
|
129
155
|
#### Implementation of
|
|
130
156
|
|
|
131
157
|
`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`
|
|
@@ -17,3 +17,31 @@ The local origin, must be provided as a fallback e.g. http://localhost:1234.
|
|
|
17
17
|
> `optional` **publicOrigin?**: `string`
|
|
18
18
|
|
|
19
19
|
The APIs public base URL e.g. "https://api.example.com:1234".
|
|
20
|
+
|
|
21
|
+
***
|
|
22
|
+
|
|
23
|
+
### paramEncryptionKeyName? {#paramencryptionkeyname}
|
|
24
|
+
|
|
25
|
+
> `optional` **paramEncryptionKeyName?**: `string`
|
|
26
|
+
|
|
27
|
+
The name of the key to retrieve from the vault for encryption/decryption of parameters.
|
|
28
|
+
|
|
29
|
+
#### Default
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
param-encryption
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
***
|
|
36
|
+
|
|
37
|
+
### tenantTokenName? {#tenanttokenname}
|
|
38
|
+
|
|
39
|
+
> `optional` **tenantTokenName?**: `string`
|
|
40
|
+
|
|
41
|
+
The query param name to look for the encrypted tenant token.
|
|
42
|
+
|
|
43
|
+
#### Default
|
|
44
|
+
|
|
45
|
+
```ts
|
|
46
|
+
tenant-token
|
|
47
|
+
```
|
|
@@ -18,6 +18,20 @@ tenant-admin
|
|
|
18
18
|
|
|
19
19
|
***
|
|
20
20
|
|
|
21
|
+
### vaultConnectorType? {#vaultconnectortype}
|
|
22
|
+
|
|
23
|
+
> `optional` **vaultConnectorType?**: `string`
|
|
24
|
+
|
|
25
|
+
The vault connector type.
|
|
26
|
+
|
|
27
|
+
#### Default
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
vault
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
***
|
|
34
|
+
|
|
21
35
|
### config {#config}
|
|
22
36
|
|
|
23
37
|
> **config**: [`IHostingServiceConfig`](IHostingServiceConfig.md)
|
package/locales/en.json
CHANGED
|
@@ -1 +1,10 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"error": {
|
|
3
|
+
"hostingService": {
|
|
4
|
+
"encryptionUnavailable": "Encryption is unavailable because no vault connector is configured",
|
|
5
|
+
"decryptionUnavailable": "Decryption is unavailable because no vault connector is configured",
|
|
6
|
+
"encryptionFailed": "An error occurred during encryption",
|
|
7
|
+
"decryptionFailed": "An error occurred during decryption"
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/api-service",
|
|
3
|
-
"version": "0.0.3-next.
|
|
3
|
+
"version": "0.0.3-next.29",
|
|
4
4
|
"description": "Information and hosting service implementations with generated REST route handlers.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -14,10 +14,11 @@
|
|
|
14
14
|
"node": ">=20.0.0"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@twin.org/api-models": "0.0.3-next.
|
|
17
|
+
"@twin.org/api-models": "0.0.3-next.29",
|
|
18
18
|
"@twin.org/context": "next",
|
|
19
19
|
"@twin.org/core": "next",
|
|
20
20
|
"@twin.org/nameof": "next",
|
|
21
|
+
"@twin.org/vault-models": "next",
|
|
21
22
|
"@twin.org/web": "next"
|
|
22
23
|
},
|
|
23
24
|
"main": "./dist/es/index.js",
|