shoal-web-sdk 1.0.142 → 1.0.143

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 { 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, 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;
@@ -70,6 +70,39 @@ export declare const listTenantsInfiniteOptions: (options?: Options<ListTenantsD
70
70
  [dataTagErrorSymbol]: import("../types.gen")._Error;
71
71
  };
72
72
  };
73
+ export declare const getOverviewQueryKey: (options?: Options<GetOverviewData>) => [Pick<Options<GetOverviewData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
74
+ _id: string;
75
+ _infinite?: boolean;
76
+ tags?: ReadonlyArray<string>;
77
+ }];
78
+ /**
79
+ * Get the dashboard overview
80
+ *
81
+ * Returns sign-ups, deployments, audit events and spend for the window, the same totals
82
+ * for the window of equal length just before it (omitted when `from` is not set), daily
83
+ * totals within the window, and the tenant summary. Replaces one request per series.
84
+ *
85
+ */
86
+ export declare const getOverviewOptions: (options?: Options<GetOverviewData>) => import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<import("../types.gen").Overview, Error, import("../types.gen").Overview, [Pick<Options<GetOverviewData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
87
+ _id: string;
88
+ _infinite?: boolean;
89
+ tags?: ReadonlyArray<string>;
90
+ }]>, "queryFn"> & {
91
+ queryFn?: import("@tanstack/react-query").QueryFunction<import("../types.gen").Overview, [Pick<Options<GetOverviewData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
92
+ _id: string;
93
+ _infinite?: boolean;
94
+ tags?: ReadonlyArray<string>;
95
+ }], never> | undefined;
96
+ } & {
97
+ queryKey: [Pick<Options<GetOverviewData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
98
+ _id: string;
99
+ _infinite?: boolean;
100
+ tags?: ReadonlyArray<string>;
101
+ }] & {
102
+ [dataTagSymbol]: import("../types.gen").Overview;
103
+ [dataTagErrorSymbol]: Error;
104
+ };
105
+ };
73
106
  export declare const getTenantSummaryQueryKey: (options?: Options<GetTenantSummaryData>) => [Pick<Options<GetTenantSummaryData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
74
107
  _id: string;
75
108
  _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 { 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, 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) {
@@ -111,6 +111,29 @@ export const listTenantsInfiniteOptions = (options) => {
111
111
  queryKey: listTenantsInfiniteQueryKey(options)
112
112
  });
113
113
  };
114
+ export const getOverviewQueryKey = (options) => createQueryKey('getOverview', options);
115
+ /**
116
+ * Get the dashboard overview
117
+ *
118
+ * Returns sign-ups, deployments, audit events and spend for the window, the same totals
119
+ * for the window of equal length just before it (omitted when `from` is not set), daily
120
+ * totals within the window, and the tenant summary. Replaces one request per series.
121
+ *
122
+ */
123
+ export const getOverviewOptions = (options) => {
124
+ return queryOptions({
125
+ queryFn: async ({ queryKey, signal }) => {
126
+ const { data } = await getOverview({
127
+ ...options,
128
+ ...queryKey[0],
129
+ signal,
130
+ throwOnError: true
131
+ });
132
+ return data;
133
+ },
134
+ queryKey: getOverviewQueryKey(options)
135
+ });
136
+ };
114
137
  export const getTenantSummaryQueryKey = (options) => createQueryKey('getTenantSummary', options);
115
138
  /**
116
139
  * Summarise tenants
@@ -1,5 +1,5 @@
1
1
  import type { Client, Options as Options2, TDataShape } from './client';
2
- import type { 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, 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
@@ -22,6 +22,15 @@ export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends
22
22
  *
23
23
  */
24
24
  export declare const listTenants: <ThrowOnError extends boolean = false>(options?: Options<ListTenantsData, ThrowOnError>) => import("./client").RequestResult<ListTenantsResponses, ListTenantsErrors, ThrowOnError, "fields">;
