@elevasis/ui 1.4.0 → 1.6.0

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.
Files changed (56) hide show
  1. package/dist/{CoreAuthKitInner-3J4RVQO6.js → CoreAuthKitInner-Y6LQYIPX.js} +1 -0
  2. package/dist/api/index.js +1 -0
  3. package/dist/auth/context.js +1 -0
  4. package/dist/auth/index.js +1 -0
  5. package/dist/charts/index.d.ts +96 -0
  6. package/dist/charts/index.js +384 -0
  7. package/dist/chunk-54S7KNJV.js +112 -0
  8. package/dist/{chunk-6IX5JZEH.js → chunk-G4TAF3T6.js} +166 -1
  9. package/dist/{chunk-Y2I5JJ3N.js → chunk-K3YVC5RW.js} +2 -2
  10. package/dist/chunk-KB5NKPTN.js +1455 -0
  11. package/dist/chunk-MLKGABMK.js +7 -0
  12. package/dist/{chunk-GIFAF5ZS.js → chunk-MS45MNFM.js} +6 -1
  13. package/dist/chunk-R56VC63S.js +129 -0
  14. package/dist/chunk-TYV5NJV2.js +1 -0
  15. package/dist/{chunk-JQLT6HBI.js → chunk-YJFTZUJJ.js} +22 -2
  16. package/dist/components/index.css +486 -0
  17. package/dist/components/index.d.ts +2047 -1
  18. package/dist/components/index.js +3350 -0
  19. package/dist/components/navigation/index.js +1 -0
  20. package/dist/execution/index.d.ts +15 -3
  21. package/dist/execution/index.js +2 -1
  22. package/dist/graph/index.js +2 -1
  23. package/dist/hooks/index.d.ts +270 -0
  24. package/dist/hooks/index.js +3 -2
  25. package/dist/hooks/published.d.ts +546 -2
  26. package/dist/hooks/published.js +3 -2
  27. package/dist/index.css +62 -0
  28. package/dist/index.d.ts +351 -4
  29. package/dist/index.js +12 -1038
  30. package/dist/initialization/index.d.ts +270 -0
  31. package/dist/initialization/index.js +1 -0
  32. package/dist/layout/index.css +44 -0
  33. package/dist/layout/index.d.ts +330 -0
  34. package/dist/layout/index.js +1440 -0
  35. package/dist/organization/index.js +1 -0
  36. package/dist/profile/index.d.ts +270 -0
  37. package/dist/profile/index.js +1 -0
  38. package/dist/provider/index.css +61 -0
  39. package/dist/provider/index.d.ts +54 -2
  40. package/dist/provider/index.js +5 -3
  41. package/dist/provider/published.d.ts +6 -0
  42. package/dist/provider/published.js +3 -2
  43. package/dist/router/context.js +1 -0
  44. package/dist/router/index.js +1 -0
  45. package/dist/sse/index.js +1 -1
  46. package/dist/supabase/index.d.ts +525 -0
  47. package/dist/supabase/index.js +1 -0
  48. package/dist/theme/index.d.ts +107 -0
  49. package/dist/theme/index.js +3 -0
  50. package/dist/typeform/index.js +1 -0
  51. package/dist/typeform/schemas.js +1 -0
  52. package/dist/types/index.d.ts +3636 -368
  53. package/dist/utils/index.js +1 -0
  54. package/package.json +96 -3
  55. package/dist/chunk-XXDDMASA.js +0 -170
  56. /package/dist/{chunk-BUZONXAW.js → chunk-ARQRKA6J.js} +0 -0
@@ -6,6 +6,171 @@ import { useQuery, useQueryClient, useMutation } from '@tanstack/react-query';
6
6
  import { z } from 'zod';
7
7
  import { useCallback, useState, useEffect, useMemo, useId, useRef } from 'react';
8
8
 
