@twin.org/api-models 0.0.3-next.42 → 0.0.3-next.44

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 (28) hide show
  1. package/dist/es/helpers/httpUrlHelper.js +36 -0
  2. package/dist/es/helpers/httpUrlHelper.js.map +1 -1
  3. package/dist/es/index.js +1 -2
  4. package/dist/es/index.js.map +1 -1
  5. package/dist/es/models/services/IPlatformComponent.js +2 -0
  6. package/dist/es/models/services/IPlatformComponent.js.map +1 -0
  7. package/dist/es/models/services/ITenant.js.map +1 -1
  8. package/dist/es/models/services/ITenantAdminComponent.js.map +1 -1
  9. package/dist/types/helpers/httpUrlHelper.d.ts +15 -0
  10. package/dist/types/index.d.ts +1 -2
  11. package/dist/types/models/services/IPlatformComponent.d.ts +17 -0
  12. package/dist/types/models/services/ITenant.d.ts +8 -0
  13. package/dist/types/models/services/ITenantAdminComponent.d.ts +3 -1
  14. package/docs/changelog.md +14 -0
  15. package/docs/reference/classes/HttpUrlHelper.md +62 -0
  16. package/docs/reference/index.md +1 -2
  17. package/docs/reference/interfaces/IPlatformComponent.md +43 -0
  18. package/docs/reference/interfaces/ITenant.md +16 -0
  19. package/docs/reference/interfaces/ITenantAdminComponent.md +9 -3
  20. package/package.json +2 -1
  21. package/dist/es/models/services/ITenantComponent.js +0 -2
  22. package/dist/es/models/services/ITenantComponent.js.map +0 -1
  23. package/dist/es/models/services/IUrlTransformerComponent.js +0 -2
  24. package/dist/es/models/services/IUrlTransformerComponent.js.map +0 -1
  25. package/dist/types/models/services/ITenantComponent.d.ts +0 -12
  26. package/dist/types/models/services/IUrlTransformerComponent.d.ts +0 -79
  27. package/docs/reference/interfaces/ITenantComponent.md +0 -29
  28. package/docs/reference/interfaces/IUrlTransformerComponent.md +0 -279
@@ -101,5 +101,41 @@ export class HttpUrlHelper {
101
101
  catch { }
102
102
  return url;
103
103
  }
104
+ /**
105
+ * Add a query string parameter to the url.
106
+ * @param url The url to add the query string parameter to.
107
+ * @param key The key of the query string parameter.
108
+ * @param value The value of the query string parameter.
109
+ * @returns The url with the added query string parameter.
110
+ */
111
+ static addQueryStringParam(url, key, value) {
112
+ if (!Is.stringValue(url) || !Is.stringValue(key) || !Is.stringValue(value)) {
113
+ return url;
114
+ }
115
+ try {
116
+ const parsedUrl = new URL(url);
117
+ parsedUrl.searchParams.append(key, value);
118
+ return parsedUrl.toString();
119
+ }
120
+ catch { }
121
+ return url;
122
+ }
123
+ /**
124
+ * Get a query string parameter from the url.
125
+ * @param url The url to get the query string parameter from.
126
+ * @param key The key of the query string parameter.
127
+ * @returns The value of the query string parameter.
128
+ */
129
+ static getQueryStringParam(url, key) {
130
+ if (!Is.stringValue(url) || !Is.stringValue(key)) {
131
+ return undefined;
132
+ }
133
+ try {
134
+ const parsedUrl = new URL(url);
135
+ return parsedUrl.searchParams.get(key) ?? undefined;
136
+ }
137
+ catch { }
138
+ return undefined;
139
+ }
104
140
  }
105
141
  //# sourceMappingURL=httpUrlHelper.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"httpUrlHelper.js","sourceRoot":"","sources":["../../../src/helpers/httpUrlHelper.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,EAAE,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAElD;;GAEG;AACH,MAAM,OAAO,aAAa;IACzB;;;;;OAKG;IACI,MAAM,CAAC,aAAa,CAAC,GAAW;QACtC,IAAI,CAAC;YACJ,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;YAClC,OAAO,YAAY,CAAC,MAAM,CAAC;QAC5B,CAAC;QAAC,MAAM,CAAC,CAAA,CAAC;IACX,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,WAAW,CAAC,GAAW;QACpC,IAAI,CAAC;YACJ,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;YAClC,OAAO,YAAY,CAAC,Q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AAC,SAAS,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;YACzF,OAAO,GAAG,CAAC;QACZ,CAAC;QAED,IAAI,CAAC;YACJ,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,qBAAqB,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;YAClF,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,SAAS,CAAC,CAAC;YACxC,SAAS,CAAC,QAAQ,GAAG,YAAY,CAAC,QAAQ,CAAC;YAC3C,SAAS,CAAC,IAAI,GAAG,YAAY,CAAC,IAAI,CAAC;YACnC,SAAS,CAAC,IAAI,GAAG,YAAY,CAAC,IAAI,CAAC;YACnC,OAAO,SAAS,CAAC,QAAQ,EAAE,CAAC;QAC7B,CAAC;QAAC,MAAM,CAAC,CAAA,CAAC;QAEV,OAAO,GAAG,CAAC;IACZ,CAAC;CACD","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { Is, StringHelper } from \"@twin.org/core\";\n\n/**\n * Class to help with handling http URLs.\n */\nexport class HttpUrlHelper {\n\t/**\n\t * Extract the origin from the url which includes protocol,host,port.\n\t * @see https://developer.mozilla.org/en-US/docs/Web/API/URL/origin\n\t * @param url The url to extract the origin from.\n\t * @returns The extracted origin.\n\t */\n\tpublic static extractOrigin(url: string): string | undefined {\n\t\ttry {\n\t\t\tconst convertedUrl = new URL(url);\n\t\t\treturn convertedUrl.origin;\n\t\t} catch {}\n\t}\n\n\t/**\n\t * Extract the path from the url.\n\t * @see https://developer.mozilla.org/en-US/docs/Web/API/URL/pathname\n\t * @param url The url to extract the path from.\n\t * @returns The extracted path.\n\t */\n\tpublic static extractPath(url: string): string | undefined {\n\t\ttry {\n\t\t\tconst convertedUrl = new URL(url);\n\t\t\treturn convertedUrl.pathname;\n\t\t} catch {}\n\t}\n\n\t/**\n\t * Extract the search from the url.\n\t * @see https://developer.mozilla.org/en-US/docs/Web/API/URL/search\n\t * @param url The url to extract the search from.\n\t * @returns The extracted search.\n\t */\n\tpublic static extractSearch(url: string): string | undefined {\n\t\ttry {\n\t\t\tconst convertedUrl = new URL(url);\n\t\t\treturn convertedUrl.search;\n\t\t} catch {}\n\t}\n\n\t/**\n\t * Extract the path and search from the url.\n\t * @param url The url to extract the path and search from.\n\t * @returns The extracted path and search.\n\t */\n\tpublic static extractPathAndSearch(url: string): string | undefined {\n\t\ttry {\n\t\t\tconst convertedUrl = new URL(url);\n\t\t\treturn `${convertedUrl.pathname}${convertedUrl.search}`;\n\t\t} catch {}\n\t}\n\n\t/**\n\t * Combine the urls parts.\n\t * @param origin The origin to combine.\n\t * @param pathAndSearch The path and search to combine.\n\t * @returns The combined parts.\n\t */\n\tpublic static combineParts(origin: string, pathAndSearch: string): string | undefined {\n\t\tif (Is.string(origin) && Is.string(pathAndSearch)) {\n\t\t\treturn `${StringHelper.trimTrailingSlashes(origin)}/${StringHelper.trimLeadingSlashes(pathAndSearch)}`;\n\t\t}\n\t}\n\n\t/**\n\t * Encode a single URL path segment per RFC 3986 §3.3.\n\t * Unlike encodeURIComponent, sub-delimiters ($ & + , ; =) and the colon and\n\t * at-sign characters that are valid unencoded in path segments are preserved.\n\t * @see https://datatracker.ietf.org/doc/html/rfc3986#section-3.3\n\t * @param segment The raw path segment value to encode.\n\t * @returns The percent-encoded path segment.\n\t */\n\tpublic static encodeUriPathSegment(segment: string): string {\n\t\t// RFC 3986 §3.3: only encode characters outside the allowed path segment set.\n\t\t// Allowed: unreserved (A-Za-z0-9 - . _ ~), sub-delimiters (! $ & ' ( ) * + , ; =), and : @\n\t\treturn segment.replace(/[^\\w!$&'()*+,.:;=@~-]/g, ch => encodeURIComponent(ch));\n\t}\n\n\t/**\n\t * Replace the origin in the url.\n\t * @param url The url to replace the origin in.\n\t * @param newOrigin The new origin to use.\n\t * @returns The url with the replaced origin.\n\t */\n\tpublic static replaceOrigin(url: string, newOrigin?: string): string {\n\t\tif (!Is.stringValue(url) || !Is.stringValue(newOrigin) || !newOrigin.startsWith(\"http\")) {\n\t\t\treturn url;\n\t\t}\n\n\t\ttry {\n\t\t\tconst parsedUrl = new URL(url.startsWith(\"/\") ? `http://placeholder${url}` : url);\n\t\t\tconst newParsedUrl = new URL(newOrigin);\n\t\t\tparsedUrl.protocol = newParsedUrl.protocol;\n\t\t\tparsedUrl.host = newParsedUrl.host;\n\t\t\tparsedUrl.port = newParsedUrl.port;\n\t\t\treturn parsedUrl.toString();\n\t\t} catch {}\n\n\t\treturn url;\n\t}\n}\n"]}