25
+ /**
26
+ * Get the dashboard overview
27
+ *
28
+ * Returns sign-ups, deployments, audit events and spend for the window, the same totals
29
+ * for the window of equal length just before it (omitted when `from` is not set), daily
30
+ * totals within the window, and the tenant summary. Replaces one request per series.
31
+ *
32
+ */
33
+ export declare const getOverview: <ThrowOnError extends boolean = false>(options?: Options<GetOverviewData, ThrowOnError>) => import("./client").RequestResult<GetOverviewResponses, GetOverviewErrors, ThrowOnError, "fields">;
25
34
  /**
26
35
  * Summarise tenants
27
36
  *
@@ -20,6 +20,26 @@ export const listTenants = (options) => {
20
20
  ...options
21
21
  });
22
22
  };
23
+ /**
24
+ * Get the dashboard overview
25
+ *
26
+ * Returns sign-ups, deployments, audit events and spend for the window, the same totals
27
+ * for the window of equal length just before it (omitted when `from` is not set), daily
28
+ * totals within the window, and the tenant summary. Replaces one request per series.
29
+ *
30
+ */
31
+ export const getOverview = (options) => {
32
+ return (options?.client ?? client).get({
33
+ security: [
34
+ {
35
+ scheme: 'bearer',
36
+ type: 'http'
37
+ }
38
+ ],
39
+ url: '/insights-engine/overview',
40
+ ...options
41
+ });
42
+ };
23
43
  /**
24
44
  * Summarise tenants
25
45
  *
@@ -492,6 +492,29 @@ export type TenantSummary = {
492
492
  transitions: Array<PlanTransition>;
493
493
  cohort: TenantCohort;
494
494
  };
495
+ export type OverviewTotals = {
496
+ signUps: number;
497
+ deployments: number;
498
+ succeededDeployments: number;
499
+ nodes: number;
500
+ audits: number;
501
+ cost: Cost;
502
+ };
503
+ export type OverviewDay = OverviewTotals & {
504
+ timestamp: string;
505
+ };
506
+ /**
507
+ * Totals for the window and for the window of the same length just before it, daily totals within the window, and the tenant summary. Each source is read once across both windows.
508
+ */
509
+ export type Overview = {
510
+ current: OverviewTotals;
511
+ previous?: OverviewTotals;
512
+ /**
513
+ * Oldest day first. Days with no activity are omitted.
514
+ */
515
+ daily: Array<OverviewDay>;
516
+ tenants: TenantSummary;
517
+ };
495
518
  export type CostEnvironment = {
496
519
  id: string;
497
520
  handle: string;
@@ -689,6 +712,39 @@ export type ListTenantsResponses = {
689
712
  200: PaginatedTenants;
690
713
  };
691
714
  export type ListTenantsResponse = ListTenantsResponses[keyof ListTenantsResponses];
715
+ export type GetOverviewData = {
716
+ body?: never;
717
+ path?: never;
718
+ query?: {
719
+ /**
720
+ * Start of the reporting window. Unbounded when omitted.
721
+ */
722
+ from?: string;
723
+ /**
724
+ * End of the reporting window. Unbounded when omitted.
725
+ */
726
+ to?: string;
727
+ };
728
+ url: '/insights-engine/overview';
729
+ };
730
+ export type GetOverviewErrors = {
731
+ /**
732
+ * The request was rejected as invalid.
733
+ */
734
+ 400: _Error;
735
+ /**
736
+ * The service is not healthy.
737
+ */
738
+ 500: _Error;
739
+ };
740
+ export type GetOverviewError = GetOverviewErrors[keyof GetOverviewErrors];
741
+ export type GetOverviewResponses = {
742
+ /**
743
+ * The overview.
744
+ */
745
+ 200: Overview;
746
+ };
747
+ export type GetOverviewResponse = GetOverviewResponses[keyof GetOverviewResponses];
692
748
  export type GetTenantSummaryData = {
693
749
  body?: never;
694
750
  path?: never;
@@ -1250,6 +1250,137 @@ export declare const zTenantSummary: z.ZodObject<{
1250
1250
  }, z.core.$strip>>;
1251
1251
  }, z.core.$strip>;
1252
1252
  }, z.core.$strip>;
