shoal-web-sdk 1.0.143 → 1.0.144

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,6 +1,6 @@
1
1
  import { type InfiniteData } from '@tanstack/react-query';
2
2
  import { type Options } from '../sdk.gen';
3
- import type { GetOverviewData, GetTenantSummaryData, ListActorActivityData, ListAuditBreakdownData, ListAuditsData, ListCostBreakdownData, ListCostOrganisationsData, ListDeploymentBreakdownData, ListDeploymentOrganisationsData, ListDeploymentsData, ListSignUpBreakdownData, ListTenantsData, ListUsersData } from '../types.gen';
3
+ import type { GetOverviewData, GetTenantSummaryData, ListActorActivityData, ListAuditBreakdownData, ListAuditsData, ListCostBreakdownData, ListCostOrganisationsData, ListDeploymentBreakdownData, ListDeploymentOrganisationsData, ListDeploymentsData, ListLiveRoutesData, ListSignUpBreakdownData, ListTenantsData, ListUsersData } from '../types.gen';
4
4
  export type QueryKey<TOptions extends Options> = [
5
5
  Pick<TOptions, 'baseUrl' | 'body' | 'headers' | 'path' | 'query'> & {
6
6
  _id: string;
@@ -103,6 +103,70 @@ export declare const getOverviewOptions: (options?: Options<GetOverviewData>) =>
103
103
  [dataTagErrorSymbol]: Error;
104
104
  };
105
105
  };