9
+ function useCommandQueue({
10
+ status,
11
+ limit,
12
+ offset,
13
+ humanCheckpoint,
14
+ timeRange,
15
+ priorityMin,
16
+ priorityMax
17
+ } = {}) {
18
+ const { apiRequest, isReady, organizationId } = useElevasisServices();
19
+ return useQuery({
20
+ queryKey: ["command-queue", "list", organizationId, status, humanCheckpoint, timeRange, priorityMin, priorityMax, limit, offset],
21
+ queryFn: async () => {
22
+ const params = new URLSearchParams();
23
+ if (status) params.set("status", status);
24
+ if (humanCheckpoint) params.set("humanCheckpoint", humanCheckpoint);
25
+ if (timeRange) params.set("timeRange", timeRange);
26
+ if (priorityMin !== void 0) params.set("priorityMin", String(priorityMin));
27
+ if (priorityMax !== void 0) params.set("priorityMax", String(priorityMax));
28
+ if (limit !== void 0) params.set("limit", String(limit));
29
+ if (offset !== void 0) params.set("offset", String(offset));
30
+ const response = await apiRequest(
31
+ `/command-queue?${params.toString()}`
32
+ );
33
+ return response.tasks.map((task) => ({
34
+ ...task,
35
+ createdAt: new Date(task.createdAt),
36
+ completedAt: task.completedAt ? new Date(task.completedAt) : void 0,
37
+ expiresAt: task.expiresAt ? new Date(task.expiresAt) : void 0
38
+ }));
39
+ },
40
+ enabled: isReady
41
+ });
42
+ }
43
+ function useSubmitAction() {
44
+ const { apiRequest } = useElevasisServices();
45
+ const queryClient = useQueryClient();
46
+ return useMutation({
47
+ mutationFn: async ({ taskId, actionId, payload, notes }) => {
48
+ const response = await apiRequest(`/command-queue/${taskId}/action`, {
49
+ method: "POST",
50
+ body: JSON.stringify({
51
+ actionId,
52
+ payload,
53
+ notes
54
+ })
55
+ });
56
+ return response;
57
+ },
58
+ onMutate: async ({ taskId }) => {
59
+ await queryClient.cancelQueries({ queryKey: ["command-queue", "list"] });
60
+ const previousData = /* @__PURE__ */ new Map();
61
+ const queries = queryClient.getQueriesData({ queryKey: ["command-queue", "list"] });
62
+ for (const [queryKey, data] of queries) {
63
+ previousData.set(queryKey, data);
64
+ if (data) {
65
+ queryClient.setQueryData(
66
+ queryKey,
67
+ (old) => old?.map((task) => task.id === taskId ? { ...task, status: "processing" } : task)
68
+ );
69
+ }
70
+ }
71
+ return { previousData };
72
+ },
73
+ onSuccess: () => {
74
+ queryClient.invalidateQueries({ queryKey: ["command-queue"] });
75
+ },
76
+ onError: (_error, _variables, context) => {
77
+ if (context?.previousData) {
78
+ for (const [queryKey, data] of context.previousData) {
79
+ queryClient.setQueryData(queryKey, data);
80
+ }
81
+ }
82
+ }
83
+ });
84
+ }
85
+ function useDeleteTask() {
86
+ const { apiRequest } = useElevasisServices();
87
+ const queryClient = useQueryClient();
88
+ const notify = useNotificationAdapter();
89
+ return useMutation({
90
+ mutationFn: async (taskId) => {
91
+ await apiRequest(`/command-queue/${taskId}`, {
92
+ method: "DELETE"
93
+ });
94
+ },
95
+ onMutate: async (taskId) => {
96
+ await queryClient.cancelQueries({ queryKey: ["command-queue", "list"] });
97
+ const previousData = /* @__PURE__ */ new Map();
98
+ const queries = queryClient.getQueriesData({ queryKey: ["command-queue", "list"] });
99
+ for (const [queryKey, data] of queries) {
100
+ previousData.set(queryKey, data);
101
+ if (data) {
102
+ queryClient.setQueryData(queryKey, (old) => old?.filter((task) => task.id !== taskId));
103
+ }
104
+ }
105
+ return { previousData };
106
+ },
107
+ onSuccess: () => {
108
+ notify.success("Task Deleted", "Task has been removed");
109
+ queryClient.invalidateQueries({ queryKey: ["command-queue"] });
110
+ },
111
+ onError: (error, _taskId, context) => {
112
+ if (context?.previousData) {
113
+ for (const [queryKey, data] of context.previousData) {
114
+ queryClient.setQueryData(queryKey, data);
115
+ }
116
+ }
117
+ notify.apiError(error);
118
+ }
119
+ });
120
+ }
121
+ function useCommandQueueTotals({
122
+ timeRange = "24h",
123
+ priorityMin,
124
+ priorityMax,
125
+ status
126
+ } = {}) {
127
+ const { apiRequest, isReady, organizationId } = useElevasisServices();
128
+ return useQuery({
129
+ queryKey: ["command-queue", "checkpoints", organizationId, timeRange, priorityMin, priorityMax, status],
130
+ queryFn: async () => {
131
+ const params = new URLSearchParams();
132
+ params.set("timeRange", timeRange);
133
+ if (priorityMin !== void 0) params.set("priorityMin", String(priorityMin));
134
+ if (priorityMax !== void 0) params.set("priorityMax", String(priorityMax));
135
+ if (status) params.set("status", status);
136
+ return apiRequest(`/command-queue/checkpoints?${params.toString()}`);
137
+ },
138
+ enabled: isReady,
139
+ staleTime: 3e4
140
+ // 30s monitoring stale time
141
+ });
142
+ }
143
+ function usePatchTask() {
144
+ const { apiRequest } = useElevasisServices();
145
+ const queryClient = useQueryClient();
146
+ const notify = useNotificationAdapter();
147
+ return useMutation({
148
+ mutationFn: async ({ taskId, params }) => {
149
+ const response = await apiRequest(`/command-queue/${taskId}`, {
150
+ method: "PATCH",
151
+ headers: { "Content-Type": "application/json" },
152
+ body: JSON.stringify(params)
153
+ });
154
+ return response.task;
155
+ },
156
+ onSuccess: (updatedTask) => {
157
+ const deserialized = {
158
+ ...updatedTask,
159
+ createdAt: new Date(updatedTask.createdAt),
160
+ completedAt: updatedTask.completedAt ? new Date(updatedTask.completedAt) : void 0,
161
+ expiresAt: updatedTask.expiresAt ? new Date(updatedTask.expiresAt) : void 0
162
+ };
163
+ queryClient.setQueriesData(
164
+ { queryKey: ["command-queue", "list"] },
165
+ (old) => old?.map((t) => t.id === deserialized.id ? { ...t, ...deserialized } : t)
166
+ );
167
+ },
168
+ onError: (error) => {
169
+ notify.apiError(error);
170
+ }
171
+ });
172
+ }
173
+
9
174
  // src/hooks/executions/queryKeys.ts