1253
+ export declare const zOverviewTotals: z.ZodObject<{
1254
+ signUps: z.ZodCoercedBigInt<unknown>;
1255
+ deployments: z.ZodCoercedBigInt<unknown>;
1256
+ succeededDeployments: z.ZodCoercedBigInt<unknown>;
1257
+ nodes: z.ZodCoercedBigInt<unknown>;
1258
+ audits: z.ZodCoercedBigInt<unknown>;
1259
+ cost: z.ZodObject<{
1260
+ computeVms: z.ZodCoercedBigInt<unknown>;
1261
+ appHosting: z.ZodCoercedBigInt<unknown>;
1262
+ databaseStorage: z.ZodCoercedBigInt<unknown>;
1263
+ networkingSecurity: z.ZodCoercedBigInt<unknown>;
1264
+ observability: z.ZodCoercedBigInt<unknown>;
1265
+ platformServices: z.ZodCoercedBigInt<unknown>;
1266
+ aiMlApis: z.ZodCoercedBigInt<unknown>;
1267
+ marketplaceLicences: z.ZodCoercedBigInt<unknown>;
1268
+ infraOverhead: z.ZodCoercedBigInt<unknown>;
1269
+ totalNet: z.ZodCoercedBigInt<unknown>;
1270
+ }, z.core.$strip>;
1271
+ }, z.core.$strip>;
1272
+ export declare const zOverviewDay: z.ZodIntersection<z.ZodObject<{
1273
+ signUps: z.ZodCoercedBigInt<unknown>;
1274
+ deployments: z.ZodCoercedBigInt<unknown>;
1275
+ succeededDeployments: z.ZodCoercedBigInt<unknown>;
1276
+ nodes: z.ZodCoercedBigInt<unknown>;
1277
+ audits: z.ZodCoercedBigInt<unknown>;
1278
+ cost: z.ZodObject<{
1279
+ computeVms: z.ZodCoercedBigInt<unknown>;
1280
+ appHosting: z.ZodCoercedBigInt<unknown>;
1281
+ databaseStorage: z.ZodCoercedBigInt<unknown>;
1282
+ networkingSecurity: z.ZodCoercedBigInt<unknown>;
1283
+ observability: z.ZodCoercedBigInt<unknown>;
1284
+ platformServices: z.ZodCoercedBigInt<unknown>;
1285
+ aiMlApis: z.ZodCoercedBigInt<unknown>;
1286
+ marketplaceLicences: z.ZodCoercedBigInt<unknown>;
1287
+ infraOverhead: z.ZodCoercedBigInt<unknown>;
1288
+ totalNet: z.ZodCoercedBigInt<unknown>;
1289
+ }, z.core.$strip>;
1290
+ }, z.core.$strip>, z.ZodObject<{
1291
+ timestamp: z.ZodISODateTime;
1292
+ }, z.core.$strip>>;
1293
+ /**
1294
+ * Totals for the window and for the window of the same length just before it, daily totals within the window, and the tenant summary. Each source is read once across both windows.
1295
+ */
1296
+ export declare const zOverview: z.ZodObject<{
1297
+ current: z.ZodObject<{
1298
+ signUps: z.ZodCoercedBigInt<unknown>;
1299
+ deployments: z.ZodCoercedBigInt<unknown>;
1300
+ succeededDeployments: z.ZodCoercedBigInt<unknown>;
1301
+ nodes: z.ZodCoercedBigInt<unknown>;
1302
+ audits: z.ZodCoercedBigInt<unknown>;
1303
+ cost: z.ZodObject<{
1304
+ computeVms: z.ZodCoercedBigInt<unknown>;
1305
+ appHosting: z.ZodCoercedBigInt<unknown>;
1306
+ databaseStorage: z.ZodCoercedBigInt<unknown>;
1307
+ networkingSecurity: z.ZodCoercedBigInt<unknown>;
1308
+ observability: z.ZodCoercedBigInt<unknown>;
1309
+ platformServices: z.ZodCoercedBigInt<unknown>;
1310
+ aiMlApis: z.ZodCoercedBigInt<unknown>;
1311
+ marketplaceLicences: z.ZodCoercedBigInt<unknown>;
1312
+ infraOverhead: z.ZodCoercedBigInt<unknown>;
1313
+ totalNet: z.ZodCoercedBigInt<unknown>;
1314
+ }, z.core.$strip>;
1315
+ }, z.core.$strip>;
1316
+ previous: z.ZodOptional<z.ZodObject<{
1317
+ signUps: z.ZodCoercedBigInt<unknown>;
1318
+ deployments: z.ZodCoercedBigInt<unknown>;
1319
+ succeededDeployments: z.ZodCoercedBigInt<unknown>;
1320
+ nodes: z.ZodCoercedBigInt<unknown>;
1321
+ audits: z.ZodCoercedBigInt<unknown>;
1322
+ cost: z.ZodObject<{
1323
+ computeVms: z.ZodCoercedBigInt<unknown>;
1324
+ appHosting: z.ZodCoercedBigInt<unknown>;
1325
+ databaseStorage: z.ZodCoercedBigInt<unknown>;
1326
+ networkingSecurity: z.ZodCoercedBigInt<unknown>;
1327
+ observability: z.ZodCoercedBigInt<unknown>;
1328
+ platformServices: z.ZodCoercedBigInt<unknown>;
1329
+ aiMlApis: z.ZodCoercedBigInt<unknown>;
1330
+ marketplaceLicences: z.ZodCoercedBigInt<unknown>;
1331
+ infraOverhead: z.ZodCoercedBigInt<unknown>;
1332
+ totalNet: z.ZodCoercedBigInt<unknown>;
1333
+ }, z.core.$strip>;
1334
+ }, z.core.$strip>>;
1335
+ daily: z.ZodArray<z.ZodIntersection<z.ZodObject<{
1336
+ signUps: z.ZodCoercedBigInt<unknown>;
1337
+ deployments: z.ZodCoercedBigInt<unknown>;
1338
+ succeededDeployments: z.ZodCoercedBigInt<unknown>;
1339
+ nodes: z.ZodCoercedBigInt<unknown>;
1340
+ audits: z.ZodCoercedBigInt<unknown>;
1341
+ cost: z.ZodObject<{
1342
+ computeVms: z.ZodCoercedBigInt<unknown>;
1343
+ appHosting: z.ZodCoercedBigInt<unknown>;
1344
+ databaseStorage: z.ZodCoercedBigInt<unknown>;
1345
+ networkingSecurity: z.ZodCoercedBigInt<unknown>;
1346
+ observability: z.ZodCoercedBigInt<unknown>;
1347
+ platformServices: z.ZodCoercedBigInt<unknown>;
1348
+ aiMlApis: z.ZodCoercedBigInt<unknown>;
1349
+ marketplaceLicences: z.ZodCoercedBigInt<unknown>;
1350
+ infraOverhead: z.ZodCoercedBigInt<unknown>;
1351
+ totalNet: z.ZodCoercedBigInt<unknown>;
1352
+ }, z.core.$strip>;
1353
+ }, z.core.$strip>, z.ZodObject<{
1354
+ timestamp: z.ZodISODateTime;
1355
+ }, z.core.$strip>>>;
1356
+ tenants: z.ZodObject<{
1357
+ total: z.ZodCoercedBigInt<unknown>;
1358
+ states: z.ZodRecord<z.ZodString, z.ZodCoercedBigInt<unknown>>;
1359
+ plans: z.ZodRecord<z.ZodString, z.ZodCoercedBigInt<unknown>>;
1360
+ upgrades: z.ZodCoercedBigInt<unknown>;
1361
+ downgrades: z.ZodCoercedBigInt<unknown>;
1362
+ transitions: z.ZodArray<z.ZodObject<{
1363
+ from: z.ZodString;
1364
+ to: z.ZodString;
1365
+ change: z.ZodEnum<{
1366
+ upgrade: "upgrade";
1367
+ downgrade: "downgrade";
1368
+ }>;
1369
+ count: z.ZodCoercedBigInt<unknown>;
1370
+ }, z.core.$strip>>;
1371
+ cohort: z.ZodObject<{
1372
+ total: z.ZodCoercedBigInt<unknown>;
1373
+ states: z.ZodRecord<z.ZodString, z.ZodCoercedBigInt<unknown>>;
1374
+ plans: z.ZodRecord<z.ZodString, z.ZodCoercedBigInt<unknown>>;
1375
+ trialed: z.ZodCoercedBigInt<unknown>;
1376
+ trialStates: z.ZodRecord<z.ZodString, z.ZodCoercedBigInt<unknown>>;
1377
+ daily: z.ZodArray<z.ZodObject<{
1378
+ timestamp: z.ZodISODateTime;
1379
+ states: z.ZodRecord<z.ZodString, z.ZodCoercedBigInt<unknown>>;
1380
+ }, z.core.$strip>>;
1381
+ }, z.core.$strip>;
1382
+ }, z.core.$strip>;
1383
+ }, z.core.$strip>;
1253
1384
  export declare const zCostEnvironment: z.ZodObject<{
1254
1385
  id: z.ZodUUID;
1255
1386
  handle: z.ZodString;
@@ -1969,6 +2100,105 @@ export declare const zListTenantsResponse: z.ZodIntersection<z.ZodObject<{
1969
2100
  trialEndsAt: z.ZodOptional<z.ZodISODateTime>;
1970
2101
  }, z.core.$strip>>;
1971
2102
  }, z.core.$strip>>;
