@twin.org/api-tenant-processor 0.0.3-next.2 → 0.0.3-next.20

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.
Files changed (82) hide show
  1. package/dist/es/entities/tenant.js +25 -1
  2. package/dist/es/entities/tenant.js.map +1 -1
  3. package/dist/es/index.js +10 -2
  4. package/dist/es/index.js.map +1 -1
  5. package/dist/es/models/api/ITenantCreateRequest.js +2 -0
  6. package/dist/es/models/api/ITenantCreateRequest.js.map +1 -0
  7. package/dist/es/models/api/ITenantGetByApiKeyRequest.js +4 -0
  8. package/dist/es/models/api/ITenantGetByApiKeyRequest.js.map +1 -0
  9. package/dist/es/models/api/ITenantGetByIdRequest.js +4 -0
  10. package/dist/es/models/api/ITenantGetByIdRequest.js.map +1 -0
  11. package/dist/es/models/api/ITenantGetByPublicOriginRequest.js +4 -0
  12. package/dist/es/models/api/ITenantGetByPublicOriginRequest.js.map +1 -0
  13. package/dist/es/models/api/ITenantGetResponse.js +2 -0
  14. package/dist/es/models/api/ITenantGetResponse.js.map +1 -0
  15. package/dist/es/models/api/ITenantListRequest.js +4 -0
  16. package/dist/es/models/api/ITenantListRequest.js.map +1 -0
  17. package/dist/es/models/api/ITenantListResponse.js +2 -0
  18. package/dist/es/models/api/ITenantListResponse.js.map +1 -0
  19. package/dist/es/models/api/ITenantRemoveRequest.js +4 -0
  20. package/dist/es/models/api/ITenantRemoveRequest.js.map +1 -0
  21. package/dist/es/models/api/ITenantUpdateRequest.js +2 -0
  22. package/dist/es/models/api/ITenantUpdateRequest.js.map +1 -0
  23. package/dist/es/restEntryPoints.js +10 -0
  24. package/dist/es/restEntryPoints.js.map +1 -0
  25. package/dist/es/tenantAdminService.js +112 -15
  26. package/dist/es/tenantAdminService.js.map +1 -1
  27. package/dist/es/tenantIdContextIdHandler.js +8 -1
  28. package/dist/es/tenantIdContextIdHandler.js.map +1 -1
  29. package/dist/es/tenantProcessor.js +26 -21
  30. package/dist/es/tenantProcessor.js.map +1 -1
  31. package/dist/es/tenantRoutes.js +396 -0
  32. package/dist/es/tenantRoutes.js.map +1 -0
  33. package/dist/es/utils/tenantIdHelper.js +3 -3
  34. package/dist/es/utils/tenantIdHelper.js.map +1 -1
  35. package/dist/types/entities/tenant.d.ts +12 -0
  36. package/dist/types/index.d.ts +10 -2
  37. package/dist/types/models/api/ITenantCreateRequest.d.ts +12 -0
  38. package/dist/types/models/api/ITenantGetByApiKeyRequest.d.ts +14 -0
  39. package/dist/types/models/api/ITenantGetByIdRequest.d.ts +14 -0
  40. package/dist/types/models/api/ITenantGetByPublicOriginRequest.d.ts +14 -0
  41. package/dist/types/models/api/ITenantGetResponse.d.ts +10 -0
  42. package/dist/types/models/api/ITenantListRequest.d.ts +18 -0
  43. package/dist/types/models/api/ITenantListResponse.d.ts +17 -0
  44. package/dist/types/models/api/ITenantRemoveRequest.d.ts +14 -0
  45. package/dist/types/models/api/ITenantUpdateRequest.d.ts +19 -0
  46. package/dist/types/restEntryPoints.d.ts +2 -0
  47. package/dist/types/tenantAdminService.d.ts +30 -10
  48. package/dist/types/tenantIdContextIdHandler.d.ts +5 -0
  49. package/dist/types/tenantRoutes.d.ts +77 -0
  50. package/docs/changelog.md +278 -0
  51. package/docs/reference/classes/Tenant.md +24 -0
  52. package/docs/reference/classes/TenantAdminService.md +93 -19
  53. package/docs/reference/classes/TenantIdContextIdHandler.md +18 -0
  54. package/docs/reference/functions/generateRestRoutesTenants.md +25 -0
  55. package/docs/reference/functions/tenantByApiKey.md +31 -0
  56. package/docs/reference/functions/tenantById.md +31 -0
  57. package/docs/reference/functions/tenantByPublicOrigin.md +31 -0
  58. package/docs/reference/functions/tenantCreate.md +31 -0
  59. package/docs/reference/functions/tenantList.md +31 -0
  60. package/docs/reference/functions/tenantRemove.md +31 -0
  61. package/docs/reference/functions/tenantUpdate.md +31 -0
  62. package/docs/reference/index.md +21 -2
  63. package/docs/reference/interfaces/ITenantCreateRequest.md +17 -0
  64. package/docs/reference/interfaces/ITenantGetByApiKeyRequest.md +17 -0
  65. package/docs/reference/interfaces/ITenantGetByIdRequest.md +17 -0
  66. package/docs/reference/interfaces/ITenantGetByPublicOriginRequest.md +17 -0
  67. package/docs/reference/interfaces/ITenantGetResponse.md +11 -0
  68. package/docs/reference/interfaces/ITenantListRequest.md +23 -0
  69. package/docs/reference/interfaces/ITenantListResponse.md +23 -0
  70. package/docs/reference/interfaces/ITenantRemoveRequest.md +17 -0
  71. package/docs/reference/interfaces/ITenantUpdateRequest.md +25 -0
  72. package/docs/reference/variables/tagsTenants.md +5 -0
  73. package/locales/en.json +4 -0
  74. package/package.json +2 -2
  75. package/dist/es/models/ITenant.js +0 -4
  76. package/dist/es/models/ITenant.js.map +0 -1
  77. package/dist/es/models/ITenantAdminComponent.js +0 -2
  78. package/dist/es/models/ITenantAdminComponent.js.map +0 -1
  79. package/dist/types/models/ITenant.d.ts +0 -21
  80. package/dist/types/models/ITenantAdminComponent.d.ts +0 -41
  81. package/docs/reference/interfaces/ITenant.md +0 -35
  82. package/docs/reference/interfaces/ITenantAdminComponent.md +0 -123