1
+ {"version":3,"file":"httpUrlHelper.js","sourceRoot":"","sources":["../../../src/helpers/httpUrlHelper.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,EAAE,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAElD;;GAEG;AACH,MAAM,OAAO,aAAa;IACzB;;;;;OAKG;IACI,MAAM,CAAC,aAAa,CAAC,GAAW;QACtC,IAAI,CAAC;YACJ,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;YAClC,OAAO,YAAY,CAAC,MAAM,CAAC;QAC5B,CAAC;QAAC,MAAM,CAAC,CAAA,CAAC;IACX,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,WAAW,CAAC,GAAW;QACpC,IAAI,CAAC;YACJ,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;YAClC,OAAO,YAAY,CAAC,QAAQ,CAAC;QAC9B,CAAC;QAAC,MAAM,CAAC,CAAA,CAAC;IACX,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,aAAa,CAAC,GAAW;QACtC,IAAI,CAAC;YACJ,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;YAClC,OAAO,YAAY,CAAC,MAAM,CAAC;QAC5B,CAAC;QAAC,MAAM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C,GAAG,CAAC,GAAG,CAAC,IAAI,SAAS,CAAC;QACrD,CAAC;QAAC,MAAM,CAAC,CAAA,CAAC;QAEV,OAAO,SAAS,CAAC;IAClB,CAAC;CACD","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { Is, StringHelper } from \"@twin.org/core\";\n\n/**\n * Class to help with handling http URLs.\n */\nexport class HttpUrlHelper {\n\t/**\n\t * Extract the origin from the url which includes protocol,host,port.\n\t * @see https://developer.mozilla.org/en-US/docs/Web/API/URL/origin\n\t * @param url The url to extract the origin from.\n\t * @returns The extracted origin.\n\t */\n\tpublic static extractOrigin(url: string): string | undefined {\n\t\ttry {\n\t\t\tconst convertedUrl = new URL(url);\n\t\t\treturn convertedUrl.origin;\n\t\t} catch {}\n\t}\n\n\t/**\n\t * Extract the path from the url.\n\t * @see https://developer.mozilla.org/en-US/docs/Web/API/URL/pathname\n\t * @param url The url to extract the path from.\n\t * @returns The extracted path.\n\t */\n\tpublic static extractPath(url: string): string | undefined {\n\t\ttry {\n\t\t\tconst convertedUrl = new URL(url);\n\t\t\treturn convertedUrl.pathname;\n\t\t} catch {}\n\t}\n\n\t/**\n\t * Extract the search from the url.\n\t * @see https://developer.mozilla.org/en-US/docs/Web/API/URL/search\n\t * @param url The url to extract the search from.\n\t * @returns The extracted search.\n\t */\n\tpublic static extractSearch(url: string): string | undefined {\n\t\ttry {\n\t\t\tconst convertedUrl = new URL(url);\n\t\t\treturn convertedUrl.search;\n\t\t} catch {}\n\t}\n\n\t/**\n\t * Extract the path and search from the url.\n\t * @param url The url to extract the path and search from.\n\t * @returns The extracted path and search.\n\t */\n\tpublic static extractPathAndSearch(url: string): string | undefined {\n\t\ttry {\n\t\t\tconst convertedUrl = new URL(url);\n\t\t\treturn `${convertedUrl.pathname}${convertedUrl.search}`;\n\t\t} catch {}\n\t}\n\n\t/**\n\t * Combine the urls parts.\n\t * @param origin The origin to combine.\n\t * @param pathAndSearch The path and search to combine.\n\t * @returns The combined parts.\n\t */\n\tpublic static combineParts(origin: string, pathAndSearch: string): string | undefined {\n\t\tif (Is.string(origin) && Is.string(pathAndSearch)) {\n\t\t\treturn `${StringHelper.trimTrailingSlashes(origin)}/${StringHelper.trimLeadingSlashes(pathAndSearch)}`;\n\t\t}\n\t}\n\n\t/**\n\t * Encode a single URL path segment per RFC 3986 §3.3.\n\t * Unlike encodeURIComponent, sub-delimiters ($ & + , ; =) and the colon and\n\t * at-sign characters that are valid unencoded in path segments are preserved.\n\t * @see https://datatracker.ietf.org/doc/html/rfc3986#section-3.3\n\t * @param segment The raw path segment value to encode.\n\t * @returns The percent-encoded path segment.\n\t */\n\tpublic static encodeUriPathSegment(segment: string): string {\n\t\t// RFC 3986 §3.3: only encode characters outside the allowed path segment set.\n\t\t// Allowed: unreserved (A-Za-z0-9 - . _ ~), sub-delimiters (! $ & ' ( ) * + , ; =), and : @\n\t\treturn segment.replace(/[^\\w!$&'()*+,.:;=@~-]/g, ch => encodeURIComponent(ch));\n\t}\n\n\t/**\n\t * Replace the origin in the url.\n\t * @param url The url to replace the origin in.\n\t * @param newOrigin The new origin to use.\n\t * @returns The url with the replaced origin.\n\t */\n\tpublic static replaceOrigin(url: string, newOrigin?: string): string {\n\t\tif (!Is.stringValue(url) || !Is.stringValue(newOrigin) || !newOrigin.startsWith(\"http\")) {\n\t\t\treturn url;\n\t\t}\n\n\t\ttry {\n\t\t\tconst parsedUrl = new URL(url.startsWith(\"/\") ? `http://placeholder${url}` : url);\n\t\t\tconst newParsedUrl = new URL(newOrigin);\n\t\t\tparsedUrl.protocol = newParsedUrl.protocol;\n\t\t\tparsedUrl.host = newParsedUrl.host;\n\t\t\tparsedUrl.port = newParsedUrl.port;\n\t\t\treturn parsedUrl.toString();\n\t\t} catch {}\n\n\t\treturn url;\n\t}\n\n\t/**\n\t * Add a query string parameter to the url.\n\t * @param url The url to add the query string parameter to.\n\t * @param key The key of the query string parameter.\n\t * @param value The value of the query string parameter.\n\t * @returns The url with the added query string parameter.\n\t */\n\tpublic static addQueryStringParam(url: string, key: string, value: string): string {\n\t\tif (!Is.stringValue(url) || !Is.stringValue(key) || !Is.stringValue(value)) {\n\t\t\treturn url;\n\t\t}\n\n\t\ttry {\n\t\t\tconst parsedUrl = new URL(url);\n\t\t\tparsedUrl.searchParams.append(key, value);\n\t\t\treturn parsedUrl.toString();\n\t\t} catch {}\n\n\t\treturn url;\n\t}\n\n\t/**\n\t * Get a query string parameter from the url.\n\t * @param url The url to get the query string parameter from.\n\t * @param key The key of the query string parameter.\n\t * @returns The value of the query string parameter.\n\t */\n\tpublic static getQueryStringParam(url: string, key: string): string | undefined {\n\t\tif (!Is.stringValue(url) || !Is.stringValue(key)) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\ttry {\n\t\t\tconst parsedUrl = new URL(url);\n\t\t\treturn parsedUrl.searchParams.get(key) ?? undefined;\n\t\t} catch {}\n\n\t\treturn undefined;\n\t}\n}\n"]}
package/dist/es/index.js CHANGED
@@ -61,9 +61,8 @@ export * from "./models/server/IWebServerOptions.js";
61
61
  export * from "./models/services/IHealthComponent.js";