106
+ export declare const listLiveRoutesQueryKey: (options?: Options<ListLiveRoutesData>) => [Pick<Options<ListLiveRoutesData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
107
+ _id: string;
108
+ _infinite?: boolean;
109
+ tags?: ReadonlyArray<string>;
110
+ }];
111
+ /**
112
+ * List live subdomains and paths
113
+ *
114
+ * Returns a page of environments, most recently deployed first, each with the proxy and VM
115
+ * subdomains and the route paths of its latest succeeded deployment. Environments that never
116
+ * deployed successfully, or whose live version has no proxy or VM, are omitted. Pass `org`
117
+ * to limit the list to one space.
118
+ *
119
+ */
120
+ export declare const listLiveRoutesOptions: (options?: Options<ListLiveRoutesData>) => import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<import("../types.gen").PaginatedLiveEnvironments, Error, import("../types.gen").PaginatedLiveEnvironments, [Pick<Options<ListLiveRoutesData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
121
+ _id: string;
122
+ _infinite?: boolean;
123
+ tags?: ReadonlyArray<string>;
124
+ }]>, "queryFn"> & {
125
+ queryFn?: import("@tanstack/react-query").QueryFunction<import("../types.gen").PaginatedLiveEnvironments, [Pick<Options<ListLiveRoutesData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
126
+ _id: string;
127
+ _infinite?: boolean;
128
+ tags?: ReadonlyArray<string>;
129
+ }], never> | undefined;
130
+ } & {
131
+ queryKey: [Pick<Options<ListLiveRoutesData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
132
+ _id: string;
133
+ _infinite?: boolean;
134
+ tags?: ReadonlyArray<string>;
135
+ }] & {
136
+ [dataTagSymbol]: import("../types.gen").PaginatedLiveEnvironments;
137
+ [dataTagErrorSymbol]: Error;
138
+ };
139
+ };
140
+ export declare const listLiveRoutesInfiniteQueryKey: (options?: Options<ListLiveRoutesData>) => QueryKey<Options<ListLiveRoutesData>>;
141
+ /**
142
+ * List live subdomains and paths
143
+ *
144
+ * Returns a page of environments, most recently deployed first, each with the proxy and VM
145
+ * subdomains and the route paths of its latest succeeded deployment. Environments that never
146
+ * deployed successfully, or whose live version has no proxy or VM, are omitted. Pass `org`
147
+ * to limit the list to one space.
148
+ *
149
+ */
150
+ export declare const listLiveRoutesInfiniteOptions: (options?: Options<ListLiveRoutesData>) => import("@tanstack/react-query").UseInfiniteQueryOptions<import("../types.gen").PaginatedLiveEnvironments, import("../types.gen")._Error, InfiniteData<import("../types.gen").PaginatedLiveEnvironments, unknown>, QueryKey<Options<ListLiveRoutesData>>, number | Pick<Pick<Options<ListLiveRoutesData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
151
+ _id: string;
152
+ _infinite?: boolean;
153
+ tags?: ReadonlyArray<string>;
154
+ }, "query" | "body" | "headers" | "path">> & {
155
+ initialData: InfiniteData<import("../types.gen").PaginatedLiveEnvironments, number | Pick<Pick<Options<ListLiveRoutesData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
156
+ _id: string;
157
+ _infinite?: boolean;
158
+ tags?: ReadonlyArray<string>;
159
+ }, "query" | "body" | "headers" | "path">> | (() => InfiniteData<import("../types.gen").PaginatedLiveEnvironments, number | Pick<Pick<Options<ListLiveRoutesData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
160
+ _id: string;
161
+ _infinite?: boolean;
162
+ tags?: ReadonlyArray<string>;
163
+ }, "query" | "body" | "headers" | "path">>) | undefined;
164
+ } & {
165
+ queryKey: QueryKey<Options<ListLiveRoutesData>> & {
166
+ [dataTagSymbol]: InfiniteData<import("../types.gen").PaginatedLiveEnvironments, unknown>;
167
+ [dataTagErrorSymbol]: import("../types.gen")._Error;
168
+ };
169
+ };
106
170
  export declare const getTenantSummaryQueryKey: (options?: Options<GetTenantSummaryData>) => [Pick<Options<GetTenantSummaryData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
107
171
  _id: string;
108
172
  _infinite?: boolean;
@@ -1,7 +1,7 @@
1
1
  // This file is auto-generated by @hey-api/openapi-ts
2
2
  import { infiniteQueryOptions, queryOptions } from '@tanstack/react-query';
3
3
  import { client } from '../client.gen';
4
- import { getOverview, getTenantSummary, listActorActivity, listAuditBreakdown, listAudits, listCostBreakdown, listCostOrganisations, listDeploymentBreakdown, listDeploymentOrganisations, listDeployments, listSignUpBreakdown, listTenants, listUsers } from '../sdk.gen';
4
+ import { getOverview, getTenantSummary, listActorActivity, listAuditBreakdown, listAudits, listCostBreakdown, listCostOrganisations, listDeploymentBreakdown, listDeploymentOrganisations, listDeployments, listLiveRoutes, listSignUpBreakdown, listTenants, listUsers } from '../sdk.gen';
5
5
  const createQueryKey = (id, options, infinite, tags) => {
6
6
  const params = { _id: id, baseUrl: options?.baseUrl || (options?.client ?? client).getConfig().baseUrl };
7
7
  if (infinite) {
@@ -134,6 +134,63 @@ export const getOverviewOptions = (options) => {
134
134
  queryKey: getOverviewQueryKey(options)
135
135
  });
136
136
  };
137
+ export const listLiveRoutesQueryKey = (options) => createQueryKey('listLiveRoutes', options);
138
+ /**
139
+ * List live subdomains and paths
140
+ *
141
+ * Returns a page of environments, most recently deployed first, each with the proxy and VM
142
+ * subdomains and the route paths of its latest succeeded deployment. Environments that never
143
+ * deployed successfully, or whose live version has no proxy or VM, are omitted. Pass `org`
144
+ * to limit the list to one space.
145
+ *
146
+ */
147
+ export const listLiveRoutesOptions = (options) => {
148
+ return queryOptions({
149
+ queryFn: async ({ queryKey, signal }) => {
150
+ const { data } = await listLiveRoutes({
151
+ ...options,
152
+ ...queryKey[0],
153
+ signal,
154
+ throwOnError: true
155
+ });
156
+ return data;
157
+ },
158
+ queryKey: listLiveRoutesQueryKey(options)
159
+ });
160
+ };
161
+ export const listLiveRoutesInfiniteQueryKey = (options) => createQueryKey('listLiveRoutes', options, true);
162
+ /**
163
+ * List live subdomains and paths
164
+ *
165
+ * Returns a page of environments, most recently deployed first, each with the proxy and VM
166
+ * subdomains and the route paths of its latest succeeded deployment. Environments that never
167
+ * deployed successfully, or whose live version has no proxy or VM, are omitted. Pass `org`
168
+ * to limit the list to one space.
169
+ *
170
+ */
171
+ export const listLiveRoutesInfiniteOptions = (options) => {
172
+ return infiniteQueryOptions(
173
+ // @ts-ignore
174
+ {
175
+ queryFn: async ({ pageParam, queryKey, signal }) => {
176
+ // @ts-ignore
177
+ const page = typeof pageParam === 'object' ? pageParam : {
178
+ query: {
179
+ page: pageParam
180
+ }
181
+ };
182
+ const params = createInfiniteParams(queryKey, page);
183
+ const { data } = await listLiveRoutes({
184
+ ...options,
185
+ ...params,
186
+ signal,
187
+ throwOnError: true
188
+ });
189
+ return data;
190
+ },
191
+ queryKey: listLiveRoutesInfiniteQueryKey(options)
192
+ });
193
+ };
137
194
  export const getTenantSummaryQueryKey = (options) => createQueryKey('getTenantSummary', options);
138
195
  /**
139
196
  * Summarise tenants
@@ -1,5 +1,5 @@
1
1
  import type { Client, Options as Options2, TDataShape } from './client';
2
- import type { GetOverviewData, GetOverviewErrors, GetOverviewResponses, GetTenantSummaryData, GetTenantSummaryErrors, GetTenantSummaryResponses, ListActorActivityData, ListActorActivityErrors, ListActorActivityResponses, ListAuditBreakdownData, ListAuditBreakdownErrors, ListAuditBreakdownResponses, ListAuditsData, ListAuditsErrors, ListAuditsResponses, ListCostBreakdownData, ListCostBreakdownErrors, ListCostBreakdownResponses, ListCostOrganisationsData, ListCostOrganisationsErrors, ListCostOrganisationsResponses, ListDeploymentBreakdownData, ListDeploymentBreakdownErrors, ListDeploymentBreakdownResponses, ListDeploymentOrganisationsData, ListDeploymentOrganisationsErrors, ListDeploymentOrganisationsResponses, ListDeploymentsData, ListDeploymentsErrors, ListDeploymentsResponses, ListSignUpBreakdownData, ListSignUpBreakdownErrors, ListSignUpBreakdownResponses, ListTenantsData, ListTenantsErrors, ListTenantsResponses, ListUsersData, ListUsersErrors, ListUsersResponses } from './types.gen';
2
+ import type { GetOverviewData, GetOverviewErrors, GetOverviewResponses, GetTenantSummaryData, GetTenantSummaryErrors, GetTenantSummaryResponses, ListActorActivityData, ListActorActivityErrors, ListActorActivityResponses, ListAuditBreakdownData, ListAuditBreakdownErrors, ListAuditBreakdownResponses, ListAuditsData, ListAuditsErrors, ListAuditsResponses, ListCostBreakdownData, ListCostBreakdownErrors, ListCostBreakdownResponses, ListCostOrganisationsData, ListCostOrganisationsErrors, ListCostOrganisationsResponses, ListDeploymentBreakdownData, ListDeploymentBreakdownErrors, ListDeploymentBreakdownResponses, ListDeploymentOrganisationsData, ListDeploymentOrganisationsErrors, ListDeploymentOrganisationsResponses, ListDeploymentsData, ListDeploymentsErrors, ListDeploymentsResponses, ListLiveRoutesData, ListLiveRoutesErrors, ListLiveRoutesResponses, ListSignUpBreakdownData, ListSignUpBreakdownErrors, ListSignUpBreakdownResponses, ListTenantsData, ListTenantsErrors, ListTenantsResponses, ListUsersData, ListUsersErrors, ListUsersResponses } from './types.gen';
3
3
  export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = Options2<TData, ThrowOnError> & {
4
4
  /**
5
5
  * You can provide a client instance returned by `createClient()` instead of
@@ -31,6 +31,16 @@ export declare const listTenants: <ThrowOnError extends boolean = false>(options
31
31
  *
32
32
  */
33
33
  export declare const getOverview: <ThrowOnError extends boolean = false>(options?: Options<GetOverviewData, ThrowOnError>) => import("./client").RequestResult<GetOverviewResponses, GetOverviewErrors, ThrowOnError, "fields">;
34
+ /**
35
+ * List live subdomains and paths
36
+ *
37
+ * Returns a page of environments, most recently deployed first, each with the proxy and VM
38
+ * subdomains and the route paths of its latest succeeded deployment. Environments that never
39
+ * deployed successfully, or whose live version has no proxy or VM, are omitted. Pass `org`
40
+ * to limit the list to one space.
41
+ *
42
+ */
43
+ export declare const listLiveRoutes: <ThrowOnError extends boolean = false>(options?: Options<ListLiveRoutesData, ThrowOnError>) => import("./client").RequestResult<ListLiveRoutesResponses, ListLiveRoutesErrors, ThrowOnError, "fields">;
34
44
  /**
35
45
  * Summarise tenants
36
46
  *
@@ -40,6 +40,27 @@ export const getOverview = (options) => {
40
40
  ...options
41
41
  });
42
42
  };
43
+ /**
44
+ * List live subdomains and paths
45
+ *
46
+ * Returns a page of environments, most recently deployed first, each with the proxy and VM
47
+ * subdomains and the route paths of its latest succeeded deployment. Environments that never
48
+ * deployed successfully, or whose live version has no proxy or VM, are omitted. Pass `org`
49
+ * to limit the list to one space.
50
+ *
51
+ */
52
+ export const listLiveRoutes = (options) => {
53
+ return (options?.client ?? client).get({
54
+ security: [
55
+ {
56
+ scheme: 'bearer',
57
+ type: 'http'
58
+ }
59
+ ],
60
+ url: '/insights-engine/routes',
61
+ ...options
62
+ });
63
+ };
43
64
  /**
44
65
  * Summarise tenants
45
66
  *
@@ -515,6 +515,50 @@ export type Overview = {
515
515
  daily: Array<OverviewDay>;
516
516
  tenants: TenantSummary;
517
517
  };
518
+ export type LivePath = {
519
+ path: string;
520
+ /**
521
+ * The path the target receives instead, empty when not rewritten.
522
+ */
523
+ rewrite: string;
524
+ targetName: string;
525
+ targetType: string;
526
+ };
527
+ /**
528
+ * A proxy or VM node in the live version and the subdomain it serves. The frontend builds the hostname from the label and the proxy or VM domain of the environment it runs in.
529
+ */
530
+ export type LiveSubdomain = {
531
+ nodeName: string;
532
+ nodeType: 'proxy' | 'vm';
533
+ /**
534
+ * The subdomain label, empty when none is claimed.
535
+ */
536
+ label: string;
537
+ /**
538
+ * The active customer domain fronting the subdomain, empty when there is none.
539
+ */
540
+ customDomain: string;
541
+ paths: Array<LivePath>;
542
+ };
543
+ /**
544
+ * The subdomains and paths served by an environment's latest succeeded deployment.
545
+ */
546
+ export type LiveEnvironment = {
547
+ orgId: string;
548
+ spaceName: string;
549
+ environmentId: string;
550
+ environmentHandle: string;
551
+ projectHandle: string;
552
+ /**
553
+ * The environment's latest succeeded deployment.
554
+ */
555
+ deploymentId: string;
556
+ deployedAt: string;
557
+ subdomains: Array<LiveSubdomain>;
558
+ };
559
+ export type PaginatedLiveEnvironments = PaginatedResponse & {
560
+ data: Array<LiveEnvironment>;
561
+ };
518
562
  export type CostEnvironment = {
519
563
  id: string;
520
564
  handle: string;
@@ -745,6 +789,43 @@ export type GetOverviewResponses = {
745
789
  200: Overview;
746
790
  };
747
791
  export type GetOverviewResponse = GetOverviewResponses[keyof GetOverviewResponses];
792
+ export type ListLiveRoutesData = {
793
+ body?: never;
794
+ path?: never;
795
+ query?: {
796
+ /**
797
+ * An organisation id.
798
+ */
799
+ org?: string;
800
+ /**
801
+ * 1-based page index.
802
+ */
803
+ page?: number;
804
+ /**
805
+ * Items per page, clamped server side to at most 5000.
806
+ */
807
+ limit?: number;
808
+ };
809
+ url: '/insights-engine/routes';
810
+ };
811
+ export type ListLiveRoutesErrors = {
812
+ /**
813
+ * The request was rejected as invalid.
814
+ */
815
+ 400: _Error;
816
+ /**
817
+ * The service is not healthy.
818
+ */
819
+ 500: _Error;
820
+ };
821
+ export type ListLiveRoutesError = ListLiveRoutesErrors[keyof ListLiveRoutesErrors];
822
+ export type ListLiveRoutesResponses = {
823
+ /**
824
+ * A page of environments and their live routes.
825
+ */
826
+ 200: PaginatedLiveEnvironments;
827
+ };
828
+ export type ListLiveRoutesResponse = ListLiveRoutesResponses[keyof ListLiveRoutesResponses];
748
829
  export type GetTenantSummaryData = {
749
830
  body?: never;
750
831
  path?: never;
@@ -1381,6 +1381,89 @@ export declare const zOverview: z.ZodObject<{
1381
1381
  }, z.core.$strip>;
1382
1382
  }, z.core.$strip>;
1383
1383
  }, z.core.$strip>;
