@twin.org/api-models 0.0.3-next.44 → 0.0.3-next.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/models/server/IWebServer.js.map +1 -1
- package/dist/es/models/services/IPlatformComponent.js.map +1 -1
- package/dist/es/models/services/ITenant.js.map +1 -1
- package/dist/es/models/services/ITenantAdminComponent.js.map +1 -1
- package/dist/types/models/server/IWebServer.d.ts +3 -3
- package/dist/types/models/services/IPlatformComponent.d.ts +1 -1
- package/dist/types/models/services/ITenant.d.ts +1 -1
- package/dist/types/models/services/ITenantAdminComponent.d.ts +10 -2
- package/docs/changelog.md +14 -0
- package/docs/reference/interfaces/IPlatformComponent.md +1 -1
- package/docs/reference/interfaces/ITenant.md +2 -2
- package/docs/reference/interfaces/ITenantAdminComponent.md +34 -2
- package/docs/reference/interfaces/IWebServer.md +3 -3
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IWebServer.js","sourceRoot":"","sources":["../../../../src/models/server/IWebServer.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IComponent, IHealth } from \"@twin.org/core\";\nimport type { IRestRouteProcessor } from \"./IRestRouteProcessor.js\";\nimport type { ISocketRouteProcessor } from \"./ISocketRouteProcessor.js\";\nimport type { IWebServerOptions } from \"./IWebServerOptions.js\";\nimport type { IRestRoute } from \"../routes/IRestRoute.js\";\nimport type { ISocketRoute } from \"../routes/ISocketRoute.js\";\n\n/**\n * Interface describing a web server.\n */\nexport interface IWebServer<T> extends IComponent {\n\t/**\n\t * Get the web server instance.\n\t * @returns The web server instance.\n\t */\n\tgetInstance(): T;\n\n\t/**\n\t * Build the server.\n\t * @param restRouteProcessors The processors for incoming requests over REST.\n\t * @param restRoutes The REST routes.\n\t * @param socketRouteProcessors The processors for incoming requests over Sockets.\n\t * @param socketRoutes The socket routes.\n\t * @param options Options for building the server.\n\t * @returns
|
|
1
|
+
{"version":3,"file":"IWebServer.js","sourceRoot":"","sources":["../../../../src/models/server/IWebServer.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IComponent, IHealth } from \"@twin.org/core\";\nimport type { IRestRouteProcessor } from \"./IRestRouteProcessor.js\";\nimport type { ISocketRouteProcessor } from \"./ISocketRouteProcessor.js\";\nimport type { IWebServerOptions } from \"./IWebServerOptions.js\";\nimport type { IRestRoute } from \"../routes/IRestRoute.js\";\nimport type { ISocketRoute } from \"../routes/ISocketRoute.js\";\n\n/**\n * Interface describing a web server.\n */\nexport interface IWebServer<T> extends IComponent {\n\t/**\n\t * Get the web server instance.\n\t * @returns The web server instance.\n\t */\n\tgetInstance(): T;\n\n\t/**\n\t * Build the server.\n\t * @param restRouteProcessors The processors for incoming requests over REST.\n\t * @param restRoutes The REST routes.\n\t * @param socketRouteProcessors The processors for incoming requests over Sockets.\n\t * @param socketRoutes The socket routes.\n\t * @param options Options for building the server.\n\t * @returns A promise that resolves when the server is fully built and ready to start.\n\t */\n\tbuild(\n\t\trestRouteProcessors?: IRestRouteProcessor[],\n\t\trestRoutes?: IRestRoute[],\n\t\tsocketRouteProcessors?: ISocketRouteProcessor[],\n\t\tsocketRoutes?: ISocketRoute[],\n\t\toptions?: IWebServerOptions\n\t): Promise<void>;\n\n\t/**\n\t * Start the server.\n\t * @returns A promise that resolves when the server is listening for connections.\n\t */\n\tstart(): Promise<void>;\n\n\t/**\n\t * Stop the server.\n\t * @returns A promise that resolves when the server has shut down all connections.\n\t */\n\tstop(): Promise<void>;\n\n\t/**\n\t * Returns the health status of the component.\n\t * @returns The health status of the component, can return multiple entries for elements within the component.\n\t */\n\thealth(): Promise<IHealth[]>;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IPlatformComponent.js","sourceRoot":"","sources":["../../../../src/models/services/IPlatformComponent.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IComponent } from \"@twin.org/core\";\n\n/**\n * Interface for the platform component.\n */\nexport interface IPlatformComponent extends IComponent {\n\t/**\n\t * Indicates whether the component is running in a multi-tenant environment.\n\t * @returns True if the component is running in a multi-tenant environment, false otherwise.\n\t */\n\tisMultiTenant(): boolean;\n\n\t/**\n\t * Execute a method, if single tenant will run once, if multi-tenant will run for each tenant.\n\t * @param method The method to run for each tenant.\n\t * @returns
|
|
1
|
+
{"version":3,"file":"IPlatformComponent.js","sourceRoot":"","sources":["../../../../src/models/services/IPlatformComponent.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IComponent } from \"@twin.org/core\";\n\n/**\n * Interface for the platform component.\n */\nexport interface IPlatformComponent extends IComponent {\n\t/**\n\t * Indicates whether the component is running in a multi-tenant environment.\n\t * @returns True if the component is running in a multi-tenant environment, false otherwise.\n\t */\n\tisMultiTenant(): boolean;\n\n\t/**\n\t * Execute a method, if single tenant will run once, if multi-tenant will run for each tenant.\n\t * @param method The method to run for each tenant.\n\t * @returns A promise that resolves when the method has been executed for all applicable tenants.\n\t */\n\texecute(method: () => Promise<void>): Promise<void>;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ITenant.js","sourceRoot":"","sources":["../../../../src/models/services/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\t/**\n\t * The date the tenant was modified.\n\t */\n\tdateModified: string;\n\n\t/**\n\t * The public origin available to the public for accessing the API.\n\t */\n\tpublicOrigin?: string;\n\n\t/**\n\t * The organization id for the tenant.\n\t */\n\torganizationId
|
|
1
|
+
{"version":3,"file":"ITenant.js","sourceRoot":"","sources":["../../../../src/models/services/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\t/**\n\t * The date the tenant was modified.\n\t */\n\tdateModified: string;\n\n\t/**\n\t * The public origin available to the public for accessing the API.\n\t */\n\tpublicOrigin?: string;\n\n\t/**\n\t * The organization id for the tenant.\n\t */\n\torganizationId: string;\n\n\t/**\n\t * Optional list of organization aliases that can are used for legacy lookups.\n\t */\n\torganizationIdLegacy?: string[];\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ITenantAdminComponent.js","sourceRoot":"","sources":["../../../../src/models/services/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 { EntityCondition } from \"@twin.org/entity\";\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 * Create a tenant.\n\t * @param tenant The tenant to store.\n\t * @returns The tenant id.\n\t */\n\tcreate(\n\t\ttenant: Omit<ITenant, \"id\" | \"dateCreated\" | \"dateModified\"> & { id?: string }\n\t): Promise<string>;\n\n\t/**\n\t * Update a tenant.\n\t * @param tenant The tenant to update.\n\t * @returns
|
|
1
|
+
{"version":3,"file":"ITenantAdminComponent.js","sourceRoot":"","sources":["../../../../src/models/services/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 { EntityCondition } from \"@twin.org/entity\";\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 * Create a tenant.\n\t * @param tenant The tenant to store.\n\t * @returns The tenant id.\n\t */\n\tcreate(\n\t\ttenant: Omit<ITenant, \"id\" | \"dateCreated\" | \"dateModified\"> & { id?: string }\n\t): Promise<string>;\n\n\t/**\n\t * Update a tenant.\n\t * @param tenant The tenant to update.\n\t * @returns A promise that resolves when the tenant has been updated.\n\t */\n\tupdate(tenant: Partial<Omit<ITenant, \"dateCreated\" | \"dateModified\">>): Promise<void>;\n\n\t/**\n\t * Get a tenant by its id.\n\t * @param tenantId The id of the tenant.\n\t * @returns The tenant.\n\t * @throws Error if the tenant is not found.\n\t */\n\tget(tenantId: string): Promise<ITenant>;\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.\n\t * @throws Error if the tenant is not found.\n\t */\n\tgetByApiKey(apiKey: string): Promise<ITenant>;\n\n\t/**\n\t * Get a tenant by its public origin.\n\t * @param publicOrigin The origin of the tenant.\n\t * @returns The tenant.\n\t * @throws Error if the tenant is not found.\n\t */\n\tgetByPublicOrigin(publicOrigin: string): Promise<ITenant>;\n\n\t/**\n\t * Remove a tenant by its id.\n\t * @param tenantId The id of the tenant.\n\t * @returns A promise that resolves when the tenant has been removed.\n\t * @throws Error if the tenant is not found.\n\t */\n\tremove(tenantId: string): Promise<void>;\n\n\t/**\n\t * Get a tenant by its organization id, optionally searching legacy ids.\n\t * @param organizationId The organization id of the tenant.\n\t * @param includeLegacy Whether to also search the legacy organization id array.\n\t * @returns The tenant.\n\t * @throws Error if the tenant is not found.\n\t */\n\tgetTenantByOrganizationId(organizationId: string, includeLegacy?: boolean): Promise<ITenant>;\n\n\t/**\n\t * Query tenants with pagination.\n\t * @param conditions The conditions to filter the tenants.\n\t * @param properties The properties to include in the returned tenants.\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(\n\t\tconditions?: EntityCondition<ITenant>,\n\t\tproperties?: (keyof ITenant)[],\n\t\tcursor?: string,\n\t\tlimit?: number\n\t): Promise<{ tenants: ITenant[]; cursor?: string }>;\n}\n"]}
|
|
@@ -20,17 +20,17 @@ export interface IWebServer<T> extends IComponent {
|
|
|
20
20
|
* @param socketRouteProcessors The processors for incoming requests over Sockets.
|
|
21
21
|
* @param socketRoutes The socket routes.
|
|
22
22
|
* @param options Options for building the server.
|
|
23
|
-
* @returns
|
|
23
|
+
* @returns A promise that resolves when the server is fully built and ready to start.
|
|
24
24
|
*/
|
|
25
25
|
build(restRouteProcessors?: IRestRouteProcessor[], restRoutes?: IRestRoute[], socketRouteProcessors?: ISocketRouteProcessor[], socketRoutes?: ISocketRoute[], options?: IWebServerOptions): Promise<void>;
|
|
26
26
|
/**
|
|
27
27
|
* Start the server.
|
|
28
|
-
* @returns
|
|
28
|
+
* @returns A promise that resolves when the server is listening for connections.
|
|
29
29
|
*/
|
|
30
30
|
start(): Promise<void>;
|
|
31
31
|
/**
|
|
32
32
|
* Stop the server.
|
|
33
|
-
* @returns
|
|
33
|
+
* @returns A promise that resolves when the server has shut down all connections.
|
|
34
34
|
*/
|
|
35
35
|
stop(): Promise<void>;
|
|
36
36
|
/**
|
|
@@ -11,7 +11,7 @@ export interface IPlatformComponent extends IComponent {
|
|
|
11
11
|
/**
|
|
12
12
|
* Execute a method, if single tenant will run once, if multi-tenant will run for each tenant.
|
|
13
13
|
* @param method The method to run for each tenant.
|
|
14
|
-
* @returns
|
|
14
|
+
* @returns A promise that resolves when the method has been executed for all applicable tenants.
|
|
15
15
|
*/
|
|
16
16
|
execute(method: () => Promise<void>): Promise<void>;
|
|
17
17
|
}
|
|
@@ -16,7 +16,7 @@ export interface ITenantAdminComponent extends IComponent {
|
|
|
16
16
|
/**
|
|
17
17
|
* Update a tenant.
|
|
18
18
|
* @param tenant The tenant to update.
|
|
19
|
-
* @returns
|
|
19
|
+
* @returns A promise that resolves when the tenant has been updated.
|
|
20
20
|
*/
|
|
21
21
|
update(tenant: Partial<Omit<ITenant, "dateCreated" | "dateModified">>): Promise<void>;
|
|
22
22
|
/**
|
|
@@ -43,10 +43,18 @@ export interface ITenantAdminComponent extends IComponent {
|
|
|
43
43
|
/**
|
|
44
44
|
* Remove a tenant by its id.
|
|
45
45
|
* @param tenantId The id of the tenant.
|
|
46
|
-
* @returns
|
|
46
|
+
* @returns A promise that resolves when the tenant has been removed.
|
|
47
47
|
* @throws Error if the tenant is not found.
|
|
48
48
|
*/
|
|
49
49
|
remove(tenantId: string): Promise<void>;
|
|
50
|
+
/**
|
|
51
|
+
* Get a tenant by its organization id, optionally searching legacy ids.
|
|
52
|
+
* @param organizationId The organization id of the tenant.
|
|
53
|
+
* @param includeLegacy Whether to also search the legacy organization id array.
|
|
54
|
+
* @returns The tenant.
|
|
55
|
+
* @throws Error if the tenant is not found.
|
|
56
|
+
*/
|
|
57
|
+
getTenantByOrganizationId(organizationId: string, includeLegacy?: boolean): Promise<ITenant>;
|
|
50
58
|
/**
|
|
51
59
|
* Query tenants with pagination.
|
|
52
60
|
* @param conditions The conditions to filter the tenants.
|
package/docs/changelog.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.0.3-next.46](https://github.com/iotaledger/twin-api/compare/api-models-v0.0.3-next.45...api-models-v0.0.3-next.46) (2026-06-17)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Miscellaneous Chores
|
|
7
|
+
|
|
8
|
+
* **api-models:** Synchronize repo versions
|
|
9
|
+
|
|
10
|
+
## [0.0.3-next.45](https://github.com/iotaledger/twin-api/compare/api-models-v0.0.3-next.44...api-models-v0.0.3-next.45) (2026-06-15)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* throw AlreadyExistsError on duplicate tenant id in create() ([#164](https://github.com/iotaledger/twin-api/issues/164)) ([b69f408](https://github.com/iotaledger/twin-api/commit/b69f408fc06a0599723b048fa4a5053305a06b78))
|
|
16
|
+
|
|
3
17
|
## [0.0.3-next.44](https://github.com/iotaledger/twin-api/compare/api-models-v0.0.3-next.43...api-models-v0.0.3-next.44) (2026-06-11)
|
|
4
18
|
|
|
5
19
|
|
|
@@ -52,9 +52,9 @@ The public origin available to the public for accessing the API.
|
|
|
52
52
|
|
|
53
53
|
***
|
|
54
54
|
|
|
55
|
-
### organizationId
|
|
55
|
+
### organizationId {#organizationid}
|
|
56
56
|
|
|
57
|
-
>
|
|
57
|
+
> **organizationId**: `string`
|
|
58
58
|
|
|
59
59
|
The organization id for the tenant.
|
|
60
60
|
|
|
@@ -48,7 +48,7 @@ The tenant to update.
|
|
|
48
48
|
|
|
49
49
|
`Promise`\<`void`\>
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
A promise that resolves when the tenant has been updated.
|
|
52
52
|
|
|
53
53
|
***
|
|
54
54
|
|
|
@@ -148,7 +148,39 @@ The id of the tenant.
|
|
|
148
148
|
|
|
149
149
|
`Promise`\<`void`\>
|
|
150
150
|
|
|
151
|
-
|
|
151
|
+
A promise that resolves when the tenant has been removed.
|
|
152
|
+
|
|
153
|
+
#### Throws
|
|
154
|
+
|
|
155
|
+
Error if the tenant is not found.
|
|
156
|
+
|
|
157
|
+
***
|
|
158
|
+
|
|
159
|
+
### getTenantByOrganizationId() {#gettenantbyorganizationid}
|
|
160
|
+
|
|
161
|
+
> **getTenantByOrganizationId**(`organizationId`, `includeLegacy?`): `Promise`\<[`ITenant`](ITenant.md)\>
|
|
162
|
+
|
|
163
|
+
Get a tenant by its organization id, optionally searching legacy ids.
|
|
164
|
+
|
|
165
|
+
#### Parameters
|
|
166
|
+
|
|
167
|
+
##### organizationId
|
|
168
|
+
|
|
169
|
+
`string`
|
|
170
|
+
|
|
171
|
+
The organization id of the tenant.
|
|
172
|
+
|
|
173
|
+
##### includeLegacy?
|
|
174
|
+
|
|
175
|
+
`boolean`
|
|
176
|
+
|
|
177
|
+
Whether to also search the legacy organization id array.
|
|
178
|
+
|
|
179
|
+
#### Returns
|
|
180
|
+
|
|
181
|
+
`Promise`\<[`ITenant`](ITenant.md)\>
|
|
182
|
+
|
|
183
|
+
The tenant.
|
|
152
184
|
|
|
153
185
|
#### Throws
|
|
154
186
|
|
|
@@ -70,7 +70,7 @@ Options for building the server.
|
|
|
70
70
|
|
|
71
71
|
`Promise`\<`void`\>
|
|
72
72
|
|
|
73
|
-
|
|
73
|
+
A promise that resolves when the server is fully built and ready to start.
|
|
74
74
|
|
|
75
75
|
***
|
|
76
76
|
|
|
@@ -84,7 +84,7 @@ Start the server.
|
|
|
84
84
|
|
|
85
85
|
`Promise`\<`void`\>
|
|
86
86
|
|
|
87
|
-
|
|
87
|
+
A promise that resolves when the server is listening for connections.
|
|
88
88
|
|
|
89
89
|
#### Overrides
|
|
90
90
|
|
|
@@ -102,7 +102,7 @@ Stop the server.
|
|
|
102
102
|
|
|
103
103
|
`Promise`\<`void`\>
|
|
104
104
|
|
|
105
|
-
|
|
105
|
+
A promise that resolves when the server has shut down all connections.
|
|
106
106
|
|
|
107
107
|
#### Overrides
|
|
108
108
|
|
package/package.json
CHANGED