62
62
  export * from "./models/services/IHostingComponent.js";
63
63
  export * from "./models/services/IInformationComponent.js";
64
- export * from "./models/services/IUrlTransformerComponent.js";
64
+ export * from "./models/services/IPlatformComponent.js";
65
65
  export * from "./models/services/IServerInfo.js";
66
66
  export * from "./models/services/ITenant.js";
67
67
  export * from "./models/services/ITenantAdminComponent.js";
68
- export * from "./models/services/ITenantComponent.js";
69
68
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,kCAAkC,CAAC;AACjD,cAAc,yCAAyC,CAAC;AACxD,cAAc,0CAA0C,CAAC;AACzD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,8BAA8B,CAAC;AAC7C,c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AACxC,cAAc,wCAAwC,CAAC;AACvD,cAAc,uCAAuC,CAAC;AACtD,cAAc,wCAAwC,CAAC;AACvD,cAAc,0CAA0C,CAAC;AACzD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,sCAAsC,CAAC;AACrD,cAAc,uCAAuC,CAAC;AACtD,cAAc,wCAAwC,CAAC;AACvD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,+CAA+C,CAAC;AAC9D,cAAc,kCAAkC,CAAC;AACjD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,4CAA4C,CAAC;AAC3D,cAAc,uCAAuC,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nexport * from \"./errors/forbiddenError.js\";\nexport * from \"./errors/tooManyRequestsError.js\";\nexport * from \"./factories/mimeTypeProcessorFactory.js\";\nexport * from \"./factories/restRouteProcessorFactory.js\";\nexport * from \"./factories/socketRouteProcessorFactory.js\";\nexport * from \"./helpers/httpErrorHelper.js\";\nexport * from \"./helpers/httpParameterHelper.js\";\nexport * from \"./helpers/httpUrlHelper.js\";\nexport * from \"./models/api/IServerFavIconResponse.js\";\nexport * from \"./models/api/IServerHealthResponse.js\";\nexport * from \"./models/api/IServerInfoResponse.js\";\nexport * from \"./models/api/IServerLivezResponse.js\";\nexport * from \"./models/api/IServerReadyzResponse.js\";\nexport * from \"./models/api/IServerRootResponse.js\";\nexport * from \"./models/api/IServerSpecResponse.js\";\nexport * from \"./models/config/IBaseRestClientConfig.js\";\nexport * from \"./models/config/IBaseSocketClientConfig.js\";\nexport * from \"./models/httpContextIdKeys.js\";\nexport * from \"./models/protocol/IHttpRequest.js\";\nexport * from \"./models/protocol/IHttpRequestContext.js\";\nexport * from \"./models/protocol/IHttpRequestPathParams.js\";\nexport * from \"./models/protocol/IHttpRequestQuery.js\";\nexport * from \"./models/protocol/IHttpResponse.js\";\nexport * from \"./models/protocol/IHttpServerRequest.js\";\nexport * from \"./models/protocol/ISocketRequestContext.js\";\nexport * from \"./models/protocol/ISocketServerRequest.js\";\nexport * from \"./models/requests/INoContentRequest.js\";\nexport * from \"./models/responses/errors/IBadRequestResponse.js\";\nexport * from \"./models/responses/errors/IConflictResponse.js\";\nexport * from \"./models/responses/errors/IForbiddenResponse.js\";\nexport * from \"./models/responses/errors/IInternalServerErrorResponse.js\";\nexport * from \"./models/responses/errors/INotFoundResponse.js\";\nexport * from \"./models/responses/errors/INotImplementedResponse.js\";\nexport * from \"./models/responses/errors/ITooManyRequestsResponse.js\";\nexport * from \"./models/responses/errors/IUnauthorizedResponse.js\";\nexport * from \"./models/responses/errors/IUnprocessableEntityResponse.js\";\nexport * from \"./models/responses/success/IAcceptedResponse.js\";\nexport * from \"./models/responses/success/ICreatedResponse.js\";\nexport * from \"./models/responses/success/INoContentResponse.js\";\nexport * from \"./models/responses/success/IOkResponse.js\";\nexport * from \"./models/routes/IBaseRoute.js\";\nexport * from \"./models/routes/IBaseRouteEntryPoint.js\";\nexport * from \"./models/routes/IRestRoute.js\";\nexport * from \"./models/routes/IRestRouteEntryPoint.js\";\nexport * from \"./models/routes/IRestRouteExample.js\";\nexport * from \"./models/routes/IRestRouteRequestExample.js\";\nexport * from \"./models/routes/IRestRouteResponseAttachmentOptions.js\";\nexport * from \"./models/routes/IRestRouteResponseExample.js\";\nexport * from \"./models/routes/IRestRouteResponseOptions.js\";\nexport * from \"./models/routes/ISocketRoute.js\";\nexport * from \"./models/routes/ISocketRouteEntryPoint.js\";\nexport * from \"./models/routes/ITag.js\";\nexport * from \"./models/server/IBaseRouteProcessor.js\";\nexport * from \"./models/server/IMimeTypeProcessor.js\";\nexport * from \"./models/server/IRestRouteProcessor.js\";\nexport * from \"./models/server/ISocketRouteProcessor.js\";\nexport * from \"./models/server/IWebServer.js\";\nexport * from \"./models/server/IWebServerOptions.js\";\nexport * from \"./models/services/IHealthComponent.js\";\nexport * from \"./models/services/IHostingComponent.js\";\nexport * from \"./models/services/IInformationComponent.js\";\nexport * from \"./models/services/IUrlTransformerComponent.js\";\nexport * from \"./models/services/IServerInfo.js\";\nexport * from \"./models/services/ITenant.js\";\nexport * from \"./models/services/ITenantAdminComponent.js\";\nexport * from \"./models/services/ITenantComponent.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,kCAAkC,CAAC;AACjD,cAAc,yCAAyC,CAAC;AACxD,cAAc,0CAA0C,CAAC;AACzD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kCAAkC,CAAC;AACjD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wCAAwC,CAAC;AACvD,cAAc,uCAAuC,CAAC;AACtD,cAAc,qCAAqC,CAAC;AACpD,cAAc,sCAAsC,CAAC;AACrD,cAAc,uCAAuC,CAAC;AACtD,cAAc,qCAAqC,CAAC;AACpD,cAAc,qCAAqC,CAAC;AACpD,cAAc,0CAA0C,CAAC;AACzD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,+BAA+B,CAAC;AAC9C,cAAc,mCAAmC,CAAC;AAClD,cAAc,0CAA0C,CAAC;AACzD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,wCAAwC,CAAC;AACvD,cAAc,oCAAoC,CAAC;AACnD,cAAc,yCAAyC,CAAC;AACxD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,2CAA2C,CAAC;AAC1D,cAAc,wCAAwC,CAAC;AACvD,cAAc,kDAAkD,CAAC;AACjE,cAAc,gDAAgD,CAAC;AAC/D,cAAc,iDAAiD,CAAC;AAChE,cAAc,2DAA2D,CAAC;AAC1E,cAAc,gDAAgD,CAAC;AAC/D,cAAc,sDAAsD,CAAC;AACrE,cAAc,uDAAuD,CAAC;AACtE,cAAc,oDAAoD,CAAC;AACnE,cAAc,2DAA2D,CAAC;AAC1E,cAAc,iDAAiD,CAAC;AAChE,cAAc,gDAAgD,CAAC;AAC/D,cAAc,kDAAkD,CAAC;AACjE,cAAc,2CAA2C,CAAC;AAC1D,cAAc,+BAA+B,CAAC;AAC9C,cAAc,yCAAyC,CAAC;AACxD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,yCAAyC,CAAC;AACxD,cAAc,sCAAsC,CAAC;AACrD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,wDAAwD,CAAC;AACvE,cAAc,8CAA8C,CAAC;AAC7D,cAAc,8CAA8C,CAAC;AAC7D,cAAc,iCAAiC,CAAC;AAChD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,yBAAyB,CAAC;AACxC,cAAc,wCAAwC,CAAC;AACvD,cAAc,uCAAuC,CAAC;AACtD,cAAc,wCAAwC,CAAC;AACvD,cAAc,0CAA0C,CAAC;AACzD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,sCAAsC,CAAC;AACrD,cAAc,uCAAuC,CAAC;AACtD,cAAc,wCAAwC,CAAC;AACvD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,yCAAyC,CAAC;AACxD,cAAc,kCAAkC,CAAC;AACjD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,4CAA4C,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nexport * from \"./errors/forbiddenError.js\";\nexport * from \"./errors/tooManyRequestsError.js\";\nexport * from \"./factories/mimeTypeProcessorFactory.js\";\nexport * from \"./factories/restRouteProcessorFactory.js\";\nexport * from \"./factories/socketRouteProcessorFactory.js\";\nexport * from \"./helpers/httpErrorHelper.js\";\nexport * from \"./helpers/httpParameterHelper.js\";\nexport * from \"./helpers/httpUrlHelper.js\";\nexport * from \"./models/api/IServerFavIconResponse.js\";\nexport * from \"./models/api/IServerHealthResponse.js\";\nexport * from \"./models/api/IServerInfoResponse.js\";\nexport * from \"./models/api/IServerLivezResponse.js\";\nexport * from \"./models/api/IServerReadyzResponse.js\";\nexport * from \"./models/api/IServerRootResponse.js\";\nexport * from \"./models/api/IServerSpecResponse.js\";\nexport * from \"./models/config/IBaseRestClientConfig.js\";\nexport * from \"./models/config/IBaseSocketClientConfig.js\";\nexport * from \"./models/httpContextIdKeys.js\";\nexport * from \"./models/protocol/IHttpRequest.js\";\nexport * from \"./models/protocol/IHttpRequestContext.js\";\nexport * from \"./models/protocol/IHttpRequestPathParams.js\";\nexport * from \"./models/protocol/IHttpRequestQuery.js\";\nexport * from \"./models/protocol/IHttpResponse.js\";\nexport * from \"./models/protocol/IHttpServerRequest.js\";\nexport * from \"./models/protocol/ISocketRequestContext.js\";\nexport * from \"./models/protocol/ISocketServerRequest.js\";\nexport * from \"./models/requests/INoContentRequest.js\";\nexport * from \"./models/responses/errors/IBadRequestResponse.js\";\nexport * from \"./models/responses/errors/IConflictResponse.js\";\nexport * from \"./models/responses/errors/IForbiddenResponse.js\";\nexport * from \"./models/responses/errors/IInternalServerErrorResponse.js\";\nexport * from \"./models/responses/errors/INotFoundResponse.js\";\nexport * from \"./models/responses/errors/INotImplementedResponse.js\";\nexport * from \"./models/responses/errors/ITooManyRequestsResponse.js\";\nexport * from \"./models/responses/errors/IUnauthorizedResponse.js\";\nexport * from \"./models/responses/errors/IUnprocessableEntityResponse.js\";\nexport * from \"./models/responses/success/IAcceptedResponse.js\";\nexport * from \"./models/responses/success/ICreatedResponse.js\";\nexport * from \"./models/responses/success/INoContentResponse.js\";\nexport * from \"./models/responses/success/IOkResponse.js\";\nexport * from \"./models/routes/IBaseRoute.js\";\nexport * from \"./models/routes/IBaseRouteEntryPoint.js\";\nexport * from \"./models/routes/IRestRoute.js\";\nexport * from \"./models/routes/IRestRouteEntryPoint.js\";\nexport * from \"./models/routes/IRestRouteExample.js\";\nexport * from \"./models/routes/IRestRouteRequestExample.js\";\nexport * from \"./models/routes/IRestRouteResponseAttachmentOptions.js\";\nexport * from \"./models/routes/IRestRouteResponseExample.js\";\nexport * from \"./models/routes/IRestRouteResponseOptions.js\";\nexport * from \"./models/routes/ISocketRoute.js\";\nexport * from \"./models/routes/ISocketRouteEntryPoint.js\";\nexport * from \"./models/routes/ITag.js\";\nexport * from \"./models/server/IBaseRouteProcessor.js\";\nexport * from \"./models/server/IMimeTypeProcessor.js\";\nexport * from \"./models/server/IRestRouteProcessor.js\";\nexport * from \"./models/server/ISocketRouteProcessor.js\";\nexport * from \"./models/server/IWebServer.js\";\nexport * from \"./models/server/IWebServerOptions.js\";\nexport * from \"./models/services/IHealthComponent.js\";\nexport * from \"./models/services/IHostingComponent.js\";\nexport * from \"./models/services/IInformationComponent.js\";\nexport * from \"./models/services/IPlatformComponent.js\";\nexport * from \"./models/services/IServerInfo.js\";\nexport * from \"./models/services/ITenant.js\";\nexport * from \"./models/services/ITenantAdminComponent.js\";\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=IPlatformComponent.js.map
@@ -0,0 +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 Nothing.\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"]}
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 { 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 Nothing.\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 Nothing.\n\t * @throws Error if the tenant is not found.\n\t */\n\tremove(tenantId: string): Promise<void>;\n\n\t/**\n\t * Query tenants with pagination.\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\tproperties: (keyof ITenant)[] | undefined,\n\t\tcursor?: string,\n\t\tlimit?: number\n\t): Promise<{ tenants: ITenant[]; cursor?: string }>;\n}\n"]}
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 Nothing.\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 Nothing.\n\t * @throws Error if the tenant is not found.\n\t */\n\tremove(tenantId: string): Promise<void>;\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"]}
@@ -52,4 +52,19 @@ export declare class HttpUrlHelper {
52
52
  * @returns The url with the replaced origin.
53
53
  */
54
54
  static replaceOrigin(url: string, newOrigin?: string): string;
55
+ /**
56
+ * Add a query string parameter to the url.
57
+ * @param url The url to add the query string parameter to.
58
+ * @param key The key of the query string parameter.
59
+ * @param value The value of the query string parameter.
60
+ * @returns The url with the added query string parameter.
61
+ */
62
+ static addQueryStringParam(url: string, key: string, value: string): string;
63
+ /**
64
+ * Get a query string parameter from the url.
65
+ * @param url The url to get the query string parameter from.
66
+ * @param key The key of the query string parameter.
67
+ * @returns The value of the query string parameter.
68
+ */
69
+ static getQueryStringParam(url: string, key: string): string | undefined;
55
70
  }
@@ -59,8 +59,7 @@ export * from "./models/server/IWebServerOptions.js";
59
59
  export * from "./models/services/IHealthComponent.js";
60
60
  export * from "./models/services/IHostingComponent.js";
61
61
  export * from "./models/services/IInformationComponent.js";
62
- export * from "./models/services/IUrlTransformerComponent.js";
62
+ export * from "./models/services/IPlatformComponent.js";
63
63
  export * from "./models/services/IServerInfo.js";
64
64
  export * from "./models/services/ITenant.js";
65
65
  export * from "./models/services/ITenantAdminComponent.js";
66
- export * from "./models/services/ITenantComponent.js";
@@ -0,0 +1,17 @@
1
+ import type { IComponent } from "@twin.org/core";
2
+ /**
3
+ * Interface for the platform component.
4
+ */
5
+ export interface IPlatformComponent extends IComponent {
6
+ /**
7
+ * Indicates whether the component is running in a multi-tenant environment.
8
+ * @returns True if the component is running in a multi-tenant environment, false otherwise.
9
+ */
10
+ isMultiTenant(): boolean;
11
+ /**
12
+ * Execute a method, if single tenant will run once, if multi-tenant will run for each tenant.
13
+ * @param method The method to run for each tenant.
14
+ * @returns Nothing.
15
+ */
16
+ execute(method: () => Promise<void>): Promise<void>;
17
+ }
@@ -26,4 +26,12 @@ export interface ITenant {
26
26
  * The public origin available to the public for accessing the API.
27
27
  */
28
28
  publicOrigin?: string;
29
+ /**
30
+ * The organization id for the tenant.
31
+ */
32
+ organizationId?: string;
33
+ /**
34
+ * Optional list of organization aliases that can are used for legacy lookups.
35
+ */
36
+ organizationIdLegacy?: string[];
29
37
  }
@@ -1,4 +1,5 @@
1
1
  import type { IComponent } from "@twin.org/core";
2
+ import type { EntityCondition } from "@twin.org/entity";
2
3
  import type { ITenant } from "./ITenant.js";
3
4
  /**
4
5
  * Configuration for the tenant admin component
@@ -48,12 +49,13 @@ export interface ITenantAdminComponent extends IComponent {
48
49
  remove(tenantId: string): Promise<void>;
49
50
  /**
50
51
  * Query tenants with pagination.
52
+ * @param conditions The conditions to filter the tenants.
51
53
  * @param properties The properties to include in the returned tenants.
52
54
  * @param cursor The cursor to start from.
53
55
  * @param limit The maximum number of tenants to return.
54
56
  * @returns The tenants and the next cursor if more tenants are available.
55
57
  */
56
- query(properties: (keyof ITenant)[] | undefined, cursor?: string, limit?: number): Promise<{
58
+ query(conditions?: EntityCondition<ITenant>, properties?: (keyof ITenant)[], cursor?: string, limit?: number): Promise<{
57
59
  tenants: ITenant[];
58
60
  cursor?: string;
59
61
  }>;
package/docs/changelog.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## [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
+
5
+
6
+ ### Features
7
+
8
+ * organization identifiers ([#158](https://github.com/iotaledger/twin-api/issues/158)) ([ce13244](https://github.com/iotaledger/twin-api/commit/ce13244aaacbf82d9e5f87d905e283b36ad63bbf))
9
+
10
+ ## [0.0.3-next.43](https://github.com/iotaledger/twin-api/compare/api-models-v0.0.3-next.42...api-models-v0.0.3-next.43) (2026-06-10)
11
+
12
+
13
+ ### Miscellaneous Chores
14
+
15
+ * **api-models:** Synchronize repo versions
16
+
3
17
  ## [0.0.3-next.42](https://github.com/iotaledger/twin-api/compare/api-models-v0.0.3-next.41...api-models-v0.0.3-next.42) (2026-06-08)
4
18
 
5
19
 
@@ -195,3 +195,65 @@ The new origin to use.
195
195
  `string`
196
196
 
197
197
  The url with the replaced origin.
198
+
199
+ ***
200
+
201
+ ### addQueryStringParam() {#addquerystringparam}
202
+
203
+ > `static` **addQueryStringParam**(`url`, `key`, `value`): `string`
204
+
205
+ Add a query string parameter to the url.
206
+
207
+ #### Parameters
208
+
209
+ ##### url
210
+
211
+ `string`
212
+
213
+ The url to add the query string parameter to.
214
+
215
+ ##### key
216
+
217
+ `string`
218
+
219
+ The key of the query string parameter.
220
+
221
+ ##### value
222
+
223
+ `string`
224
+
225
+ The value of the query string parameter.
226
+
227
+ #### Returns
228
+
229
+ `string`
230
+
231
+ The url with the added query string parameter.
232
+
233
+ ***
234
+
235
+ ### getQueryStringParam() {#getquerystringparam}
236
+
237
+ > `static` **getQueryStringParam**(`url`, `key`): `string` \| `undefined`
238
+
239
+ Get a query string parameter from the url.
240
+
241
+ #### Parameters
242
+
243
+ ##### url
244
+
245
+ `string`
246
+
247
+ The url to get the query string parameter from.
248
+
249
+ ##### key
250
+
251
+ `string`
252
+
253
+ The key of the query string parameter.
254
+
255
+ #### Returns
256
+
257
+ `string` \| `undefined`
258
+
259
+ The value of the query string parameter.
@@ -60,11 +60,10 @@
60
60
  - [IHealthComponent](interfaces/IHealthComponent.md)
61
61
  - [IHostingComponent](interfaces/IHostingComponent.md)
62
62
  - [IInformationComponent](interfaces/IInformationComponent.md)
63
+ - [IPlatformComponent](interfaces/IPlatformComponent.md)
63
64
  - [IServerInfo](interfaces/IServerInfo.md)
64
65
  - [ITenant](interfaces/ITenant.md)
65
66
  - [ITenantAdminComponent](interfaces/ITenantAdminComponent.md)
66
- - [ITenantComponent](interfaces/ITenantComponent.md)
67
- - [IUrlTransformerComponent](interfaces/IUrlTransformerComponent.md)
68
67
 
69
68
  ## Type Aliases
70
69
 
@@ -0,0 +1,43 @@
1
+ # Interface: IPlatformComponent
2
+
3
+ Interface for the platform component.
4
+
5
+ ## Extends
6
+
7
+ - `IComponent`
8
+
9
+ ## Methods
10
+
11
+ ### isMultiTenant() {#ismultitenant}
12
+
13
+ > **isMultiTenant**(): `boolean`
14
+
15
+ Indicates whether the component is running in a multi-tenant environment.
16
+
17
+ #### Returns
18
+
19
+ `boolean`
20
+
21
+ True if the component is running in a multi-tenant environment, false otherwise.
22
+
23
+ ***
24
+
25
+ ### execute() {#execute}
26
+
27
+ > **execute**(`method`): `Promise`\<`void`\>
28
+
29
+ Execute a method, if single tenant will run once, if multi-tenant will run for each tenant.
30
+
31
+ #### Parameters
32
+
33
+ ##### method
34
+
35
+ () => `Promise`\<`void`\>
36
+
37
+ The method to run for each tenant.
38
+
39
+ #### Returns
40
+
41
+ `Promise`\<`void`\>
42
+
43
+ Nothing.
@@ -49,3 +49,19 @@ The date the tenant was modified.
49
49
  > `optional` **publicOrigin?**: `string`
50
50
 
51
51
  The public origin available to the public for accessing the API.
52
+
53
+ ***
54
+
55
+ ### organizationId? {#organizationid}
56
+
57
+ > `optional` **organizationId?**: `string`
58
+
59
+ The organization id for the tenant.
60
+
61
+ ***
62
+
63
+ ### organizationIdLegacy? {#organizationidlegacy}
64
+
65
+ > `optional` **organizationIdLegacy?**: `string`[]
66
+
67
+ Optional list of organization aliases that can are used for legacy lookups.
@@ -158,15 +158,21 @@ Error if the tenant is not found.
158
158
 
159
159
  ### query() {#query}
160
160
 
161
- > **query**(`properties`, `cursor?`, `limit?`): `Promise`\<\{ `tenants`: [`ITenant`](ITenant.md)[]; `cursor?`: `string`; \}\>
161
+ > **query**(`conditions?`, `properties?`, `cursor?`, `limit?`): `Promise`\<\{ `tenants`: [`ITenant`](ITenant.md)[]; `cursor?`: `string`; \}\>
162
162
 
163
163
  Query tenants with pagination.
164
164
 
165
165
  #### Parameters
166
166
 
167
- ##### properties
167
+ ##### conditions?
168
168
 
169
- keyof [`ITenant`](ITenant.md)[] \| `undefined`
169
+ `EntityCondition`\<[`ITenant`](ITenant.md)\>
170
+
171
+ The conditions to filter the tenants.
172
+
173
+ ##### properties?
174
+
175
+ keyof [`ITenant`](ITenant.md)[]
170
176
 
171
177
  The properties to include in the returned tenants.
172
178
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/api-models",
3
- "version": "0.0.3-next.42",
3
+ "version": "0.0.3-next.44",
4
4
  "description": "Shared API contracts, route types, and response models used across services and clients.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -16,6 +16,7 @@
16
16
  "dependencies": {
17
17
  "@twin.org/context": "next",
18
18
  "@twin.org/core": "next",
19
+ "@twin.org/entity": "next",
19
20
  "@twin.org/nameof": "next",
20
21
  "@twin.org/web": "next"
21
22
  },
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=ITenantComponent.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ITenantComponent.js","sourceRoot":"","sources":["../../../../src/models/services/ITenantComponent.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 tenant component.\n */\nexport interface ITenantComponent extends IComponent {\n\t/**\n\t * Run a per tenant operation.\n\t * @param method The method to run for each tenant.\n\t * @returns Nothing.\n\t */\n\trunPerTenant(method: () => Promise<void>): Promise<void>;\n}\n"]}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=IUrlTransformerComponent.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"IUrlTransformerComponent.js","sourceRoot":"","sources":["../../../../src/models/services/IUrlTransformerComponent.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IComponent } from \"@twin.org/core\";\nimport type { IHttpRequestQuery } from \"../protocol/IHttpRequestQuery.js\";\n\n/**\n * The URL transformer component for encrypting and decrypting URL parameters.\n */\nexport interface IUrlTransformerComponent extends IComponent {\n\t/**\n\t * Encrypt a named token value and append it as a query parameter to the given URL.\n\t * The URL param name is resolved from the configured token name dictionary using the id.\n\t * @param url The URL to append the encrypted token to.\n\t * @param id The logical token identifier (e.g. \"tenant\").\n\t * @param value The value to encrypt and add.\n\t * @returns The URL with the encrypted token added as a query parameter.\n\t */\n\taddEncryptedQueryParamToUrl(url: string, id: string, value: string): Promise<string>;\n\n\t/**\n\t * Get a named token value from the query parameters.\n\t * The URL param name is resolved from the configured token name dictionary using the id.\n\t * @param queryParams The HTTP request query containing the parameters.\n\t * @param id The logical token identifier (e.g. \"tenant\").\n\t * @returns The decrypted token value if it exists.\n\t */\n\tgetEncryptedQueryParam(\n\t\tqueryParams: IHttpRequestQuery | undefined,\n\t\tid: string\n\t): Promise<string | undefined>;\n\n\t/**\n\t * Add encrypted key/value pairs to a URL's query string.\n\t * Existing query parameters on the URL are preserved; the provided params are\n\t * merged in and then encrypted before being written back to the URL.\n\t * @param url The base URL to add parameters to.\n\t * @param params The key/value pairs to encrypt and append.\n\t * @returns The URL with the encrypted parameters added.\n\t */\n\taddEncryptedToUrl(url: string, params: IHttpRequestQuery): Promise<string>;\n\n\t/**\n\t * Get an encrypted value from a URL's query string.\n\t * @param url The URL to extract the encrypted value from.\n\t * @param id The logical identifier for the value to retrieve (e.g. \"tenant\").\n\t * @returns The decrypted value if it exists.\n\t */\n\tgetEncryptedFromUrl(url: string, id: string): Promise<string | undefined>;\n\n\t/**\n\t * Decrypt specified keys from a query parameter object and return their plain-text values.\n\t * @param queryParams The HTTP request query containing the encrypted parameters.\n\t * @param keys The keys to decrypt.\n\t * @returns A map of the decrypted key/value pairs that were present.\n\t */\n\tgetDecryptedFromQueryParams(\n\t\tqueryParams: IHttpRequestQuery | undefined,\n\t\tkeys: string[]\n\t): Promise<IHttpRequestQuery>;\n\n\t/**\n\t * Encrypt query parameters using the URL transformer's encryption mechanism.\n\t * @param httpRequestQuery The HTTP request query containing the parameters to encrypt.\n\t * @param keys The keys of the parameters to encrypt.\n\t * @returns A promise that resolves when the query parameters have been encrypted.\n\t */\n\tencryptQueryParams(\n\t\thttpRequestQuery: IHttpRequestQuery | undefined,\n\t\tkeys: string[]\n\t): Promise<void>;\n\n\t/**\n\t * Decrypt query parameters using the URL transformer's encryption mechanism.\n\t * @param httpRequestQuery The HTTP request query containing the encrypted values.\n\t * @param keys The keys of the parameters to decrypt.\n\t * @returns A promise that resolves when the query parameters have been decrypted.\n\t */\n\tdecryptQueryParams(\n\t\thttpRequestQuery: IHttpRequestQuery | undefined,\n\t\tkeys: string[]\n\t): Promise<void>;\n\n\t/**\n\t * Encrypt a parameter value.\n\t * @param paramValue The value of the parameter to encrypt.\n\t * @returns A promise that resolves to the encrypted value of the parameter.\n\t */\n\tencryptParam(paramValue: string): Promise<string>;\n\n\t/**\n\t * Decrypt a parameter value.\n\t * @param encryptedValue The encrypted value of the parameter.\n\t * @returns A promise that resolves to the decrypted value of the parameter.\n\t */\n\tdecryptParam(encryptedValue: string): Promise<string>;\n\n\t/**\n\t * Get the parameter name for a given key.\n\t * @param key The key of the parameter.\n\t * @returns The parameter name.\n\t */\n\tgetParamName(key: string): string | undefined;\n}\n"]}
@@ -1,12 +0,0 @@
1
- import type { IComponent } from "@twin.org/core";
2
- /**
3
- * Interface for the tenant component.
4
- */
5
- export interface ITenantComponent extends IComponent {
6
- /**
7
- * Run a per tenant operation.
8
- * @param method The method to run for each tenant.
9
- * @returns Nothing.
10
- */
11
- runPerTenant(method: () => Promise<void>): Promise<void>;
12
- }
@@ -1,79 +0,0 @@
1
- import type { IComponent } from "@twin.org/core";
2
- import type { IHttpRequestQuery } from "../protocol/IHttpRequestQuery.js";
3
- /**
4
- * The URL transformer component for encrypting and decrypting URL parameters.
5
- */
6
- export interface IUrlTransformerComponent extends IComponent {
7
- /**
8
- * Encrypt a named token value and append it as a query parameter to the given URL.
9
- * The URL param name is resolved from the configured token name dictionary using the id.
10
- * @param url The URL to append the encrypted token to.
11
- * @param id The logical token identifier (e.g. "tenant").
12
- * @param value The value to encrypt and add.
13
- * @returns The URL with the encrypted token added as a query parameter.
14
- */
15
- addEncryptedQueryParamToUrl(url: string, id: string, value: string): Promise<string>;
16
- /**
17
- * Get a named token value from the query parameters.
18
- * The URL param name is resolved from the configured token name dictionary using the id.
19
- * @param queryParams The HTTP request query containing the parameters.
20
- * @param id The logical token identifier (e.g. "tenant").
21
- * @returns The decrypted token value if it exists.
22
- */
23
- getEncryptedQueryParam(queryParams: IHttpRequestQuery | undefined, id: string): Promise<string | undefined>;
24
- /**
25
- * Add encrypted key/value pairs to a URL's query string.
26
- * Existing query parameters on the URL are preserved; the provided params are
27
- * merged in and then encrypted before being written back to the URL.
28
- * @param url The base URL to add parameters to.
29
- * @param params The key/value pairs to encrypt and append.
30
- * @returns The URL with the encrypted parameters added.
31
- */
32
- addEncryptedToUrl(url: string, params: IHttpRequestQuery): Promise<string>;
33
- /**
34
- * Get an encrypted value from a URL's query string.
35
- * @param url The URL to extract the encrypted value from.
36
- * @param id The logical identifier for the value to retrieve (e.g. "tenant").
37
- * @returns The decrypted value if it exists.
38
- */
39
- getEncryptedFromUrl(url: string, id: string): Promise<string | undefined>;
40
- /**
41
- * Decrypt specified keys from a query parameter object and return their plain-text values.
42
- * @param queryParams The HTTP request query containing the encrypted parameters.
43
- * @param keys The keys to decrypt.
44
- * @returns A map of the decrypted key/value pairs that were present.
45
- */
46
- getDecryptedFromQueryParams(queryParams: IHttpRequestQuery | undefined, keys: string[]): Promise<IHttpRequestQuery>;
47
- /**
48
- * Encrypt query parameters using the URL transformer's encryption mechanism.
49
- * @param httpRequestQuery The HTTP request query containing the parameters to encrypt.
50
- * @param keys The keys of the parameters to encrypt.
51
- * @returns A promise that resolves when the query parameters have been encrypted.
52
- */
53
- encryptQueryParams(httpRequestQuery: IHttpRequestQuery | undefined, keys: string[]): Promise<void>;
54
- /**
55
- * Decrypt query parameters using the URL transformer's encryption mechanism.
56
- * @param httpRequestQuery The HTTP request query containing the encrypted values.
57
- * @param keys The keys of the parameters to decrypt.
58
- * @returns A promise that resolves when the query parameters have been decrypted.
59
- */
60
- decryptQueryParams(httpRequestQuery: IHttpRequestQuery | undefined, keys: string[]): Promise<void>;
61
- /**
62
- * Encrypt a parameter value.
63
- * @param paramValue The value of the parameter to encrypt.
64
- * @returns A promise that resolves to the encrypted value of the parameter.
65
- */
66
- encryptParam(paramValue: string): Promise<string>;
67
- /**
68
- * Decrypt a parameter value.
69
- * @param encryptedValue The encrypted value of the parameter.
70
- * @returns A promise that resolves to the decrypted value of the parameter.
71
- */
72
- decryptParam(encryptedValue: string): Promise<string>;
73
- /**
74
- * Get the parameter name for a given key.
75
- * @param key The key of the parameter.
76
- * @returns The parameter name.
77
- */
78
- getParamName(key: string): string | undefined;
79
- }
@@ -1,29 +0,0 @@
1
- # Interface: ITenantComponent
2
-
3
- Interface for the tenant component.
4
-
5
- ## Extends
6
-
7
- - `IComponent`
8
-
9
- ## Methods
10
-
11
- ### runPerTenant() {#runpertenant}
12
-
13
- > **runPerTenant**(`method`): `Promise`\<`void`\>
14
-
15
- Run a per tenant operation.
16
-
17
- #### Parameters
18
-
19
- ##### method
20
-
21
- () => `Promise`\<`void`\>
22
-
23
- The method to run for each tenant.
24
-
25
- #### Returns
26
-
27
- `Promise`\<`void`\>
28
-
29
- Nothing.
@@ -1,279 +0,0 @@
1
- # Interface: IUrlTransformerComponent
2
-
3
- The URL transformer component for encrypting and decrypting URL parameters.
4
-
5
- ## Extends
6
-
7
- - `IComponent`
8
-
9
- ## Methods
10
-
11
- ### addEncryptedQueryParamToUrl() {#addencryptedqueryparamtourl}
12
-
13
- > **addEncryptedQueryParamToUrl**(`url`, `id`, `value`): `Promise`\<`string`\>
14
-
15
- Encrypt a named token value and append it as a query parameter to the given URL.
16
- The URL param name is resolved from the configured token name dictionary using the id.
17
-
18
- #### Parameters
19
-
20
- ##### url
21
-
22
- `string`
23
-
24
- The URL to append the encrypted token to.
25
-
26
- ##### id
27
-
28
- `string`
29
-
30
- The logical token identifier (e.g. "tenant").
31
-
32
- ##### value
33
-
34
- `string`
35
-
36
- The value to encrypt and add.
37
-
38
- #### Returns
39
-
40
- `Promise`\<`string`\>
41
-
42
- The URL with the encrypted token added as a query parameter.
43
-
44
- ***
45
-
46
- ### getEncryptedQueryParam() {#getencryptedqueryparam}
47
-
48
- > **getEncryptedQueryParam**(`queryParams`, `id`): `Promise`\<`string` \| `undefined`\>
49
-
50
- Get a named token value from the query parameters.
51
- The URL param name is resolved from the configured token name dictionary using the id.
52
-
53
- #### Parameters
54
-
55
- ##### queryParams
56
-
57
- [`IHttpRequestQuery`](IHttpRequestQuery.md) \| `undefined`
58
-
59
- The HTTP request query containing the parameters.
60
-
61
- ##### id
62
-
63
- `string`
64
-
65
- The logical token identifier (e.g. "tenant").
66
-
67
- #### Returns
68
-
69
- `Promise`\<`string` \| `undefined`\>
70
-
71
- The decrypted token value if it exists.
72
-
73
- ***
74
-
75
- ### addEncryptedToUrl() {#addencryptedtourl}
76
-
77
- > **addEncryptedToUrl**(`url`, `params`): `Promise`\<`string`\>
78
-
79
- Add encrypted key/value pairs to a URL's query string.
80
- Existing query parameters on the URL are preserved; the provided params are
81
- merged in and then encrypted before being written back to the URL.
82
-
83
- #### Parameters
84
-
85
- ##### url
86
-
87
- `string`
88
-
89
- The base URL to add parameters to.
90
-
91
- ##### params
92
-
93
- [`IHttpRequestQuery`](IHttpRequestQuery.md)
94
-
95
- The key/value pairs to encrypt and append.
96
-
97
- #### Returns
98
-
99
- `Promise`\<`string`\>
100
-
101
- The URL with the encrypted parameters added.
102
-
103
- ***
104
-
105
- ### getEncryptedFromUrl() {#getencryptedfromurl}
106
-
107
- > **getEncryptedFromUrl**(`url`, `id`): `Promise`\<`string` \| `undefined`\>
108
-
109
- Get an encrypted value from a URL's query string.
110
-
111
- #### Parameters
112
-
113
- ##### url
114
-
115
- `string`
116
-
117
- The URL to extract the encrypted value from.
118
-
119
- ##### id
120
-
121
- `string`
122
-
123
- The logical identifier for the value to retrieve (e.g. "tenant").
124
-
125
- #### Returns
126
-
127
- `Promise`\<`string` \| `undefined`\>
128
-
129
- The decrypted value if it exists.
130
-
131
- ***
132
-
133
- ### getDecryptedFromQueryParams() {#getdecryptedfromqueryparams}
134
-
135
- > **getDecryptedFromQueryParams**(`queryParams`, `keys`): `Promise`\<[`IHttpRequestQuery`](IHttpRequestQuery.md)\>
136
-
137
- Decrypt specified keys from a query parameter object and return their plain-text values.
138
-
139
- #### Parameters
140
-
141
- ##### queryParams
142
-
143
- [`IHttpRequestQuery`](IHttpRequestQuery.md) \| `undefined`
144
-
145
- The HTTP request query containing the encrypted parameters.
146
-
147
- ##### keys
148
-
149
- `string`[]
150
-
151
- The keys to decrypt.
152
-
153
- #### Returns
154
-
155
- `Promise`\<[`IHttpRequestQuery`](IHttpRequestQuery.md)\>
156
-
157
- A map of the decrypted key/value pairs that were present.
158
-
159
- ***
160
-
161
- ### encryptQueryParams() {#encryptqueryparams}
162
-
163
- > **encryptQueryParams**(`httpRequestQuery`, `keys`): `Promise`\<`void`\>
164
-
165
- Encrypt query parameters using the URL transformer's encryption mechanism.
166
-
167
- #### Parameters
168
-
169
- ##### httpRequestQuery
170
-
171
- [`IHttpRequestQuery`](IHttpRequestQuery.md) \| `undefined`
172
-
173
- The HTTP request query containing the parameters to encrypt.
174
-
175
- ##### keys
176
-
177
- `string`[]
178
-
179
- The keys of the parameters to encrypt.
180
-
181
- #### Returns
182
-
183
- `Promise`\<`void`\>
184
-
185
- A promise that resolves when the query parameters have been encrypted.
186
-
187
- ***
188
-
189
- ### decryptQueryParams() {#decryptqueryparams}
190
-
191
- > **decryptQueryParams**(`httpRequestQuery`, `keys`): `Promise`\<`void`\>
192
-
193
- Decrypt query parameters using the URL transformer's encryption mechanism.
194
-
195
- #### Parameters
196
-
197
- ##### httpRequestQuery
198
-
199
- [`IHttpRequestQuery`](IHttpRequestQuery.md) \| `undefined`
200
-
201
- The HTTP request query containing the encrypted values.
202
-
203
- ##### keys
204
-
205
- `string`[]
206
-
207
- The keys of the parameters to decrypt.
208
-
209
- #### Returns
210
-
211
- `Promise`\<`void`\>
212
-
213
- A promise that resolves when the query parameters have been decrypted.
214
-
215
- ***
216
-
217
- ### encryptParam() {#encryptparam}
218
-
219
- > **encryptParam**(`paramValue`): `Promise`\<`string`\>
220
-
221
- Encrypt a parameter value.
222
-
223
- #### Parameters
224
-
225
- ##### paramValue
226
-
227
- `string`
228
-
229
- The value of the parameter to encrypt.
230
-
231
- #### Returns
232
-
233
- `Promise`\<`string`\>
234
-
235
- A promise that resolves to the encrypted value of the parameter.
236
-
237
- ***
238
-
239
- ### decryptParam() {#decryptparam}
240
-
241
- > **decryptParam**(`encryptedValue`): `Promise`\<`string`\>
242
-
243
- Decrypt a parameter value.
244
-
245
- #### Parameters
246
-
247
- ##### encryptedValue
248
-
249
- `string`
250
-
251
- The encrypted value of the parameter.
252
-
253
- #### Returns
254
-
255
- `Promise`\<`string`\>
256
-
257
- A promise that resolves to the decrypted value of the parameter.
258
-
259
- ***
260
-
261
- ### getParamName() {#getparamname}
262
-
263
- > **getParamName**(`key`): `string` \| `undefined`
264
-
265
- Get the parameter name for a given key.
266
-
267
- #### Parameters
268
-
269
- ##### key
270
-
271
- `string`
272
-
273
- The key of the parameter.
274
-
275
- #### Returns
276
-
277
- `string` \| `undefined`
278
-
279
- The parameter name.