@@ -26,6 +26,24 @@ Runtime name for the class.
26
26
 
27
27
  ## Methods
28
28
 
29
+ ### 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
+
29
47
  ### short()
30
48
 
31
49
  > **short**(`value`): `string`
@@ -0,0 +1,25 @@
1
+ # Function: generateRestRoutesTenants()
2
+
3
+ > **generateRestRoutesTenants**(`baseRouteName`, `componentName`): `IRestRoute`\<`any`, `any`\>[]
4
+
5
+ The REST routes for tenant management.
6
+
7
+ ## Parameters
8
+
9
+ ### baseRouteName
10
+
11
+ `string`
12
+
13
+ Prefix to prepend to the paths.
14
+
15
+ ### componentName
16
+
17
+ `string`
18
+
19
+ The name of the component to use in the routes stored in the ComponentFactory.
20
+
21
+ ## Returns
22
+
23
+ `IRestRoute`\<`any`, `any`\>[]
24
+
25
+ The generated routes.
@@ -0,0 +1,31 @@
1
+ # Function: tenantByApiKey()
2
+
3
+ > **tenantByApiKey**(`httpRequestContext`, `componentName`, `request`): `Promise`\<[`ITenantGetResponse`](../interfaces/ITenantGetResponse.md)\>
4
+
5
+ Get the tenant by api key.
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
+ [`ITenantGetByApiKeyRequest`](../interfaces/ITenantGetByApiKeyRequest.md)
24
+
25
+ The request.
26
+
27
+ ## Returns
28
+
29
+ `Promise`\<[`ITenantGetResponse`](../interfaces/ITenantGetResponse.md)\>
30
+
31
+ The response object with additional http response properties.
@@ -0,0 +1,31 @@
1
+ # Function: tenantById()
2
+
3
+ > **tenantById**(`httpRequestContext`, `componentName`, `request`): `Promise`\<[`ITenantGetResponse`](../interfaces/ITenantGetResponse.md)\>
4
+
5
+ Get the tenant by id.
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
+ [`ITenantGetByIdRequest`](../interfaces/ITenantGetByIdRequest.md)
24
+
25
+ The request.
26
+
27
+ ## Returns
28
+
29
+ `Promise`\<[`ITenantGetResponse`](../interfaces/ITenantGetResponse.md)\>
30
+
31
+ The response object with additional http response properties.
@@ -0,0 +1,31 @@
1
+ # Function: tenantByPublicOrigin()
2
+
3
+ > **tenantByPublicOrigin**(`httpRequestContext`, `componentName`, `request`): `Promise`\<[`ITenantGetResponse`](../interfaces/ITenantGetResponse.md)\>
4
+
5
+ Get the tenant by public origin.
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
+ [`ITenantGetByPublicOriginRequest`](../interfaces/ITenantGetByPublicOriginRequest.md)
24
+
25
+ The request.
26
+
27
+ ## Returns
28
+
29
+ `Promise`\<[`ITenantGetResponse`](../interfaces/ITenantGetResponse.md)\>
30
+
31
+ The response object with additional http response properties.
@@ -0,0 +1,31 @@
1
+ # Function: tenantCreate()
2
+
3
+ > **tenantCreate**(`httpRequestContext`, `componentName`, `request`): `Promise`\<`ICreatedResponse`\>
4
+
5
+ Create 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
+ [`ITenantCreateRequest`](../interfaces/ITenantCreateRequest.md)
24
+
25
+ The request.
26
+
27
+ ## Returns
28
+
29
+ `Promise`\<`ICreatedResponse`\>
30
+
31
+ The response object with additional http response properties.
@@ -0,0 +1,31 @@
1
+ # Function: tenantList()
2
+
3
+ > **tenantList**(`httpRequestContext`, `componentName`, `request`): `Promise`\<[`ITenantListResponse`](../interfaces/ITenantListResponse.md)\>
4
+
5
+ Get the list of tenants.
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
+ [`ITenantListRequest`](../interfaces/ITenantListRequest.md)
24
+
25
+ The request.
26
+
27
+ ## Returns
28
+
29
+ `Promise`\<[`ITenantListResponse`](../interfaces/ITenantListResponse.md)\>
30
+
31
+ The response object with additional http response properties.
@@ -0,0 +1,31 @@
1
+ # Function: tenantRemove()
2
+
3
+ > **tenantRemove**(`httpRequestContext`, `componentName`, `request`): `Promise`\<`INoContentResponse`\>
4
+
5
+ Remove the tenant by id.
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
+ [`ITenantRemoveRequest`](../interfaces/ITenantRemoveRequest.md)
24
+
25
+ The request.
26
+
27
+ ## Returns
28
+
29
+ `Promise`\<`INoContentResponse`\>
30
+
31
+ The response object with additional http response properties.
@@ -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.
@@ -10,13 +10,32 @@
10
10
 
