@twin.org/api-tenant-processor 0.0.3-next.4 → 0.0.3-next.40
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/entities/tenant.js +17 -1
- package/dist/es/entities/tenant.js.map +1 -1
- package/dist/es/index.js +13 -2
- package/dist/es/index.js.map +1 -1
- package/dist/es/models/ITenantProcessorConfig.js.map +1 -1
- package/dist/es/models/ITenantProcessorConstructorOptions.js.map +1 -1
- package/dist/es/models/ITenantServiceConfig.js +4 -0
- package/dist/es/models/ITenantServiceConfig.js.map +1 -0
- package/dist/es/models/ITenantServiceConstructorOptions.js +2 -0
- package/dist/es/models/ITenantServiceConstructorOptions.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 +10 -0
- package/dist/es/restEntryPoints.js.map +1 -0
- package/dist/es/tenantAdminService.js +101 -16
- package/dist/es/tenantAdminService.js.map +1 -1
- package/dist/es/tenantIdContextIdHandler.js +7 -0
- package/dist/es/tenantIdContextIdHandler.js.map +1 -1
- package/dist/es/tenantProcessor.js +75 -17
- package/dist/es/tenantProcessor.js.map +1 -1
- package/dist/es/tenantRoutes.js +394 -0
- package/dist/es/tenantRoutes.js.map +1 -0
- package/dist/es/tenantService.js +51 -0
- package/dist/es/tenantService.js.map +1 -0
- package/dist/es/utils/tenantIdHelper.js +3 -3
- package/dist/es/utils/tenantIdHelper.js.map +1 -1
- package/dist/types/entities/tenant.d.ts +8 -0
- package/dist/types/index.d.ts +13 -2
- package/dist/types/models/ITenantProcessorConfig.d.ts +4 -0
- package/dist/types/models/ITenantProcessorConstructorOptions.d.ts +5 -0
- package/dist/types/models/ITenantServiceConfig.d.ts +5 -0
- package/dist/types/models/ITenantServiceConstructorOptions.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 +23 -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 +2 -0
- package/dist/types/tenantAdminService.d.ts +28 -11
- package/dist/types/tenantIdContextIdHandler.d.ts +5 -0
- package/dist/types/tenantProcessor.d.ts +1 -1
- package/dist/types/tenantRoutes.d.ts +77 -0
- package/dist/types/tenantService.d.ts +27 -0
- package/docs/changelog.md +532 -15
- package/docs/examples.md +81 -1
- package/docs/reference/classes/Tenant.md +20 -4
- package/docs/reference/classes/TenantAdminService.md +96 -26
- package/docs/reference/classes/TenantIdContextIdHandler.md +21 -3
- package/docs/reference/classes/TenantIdHelper.md +2 -2
- package/docs/reference/classes/TenantProcessor.md +6 -6
- package/docs/reference/classes/TenantService.md +79 -0
- package/docs/reference/functions/generateRestRoutesTenants.md +25 -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 +31 -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 +24 -2
- package/docs/reference/interfaces/ITenantAdminServiceConstructorOptions.md +4 -4
- 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 +30 -0
- package/docs/reference/interfaces/ITenantListResponse.md +23 -0
- package/docs/reference/interfaces/ITenantProcessorConfig.md +10 -2
- package/docs/reference/interfaces/ITenantProcessorConstructorOptions.md +18 -4
- package/docs/reference/interfaces/ITenantRemoveRequest.md +17 -0
- package/docs/reference/interfaces/ITenantServiceConfig.md +3 -0
- package/docs/reference/interfaces/ITenantServiceConstructorOptions.md +25 -0
- package/docs/reference/interfaces/ITenantUpdateRequest.md +25 -0
- package/docs/reference/variables/tagsTenants.md +5 -0
- package/locales/en.json +8 -2
- package/package.json +6 -5
- package/dist/es/models/ITenant.js +0 -4
- package/dist/es/models/ITenant.js.map +0 -1
- package/dist/es/models/ITenantAdminComponent.js +0 -2
- package/dist/es/models/ITenantAdminComponent.js.map +0 -1
- package/dist/types/models/ITenant.d.ts +0 -21
- package/dist/types/models/ITenantAdminComponent.d.ts +0 -41
- package/docs/reference/interfaces/ITenant.md +0 -35
- package/docs/reference/interfaces/ITenantAdminComponent.md +0 -123
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Function: tenantUpdate()
|
|
2
|
+
|
|
3
|
+
> **tenantUpdate**(`httpRequestContext`, `componentName`, `request`): `Promise`\<`INoContentResponse`\>
|
|
4
|
+
|
|
5
|
+
Update the tenant.
|
|
6
|
+
|
|
7
|
+
## Parameters
|
|
8
|
+
|
|
9
|
+
### httpRequestContext
|
|
10
|
+
|
|
11
|
+
`IHttpRequestContext`
|
|
12
|
+
|
|
13
|
+
The request context for the API.
|
|
14
|
+
|
|
15
|
+
### componentName
|
|
16
|
+
|
|
17
|
+
`string`
|
|
18
|
+
|
|
19
|
+
The name of the component to use in the routes.
|
|
20
|
+
|
|
21
|
+
### request
|
|
22
|
+
|
|
23
|
+
[`ITenantUpdateRequest`](../interfaces/ITenantUpdateRequest.md)
|
|
24
|
+
|
|
25
|
+
The request.
|
|
26
|
+
|
|
27
|
+
## Returns
|
|
28
|
+
|
|
29
|
+
`Promise`\<`INoContentResponse`\>
|
|
30
|
+
|
|
31
|
+
The response object with additional http response properties.
|
package/docs/reference/index.md
CHANGED
|
@@ -6,17 +6,39 @@
|
|
|
6
6
|
- [TenantAdminService](classes/TenantAdminService.md)
|
|
7
7
|
- [TenantIdContextIdHandler](classes/TenantIdContextIdHandler.md)
|
|
8
8
|
- [TenantProcessor](classes/TenantProcessor.md)
|
|
9
|
+
- [TenantService](classes/TenantService.md)
|
|
9
10
|
- [TenantIdHelper](classes/TenantIdHelper.md)
|
|
10
11
|
|
|
11
12
|
## Interfaces
|
|
12
13
|
|
|
13
|
-
- [ITenant](interfaces/ITenant.md)
|
|
14
|
-
- [ITenantAdminComponent](interfaces/ITenantAdminComponent.md)
|
|
15
14
|
- [ITenantAdminServiceConfig](interfaces/ITenantAdminServiceConfig.md)
|
|
16
15
|
- [ITenantAdminServiceConstructorOptions](interfaces/ITenantAdminServiceConstructorOptions.md)
|
|
17
16
|
- [ITenantProcessorConfig](interfaces/ITenantProcessorConfig.md)
|
|
18
17
|
- [ITenantProcessorConstructorOptions](interfaces/ITenantProcessorConstructorOptions.md)
|
|
18
|
+
- [ITenantServiceConfig](interfaces/ITenantServiceConfig.md)
|
|
19
|
+
- [ITenantServiceConstructorOptions](interfaces/ITenantServiceConstructorOptions.md)
|
|
20
|
+
- [ITenantCreateRequest](interfaces/ITenantCreateRequest.md)
|
|
21
|
+
- [ITenantGetByApiKeyRequest](interfaces/ITenantGetByApiKeyRequest.md)
|
|
22
|
+
- [ITenantGetByIdRequest](interfaces/ITenantGetByIdRequest.md)
|
|
23
|
+
- [ITenantGetByPublicOriginRequest](interfaces/ITenantGetByPublicOriginRequest.md)
|
|
24
|
+
- [ITenantGetResponse](interfaces/ITenantGetResponse.md)
|
|
25
|
+
- [ITenantListRequest](interfaces/ITenantListRequest.md)
|
|
26
|
+
- [ITenantListResponse](interfaces/ITenantListResponse.md)
|
|
27
|
+
- [ITenantRemoveRequest](interfaces/ITenantRemoveRequest.md)
|
|
28
|
+
- [ITenantUpdateRequest](interfaces/ITenantUpdateRequest.md)
|
|
29
|
+
|
|
30
|
+
## Variables
|
|
31
|
+
|
|
32
|
+
- [tagsTenants](variables/tagsTenants.md)
|
|
19
33
|
|
|
20
34
|
## Functions
|
|
21
35
|
|
|
22
36
|
- [initSchema](functions/initSchema.md)
|
|
37
|
+
- [generateRestRoutesTenants](functions/generateRestRoutesTenants.md)
|
|
38
|
+
- [tenantList](functions/tenantList.md)
|
|
39
|
+
- [tenantById](functions/tenantById.md)
|
|
40
|
+
- [tenantByApiKey](functions/tenantByApiKey.md)
|
|
41
|
+
- [tenantByPublicOrigin](functions/tenantByPublicOrigin.md)
|
|
42
|
+
- [tenantRemove](functions/tenantRemove.md)
|
|
43
|
+
- [tenantCreate](functions/tenantCreate.md)
|
|
44
|
+
- [tenantUpdate](functions/tenantUpdate.md)
|
|
@@ -4,9 +4,9 @@ Options for the Tenant Admin Service constructor.
|
|
|
4
4
|
|
|
5
5
|
## Properties
|
|
6
6
|
|
|
7
|
-
### tenantEntityStorageType?
|
|
7
|
+
### tenantEntityStorageType? {#tenantentitystoragetype}
|
|
8
8
|
|
|
9
|
-
> `optional` **tenantEntityStorageType
|
|
9
|
+
> `optional` **tenantEntityStorageType?**: `string`
|
|
10
10
|
|
|
11
11
|
The entity storage for the tenants.
|
|
12
12
|
|
|
@@ -18,8 +18,8 @@ tenant
|
|
|
18
18
|
|
|
19
19
|
***
|
|
20
20
|
|
|
21
|
-
### config?
|
|
21
|
+
### config? {#config}
|
|
22
22
|
|
|
23
|
-
> `optional` **config
|
|
23
|
+
> `optional` **config?**: [`ITenantAdminServiceConfig`](ITenantAdminServiceConfig.md)
|
|
24
24
|
|
|
25
25
|
Configuration for the admin service.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Interface: ITenantCreateRequest
|
|
2
|
+
|
|
3
|
+
The tenant to create.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
### body {#body}
|
|
8
|
+
|
|
9
|
+
> **body**: `Omit`\<`ITenant`, `"id"` \| `"dateCreated"` \| `"dateModified"`\> & `object`
|
|
10
|
+
|
|
11
|
+
The tenant to create.
|
|
12
|
+
|
|
13
|
+
#### Type Declaration
|
|
14
|
+
|
|
15
|
+
##### id?
|
|
16
|
+
|
|
17
|
+
> `optional` **id?**: `string`
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Interface: ITenantGetByApiKeyRequest
|
|
2
|
+
|
|
3
|
+
The tenant to get by API key.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
### pathParams {#pathparams}
|
|
8
|
+
|
|
9
|
+
> **pathParams**: `object`
|
|
10
|
+
|
|
11
|
+
The path parameters.
|
|
12
|
+
|
|
13
|
+
#### apiKey
|
|
14
|
+
|
|
15
|
+
> **apiKey**: `string`
|
|
16
|
+
|
|
17
|
+
The API key of the tenant to get.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Interface: ITenantGetByPublicOriginRequest
|
|
2
|
+
|
|
3
|
+
The tenant to get by public origin.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
### pathParams {#pathparams}
|
|
8
|
+
|
|
9
|
+
> **pathParams**: `object`
|
|
10
|
+
|
|
11
|
+
The path parameters.
|
|
12
|
+
|
|
13
|
+
#### publicOrigin
|
|
14
|
+
|
|
15
|
+
> **publicOrigin**: `string`
|
|
16
|
+
|
|
17
|
+
The public origin of the tenant to get.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Interface: ITenantListRequest
|
|
2
|
+
|
|
3
|
+
The list of tenants.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
### query {#query}
|
|
8
|
+
|
|
9
|
+
> **query**: `object`
|
|
10
|
+
|
|
11
|
+
The query parameters.
|
|
12
|
+
|
|
13
|
+
#### properties?
|
|
14
|
+
|
|
15
|
+
> `optional` **properties?**: `string`
|
|
16
|
+
|
|
17
|
+
The properties to include in the returned tenants, separated by commas.
|
|
18
|
+
If not provided, all properties will be returned.
|
|
19
|
+
|
|
20
|
+
#### cursor?
|
|
21
|
+
|
|
22
|
+
> `optional` **cursor?**: `string`
|
|
23
|
+
|
|
24
|
+
The cursor to get the next chunk of tenants.
|
|
25
|
+
|
|
26
|
+
#### limit?
|
|
27
|
+
|
|
28
|
+
> `optional` **limit?**: `string`
|
|
29
|
+
|
|
30
|
+
The number of tenants to return.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Interface: ITenantListResponse
|
|
2
|
+
|
|
3
|
+
The list of tenants.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
### headers? {#headers}
|
|
8
|
+
|
|
9
|
+
> `optional` **headers?**: `object`
|
|
10
|
+
|
|
11
|
+
The headers which can be used to include the cursor.
|
|
12
|
+
|
|
13
|
+
#### link?
|
|
14
|
+
|
|
15
|
+
> `optional` **link?**: `string` \| `string`[]
|
|
16
|
+
|
|
17
|
+
***
|
|
18
|
+
|
|
19
|
+
### body {#body}
|
|
20
|
+
|
|
21
|
+
> **body**: `ITenant`[]
|
|
22
|
+
|
|
23
|
+
The list of tenants.
|
|
@@ -4,9 +4,9 @@ Configuration for the tenant processor
|
|
|
4
4
|
|
|
5
5
|
## Properties
|
|
6
6
|
|
|
7
|
-
### apiKeyName?
|
|
7
|
+
### apiKeyName? {#apikeyname}
|
|
8
8
|
|
|
9
|
-
> `optional` **apiKeyName
|
|
9
|
+
> `optional` **apiKeyName?**: `string`
|
|
10
10
|
|
|
11
11
|
The key to look for in the header or query params for the api key.
|
|
12
12
|
|
|
@@ -15,3 +15,11 @@ The key to look for in the header or query params for the api key.
|
|
|
15
15
|
```ts
|
|
16
16
|
x-api-key
|
|
17
17
|
```
|
|
18
|
+
|
|
19
|
+
***
|
|
20
|
+
|
|
21
|
+
### apiKeyEndpoints? {#apikeyendpoints}
|
|
22
|
+
|
|
23
|
+
> `optional` **apiKeyEndpoints?**: `string`[]
|
|
24
|
+
|
|
25
|
+
The list of endpoint paths that should be checked for an api key header, can be regexp strings. Defaults to ["/login$"].
|
|
@@ -4,9 +4,9 @@ Options for the Tenant Processor constructor.
|
|
|
4
4
|
|
|
5
5
|
## Properties
|
|
6
6
|
|
|
7
|
-
### tenantEntityStorageType?
|
|
7
|
+
### tenantEntityStorageType? {#tenantentitystoragetype}
|
|
8
8
|
|
|
9
|
-
> `optional` **tenantEntityStorageType
|
|
9
|
+
> `optional` **tenantEntityStorageType?**: `string`
|
|
10
10
|
|
|
11
11
|
The entity storage for the tenants.
|
|
12
12
|
|
|
@@ -18,8 +18,22 @@ tenant
|
|
|
18
18
|
|
|
19
19
|
***
|
|
20
20
|
|
|
21
|
-
###
|
|
21
|
+
### urlTransformerComponentType? {#urltransformercomponenttype}
|
|
22
22
|
|
|
23
|
-
> `optional` **
|
|
23
|
+
> `optional` **urlTransformerComponentType?**: `string`
|
|
24
|
+
|
|
25
|
+
The URL transformer component for the tenants.
|
|
26
|
+
|
|
27
|
+
#### Default
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
url-transformer
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
***
|
|
34
|
+
|
|
35
|
+
### config? {#config}
|
|
36
|
+
|
|
37
|
+
> `optional` **config?**: [`ITenantProcessorConfig`](ITenantProcessorConfig.md)
|
|
24
38
|
|
|
25
39
|
Configuration for the processor.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Interface: ITenantRemoveRequest
|
|
2
|
+
|
|
3
|
+
The tenant to remove by id.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
### pathParams {#pathparams}
|
|
8
|
+
|
|
9
|
+
> **pathParams**: `object`
|
|
10
|
+
|
|
11
|
+
The path parameters.
|
|
12
|
+
|
|
13
|
+
#### id
|
|
14
|
+
|
|
15
|
+
> **id**: `string`
|
|
16
|
+
|
|
17
|
+
The id of the tenant to remove.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Interface: ITenantServiceConstructorOptions
|
|
2
|
+
|
|
3
|
+
Options for the Tenant Service constructor.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
### tenantEntityStorageType? {#tenantentitystoragetype}
|
|
8
|
+
|
|
9
|
+
> `optional` **tenantEntityStorageType?**: `string`
|
|
10
|
+
|
|
11
|
+
The entity storage for the tenants.
|
|
12
|
+
|
|
13
|
+
#### Default
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
tenant
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
***
|
|
20
|
+
|
|
21
|
+
### config? {#config}
|
|
22
|
+
|
|
23
|
+
> `optional` **config?**: [`ITenantServiceConfig`](ITenantServiceConfig.md)
|
|
24
|
+
|
|
25
|
+
Configuration for the service.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Interface: ITenantUpdateRequest
|
|
2
|
+
|
|
3
|
+
The tenant to update.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
### pathParams {#pathparams}
|
|
8
|
+
|
|
9
|
+
> **pathParams**: `object`
|
|
10
|
+
|
|
11
|
+
The path parameters.
|
|
12
|
+
|
|
13
|
+
#### id
|
|
14
|
+
|
|
15
|
+
> **id**: `string`
|
|
16
|
+
|
|
17
|
+
The id of the tenant to update.
|
|
18
|
+
|
|
19
|
+
***
|
|
20
|
+
|
|
21
|
+
### body {#body}
|
|
22
|
+
|
|
23
|
+
> **body**: `Omit`\<`ITenant`, `"id"` \| `"dateCreated"` \| `"dateModified"`\>
|
|
24
|
+
|
|
25
|
+
The tenant to update.
|
package/locales/en.json
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"error": {
|
|
3
3
|
"tenantProcessor": {
|
|
4
|
-
"missingApiKey": "API key
|
|
5
|
-
"
|
|
4
|
+
"missingApiKey": "API key \"{keyName}\" is missing",
|
|
5
|
+
"missingTenantToken": "Tenant token query parameter \"{paramName}\" is missing",
|
|
6
|
+
"apiKeyNotFound": "No node tenant found for API key \"{key}\".",
|
|
7
|
+
"tenantNotFound": "No node tenant found for the decrypted tenant token \"{tenantId}\"."
|
|
8
|
+
},
|
|
9
|
+
"tenantAdminService": {
|
|
10
|
+
"apiKeyAlreadyInUse": "The provided API key is already in use by another tenant.",
|
|
11
|
+
"tenantNotFound": "Tenant with ID \"{notFoundId}\" not found."
|
|
6
12
|
}
|
|
7
13
|
}
|
|
8
14
|
}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/api-tenant-processor",
|
|
3
|
-
"version": "0.0.3-next.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.0.3-next.40",
|
|
4
|
+
"description": "Tenant resolution services and route handlers that derive tenant context from API keys.",
|
|
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-tenant-processor"
|
|
9
9
|
},
|
|
10
10
|
"author": "martyn.janes@iota.org",
|
|
@@ -14,12 +14,13 @@
|
|
|
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.40",
|
|
18
18
|
"@twin.org/context": "next",
|
|
19
19
|
"@twin.org/core": "next",
|
|
20
20
|
"@twin.org/entity": "next",
|
|
21
21
|
"@twin.org/entity-storage-models": "next",
|
|
22
22
|
"@twin.org/nameof": "next",
|
|
23
|
+
"@twin.org/vault-models": "next",
|
|
23
24
|
"@twin.org/web": "next"
|
|
24
25
|
},
|
|
25
26
|
"main": "./dist/es/index.js",
|
|
@@ -50,7 +51,7 @@
|
|
|
50
51
|
"utilities"
|
|
51
52
|
],
|
|
52
53
|
"bugs": {
|
|
53
|
-
"url": "git+https://github.com/
|
|
54
|
+
"url": "git+https://github.com/iotaledger/twin-api/issues"
|
|
54
55
|
},
|
|
55
56
|
"homepage": "https://twindev.org"
|
|
56
57
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ITenant.js","sourceRoot":"","sources":["../../../src/models/ITenant.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Model defining the tenant.\n */\nexport interface ITenant {\n\t/**\n\t * The unique identifier for the tenant.\n\t */\n\tid: string;\n\n\t/**\n\t * The api key for the tenant.\n\t */\n\tapiKey: string;\n\n\t/**\n\t * The label of the tenant.\n\t */\n\tlabel: string;\n\n\t/**\n\t * The date the tenant was created.\n\t */\n\tdateCreated: string;\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ITenantAdminComponent.js","sourceRoot":"","sources":["../../../src/models/ITenantAdminComponent.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2025 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IComponent } from \"@twin.org/core\";\nimport type { ITenant } from \"./ITenant.js\";\n\n/**\n * Configuration for the tenant admin component\n */\nexport interface ITenantAdminComponent extends IComponent {\n\t/**\n\t * Get a tenant by its id.\n\t * @param tenantId The id of the tenant.\n\t * @returns The tenant or undefined if not found.\n\t */\n\tget(tenantId: string): Promise<ITenant | undefined>;\n\n\t/**\n\t * Get a tenant by its api key.\n\t * @param apiKey The api key of the tenant.\n\t * @returns The tenant or undefined if not found.\n\t */\n\tgetByApiKey(apiKey: string): Promise<ITenant | undefined>;\n\n\t/**\n\t * Set a tenant.\n\t * @param tenant The tenant to store.\n\t * @returns Nothing.\n\t */\n\tset(tenant: ITenant): Promise<void>;\n\n\t/**\n\t * Remove a tenant by its id.\n\t * @param tenantId The id of the tenant.\n\t * @returns Nothing.\n\t */\n\tremove(tenantId: string): Promise<void>;\n\n\t/**\n\t * Query tenants with pagination.\n\t * @param cursor The cursor to start from.\n\t * @param limit The maximum number of tenants to return.\n\t * @returns The tenants and the next cursor if more tenants are available.\n\t */\n\tquery(cursor?: string, limit?: number): Promise<{ tenants: ITenant[]; cursor?: string }>;\n}\n"]}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Model defining the tenant.
|
|
3
|
-
*/
|
|
4
|
-
export interface ITenant {
|
|
5
|
-
/**
|
|
6
|
-
* The unique identifier for the tenant.
|
|
7
|
-
*/
|
|
8
|
-
id: string;
|
|
9
|
-
/**
|
|
10
|
-
* The api key for the tenant.
|
|
11
|
-
*/
|
|
12
|
-
apiKey: string;
|
|
13
|
-
/**
|
|
14
|
-
* The label of the tenant.
|
|
15
|
-
*/
|
|
16
|
-
label: string;
|
|
17
|
-
/**
|
|
18
|
-
* The date the tenant was created.
|
|
19
|
-
*/
|
|
20
|
-
dateCreated: string;
|
|
21
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import type { IComponent } from "@twin.org/core";
|
|
2
|
-
import type { ITenant } from "./ITenant.js";
|
|
3
|
-
/**
|
|
4
|
-
* Configuration for the tenant admin component
|
|
5
|
-
*/
|
|
6
|
-
export interface ITenantAdminComponent extends IComponent {
|
|
7
|
-
/**
|
|
8
|
-
* Get a tenant by its id.
|
|
9
|
-
* @param tenantId The id of the tenant.
|
|
10
|
-
* @returns The tenant or undefined if not found.
|
|
11
|
-
*/
|
|
12
|
-
get(tenantId: string): Promise<ITenant | undefined>;
|
|
13
|
-
/**
|
|
14
|
-
* Get a tenant by its api key.
|
|
15
|
-
* @param apiKey The api key of the tenant.
|
|
16
|
-
* @returns The tenant or undefined if not found.
|
|
17
|
-
*/
|
|
18
|
-
getByApiKey(apiKey: string): Promise<ITenant | undefined>;
|
|
19
|
-
/**
|
|
20
|
-
* Set a tenant.
|
|
21
|
-
* @param tenant The tenant to store.
|
|
22
|
-
* @returns Nothing.
|
|
23
|
-
*/
|
|
24
|
-
set(tenant: ITenant): Promise<void>;
|
|
25
|
-
/**
|
|
26
|
-
* Remove a tenant by its id.
|
|
27
|
-
* @param tenantId The id of the tenant.
|
|
28
|
-
* @returns Nothing.
|
|
29
|
-
*/
|
|
30
|
-
remove(tenantId: string): Promise<void>;
|
|
31
|
-
/**
|
|
32
|
-
* Query tenants with pagination.
|
|
33
|
-
* @param cursor The cursor to start from.
|
|
34
|
-
* @param limit The maximum number of tenants to return.
|
|
35
|
-
* @returns The tenants and the next cursor if more tenants are available.
|
|
36
|
-
*/
|
|
37
|
-
query(cursor?: string, limit?: number): Promise<{
|
|
38
|
-
tenants: ITenant[];
|
|
39
|
-
cursor?: string;
|
|
40
|
-
}>;
|
|
41
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
# Interface: ITenant
|
|
2
|
-
|
|
3
|
-
Model defining the tenant.
|
|
4
|
-
|
|
5
|
-
## Properties
|
|
6
|
-
|
|
7
|
-
### id
|
|
8
|
-
|
|
9
|
-
> **id**: `string`
|
|
10
|
-
|
|
11
|
-
The unique identifier for the tenant.
|
|
12
|
-
|
|
13
|
-
***
|
|
14
|
-
|
|
15
|
-
### apiKey
|
|
16
|
-
|
|
17
|
-
> **apiKey**: `string`
|
|
18
|
-
|
|
19
|
-
The api key for the tenant.
|
|
20
|
-
|
|
21
|
-
***
|
|
22
|
-
|
|
23
|
-
### label
|
|
24
|
-
|
|
25
|
-
> **label**: `string`
|
|
26
|
-
|
|
27
|
-
The label of the tenant.
|
|
28
|
-
|
|
29
|
-
***
|
|
30
|
-
|
|
31
|
-
### dateCreated
|
|
32
|
-
|
|
33
|
-
> **dateCreated**: `string`
|
|
34
|
-
|
|
35
|
-
The date the tenant was created.
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
# Interface: ITenantAdminComponent
|
|
2
|
-
|
|
3
|
-
Configuration for the tenant admin component
|
|
4
|
-
|
|
5
|
-
## Extends
|
|
6
|
-
|
|
7
|
-
- `IComponent`
|
|
8
|
-
|
|
9
|
-
## Methods
|
|
10
|
-
|
|
11
|
-
### get()
|
|
12
|
-
|
|
13
|
-
> **get**(`tenantId`): `Promise`\<[`ITenant`](ITenant.md) \| `undefined`\>
|
|
14
|
-
|
|
15
|
-
Get a tenant by its id.
|
|
16
|
-
|
|
17
|
-
#### Parameters
|
|
18
|
-
|
|
19
|
-
##### tenantId
|
|
20
|
-
|
|
21
|
-
`string`
|
|
22
|
-
|
|
23
|
-
The id of the tenant.
|
|
24
|
-
|
|
25
|
-
#### Returns
|
|
26
|
-
|
|
27
|
-
`Promise`\<[`ITenant`](ITenant.md) \| `undefined`\>
|
|
28
|
-
|
|
29
|
-
The tenant or undefined if not found.
|
|
30
|
-
|
|
31
|
-
***
|
|
32
|
-
|
|
33
|
-
### getByApiKey()
|
|
34
|
-
|
|
35
|
-
> **getByApiKey**(`apiKey`): `Promise`\<[`ITenant`](ITenant.md) \| `undefined`\>
|
|
36
|
-
|
|
37
|
-
Get a tenant by its api key.
|
|
38
|
-
|
|
39
|
-
#### Parameters
|
|
40
|
-
|
|
41
|
-
##### apiKey
|
|
42
|
-
|
|
43
|
-
`string`
|
|
44
|
-
|
|
45
|
-
The api key of the tenant.
|
|
46
|
-
|
|
47
|
-
#### Returns
|
|
48
|
-
|
|
49
|
-
`Promise`\<[`ITenant`](ITenant.md) \| `undefined`\>
|
|
50
|
-
|
|
51
|
-
The tenant or undefined if not found.
|
|
52
|
-
|
|
53
|
-
***
|
|
54
|
-
|
|
55
|
-
### set()
|
|
56
|
-
|
|
57
|
-
> **set**(`tenant`): `Promise`\<`void`\>
|
|
58
|
-
|
|
59
|
-
Set a tenant.
|
|
60
|
-
|
|
61
|
-
#### Parameters
|
|
62
|
-
|
|
63
|
-
##### tenant
|
|
64
|
-
|
|
65
|
-
[`ITenant`](ITenant.md)
|
|
66
|
-
|
|
67
|
-
The tenant to store.
|
|
68
|
-
|
|
69
|
-
#### Returns
|
|
70
|
-
|
|
71
|
-
`Promise`\<`void`\>
|
|
72
|
-
|
|
73
|
-
Nothing.
|
|
74
|
-
|
|
75
|
-
***
|
|
76
|
-
|
|
77
|
-
### remove()
|
|
78
|
-
|
|
79
|
-
> **remove**(`tenantId`): `Promise`\<`void`\>
|
|
80
|
-
|
|
81
|
-
Remove a tenant by its id.
|
|
82
|
-
|
|
83
|
-
#### Parameters
|
|
84
|
-
|
|
85
|
-
##### tenantId
|
|
86
|
-
|
|
87
|
-
`string`
|
|
88
|
-
|
|
89
|
-
The id of the tenant.
|
|
90
|
-
|
|
91
|
-
#### Returns
|
|
92
|
-
|
|
93
|
-
`Promise`\<`void`\>
|
|
94
|
-
|
|
95
|
-
Nothing.
|
|
96
|
-
|
|
97
|
-
***
|
|
98
|
-
|
|
99
|
-
### query()
|
|
100
|
-
|
|
101
|
-
> **query**(`cursor?`, `limit?`): `Promise`\<\{ `tenants`: [`ITenant`](ITenant.md)[]; `cursor?`: `string`; \}\>
|
|
102
|
-
|
|
103
|
-
Query tenants with pagination.
|
|
104
|
-
|
|
105
|
-
#### Parameters
|
|
106
|
-
|
|
107
|
-
##### cursor?
|
|
108
|
-
|
|
109
|
-
`string`
|
|
110
|
-
|
|
111
|
-
The cursor to start from.
|
|
112
|
-
|
|
113
|
-
##### limit?
|
|
114
|
-
|
|
115
|
-
`number`
|
|
116
|
-
|
|
117
|
-
The maximum number of tenants to return.
|
|
118
|
-
|
|
119
|
-
#### Returns
|
|
120
|
-
|
|
121
|
-
`Promise`\<\{ `tenants`: [`ITenant`](ITenant.md)[]; `cursor?`: `string`; \}\>
|
|
122
|
-
|
|
123
|
-
The tenants and the next cursor if more tenants are available.
|