1384
+ export declare const zLivePath: z.ZodObject<{
1385
+ path: z.ZodString;
1386
+ rewrite: z.ZodString;
1387
+ targetName: z.ZodString;
1388
+ targetType: z.ZodString;
1389
+ }, z.core.$strip>;
1390
+ /**
1391
+ * A proxy or VM node in the live version and the subdomain it serves. The frontend builds the hostname from the label and the proxy or VM domain of the environment it runs in.
1392
+ */
1393
+ export declare const zLiveSubdomain: z.ZodObject<{
1394
+ nodeName: z.ZodString;
1395
+ nodeType: z.ZodEnum<{
1396
+ proxy: "proxy";
1397
+ vm: "vm";
1398
+ }>;
1399
+ label: z.ZodString;
1400
+ customDomain: z.ZodString;
1401
+ paths: z.ZodArray<z.ZodObject<{
1402
+ path: z.ZodString;
1403
+ rewrite: z.ZodString;
1404
+ targetName: z.ZodString;
1405
+ targetType: z.ZodString;
1406
+ }, z.core.$strip>>;
1407
+ }, z.core.$strip>;
1408
+ /**
1409
+ * The subdomains and paths served by an environment's latest succeeded deployment.
1410
+ */
1411
+ export declare const zLiveEnvironment: z.ZodObject<{
1412
+ orgId: z.ZodString;
1413
+ spaceName: z.ZodString;
1414
+ environmentId: z.ZodString;
1415
+ environmentHandle: z.ZodString;
1416
+ projectHandle: z.ZodString;
1417
+ deploymentId: z.ZodString;
1418
+ deployedAt: z.ZodISODateTime;
1419
+ subdomains: z.ZodArray<z.ZodObject<{
1420
+ nodeName: z.ZodString;
1421
+ nodeType: z.ZodEnum<{
1422
+ proxy: "proxy";
1423
+ vm: "vm";
1424
+ }>;
1425
+ label: z.ZodString;
1426
+ customDomain: z.ZodString;
1427
+ paths: z.ZodArray<z.ZodObject<{
1428
+ path: z.ZodString;
1429
+ rewrite: z.ZodString;
1430
+ targetName: z.ZodString;
1431
+ targetType: z.ZodString;
1432
+ }, z.core.$strip>>;
1433
+ }, z.core.$strip>>;
1434
+ }, z.core.$strip>;
1435
+ export declare const zPaginatedLiveEnvironments: z.ZodIntersection<z.ZodObject<{
1436
+ page: z.ZodInt;
1437
+ limit: z.ZodInt;
1438
+ total: z.ZodCoercedBigInt<unknown>;
1439
+ pages: z.ZodInt;
1440
+ data: z.ZodArray<z.ZodUnknown>;
1441
+ }, z.core.$strip>, z.ZodObject<{
1442
+ data: z.ZodArray<z.ZodObject<{
1443
+ orgId: z.ZodString;
1444
+ spaceName: z.ZodString;
1445
+ environmentId: z.ZodString;
1446
+ environmentHandle: z.ZodString;
1447
+ projectHandle: z.ZodString;
1448
+ deploymentId: z.ZodString;
1449
+ deployedAt: z.ZodISODateTime;
1450
+ subdomains: z.ZodArray<z.ZodObject<{
1451
+ nodeName: z.ZodString;
1452
+ nodeType: z.ZodEnum<{
1453
+ proxy: "proxy";
1454
+ vm: "vm";
1455
+ }>;
1456
+ label: z.ZodString;
1457
+ customDomain: z.ZodString;
1458
+ paths: z.ZodArray<z.ZodObject<{
1459
+ path: z.ZodString;
1460
+ rewrite: z.ZodString;
1461
+ targetName: z.ZodString;
1462
+ targetType: z.ZodString;
1463
+ }, z.core.$strip>>;
1464
+ }, z.core.$strip>>;
1465
+ }, z.core.$strip>>;
1466
+ }, z.core.$strip>>;
1384
1467
  export declare const zCostEnvironment: z.ZodObject<{
1385
1468
  id: z.ZodUUID;
1386
1469
  handle: z.ZodString;
@@ -2199,6 +2282,50 @@ export declare const zGetOverviewResponse: z.ZodObject<{
2199
2282
  }, z.core.$strip>;
2200
2283
  }, z.core.$strip>;