11
11
  ## Interfaces
12
12
 
13
- - [ITenant](interfaces/ITenant.md)
14
- - [ITenantAdminComponent](interfaces/ITenantAdminComponent.md)
15
13
  - [ITenantAdminServiceConfig](interfaces/ITenantAdminServiceConfig.md)
16
14
  - [ITenantAdminServiceConstructorOptions](interfaces/ITenantAdminServiceConstructorOptions.md)
17
15
  - [ITenantProcessorConfig](interfaces/ITenantProcessorConfig.md)
18
16
  - [ITenantProcessorConstructorOptions](interfaces/ITenantProcessorConstructorOptions.md)
17
+ - [ITenantCreateRequest](interfaces/ITenantCreateRequest.md)
18
+ - [ITenantGetByApiKeyRequest](interfaces/ITenantGetByApiKeyRequest.md)
19
+ - [ITenantGetByIdRequest](interfaces/ITenantGetByIdRequest.md)
20
+ - [ITenantGetByPublicOriginRequest](interfaces/ITenantGetByPublicOriginRequest.md)
21
+ - [ITenantGetResponse](interfaces/ITenantGetResponse.md)
22
+ - [ITenantListRequest](interfaces/ITenantListRequest.md)
23
+ - [ITenantListResponse](interfaces/ITenantListResponse.md)
24
+ - [ITenantRemoveRequest](interfaces/ITenantRemoveRequest.md)
25
+ - [ITenantUpdateRequest](interfaces/ITenantUpdateRequest.md)
26
+
27
+ ## Variables
28
+
29
+ - [tagsTenants](variables/tagsTenants.md)
19
30
 
20
31
  ## Functions
21
32
 
