@vrplatform/api 1.3.1-stage.4133 → 1.3.1-stage.4140
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/main/generated/v1.d.ts +692 -10
- package/build/main/generated/v1.js.map +1 -1
- package/build/main/routing.d.ts +7 -0
- package/build/main/routing.js +7 -0
- package/build/main/routing.js.map +1 -1
- package/build/module/generated/v1.d.ts +692 -10
- package/build/module/generated/v1.js.map +1 -1
- package/build/module/routing.d.ts +7 -0
- package/build/module/routing.js +7 -0
- package/build/module/routing.js.map +1 -1
- package/package.json +1 -1
- package/src/generated/v1.ts +692 -10
- package/src/routing.ts +7 -0
package/build/main/routing.d.ts
CHANGED
|
@@ -2,6 +2,13 @@ import { useApiClient } from './client';
|
|
|
2
2
|
import type { ResponseData } from './types';
|
|
3
3
|
export type TenantRouting = Pick<ResponseData<'get:/teams/resolve'>, 'id' | 'slug' | 'dataRegion' | 'apiBaseUrl'>;
|
|
4
4
|
type ApiClientOptions = Parameters<typeof useApiClient>[0];
|
|
5
|
+
/**
|
|
6
|
+
* Resolve a tenant's region and regional `apiBaseUrl` from a connection id,
|
|
7
|
+
* slug, or tenant id — the client entry point for non-API runtimes that need
|
|
8
|
+
* to reach a tenant's home region. Each call is a `/teams/resolve` round trip;
|
|
9
|
+
* hot-loop callers should cache the result (placement changes only on an
|
|
10
|
+
* explicit tenant migration).
|
|
11
|
+
*/
|
|
5
12
|
export declare function resolveTenantRouting({ connectionId, slug, tenantId, auth, ...apiClientOptions }: ApiClientOptions & {
|
|
6
13
|
connectionId?: string;
|
|
7
14
|
slug?: string;
|
package/build/main/routing.js
CHANGED
|
@@ -3,6 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.resolveTenantRouting = resolveTenantRouting;
|
|
4
4
|
const client_1 = require("./client");
|
|
5
5
|
const error_1 = require("./error");
|
|
6
|
+
/**
|
|
7
|
+
* Resolve a tenant's region and regional `apiBaseUrl` from a connection id,
|
|
8
|
+
* slug, or tenant id — the client entry point for non-API runtimes that need
|
|
9
|
+
* to reach a tenant's home region. Each call is a `/teams/resolve` round trip;
|
|
10
|
+
* hot-loop callers should cache the result (placement changes only on an
|
|
11
|
+
* explicit tenant migration).
|
|
12
|
+
*/
|
|
6
13
|
async function resolveTenantRouting({ connectionId, slug, tenantId, auth, ...apiClientOptions }) {
|
|
7
14
|
if (!connectionId && !slug && !tenantId) {
|
|
8
15
|
throw new Error('connectionId, slug, or tenantId is required');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routing.js","sourceRoot":"src/","sources":["routing.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"routing.js","sourceRoot":"src/","sources":["routing.ts"],"names":[],"mappings":";;AAkBA,oDAwCC;AA1DD,qCAAwC;AACxC,mCAAuC;AAUvC;;;;;;GAMG;AACI,KAAK,UAAU,oBAAoB,CAAC,EACzC,YAAY,EACZ,IAAI,EACJ,QAAQ,EACR,IAAI,EACJ,GAAG,gBAAgB,EAKpB;IACC,IAAI,CAAC,YAAY,IAAI,CAAC,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;QACxC,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;IACjE,CAAC;IAED,MAAM,QAAQ,GAAG,IAAA,oBAAY,EAC3B,MAAM,IAAA,qBAAY,EAAC;QACjB,GAAG,gBAAgB;QACnB,IAAI,EAAE,QAAQ;YACZ,CAAC,CAAC,GAAG,EAAE;gBACH,MAAM,OAAO,GAAG,OAAO,IAAI,KAAK,UAAU,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC;gBACnE,OAAO;oBACL,GAAG,OAAO;oBACV,QAAQ;iBACe,CAAC;YAC5B,CAAC;YACH,CAAC,CAAC,IAAI;KACT,CAAC,CAAC,GAAG,CAAC,gBAAgB,EAAE;QACvB,MAAM,EAAE;YACN,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE;SAC9D;KACF,CAAC,CACH,CAAC;IAEF,OAAO;QACL,EAAE,EAAE,QAAQ,CAAC,EAAE;QACf,IAAI,EAAE,QAAQ,CAAC,IAAI;QACnB,UAAU,EAAE,QAAQ,CAAC,UAAU;QAC/B,UAAU,EAAE,IAAI,GAAG,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;KACvE,CAAC;AACJ,CAAC","sourcesContent":["import { useApiClient } from './client';\nimport { throwIfError } from './error';\nimport type { ApiClientAuth, ResponseData } from './types';\n\nexport type TenantRouting = Pick<\n ResponseData<'get:/teams/resolve'>,\n 'id' | 'slug' | 'dataRegion' | 'apiBaseUrl'\n>;\n\ntype ApiClientOptions = Parameters<typeof useApiClient>[0];\n\n/**\n * Resolve a tenant's region and regional `apiBaseUrl` from a connection id,\n * slug, or tenant id — the client entry point for non-API runtimes that need\n * to reach a tenant's home region. Each call is a `/teams/resolve` round trip;\n * hot-loop callers should cache the result (placement changes only on an\n * explicit tenant migration).\n */\nexport async function resolveTenantRouting({\n connectionId,\n slug,\n tenantId,\n auth,\n ...apiClientOptions\n}: ApiClientOptions & {\n connectionId?: string;\n slug?: string;\n tenantId?: string;\n}): Promise<TenantRouting> {\n if (!connectionId && !slug && !tenantId) {\n throw new Error('connectionId, slug, or tenantId is required');\n }\n\n const response = throwIfError(\n await useApiClient({\n ...apiClientOptions,\n auth: tenantId\n ? () => {\n const current = typeof auth === 'function' ? auth() : (auth ?? {});\n return {\n ...current,\n tenantId,\n } satisfies ApiClientAuth;\n }\n : auth,\n }).GET('/teams/resolve', {\n params: {\n query: slug ? { slug } : connectionId ? { connectionId } : {},\n },\n })\n );\n\n return {\n id: response.id,\n slug: response.slug,\n dataRegion: response.dataRegion,\n apiBaseUrl: new URL(response.apiBaseUrl).toString().replace(/\\/$/, ''),\n };\n}\n"]}
|