2103
+ export declare const zGetOverviewData: z.ZodObject<{
2104
+ body: z.ZodOptional<z.ZodNever>;
2105
+ path: z.ZodOptional<z.ZodNever>;
2106
+ query: z.ZodOptional<z.ZodObject<{
2107
+ from: z.ZodOptional<z.ZodISODateTime>;
2108
+ to: z.ZodOptional<z.ZodISODateTime>;
2109
+ }, z.core.$strip>>;
2110
+ }, z.core.$strip>;
2111
+ /**
2112
+ * The overview.
2113
+ */
2114
+ export declare const zGetOverviewResponse: z.ZodObject<{
2115
+ current: z.ZodObject<{
2116
+ signUps: z.ZodCoercedBigInt<unknown>;
2117
+ deployments: z.ZodCoercedBigInt<unknown>;
2118
+ succeededDeployments: z.ZodCoercedBigInt<unknown>;
2119
+ nodes: z.ZodCoercedBigInt<unknown>;
2120
+ audits: z.ZodCoercedBigInt<unknown>;
2121
+ cost: z.ZodObject<{
2122
+ computeVms: z.ZodCoercedBigInt<unknown>;
2123
+ appHosting: z.ZodCoercedBigInt<unknown>;
2124
+ databaseStorage: z.ZodCoercedBigInt<unknown>;
2125
+ networkingSecurity: z.ZodCoercedBigInt<unknown>;
2126
+ observability: z.ZodCoercedBigInt<unknown>;
2127
+ platformServices: z.ZodCoercedBigInt<unknown>;
2128
+ aiMlApis: z.ZodCoercedBigInt<unknown>;
2129
+ marketplaceLicences: z.ZodCoercedBigInt<unknown>;
2130
+ infraOverhead: z.ZodCoercedBigInt<unknown>;
2131
+ totalNet: z.ZodCoercedBigInt<unknown>;
2132
+ }, z.core.$strip>;
2133
+ }, z.core.$strip>;
2134
+ previous: z.ZodOptional<z.ZodObject<{
2135
+ signUps: z.ZodCoercedBigInt<unknown>;
2136
+ deployments: z.ZodCoercedBigInt<unknown>;
2137
+ succeededDeployments: z.ZodCoercedBigInt<unknown>;
2138
+ nodes: z.ZodCoercedBigInt<unknown>;
2139
+ audits: z.ZodCoercedBigInt<unknown>;
2140
+ cost: z.ZodObject<{
2141
+ computeVms: z.ZodCoercedBigInt<unknown>;
2142
+ appHosting: z.ZodCoercedBigInt<unknown>;
2143
+ databaseStorage: z.ZodCoercedBigInt<unknown>;
2144
+ networkingSecurity: z.ZodCoercedBigInt<unknown>;
2145
+ observability: z.ZodCoercedBigInt<unknown>;
2146
+ platformServices: z.ZodCoercedBigInt<unknown>;
2147
+ aiMlApis: z.ZodCoercedBigInt<unknown>;
2148
+ marketplaceLicences: z.ZodCoercedBigInt<unknown>;
2149
+ infraOverhead: z.ZodCoercedBigInt<unknown>;
2150
+ totalNet: z.ZodCoercedBigInt<unknown>;
2151
+ }, z.core.$strip>;
2152
+ }, z.core.$strip>>;
2153
+ daily: z.ZodArray<z.ZodIntersection<z.ZodObject<{
2154
+ signUps: z.ZodCoercedBigInt<unknown>;
2155
+ deployments: z.ZodCoercedBigInt<unknown>;
2156
+ succeededDeployments: z.ZodCoercedBigInt<unknown>;
2157
+ nodes: z.ZodCoercedBigInt<unknown>;
2158
+ audits: z.ZodCoercedBigInt<unknown>;
2159
+ cost: z.ZodObject<{
2160
+ computeVms: z.ZodCoercedBigInt<unknown>;
2161
+ appHosting: z.ZodCoercedBigInt<unknown>;
2162
+ databaseStorage: z.ZodCoercedBigInt<unknown>;
2163
+ networkingSecurity: z.ZodCoercedBigInt<unknown>;
2164
+ observability: z.ZodCoercedBigInt<unknown>;
2165
+ platformServices: z.ZodCoercedBigInt<unknown>;
2166
+ aiMlApis: z.ZodCoercedBigInt<unknown>;
2167
+ marketplaceLicences: z.ZodCoercedBigInt<unknown>;
2168
+ infraOverhead: z.ZodCoercedBigInt<unknown>;
2169
+ totalNet: z.ZodCoercedBigInt<unknown>;
2170
+ }, z.core.$strip>;
2171
+ }, z.core.$strip>, z.ZodObject<{
2172
+ timestamp: z.ZodISODateTime;
2173
+ }, z.core.$strip>>>;
2174
+ tenants: z.ZodObject<{
2175
+ total: z.ZodCoercedBigInt<unknown>;
2176
+ states: z.ZodRecord<z.ZodString, z.ZodCoercedBigInt<unknown>>;
2177
+ plans: z.ZodRecord<z.ZodString, z.ZodCoercedBigInt<unknown>>;
2178
+ upgrades: z.ZodCoercedBigInt<unknown>;
2179
+ downgrades: z.ZodCoercedBigInt<unknown>;
2180
+ transitions: z.ZodArray<z.ZodObject<{
2181
+ from: z.ZodString;
2182
+ to: z.ZodString;
2183
+ change: z.ZodEnum<{
2184
+ upgrade: "upgrade";
2185
+ downgrade: "downgrade";
2186
+ }>;
2187
+ count: z.ZodCoercedBigInt<unknown>;
2188
+ }, z.core.$strip>>;
2189
+ cohort: z.ZodObject<{
2190
+ total: z.ZodCoercedBigInt<unknown>;
2191
+ states: z.ZodRecord<z.ZodString, z.ZodCoercedBigInt<unknown>>;
2192
+ plans: z.ZodRecord<z.ZodString, z.ZodCoercedBigInt<unknown>>;
2193
+ trialed: z.ZodCoercedBigInt<unknown>;
2194
+ trialStates: z.ZodRecord<z.ZodString, z.ZodCoercedBigInt<unknown>>;
2195
+ daily: z.ZodArray<z.ZodObject<{
2196
+ timestamp: z.ZodISODateTime;
2197
+ states: z.ZodRecord<z.ZodString, z.ZodCoercedBigInt<unknown>>;
2198
+ }, z.core.$strip>>;
2199
+ }, z.core.$strip>;
2200
+ }, z.core.$strip>;
2201
+ }, z.core.$strip>;
1972
2202
  export declare const zGetTenantSummaryData: z.ZodObject<{
1973
2203
  body: z.ZodOptional<z.ZodNever>;
1974
2204
  path: z.ZodOptional<z.ZodNever>;
@@ -392,6 +392,26 @@ export const zTenantSummary = z.object({
392
392
  transitions: z.array(zPlanTransition),
393
393
  cohort: zTenantCohort
394
394
  });
395
+ export const zOverviewTotals = z.object({
396
+ signUps: z.coerce.bigint(),
397
+ deployments: z.coerce.bigint(),
398
+ succeededDeployments: z.coerce.bigint(),
399
+ nodes: z.coerce.bigint(),
400
+ audits: z.coerce.bigint(),
401
+ cost: zCost
402
+ });
403
+ export const zOverviewDay = zOverviewTotals.and(z.object({
404
+ timestamp: z.iso.datetime()
405
+ }));
406
+ /**
407
+ * Totals for the window and for the window of the same length just before it, daily totals within the window, and the tenant summary. Each source is read once across both windows.
408
+ */
409
+ export const zOverview = z.object({
410
+ current: zOverviewTotals,
411
+ previous: z.optional(zOverviewTotals),
412
+ daily: z.array(zOverviewDay),
413
+ tenants: zTenantSummary
414
+ });
395
415
  export const zCostEnvironment = z.object({
396
416
  id: z.uuid(),
397
417
  handle: z.string(),
@@ -579,6 +599,18 @@ export const zListTenantsData = z.object({
579
599
  * A page of tenants.
580
600
  */
581
601
  export const zListTenantsResponse = zPaginatedTenants;
602
+ export const zGetOverviewData = z.object({
603
+ body: z.optional(z.never()),
604
+ path: z.optional(z.never()),
605
+ query: z.optional(z.object({
606
+ from: z.optional(z.iso.datetime()),
607
+ to: z.optional(z.iso.datetime())
608
+ }))
609
+ });
610
+ /**
611
+ * The overview.
612
+ */
613
+ export const zGetOverviewResponse = zOverview;
582
614
  export const zGetTenantSummaryData = z.object({
583
615
  body: z.optional(z.never()),
584
616
  path: z.optional(z.never()),
@@ -1,4 +1,4 @@
1
- import { ListTenantsData, GetTenantSummaryData, ListUsersData, ListDeploymentsData, ListAuditsData, ListSignUpBreakdownData, ListActorActivityData, ListAuditBreakdownData, ListDeploymentOrganisationsData, ListDeploymentBreakdownData, ListCostOrganisationsData, ListCostBreakdownData } from "../../sdk/insights-engine/types.gen";
1
+ import { ListTenantsData, GetOverviewData, 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
  }) => {
@@ -206,6 +206,213 @@ export declare const useListTenants: (options?: Omit<ListTenantsData, "url"> & {
206
206
  headers: Record<string, string>;
207
207
  } | undefined>;
208
208
  };
209
+ export declare const useGetOverview: (options?: Omit<GetOverviewData, "url"> & {
210
+ enabled?: boolean;
211
+ }) => {
212
+ data: import("../../sdk/insights-engine/types.gen").Overview | undefined;
213
+ headers: Record<string, string> | undefined;
214
+ error: Error;
215
+ isError: true;
216
+ isPending: false;
217
+ isLoading: false;
218
+ isLoadingError: false;
219
+ isRefetchError: true;
220
+ isSuccess: false;
221
+ isPlaceholderData: false;
222
+ status: "error";
223
+ dataUpdatedAt: number;
224
+ errorUpdatedAt: number;
225
+ failureCount: number;
226
+ failureReason: Error | null;
227
+ errorUpdateCount: number;
228
+ isFetched: boolean;
229
+ isFetchedAfterMount: boolean;
230
+ isFetching: boolean;
231
+ isInitialLoading: boolean;
232
+ isPaused: boolean;
233
+ isRefetching: boolean;
234
+ isStale: boolean;
235
+ isEnabled: boolean;
236
+ refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<{
237
+ data: import("../../sdk/insights-engine/types.gen").Overview | undefined;
238
+ headers: Record<string, string>;
239
+ } | undefined, Error>>;
240
+ fetchStatus: import("@tanstack/react-query").FetchStatus;
241
+ promise: Promise<{
242
+ data: import("../../sdk/insights-engine/types.gen").Overview | undefined;
243
+ headers: Record<string, string>;
244
+ } | undefined>;
245
+ } | {
246
+ data: import("../../sdk/insights-engine/types.gen").Overview | undefined;
247
+ headers: Record<string, string> | undefined;
248
+ error: null;
249
+ isError: false;
250
+ isPending: false;
251
+ isLoading: false;
252
+ isLoadingError: false;
253
+ isRefetchError: false;
254
+ isSuccess: true;
255
+ isPlaceholderData: false;
256
+ status: "success";
257
+ dataUpdatedAt: number;
258
+ errorUpdatedAt: number;
259
+ failureCount: number;
260
+ failureReason: Error | null;
261
+ errorUpdateCount: number;
262
+ isFetched: boolean;
263
+ isFetchedAfterMount: boolean;
264
+ isFetching: boolean;
265
+ isInitialLoading: boolean;
266
+ isPaused: boolean;
267
+ isRefetching: boolean;
268
+ isStale: boolean;
269
+ isEnabled: boolean;
270
+ refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<{
271
+ data: import("../../sdk/insights-engine/types.gen").Overview | undefined;
272
+ headers: Record<string, string>;
273
+ } | undefined, Error>>;
274
+ fetchStatus: import("@tanstack/react-query").FetchStatus;
275
+ promise: Promise<{
276
+ data: import("../../sdk/insights-engine/types.gen").Overview | undefined;
277
+ headers: Record<string, string>;
278
+ } | undefined>;
279
+ } | {
280
+ data: import("../../sdk/insights-engine/types.gen").Overview | undefined;
281
+ headers: Record<string, string> | undefined;
282
+ error: Error;
283
+ isError: true;
284
+ isPending: false;
285
+ isLoading: false;
286
+ isLoadingError: true;
287
+ isRefetchError: false;
288
+ isSuccess: false;
289
+ isPlaceholderData: false;
290
+ status: "error";
291
+ dataUpdatedAt: number;
292
+ errorUpdatedAt: number;
293
+ failureCount: number;
294
+ failureReason: Error | null;
295
+ errorUpdateCount: number;
296
+ isFetched: boolean;
297
+ isFetchedAfterMount: boolean;
298
+ isFetching: boolean;
299
+ isInitialLoading: boolean;
300
+ isPaused: boolean;
301
+ isRefetching: boolean;
302
+ isStale: boolean;
303
+ isEnabled: boolean;
304
+ refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<{
305
+ data: import("../../sdk/insights-engine/types.gen").Overview | undefined;
306
+ headers: Record<string, string>;
307
+ } | undefined, Error>>;
308
+ fetchStatus: import("@tanstack/react-query").FetchStatus;
309
+ promise: Promise<{
310
+ data: import("../../sdk/insights-engine/types.gen").Overview | undefined;
311
+ headers: Record<string, string>;
312
+ } | undefined>;
313
+ } | {
314
+ data: import("../../sdk/insights-engine/types.gen").Overview | undefined;
315
+ headers: Record<string, string> | undefined;
316
+ error: null;
317
+ isError: false;
318
+ isPending: true;
319
+ isLoading: true;
320
+ isLoadingError: false;
321
+ isRefetchError: false;
322
+ isSuccess: false;
323
+ isPlaceholderData: false;
324
+ status: "pending";
325
+ dataUpdatedAt: number;
326
+ errorUpdatedAt: number;
327
+ failureCount: number;
328
+ failureReason: Error | null;
329
+ errorUpdateCount: number;
330
+ isFetched: boolean;
331
+ isFetchedAfterMount: boolean;
332
+ isFetching: boolean;
333
+ isInitialLoading: boolean;
334
+ isPaused: boolean;
335
+ isRefetching: boolean;
336
+ isStale: boolean;
337
+ isEnabled: boolean;
338
+ refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<{
339
+ data: import("../../sdk/insights-engine/types.gen").Overview | undefined;
340
+ headers: Record<string, string>;
341
+ } | undefined, Error>>;
342
+ fetchStatus: import("@tanstack/react-query").FetchStatus;
343
+ promise: Promise<{
344
+ data: import("../../sdk/insights-engine/types.gen").Overview | undefined;
345
+ headers: Record<string, string>;
346
+ } | undefined>;
347
+ } | {
348
+ data: import("../../sdk/insights-engine/types.gen").Overview | undefined;
349
+ headers: Record<string, string> | undefined;
350
+ error: null;
351
+ isError: false;
352
+ isPending: true;
353
+ isLoadingError: false;
354
+ isRefetchError: false;
355
+ isSuccess: false;
356
+ isPlaceholderData: false;
357
+ status: "pending";
358
+ dataUpdatedAt: number;
359
+ errorUpdatedAt: number;
360
+ failureCount: number;
361
+ failureReason: Error | null;
362
+ errorUpdateCount: number;
363
+ isFetched: boolean;
364
+ isFetchedAfterMount: boolean;
365
+ isFetching: boolean;
366
+ isLoading: boolean;
367
+ isInitialLoading: boolean;
368
+ isPaused: boolean;
369
+ isRefetching: boolean;
370
+ isStale: boolean;
371
+ isEnabled: boolean;
372
+ refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<{
373
+ data: import("../../sdk/insights-engine/types.gen").Overview | undefined;
374
+ headers: Record<string, string>;
375
+ } | undefined, Error>>;
376
+ fetchStatus: import("@tanstack/react-query").FetchStatus;
377
+ promise: Promise<{
378
+ data: import("../../sdk/insights-engine/types.gen").Overview | undefined;
379
+ headers: Record<string, string>;
380
+ } | undefined>;
381
+ } | {
382
+ data: import("../../sdk/insights-engine/types.gen").Overview | undefined;
383
+ headers: Record<string, string> | undefined;
384
+ isError: false;
385
+ error: null;
386
+ isPending: false;
387
+ isLoading: false;
388
+ isLoadingError: false;
389
+ isRefetchError: false;
390
+ isSuccess: true;
391
+ isPlaceholderData: true;
392
+ status: "success";
393
+ dataUpdatedAt: number;
394
+ errorUpdatedAt: number;
395
+ failureCount: number;
396
+ failureReason: Error | null;
397
+ errorUpdateCount: number;
398
+ isFetched: boolean;
399
+ isFetchedAfterMount: boolean;
400
+ isFetching: boolean;
401
+ isInitialLoading: boolean;
402
+ isPaused: boolean;
403
+ isRefetching: boolean;
404
+ isStale: boolean;
405
+ isEnabled: boolean;
406
+ refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<{
407
+ data: import("../../sdk/insights-engine/types.gen").Overview | undefined;
408
+ headers: Record<string, string>;
409
+ } | undefined, Error>>;
410
+ fetchStatus: import("@tanstack/react-query").FetchStatus;
411
+ promise: Promise<{
412
+ data: import("../../sdk/insights-engine/types.gen").Overview | undefined;
413
+ headers: Record<string, string>;
414
+ } | undefined>;
415
+ };
209
416
  export declare const useGetTenantSummary: (options?: Omit<GetTenantSummaryData, "url"> & {
210
417
  enabled?: boolean;
211
418
  }) => {
@@ -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, getTenantSummary, listUsers, listDeployments, listAudits, listSignUpBreakdown, listActorActivity, listAuditBreakdown, listDeploymentOrganisations, listDeploymentBreakdown, listCostOrganisations, listCostBreakdown } from "../../sdk/insights-engine/sdk.gen";
5
+ import { listTenants, getOverview, 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 };
@@ -25,6 +25,28 @@ export const useListTenants = (options) => {
25
25
  });
26
26
  return { ...query, data: query.data?.data, headers: query.data?.headers };
27
27
  };
28
+ export const useGetOverview = (options) => {
29
+ const token = useToken();
30
+ let { enabled, ...rest } = options || { enabled: true };
31
+ const opts = { throwOnError: true, url: "/insights-engine/overview" };
32
+ const funcer = async () => {
33
+ const auth = isPromise(token) ? (await token) || "" : token || "";
34
+ if (isPromise(token) && !token)
35
+ return;
36
+ const res = await getOverview({ ...opts, ...rest, auth });
37
+ return { data: res.data, headers: headersToObject(res.response.headers) };
38
+ };
39
+ if (!token)
40
+ enabled = false;
41
+ const query = useQuery({
42
+ queryKey: ["insights-engine", "overview", options?.query ?? {}],
43
+ queryFn: funcer,
44
+ enabled,
45
+ retry: false,
46
+ staleTime: 600000
47
+ });
48
+ return { ...query, data: query.data?.data, headers: query.data?.headers };
49
+ };
28
50
  export const useGetTenantSummary = (options) => {
29
51
  const token = useToken();
30
52
  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.142",
3
+ "version": "1.0.143",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "build-hooks": "npx tsx tanstack-codegen/generator.ts",