22
33
  - [initSchema](functions/initSchema.md)
34
+ - [generateRestRoutesTenants](functions/generateRestRoutesTenants.md)
35
+ - [tenantList](functions/tenantList.md)
36
+ - [tenantById](functions/tenantById.md)
37
+ - [tenantByApiKey](functions/tenantByApiKey.md)
38
+ - [tenantByPublicOrigin](functions/tenantByPublicOrigin.md)
39
+ - [tenantRemove](functions/tenantRemove.md)
40
+ - [tenantCreate](functions/tenantCreate.md)
41
+ - [tenantUpdate](functions/tenantUpdate.md)
@@ -0,0 +1,17 @@
1
+ # Interface: ITenantCreateRequest
2
+
3
+ The tenant to create.
4
+
5
+ ## Properties
6
+
7
+ ### 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
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: ITenantGetByIdRequest
2
+
3
+ The tenant to get by id.
4
+
5
+ ## Properties
6
+
7
+ ### 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 get.
@@ -0,0 +1,17 @@
1
+ # Interface: ITenantGetByPublicOriginRequest
2
+
3
+ The tenant to get by public origin.
4
+
5
+ ## Properties
6
+
7
+ ### 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,11 @@
1
+ # Interface: ITenantGetResponse
2
+
3
+ The tenant get response.
4
+
5
+ ## Properties
6
+
7
+ ### body
8
+
9
+ > **body**: `ITenant`
10
+
11
+ The tenant.
@@ -0,0 +1,23 @@
1
+ # Interface: ITenantListRequest
2
+
3
+ The list of tenants.
4
+
5
+ ## Properties
6
+
7
+ ### query
8
+
9
+ > **query**: `object`
10
+
11
+ The query parameters.
12
+
13
+ #### cursor?
14
+
15
+ > `optional` **cursor**: `string`
16
+
17
+ The cursor to get the next chunk of tenants.
18
+
19
+ #### limit?
20
+
21
+ > `optional` **limit**: `string`
22
+
23
+ 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?
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
20
+
21
+ > **body**: `ITenant`[]
22
+
23
+ The list of tenants.
@@ -0,0 +1,17 @@
1
+ # Interface: ITenantRemoveRequest
2
+
3
+ The tenant to remove by id.
4
+
5
+ ## Properties
6
+
7
+ ### 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: ITenantUpdateRequest
2
+
3
+ The tenant to update.
4
+
5
+ ## Properties
6
+
7
+ ### 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
22
+
23
+ > **body**: `Omit`\<`ITenant`, `"id"` \| `"dateCreated"` \| `"dateModified"`\>
24
+
25
+ The tenant to update.
@@ -0,0 +1,5 @@
1
+ # Variable: tagsTenants
2
+
3
+ > `const` **tagsTenants**: `ITag`[]
4
+
5
+ The tag to associate with the routes.
package/locales/en.json CHANGED
@@ -3,6 +3,10 @@
3
3
  "tenantProcessor": {
4
4
  "missingApiKey": "API key header or query param \"{keyName}\" is missing or invalid.",
5
5
  "apiKeyNotFound": "No node tenant found for API key \"{key}\"."
6
+ },
7
+ "tenantAdminService": {
8
+ "apiKeyAlreadyInUse": "The provided API key is already in use by another tenant.",
9
+ "tenantNotFound": "Tenant with ID \"{notFoundId}\" not found."
6
10
  }
7
11
  }
8
12
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/api-tenant-processor",
3
- "version": "0.0.3-next.2",
3
+ "version": "0.0.3-next.20",
4
4
  "description": "API Tenant Processor for converting and api key to a tenant id.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -14,7 +14,7 @@
14
14
  "node": ">=20.0.0"
15
15
  },
16
16
  "dependencies": {
17
- "@twin.org/api-models": "0.0.3-next.2",
17
+ "@twin.org/api-models": "0.0.3-next.20",
18
18
  "@twin.org/context": "next",
19
19
  "@twin.org/core": "next",
20
20
  "@twin.org/entity": "next",
@@ -1,4 +0,0 @@
1
- // Copyright 2025 IOTA Stiftung.
2
- // SPDX-License-Identifier: Apache-2.0.
3
- export {};
4
- //# sourceMappingURL=ITenant.js.map
@@ -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,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=ITenantAdminComponent.js.map
@@ -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.