10
175
  var executionsKeys = {
11
176
  all: ["executions"],
@@ -1418,4 +1583,4 @@ function useSSEConnection({
1418
1583
  return { connected, error };
1419
1584
  }
1420
1585
 
1421
- export { ExecutionIdParamsSchema, OperationsService, SessionIdParamSchema, WebSocketSessionTurnSchema, createUseFeatureAccess, executionsKeys, observabilityKeys, scheduleKeys, sortData, useActivities, useActivityTrend, useBatchDelete, useBulkDeleteExecutions, useBusinessImpact, useCancelExecution, useCancelSchedule, useCostBreakdown, useCostByModel, useCostSummary, useCostTrends, useCreateSchedule, useDashboardMetrics, useDeleteExecution, useDeleteSchedule, useErrorAnalysis, useErrorDetail, useErrorDetails, useErrorDistribution, useErrorNotification, useErrorTrends, useExecuteAsync, useExecution, useExecutionHealth, useExecutionLogs, useExecutions, useGetExecutionHistory, useGetSchedule, useListSchedules, useMarkAllAsRead, useMarkAsRead, useNotificationCount, useNotifications, usePaginationState, usePauseSchedule, useResolveAllErrors, useResolveError, useResolveErrorsByExecution, useResourceDefinition, useResources, useResumeSchedule, useRetryExecution, useSSEConnection, useSortedData, useSuccessNotification, useTableSelection, useTableSort, useTopFailingResources, useUnresolveError, useUpdateAnchor, useUpdateSchedule, useWarningNotification };
1586
+ export { ExecutionIdParamsSchema, OperationsService, SessionIdParamSchema, WebSocketSessionTurnSchema, createUseFeatureAccess, executionsKeys, observabilityKeys, scheduleKeys, sortData, useActivities, useActivityTrend, useBatchDelete, useBulkDeleteExecutions, useBusinessImpact, useCancelExecution, useCancelSchedule, useCommandQueue, useCommandQueueTotals, useCostBreakdown, useCostByModel, useCostSummary, useCostTrends, useCreateSchedule, useDashboardMetrics, useDeleteExecution, useDeleteSchedule, useDeleteTask, useErrorAnalysis, useErrorDetail, useErrorDetails, useErrorDistribution, useErrorNotification, useErrorTrends, useExecuteAsync, useExecution, useExecutionHealth, useExecutionLogs, useExecutions, useGetExecutionHistory, useGetSchedule, useListSchedules, useMarkAllAsRead, useMarkAsRead, useNotificationCount, useNotifications, usePaginationState, usePatchTask, usePauseSchedule, useResolveAllErrors, useResolveError, useResolveErrorsByExecution, useResourceDefinition, useResources, useResumeSchedule, useRetryExecution, useSSEConnection, useSortedData, useSubmitAction, useSuccessNotification, useTableSelection, useTableSort, useTopFailingResources, useUnresolveError, useUpdateAnchor, useUpdateSchedule, useWarningNotification };
@@ -1,6 +1,6 @@
1
- import { NotificationProvider } from './chunk-TIRMFDM4.js';
2
1
  import { OrganizationProvider } from './chunk-SFF5MJEI.js';
3
2
  import { ApiClientProvider, useApiClient } from './chunk-LBPALY25.js';
3
+ import { NotificationProvider } from './chunk-TIRMFDM4.js';
4
4
  import { InitializationProvider } from './chunk-NEK6JKPW.js';
5
5
  import { ProfileProvider } from './chunk-L2CM2CUA.js';
6
6
  import { ElevasisServiceProvider, useElevasisServices } from './chunk-KA7LO7U5.js';
@@ -10,7 +10,7 @@ import { lazy, Suspense, useRef } from 'react';
10
10
  import { QueryClientProvider, QueryClient } from '@tanstack/react-query';
11
11
  import { jsx, Fragment } from 'react/jsx-runtime';
12
12
 
13
- var LazyCoreAuthKitInner = lazy(() => import('./CoreAuthKitInner-3J4RVQO6.js').then((m) => ({ default: m.CoreAuthKitInner })));
13
+ var LazyCoreAuthKitInner = lazy(() => import('./CoreAuthKitInner-Y6LQYIPX.js').then((m) => ({ default: m.CoreAuthKitInner })));
14
14
  var defaultQueryClient = null;
15
15
  function getDefaultQueryClient() {
16
16
  if (!defaultQueryClient) {