@vrplatform/api 1.3.1-stage.4084 → 1.3.1-stage.4089

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.
@@ -2,6 +2,7 @@ import type { ApiClient } from './types';
2
2
  export * from './client';
3
3
  export * from './error';
4
4
  export type * from './generated/v1';
5
+ export * from './routing';
5
6
  export * from './sec';
6
7
  export * from './types';
7
8
  export type VRPlatformApi = ApiClient;
@@ -1,5 +1,6 @@
1
1
  export * from './client';
2
2
  export * from './error';
3
+ export * from './routing';
3
4
  export * from './sec';
4
5
  export * from './types';
5
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"src/","sources":["index.ts"],"names":[],"mappings":"AAEA,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AAExB,cAAc,OAAO,CAAC;AACtB,cAAc,SAAS,CAAC","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,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AAExB,cAAc,WAAW,CAAC;AAC1B,cAAc,OAAO,CAAC;AACtB,cAAc,SAAS,CAAC","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,10 @@
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
+ export declare function resolveTenantRouting({ connectionId, slug, tenantId, auth, ...apiClientOptions }: ApiClientOptions & {
6
+ connectionId?: string;
7
+ slug?: string;
8
+ tenantId?: string;
9
+ }): Promise<TenantRouting>;
10
+ export {};
@@ -0,0 +1,30 @@
1
+ import { useApiClient } from './client';
2
+ import { throwIfError } from './error';
3
+ export async function resolveTenantRouting({ connectionId, slug, tenantId, auth, ...apiClientOptions }) {
4
+ if (!connectionId && !slug && !tenantId) {
5
+ throw new Error('connectionId, slug, or tenantId is required');
6
+ }
7
+ const response = throwIfError(await useApiClient({
8
+ ...apiClientOptions,
9
+ auth: tenantId
10
+ ? () => {
11
+ const current = typeof auth === 'function' ? auth() : (auth ?? {});
12
+ return {
13
+ ...current,
14
+ tenantId,
15
+ };
16
+ }
17
+ : auth,
18
+ }).GET('/teams/resolve', {
19
+ params: {
20
+ query: slug ? { slug } : connectionId ? { connectionId } : {},
21
+ },
22
+ }));
23
+ return {
24
+ id: response.id,
25
+ slug: response.slug,
26
+ dataRegion: response.dataRegion,
27
+ apiBaseUrl: new URL(response.apiBaseUrl).toString().replace(/\/$/, ''),
28
+ };
29
+ }
30
+ //# sourceMappingURL=routing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"routing.js","sourceRoot":"src/","sources":["routing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAUvC,MAAM,CAAC,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,YAAY,CAC3B,MAAM,YAAY,CAAC;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\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"]}
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.3.1-stage.4084",
6
+ "version": "1.3.1-stage.4089",
7
7
  "description": "",
8
8
  "main": "build/main/index.js",
9
9
  "module": "build/module/index.js",
@@ -3423,7 +3423,7 @@ export interface paths {
3423
3423
  path?: never;
3424
3424
  cookie?: never;
3425
3425
  };
3426
- /** @description Resolve a team by slug */
3426
+ /** @description Resolve a team by slug, connection, or tenant-scoped auth */
3427
3427
  get: operations["getTeamsResolve"];
3428
3428
  put?: never;
3429
3429
  post?: never;
@@ -63182,8 +63182,9 @@ export interface operations {
63182
63182
  };
63183
63183
  getTeamsResolve: {
63184
63184
  parameters: {
63185
- query: {
63186
- slug: string;
63185
+ query?: {
63186
+ connectionId?: string;
63187
+ slug?: string;
63187
63188
  };
63188
63189
  header?: never;
63189
63190
  path?: never;
package/src/index.ts CHANGED
@@ -3,6 +3,7 @@ import type { ApiClient } from './types';
3
3
  export * from './client';
4
4
  export * from './error';
5
5
  export type * from './generated/v1';
6
+ export * from './routing';
6
7
  export * from './sec';
7
8
  export * from './types';
8
9
 
package/src/routing.ts ADDED
@@ -0,0 +1,52 @@
1
+ import { useApiClient } from './client';
2
+ import { throwIfError } from './error';
3
+ import type { ApiClientAuth, ResponseData } from './types';
4
+
5
+ export type TenantRouting = Pick<
6
+ ResponseData<'get:/teams/resolve'>,
7
+ 'id' | 'slug' | 'dataRegion' | 'apiBaseUrl'
8
+ >;
9
+
10
+ type ApiClientOptions = Parameters<typeof useApiClient>[0];
11
+
12
+ export async function resolveTenantRouting({
13
+ connectionId,
14
+ slug,
15
+ tenantId,
16
+ auth,
17
+ ...apiClientOptions
18
+ }: ApiClientOptions & {
19
+ connectionId?: string;
20
+ slug?: string;
21
+ tenantId?: string;
22
+ }): Promise<TenantRouting> {
23
+ if (!connectionId && !slug && !tenantId) {
24
+ throw new Error('connectionId, slug, or tenantId is required');
25
+ }
26
+
27
+ const response = throwIfError(
28
+ await useApiClient({
29
+ ...apiClientOptions,
30
+ auth: tenantId
31
+ ? () => {
32
+ const current = typeof auth === 'function' ? auth() : (auth ?? {});
33
+ return {
34
+ ...current,
35
+ tenantId,
36
+ } satisfies ApiClientAuth;
37
+ }
38
+ : auth,
39
+ }).GET('/teams/resolve', {
40
+ params: {
41
+ query: slug ? { slug } : connectionId ? { connectionId } : {},
42
+ },
43
+ })
44
+ );
45
+
46
+ return {
47
+ id: response.id,
48
+ slug: response.slug,
49
+ dataRegion: response.dataRegion,
50
+ apiBaseUrl: new URL(response.apiBaseUrl).toString().replace(/\/$/, ''),
51
+ };
52
+ }