2201
2284
  }, z.core.$strip>;
2285
+ export declare const zListLiveRoutesData: z.ZodObject<{
2286
+ body: z.ZodOptional<z.ZodNever>;
2287
+ path: z.ZodOptional<z.ZodNever>;
2288
+ query: z.ZodOptional<z.ZodObject<{
2289
+ org: z.ZodOptional<z.ZodString>;
2290
+ page: z.ZodDefault<z.ZodOptional<z.ZodInt>>;
2291
+ limit: z.ZodDefault<z.ZodOptional<z.ZodInt>>;
2292
+ }, z.core.$strip>>;
2293
+ }, z.core.$strip>;
2294
+ /**
2295
+ * A page of environments and their live routes.
2296
+ */
2297
+ export declare const zListLiveRoutesResponse: z.ZodIntersection<z.ZodObject<{
2298
+ page: z.ZodInt;
2299
+ limit: z.ZodInt;
2300
+ total: z.ZodCoercedBigInt<unknown>;
2301
+ pages: z.ZodInt;
2302
+ data: z.ZodArray<z.ZodUnknown>;
2303
+ }, z.core.$strip>, z.ZodObject<{
2304
+ data: z.ZodArray<z.ZodObject<{
2305
+ orgId: z.ZodString;
2306
+ spaceName: z.ZodString;
2307
+ environmentId: z.ZodString;
2308
+ environmentHandle: z.ZodString;
2309
+ projectHandle: z.ZodString;
2310
+ deploymentId: z.ZodString;
2311
+ deployedAt: z.ZodISODateTime;
2312
+ subdomains: z.ZodArray<z.ZodObject<{
2313
+ nodeName: z.ZodString;
2314
+ nodeType: z.ZodEnum<{
2315
+ proxy: "proxy";
2316
+ vm: "vm";
2317
+ }>;
2318
+ label: z.ZodString;
2319
+ customDomain: z.ZodString;
2320
+ paths: z.ZodArray<z.ZodObject<{
2321
+ path: z.ZodString;
2322
+ rewrite: z.ZodString;
2323
+ targetName: z.ZodString;
2324
+ targetType: z.ZodString;
2325
+ }, z.core.$strip>>;
2326
+ }, z.core.$strip>>;
2327
+ }, z.core.$strip>>;
2328
+ }, z.core.$strip>>;
2202
2329
  export declare const zGetTenantSummaryData: z.ZodObject<{
2203
2330
  body: z.ZodOptional<z.ZodNever>;
2204
2331
  path: z.ZodOptional<z.ZodNever>;
@@ -412,6 +412,41 @@ export const zOverview = z.object({
412
412
  daily: z.array(zOverviewDay),
413
413
  tenants: zTenantSummary
414
414
  });
415
+ export const zLivePath = z.object({
416
+ path: z.string(),
417
+ rewrite: z.string(),
418
+ targetName: z.string(),
419
+ targetType: z.string()
420
+ });
421
+ /**
422
+ * A proxy or VM node in the live version and the subdomain it serves. The frontend builds the hostname from the label and the proxy or VM domain of the environment it runs in.
423
+ */
424
+ export const zLiveSubdomain = z.object({
425
+ nodeName: z.string(),
426
+ nodeType: z.enum([
427
+ 'proxy',
428
+ 'vm'
429
+ ]),
430
+ label: z.string(),
431
+ customDomain: z.string(),
432
+ paths: z.array(zLivePath)
433
+ });
434
+ /**
435
+ * The subdomains and paths served by an environment's latest succeeded deployment.
436
+ */
437
+ export const zLiveEnvironment = z.object({
438
+ orgId: z.string(),
439
+ spaceName: z.string(),
440
+ environmentId: z.string(),
441
+ environmentHandle: z.string(),
442
+ projectHandle: z.string(),
443
+ deploymentId: z.string(),
444
+ deployedAt: z.iso.datetime(),
445
+ subdomains: z.array(zLiveSubdomain)
446
+ });
447
+ export const zPaginatedLiveEnvironments = zPaginatedResponse.and(z.object({
448
+ data: z.array(zLiveEnvironment)
449
+ }));
415
450
  export const zCostEnvironment = z.object({
416
451
  id: z.uuid(),
417
452
  handle: z.string(),
@@ -611,6 +646,19 @@ export const zGetOverviewData = z.object({
611
646
  * The overview.
612
647
  */
613
648
  export const zGetOverviewResponse = zOverview;
649
+ export const zListLiveRoutesData = z.object({
650
+ body: z.optional(z.never()),
651
+ path: z.optional(z.never()),
652
+ query: z.optional(z.object({
653
+ org: z.optional(z.string()),
654
+ page: z.optional(z.int()).default(1),
655
+ limit: z.optional(z.int()).default(25)
656
+ }))
657
+ });
658
+ /**
659
+ * A page of environments and their live routes.
660
+ */
661
+ export const zListLiveRoutesResponse = zPaginatedLiveEnvironments;
614
662
  export const zGetTenantSummaryData = z.object({
615
663
  body: z.optional(z.never()),
616
664
  path: z.optional(z.never()),
@@ -1,4 +1,4 @@
1
- import { ListTenantsData, GetOverviewData, GetTenantSummaryData, ListUsersData, ListDeploymentsData, ListAuditsData, ListSignUpBreakdownData, ListActorActivityData, ListAuditBreakdownData, ListDeploymentOrganisationsData, ListDeploymentBreakdownData, ListCostOrganisationsData, ListCostBreakdownData } from "../../sdk/insights-engine/types.gen";
1
+ import { ListTenantsData, GetOverviewData, ListLiveRoutesData, GetTenantSummaryData, ListUsersData, ListDeploymentsData, ListAuditsData, ListSignUpBreakdownData, ListActorActivityData, ListAuditBreakdownData, ListDeploymentOrganisationsData, ListDeploymentBreakdownData, ListCostOrganisationsData, ListCostBreakdownData } from "../../sdk/insights-engine/types.gen";
2
2
  export declare const useListTenants: (options?: Omit<ListTenantsData, "url"> & {
3
3
  enabled?: boolean;
4
4
  }) => {
@@ -413,6 +413,213 @@ export declare const useGetOverview: (options?: Omit<GetOverviewData, "url"> & {
413
413
  headers: Record<string, string>;
414
414
  } | undefined>;
415
415
  };
416
+ export declare const useListLiveRoutes: (options?: Omit<ListLiveRoutesData, "url"> & {
417
+ enabled?: boolean;
418
+ }) => {
419
+ data: import("../../sdk/insights-engine/types.gen").PaginatedLiveEnvironments | undefined;
420
+ headers: Record<string, string> | undefined;
421
+ error: Error;
422
+ isError: true;
423
+ isPending: false;
424
+ isLoading: false;
425
+ isLoadingError: false;
426
+ isRefetchError: true;
427
+ isSuccess: false;
428
+ isPlaceholderData: false;
429
+ status: "error";
430
+ dataUpdatedAt: number;
431
+ errorUpdatedAt: number;
432
+ failureCount: number;
433
+ failureReason: Error | null;
434
+ errorUpdateCount: number;
435
+ isFetched: boolean;
436
+ isFetchedAfterMount: boolean;
437
+ isFetching: boolean;
438
+ isInitialLoading: boolean;
439
+ isPaused: boolean;
440
+ isRefetching: boolean;
441
+ isStale: boolean;
442
+ isEnabled: boolean;
443
+ refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<{
444
+ data: import("../../sdk/insights-engine/types.gen").PaginatedLiveEnvironments | undefined;
445
+ headers: Record<string, string>;
446
+ } | undefined, Error>>;
447
+ fetchStatus: import("@tanstack/react-query").FetchStatus;
448
+ promise: Promise<{
449
+ data: import("../../sdk/insights-engine/types.gen").PaginatedLiveEnvironments | undefined;
450
+ headers: Record<string, string>;
451
+ } | undefined>;
452
+ } | {
453
+ data: import("../../sdk/insights-engine/types.gen").PaginatedLiveEnvironments | undefined;
454
+ headers: Record<string, string> | undefined;
455
+ error: null;
456
+ isError: false;
457
+ isPending: false;
458
+ isLoading: false;
459
+ isLoadingError: false;
460
+ isRefetchError: false;
461
+ isSuccess: true;
462
+ isPlaceholderData: false;
463
+ status: "success";
464
+ dataUpdatedAt: number;
465
+ errorUpdatedAt: number;
466
+ failureCount: number;
467
+ failureReason: Error | null;
468
+ errorUpdateCount: number;
469
+ isFetched: boolean;
470
+ isFetchedAfterMount: boolean;
471
+ isFetching: boolean;
472
+ isInitialLoading: boolean;
473
+ isPaused: boolean;
474
+ isRefetching: boolean;
475
+ isStale: boolean;
476
+ isEnabled: boolean;
477
+ refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<{
478
+ data: import("../../sdk/insights-engine/types.gen").PaginatedLiveEnvironments | undefined;
479
+ headers: Record<string, string>;
480
+ } | undefined, Error>>;
481
+ fetchStatus: import("@tanstack/react-query").FetchStatus;
482
+ promise: Promise<{
483
+ data: import("../../sdk/insights-engine/types.gen").PaginatedLiveEnvironments | undefined;
484
+ headers: Record<string, string>;
485
+ } | undefined>;
486
+ } | {
487
+ data: import("../../sdk/insights-engine/types.gen").PaginatedLiveEnvironments | undefined;
488
+ headers: Record<string, string> | undefined;
489
+ error: Error;
490
+ isError: true;
491
+ isPending: false;
492
+ isLoading: false;
493
+ isLoadingError: true;
494
+ isRefetchError: false;
495
+ isSuccess: false;
496
+ isPlaceholderData: false;
497
+ status: "error";
498
+ dataUpdatedAt: number;
499
+ errorUpdatedAt: number;
500
+ failureCount: number;
501
+ failureReason: Error | null;
502
+ errorUpdateCount: number;
503
+ isFetched: boolean;
504
+ isFetchedAfterMount: boolean;
505
+ isFetching: boolean;
506
+ isInitialLoading: boolean;
507
+ isPaused: boolean;
508
+ isRefetching: boolean;
509
+ isStale: boolean;
510
+ isEnabled: boolean;
511
+ refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<{
512
+ data: import("../../sdk/insights-engine/types.gen").PaginatedLiveEnvironments | undefined;
513
+ headers: Record<string, string>;
514
+ } | undefined, Error>>;
515
+ fetchStatus: import("@tanstack/react-query").FetchStatus;
516
+ promise: Promise<{
517
+ data: import("../../sdk/insights-engine/types.gen").PaginatedLiveEnvironments | undefined;
518
+ headers: Record<string, string>;
519
+ } | undefined>;
520
+ } | {
521
+ data: import("../../sdk/insights-engine/types.gen").PaginatedLiveEnvironments | undefined;
522
+ headers: Record<string, string> | undefined;
523
+ error: null;
524
+ isError: false;
525
+ isPending: true;
526
+ isLoading: true;
527
+ isLoadingError: false;
528
+ isRefetchError: false;
529
+ isSuccess: false;
530
+ isPlaceholderData: false;
531
+ status: "pending";
532
+ dataUpdatedAt: number;
533
+ errorUpdatedAt: number;
534
+ failureCount: number;
535
+ failureReason: Error | null;
536
+ errorUpdateCount: number;
537
+ isFetched: boolean;
538
+ isFetchedAfterMount: boolean;
539
+ isFetching: boolean;
540
+ isInitialLoading: boolean;
541
+ isPaused: boolean;
542
+ isRefetching: boolean;
543
+ isStale: boolean;
544
+ isEnabled: boolean;
545
+ refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<{
546
+ data: import("../../sdk/insights-engine/types.gen").PaginatedLiveEnvironments | undefined;
547
+ headers: Record<string, string>;
548
+ } | undefined, Error>>;
549
+ fetchStatus: import("@tanstack/react-query").FetchStatus;
550
+ promise: Promise<{
551
+ data: import("../../sdk/insights-engine/types.gen").PaginatedLiveEnvironments | undefined;
552
+ headers: Record<string, string>;
553
+ } | undefined>;
554
+ } | {
555
+ data: import("../../sdk/insights-engine/types.gen").PaginatedLiveEnvironments | undefined;
556
+ headers: Record<string, string> | undefined;
557
+ error: null;
558
+ isError: false;
559
+ isPending: true;
560
+ isLoadingError: false;
561
+ isRefetchError: false;
562
+ isSuccess: false;
563
+ isPlaceholderData: false;
564
+ status: "pending";
565
+ dataUpdatedAt: number;
566
+ errorUpdatedAt: number;
567
+ failureCount: number;
568
+ failureReason: Error | null;
569
+ errorUpdateCount: number;
570
+ isFetched: boolean;
571
+ isFetchedAfterMount: boolean;
572
+ isFetching: boolean;
573
+ isLoading: boolean;
574
+ isInitialLoading: boolean;
575
+ isPaused: boolean;
576
+ isRefetching: boolean;
577
+ isStale: boolean;
578
+ isEnabled: boolean;
579
+ refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<{
580
+ data: import("../../sdk/insights-engine/types.gen").PaginatedLiveEnvironments | undefined;
581
+ headers: Record<string, string>;
582
+ } | undefined, Error>>;
583
+ fetchStatus: import("@tanstack/react-query").FetchStatus;
584
+ promise: Promise<{
585
+ data: import("../../sdk/insights-engine/types.gen").PaginatedLiveEnvironments | undefined;
586
+ headers: Record<string, string>;
587
+ } | undefined>;
588
+ } | {
589
+ data: import("../../sdk/insights-engine/types.gen").PaginatedLiveEnvironments | undefined;
590
+ headers: Record<string, string> | undefined;
591
+ isError: false;
592
+ error: null;
593
+ isPending: false;
594
+ isLoading: false;
595
+ isLoadingError: false;
596
+ isRefetchError: false;
597
+ isSuccess: true;
598
+ isPlaceholderData: true;
599
+ status: "success";
600
+ dataUpdatedAt: number;
601
+ errorUpdatedAt: number;
602
+ failureCount: number;
603
+ failureReason: Error | null;
604
+ errorUpdateCount: number;
605
+ isFetched: boolean;
606
+ isFetchedAfterMount: boolean;
607
+ isFetching: boolean;
608
+ isInitialLoading: boolean;
609
+ isPaused: boolean;
610
+ isRefetching: boolean;
611
+ isStale: boolean;
612
+ isEnabled: boolean;
613
+ refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<{
614
+ data: import("../../sdk/insights-engine/types.gen").PaginatedLiveEnvironments | undefined;
615
+ headers: Record<string, string>;
616
+ } | undefined, Error>>;
617
+ fetchStatus: import("@tanstack/react-query").FetchStatus;
618
+ promise: Promise<{
619
+ data: import("../../sdk/insights-engine/types.gen").PaginatedLiveEnvironments | undefined;
620
+ headers: Record<string, string>;
621
+ } | undefined>;
622
+ };
416
623
  export declare const useGetTenantSummary: (options?: Omit<GetTenantSummaryData, "url"> & {
417
624
  enabled?: boolean;
418
625
  }) => {
@@ -2,7 +2,7 @@
2
2
  import { useQuery } from "@tanstack/react-query";
3
3
  import { isPromise, headersToObject } from "../util";
4
4
  import { useToken } from "../../provider/token-provider";
5
- import { listTenants, getOverview, getTenantSummary, listUsers, listDeployments, listAudits, listSignUpBreakdown, listActorActivity, listAuditBreakdown, listDeploymentOrganisations, listDeploymentBreakdown, listCostOrganisations, listCostBreakdown } from "../../sdk/insights-engine/sdk.gen";
5
+ import { listTenants, getOverview, listLiveRoutes, getTenantSummary, listUsers, listDeployments, listAudits, listSignUpBreakdown, listActorActivity, listAuditBreakdown, listDeploymentOrganisations, listDeploymentBreakdown, listCostOrganisations, listCostBreakdown } from "../../sdk/insights-engine/sdk.gen";
6
6
  export const useListTenants = (options) => {
7
7
  const token = useToken();
8
8
  let { enabled, ...rest } = options || { enabled: true };
@@ -47,6 +47,28 @@ export const useGetOverview = (options) => {
47
47
  });
48
48
  return { ...query, data: query.data?.data, headers: query.data?.headers };
49
49
  };
50
+ export const useListLiveRoutes = (options) => {
51
+ const token = useToken();
52
+ let { enabled, ...rest } = options || { enabled: true };
53
+ const opts = { throwOnError: true, url: "/insights-engine/routes" };
54
+ const funcer = async () => {
55
+ const auth = isPromise(token) ? (await token) || "" : token || "";
56
+ if (isPromise(token) && !token)
57
+ return;
58
+ const res = await listLiveRoutes({ ...opts, ...rest, auth });
59
+ return { data: res.data, headers: headersToObject(res.response.headers) };
60
+ };
61
+ if (!token)
62
+ enabled = false;
63
+ const query = useQuery({
64
+ queryKey: ["insights-engine", "routes", options?.query ?? {}],
65
+ queryFn: funcer,
66
+ enabled,
67
+ retry: false,
68
+ staleTime: 600000
69
+ });
70
+ return { ...query, data: query.data?.data, headers: query.data?.headers };
71
+ };
50
72
  export const useGetTenantSummary = (options) => {
51
73
  const token = useToken();
52
74
  let { enabled, ...rest } = options || { enabled: true };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shoal-web-sdk",
3
- "version": "1.0.143",
3
+ "version": "1.0.144",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "build-hooks": "npx tsx tanstack-codegen/generator.ts",