@3sixty/api-tenant-processor 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.
- package/LICENSE +201 -0
- package/README.md +24 -2
- package/dist/es/entities/tenant.js +77 -0
- package/dist/es/entities/tenant.js.map +1 -0
- package/dist/es/entities/tenantV0.js +61 -0
- package/dist/es/entities/tenantV0.js.map +1 -0
- package/dist/es/entities/tenantV1.js +77 -0
- package/dist/es/entities/tenantV1.js.map +1 -0
- package/dist/es/index.js +30 -0
- package/dist/es/index.js.map +1 -0
- package/dist/es/models/ISingleTenantProcessorConfig.js +4 -0
- package/dist/es/models/ISingleTenantProcessorConfig.js.map +1 -0
- package/dist/es/models/ISingleTenantProcessorConstructorOptions.js +2 -0
- package/dist/es/models/ISingleTenantProcessorConstructorOptions.js.map +1 -0
- package/dist/es/models/ITenantAdminServiceConfig.js +4 -0
- package/dist/es/models/ITenantAdminServiceConfig.js.map +1 -0
- package/dist/es/models/ITenantAdminServiceConstructorOptions.js +2 -0
- package/dist/es/models/ITenantAdminServiceConstructorOptions.js.map +1 -0
- package/dist/es/models/ITenantProcessorConfig.js +4 -0
- package/dist/es/models/ITenantProcessorConfig.js.map +1 -0
- package/dist/es/models/ITenantProcessorConstructorOptions.js +2 -0
- package/dist/es/models/ITenantProcessorConstructorOptions.js.map +1 -0
- package/dist/es/models/api/ITenantCreateRequest.js +2 -0
- package/dist/es/models/api/ITenantCreateRequest.js.map +1 -0
- package/dist/es/models/api/ITenantGetByApiKeyRequest.js +4 -0
- package/dist/es/models/api/ITenantGetByApiKeyRequest.js.map +1 -0
- package/dist/es/models/api/ITenantGetByIdRequest.js +4 -0
- package/dist/es/models/api/ITenantGetByIdRequest.js.map +1 -0
- package/dist/es/models/api/ITenantGetByPublicOriginRequest.js +4 -0
- package/dist/es/models/api/ITenantGetByPublicOriginRequest.js.map +1 -0
- package/dist/es/models/api/ITenantGetResponse.js +2 -0
- package/dist/es/models/api/ITenantGetResponse.js.map +1 -0
- package/dist/es/models/api/ITenantListRequest.js +4 -0
- package/dist/es/models/api/ITenantListRequest.js.map +1 -0
- package/dist/es/models/api/ITenantListResponse.js +2 -0
- package/dist/es/models/api/ITenantListResponse.js.map +1 -0
- package/dist/es/models/api/ITenantRemoveRequest.js +4 -0
- package/dist/es/models/api/ITenantRemoveRequest.js.map +1 -0
- package/dist/es/models/api/ITenantUpdateRequest.js +2 -0
- package/dist/es/models/api/ITenantUpdateRequest.js.map +1 -0
- package/dist/es/restEntryPoints.js +13 -0
- package/dist/es/restEntryPoints.js.map +1 -0
- package/dist/es/schema.js +64 -0
- package/dist/es/schema.js.map +1 -0
- package/dist/es/singleTenantProcessor.js +81 -0
- package/dist/es/singleTenantProcessor.js.map +1 -0
- package/dist/es/tenantAdminService.js +510 -0
- package/dist/es/tenantAdminService.js.map +1 -0
- package/dist/es/tenantIdContextIdHandler.js +47 -0
- package/dist/es/tenantIdContextIdHandler.js.map +1 -0
- package/dist/es/tenantProcessor.js +164 -0
- package/dist/es/tenantProcessor.js.map +1 -0
- package/dist/es/tenantRoutes.js +417 -0
- package/dist/es/tenantRoutes.js.map +1 -0
- package/dist/es/utils/tenantIdHelper.js +23 -0
- package/dist/es/utils/tenantIdHelper.js.map +1 -0
- package/dist/types/entities/tenant.d.ts +37 -0
- package/dist/types/entities/tenantV0.d.ts +29 -0
- package/dist/types/entities/tenantV1.d.ts +37 -0
- package/dist/types/index.d.ts +26 -0
- package/dist/types/models/ISingleTenantProcessorConfig.d.ts +9 -0
- package/dist/types/models/ISingleTenantProcessorConstructorOptions.d.ts +10 -0
- package/dist/types/models/ITenantAdminServiceConfig.d.ts +24 -0
- package/dist/types/models/ITenantAdminServiceConstructorOptions.d.ts +20 -0
- package/dist/types/models/ITenantProcessorConfig.d.ts +18 -0
- package/dist/types/models/ITenantProcessorConstructorOptions.d.ts +15 -0
- package/dist/types/models/api/ITenantCreateRequest.d.ts +12 -0
- package/dist/types/models/api/ITenantGetByApiKeyRequest.d.ts +14 -0
- package/dist/types/models/api/ITenantGetByIdRequest.d.ts +14 -0
- package/dist/types/models/api/ITenantGetByPublicOriginRequest.d.ts +14 -0
- package/dist/types/models/api/ITenantGetResponse.d.ts +10 -0
- package/dist/types/models/api/ITenantListRequest.d.ts +27 -0
- package/dist/types/models/api/ITenantListResponse.d.ts +17 -0
- package/dist/types/models/api/ITenantRemoveRequest.d.ts +14 -0
- package/dist/types/models/api/ITenantUpdateRequest.d.ts +19 -0
- package/dist/types/restEntryPoints.d.ts +5 -0
- package/dist/types/schema.d.ts +5 -0
- package/dist/types/singleTenantProcessor.d.ts +41 -0
- package/dist/types/tenantAdminService.d.ts +109 -0
- package/dist/types/tenantIdContextIdHandler.d.ts +33 -0
- package/dist/types/tenantProcessor.d.ts +34 -0
- package/dist/types/tenantRoutes.d.ts +78 -0
- package/dist/types/utils/tenantIdHelper.d.ts +15 -0
- package/docs/changelog.md +17 -0
- package/docs/examples.md +81 -0
- package/docs/reference/classes/SingleTenantProcessor.md +130 -0
- package/docs/reference/classes/Tenant.md +77 -0
- package/docs/reference/classes/TenantAdminService.md +393 -0
- package/docs/reference/classes/TenantIdContextIdHandler.md +123 -0
- package/docs/reference/classes/TenantIdHelper.md +41 -0
- package/docs/reference/classes/TenantProcessor.md +103 -0
- package/docs/reference/classes/TenantV0.md +61 -0
- package/docs/reference/classes/TenantV1.md +77 -0
- package/docs/reference/functions/generateRestRoutesTenants.md +25 -0
- package/docs/reference/functions/initSchema.md +10 -0
- package/docs/reference/functions/tenantByApiKey.md +31 -0
- package/docs/reference/functions/tenantById.md +31 -0
- package/docs/reference/functions/tenantByPublicOrigin.md +31 -0
- package/docs/reference/functions/tenantCreate.md +37 -0
- package/docs/reference/functions/tenantList.md +31 -0
- package/docs/reference/functions/tenantRemove.md +31 -0
- package/docs/reference/functions/tenantUpdate.md +31 -0
- package/docs/reference/index.md +47 -0
- package/docs/reference/interfaces/ISingleTenantProcessorConfig.md +11 -0
- package/docs/reference/interfaces/ISingleTenantProcessorConstructorOptions.md +11 -0
- package/docs/reference/interfaces/ITenantAdminServiceConfig.md +49 -0
- package/docs/reference/interfaces/ITenantAdminServiceConstructorOptions.md +39 -0
- package/docs/reference/interfaces/ITenantCreateRequest.md +17 -0
- package/docs/reference/interfaces/ITenantGetByApiKeyRequest.md +17 -0
- package/docs/reference/interfaces/ITenantGetByIdRequest.md +17 -0
- package/docs/reference/interfaces/ITenantGetByPublicOriginRequest.md +17 -0
- package/docs/reference/interfaces/ITenantGetResponse.md +11 -0
- package/docs/reference/interfaces/ITenantListRequest.md +36 -0
- package/docs/reference/interfaces/ITenantListResponse.md +23 -0
- package/docs/reference/interfaces/ITenantProcessorConfig.md +33 -0
- package/docs/reference/interfaces/ITenantProcessorConstructorOptions.md +25 -0
- package/docs/reference/interfaces/ITenantRemoveRequest.md +17 -0
- package/docs/reference/interfaces/ITenantUpdateRequest.md +25 -0
- package/docs/reference/variables/restEntryPoints.md +5 -0
- package/docs/reference/variables/tagsTenants.md +5 -0
- package/locales/en.json +20 -0
- package/package.json +57 -5
|
@@ -0,0 +1,393 @@
|
|
|
1
|
+
# Class: TenantAdminService
|
|
2
|
+
|
|
3
|
+
Service for performing tenant administration operations.
|
|
4
|
+
|
|
5
|
+
## Implements
|
|
6
|
+
|
|
7
|
+
- `ITenantAdminComponent`
|
|
8
|
+
- `IHealthProviderComponent`
|
|
9
|
+
|
|
10
|
+
## Constructors
|
|
11
|
+
|
|
12
|
+
### Constructor
|
|
13
|
+
|
|
14
|
+
> **new TenantAdminService**(`options?`): `TenantAdminService`
|
|
15
|
+
|
|
16
|
+
Create a new instance of TenantAdminService.
|
|
17
|
+
|
|
18
|
+
#### Parameters
|
|
19
|
+
|
|
20
|
+
##### options?
|
|
21
|
+
|
|
22
|
+
[`ITenantAdminServiceConstructorOptions`](../interfaces/ITenantAdminServiceConstructorOptions.md)
|
|
23
|
+
|
|
24
|
+
The options for the connector.
|
|
25
|
+
|
|
26
|
+
#### Returns
|
|
27
|
+
|
|
28
|
+
`TenantAdminService`
|
|
29
|
+
|
|
30
|
+
## Properties
|
|
31
|
+
|
|
32
|
+
### CLASS\_NAME {#class_name}
|
|
33
|
+
|
|
34
|
+
> `readonly` `static` **CLASS\_NAME**: `string`
|
|
35
|
+
|
|
36
|
+
Runtime name for the class.
|
|
37
|
+
|
|
38
|
+
## Methods
|
|
39
|
+
|
|
40
|
+
### className() {#classname}
|
|
41
|
+
|
|
42
|
+
> **className**(): `string`
|
|
43
|
+
|
|
44
|
+
Returns the class name of the component.
|
|
45
|
+
|
|
46
|
+
#### Returns
|
|
47
|
+
|
|
48
|
+
`string`
|
|
49
|
+
|
|
50
|
+
The class name of the component.
|
|
51
|
+
|
|
52
|
+
#### Implementation of
|
|
53
|
+
|
|
54
|
+
`ITenantAdminComponent.className`
|
|
55
|
+
|
|
56
|
+
***
|
|
57
|
+
|
|
58
|
+
### stop() {#stop}
|
|
59
|
+
|
|
60
|
+
> **stop**(): `Promise`\<`void`\>
|
|
61
|
+
|
|
62
|
+
Stop the service and release the tenant cache.
|
|
63
|
+
|
|
64
|
+
#### Returns
|
|
65
|
+
|
|
66
|
+
`Promise`\<`void`\>
|
|
67
|
+
|
|
68
|
+
A promise that resolves when the service has stopped.
|
|
69
|
+
|
|
70
|
+
#### Implementation of
|
|
71
|
+
|
|
72
|
+
`ITenantAdminComponent.stop`
|
|
73
|
+
|
|
74
|
+
***
|
|
75
|
+
|
|
76
|
+
### get() {#get}
|
|
77
|
+
|
|
78
|
+
> **get**(`tenantId`): `Promise`\<`ITenant`\>
|
|
79
|
+
|
|
80
|
+
Get a tenant by its id.
|
|
81
|
+
|
|
82
|
+
#### Parameters
|
|
83
|
+
|
|
84
|
+
##### tenantId
|
|
85
|
+
|
|
86
|
+
`string`
|
|
87
|
+
|
|
88
|
+
The id of the tenant.
|
|
89
|
+
|
|
90
|
+
#### Returns
|
|
91
|
+
|
|
92
|
+
`Promise`\<`ITenant`\>
|
|
93
|
+
|
|
94
|
+
The tenant.
|
|
95
|
+
|
|
96
|
+
#### Throws
|
|
97
|
+
|
|
98
|
+
Error if the tenant is not found.
|
|
99
|
+
|
|
100
|
+
#### Implementation of
|
|
101
|
+
|
|
102
|
+
`ITenantAdminComponent.get`
|
|
103
|
+
|
|
104
|
+
***
|
|
105
|
+
|
|
106
|
+
### getByApiKey() {#getbyapikey}
|
|
107
|
+
|
|
108
|
+
> **getByApiKey**(`apiKey`): `Promise`\<`ITenant`\>
|
|
109
|
+
|
|
110
|
+
Get a tenant by its api key.
|
|
111
|
+
|
|
112
|
+
#### Parameters
|
|
113
|
+
|
|
114
|
+
##### apiKey
|
|
115
|
+
|
|
116
|
+
`string`
|
|
117
|
+
|
|
118
|
+
The api key of the tenant.
|
|
119
|
+
|
|
120
|
+
#### Returns
|
|
121
|
+
|
|
122
|
+
`Promise`\<`ITenant`\>
|
|
123
|
+
|
|
124
|
+
The tenant.
|
|
125
|
+
|
|
126
|
+
#### Throws
|
|
127
|
+
|
|
128
|
+
Error if the tenant is not found.
|
|
129
|
+
|
|
130
|
+
#### Implementation of
|
|
131
|
+
|
|
132
|
+
`ITenantAdminComponent.getByApiKey`
|
|
133
|
+
|
|
134
|
+
***
|
|
135
|
+
|
|
136
|
+
### getByPublicOrigin() {#getbypublicorigin}
|
|
137
|
+
|
|
138
|
+
> **getByPublicOrigin**(`publicOrigin`): `Promise`\<`ITenant`\>
|
|
139
|
+
|
|
140
|
+
Get a tenant by its public origin.
|
|
141
|
+
|
|
142
|
+
#### Parameters
|
|
143
|
+
|
|
144
|
+
##### publicOrigin
|
|
145
|
+
|
|
146
|
+
`string`
|
|
147
|
+
|
|
148
|
+
The origin of the tenant.
|
|
149
|
+
|
|
150
|
+
#### Returns
|
|
151
|
+
|
|
152
|
+
`Promise`\<`ITenant`\>
|
|
153
|
+
|
|
154
|
+
The tenant.
|
|
155
|
+
|
|
156
|
+
#### Throws
|
|
157
|
+
|
|
158
|
+
Error if the tenant is not found.
|
|
159
|
+
|
|
160
|
+
#### Implementation of
|
|
161
|
+
|
|
162
|
+
`ITenantAdminComponent.getByPublicOrigin`
|
|
163
|
+
|
|
164
|
+
***
|
|
165
|
+
|
|
166
|
+
### getTenantByOrganizationId() {#gettenantbyorganizationid}
|
|
167
|
+
|
|
168
|
+
> **getTenantByOrganizationId**(`organizationId`, `includeLegacy?`): `Promise`\<`ITenant`\>
|
|
169
|
+
|
|
170
|
+
Get a tenant by its organization id, optionally searching legacy ids.
|
|
171
|
+
|
|
172
|
+
#### Parameters
|
|
173
|
+
|
|
174
|
+
##### organizationId
|
|
175
|
+
|
|
176
|
+
`string`
|
|
177
|
+
|
|
178
|
+
The organization id of the tenant.
|
|
179
|
+
|
|
180
|
+
##### includeLegacy?
|
|
181
|
+
|
|
182
|
+
`boolean`
|
|
183
|
+
|
|
184
|
+
Whether to also search the legacy organization id array.
|
|
185
|
+
|
|
186
|
+
#### Returns
|
|
187
|
+
|
|
188
|
+
`Promise`\<`ITenant`\>
|
|
189
|
+
|
|
190
|
+
The tenant.
|
|
191
|
+
|
|
192
|
+
#### Throws
|
|
193
|
+
|
|
194
|
+
Error if the tenant is not found.
|
|
195
|
+
|
|
196
|
+
#### Implementation of
|
|
197
|
+
|
|
198
|
+
`ITenantAdminComponent.getTenantByOrganizationId`
|
|
199
|
+
|
|
200
|
+
***
|
|
201
|
+
|
|
202
|
+
### create() {#create}
|
|
203
|
+
|
|
204
|
+
> **create**(`tenant`): `Promise`\<`string`\>
|
|
205
|
+
|
|
206
|
+
Create a tenant.
|
|
207
|
+
|
|
208
|
+
#### Parameters
|
|
209
|
+
|
|
210
|
+
##### tenant
|
|
211
|
+
|
|
212
|
+
`Omit`\<`ITenant`, `"id"` \| `"dateCreated"` \| `"dateModified"`\> & `object`
|
|
213
|
+
|
|
214
|
+
The tenant to store.
|
|
215
|
+
|
|
216
|
+
#### Returns
|
|
217
|
+
|
|
218
|
+
`Promise`\<`string`\>
|
|
219
|
+
|
|
220
|
+
The tenant id.
|
|
221
|
+
|
|
222
|
+
#### Implementation of
|
|
223
|
+
|
|
224
|
+
`ITenantAdminComponent.create`
|
|
225
|
+
|
|
226
|
+
***
|
|
227
|
+
|
|
228
|
+
### update() {#update}
|
|
229
|
+
|
|
230
|
+
> **update**(`tenant`): `Promise`\<`void`\>
|
|
231
|
+
|
|
232
|
+
Update a tenant.
|
|
233
|
+
|
|
234
|
+
#### Parameters
|
|
235
|
+
|
|
236
|
+
##### tenant
|
|
237
|
+
|
|
238
|
+
`Partial`\<`Omit`\<`ITenant`, `"dateCreated"` \| `"dateModified"`\>\>
|
|
239
|
+
|
|
240
|
+
The tenant to update.
|
|
241
|
+
|
|
242
|
+
#### Returns
|
|
243
|
+
|
|
244
|
+
`Promise`\<`void`\>
|
|
245
|
+
|
|
246
|
+
A promise that resolves when the tenant has been updated.
|
|
247
|
+
|
|
248
|
+
#### Implementation of
|
|
249
|
+
|
|
250
|
+
`ITenantAdminComponent.update`
|
|
251
|
+
|
|
252
|
+
***
|
|
253
|
+
|
|
254
|
+
### remove() {#remove}
|
|
255
|
+
|
|
256
|
+
> **remove**(`tenantId`): `Promise`\<`void`\>
|
|
257
|
+
|
|
258
|
+
Remove a tenant by its id.
|
|
259
|
+
|
|
260
|
+
#### Parameters
|
|
261
|
+
|
|
262
|
+
##### tenantId
|
|
263
|
+
|
|
264
|
+
`string`
|
|
265
|
+
|
|
266
|
+
The id of the tenant.
|
|
267
|
+
|
|
268
|
+
#### Returns
|
|
269
|
+
|
|
270
|
+
`Promise`\<`void`\>
|
|
271
|
+
|
|
272
|
+
Nothing.
|
|
273
|
+
|
|
274
|
+
#### Implementation of
|
|
275
|
+
|
|
276
|
+
`ITenantAdminComponent.remove`
|
|
277
|
+
|
|
278
|
+
***
|
|
279
|
+
|
|
280
|
+
### query() {#query}
|
|
281
|
+
|
|
282
|
+
> **query**(`conditions?`, `properties?`, `cursor?`, `limit?`): `Promise`\<\{ `tenants`: `ITenant`[]; `cursor?`: `string`; \}\>
|
|
283
|
+
|
|
284
|
+
Query tenants with pagination.
|
|
285
|
+
|
|
286
|
+
#### Parameters
|
|
287
|
+
|
|
288
|
+
##### conditions?
|
|
289
|
+
|
|
290
|
+
`EntityCondition`\<`ITenant`\>
|
|
291
|
+
|
|
292
|
+
The conditions to filter the tenants.
|
|
293
|
+
|
|
294
|
+
##### properties?
|
|
295
|
+
|
|
296
|
+
(keyof `ITenant`)[]
|
|
297
|
+
|
|
298
|
+
The properties to include in the returned tenants.
|
|
299
|
+
|
|
300
|
+
##### cursor?
|
|
301
|
+
|
|
302
|
+
`string`
|
|
303
|
+
|
|
304
|
+
The cursor to start from.
|
|
305
|
+
|
|
306
|
+
##### limit?
|
|
307
|
+
|
|
308
|
+
`number`
|
|
309
|
+
|
|
310
|
+
The maximum number of tenants to return.
|
|
311
|
+
|
|
312
|
+
#### Returns
|
|
313
|
+
|
|
314
|
+
`Promise`\<\{ `tenants`: `ITenant`[]; `cursor?`: `string`; \}\>
|
|
315
|
+
|
|
316
|
+
The tenants and the next cursor if more tenants are available.
|
|
317
|
+
|
|
318
|
+
#### Implementation of
|
|
319
|
+
|
|
320
|
+
`ITenantAdminComponent.query`
|
|
321
|
+
|
|
322
|
+
***
|
|
323
|
+
|
|
324
|
+
### healthApplicationInit() {#healthapplicationinit}
|
|
325
|
+
|
|
326
|
+
> **healthApplicationInit**(`contextIds`): `Promise`\<`void`\>
|
|
327
|
+
|
|
328
|
+
Provision a temporary tenant for the application health cycle.
|
|
329
|
+
|
|
330
|
+
#### Parameters
|
|
331
|
+
|
|
332
|
+
##### contextIds
|
|
333
|
+
|
|
334
|
+
`IContextIds`
|
|
335
|
+
|
|
336
|
+
Accumulated context IDs; receives the provisional tenant ID.
|
|
337
|
+
|
|
338
|
+
#### Returns
|
|
339
|
+
|
|
340
|
+
`Promise`\<`void`\>
|
|
341
|
+
|
|
342
|
+
A promise that resolves when provisioning is complete.
|
|
343
|
+
|
|
344
|
+
#### Implementation of
|
|
345
|
+
|
|
346
|
+
`IHealthProviderComponent.healthApplicationInit`
|
|
347
|
+
|
|
348
|
+
***
|
|
349
|
+
|
|
350
|
+
### healthApplication() {#healthapplication}
|
|
351
|
+
|
|
352
|
+
> **healthApplication**(`callback`): `Promise`\<`IHealth`[] \| `undefined`\>
|
|
353
|
+
|
|
354
|
+
Verify the provisioned tenant can be retrieved.
|
|
355
|
+
The tenant ID is read from the active context set by the init pass.
|
|
356
|
+
|
|
357
|
+
#### Parameters
|
|
358
|
+
|
|
359
|
+
##### callback
|
|
360
|
+
|
|
361
|
+
`HealthApplicationCallback`
|
|
362
|
+
|
|
363
|
+
The callback to invoke when a deferred health result is ready.
|
|
364
|
+
|
|
365
|
+
#### Returns
|
|
366
|
+
|
|
367
|
+
`Promise`\<`IHealth`[] \| `undefined`\>
|
|
368
|
+
|
|
369
|
+
The health entries for this component.
|
|
370
|
+
|
|
371
|
+
#### Implementation of
|
|
372
|
+
|
|
373
|
+
`IHealthProviderComponent.healthApplication`
|
|
374
|
+
|
|
375
|
+
***
|
|
376
|
+
|
|
377
|
+
### healthApplicationTeardown() {#healthapplicationteardown}
|
|
378
|
+
|
|
379
|
+
> **healthApplicationTeardown**(): `Promise`\<`void`\>
|
|
380
|
+
|
|
381
|
+
Remove the temporary tenant provisioned during init.
|
|
382
|
+
The tenant ID is read from the active context set by the init pass.
|
|
383
|
+
Does nothing when no tenant ID is present.
|
|
384
|
+
|
|
385
|
+
#### Returns
|
|
386
|
+
|
|
387
|
+
`Promise`\<`void`\>
|
|
388
|
+
|
|
389
|
+
A promise that resolves when teardown is complete.
|
|
390
|
+
|
|
391
|
+
#### Implementation of
|
|
392
|
+
|
|
393
|
+
`IHealthProviderComponent.healthApplicationTeardown`
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# Class: TenantIdContextIdHandler
|
|
2
|
+
|
|
3
|
+
Context ID handler that treats a tenant ID as a compact base64url-encoded hex string.
|
|
4
|
+
|
|
5
|
+
## Implements
|
|
6
|
+
|
|
7
|
+
- `IContextIdHandler`
|
|
8
|
+
|
|
9
|
+
## Constructors
|
|
10
|
+
|
|
11
|
+
### Constructor
|
|
12
|
+
|
|
13
|
+
> **new TenantIdContextIdHandler**(): `TenantIdContextIdHandler`
|
|
14
|
+
|
|
15
|
+
#### Returns
|
|
16
|
+
|
|
17
|
+
`TenantIdContextIdHandler`
|
|
18
|
+
|
|
19
|
+
## Properties
|
|
20
|
+
|
|
21
|
+
### CLASS\_NAME {#class_name}
|
|
22
|
+
|
|
23
|
+
> `readonly` `static` **CLASS\_NAME**: `string`
|
|
24
|
+
|
|
25
|
+
Runtime name for the class.
|
|
26
|
+
|
|
27
|
+
## Methods
|
|
28
|
+
|
|
29
|
+
### className() {#classname}
|
|
30
|
+
|
|
31
|
+
> **className**(): `string`
|
|
32
|
+
|
|
33
|
+
The class name of the component.
|
|
34
|
+
|
|
35
|
+
#### Returns
|
|
36
|
+
|
|
37
|
+
`string`
|
|
38
|
+
|
|
39
|
+
The class name.
|
|
40
|
+
|
|
41
|
+
#### Implementation of
|
|
42
|
+
|
|
43
|
+
`IContextIdHandler.className`
|
|
44
|
+
|
|
45
|
+
***
|
|
46
|
+
|
|
47
|
+
### short() {#short}
|
|
48
|
+
|
|
49
|
+
> **short**(`value`): `string`
|
|
50
|
+
|
|
51
|
+
The short form of the tenant id is the base64 version to compact.
|
|
52
|
+
|
|
53
|
+
#### Parameters
|
|
54
|
+
|
|
55
|
+
##### value
|
|
56
|
+
|
|
57
|
+
`string`
|
|
58
|
+
|
|
59
|
+
The full context id value.
|
|
60
|
+
|
|
61
|
+
#### Returns
|
|
62
|
+
|
|
63
|
+
`string`
|
|
64
|
+
|
|
65
|
+
Short form string.
|
|
66
|
+
|
|
67
|
+
#### Implementation of
|
|
68
|
+
|
|
69
|
+
`IContextIdHandler.short`
|
|
70
|
+
|
|
71
|
+
***
|
|
72
|
+
|
|
73
|
+
### long() {#long}
|
|
74
|
+
|
|
75
|
+
> **long**(`value`): `string`
|
|
76
|
+
|
|
77
|
+
The long form version of the context ID, expanded from a short version.
|
|
78
|
+
|
|
79
|
+
#### Parameters
|
|
80
|
+
|
|
81
|
+
##### value
|
|
82
|
+
|
|
83
|
+
`string`
|
|
84
|
+
|
|
85
|
+
The short form context ID value.
|
|
86
|
+
|
|
87
|
+
#### Returns
|
|
88
|
+
|
|
89
|
+
`string`
|
|
90
|
+
|
|
91
|
+
The long form version of the context ID.
|
|
92
|
+
|
|
93
|
+
#### Implementation of
|
|
94
|
+
|
|
95
|
+
`IContextIdHandler.long`
|
|
96
|
+
|
|
97
|
+
***
|
|
98
|
+
|
|
99
|
+
### guard() {#guard}
|
|
100
|
+
|
|
101
|
+
> **guard**(`value`): `void`
|
|
102
|
+
|
|
103
|
+
Guard the value ensuring length.
|
|
104
|
+
|
|
105
|
+
#### Parameters
|
|
106
|
+
|
|
107
|
+
##### value
|
|
108
|
+
|
|
109
|
+
`string`
|
|
110
|
+
|
|
111
|
+
The value to guard.
|
|
112
|
+
|
|
113
|
+
#### Returns
|
|
114
|
+
|
|
115
|
+
`void`
|
|
116
|
+
|
|
117
|
+
#### Throws
|
|
118
|
+
|
|
119
|
+
GeneralError if the value is too short.
|
|
120
|
+
|
|
121
|
+
#### Implementation of
|
|
122
|
+
|
|
123
|
+
`IContextIdHandler.guard`
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Class: TenantIdHelper
|
|
2
|
+
|
|
3
|
+
Helper class for tenant id related operations.
|
|
4
|
+
|
|
5
|
+
## Constructors
|
|
6
|
+
|
|
7
|
+
### Constructor
|
|
8
|
+
|
|
9
|
+
> **new TenantIdHelper**(): `TenantIdHelper`
|
|
10
|
+
|
|
11
|
+
#### Returns
|
|
12
|
+
|
|
13
|
+
`TenantIdHelper`
|
|
14
|
+
|
|
15
|
+
## Methods
|
|
16
|
+
|
|
17
|
+
### generateTenantId() {#generatetenantid}
|
|
18
|
+
|
|
19
|
+
> `static` **generateTenantId**(): `string`
|
|
20
|
+
|
|
21
|
+
Generates a new tenant ID.
|
|
22
|
+
|
|
23
|
+
#### Returns
|
|
24
|
+
|
|
25
|
+
`string`
|
|
26
|
+
|
|
27
|
+
A new tenant ID.
|
|
28
|
+
|
|
29
|
+
***
|
|
30
|
+
|
|
31
|
+
### generateApiKey() {#generateapikey}
|
|
32
|
+
|
|
33
|
+
> `static` **generateApiKey**(): `string`
|
|
34
|
+
|
|
35
|
+
Generates a new API Key.
|
|
36
|
+
|
|
37
|
+
#### Returns
|
|
38
|
+
|
|
39
|
+
`string`
|
|
40
|
+
|
|
41
|
+
A new API Key.
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# Class: TenantProcessor
|
|
2
|
+
|
|
3
|
+
Handles incoming api keys and maps them to tenant ids.
|
|
4
|
+
|
|
5
|
+
## Implements
|
|
6
|
+
|
|
7
|
+
- `IBaseRouteProcessor`
|
|
8
|
+
|
|
9
|
+
## Constructors
|
|
10
|
+
|
|
11
|
+
### Constructor
|
|
12
|
+
|
|
13
|
+
> **new TenantProcessor**(`options?`): `TenantProcessor`
|
|
14
|
+
|
|
15
|
+
Create a new instance of TenantProcessor.
|
|
16
|
+
|
|
17
|
+
#### Parameters
|
|
18
|
+
|
|
19
|
+
##### options?
|
|
20
|
+
|
|
21
|
+
[`ITenantProcessorConstructorOptions`](../interfaces/ITenantProcessorConstructorOptions.md)
|
|
22
|
+
|
|
23
|
+
Options for the processor.
|
|
24
|
+
|
|
25
|
+
#### Returns
|
|
26
|
+
|
|
27
|
+
`TenantProcessor`
|
|
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
|
+
`IBaseRouteProcessor.className`
|
|
54
|
+
|
|
55
|
+
***
|
|
56
|
+
|
|
57
|
+
### pre() {#pre}
|
|
58
|
+
|
|
59
|
+
> **pre**(`request`, `response`, `route`, `contextIds`, `processorState`): `Promise`\<`void`\>
|
|
60
|
+
|
|
61
|
+
Pre process the REST request for the specified route.
|
|
62
|
+
|
|
63
|
+
#### Parameters
|
|
64
|
+
|
|
65
|
+
##### request
|
|
66
|
+
|
|
67
|
+
`IHttpServerRequest`
|
|
68
|
+
|
|
69
|
+
The incoming request.
|
|
70
|
+
|
|
71
|
+
##### response
|
|
72
|
+
|
|
73
|
+
`IHttpResponse`
|
|
74
|
+
|
|
75
|
+
The outgoing response.
|
|
76
|
+
|
|
77
|
+
##### route
|
|
78
|
+
|
|
79
|
+
`IBaseRoute` \| `undefined`
|
|
80
|
+
|
|
81
|
+
The route to process.
|
|
82
|
+
|
|
83
|
+
##### contextIds
|
|
84
|
+
|
|
85
|
+
`IContextIds`
|
|
86
|
+
|
|
87
|
+
The context IDs of the request.
|
|
88
|
+
|
|
89
|
+
##### processorState
|
|
90
|
+
|
|
91
|
+
\{\[`id`: `string`\]: `unknown`; \}
|
|
92
|
+
|
|
93
|
+
The state handed through the processors.
|
|
94
|
+
|
|
95
|
+
#### Returns
|
|
96
|
+
|
|
97
|
+
`Promise`\<`void`\>
|
|
98
|
+
|
|
99
|
+
A promise that resolves when the tenant context has been resolved and injected, or an error response set.
|
|
100
|
+
|
|
101
|
+
#### Implementation of
|
|
102
|
+
|
|
103
|
+
`IBaseRouteProcessor.pre`
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Class: TenantV0
|
|
2
|
+
|
|
3
|
+
Class defining the storage for node tenants.
|
|
4
|
+
|
|
5
|
+
## Constructors
|
|
6
|
+
|
|
7
|
+
### Constructor
|
|
8
|
+
|
|
9
|
+
> **new TenantV0**(): `TenantV0`
|
|
10
|
+
|
|
11
|
+
#### Returns
|
|
12
|
+
|
|
13
|
+
`TenantV0`
|
|
14
|
+
|
|
15
|
+
## Properties
|
|
16
|
+
|
|
17
|
+
### id {#id}
|
|
18
|
+
|
|
19
|
+
> **id**: `string`
|
|
20
|
+
|
|
21
|
+
The unique identifier for the tenant.
|
|
22
|
+
|
|
23
|
+
***
|
|
24
|
+
|
|
25
|
+
### apiKey {#apikey}
|
|
26
|
+
|
|
27
|
+
> **apiKey**: `string`
|
|
28
|
+
|
|
29
|
+
The api key for the tenant.
|
|
30
|
+
|
|
31
|
+
***
|
|
32
|
+
|
|
33
|
+
### label {#label}
|
|
34
|
+
|
|
35
|
+
> **label**: `string`
|
|
36
|
+
|
|
37
|
+
The label of the tenant.
|
|
38
|
+
|
|
39
|
+
***
|
|
40
|
+
|
|
41
|
+
### dateCreated {#datecreated}
|
|
42
|
+
|
|
43
|
+
> **dateCreated**: `string`
|
|
44
|
+
|
|
45
|
+
The date the tenant was created.
|
|
46
|
+
|
|
47
|
+
***
|
|
48
|
+
|
|
49
|
+
### dateModified {#datemodified}
|
|
50
|
+
|
|
51
|
+
> **dateModified**: `string`
|
|
52
|
+
|
|
53
|
+
The date the tenant was modified.
|
|
54
|
+
|
|
55
|
+
***
|
|
56
|
+
|
|
57
|
+
### publicOrigin? {#publicorigin}
|
|
58
|
+
|
|
59
|
+
> `optional` **publicOrigin?**: `string`
|
|
60
|
+
|
|
61
|
+
The origin available to the public for accessing the API.
|