@twin.org/api-models 0.0.3-next.40 → 0.0.3-next.41

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.
@@ -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\";\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 * Check if the origin of the given url matches the node public origin or any tenant's public origin.\n\t * @param url The url whose origin to check.\n\t * @returns \"node\" for the node public origin, the tenant id for a tenant public origin, or undefined.\n\t */\n\tmatchesLocalOrigin(url: string): Promise<string | undefined>;\n}\n"]}
@@ -21,4 +21,10 @@ export interface IHostingComponent extends IComponent {
21
21
  * @returns The full url based on the public origin.
22
22
  */
23
23
  buildPublicUrl(url: string): Promise<string>;
24
+ /**
25
+ * Check if the origin of the given url matches the node public origin or any tenant's public origin.
26
+ * @param url The url whose origin to check.
27
+ * @returns "node" for the node public origin, the tenant id for a tenant public origin, or undefined.
28
+ */
29
+ matchesLocalOrigin(url: string): Promise<string | undefined>;
24
30
  }
package/docs/changelog.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.0.3-next.41](https://github.com/iotaledger/twin-api/compare/api-models-v0.0.3-next.40...api-models-v0.0.3-next.41) (2026-06-05)
4
+
5
+
6
+ ### Features
7
+
8
+ * matches local origin ([#148](https://github.com/iotaledger/twin-api/issues/148)) ([7f6d30c](https://github.com/iotaledger/twin-api/commit/7f6d30c4dd1fe699f6171c41251bb56b803934e5))
9
+
3
10
  ## [0.0.3-next.40](https://github.com/iotaledger/twin-api/compare/api-models-v0.0.3-next.39...api-models-v0.0.3-next.40) (2026-06-04)
4
11
 
5
12
 
@@ -71,3 +71,25 @@ 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
+ ### matchesLocalOrigin() {#matcheslocalorigin}
78
+
79
+ > **matchesLocalOrigin**(`url`): `Promise`\<`string` \| `undefined`\>
80
+
81
+ Check if the origin of the given url matches the node public origin or any tenant's public origin.
82
+
83
+ #### Parameters
84
+
85
+ ##### url
86
+
87
+ `string`
88
+
89
+ The url whose origin to check.
90
+
91
+ #### Returns
92
+
93
+ `Promise`\<`string` \| `undefined`\>
94
+
95
+ "node" for the node public origin, the tenant id for a tenant public origin, or undefined.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/api-models",
3
- "version": "0.0.3-next.40",
3
+ "version": "0.0.3-next.41",
4
4
  "description": "Shared API contracts, route types, and response models used across services and clients.",
5
5
  "repository": {
6
6
  "type": "git",