@twin.org/api-tenant-processor 0.0.3-next.2 → 0.0.3-next.21
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 +25 -1
- package/dist/es/entities/tenant.js.map +1 -1
- package/dist/es/index.js +10 -2
- package/dist/es/index.js.map +1 -1
- 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 +112 -15
- package/dist/es/tenantAdminService.js.map +1 -1
- package/dist/es/tenantIdContextIdHandler.js +8 -1
- package/dist/es/tenantIdContextIdHandler.js.map +1 -1
- package/dist/es/tenantProcessor.js +26 -21
- package/dist/es/tenantProcessor.js.map +1 -1
- package/dist/es/tenantRoutes.js +396 -0
- package/dist/es/tenantRoutes.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 +12 -0
- package/dist/types/index.d.ts +10 -2
- 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 +18 -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 +30 -10
- package/dist/types/tenantIdContextIdHandler.d.ts +5 -0
- package/dist/types/tenantRoutes.d.ts +77 -0
- package/docs/changelog.md +293 -1
- package/docs/examples.md +81 -1
- package/docs/reference/classes/Tenant.md +24 -0
- package/docs/reference/classes/TenantAdminService.md +93 -19
- package/docs/reference/classes/TenantIdContextIdHandler.md +18 -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 +21 -2
- package/docs/reference/interfaces/ITenantAdminServiceConstructorOptions.md +0 -6
- 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 +23 -0
- package/docs/reference/interfaces/ITenantListResponse.md +23 -0
- package/docs/reference/interfaces/ITenantProcessorConfig.md +0 -6
- package/docs/reference/interfaces/ITenantProcessorConstructorOptions.md +0 -6
- package/docs/reference/interfaces/ITenantRemoveRequest.md +17 -0
- package/docs/reference/interfaces/ITenantUpdateRequest.md +25 -0
- package/docs/reference/variables/tagsTenants.md +5 -0
- package/locales/en.json +4 -0
- package/package.json +3 -3
- 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,19 @@
|
|
|
1
|
+
import type { ITenant } from "@twin.org/api-models";
|
|
2
|
+
/**
|
|
3
|
+
* The tenant to update.
|
|
4
|
+
*/
|
|
5
|
+
export interface ITenantUpdateRequest {
|
|
6
|
+
/**
|
|
7
|
+
* The path parameters.
|
|
8
|
+
*/
|
|
9
|
+
pathParams: {
|
|
10
|
+
/**
|
|
11
|
+
* The id of the tenant to update.
|
|
12
|
+
*/
|
|
13
|
+
id: string;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* The tenant to update.
|
|
17
|
+
*/
|
|
18
|
+
body: Omit<ITenant, "id" | "dateCreated" | "dateModified">;
|
|
19
|
+
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { ITenant } from "
|
|
2
|
-
import type { ITenantAdminComponent } from "./models/ITenantAdminComponent.js";
|
|
1
|
+
import type { ITenantAdminComponent, ITenant } from "@twin.org/api-models";
|
|
3
2
|
import type { ITenantAdminServiceConstructorOptions } from "./models/ITenantAdminServiceConstructorOptions.js";
|
|
4
3
|
/**
|
|
5
4
|
* Service for performing email messaging operations to a connector.
|
|
@@ -22,21 +21,38 @@ export declare class TenantAdminService implements ITenantAdminComponent {
|
|
|
22
21
|
/**
|
|
23
22
|
* Get a tenant by its id.
|
|
24
23
|
* @param tenantId The id of the tenant.
|
|
25
|
-
* @returns The tenant
|
|
24
|
+
* @returns The tenant.
|
|
25
|
+
* @throws Error if the tenant is not found.
|
|
26
26
|
*/
|
|
27
|
-
get(tenantId: string): Promise<ITenant
|
|
27
|
+
get(tenantId: string): Promise<ITenant>;
|
|
28
28
|
/**
|
|
29
29
|
* Get a tenant by its api key.
|
|
30
30
|
* @param apiKey The api key of the tenant.
|
|
31
|
-
* @returns The tenant
|
|
31
|
+
* @returns The tenant.
|
|
32
|
+
* @throws Error if the tenant is not found.
|
|
32
33
|
*/
|
|
33
|
-
getByApiKey(apiKey: string): Promise<ITenant
|
|
34
|
+
getByApiKey(apiKey: string): Promise<ITenant>;
|
|
34
35
|
/**
|
|
35
|
-
*
|
|
36
|
+
* Get a tenant by its public origin.
|
|
37
|
+
* @param publicOrigin The origin of the tenant.
|
|
38
|
+
* @returns The tenant.
|
|
39
|
+
* @throws Error if the tenant is not found.
|
|
40
|
+
*/
|
|
41
|
+
getByPublicOrigin(publicOrigin: string): Promise<ITenant>;
|
|
42
|
+
/**
|
|
43
|
+
* Create a tenant.
|
|
36
44
|
* @param tenant The tenant to store.
|
|
37
|
-
* @returns
|
|
45
|
+
* @returns The tenant id.
|
|
46
|
+
*/
|
|
47
|
+
create(tenant: Omit<ITenant, "id" | "dateCreated" | "dateModified"> & {
|
|
48
|
+
id?: string;
|
|
49
|
+
}): Promise<string>;
|
|
50
|
+
/**
|
|
51
|
+
* Update a tenant.
|
|
52
|
+
* @param tenant The tenant to update.
|
|
53
|
+
* @returns The nothing.
|
|
38
54
|
*/
|
|
39
|
-
|
|
55
|
+
update(tenant: Partial<Omit<ITenant, "dateCreated" | "dateModified">>): Promise<void>;
|
|
40
56
|
/**
|
|
41
57
|
* Remove a tenant by its id.
|
|
42
58
|
* @param tenantId The id of the tenant.
|
|
@@ -45,11 +61,15 @@ export declare class TenantAdminService implements ITenantAdminComponent {
|
|
|
45
61
|
remove(tenantId: string): Promise<void>;
|
|
46
62
|
/**
|
|
47
63
|
* Query tenants with pagination.
|
|
64
|
+
* @param options Optional query options.
|
|
65
|
+
* @param options.isNodeTenant Whether to filter for node admin tenants.
|
|
48
66
|
* @param cursor The cursor to start from.
|
|
49
67
|
* @param limit The maximum number of tenants to return.
|
|
50
68
|
* @returns The tenants and the next cursor if more tenants are available.
|
|
51
69
|
*/
|
|
52
|
-
query(
|
|
70
|
+
query(options?: {
|
|
71
|
+
isNodeTenant?: boolean;
|
|
72
|
+
}, cursor?: string, limit?: number): Promise<{
|
|
53
73
|
tenants: ITenant[];
|
|
54
74
|
cursor?: string;
|
|
55
75
|
}>;
|
|
@@ -7,6 +7,11 @@ export declare class TenantIdContextIdHandler implements IContextIdHandler {
|
|
|
7
7
|
* Runtime name for the class.
|
|
8
8
|
*/
|
|
9
9
|
static readonly CLASS_NAME: string;
|
|
10
|
+
/**
|
|
11
|
+
* The class name of the component.
|
|
12
|
+
* @returns The class name.
|
|
13
|
+
*/
|
|
14
|
+
className(): string;
|
|
10
15
|
/**
|
|
11
16
|
* The short form of the tenant id is the base64 version to compact.
|
|
12
17
|
* @param value The full context id value.
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import type { ICreatedResponse, IHttpRequestContext, INoContentResponse, IRestRoute, ITag } from "@twin.org/api-models";
|
|
2
|
+
import type { ITenantCreateRequest } from "./models/api/ITenantCreateRequest.js";
|
|
3
|
+
import type { ITenantGetByApiKeyRequest } from "./models/api/ITenantGetByApiKeyRequest.js";
|
|
4
|
+
import type { ITenantGetByIdRequest } from "./models/api/ITenantGetByIdRequest.js";
|
|
5
|
+
import type { ITenantGetByPublicOriginRequest } from "./models/api/ITenantGetByPublicOriginRequest.js";
|
|
6
|
+
import type { ITenantGetResponse } from "./models/api/ITenantGetResponse.js";
|
|
7
|
+
import type { ITenantListRequest } from "./models/api/ITenantListRequest.js";
|
|
8
|
+
import type { ITenantListResponse } from "./models/api/ITenantListResponse.js";
|
|
9
|
+
import type { ITenantRemoveRequest } from "./models/api/ITenantRemoveRequest.js";
|
|
10
|
+
import type { ITenantUpdateRequest } from "./models/api/ITenantUpdateRequest.js";
|
|
11
|
+
/**
|
|
12
|
+
* The tag to associate with the routes.
|
|
13
|
+
*/
|
|
14
|
+
export declare const tagsTenants: ITag[];
|
|
15
|
+
/**
|
|
16
|
+
* The REST routes for tenant management.
|
|
17
|
+
* @param baseRouteName Prefix to prepend to the paths.
|
|
18
|
+
* @param componentName The name of the component to use in the routes stored in the ComponentFactory.
|
|
19
|
+
* @returns The generated routes.
|
|
20
|
+
*/
|
|
21
|
+
export declare function generateRestRoutesTenants(baseRouteName: string, componentName: string): IRestRoute[];
|
|
22
|
+
/**
|
|
23
|
+
* Get the list of tenants.
|
|
24
|
+
* @param httpRequestContext The request context for the API.
|
|
25
|
+
* @param componentName The name of the component to use in the routes.
|
|
26
|
+
* @param request The request.
|
|
27
|
+
* @returns The response object with additional http response properties.
|
|
28
|
+
*/
|
|
29
|
+
export declare function tenantList(httpRequestContext: IHttpRequestContext, componentName: string, request: ITenantListRequest): Promise<ITenantListResponse>;
|
|
30
|
+
/**
|
|
31
|
+
* Get the tenant by id.
|
|
32
|
+
* @param httpRequestContext The request context for the API.
|
|
33
|
+
* @param componentName The name of the component to use in the routes.
|
|
34
|
+
* @param request The request.
|
|
35
|
+
* @returns The response object with additional http response properties.
|
|
36
|
+
*/
|
|
37
|
+
export declare function tenantById(httpRequestContext: IHttpRequestContext, componentName: string, request: ITenantGetByIdRequest): Promise<ITenantGetResponse>;
|
|
38
|
+
/**
|
|
39
|
+
* Get the tenant by api key.
|
|
40
|
+
* @param httpRequestContext The request context for the API.
|
|
41
|
+
* @param componentName The name of the component to use in the routes.
|
|
42
|
+
* @param request The request.
|
|
43
|
+
* @returns The response object with additional http response properties.
|
|
44
|
+
*/
|
|
45
|
+
export declare function tenantByApiKey(httpRequestContext: IHttpRequestContext, componentName: string, request: ITenantGetByApiKeyRequest): Promise<ITenantGetResponse>;
|
|
46
|
+
/**
|
|
47
|
+
* Get the tenant by public origin.
|
|
48
|
+
* @param httpRequestContext The request context for the API.
|
|
49
|
+
* @param componentName The name of the component to use in the routes.
|
|
50
|
+
* @param request The request.
|
|
51
|
+
* @returns The response object with additional http response properties.
|
|
52
|
+
*/
|
|
53
|
+
export declare function tenantByPublicOrigin(httpRequestContext: IHttpRequestContext, componentName: string, request: ITenantGetByPublicOriginRequest): Promise<ITenantGetResponse>;
|
|
54
|
+
/**
|
|
55
|
+
* Remove the tenant by id.
|
|
56
|
+
* @param httpRequestContext The request context for the API.
|
|
57
|
+
* @param componentName The name of the component to use in the routes.
|
|
58
|
+
* @param request The request.
|
|
59
|
+
* @returns The response object with additional http response properties.
|
|
60
|
+
*/
|
|
61
|
+
export declare function tenantRemove(httpRequestContext: IHttpRequestContext, componentName: string, request: ITenantRemoveRequest): Promise<INoContentResponse>;
|
|
62
|
+
/**
|
|
63
|
+
* Create the tenant.
|
|
64
|
+
* @param httpRequestContext The request context for the API.
|
|
65
|
+
* @param componentName The name of the component to use in the routes.
|
|
66
|
+
* @param request The request.
|
|
67
|
+
* @returns The response object with additional http response properties.
|
|
68
|
+
*/
|
|
69
|
+
export declare function tenantCreate(httpRequestContext: IHttpRequestContext, componentName: string, request: ITenantCreateRequest): Promise<ICreatedResponse>;
|
|
70
|
+
/**
|
|
71
|
+
* Update the tenant.
|
|
72
|
+
* @param httpRequestContext The request context for the API.
|
|
73
|
+
* @param componentName The name of the component to use in the routes.
|
|
74
|
+
* @param request The request.
|
|
75
|
+
* @returns The response object with additional http response properties.
|
|
76
|
+
*/
|
|
77
|
+
export declare function tenantUpdate(httpRequestContext: IHttpRequestContext, componentName: string, request: ITenantUpdateRequest): Promise<INoContentResponse>;
|
package/docs/changelog.md
CHANGED
|
@@ -1,5 +1,297 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.0.3-next.21](https://github.com/twinfoundation/api/compare/api-tenant-processor-v0.0.3-next.20...api-tenant-processor-v0.0.3-next.21) (2026-03-11)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Miscellaneous Chores
|
|
7
|
+
|
|
8
|
+
* **api-tenant-processor:** Synchronize repo versions
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Dependencies
|
|
12
|
+
|
|
13
|
+
* The following workspace dependencies were updated
|
|
14
|
+
* dependencies
|
|
15
|
+
* @twin.org/api-models bumped from 0.0.3-next.20 to 0.0.3-next.21
|
|
16
|
+
|
|
17
|
+
## [0.0.3-next.20](https://github.com/twinfoundation/api/compare/api-tenant-processor-v0.0.3-next.19...api-tenant-processor-v0.0.3-next.20) (2026-02-09)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* location encoding ([#79](https://github.com/twinfoundation/api/issues/79)) ([c684465](https://github.com/twinfoundation/api/commit/c684465f2a871376152472bdecb6aa230b1101a1))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Dependencies
|
|
26
|
+
|
|
27
|
+
* The following workspace dependencies were updated
|
|
28
|
+
* dependencies
|
|
29
|
+
* @twin.org/api-models bumped from 0.0.3-next.19 to 0.0.3-next.20
|
|
30
|
+
|
|
31
|
+
## [0.0.3-next.19](https://github.com/twinfoundation/api/compare/api-tenant-processor-v0.0.3-next.18...api-tenant-processor-v0.0.3-next.19) (2026-02-06)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
### Miscellaneous Chores
|
|
35
|
+
|
|
36
|
+
* **api-tenant-processor:** Synchronize repo versions
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
### Dependencies
|
|
40
|
+
|
|
41
|
+
* The following workspace dependencies were updated
|
|
42
|
+
* dependencies
|
|
43
|
+
* @twin.org/api-models bumped from 0.0.3-next.18 to 0.0.3-next.19
|
|
44
|
+
|
|
45
|
+
## [0.0.3-next.18](https://github.com/twinfoundation/api/compare/api-tenant-processor-v0.0.3-next.17...api-tenant-processor-v0.0.3-next.18) (2026-02-04)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
### Features
|
|
49
|
+
|
|
50
|
+
* tenant api and scopes ([#75](https://github.com/twinfoundation/api/issues/75)) ([c663141](https://github.com/twinfoundation/api/commit/c663141091e8974d769f8f9904ecdab009ebd083))
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
### Dependencies
|
|
54
|
+
|
|
55
|
+
* The following workspace dependencies were updated
|
|
56
|
+
* dependencies
|
|
57
|
+
* @twin.org/api-models bumped from 0.0.3-next.17 to 0.0.3-next.18
|
|
58
|
+
|
|
59
|
+
## [0.0.3-next.17](https://github.com/twinfoundation/api/compare/api-tenant-processor-v0.0.3-next.16...api-tenant-processor-v0.0.3-next.17) (2026-01-26)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
### Miscellaneous Chores
|
|
63
|
+
|
|
64
|
+
* **api-tenant-processor:** Synchronize repo versions
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
### Dependencies
|
|
68
|
+
|
|
69
|
+
* The following workspace dependencies were updated
|
|
70
|
+
* dependencies
|
|
71
|
+
* @twin.org/api-models bumped from 0.0.3-next.16 to 0.0.3-next.17
|
|
72
|
+
|
|
73
|
+
## [0.0.3-next.16](https://github.com/twinfoundation/api/compare/api-tenant-processor-v0.0.3-next.15...api-tenant-processor-v0.0.3-next.16) (2026-01-26)
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
### Features
|
|
77
|
+
|
|
78
|
+
* public base url ([#70](https://github.com/twinfoundation/api/issues/70)) ([5b958cd](https://github.com/twinfoundation/api/commit/5b958cd91e8a38cdae2835ff5f2356c7e48d37c3))
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
### Dependencies
|
|
82
|
+
|
|
83
|
+
* The following workspace dependencies were updated
|
|
84
|
+
* dependencies
|
|
85
|
+
* @twin.org/api-models bumped from 0.0.3-next.15 to 0.0.3-next.16
|
|
86
|
+
|
|
87
|
+
## [0.0.3-next.15](https://github.com/twinfoundation/api/compare/api-tenant-processor-v0.0.3-next.14...api-tenant-processor-v0.0.3-next.15) (2026-01-22)
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
### Miscellaneous Chores
|
|
91
|
+
|
|
92
|
+
* **api-tenant-processor:** Synchronize repo versions
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
### Dependencies
|
|
96
|
+
|
|
97
|
+
* The following workspace dependencies were updated
|
|
98
|
+
* dependencies
|
|
99
|
+
* @twin.org/api-models bumped from 0.0.3-next.14 to 0.0.3-next.15
|
|
100
|
+
|
|
101
|
+
## [0.0.3-next.14](https://github.com/twinfoundation/api/compare/api-tenant-processor-v0.0.3-next.13...api-tenant-processor-v0.0.3-next.14) (2026-01-20)
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
### Miscellaneous Chores
|
|
105
|
+
|
|
106
|
+
* **api-tenant-processor:** Synchronize repo versions
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
### Dependencies
|
|
110
|
+
|
|
111
|
+
* The following workspace dependencies were updated
|
|
112
|
+
* dependencies
|
|
113
|
+
* @twin.org/api-models bumped from 0.0.3-next.13 to 0.0.3-next.14
|
|
114
|
+
|
|
115
|
+
## [0.0.3-next.13](https://github.com/twinfoundation/api/compare/api-tenant-processor-v0.0.3-next.12...api-tenant-processor-v0.0.3-next.13) (2026-01-19)
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
### Miscellaneous Chores
|
|
119
|
+
|
|
120
|
+
* **api-tenant-processor:** Synchronize repo versions
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
### Dependencies
|
|
124
|
+
|
|
125
|
+
* The following workspace dependencies were updated
|
|
126
|
+
* dependencies
|
|
127
|
+
* @twin.org/api-models bumped from 0.0.3-next.12 to 0.0.3-next.13
|
|
128
|
+
|
|
129
|
+
## [0.0.3-next.12](https://github.com/twinfoundation/api/compare/api-tenant-processor-v0.0.3-next.11...api-tenant-processor-v0.0.3-next.12) (2026-01-12)
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
### Miscellaneous Chores
|
|
133
|
+
|
|
134
|
+
* **api-tenant-processor:** Synchronize repo versions
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
### Dependencies
|
|
138
|
+
|
|
139
|
+
* The following workspace dependencies were updated
|
|
140
|
+
* dependencies
|
|
141
|
+
* @twin.org/api-models bumped from 0.0.3-next.11 to 0.0.3-next.12
|
|
142
|
+
|
|
143
|
+
## [0.0.3-next.11](https://github.com/twinfoundation/api/compare/api-tenant-processor-v0.0.3-next.10...api-tenant-processor-v0.0.3-next.11) (2026-01-08)
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
### Bug Fixes
|
|
147
|
+
|
|
148
|
+
* duplicate api keys ([#61](https://github.com/twinfoundation/api/issues/61)) ([5519c2d](https://github.com/twinfoundation/api/commit/5519c2d077d9b3d4b5fc7d5f073ef67cd000a367))
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
### Dependencies
|
|
152
|
+
|
|
153
|
+
* The following workspace dependencies were updated
|
|
154
|
+
* dependencies
|
|
155
|
+
* @twin.org/api-models bumped from 0.0.3-next.10 to 0.0.3-next.11
|
|
156
|
+
|
|
157
|
+
## [0.0.3-next.10](https://github.com/twinfoundation/api/compare/api-tenant-processor-v0.0.3-next.9...api-tenant-processor-v0.0.3-next.10) (2026-01-05)
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
### Miscellaneous Chores
|
|
161
|
+
|
|
162
|
+
* **api-tenant-processor:** Synchronize repo versions
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
### Dependencies
|
|
166
|
+
|
|
167
|
+
* The following workspace dependencies were updated
|
|
168
|
+
* dependencies
|
|
169
|
+
* @twin.org/api-models bumped from 0.0.3-next.9 to 0.0.3-next.10
|
|
170
|
+
|
|
171
|
+
## [0.0.3-next.9](https://github.com/twinfoundation/api/compare/api-tenant-processor-v0.0.3-next.8...api-tenant-processor-v0.0.3-next.9) (2026-01-05)
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
### Features
|
|
175
|
+
|
|
176
|
+
* add context id features ([#42](https://github.com/twinfoundation/api/issues/42)) ([0186055](https://github.com/twinfoundation/api/commit/0186055c48afde842a4254b4df9ac9249c40fe40))
|
|
177
|
+
* add livez endpoint ([#57](https://github.com/twinfoundation/api/issues/57)) ([ef007db](https://github.com/twinfoundation/api/commit/ef007db8201736dd3053211f849ffd03baaa485e))
|
|
178
|
+
* add tests for tenant id handler ([c868e7e](https://github.com/twinfoundation/api/commit/c868e7e5831e13df39b8994c40834e51f69fa0b9))
|
|
179
|
+
* check tenant id in auth if set ([937ba0c](https://github.com/twinfoundation/api/commit/937ba0cd790038556a7b2af251e52b43cb059df4))
|
|
180
|
+
* check tenant id in auth if set ([66f7337](https://github.com/twinfoundation/api/commit/66f73374d3cf4c1c85ea96ec74bb30712fb84dd7))
|
|
181
|
+
* reduce short form tenant id length ([bcda377](https://github.com/twinfoundation/api/commit/bcda377daed03b21fd1c6ffe47bad4a45d96602b))
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
### Bug Fixes
|
|
185
|
+
|
|
186
|
+
* do not check x-api-key for health resourcr ([#54](https://github.com/twinfoundation/api/issues/54)) ([897a747](https://github.com/twinfoundation/api/commit/897a747a57ed76ee37035f7ea3d40953df3f5fb0))
|
|
187
|
+
* remove extraneous type ([f85c52c](https://github.com/twinfoundation/api/commit/f85c52c55caa3a7a64f6f675842f0ea59289a5d9))
|
|
188
|
+
* use base64Url for tenant id short form so it doesn't include slash ([7210771](https://github.com/twinfoundation/api/commit/72107718650acd05440ce9d9bf10905e6052281c))
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
### Dependencies
|
|
192
|
+
|
|
193
|
+
* The following workspace dependencies were updated
|
|
194
|
+
* dependencies
|
|
195
|
+
* @twin.org/api-models bumped from 0.0.3-next.8 to 0.0.3-next.9
|
|
196
|
+
|
|
197
|
+
## [0.0.3-next.8](https://github.com/twinfoundation/api/compare/api-tenant-processor-v0.0.3-next.7...api-tenant-processor-v0.0.3-next.8) (2025-12-17)
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
### Bug Fixes
|
|
201
|
+
|
|
202
|
+
* do not check x-api-key for health resourcr ([#54](https://github.com/twinfoundation/api/issues/54)) ([897a747](https://github.com/twinfoundation/api/commit/897a747a57ed76ee37035f7ea3d40953df3f5fb0))
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
### Dependencies
|
|
206
|
+
|
|
207
|
+
* The following workspace dependencies were updated
|
|
208
|
+
* dependencies
|
|
209
|
+
* @twin.org/api-models bumped from 0.0.3-next.7 to 0.0.3-next.8
|
|
210
|
+
|
|
211
|
+
## [0.0.3-next.7](https://github.com/twinfoundation/api/compare/api-tenant-processor-v0.0.3-next.6...api-tenant-processor-v0.0.3-next.7) (2025-11-26)
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
### Miscellaneous Chores
|
|
215
|
+
|
|
216
|
+
* **api-tenant-processor:** Synchronize repo versions
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
### Dependencies
|
|
220
|
+
|
|
221
|
+
* The following workspace dependencies were updated
|
|
222
|
+
* dependencies
|
|
223
|
+
* @twin.org/api-models bumped from 0.0.3-next.6 to 0.0.3-next.7
|
|
224
|
+
|
|
225
|
+
## [0.0.3-next.6](https://github.com/twinfoundation/api/compare/api-tenant-processor-v0.0.3-next.5...api-tenant-processor-v0.0.3-next.6) (2025-11-20)
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
### Features
|
|
229
|
+
|
|
230
|
+
* check tenant id in auth if set ([937ba0c](https://github.com/twinfoundation/api/commit/937ba0cd790038556a7b2af251e52b43cb059df4))
|
|
231
|
+
* check tenant id in auth if set ([66f7337](https://github.com/twinfoundation/api/commit/66f73374d3cf4c1c85ea96ec74bb30712fb84dd7))
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
### Dependencies
|
|
235
|
+
|
|
236
|
+
* The following workspace dependencies were updated
|
|
237
|
+
* dependencies
|
|
238
|
+
* @twin.org/api-models bumped from 0.0.3-next.5 to 0.0.3-next.6
|
|
239
|
+
|
|
240
|
+
## [0.0.3-next.5](https://github.com/twinfoundation/api/compare/api-tenant-processor-v0.0.3-next.4...api-tenant-processor-v0.0.3-next.5) (2025-11-14)
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
### Miscellaneous Chores
|
|
244
|
+
|
|
245
|
+
* **api-tenant-processor:** Synchronize repo versions
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
### Dependencies
|
|
249
|
+
|
|
250
|
+
* The following workspace dependencies were updated
|
|
251
|
+
* dependencies
|
|
252
|
+
* @twin.org/api-models bumped from 0.0.3-next.4 to 0.0.3-next.5
|
|
253
|
+
|
|
254
|
+
## [0.0.3-next.4](https://github.com/twinfoundation/api/compare/api-tenant-processor-v0.0.3-next.3...api-tenant-processor-v0.0.3-next.4) (2025-11-14)
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
### Features
|
|
258
|
+
|
|
259
|
+
* add context id features ([#42](https://github.com/twinfoundation/api/issues/42)) ([0186055](https://github.com/twinfoundation/api/commit/0186055c48afde842a4254b4df9ac9249c40fe40))
|
|
260
|
+
* add tests for tenant id handler ([c868e7e](https://github.com/twinfoundation/api/commit/c868e7e5831e13df39b8994c40834e51f69fa0b9))
|
|
261
|
+
* reduce short form tenant id length ([bcda377](https://github.com/twinfoundation/api/commit/bcda377daed03b21fd1c6ffe47bad4a45d96602b))
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
### Bug Fixes
|
|
265
|
+
|
|
266
|
+
* remove extraneous type ([f85c52c](https://github.com/twinfoundation/api/commit/f85c52c55caa3a7a64f6f675842f0ea59289a5d9))
|
|
267
|
+
* use base64Url for tenant id short form so it doesn't include slash ([7210771](https://github.com/twinfoundation/api/commit/72107718650acd05440ce9d9bf10905e6052281c))
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
### Dependencies
|
|
271
|
+
|
|
272
|
+
* The following workspace dependencies were updated
|
|
273
|
+
* dependencies
|
|
274
|
+
* @twin.org/api-models bumped from 0.0.3-next.3 to 0.0.3-next.4
|
|
275
|
+
|
|
276
|
+
## [0.0.3-next.3](https://github.com/twinfoundation/api/compare/api-tenant-processor-v0.0.3-next.2...api-tenant-processor-v0.0.3-next.3) (2025-11-14)
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
### Features
|
|
280
|
+
|
|
281
|
+
* add tests for tenant id handler ([c868e7e](https://github.com/twinfoundation/api/commit/c868e7e5831e13df39b8994c40834e51f69fa0b9))
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
### Bug Fixes
|
|
285
|
+
|
|
286
|
+
* use base64Url for tenant id short form so it doesn't include slash ([7210771](https://github.com/twinfoundation/api/commit/72107718650acd05440ce9d9bf10905e6052281c))
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
### Dependencies
|
|
290
|
+
|
|
291
|
+
* The following workspace dependencies were updated
|
|
292
|
+
* dependencies
|
|
293
|
+
* @twin.org/api-models bumped from 0.0.3-next.2 to 0.0.3-next.3
|
|
294
|
+
|
|
3
295
|
## [0.0.3-next.2](https://github.com/twinfoundation/api/compare/api-tenant-processor-v0.0.3-next.1...api-tenant-processor-v0.0.3-next.2) (2025-11-12)
|
|
4
296
|
|
|
5
297
|
|
|
@@ -33,4 +325,4 @@
|
|
|
33
325
|
* dependencies
|
|
34
326
|
* @twin.org/api-models bumped from 0.0.3-next.0 to 0.0.3-next.1
|
|
35
327
|
|
|
36
|
-
##
|
|
328
|
+
## Changelog
|
package/docs/examples.md
CHANGED
|
@@ -1 +1,81 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Tenant Processor Examples
|
|
2
|
+
|
|
3
|
+
These snippets show tenant lifecycle management and request context routing for multi-tenant deployments.
|
|
4
|
+
|
|
5
|
+
## TenantAdminService
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import { TenantAdminService } from '@twin.org/api-tenant-processor';
|
|
9
|
+
|
|
10
|
+
const tenantAdmin = new TenantAdminService();
|
|
11
|
+
|
|
12
|
+
console.log(tenantAdmin.className()); // TenantAdminService
|
|
13
|
+
|
|
14
|
+
const createdTenantId = await tenantAdmin.create({
|
|
15
|
+
label: 'North Region',
|
|
16
|
+
apiKey: '0123456789abcdef0123456789abcdef',
|
|
17
|
+
publicOrigin: 'https://north.example.org'
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
await tenantAdmin.update({
|
|
21
|
+
id: createdTenantId,
|
|
22
|
+
label: 'North Region EU'
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
const byKey = await tenantAdmin.getByApiKey('0123456789abcdef0123456789abcdef');
|
|
26
|
+
console.log(byKey.id.length); // 32
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
import { TenantAdminService } from '@twin.org/api-tenant-processor';
|
|
31
|
+
|
|
32
|
+
const tenantAdmin = new TenantAdminService();
|
|
33
|
+
|
|
34
|
+
const byId = await tenantAdmin.get('0123456789abcdef0123456789abcdef');
|
|
35
|
+
const byOrigin = await tenantAdmin.getByPublicOrigin('https://north.example.org');
|
|
36
|
+
const page = await tenantAdmin.query({ isNodeTenant: false }, '', 10);
|
|
37
|
+
|
|
38
|
+
await tenantAdmin.remove(byId.id);
|
|
39
|
+
|
|
40
|
+
console.log(byOrigin.label); // North Region EU
|
|
41
|
+
console.log(page.tenants.length); // 1
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## TenantIdContextIdHandler
|
|
45
|
+
|
|
46
|
+
```typescript
|
|
47
|
+
import { TenantIdContextIdHandler } from '@twin.org/api-tenant-processor';
|
|
48
|
+
|
|
49
|
+
const handler = new TenantIdContextIdHandler();
|
|
50
|
+
|
|
51
|
+
console.log(handler.className()); // TenantIdContextIdHandler
|
|
52
|
+
console.log(handler.short('0123456789abcdef0123456789abcdef')); // ASNFZ4mrze8BI0VniavN7w
|
|
53
|
+
|
|
54
|
+
handler.guard('0123456789abcdef0123456789abcdef');
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## TenantProcessor
|
|
58
|
+
|
|
59
|
+
```typescript
|
|
60
|
+
import { TenantProcessor } from '@twin.org/api-tenant-processor';
|
|
61
|
+
|
|
62
|
+
const tenantProcessor = new TenantProcessor();
|
|
63
|
+
|
|
64
|
+
console.log(tenantProcessor.className()); // TenantProcessor
|
|
65
|
+
|
|
66
|
+
const request = {
|
|
67
|
+
method: 'get',
|
|
68
|
+
url: '/info',
|
|
69
|
+
headers: {
|
|
70
|
+
'x-api-key': '0123456789abcdef0123456789abcdef'
|
|
71
|
+
},
|
|
72
|
+
query: {}
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
const response = {};
|
|
76
|
+
const contextIds = {};
|
|
77
|
+
const processorState: { [id: string]: unknown } = {};
|
|
78
|
+
|
|
79
|
+
await tenantProcessor.pre(request, response, { skipTenant: false }, contextIds, processorState);
|
|
80
|
+
console.log(typeof contextIds.tenant); // string
|
|
81
|
+
```
|
|
@@ -43,3 +43,27 @@ The label of the tenant.
|
|
|
43
43
|
> **dateCreated**: `string`
|
|
44
44
|
|
|
45
45
|
The date the tenant was created.
|
|
46
|
+
|
|
47
|
+
***
|
|
48
|
+
|
|
49
|
+
### dateModified
|
|
50
|
+
|
|
51
|
+
> **dateModified**: `string`
|
|
52
|
+
|
|
53
|
+
The date the tenant was modified.
|
|
54
|
+
|
|
55
|
+
***
|
|
56
|
+
|
|
57
|
+
### publicOrigin?
|
|
58
|
+
|
|
59
|
+
> `optional` **publicOrigin**: `string`
|
|
60
|
+
|
|
61
|
+
The origin available to the public for accessing the API.
|
|
62
|
+
|
|
63
|
+
***
|
|
64
|
+
|
|
65
|
+
### isNodeTenant
|
|
66
|
+
|
|
67
|
+
> **isNodeTenant**: `boolean`
|
|
68
|
+
|
|
69
|
+
Indicates whether the tenant is the node tenant.
|