@twin.org/api-models 0.0.3-next.27 → 0.0.3-next.29

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.
@@ -67,6 +67,19 @@ export class HttpUrlHelper {
67
67
  return `${StringHelper.trimTrailingSlashes(origin)}/${StringHelper.trimLeadingSlashes(pathAndSearch)}`;
68
68
  }
69
69
  }
70
+ /**
71
+ * Encode a single URL path segment per RFC 3986 §3.3.
72
+ * Unlike encodeURIComponent, sub-delimiters ($ & + , ; =) and the colon and
73
+ * at-sign characters that are valid unencoded in path segments are preserved.
74
+ * @see https://datatracker.ietf.org/doc/html/rfc3986#section-3.3
75
+ * @param segment The raw path segment value to encode.
76
+ * @returns The percent-encoded path segment.
77
+ */
78
+ static encodeUriPathSegment(segment) {
79
+ // RFC 3986 §3.3: only encode characters outside the allowed path segment set.
80
+ // Allowed: unreserved (A-Za-z0-9 - . _ ~), sub-delimiters (! $ & ' ( ) * + , ; =), and : @
81
+ return segment.replace(/[^\w!$&'()*+,.:;=@~-]/g, ch => encodeURIComponent(ch));
82
+ }
70
83
  /**
71
84
  * Replace the origin in the url.
72
85
  * @param url The url to replace the origin in.
@@ -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,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,CAAC,CAAA,CAAC;IACX,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,oBAAoB,CAAC,GAAW;QAC7C,IAAI,CAAC;YACJ,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;YAClC,OAAO,GAAG,YAAY,CAAC,QAAQ,GAAG,YAAY,CAAC,MAAM,EAAE,CAAC;QACzD,CAAC;QAAC,MAAM,CAAC,CAAA,CAAC;IACX,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,YAAY,CAAC,MAAc,EAAE,aAAqB;QAC/D,IAAI,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAC;YACnD,OAAO,GAAG,YAAY,CAAC,mBAAmB,CAAC,MAAM,CAAC,IAAI,YAAY,CAAC,kBAAkB,CAAC,aAAa,CAAC,EAAE,CAAC;QACxG,CAAC;IACF,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,aAAa,CAAC,GAAW,EAAE,SAAkB;QAC1D,IAAI,CAAC,EAAE,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,WAAW,CAAC,SAAS,CAAC,IAAI,CAAC,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 * 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,CAAC,CAAA,CAAC;IACX,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,oBAAoB,CAAC,GAAW;QAC7C,IAAI,CAAC;YACJ,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;YAClC,OAAO,GAAG,YAAY,CAAC,QAAQ,GAAG,YAAY,CAAC,MAAM,EAAE,CAAC;QACzD,CAAC;QAAC,MAAM,CAAC,CAAA,CAAC;IACX,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,YAAY,CAAC,MAAc,EAAE,aAAqB;QAC/D,IAAI,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAC;YACnD,OAAO,GAAG,YAAY,CAAC,mBAAmB,CAAC,MAAM,CAAC,IAAI,YAAY,CAAC,kBAAkB,CAAC,aAAa,CAAC,EAAE,CAAC;QACxG,CAAC;IACF,CAAC;IAED;;;;;;;OAOG;IACI,MAAM,CAAC,oBAAoB,CAAC,OAAe;QACjD,8EAA8E;QAC9E,2FAA2F;QAC3F,OAAO,OAAO,CAAC,OAAO,CAAC,wBAAwB,EAAE,EAAE,CAAC,EAAE,CAAC,kBAAkB,CAAC,EAAE,CAAC,CAAC,CAAC;IAChF,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,aAAa,CAAC,GAAW,EAAE,SAAkB;QAC1D,IAAI,CAAC,EAAE,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,WAAW,CAAC,SAAS,CAAC,IAAI,CAAC,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 +1 @@
1
- {"version":3,"file":"IBaseRestClientConfig.js","sourceRoot":"","sources":["../../../../src/models/config/IBaseRestClientConfig.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IHttpHeaders } from \"@twin.org/web\";\n\n/**\n * Definition for the configuration of a rest client.\n */\nexport interface IBaseRestClientConfig {\n\t/**\n\t * The endpoint where the api is hosted.\n\t */\n\tendpoint: string;\n\n\t/**\n\t * The prefix to the routes.\n\t */\n\tpathPrefix?: string;\n\n\t/**\n\t * The headers to include in requests.\n\t */\n\theaders?: IHttpHeaders;\n\n\t/**\n\t * Timeout for requests in ms.\n\t */\n\ttimeout?: number;\n\n\t/**\n\t * Include credentials in the request, defaults to true.\n\t */\n\tincludeCredentials?: boolean;\n}\n"]}
1
+ {"version":3,"file":"IBaseRestClientConfig.js","sourceRoot":"","sources":["../../../../src/models/config/IBaseRestClientConfig.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IError } from \"@twin.org/core\";\nimport type { IHttpHeaders } from \"@twin.org/web\";\n\n/**\n * Definition for the configuration of a rest client.\n */\nexport interface IBaseRestClientConfig {\n\t/**\n\t * The endpoint where the api is hosted.\n\t */\n\tendpoint: string;\n\n\t/**\n\t * The prefix to the routes.\n\t */\n\tpathPrefix?: string;\n\n\t/**\n\t * The headers to include in requests.\n\t */\n\theaders?: IHttpHeaders;\n\n\t/**\n\t * Timeout for requests in ms.\n\t */\n\ttimeout?: number;\n\n\t/**\n\t * Include credentials in the request, defaults to true.\n\t */\n\tincludeCredentials?: boolean;\n\n\t/**\n\t * Hook to provide headers asynchronously.\n\t * @returns A promise that resolves to the headers.\n\t */\n\tcustomHeaders?: () => Promise<IHttpHeaders>;\n\n\t/**\n\t * Hook to provide an authorization header value asynchronously.\n\t * @returns A promise that resolves to the authorization header value.\n\t */\n\tcustomAuthHeader?: () => Promise<string>;\n\n\t/**\n\t * Hook to handle authorization failures asynchronously.\n\t * @returns A promise that resolves when the auth failure handling is complete.\n\t */\n\tonAuthFailure?: (err: IError) => Promise<void>;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"IHostingComponent.js","sourceRoot":"","sources":["../../../../src/models/services/IHostingComponent.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 * The information about the hosting of the API.\n */\nexport interface IHostingComponent extends IComponent {\n\t/**\n\t * Get the public origin for the hosting.\n\t * @param serverRequestUrl The url of the current server request if there is one.\n\t * @returns The public origin.\n\t */\n\tgetPublicOrigin(serverRequestUrl?: string): Promise<string>;\n\n\t/**\n\t * Get the public origin for the tenant if one exists.\n\t * @param tenantId The tenant identifier.\n\t * @returns The public origin for the tenant.\n\t */\n\tgetTenantOrigin(tenantId: string): Promise<string | undefined>;\n\n\t/**\n\t * Build a public url based on the public origin and the url provided.\n\t * @param url The url to build upon the public origin.\n\t * @returns The full url based on the public origin.\n\t */\n\tbuildPublicUrl(url: string): Promise<string>;\n}\n"]}
1
+ {"version":3,"file":"IHostingComponent.js","sourceRoot":"","sources":["../../../../src/models/services/IHostingComponent.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2026 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 information about the hosting of the API.\n */\nexport interface IHostingComponent extends IComponent {\n\t/**\n\t * Get the public origin for the hosting.\n\t * @param serverRequestUrl The url of the current server request if there is one.\n\t * @returns The public origin.\n\t */\n\tgetPublicOrigin(serverRequestUrl?: string): Promise<string>;\n\n\t/**\n\t * Get the public origin for the tenant if one exists.\n\t * @param tenantId The tenant identifier.\n\t * @returns The public origin for the tenant.\n\t */\n\tgetTenantOrigin(tenantId: string): Promise<string | undefined>;\n\n\t/**\n\t * Build a public url based on the public origin and the url provided.\n\t * @param url The url to build upon the public origin.\n\t * @returns The full url based on the public origin.\n\t */\n\tbuildPublicUrl(url: string): Promise<string>;\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\taddEncryptedParamsToUrl(url: string, params: IHttpRequestQuery): Promise<string>;\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\tgetDecryptedParamsFromQueryParams(\n\t\tqueryParams: IHttpRequestQuery | undefined,\n\t\tkeys: string[]\n\t): Promise<IHttpRequestQuery>;\n\n\t/**\n\t * Encrypt the tenant id and append it as a query parameter to the given URL.\n\t * @param url The URL to append the encrypted tenant token to.\n\t * @param tenantId The tenant identifier to encrypt and add.\n\t * @returns The URL with the encrypted tenant token added as a query parameter.\n\t */\n\taddTenantTokenToUrl(url: string, tenantId: string): Promise<string>;\n\t/**\n\t * Get the tenant token from the query parameters.\n\t * @param queryParams The HTTP request query containing the parameters.\n\t * @returns The tenant token if it exists.\n\t */\n\tgetTenantTokenFromQueryParams(\n\t\tqueryParams: IHttpRequestQuery | undefined\n\t): Promise<string | undefined>;\n\n\t/**\n\t * Encrypt query parameters using the hosting component'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 hosting component'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 using the hosting component's encryption mechanism.\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 using the hosting component's encryption mechanism.\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"]}
@@ -36,6 +36,15 @@ export declare class HttpUrlHelper {
36
36
  * @returns The combined parts.
37
37
  */
38
38
  static combineParts(origin: string, pathAndSearch: string): string | undefined;
39
+ /**
40
+ * Encode a single URL path segment per RFC 3986 §3.3.
41
+ * Unlike encodeURIComponent, sub-delimiters ($ & + , ; =) and the colon and
42
+ * at-sign characters that are valid unencoded in path segments are preserved.
43
+ * @see https://datatracker.ietf.org/doc/html/rfc3986#section-3.3
44
+ * @param segment The raw path segment value to encode.
45
+ * @returns The percent-encoded path segment.
46
+ */
47
+ static encodeUriPathSegment(segment: string): string;
39
48
  /**
40
49
  * Replace the origin in the url.
41
50
  * @param url The url to replace the origin in.
@@ -1,3 +1,4 @@
1
+ import type { IError } from "@twin.org/core";
1
2
  import type { IHttpHeaders } from "@twin.org/web";
2
3
  /**
3
4
  * Definition for the configuration of a rest client.
@@ -23,4 +24,19 @@ export interface IBaseRestClientConfig {
23
24
  * Include credentials in the request, defaults to true.
24
25
  */
25
26
  includeCredentials?: boolean;
27
+ /**
28
+ * Hook to provide headers asynchronously.
29
+ * @returns A promise that resolves to the headers.
30
+ */
31
+ customHeaders?: () => Promise<IHttpHeaders>;
32
+ /**
33
+ * Hook to provide an authorization header value asynchronously.
34
+ * @returns A promise that resolves to the authorization header value.
35
+ */
36
+ customAuthHeader?: () => Promise<string>;
37
+ /**
38
+ * Hook to handle authorization failures asynchronously.
39
+ * @returns A promise that resolves when the auth failure handling is complete.
40
+ */
41
+ onAuthFailure?: (err: IError) => Promise<void>;
26
42
  }
@@ -1,4 +1,5 @@
1
1
  import type { IComponent } from "@twin.org/core";
2
+ import type { IHttpRequestQuery } from "../protocol/IHttpRequestQuery.js";
2
3
  /**
3
4
  * The information about the hosting of the API.
4
5
  */
@@ -21,4 +22,59 @@ export interface IHostingComponent extends IComponent {
21
22
  * @returns The full url based on the public origin.
22
23
  */
23
24
  buildPublicUrl(url: string): Promise<string>;
25
+ /**
26
+ * Add encrypted key/value pairs to a URL's query string.
27
+ * Existing query parameters on the URL are preserved; the provided params are
28
+ * merged in and then encrypted before being written back to the URL.
29
+ * @param url The base URL to add parameters to.
30
+ * @param params The key/value pairs to encrypt and append.
31
+ * @returns The URL with the encrypted parameters added.
32
+ */
33
+ addEncryptedParamsToUrl(url: string, params: IHttpRequestQuery): Promise<string>;
34
+ /**
35
+ * Decrypt specified keys from a query parameter object and return their plain-text values.
36
+ * @param queryParams The HTTP request query containing the encrypted parameters.
37
+ * @param keys The keys to decrypt.
38
+ * @returns A map of the decrypted key/value pairs that were present.
39
+ */
40
+ getDecryptedParamsFromQueryParams(queryParams: IHttpRequestQuery | undefined, keys: string[]): Promise<IHttpRequestQuery>;
41
+ /**
42
+ * Encrypt the tenant id and append it as a query parameter to the given URL.
43
+ * @param url The URL to append the encrypted tenant token to.
44
+ * @param tenantId The tenant identifier to encrypt and add.
45
+ * @returns The URL with the encrypted tenant token added as a query parameter.
46
+ */
47
+ addTenantTokenToUrl(url: string, tenantId: string): Promise<string>;
48
+ /**
49
+ * Get the tenant token from the query parameters.
50
+ * @param queryParams The HTTP request query containing the parameters.
51
+ * @returns The tenant token if it exists.
52
+ */
53
+ getTenantTokenFromQueryParams(queryParams: IHttpRequestQuery | undefined): Promise<string | undefined>;
54
+ /**
55
+ * Encrypt query parameters using the hosting component's encryption mechanism.
56
+ * @param httpRequestQuery The HTTP request query containing the parameters to encrypt.
57
+ * @param keys The keys of the parameters to encrypt.
58
+ * @returns A promise that resolves when the query parameters have been encrypted.
59
+ */
60
+ encryptQueryParams(httpRequestQuery: IHttpRequestQuery | undefined, keys: string[]): Promise<void>;
61
+ /**
62
+ * Decrypt query parameters using the hosting component's encryption mechanism.
63
+ * @param httpRequestQuery The HTTP request query containing the encrypted values.
64
+ * @param keys The keys of the parameters to decrypt.
65
+ * @returns A promise that resolves when the query parameters have been decrypted.
66
+ */
67
+ decryptQueryParams(httpRequestQuery: IHttpRequestQuery | undefined, keys: string[]): Promise<void>;
68
+ /**
69
+ * Encrypt a parameter value using the hosting component's encryption mechanism.
70
+ * @param paramValue The value of the parameter to encrypt.
71
+ * @returns A promise that resolves to the encrypted value of the parameter.
72
+ */
73
+ encryptParam(paramValue: string): Promise<string>;
74
+ /**
75
+ * Decrypt a parameter value using the hosting component's encryption mechanism.
76
+ * @param encryptedValue The encrypted value of the parameter.
77
+ * @returns A promise that resolves to the decrypted value of the parameter.
78
+ */
79
+ decryptParam(encryptedValue: string): Promise<string>;
24
80
  }
package/docs/changelog.md CHANGED
@@ -1,372 +1,386 @@
1
1
  # Changelog
2
2
 
3
- ## [0.0.3-next.27](https://github.com/twinfoundation/api/compare/api-models-v0.0.3-next.26...api-models-v0.0.3-next.27) (2026-04-23)
3
+ ## [0.0.3-next.29](https://github.com/twinfoundation/twin-api/compare/api-models-v0.0.3-next.28...api-models-v0.0.3-next.29) (2026-05-01)
4
+
5
+
6
+ ### Features
7
+
8
+ * hosting service ([#109](https://github.com/twinfoundation/twin-api/issues/109)) ([985bf1f](https://github.com/twinfoundation/twin-api/commit/985bf1f5c07b09ecb800df7120bc2422ac7a6d25))
9
+
10
+ ## [0.0.3-next.28](https://github.com/twinfoundation/twin-api/compare/api-models-v0.0.3-next.27...api-models-v0.0.3-next.28) (2026-04-30)
11
+
12
+
13
+ ### Miscellaneous Chores
14
+
15
+ * **api-models:** Synchronize repo versions
16
+
17
+ ## [0.0.3-next.27](https://github.com/iotaledger/twin-api/compare/api-models-v0.0.3-next.26...api-models-v0.0.3-next.27) (2026-04-23)
4
18
 
5
19
 
6
20
  ### Miscellaneous Chores
7
21
 
8
22
  * **api-models:** Synchronize repo versions
9
23
 
10
- ## [0.0.3-next.26](https://github.com/twinfoundation/api/compare/api-models-v0.0.3-next.25...api-models-v0.0.3-next.26) (2026-04-22)
24
+ ## [0.0.3-next.26](https://github.com/iotaledger/twin-api/compare/api-models-v0.0.3-next.25...api-models-v0.0.3-next.26) (2026-04-22)
11
25
 
12
26
 
13
27
  ### Bug Fixes
14
28
 
15
- * prevent error body masking 4xx as 500, run pre-processors in context scope ([#102](https://github.com/twinfoundation/api/issues/102)) ([5fbe14c](https://github.com/twinfoundation/api/commit/5fbe14c98e11e77a30e16704dcb8bfba7705926b))
29
+ * prevent error body masking 4xx as 500, run pre-processors in context scope ([#102](https://github.com/iotaledger/twin-api/issues/102)) ([5fbe14c](https://github.com/iotaledger/twin-api/commit/5fbe14c98e11e77a30e16704dcb8bfba7705926b))
16
30
 
17
- ## [0.0.3-next.25](https://github.com/twinfoundation/api/compare/api-models-v0.0.3-next.24...api-models-v0.0.3-next.25) (2026-04-14)
31
+ ## [0.0.3-next.25](https://github.com/iotaledger/twin-api/compare/api-models-v0.0.3-next.24...api-models-v0.0.3-next.25) (2026-04-14)
18
32
 
19
33
 
20
34
  ### Miscellaneous Chores
21
35
 
22
36
  * **api-models:** Synchronize repo versions
23
37
 
24
- ## [0.0.3-next.24](https://github.com/twinfoundation/api/compare/api-models-v0.0.3-next.23...api-models-v0.0.3-next.24) (2026-04-14)
38
+ ## [0.0.3-next.24](https://github.com/iotaledger/twin-api/compare/api-models-v0.0.3-next.23...api-models-v0.0.3-next.24) (2026-04-14)
25
39
 
26
40
 
27
41
  ### Miscellaneous Chores
28
42
 
29
43
  * **api-models:** Synchronize repo versions
30
44
 
31
- ## [0.0.3-next.23](https://github.com/twinfoundation/api/compare/api-models-v0.0.3-next.22...api-models-v0.0.3-next.23) (2026-04-14)
45
+ ## [0.0.3-next.23](https://github.com/iotaledger/twin-api/compare/api-models-v0.0.3-next.22...api-models-v0.0.3-next.23) (2026-04-14)
32
46
 
33
47
 
34
48
  ### Features
35
49
 
36
- * auth enhancements ([#93](https://github.com/twinfoundation/api/issues/93)) ([921a50c](https://github.com/twinfoundation/api/commit/921a50cd89d26e530a6be6174a5a803060fa0eb6))
50
+ * auth enhancements ([#93](https://github.com/iotaledger/twin-api/issues/93)) ([921a50c](https://github.com/iotaledger/twin-api/commit/921a50cd89d26e530a6be6174a5a803060fa0eb6))
37
51
 
38
- ## [0.0.3-next.22](https://github.com/twinfoundation/api/compare/api-models-v0.0.3-next.21...api-models-v0.0.3-next.22) (2026-03-27)
52
+ ## [0.0.3-next.22](https://github.com/iotaledger/twin-api/compare/api-models-v0.0.3-next.21...api-models-v0.0.3-next.22) (2026-03-27)
39
53
 
40
54
 
41
55
  ### Features
42
56
 
43
- * add new error types ([#86](https://github.com/twinfoundation/api/issues/86)) ([71e3c07](https://github.com/twinfoundation/api/commit/71e3c07c792984af01c307943e0e09a3ae98710d))
57
+ * add new error types ([#86](https://github.com/iotaledger/twin-api/issues/86)) ([71e3c07](https://github.com/iotaledger/twin-api/commit/71e3c07c792984af01c307943e0e09a3ae98710d))
44
58
 
45
- ## [0.0.3-next.21](https://github.com/twinfoundation/api/compare/api-models-v0.0.3-next.20...api-models-v0.0.3-next.21) (2026-03-11)
59
+ ## [0.0.3-next.21](https://github.com/iotaledger/twin-api/compare/api-models-v0.0.3-next.20...api-models-v0.0.3-next.21) (2026-03-11)
46
60
 
47
61
 
48
62
  ### Miscellaneous Chores
49
63
 
50
64
  * **api-models:** Synchronize repo versions
51
65
 
52
- ## [0.0.3-next.20](https://github.com/twinfoundation/api/compare/api-models-v0.0.3-next.19...api-models-v0.0.3-next.20) (2026-02-09)
66
+ ## [0.0.3-next.20](https://github.com/iotaledger/twin-api/compare/api-models-v0.0.3-next.19...api-models-v0.0.3-next.20) (2026-02-09)
53
67
 
54
68
 
55
69
  ### Miscellaneous Chores
56
70
 
57
71
  * **api-models:** Synchronize repo versions
58
72
 
59
- ## [0.0.3-next.19](https://github.com/twinfoundation/api/compare/api-models-v0.0.3-next.18...api-models-v0.0.3-next.19) (2026-02-06)
73
+ ## [0.0.3-next.19](https://github.com/iotaledger/twin-api/compare/api-models-v0.0.3-next.18...api-models-v0.0.3-next.19) (2026-02-06)
60
74
 
61
75
 
62
76
  ### Miscellaneous Chores
63
77
 
64
78
  * **api-models:** Synchronize repo versions
65
79
 
66
- ## [0.0.3-next.18](https://github.com/twinfoundation/api/compare/api-models-v0.0.3-next.17...api-models-v0.0.3-next.18) (2026-02-04)
80
+ ## [0.0.3-next.18](https://github.com/iotaledger/twin-api/compare/api-models-v0.0.3-next.17...api-models-v0.0.3-next.18) (2026-02-04)
67
81
 
68
82
 
69
83
  ### Features
70
84
 
71
- * tenant api and scopes ([#75](https://github.com/twinfoundation/api/issues/75)) ([c663141](https://github.com/twinfoundation/api/commit/c663141091e8974d769f8f9904ecdab009ebd083))
85
+ * tenant api and scopes ([#75](https://github.com/iotaledger/twin-api/issues/75)) ([c663141](https://github.com/iotaledger/twin-api/commit/c663141091e8974d769f8f9904ecdab009ebd083))
72
86
 
73
- ## [0.0.3-next.17](https://github.com/twinfoundation/api/compare/api-models-v0.0.3-next.16...api-models-v0.0.3-next.17) (2026-01-26)
87
+ ## [0.0.3-next.17](https://github.com/iotaledger/twin-api/compare/api-models-v0.0.3-next.16...api-models-v0.0.3-next.17) (2026-01-26)
74
88
 
75
89
 
76
90
  ### Features
77
91
 
78
- * update public origin building ([6c8e042](https://github.com/twinfoundation/api/commit/6c8e0422d9ddbed42a843e1c23498c99977b2fc7))
92
+ * update public origin building ([6c8e042](https://github.com/iotaledger/twin-api/commit/6c8e0422d9ddbed42a843e1c23498c99977b2fc7))
79
93
 
80
- ## [0.0.3-next.16](https://github.com/twinfoundation/api/compare/api-models-v0.0.3-next.15...api-models-v0.0.3-next.16) (2026-01-26)
94
+ ## [0.0.3-next.16](https://github.com/iotaledger/twin-api/compare/api-models-v0.0.3-next.15...api-models-v0.0.3-next.16) (2026-01-26)
81
95
 
82
96
 
83
97
  ### Features
84
98
 
85
- * public base url ([#70](https://github.com/twinfoundation/api/issues/70)) ([5b958cd](https://github.com/twinfoundation/api/commit/5b958cd91e8a38cdae2835ff5f2356c7e48d37c3))
99
+ * public base url ([#70](https://github.com/iotaledger/twin-api/issues/70)) ([5b958cd](https://github.com/iotaledger/twin-api/commit/5b958cd91e8a38cdae2835ff5f2356c7e48d37c3))
86
100
 
87
- ## [0.0.3-next.15](https://github.com/twinfoundation/api/compare/api-models-v0.0.3-next.14...api-models-v0.0.3-next.15) (2026-01-22)
101
+ ## [0.0.3-next.15](https://github.com/iotaledger/twin-api/compare/api-models-v0.0.3-next.14...api-models-v0.0.3-next.15) (2026-01-22)
88
102
 
89
103
 
90
104
  ### Miscellaneous Chores
91
105
 
92
106
  * **api-models:** Synchronize repo versions
93
107
 
94
- ## [0.0.3-next.14](https://github.com/twinfoundation/api/compare/api-models-v0.0.3-next.13...api-models-v0.0.3-next.14) (2026-01-20)
108
+ ## [0.0.3-next.14](https://github.com/iotaledger/twin-api/compare/api-models-v0.0.3-next.13...api-models-v0.0.3-next.14) (2026-01-20)
95
109
 
96
110
 
97
111
  ### Features
98
112
 
99
- * export error type map ([#68](https://github.com/twinfoundation/api/issues/68)) ([697dfc4](https://github.com/twinfoundation/api/commit/697dfc4c9f6a7be493bf4b3619d7bcebf2e4584e))
113
+ * export error type map ([#68](https://github.com/iotaledger/twin-api/issues/68)) ([697dfc4](https://github.com/iotaledger/twin-api/commit/697dfc4c9f6a7be493bf4b3619d7bcebf2e4584e))
100
114
 
101
- ## [0.0.3-next.13](https://github.com/twinfoundation/api/compare/api-models-v0.0.3-next.12...api-models-v0.0.3-next.13) (2026-01-19)
115
+ ## [0.0.3-next.13](https://github.com/iotaledger/twin-api/compare/api-models-v0.0.3-next.12...api-models-v0.0.3-next.13) (2026-01-19)
102
116
 
103
117
 
104
118
  ### Features
105
119
 
106
- * remove authentication generators ([#66](https://github.com/twinfoundation/api/issues/66)) ([adaa169](https://github.com/twinfoundation/api/commit/adaa1698df1c5ccb0ad645a7a7c0d3ef82ef6ac1))
120
+ * remove authentication generators ([#66](https://github.com/iotaledger/twin-api/issues/66)) ([adaa169](https://github.com/iotaledger/twin-api/commit/adaa1698df1c5ccb0ad645a7a7c0d3ef82ef6ac1))
107
121
 
108
- ## [0.0.3-next.12](https://github.com/twinfoundation/api/compare/api-models-v0.0.3-next.11...api-models-v0.0.3-next.12) (2026-01-12)
122
+ ## [0.0.3-next.12](https://github.com/iotaledger/twin-api/compare/api-models-v0.0.3-next.11...api-models-v0.0.3-next.12) (2026-01-12)
109
123
 
110
124
 
111
125
  ### Miscellaneous Chores
112
126
 
113
127
  * **api-models:** Synchronize repo versions
114
128
 
115
- ## [0.0.3-next.11](https://github.com/twinfoundation/api/compare/api-models-v0.0.3-next.10...api-models-v0.0.3-next.11) (2026-01-08)
129
+ ## [0.0.3-next.11](https://github.com/iotaledger/twin-api/compare/api-models-v0.0.3-next.10...api-models-v0.0.3-next.11) (2026-01-08)
116
130
 
117
131
 
118
132
  ### Miscellaneous Chores
119
133
 
120
134
  * **api-models:** Synchronize repo versions
121
135
 
122
- ## [0.0.3-next.10](https://github.com/twinfoundation/api/compare/api-models-v0.0.3-next.9...api-models-v0.0.3-next.10) (2026-01-05)
136
+ ## [0.0.3-next.10](https://github.com/iotaledger/twin-api/compare/api-models-v0.0.3-next.9...api-models-v0.0.3-next.10) (2026-01-05)
123
137
 
124
138
 
125
139
  ### Miscellaneous Chores
126
140
 
127
141
  * **api-models:** Synchronize repo versions
128
142
 
129
- ## [0.0.3-next.9](https://github.com/twinfoundation/api/compare/api-models-v0.0.3-next.8...api-models-v0.0.3-next.9) (2026-01-05)
143
+ ## [0.0.3-next.9](https://github.com/iotaledger/twin-api/compare/api-models-v0.0.3-next.8...api-models-v0.0.3-next.9) (2026-01-05)
130
144
 
131
145
 
132
146
  ### Features
133
147
 
134
- * add authentication generators and process features option ([a67edf1](https://github.com/twinfoundation/api/commit/a67edf1df212bd8ab94a40cddf5338551155696f))
135
- * add context id features ([#42](https://github.com/twinfoundation/api/issues/42)) ([0186055](https://github.com/twinfoundation/api/commit/0186055c48afde842a4254b4df9ac9249c40fe40))
136
- * add livez endpoint ([#57](https://github.com/twinfoundation/api/issues/57)) ([ef007db](https://github.com/twinfoundation/api/commit/ef007db8201736dd3053211f849ffd03baaa485e))
137
- * add logging component type to request contexts ([210de1b](https://github.com/twinfoundation/api/commit/210de1b9e1c91079b59a2b90ddd57569668d647d))
138
- * add root, favicon routes ([71da1c3](https://github.com/twinfoundation/api/commit/71da1c3a93c349588aff7084d1d8d6a29a277da8))
139
- * add socket id, connect and disconnect ([20b0d0e](https://github.com/twinfoundation/api/commit/20b0d0ec279cab46141fee09de2c4a7087cdce16))
140
- * add validate-locales ([cdba610](https://github.com/twinfoundation/api/commit/cdba610a0acb5022d2e3ce729732e6646a297e5e))
141
- * decodeURIComponent for query and path params ([ead68a2](https://github.com/twinfoundation/api/commit/ead68a257425c10dd912497f7edd473c469ca132))
142
- * eslint migration to flat config ([0dd5820](https://github.com/twinfoundation/api/commit/0dd5820e3af97350fd08b8d226f4a6c1a9246805))
143
- * update dependencies ([1171dc4](https://github.com/twinfoundation/api/commit/1171dc416a9481737f6a640e3cf30145768f37e9))
144
- * update framework core ([d8eebf2](https://github.com/twinfoundation/api/commit/d8eebf267fa2a0abaa84e58590496e9d20490cfa))
145
- * update IComponent signatures ([915ce37](https://github.com/twinfoundation/api/commit/915ce37712326ab4aa6869c350eabaa4622e8430))
146
- * use new includeStackTrace flag for toJsonObject ([6452b15](https://github.com/twinfoundation/api/commit/6452b153af786eee14b21152420f8a2578b70593))
147
- * use shared store mechanism ([#19](https://github.com/twinfoundation/api/issues/19)) ([32116df](https://github.com/twinfoundation/api/commit/32116df3b4380a30137f5056f242a5c99afa2df9))
148
- * validationError mapped to http status badrequest ([adc5eb1](https://github.com/twinfoundation/api/commit/adc5eb11d987abb0ab9f7e0dc8e1fdae207e436e))
148
+ * add authentication generators and process features option ([a67edf1](https://github.com/iotaledger/twin-api/commit/a67edf1df212bd8ab94a40cddf5338551155696f))
149
+ * add context id features ([#42](https://github.com/iotaledger/twin-api/issues/42)) ([0186055](https://github.com/iotaledger/twin-api/commit/0186055c48afde842a4254b4df9ac9249c40fe40))
150
+ * add livez endpoint ([#57](https://github.com/iotaledger/twin-api/issues/57)) ([ef007db](https://github.com/iotaledger/twin-api/commit/ef007db8201736dd3053211f849ffd03baaa485e))
151
+ * add logging component type to request contexts ([210de1b](https://github.com/iotaledger/twin-api/commit/210de1b9e1c91079b59a2b90ddd57569668d647d))
152
+ * add root, favicon routes ([71da1c3](https://github.com/iotaledger/twin-api/commit/71da1c3a93c349588aff7084d1d8d6a29a277da8))
153
+ * add socket id, connect and disconnect ([20b0d0e](https://github.com/iotaledger/twin-api/commit/20b0d0ec279cab46141fee09de2c4a7087cdce16))
154
+ * add validate-locales ([cdba610](https://github.com/iotaledger/twin-api/commit/cdba610a0acb5022d2e3ce729732e6646a297e5e))
155
+ * decodeURIComponent for query and path params ([ead68a2](https://github.com/iotaledger/twin-api/commit/ead68a257425c10dd912497f7edd473c469ca132))
156
+ * eslint migration to flat config ([0dd5820](https://github.com/iotaledger/twin-api/commit/0dd5820e3af97350fd08b8d226f4a6c1a9246805))
157
+ * update dependencies ([1171dc4](https://github.com/iotaledger/twin-api/commit/1171dc416a9481737f6a640e3cf30145768f37e9))
158
+ * update framework core ([d8eebf2](https://github.com/iotaledger/twin-api/commit/d8eebf267fa2a0abaa84e58590496e9d20490cfa))
159
+ * update IComponent signatures ([915ce37](https://github.com/iotaledger/twin-api/commit/915ce37712326ab4aa6869c350eabaa4622e8430))
160
+ * use new includeStackTrace flag for toJsonObject ([6452b15](https://github.com/iotaledger/twin-api/commit/6452b153af786eee14b21152420f8a2578b70593))
161
+ * use shared store mechanism ([#19](https://github.com/iotaledger/twin-api/issues/19)) ([32116df](https://github.com/iotaledger/twin-api/commit/32116df3b4380a30137f5056f242a5c99afa2df9))
162
+ * validationError mapped to http status badrequest ([adc5eb1](https://github.com/iotaledger/twin-api/commit/adc5eb11d987abb0ab9f7e0dc8e1fdae207e436e))
149
163
 
150
164
 
151
165
  ### Bug Fixes
152
166
 
153
- * error handling make sure primary error takes precedence ([84b61f2](https://github.com/twinfoundation/api/commit/84b61f27fe5e4919c0c9f9a1edc8ff46dc45c1f7))
167
+ * error handling make sure primary error takes precedence ([84b61f2](https://github.com/iotaledger/twin-api/commit/84b61f27fe5e4919c0c9f9a1edc8ff46dc45c1f7))
154
168
 
155
- ## [0.0.3-next.8](https://github.com/twinfoundation/api/compare/api-models-v0.0.3-next.7...api-models-v0.0.3-next.8) (2025-12-17)
169
+ ## [0.0.3-next.8](https://github.com/iotaledger/twin-api/compare/api-models-v0.0.3-next.7...api-models-v0.0.3-next.8) (2025-12-17)
156
170
 
157
171
 
158
172
  ### Miscellaneous Chores
159
173
 
160
174
  * **api-models:** Synchronize repo versions
161
175
 
162
- ## [0.0.3-next.7](https://github.com/twinfoundation/api/compare/api-models-v0.0.3-next.6...api-models-v0.0.3-next.7) (2025-11-26)
176
+ ## [0.0.3-next.7](https://github.com/iotaledger/twin-api/compare/api-models-v0.0.3-next.6...api-models-v0.0.3-next.7) (2025-11-26)
163
177
 
164
178
 
165
179
  ### Bug Fixes
166
180
 
167
- * error handling make sure primary error takes precedence ([84b61f2](https://github.com/twinfoundation/api/commit/84b61f27fe5e4919c0c9f9a1edc8ff46dc45c1f7))
181
+ * error handling make sure primary error takes precedence ([84b61f2](https://github.com/iotaledger/twin-api/commit/84b61f27fe5e4919c0c9f9a1edc8ff46dc45c1f7))
168
182
 
169
- ## [0.0.3-next.6](https://github.com/twinfoundation/api/compare/api-models-v0.0.3-next.5...api-models-v0.0.3-next.6) (2025-11-20)
183
+ ## [0.0.3-next.6](https://github.com/iotaledger/twin-api/compare/api-models-v0.0.3-next.5...api-models-v0.0.3-next.6) (2025-11-20)
170
184
 
171
185
 
172
186
  ### Miscellaneous Chores
173
187
 
174
188
  * **api-models:** Synchronize repo versions
175
189
 
176
- ## [0.0.3-next.5](https://github.com/twinfoundation/api/compare/api-models-v0.0.3-next.4...api-models-v0.0.3-next.5) (2025-11-14)
190
+ ## [0.0.3-next.5](https://github.com/iotaledger/twin-api/compare/api-models-v0.0.3-next.4...api-models-v0.0.3-next.5) (2025-11-14)
177
191
 
178
192
 
179
193
  ### Features
180
194
 
181
- * decodeURIComponent for query and path params ([ead68a2](https://github.com/twinfoundation/api/commit/ead68a257425c10dd912497f7edd473c469ca132))
195
+ * decodeURIComponent for query and path params ([ead68a2](https://github.com/iotaledger/twin-api/commit/ead68a257425c10dd912497f7edd473c469ca132))
182
196
 
183
- ## [0.0.3-next.4](https://github.com/twinfoundation/api/compare/api-models-v0.0.3-next.3...api-models-v0.0.3-next.4) (2025-11-14)
197
+ ## [0.0.3-next.4](https://github.com/iotaledger/twin-api/compare/api-models-v0.0.3-next.3...api-models-v0.0.3-next.4) (2025-11-14)
184
198
 
185
199
 
186
200
  ### Features
187
201
 
188
- * add authentication generators and process features option ([a67edf1](https://github.com/twinfoundation/api/commit/a67edf1df212bd8ab94a40cddf5338551155696f))
189
- * add context id features ([#42](https://github.com/twinfoundation/api/issues/42)) ([0186055](https://github.com/twinfoundation/api/commit/0186055c48afde842a4254b4df9ac9249c40fe40))
190
- * add logging component type to request contexts ([210de1b](https://github.com/twinfoundation/api/commit/210de1b9e1c91079b59a2b90ddd57569668d647d))
191
- * add root, favicon routes ([71da1c3](https://github.com/twinfoundation/api/commit/71da1c3a93c349588aff7084d1d8d6a29a277da8))
192
- * add socket id, connect and disconnect ([20b0d0e](https://github.com/twinfoundation/api/commit/20b0d0ec279cab46141fee09de2c4a7087cdce16))
193
- * add validate-locales ([cdba610](https://github.com/twinfoundation/api/commit/cdba610a0acb5022d2e3ce729732e6646a297e5e))
194
- * eslint migration to flat config ([0dd5820](https://github.com/twinfoundation/api/commit/0dd5820e3af97350fd08b8d226f4a6c1a9246805))
195
- * update dependencies ([1171dc4](https://github.com/twinfoundation/api/commit/1171dc416a9481737f6a640e3cf30145768f37e9))
196
- * update framework core ([d8eebf2](https://github.com/twinfoundation/api/commit/d8eebf267fa2a0abaa84e58590496e9d20490cfa))
197
- * update IComponent signatures ([915ce37](https://github.com/twinfoundation/api/commit/915ce37712326ab4aa6869c350eabaa4622e8430))
198
- * use new includeStackTrace flag for toJsonObject ([6452b15](https://github.com/twinfoundation/api/commit/6452b153af786eee14b21152420f8a2578b70593))
199
- * use shared store mechanism ([#19](https://github.com/twinfoundation/api/issues/19)) ([32116df](https://github.com/twinfoundation/api/commit/32116df3b4380a30137f5056f242a5c99afa2df9))
200
- * validationError mapped to http status badrequest ([adc5eb1](https://github.com/twinfoundation/api/commit/adc5eb11d987abb0ab9f7e0dc8e1fdae207e436e))
202
+ * add authentication generators and process features option ([a67edf1](https://github.com/iotaledger/twin-api/commit/a67edf1df212bd8ab94a40cddf5338551155696f))
203
+ * add context id features ([#42](https://github.com/iotaledger/twin-api/issues/42)) ([0186055](https://github.com/iotaledger/twin-api/commit/0186055c48afde842a4254b4df9ac9249c40fe40))
204
+ * add logging component type to request contexts ([210de1b](https://github.com/iotaledger/twin-api/commit/210de1b9e1c91079b59a2b90ddd57569668d647d))
205
+ * add root, favicon routes ([71da1c3](https://github.com/iotaledger/twin-api/commit/71da1c3a93c349588aff7084d1d8d6a29a277da8))
206
+ * add socket id, connect and disconnect ([20b0d0e](https://github.com/iotaledger/twin-api/commit/20b0d0ec279cab46141fee09de2c4a7087cdce16))
207
+ * add validate-locales ([cdba610](https://github.com/iotaledger/twin-api/commit/cdba610a0acb5022d2e3ce729732e6646a297e5e))
208
+ * eslint migration to flat config ([0dd5820](https://github.com/iotaledger/twin-api/commit/0dd5820e3af97350fd08b8d226f4a6c1a9246805))
209
+ * update dependencies ([1171dc4](https://github.com/iotaledger/twin-api/commit/1171dc416a9481737f6a640e3cf30145768f37e9))
210
+ * update framework core ([d8eebf2](https://github.com/iotaledger/twin-api/commit/d8eebf267fa2a0abaa84e58590496e9d20490cfa))
211
+ * update IComponent signatures ([915ce37](https://github.com/iotaledger/twin-api/commit/915ce37712326ab4aa6869c350eabaa4622e8430))
212
+ * use new includeStackTrace flag for toJsonObject ([6452b15](https://github.com/iotaledger/twin-api/commit/6452b153af786eee14b21152420f8a2578b70593))
213
+ * use shared store mechanism ([#19](https://github.com/iotaledger/twin-api/issues/19)) ([32116df](https://github.com/iotaledger/twin-api/commit/32116df3b4380a30137f5056f242a5c99afa2df9))
214
+ * validationError mapped to http status badrequest ([adc5eb1](https://github.com/iotaledger/twin-api/commit/adc5eb11d987abb0ab9f7e0dc8e1fdae207e436e))
201
215
 
202
- ## [0.0.3-next.3](https://github.com/twinfoundation/api/compare/api-models-v0.0.3-next.2...api-models-v0.0.3-next.3) (2025-11-14)
216
+ ## [0.0.3-next.3](https://github.com/iotaledger/twin-api/compare/api-models-v0.0.3-next.2...api-models-v0.0.3-next.3) (2025-11-14)
203
217
 
204
218
 
205
219
  ### Miscellaneous Chores
206
220
 
207
221
  * **api-models:** Synchronize repo versions
208
222
 
209
- ## [0.0.3-next.2](https://github.com/twinfoundation/api/compare/api-models-v0.0.3-next.1...api-models-v0.0.3-next.2) (2025-11-12)
223
+ ## [0.0.3-next.2](https://github.com/iotaledger/twin-api/compare/api-models-v0.0.3-next.1...api-models-v0.0.3-next.2) (2025-11-12)
210
224
 
211
225
 
212
226
  ### Miscellaneous Chores
213
227
 
214
228
  * **api-models:** Synchronize repo versions
215
229
 
216
- ## [0.0.3-next.1](https://github.com/twinfoundation/api/compare/api-models-v0.0.3-next.0...api-models-v0.0.3-next.1) (2025-11-10)
230
+ ## [0.0.3-next.1](https://github.com/iotaledger/twin-api/compare/api-models-v0.0.3-next.0...api-models-v0.0.3-next.1) (2025-11-10)
217
231
 
218
232
 
219
233
  ### Features
220
234
 
221
- * add authentication generators and process features option ([a67edf1](https://github.com/twinfoundation/api/commit/a67edf1df212bd8ab94a40cddf5338551155696f))
222
- * add context id features ([#42](https://github.com/twinfoundation/api/issues/42)) ([0186055](https://github.com/twinfoundation/api/commit/0186055c48afde842a4254b4df9ac9249c40fe40))
223
- * add logging component type to request contexts ([210de1b](https://github.com/twinfoundation/api/commit/210de1b9e1c91079b59a2b90ddd57569668d647d))
224
- * add root, favicon routes ([71da1c3](https://github.com/twinfoundation/api/commit/71da1c3a93c349588aff7084d1d8d6a29a277da8))
225
- * add socket id, connect and disconnect ([20b0d0e](https://github.com/twinfoundation/api/commit/20b0d0ec279cab46141fee09de2c4a7087cdce16))
226
- * add validate-locales ([cdba610](https://github.com/twinfoundation/api/commit/cdba610a0acb5022d2e3ce729732e6646a297e5e))
227
- * eslint migration to flat config ([0dd5820](https://github.com/twinfoundation/api/commit/0dd5820e3af97350fd08b8d226f4a6c1a9246805))
228
- * update dependencies ([1171dc4](https://github.com/twinfoundation/api/commit/1171dc416a9481737f6a640e3cf30145768f37e9))
229
- * update framework core ([d8eebf2](https://github.com/twinfoundation/api/commit/d8eebf267fa2a0abaa84e58590496e9d20490cfa))
230
- * update IComponent signatures ([915ce37](https://github.com/twinfoundation/api/commit/915ce37712326ab4aa6869c350eabaa4622e8430))
231
- * use new includeStackTrace flag for toJsonObject ([6452b15](https://github.com/twinfoundation/api/commit/6452b153af786eee14b21152420f8a2578b70593))
232
- * use shared store mechanism ([#19](https://github.com/twinfoundation/api/issues/19)) ([32116df](https://github.com/twinfoundation/api/commit/32116df3b4380a30137f5056f242a5c99afa2df9))
233
- * validationError mapped to http status badrequest ([adc5eb1](https://github.com/twinfoundation/api/commit/adc5eb11d987abb0ab9f7e0dc8e1fdae207e436e))
235
+ * add authentication generators and process features option ([a67edf1](https://github.com/iotaledger/twin-api/commit/a67edf1df212bd8ab94a40cddf5338551155696f))
236
+ * add context id features ([#42](https://github.com/iotaledger/twin-api/issues/42)) ([0186055](https://github.com/iotaledger/twin-api/commit/0186055c48afde842a4254b4df9ac9249c40fe40))
237
+ * add logging component type to request contexts ([210de1b](https://github.com/iotaledger/twin-api/commit/210de1b9e1c91079b59a2b90ddd57569668d647d))
238
+ * add root, favicon routes ([71da1c3](https://github.com/iotaledger/twin-api/commit/71da1c3a93c349588aff7084d1d8d6a29a277da8))
239
+ * add socket id, connect and disconnect ([20b0d0e](https://github.com/iotaledger/twin-api/commit/20b0d0ec279cab46141fee09de2c4a7087cdce16))
240
+ * add validate-locales ([cdba610](https://github.com/iotaledger/twin-api/commit/cdba610a0acb5022d2e3ce729732e6646a297e5e))
241
+ * eslint migration to flat config ([0dd5820](https://github.com/iotaledger/twin-api/commit/0dd5820e3af97350fd08b8d226f4a6c1a9246805))
242
+ * update dependencies ([1171dc4](https://github.com/iotaledger/twin-api/commit/1171dc416a9481737f6a640e3cf30145768f37e9))
243
+ * update framework core ([d8eebf2](https://github.com/iotaledger/twin-api/commit/d8eebf267fa2a0abaa84e58590496e9d20490cfa))
244
+ * update IComponent signatures ([915ce37](https://github.com/iotaledger/twin-api/commit/915ce37712326ab4aa6869c350eabaa4622e8430))
245
+ * use new includeStackTrace flag for toJsonObject ([6452b15](https://github.com/iotaledger/twin-api/commit/6452b153af786eee14b21152420f8a2578b70593))
246
+ * use shared store mechanism ([#19](https://github.com/iotaledger/twin-api/issues/19)) ([32116df](https://github.com/iotaledger/twin-api/commit/32116df3b4380a30137f5056f242a5c99afa2df9))
247
+ * validationError mapped to http status badrequest ([adc5eb1](https://github.com/iotaledger/twin-api/commit/adc5eb11d987abb0ab9f7e0dc8e1fdae207e436e))
234
248
 
235
- ## [0.0.2-next.13](https://github.com/twinfoundation/api/compare/api-models-v0.0.2-next.12...api-models-v0.0.2-next.13) (2025-10-09)
249
+ ## [0.0.2-next.13](https://github.com/iotaledger/twin-api/compare/api-models-v0.0.2-next.12...api-models-v0.0.2-next.13) (2025-10-09)
236
250
 
237
251
 
238
252
  ### Miscellaneous Chores
239
253
 
240
254
  * **api-models:** Synchronize repo versions
241
255
 
242
- ## [0.0.2-next.12](https://github.com/twinfoundation/api/compare/api-models-v0.0.2-next.11...api-models-v0.0.2-next.12) (2025-10-09)
256
+ ## [0.0.2-next.12](https://github.com/iotaledger/twin-api/compare/api-models-v0.0.2-next.11...api-models-v0.0.2-next.12) (2025-10-09)
243
257
 
244
258
 
245
259
  ### Features
246
260
 
247
- * add validate-locales ([cdba610](https://github.com/twinfoundation/api/commit/cdba610a0acb5022d2e3ce729732e6646a297e5e))
261
+ * add validate-locales ([cdba610](https://github.com/iotaledger/twin-api/commit/cdba610a0acb5022d2e3ce729732e6646a297e5e))
248
262
 
249
- ## [0.0.2-next.11](https://github.com/twinfoundation/api/compare/api-models-v0.0.2-next.10...api-models-v0.0.2-next.11) (2025-09-29)
263
+ ## [0.0.2-next.11](https://github.com/iotaledger/twin-api/compare/api-models-v0.0.2-next.10...api-models-v0.0.2-next.11) (2025-09-29)
250
264
 
251
265
 
252
266
  ### Features
253
267
 
254
- * update IComponent signatures ([915ce37](https://github.com/twinfoundation/api/commit/915ce37712326ab4aa6869c350eabaa4622e8430))
268
+ * update IComponent signatures ([915ce37](https://github.com/iotaledger/twin-api/commit/915ce37712326ab4aa6869c350eabaa4622e8430))
255
269
 
256
- ## [0.0.2-next.10](https://github.com/twinfoundation/api/compare/api-models-v0.0.2-next.9...api-models-v0.0.2-next.10) (2025-09-23)
270
+ ## [0.0.2-next.10](https://github.com/iotaledger/twin-api/compare/api-models-v0.0.2-next.9...api-models-v0.0.2-next.10) (2025-09-23)
257
271
 
258
272
 
259
273
  ### Features
260
274
 
261
- * add authentication generators and process features option ([a67edf1](https://github.com/twinfoundation/api/commit/a67edf1df212bd8ab94a40cddf5338551155696f))
275
+ * add authentication generators and process features option ([a67edf1](https://github.com/iotaledger/twin-api/commit/a67edf1df212bd8ab94a40cddf5338551155696f))
262
276
 
263
- ## [0.0.2-next.9](https://github.com/twinfoundation/api/compare/api-models-v0.0.2-next.8...api-models-v0.0.2-next.9) (2025-08-29)
277
+ ## [0.0.2-next.9](https://github.com/iotaledger/twin-api/compare/api-models-v0.0.2-next.8...api-models-v0.0.2-next.9) (2025-08-29)
264
278
 
265
279
 
266
280
  ### Features
267
281
 
268
- * eslint migration to flat config ([0dd5820](https://github.com/twinfoundation/api/commit/0dd5820e3af97350fd08b8d226f4a6c1a9246805))
282
+ * eslint migration to flat config ([0dd5820](https://github.com/iotaledger/twin-api/commit/0dd5820e3af97350fd08b8d226f4a6c1a9246805))
269
283
 
270
- ## [0.0.2-next.8](https://github.com/twinfoundation/api/compare/api-models-v0.0.2-next.7...api-models-v0.0.2-next.8) (2025-08-21)
284
+ ## [0.0.2-next.8](https://github.com/iotaledger/twin-api/compare/api-models-v0.0.2-next.7...api-models-v0.0.2-next.8) (2025-08-21)
271
285
 
272
286
 
273
287
  ### Features
274
288
 
275
- * add root, favicon routes ([71da1c3](https://github.com/twinfoundation/api/commit/71da1c3a93c349588aff7084d1d8d6a29a277da8))
289
+ * add root, favicon routes ([71da1c3](https://github.com/iotaledger/twin-api/commit/71da1c3a93c349588aff7084d1d8d6a29a277da8))
276
290
 
277
- ## [0.0.2-next.7](https://github.com/twinfoundation/api/compare/api-models-v0.0.2-next.6...api-models-v0.0.2-next.7) (2025-08-20)
291
+ ## [0.0.2-next.7](https://github.com/iotaledger/twin-api/compare/api-models-v0.0.2-next.6...api-models-v0.0.2-next.7) (2025-08-20)
278
292
 
279
293
 
280
294
  ### Miscellaneous Chores
281
295
 
282
296
  * **api-models:** Synchronize repo versions
283
297
 
284
- ## [0.0.2-next.6](https://github.com/twinfoundation/api/compare/api-models-v0.0.2-next.5...api-models-v0.0.2-next.6) (2025-08-19)
298
+ ## [0.0.2-next.6](https://github.com/iotaledger/twin-api/compare/api-models-v0.0.2-next.5...api-models-v0.0.2-next.6) (2025-08-19)
285
299
 
286
300
 
287
301
  ### Features
288
302
 
289
- * update framework core ([d8eebf2](https://github.com/twinfoundation/api/commit/d8eebf267fa2a0abaa84e58590496e9d20490cfa))
303
+ * update framework core ([d8eebf2](https://github.com/iotaledger/twin-api/commit/d8eebf267fa2a0abaa84e58590496e9d20490cfa))
290
304
 
291
- ## [0.0.2-next.5](https://github.com/twinfoundation/api/compare/api-models-v0.0.2-next.4...api-models-v0.0.2-next.5) (2025-07-25)
305
+ ## [0.0.2-next.5](https://github.com/iotaledger/twin-api/compare/api-models-v0.0.2-next.4...api-models-v0.0.2-next.5) (2025-07-25)
292
306
 
293
307
 
294
308
  ### Features
295
309
 
296
- * add logging component type to request contexts ([210de1b](https://github.com/twinfoundation/api/commit/210de1b9e1c91079b59a2b90ddd57569668d647d))
297
- * add socket id, connect and disconnect ([20b0d0e](https://github.com/twinfoundation/api/commit/20b0d0ec279cab46141fee09de2c4a7087cdce16))
298
- * update dependencies ([1171dc4](https://github.com/twinfoundation/api/commit/1171dc416a9481737f6a640e3cf30145768f37e9))
299
- * use new includeStackTrace flag for toJsonObject ([6452b15](https://github.com/twinfoundation/api/commit/6452b153af786eee14b21152420f8a2578b70593))
300
- * use shared store mechanism ([#19](https://github.com/twinfoundation/api/issues/19)) ([32116df](https://github.com/twinfoundation/api/commit/32116df3b4380a30137f5056f242a5c99afa2df9))
301
- * validationError mapped to http status badrequest ([adc5eb1](https://github.com/twinfoundation/api/commit/adc5eb11d987abb0ab9f7e0dc8e1fdae207e436e))
310
+ * add logging component type to request contexts ([210de1b](https://github.com/iotaledger/twin-api/commit/210de1b9e1c91079b59a2b90ddd57569668d647d))
311
+ * add socket id, connect and disconnect ([20b0d0e](https://github.com/iotaledger/twin-api/commit/20b0d0ec279cab46141fee09de2c4a7087cdce16))
312
+ * update dependencies ([1171dc4](https://github.com/iotaledger/twin-api/commit/1171dc416a9481737f6a640e3cf30145768f37e9))
313
+ * use new includeStackTrace flag for toJsonObject ([6452b15](https://github.com/iotaledger/twin-api/commit/6452b153af786eee14b21152420f8a2578b70593))
314
+ * use shared store mechanism ([#19](https://github.com/iotaledger/twin-api/issues/19)) ([32116df](https://github.com/iotaledger/twin-api/commit/32116df3b4380a30137f5056f242a5c99afa2df9))
315
+ * validationError mapped to http status badrequest ([adc5eb1](https://github.com/iotaledger/twin-api/commit/adc5eb11d987abb0ab9f7e0dc8e1fdae207e436e))
302
316
 
303
- ## [0.0.2-next.4](https://github.com/twinfoundation/api/compare/api-models-v0.0.2-next.3...api-models-v0.0.2-next.4) (2025-07-25)
317
+ ## [0.0.2-next.4](https://github.com/iotaledger/twin-api/compare/api-models-v0.0.2-next.3...api-models-v0.0.2-next.4) (2025-07-25)
304
318
 
305
319
 
306
320
  ### Features
307
321
 
308
- * add logging component type to request contexts ([210de1b](https://github.com/twinfoundation/api/commit/210de1b9e1c91079b59a2b90ddd57569668d647d))
322
+ * add logging component type to request contexts ([210de1b](https://github.com/iotaledger/twin-api/commit/210de1b9e1c91079b59a2b90ddd57569668d647d))
309
323
 
310
- ## [0.0.2-next.3](https://github.com/twinfoundation/api/compare/api-models-v0.0.2-next.2...api-models-v0.0.2-next.3) (2025-07-24)
324
+ ## [0.0.2-next.3](https://github.com/iotaledger/twin-api/compare/api-models-v0.0.2-next.2...api-models-v0.0.2-next.3) (2025-07-24)
311
325
 
312
326
 
313
327
  ### Features
314
328
 
315
- * add socket id, connect and disconnect ([20b0d0e](https://github.com/twinfoundation/api/commit/20b0d0ec279cab46141fee09de2c4a7087cdce16))
329
+ * add socket id, connect and disconnect ([20b0d0e](https://github.com/iotaledger/twin-api/commit/20b0d0ec279cab46141fee09de2c4a7087cdce16))
316
330
 
317
- ## [0.0.2-next.2](https://github.com/twinfoundation/api/compare/api-models-v0.0.2-next.1...api-models-v0.0.2-next.2) (2025-07-17)
331
+ ## [0.0.2-next.2](https://github.com/iotaledger/twin-api/compare/api-models-v0.0.2-next.1...api-models-v0.0.2-next.2) (2025-07-17)
318
332
 
319
333
 
320
334
  ### Miscellaneous Chores
321
335
 
322
336
  * **api-models:** Synchronize repo versions
323
337
 
324
- ## [0.0.2-next.1](https://github.com/twinfoundation/api/compare/api-models-v0.0.2-next.0...api-models-v0.0.2-next.1) (2025-07-08)
338
+ ## [0.0.2-next.1](https://github.com/iotaledger/twin-api/compare/api-models-v0.0.2-next.0...api-models-v0.0.2-next.1) (2025-07-08)
325
339
 
326
340
 
327
341
  ### Features
328
342
 
329
- * update dependencies ([1171dc4](https://github.com/twinfoundation/api/commit/1171dc416a9481737f6a640e3cf30145768f37e9))
330
- * use new includeStackTrace flag for toJsonObject ([6452b15](https://github.com/twinfoundation/api/commit/6452b153af786eee14b21152420f8a2578b70593))
331
- * use shared store mechanism ([#19](https://github.com/twinfoundation/api/issues/19)) ([32116df](https://github.com/twinfoundation/api/commit/32116df3b4380a30137f5056f242a5c99afa2df9))
332
- * validationError mapped to http status badrequest ([adc5eb1](https://github.com/twinfoundation/api/commit/adc5eb11d987abb0ab9f7e0dc8e1fdae207e436e))
343
+ * update dependencies ([1171dc4](https://github.com/iotaledger/twin-api/commit/1171dc416a9481737f6a640e3cf30145768f37e9))
344
+ * use new includeStackTrace flag for toJsonObject ([6452b15](https://github.com/iotaledger/twin-api/commit/6452b153af786eee14b21152420f8a2578b70593))
345
+ * use shared store mechanism ([#19](https://github.com/iotaledger/twin-api/issues/19)) ([32116df](https://github.com/iotaledger/twin-api/commit/32116df3b4380a30137f5056f242a5c99afa2df9))
346
+ * validationError mapped to http status badrequest ([adc5eb1](https://github.com/iotaledger/twin-api/commit/adc5eb11d987abb0ab9f7e0dc8e1fdae207e436e))
333
347
 
334
348
  ## 0.0.1 (2025-07-03)
335
349
 
336
350
 
337
351
  ### Features
338
352
 
339
- * release to production ([70ee2d5](https://github.com/twinfoundation/api/commit/70ee2d56a1dc9537d7c9c154d4cb78a235678a3a))
353
+ * release to production ([70ee2d5](https://github.com/iotaledger/twin-api/commit/70ee2d56a1dc9537d7c9c154d4cb78a235678a3a))
340
354
 
341
- ## [0.0.1-next.36](https://github.com/twinfoundation/api/compare/api-models-v0.0.1-next.35...api-models-v0.0.1-next.36) (2025-06-17)
355
+ ## [0.0.1-next.36](https://github.com/iotaledger/twin-api/compare/api-models-v0.0.1-next.35...api-models-v0.0.1-next.36) (2025-06-17)
342
356
 
343
357
 
344
358
  ### Features
345
359
 
346
- * use new includeStackTrace flag for toJsonObject ([6452b15](https://github.com/twinfoundation/api/commit/6452b153af786eee14b21152420f8a2578b70593))
360
+ * use new includeStackTrace flag for toJsonObject ([6452b15](https://github.com/iotaledger/twin-api/commit/6452b153af786eee14b21152420f8a2578b70593))
347
361
 
348
- ## [0.0.1-next.35](https://github.com/twinfoundation/api/compare/api-models-v0.0.1-next.34...api-models-v0.0.1-next.35) (2025-06-11)
362
+ ## [0.0.1-next.35](https://github.com/iotaledger/twin-api/compare/api-models-v0.0.1-next.34...api-models-v0.0.1-next.35) (2025-06-11)
349
363
 
350
364
 
351
365
  ### Features
352
366
 
353
- * update dependencies ([1171dc4](https://github.com/twinfoundation/api/commit/1171dc416a9481737f6a640e3cf30145768f37e9))
367
+ * update dependencies ([1171dc4](https://github.com/iotaledger/twin-api/commit/1171dc416a9481737f6a640e3cf30145768f37e9))
354
368
 
355
- ## [0.0.1-next.34](https://github.com/twinfoundation/api/compare/api-models-v0.0.1-next.33...api-models-v0.0.1-next.34) (2025-05-27)
369
+ ## [0.0.1-next.34](https://github.com/iotaledger/twin-api/compare/api-models-v0.0.1-next.33...api-models-v0.0.1-next.34) (2025-05-27)
356
370
 
357
371
 
358
372
  ### Features
359
373
 
360
- * validationError mapped to http status badrequest ([adc5eb1](https://github.com/twinfoundation/api/commit/adc5eb11d987abb0ab9f7e0dc8e1fdae207e436e))
374
+ * validationError mapped to http status badrequest ([adc5eb1](https://github.com/iotaledger/twin-api/commit/adc5eb11d987abb0ab9f7e0dc8e1fdae207e436e))
361
375
 
362
- ## [0.0.1-next.33](https://github.com/twinfoundation/api/compare/api-models-v0.0.1-next.32...api-models-v0.0.1-next.33) (2025-04-17)
376
+ ## [0.0.1-next.33](https://github.com/iotaledger/twin-api/compare/api-models-v0.0.1-next.32...api-models-v0.0.1-next.33) (2025-04-17)
363
377
 
364
378
 
365
379
  ### Features
366
380
 
367
- * use shared store mechanism ([#19](https://github.com/twinfoundation/api/issues/19)) ([32116df](https://github.com/twinfoundation/api/commit/32116df3b4380a30137f5056f242a5c99afa2df9))
381
+ * use shared store mechanism ([#19](https://github.com/iotaledger/twin-api/issues/19)) ([32116df](https://github.com/iotaledger/twin-api/commit/32116df3b4380a30137f5056f242a5c99afa2df9))
368
382
 
369
- ## [0.0.1-next.32](https://github.com/twinfoundation/api/compare/api-models-v0.0.1-next.31...api-models-v0.0.1-next.32) (2025-03-28)
383
+ ## [0.0.1-next.32](https://github.com/iotaledger/twin-api/compare/api-models-v0.0.1-next.31...api-models-v0.0.1-next.32) (2025-03-28)
370
384
 
371
385
 
372
386
  ### Miscellaneous Chores
package/docs/examples.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Models Examples
2
2
 
3
- These snippets show practical helpers for URL manipulation, request parameter conversion, and consistent error responses.
3
+ These snippets show practical helpers for URL manipulation, request parameter conversion, consistent error responses, and secure parameter encryption.
4
4
 
5
5
  ## HttpUrlHelper
6
6
 
@@ -61,3 +61,140 @@ try {
61
61
  console.log(mapped.error.message); // Error: Invalid request
62
62
  }
63
63
  ```
64
+
65
+ ## IHostingComponent
66
+
67
+ When working with the hosting component, you can encrypt and decrypt query parameters for secure transmission. The encryption mechanism automatically handles salt generation to prevent rainbow table attacks.
68
+
69
+ ```typescript
70
+ import type { IComponent, IHttpRequestQuery } from '@twin.org/api-models';
71
+ import { ComponentFactory } from '@twin.org/core';
72
+
73
+ interface IHostingComponent extends IComponent {
74
+ addEncryptedParamsToUrl(url: string, params: IHttpRequestQuery): Promise<string>;
75
+ getDecryptedParamsFromQueryParams(
76
+ queryParams: IHttpRequestQuery | undefined,
77
+ keys: string[]
78
+ ): Promise<IHttpRequestQuery>;
79
+ encryptParam(paramValue: string): Promise<string>;
80
+ decryptParam(encryptedValue: string): Promise<string>;
81
+ }
82
+
83
+ // Get the hosting component from the component factory
84
+ const hosting = ComponentFactory.get<IHostingComponent>('hosting');
85
+
86
+ // Encrypt parameters and add them to a URL
87
+ const baseUrl = 'https://api.example.com/callback';
88
+ const encrypted = await hosting.addEncryptedParamsToUrl(baseUrl, {
89
+ token: 'secret-token-123',
90
+ userId: 'user-456'
91
+ });
92
+ console.log(encrypted); // https://api.example.com/callback?x-enc-token=...&x-enc-userId=...
93
+ ```
94
+
95
+ ```typescript
96
+ import type { IHttpRequestQuery } from '@twin.org/api-models';
97
+ import { ComponentFactory } from '@twin.org/core';
98
+
99
+ interface IHostingComponent {
100
+ addEncryptedParamsToUrl(url: string, params: IHttpRequestQuery): Promise<string>;
101
+ getDecryptedParamsFromQueryParams(
102
+ queryParams: IHttpRequestQuery | undefined,
103
+ keys: string[]
104
+ ): Promise<IHttpRequestQuery>;
105
+ encryptQueryParams(
106
+ httpRequestQuery: IHttpRequestQuery | undefined,
107
+ keys: string[]
108
+ ): Promise<void>;
109
+ decryptQueryParams(
110
+ httpRequestQuery: IHttpRequestQuery | undefined,
111
+ keys: string[]
112
+ ): Promise<void>;
113
+ }
114
+
115
+ const hosting = ComponentFactory.get<IHostingComponent>('hosting');
116
+
117
+ // Decrypt specific parameters from a query object
118
+ const queryParams: IHttpRequestQuery = {
119
+ 'x-enc-token': 'CngBAgMEBQYH...',
120
+ 'x-enc-userId': 'CxgICSoLDAwN...',
121
+ status: 'active'
122
+ };
123
+
124
+ const decrypted = await hosting.getDecryptedParamsFromQueryParams(queryParams, ['token', 'userId']);
125
+ console.log(decrypted); // { token: 'secret-token-123', userId: 'user-456' }
126
+ ```
127
+
128
+ ```typescript
129
+ import type { IHttpRequestQuery } from '@twin.org/api-models';
130
+ import { ComponentFactory } from '@twin.org/core';
131
+
132
+ interface IHostingComponent {
133
+ addTenantTokenToUrl(url: string, tenantId: string): Promise<string>;
134
+ getTenantTokenFromQueryParams(
135
+ queryParams: IHttpRequestQuery | undefined
136
+ ): Promise<string | undefined>;
137
+ }
138
+
139
+ const hosting = ComponentFactory.get<IHostingComponent>('hosting');
140
+
141
+ // Add encrypted tenant token to a URL
142
+ const redirectUrl = 'https://tenant.example.com/dashboard';
143
+ const urlWithTenant = await hosting.addTenantTokenToUrl(
144
+ redirectUrl,
145
+ 'a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6'
146
+ );
147
+ console.log(urlWithTenant); // https://tenant.example.com/dashboard?x-enc-tenant-token=...
148
+ ```
149
+
150
+ ```typescript
151
+ import type { IHttpRequestQuery } from '@twin.org/api-models';
152
+ import { ComponentFactory } from '@twin.org/core';
153
+
154
+ interface IHostingComponent {
155
+ encryptQueryParams(
156
+ httpRequestQuery: IHttpRequestQuery | undefined,
157
+ keys: string[]
158
+ ): Promise<void>;
159
+ decryptQueryParams(
160
+ httpRequestQuery: IHttpRequestQuery | undefined,
161
+ keys: string[]
162
+ ): Promise<void>;
163
+ }
164
+
165
+ const hosting = ComponentFactory.get<IHostingComponent>('hosting');
166
+
167
+ // Encrypt specific query parameters in place
168
+ const query: IHttpRequestQuery = {
169
+ token: 'secret-123',
170
+ apiKey: 'key-456',
171
+ status: 'active'
172
+ };
173
+
174
+ await hosting.encryptQueryParams(query, ['token', 'apiKey']);
175
+ console.log(query); // { 'x-enc-token': '...', 'x-enc-apiKey': '...', status: 'active' }
176
+
177
+ // Decrypt the parameters back to their original keys
178
+ await hosting.decryptQueryParams(query, ['token', 'apiKey']);
179
+ console.log(query); // { token: 'secret-123', apiKey: 'key-456', status: 'active' }
180
+ ```
181
+
182
+ ```typescript
183
+ import { ComponentFactory } from '@twin.org/core';
184
+
185
+ interface IHostingComponent {
186
+ encryptParam(paramValue: string): Promise<string>;
187
+ decryptParam(encryptedValue: string): Promise<string>;
188
+ }
189
+
190
+ const hosting = ComponentFactory.get<IHostingComponent>('hosting');
191
+
192
+ // Encrypt a single parameter value
193
+ const plainText = 'confidential-data';
194
+ const encrypted = await hosting.encryptParam(plainText);
195
+ console.log(encrypted); // CngBAgMEBQYHCAkKCwwNDg8QERAh...
196
+
197
+ // Decrypt the parameter value
198
+ const decrypted = await hosting.decryptParam(encrypted);
199
+ console.log(decrypted); // confidential-data
200
+ ```
@@ -142,6 +142,34 @@ The combined parts.
142
142
 
143
143
  ***
144
144
 
145
+ ### encodeUriPathSegment() {#encodeuripathsegment}
146
+
147
+ > `static` **encodeUriPathSegment**(`segment`): `string`
148
+
149
+ Encode a single URL path segment per RFC 3986 §3.3.
150
+ Unlike encodeURIComponent, sub-delimiters ($ & + , ; =) and the colon and
151
+ at-sign characters that are valid unencoded in path segments are preserved.
152
+
153
+ #### Parameters
154
+
155
+ ##### segment
156
+
157
+ `string`
158
+
159
+ The raw path segment value to encode.
160
+
161
+ #### Returns
162
+
163
+ `string`
164
+
165
+ The percent-encoded path segment.
166
+
167
+ #### See
168
+
169
+ https://datatracker.ietf.org/doc/html/rfc3986#section-3.3
170
+
171
+ ***
172
+
145
173
  ### replaceOrigin() {#replaceorigin}
146
174
 
147
175
  > `static` **replaceOrigin**(`url`, `newOrigin?`): `string`
@@ -41,3 +41,51 @@ Timeout for requests in ms.
41
41
  > `optional` **includeCredentials?**: `boolean`
42
42
 
43
43
  Include credentials in the request, defaults to true.
44
+
45
+ ***
46
+
47
+ ### customHeaders? {#customheaders}
48
+
49
+ > `optional` **customHeaders?**: () => `Promise`\<`IHttpHeaders`\>
50
+
51
+ Hook to provide headers asynchronously.
52
+
53
+ #### Returns
54
+
55
+ `Promise`\<`IHttpHeaders`\>
56
+
57
+ A promise that resolves to the headers.
58
+
59
+ ***
60
+
61
+ ### customAuthHeader? {#customauthheader}
62
+
63
+ > `optional` **customAuthHeader?**: () => `Promise`\<`string`\>
64
+
65
+ Hook to provide an authorization header value asynchronously.
66
+
67
+ #### Returns
68
+
69
+ `Promise`\<`string`\>
70
+
71
+ A promise that resolves to the authorization header value.
72
+
73
+ ***
74
+
75
+ ### onAuthFailure? {#onauthfailure}
76
+
77
+ > `optional` **onAuthFailure?**: (`err`) => `Promise`\<`void`\>
78
+
79
+ Hook to handle authorization failures asynchronously.
80
+
81
+ #### Parameters
82
+
83
+ ##### err
84
+
85
+ `IError`
86
+
87
+ #### Returns
88
+
89
+ `Promise`\<`void`\>
90
+
91
+ A promise that resolves when the auth failure handling is complete.
@@ -71,3 +71,211 @@ The url to build upon the public origin.
71
71
  `Promise`\<`string`\>
72
72
 
73
73
  The full url based on the public origin.
74
+
75
+ ***
76
+
77
+ ### addEncryptedParamsToUrl() {#addencryptedparamstourl}
78
+
79
+ > **addEncryptedParamsToUrl**(`url`, `params`): `Promise`\<`string`\>
80
+
81
+ Add encrypted key/value pairs to a URL's query string.
82
+ Existing query parameters on the URL are preserved; the provided params are
83
+ merged in and then encrypted before being written back to the URL.
84
+
85
+ #### Parameters
86
+
87
+ ##### url
88
+
89
+ `string`
90
+
91
+ The base URL to add parameters to.
92
+
93
+ ##### params
94
+
95
+ [`IHttpRequestQuery`](IHttpRequestQuery.md)
96
+
97
+ The key/value pairs to encrypt and append.
98
+
99
+ #### Returns
100
+
101
+ `Promise`\<`string`\>
102
+
103
+ The URL with the encrypted parameters added.
104
+
105
+ ***
106
+
107
+ ### getDecryptedParamsFromQueryParams() {#getdecryptedparamsfromqueryparams}
108
+
109
+ > **getDecryptedParamsFromQueryParams**(`queryParams`, `keys`): `Promise`\<[`IHttpRequestQuery`](IHttpRequestQuery.md)\>
110
+
111
+ Decrypt specified keys from a query parameter object and return their plain-text values.
112
+
113
+ #### Parameters
114
+
115
+ ##### queryParams
116
+
117
+ [`IHttpRequestQuery`](IHttpRequestQuery.md) \| `undefined`
118
+
119
+ The HTTP request query containing the encrypted parameters.
120
+
121
+ ##### keys
122
+
123
+ `string`[]
124
+
125
+ The keys to decrypt.
126
+
127
+ #### Returns
128
+
129
+ `Promise`\<[`IHttpRequestQuery`](IHttpRequestQuery.md)\>
130
+
131
+ A map of the decrypted key/value pairs that were present.
132
+
133
+ ***
134
+
135
+ ### addTenantTokenToUrl() {#addtenanttokentourl}
136
+
137
+ > **addTenantTokenToUrl**(`url`, `tenantId`): `Promise`\<`string`\>
138
+
139
+ Encrypt the tenant id and append it as a query parameter to the given URL.
140
+
141
+ #### Parameters
142
+
143
+ ##### url
144
+
145
+ `string`
146
+
147
+ The URL to append the encrypted tenant token to.
148
+
149
+ ##### tenantId
150
+
151
+ `string`
152
+
153
+ The tenant identifier to encrypt and add.
154
+
155
+ #### Returns
156
+
157
+ `Promise`\<`string`\>
158
+
159
+ The URL with the encrypted tenant token added as a query parameter.
160
+
161
+ ***
162
+
163
+ ### getTenantTokenFromQueryParams() {#gettenanttokenfromqueryparams}
164
+
165
+ > **getTenantTokenFromQueryParams**(`queryParams`): `Promise`\<`string` \| `undefined`\>
166
+
167
+ Get the tenant token from the query parameters.
168
+
169
+ #### Parameters
170
+
171
+ ##### queryParams
172
+
173
+ [`IHttpRequestQuery`](IHttpRequestQuery.md) \| `undefined`
174
+
175
+ The HTTP request query containing the parameters.
176
+
177
+ #### Returns
178
+
179
+ `Promise`\<`string` \| `undefined`\>
180
+
181
+ The tenant token if it exists.
182
+
183
+ ***
184
+
185
+ ### encryptQueryParams() {#encryptqueryparams}
186
+
187
+ > **encryptQueryParams**(`httpRequestQuery`, `keys`): `Promise`\<`void`\>
188
+
189
+ Encrypt query parameters using the hosting component's encryption mechanism.
190
+
191
+ #### Parameters
192
+
193
+ ##### httpRequestQuery
194
+
195
+ [`IHttpRequestQuery`](IHttpRequestQuery.md) \| `undefined`
196
+
197
+ The HTTP request query containing the parameters to encrypt.
198
+
199
+ ##### keys
200
+
201
+ `string`[]
202
+
203
+ The keys of the parameters to encrypt.
204
+
205
+ #### Returns
206
+
207
+ `Promise`\<`void`\>
208
+
209
+ A promise that resolves when the query parameters have been encrypted.
210
+
211
+ ***
212
+
213
+ ### decryptQueryParams() {#decryptqueryparams}
214
+
215
+ > **decryptQueryParams**(`httpRequestQuery`, `keys`): `Promise`\<`void`\>
216
+
217
+ Decrypt query parameters using the hosting component's encryption mechanism.
218
+
219
+ #### Parameters
220
+
221
+ ##### httpRequestQuery
222
+
223
+ [`IHttpRequestQuery`](IHttpRequestQuery.md) \| `undefined`
224
+
225
+ The HTTP request query containing the encrypted values.
226
+
227
+ ##### keys
228
+
229
+ `string`[]
230
+
231
+ The keys of the parameters to decrypt.
232
+
233
+ #### Returns
234
+
235
+ `Promise`\<`void`\>
236
+
237
+ A promise that resolves when the query parameters have been decrypted.
238
+
239
+ ***
240
+
241
+ ### encryptParam() {#encryptparam}
242
+
243
+ > **encryptParam**(`paramValue`): `Promise`\<`string`\>
244
+
245
+ Encrypt a parameter value using the hosting component's encryption mechanism.
246
+
247
+ #### Parameters
248
+
249
+ ##### paramValue
250
+
251
+ `string`
252
+
253
+ The value of the parameter to encrypt.
254
+
255
+ #### Returns
256
+
257
+ `Promise`\<`string`\>
258
+
259
+ A promise that resolves to the encrypted value of the parameter.
260
+
261
+ ***
262
+
263
+ ### decryptParam() {#decryptparam}
264
+
265
+ > **decryptParam**(`encryptedValue`): `Promise`\<`string`\>
266
+
267
+ Decrypt a parameter value using the hosting component's encryption mechanism.
268
+
269
+ #### Parameters
270
+
271
+ ##### encryptedValue
272
+
273
+ `string`
274
+
275
+ The encrypted value of the parameter.
276
+
277
+ #### Returns
278
+
279
+ `Promise`\<`string`\>
280
+
281
+ A promise that resolves to the decrypted value of the parameter.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/api-models",
3
- "version": "0.0.3-next.27",
3
+ "version": "0.0.3-next.29",
4
4
  "description": "Shared API contracts, route types, and response models used across services and clients.",
5
5
  "repository": {
6
6
  "type": "git",