@vrplatform/api 1.3.1-4163 → 1.3.1-4245
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 +9983 -3
- package/build/main/generated/v1.js.map +1 -1
- package/build/main/index.d.ts +1 -0
- package/build/main/index.js +1 -0
- package/build/main/index.js.map +1 -1
- package/build/main/routing.d.ts +17 -0
- package/build/main/routing.js +40 -0
- package/build/main/routing.js.map +1 -0
- package/build/module/generated/v1.d.ts +9983 -3
- package/build/module/generated/v1.js.map +1 -1
- package/build/module/index.d.ts +1 -0
- package/build/module/index.js +1 -0
- package/build/module/index.js.map +1 -1
- package/build/module/routing.d.ts +17 -0
- package/build/module/routing.js +37 -0
- package/build/module/routing.js.map +1 -0
- package/package.json +1 -1
- package/src/generated/v1.ts +9983 -3
- package/src/index.ts +1 -0
- package/src/routing.ts +59 -0
package/build/main/index.d.ts
CHANGED
package/build/main/index.js
CHANGED
|
@@ -16,6 +16,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./client"), exports);
|
|
18
18
|
__exportStar(require("./error"), exports);
|
|
19
|
+
__exportStar(require("./routing"), exports);
|
|
19
20
|
__exportStar(require("./sec"), exports);
|
|
20
21
|
__exportStar(require("./types"), exports);
|
|
21
22
|
//# sourceMappingURL=index.js.map
|
package/build/main/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"src/","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAEA,2CAAyB;AACzB,0CAAwB;AAExB,wCAAsB;AACtB,0CAAwB","sourcesContent":["import type { ApiClient } from './types';\n\nexport * from './client';\nexport * from './error';\nexport type * from './generated/v1';\nexport * from './sec';\nexport * from './types';\n\nexport type VRPlatformApi = ApiClient;\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"src/","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAEA,2CAAyB;AACzB,0CAAwB;AAExB,4CAA0B;AAC1B,wCAAsB;AACtB,0CAAwB","sourcesContent":["import type { ApiClient } from './types';\n\nexport * from './client';\nexport * from './error';\nexport type * from './generated/v1';\nexport * from './routing';\nexport * from './sec';\nexport * from './types';\n\nexport type VRPlatformApi = ApiClient;\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { useApiClient } from './client';
|
|
2
|
+
import type { ResponseData } from './types';
|
|
3
|
+
export type TenantRouting = Pick<ResponseData<'get:/teams/resolve'>, 'id' | 'slug' | 'dataRegion' | 'apiBaseUrl'>;
|
|
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
|
+
*/
|
|
12
|
+
export declare function resolveTenantRouting({ connectionId, slug, tenantId, auth, ...apiClientOptions }: ApiClientOptions & {
|
|
13
|
+
connectionId?: string;
|
|
14
|
+
slug?: string;
|
|
15
|
+
tenantId?: string;
|
|
16
|
+
}): Promise<TenantRouting>;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveTenantRouting = resolveTenantRouting;
|
|
4
|
+
const client_1 = require("./client");
|
|
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
|
+
*/
|
|
13
|
+
async function resolveTenantRouting({ connectionId, slug, tenantId, auth, ...apiClientOptions }) {
|
|
14
|
+
if (!connectionId && !slug && !tenantId) {
|
|
15
|
+
throw new Error('connectionId, slug, or tenantId is required');
|
|
16
|
+
}
|
|
17
|
+
const response = (0, error_1.throwIfError)(await (0, client_1.useApiClient)({
|
|
18
|
+
...apiClientOptions,
|
|
19
|
+
auth: tenantId
|
|
20
|
+
? () => {
|
|
21
|
+
const current = typeof auth === 'function' ? auth() : (auth ?? {});
|
|
22
|
+
return {
|
|
23
|
+
...current,
|
|
24
|
+
tenantId,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
: auth,
|
|
28
|
+
}).GET('/teams/resolve', {
|
|
29
|
+
params: {
|
|
30
|
+
query: slug ? { slug } : connectionId ? { connectionId } : {},
|
|
31
|
+
},
|
|
32
|
+
}));
|
|
33
|
+
return {
|
|
34
|
+
id: response.id,
|
|
35
|
+
slug: response.slug,
|
|
36
|
+
dataRegion: response.dataRegion,
|
|
37
|
+
apiBaseUrl: new URL(response.apiBaseUrl).toString().replace(/\/$/, ''),
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=routing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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"]}
|