@elevasis/ui 1.3.0 → 1.3.2

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 (279) hide show
  1. package/dist/CoreAuthKitInner-3J4RVQO6.js +43 -0
  2. package/dist/api/index.d.ts +7 -31
  3. package/dist/api/index.js +3 -2
  4. package/dist/auth/context.d.ts +23 -5
  5. package/dist/auth/guards/AdminGuard.d.ts +32 -0
  6. package/dist/auth/guards/AdminGuard.d.ts.map +1 -0
  7. package/dist/auth/guards/ProtectedRoute.d.ts +60 -0
  8. package/dist/auth/guards/ProtectedRoute.d.ts.map +1 -0
  9. package/dist/auth/guards/__tests__/AdminGuard.test.d.ts +12 -0
  10. package/dist/auth/guards/__tests__/AdminGuard.test.d.ts.map +1 -0
  11. package/dist/auth/guards/__tests__/ProtectedRoute.test.d.ts +14 -0
  12. package/dist/auth/guards/__tests__/ProtectedRoute.test.d.ts.map +1 -0
  13. package/dist/auth/index.d.ts +14 -171
  14. package/dist/auth/index.d.ts.map +1 -0
  15. package/dist/auth/index.js +5 -6
  16. package/dist/{chunk-FDCVFCOQ.js → chunk-2JBWPFHF.js} +23 -20
  17. package/dist/{chunk-BZTA7IIL.js → chunk-6IX5JZEH.js} +358 -4
  18. package/dist/chunk-FWZJH3TL.js +13 -0
  19. package/dist/chunk-GIFAF5ZS.js +313 -0
  20. package/dist/chunk-JGJSZ3UE.js +47 -0
  21. package/dist/chunk-JQLT6HBI.js +850 -0
  22. package/dist/{chunk-4KAG5U7A.js → chunk-L2CM2CUA.js} +0 -2
  23. package/dist/chunk-LFYO3MDC.js +58 -0
  24. package/dist/{chunk-OLD3NQLI.js → chunk-LTQAAIGE.js} +13 -17
  25. package/dist/{chunk-QQOLC46E.js → chunk-NEK6JKPW.js} +1 -1
  26. package/dist/{chunk-SITSZUFW.js → chunk-PVVQTENF.js} +1 -1
  27. package/dist/{chunk-FLJXZ7YC.js → chunk-SFF5MJEI.js} +2 -4
  28. package/dist/{chunk-EZMRFWZQ.js → chunk-U34YGJQB.js} +2 -94
  29. package/dist/{chunk-BWCC6ZJC.js → chunk-XLV6LYN2.js} +15 -60
  30. package/dist/components/index.d.ts +1 -1353
  31. package/dist/components/index.js +1 -20
  32. package/dist/components/navigation/index.d.ts +2 -32
  33. package/dist/components/navigation/index.js +1 -29
  34. package/dist/execution/index.d.ts +63 -231
  35. package/dist/execution/index.js +1 -4
  36. package/dist/graph/index.css +0 -1
  37. package/dist/graph/index.d.ts +4 -203
  38. package/dist/graph/index.js +1 -1
  39. package/dist/hooks/command-queue/index.d.ts +7 -0
  40. package/dist/hooks/command-queue/index.d.ts.map +1 -0
  41. package/dist/hooks/command-queue/useCommandQueue.d.ts +33 -0
  42. package/dist/hooks/command-queue/useCommandQueue.d.ts.map +1 -0
  43. package/dist/hooks/command-queue/useCommandQueueTotals.d.ts +17 -0
  44. package/dist/hooks/command-queue/useCommandQueueTotals.d.ts.map +1 -0
  45. package/dist/hooks/command-queue/useDeleteTask.d.ts +5 -0
  46. package/dist/hooks/command-queue/useDeleteTask.d.ts.map +1 -0
  47. package/dist/hooks/command-queue/usePatchTask.d.ts +6 -0
  48. package/dist/hooks/command-queue/usePatchTask.d.ts.map +1 -0
  49. package/dist/hooks/command-queue/useSubmitAction.d.ts +29 -0
  50. package/dist/hooks/command-queue/useSubmitAction.d.ts.map +1 -0
  51. package/dist/hooks/executions/index.d.ts +16 -0
  52. package/dist/hooks/executions/index.d.ts.map +1 -0
  53. package/dist/hooks/executions/useBulkDeleteExecutions.d.ts +15 -0
  54. package/dist/hooks/executions/useBulkDeleteExecutions.d.ts.map +1 -0
  55. package/dist/hooks/executions/useCancelExecution.d.ts +20 -0
  56. package/dist/hooks/executions/useCancelExecution.d.ts.map +1 -0
  57. package/dist/hooks/executions/useDeleteExecution.d.ts +13 -0
  58. package/dist/hooks/executions/useDeleteExecution.d.ts.map +1 -0
  59. package/dist/hooks/executions/useExecuteAsync.d.ts +21 -0
  60. package/dist/hooks/executions/useExecuteAsync.d.ts.map +1 -0
  61. package/dist/hooks/executions/useExecution.d.ts +10 -0
  62. package/dist/hooks/executions/useExecution.d.ts.map +1 -0
  63. package/dist/hooks/executions/useExecutions.d.ts +16 -0
  64. package/dist/hooks/executions/useExecutions.d.ts.map +1 -0
  65. package/dist/hooks/executions/useResourceDefinition.d.ts +9 -0
  66. package/dist/hooks/executions/useResourceDefinition.d.ts.map +1 -0
  67. package/dist/hooks/executions/useResources.d.ts +15 -0
  68. package/dist/hooks/executions/useResources.d.ts.map +1 -0
  69. package/dist/hooks/executions/useRetryExecution.d.ts +16 -0
  70. package/dist/hooks/executions/useRetryExecution.d.ts.map +1 -0
  71. package/dist/hooks/feature-access/createUseFeatureAccess.d.ts +44 -0
  72. package/dist/hooks/feature-access/createUseFeatureAccess.d.ts.map +1 -0
  73. package/dist/hooks/feature-access/index.d.ts +2 -0
  74. package/dist/hooks/feature-access/index.d.ts.map +1 -0
  75. package/dist/hooks/index.d.ts +11 -1927
  76. package/dist/hooks/index.d.ts.map +1 -0
  77. package/dist/hooks/index.js +5 -4
  78. package/dist/hooks/monitoring/index.d.ts +9 -0
  79. package/dist/hooks/monitoring/index.d.ts.map +1 -0
  80. package/dist/hooks/monitoring/useActivities.d.ts +52 -0
  81. package/dist/hooks/monitoring/useActivities.d.ts.map +1 -0
  82. package/dist/hooks/monitoring/useCostSummary.d.ts +7 -0
  83. package/dist/hooks/monitoring/useCostSummary.d.ts.map +1 -0
  84. package/dist/hooks/monitoring/useExecutionHealth.d.ts +10 -0
  85. package/dist/hooks/monitoring/useExecutionHealth.d.ts.map +1 -0
  86. package/dist/hooks/monitoring/useExecutionLogs.d.ts +56 -0
  87. package/dist/hooks/monitoring/useExecutionLogs.d.ts.map +1 -0
  88. package/dist/hooks/monitoring/useNotifications.d.ts +11 -0
  89. package/dist/hooks/monitoring/useNotifications.d.ts.map +1 -0
  90. package/dist/hooks/notifications/index.d.ts +8 -0
  91. package/dist/hooks/notifications/index.d.ts.map +1 -0
  92. package/dist/hooks/notifications/useMarkAllAsRead.d.ts +2 -0
  93. package/dist/hooks/notifications/useMarkAllAsRead.d.ts.map +1 -0
  94. package/dist/hooks/notifications/useMarkAsRead.d.ts +2 -0
  95. package/dist/hooks/notifications/useMarkAsRead.d.ts.map +1 -0
  96. package/dist/hooks/notifications/useNotificationCount.d.ts +8 -0
  97. package/dist/hooks/notifications/useNotificationCount.d.ts.map +1 -0
  98. package/dist/hooks/observability/index.d.ts +19 -0
  99. package/dist/hooks/observability/index.d.ts.map +1 -0
  100. package/dist/hooks/observability/useBusinessImpact.d.ts +9 -0
  101. package/dist/hooks/observability/useBusinessImpact.d.ts.map +1 -0
  102. package/dist/hooks/observability/useCostBreakdown.d.ts +10 -0
  103. package/dist/hooks/observability/useCostBreakdown.d.ts.map +1 -0
  104. package/dist/hooks/observability/useCostByModel.d.ts +3 -0
  105. package/dist/hooks/observability/useCostByModel.d.ts.map +1 -0
  106. package/dist/hooks/observability/useCostTrends.d.ts +3 -0
  107. package/dist/hooks/observability/useCostTrends.d.ts.map +1 -0
  108. package/dist/hooks/observability/useDashboardMetrics.d.ts +3 -0
  109. package/dist/hooks/observability/useDashboardMetrics.d.ts.map +1 -0
  110. package/dist/hooks/observability/useErrorAnalysis.d.ts +7 -0
  111. package/dist/hooks/observability/useErrorAnalysis.d.ts.map +1 -0
  112. package/dist/hooks/observability/useErrorDetails.d.ts +20 -0
  113. package/dist/hooks/observability/useErrorDetails.d.ts.map +1 -0
  114. package/dist/hooks/observability/useErrorDistribution.d.ts +12 -0
  115. package/dist/hooks/observability/useErrorDistribution.d.ts.map +1 -0
  116. package/dist/hooks/observability/useErrorTrends.d.ts +12 -0
  117. package/dist/hooks/observability/useErrorTrends.d.ts.map +1 -0
  118. package/dist/hooks/observability/useResolveError.d.ts +17 -0
  119. package/dist/hooks/observability/useResolveError.d.ts.map +1 -0
  120. package/dist/hooks/observability/useTopFailingResources.d.ts +13 -0
  121. package/dist/hooks/observability/useTopFailingResources.d.ts.map +1 -0
  122. package/dist/hooks/published.d.ts +19 -1652
  123. package/dist/hooks/published.d.ts.map +1 -0
  124. package/dist/hooks/published.js +369 -3
  125. package/dist/hooks/scheduling/index.d.ts +5 -0
  126. package/dist/hooks/scheduling/index.d.ts.map +1 -0
  127. package/dist/hooks/scheduling/useSchedules.d.ts +185 -0
  128. package/dist/hooks/scheduling/useSchedules.d.ts.map +1 -0
  129. package/dist/hooks/sessions/index.d.ts +8 -0
  130. package/dist/hooks/sessions/index.d.ts.map +1 -0
  131. package/dist/hooks/sessions/useSessionExecutions.d.ts +13 -0
  132. package/dist/hooks/sessions/useSessionExecutions.d.ts.map +1 -0
  133. package/dist/hooks/sessions/useSessionMessages.d.ts +7 -0
  134. package/dist/hooks/sessions/useSessionMessages.d.ts.map +1 -0
  135. package/dist/hooks/sessions/useSessions.d.ts +26 -0
  136. package/dist/hooks/sessions/useSessions.d.ts.map +1 -0
  137. package/dist/index.css +0 -118
  138. package/dist/index.d.ts +15 -7624
  139. package/dist/index.d.ts.map +1 -0
  140. package/dist/index.js +1125 -30
  141. package/dist/initialization/InitializationProvider.d.ts +48 -0
  142. package/dist/initialization/InitializationProvider.d.ts.map +1 -0
  143. package/dist/initialization/hooks/useAppInitialization.d.ts +32 -0
  144. package/dist/initialization/hooks/useAppInitialization.d.ts.map +1 -0
  145. package/dist/initialization/index.d.ts +22 -2361
  146. package/dist/initialization/index.d.ts.map +1 -0
  147. package/dist/initialization/index.js +4 -4
  148. package/dist/organization/context/OrganizationProvider.d.ts +20 -0
  149. package/dist/organization/context/OrganizationProvider.d.ts.map +1 -0
  150. package/dist/organization/hooks/useOrgInitialization.d.ts +56 -0
  151. package/dist/organization/hooks/useOrgInitialization.d.ts.map +1 -0
  152. package/dist/organization/index.d.ts +21 -283
  153. package/dist/organization/index.d.ts.map +1 -0
  154. package/dist/organization/index.js +4 -4
  155. package/dist/profile/context/ProfileProvider.d.ts +27 -0
  156. package/dist/profile/context/ProfileProvider.d.ts.map +1 -0
  157. package/dist/profile/hooks/useUserProfile.d.ts +31 -0
  158. package/dist/profile/hooks/useUserProfile.d.ts.map +1 -0
  159. package/dist/profile/index.d.ts +14 -2290
  160. package/dist/profile/index.d.ts.map +1 -0
  161. package/dist/profile/index.js +1 -1
  162. package/dist/provider/CoreAuthKitInner.d.ts +12 -0
  163. package/dist/provider/CoreAuthKitInner.d.ts.map +1 -0
  164. package/dist/provider/ElevasisCoreProvider.d.ts +39 -0
  165. package/dist/provider/ElevasisCoreProvider.d.ts.map +1 -0
  166. package/dist/provider/ElevasisServiceContext.d.ts +31 -0
  167. package/dist/provider/ElevasisServiceContext.d.ts.map +1 -0
  168. package/dist/provider/__tests__/CoreAuthKitInner.test.d.ts +2 -0
  169. package/dist/provider/__tests__/CoreAuthKitInner.test.d.ts.map +1 -0
  170. package/dist/provider/__tests__/ElevasisCoreProvider.test.d.ts +2 -0
  171. package/dist/provider/__tests__/ElevasisCoreProvider.test.d.ts.map +1 -0
  172. package/dist/provider/index.d.ts +7 -384
  173. package/dist/provider/index.d.ts.map +1 -0
  174. package/dist/provider/index.js +8 -9
  175. package/dist/provider/published.d.ts +9 -275
  176. package/dist/provider/published.d.ts.map +1 -0
  177. package/dist/provider/published.js +7 -8
  178. package/dist/provider/types.d.ts +190 -0
  179. package/dist/provider/types.d.ts.map +1 -0
  180. package/dist/sdk-barrel.d.ts +20 -0
  181. package/dist/sdk-barrel.d.ts.map +1 -0
  182. package/dist/supabase/index.d.ts +0 -255
  183. package/dist/supabase/index.js +2 -47
  184. package/dist/theme/cssVariables.d.ts +12 -0
  185. package/dist/theme/cssVariables.d.ts.map +1 -0
  186. package/dist/theme/index.d.ts +4 -0
  187. package/dist/theme/index.d.ts.map +1 -0
  188. package/dist/theme/presets/__tests__/getPreset.test.d.ts +2 -0
  189. package/dist/theme/presets/__tests__/getPreset.test.d.ts.map +1 -0
  190. package/dist/theme/presets/abyss.d.ts +3 -0
  191. package/dist/theme/presets/abyss.d.ts.map +1 -0
  192. package/dist/theme/presets/abyss.js +54 -0
  193. package/dist/theme/presets/aurora.d.ts +8 -0
  194. package/dist/theme/presets/aurora.d.ts.map +1 -0
  195. package/dist/theme/presets/aurora.js +59 -0
  196. package/dist/theme/presets/canopy.d.ts +3 -0
  197. package/dist/theme/presets/canopy.d.ts.map +1 -0
  198. package/dist/theme/presets/canopy.js +58 -0
  199. package/dist/theme/presets/cyber-flux.d.ts +8 -0
  200. package/dist/theme/presets/cyber-flux.d.ts.map +1 -0
  201. package/dist/theme/presets/cyber-strike.d.ts +9 -0
  202. package/dist/theme/presets/cyber-strike.d.ts.map +1 -0
  203. package/dist/theme/presets/cyber-void.d.ts +8 -0
  204. package/dist/theme/presets/cyber-void.d.ts.map +1 -0
  205. package/dist/theme/presets/cyber-volt.d.ts +8 -0
  206. package/dist/theme/presets/cyber-volt.d.ts.map +1 -0
  207. package/dist/theme/presets/default.d.ts +4 -0
  208. package/dist/theme/presets/default.d.ts.map +1 -0
  209. package/dist/theme/presets/ember.d.ts +8 -0
  210. package/dist/theme/presets/ember.d.ts.map +1 -0
  211. package/dist/theme/presets/ember.js +63 -0
  212. package/dist/theme/presets/honey.d.ts +3 -0
  213. package/dist/theme/presets/honey.d.ts.map +1 -0
  214. package/dist/theme/presets/honey.js +62 -0
  215. package/dist/theme/presets/index.d.ts +6 -0
  216. package/dist/theme/presets/index.d.ts.map +1 -0
  217. package/dist/theme/presets/midnight.d.ts +8 -0
  218. package/dist/theme/presets/midnight.d.ts.map +1 -0
  219. package/dist/theme/presets/midnight.js +68 -0
  220. package/dist/theme/presets/obsidian.d.ts +3 -0
  221. package/dist/theme/presets/obsidian.d.ts.map +1 -0
  222. package/dist/theme/presets/obsidian.js +56 -0
  223. package/dist/theme/presets/regal.d.ts +8 -0
  224. package/dist/theme/presets/regal.d.ts.map +1 -0
  225. package/dist/theme/presets/rose-gold.d.ts +8 -0
  226. package/dist/theme/presets/rose-gold.d.ts.map +1 -0
  227. package/dist/theme/presets/slate.d.ts +3 -0
  228. package/dist/theme/presets/slate.d.ts.map +1 -0
  229. package/dist/theme/presets/slate.js +56 -0
  230. package/dist/theme/presets/tactical.d.ts +8 -0
  231. package/dist/theme/presets/tactical.d.ts.map +1 -0
  232. package/dist/theme/presets/types.d.ts +26 -0
  233. package/dist/theme/presets/types.d.ts.map +1 -0
  234. package/dist/theme/presets/types.js +1 -0
  235. package/dist/utils/index.d.ts +1 -22
  236. package/dist/utils/index.js +1 -1
  237. package/package.json +67 -51
  238. package/dist/CoreAuthKitInner-KM72EYJS.js +0 -19
  239. package/dist/api/hooks/useApiClient.d.ts +0 -54
  240. package/dist/api/hooks/useApiClient.d.ts.map +0 -1
  241. package/dist/api/hooks/useApiClient.js +0 -185
  242. package/dist/chunk-3KMDHCAR.js +0 -52
  243. package/dist/chunk-6BJOYF6E.js +0 -8
  244. package/dist/chunk-BLO4SISK.js +0 -113
  245. package/dist/chunk-HUWJXLLF.js +0 -681
  246. package/dist/chunk-JVAZHVNV.js +0 -110
  247. package/dist/chunk-JYSYHVLU.js +0 -379
  248. package/dist/chunk-NE36BUGQ.js +0 -146
  249. package/dist/chunk-NIAVTSMB.js +0 -21
  250. package/dist/chunk-O3PY6B6E.js +0 -749
  251. package/dist/chunk-OXVOHOP3.js +0 -661
  252. package/dist/chunk-PCBXNHKY.js +0 -1460
  253. package/dist/chunk-PSLKGOBZ.js +0 -58
  254. package/dist/chunk-QSVZP2NU.js +0 -214
  255. package/dist/chunk-RJCA5672.js +0 -1664
  256. package/dist/chunk-TMFCNFLW.js +0 -107
  257. package/dist/chunk-TN3PU2WK.js +0 -748
  258. package/dist/chunk-W7ZBF5AA.js +0 -1
  259. package/dist/chunk-YZ6GTZXL.js +0 -48
  260. package/dist/components/command-queue/index.css +0 -53
  261. package/dist/components/command-queue/index.d.ts +0 -204
  262. package/dist/components/command-queue/index.js +0 -12
  263. package/dist/components/forms/index.d.ts +0 -56
  264. package/dist/components/forms/index.js +0 -2
  265. package/dist/components/index.css +0 -443
  266. package/dist/components/monitoring/index.d.ts +0 -66
  267. package/dist/components/monitoring/index.js +0 -2
  268. package/dist/components/notifications/index.d.ts +0 -52
  269. package/dist/components/notifications/index.js +0 -5
  270. package/dist/components/resource-definition/index.css +0 -388
  271. package/dist/components/resource-definition/index.d.ts +0 -301
  272. package/dist/components/resource-definition/index.js +0 -3
  273. package/dist/display/index.css +0 -53
  274. package/dist/display/index.d.ts +0 -606
  275. package/dist/display/index.js +0 -7
  276. package/dist/execution/index.css +0 -388
  277. package/dist/provider/index.css +0 -61
  278. /package/dist/{chunk-Q47SPRY7.js → chunk-BUZONXAW.js} +0 -0
  279. /package/dist/{chunk-NXHL23JW.js → chunk-XXDDMASA.js} +0 -0
@@ -1,19 +0,0 @@
1
- import { WorkOSAuthBridge } from './chunk-NIAVTSMB.js';
2
- import './chunk-7PLEQFHO.js';
3
- import { AuthKitProvider } from '@workos-inc/authkit-react';
4
- import { jsx } from 'react/jsx-runtime';
5
-
6
- function CoreAuthKitInner({ auth, children }) {
7
- return /* @__PURE__ */ jsx(
8
- AuthKitProvider,
9
- {
10
- clientId: auth.clientId,
11
- apiHostname: auth.apiHostname ?? "api.workos.com",
12
- redirectUri: auth.redirectUri,
13
- devMode: auth.devMode ?? false,
14
- children: /* @__PURE__ */ jsx(WorkOSAuthBridge, { children })
15
- }
16
- );
17
- }
18
-
19
- export { CoreAuthKitInner };
@@ -1,54 +0,0 @@
1
- /**
2
- * Return type of useOrganizations hook (subset needed by the factory)
3
- */
4
- interface UseOrganizationsReturn {
5
- isInitializing: boolean;
6
- isOrgRefreshing: boolean;
7
- }
8
- /**
9
- * Hook that returns apiRequest and deferredApiRequest bound to the current
10
- * ApiClientContext. apiUrl is the only parameter because org ID is resolved
11
- * at call time via getOrganizationId() from context.
12
- *
13
- * Usage:
14
- * ```typescript
15
- * import { useApiClient } from '@repo/ui/api'
16
- *
17
- * const API_URL = import.meta.env.VITE_API_SERVER || 'http://localhost:5170'
18
- *
19
- * function useMyClient() {
20
- * return useApiClient(API_URL)
21
- * }
22
- * ```
23
- */
24
- export declare function useApiClient(apiUrl: string): {
25
- apiRequest: <T>(endpoint: string, options?: RequestInit) => Promise<T>;
26
- deferredApiRequest: <T>(endpoint: string, options?: RequestInit) => Promise<T>;
27
- isOrganizationReady: boolean;
28
- isInitializing: boolean;
29
- };
30
- /**
31
- * Factory function to create a useApiClient hook for your app.
32
- *
33
- * @deprecated Use the plain `useApiClient(apiUrl)` hook instead.
34
- * The factory pattern is no longer needed because org ID is resolved at
35
- * call time via getOrganizationId() from ApiClientContext.
36
- *
37
- * Migration:
38
- * ```typescript
39
- * // Before
40
- * export const useApiClient = createUseApiClient(useOrganizations, API_URL)
41
- *
42
- * // After
43
- * import { useApiClient } from '@repo/ui/api'
44
- * // call useApiClient(API_URL) directly in your hook/component
45
- * ```
46
- */
47
- export declare function createUseApiClient(useOrganizations: () => UseOrganizationsReturn, apiUrl: string): () => {
48
- apiRequest: <T>(endpoint: string, options?: RequestInit) => Promise<T>;
49
- deferredApiRequest: <T>(endpoint: string, options?: RequestInit) => Promise<T>;
50
- isOrganizationReady: boolean;
51
- isInitializing: boolean;
52
- };
53
- export {};
54
- //# sourceMappingURL=useApiClient.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useApiClient.d.ts","sourceRoot":"","sources":["../../../src/api/hooks/useApiClient.ts"],"names":[],"mappings":"AAOA;;GAEG;AACH,UAAU,sBAAsB;IAC9B,cAAc,EAAE,OAAO,CAAA;IACvB,eAAe,EAAE,OAAO,CAAA;CACzB;AA+FD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM;iBA+BtC,CAAC,YAAY,MAAM,YAAW,WAAW,KAAQ,OAAO,CAAC,CAAC,CAAC;yBAMrD,CAAC,YAAY,MAAM,YAAW,WAAW,KAAQ,OAAO,CAAC,CAAC,CAAC;;;EAerE;AAMD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,kBAAkB,CAAC,gBAAgB,EAAE,MAAM,sBAAsB,EAAE,MAAM,EAAE,MAAM;iBAqC1F,CAAC,YAAY,MAAM,YAAW,WAAW,KAAQ,OAAO,CAAC,CAAC,CAAC;yBAMrD,CAAC,YAAY,MAAM,YAAW,WAAW,KAAQ,OAAO,CAAC,CAAC,CAAC;;;EAqBvE"}
@@ -1,185 +0,0 @@
1
- import { useCallback } from 'react';
2
- import { HTTP_HEADERS } from '@repo/core';
3
- import { APIClientError } from '../../utils';
4
- import { useApiClientContext } from '../context/ApiClientProvider';
5
- const DEFAULT_TIMEOUT_MS = 60_000;
6
- // ---------------------------------------------------------------------------
7
- // Shared request logic builder — used by both the plain hook and the factory.
8
- // ---------------------------------------------------------------------------
9
- function buildApiRequest(getAccessToken, getOrganizationId, apiUrl, handleResponseError) {
10
- return async function apiRequest(endpoint, options = {}) {
11
- try {
12
- // Get the access token from context
13
- const token = await getAccessToken();
14
- // Read org ID at call time — reflects org switches without re-render
15
- const organizationId = getOrganizationId();
16
- // DEBUG
17
- if (organizationId)
18
- console.log('[apiRequest]', endpoint, 'org:', organizationId);
19
- // Only set Content-Type if there's a body
20
- const headers = {
21
- ...(options.body ? { 'Content-Type': 'application/json' } : {}),
22
- ...(token ? { Authorization: `Bearer ${token}` } : {}),
23
- ...(organizationId && { [HTTP_HEADERS.WORKOS_ORGANIZATION_ID]: organizationId }),
24
- ...options.headers
25
- };
26
- const timeoutSignal = AbortSignal.timeout(DEFAULT_TIMEOUT_MS);
27
- const signal = options.signal ? AbortSignal.any([options.signal, timeoutSignal]) : timeoutSignal;
28
- const response = await fetch(`${apiUrl}/api${endpoint}`, {
29
- ...options,
30
- headers,
31
- signal
32
- });
33
- if (!response.ok) {
34
- await handleResponseError(endpoint, response, options);
35
- }
36
- // Handle 204 No Content responses
37
- if (response.status === 204) {
38
- return undefined;
39
- }
40
- const data = await response.json();
41
- // DEBUG
42
- if (organizationId && endpoint.includes('dashboard'))
43
- console.log('[apiResponse] dashboard:', data);
44
- return data;
45
- }
46
- catch (error) {
47
- // If getAccessToken fails, still make the request without auth
48
- // This allows public endpoints to work
49
- if (error instanceof Error && error.message.includes('No access token')) {
50
- // Only set Content-Type if there's a body
51
- const headers = {
52
- ...(options.body ? { 'Content-Type': 'application/json' } : {}),
53
- ...options.headers
54
- };
55
- const fallbackTimeoutSignal = AbortSignal.timeout(DEFAULT_TIMEOUT_MS);
56
- const fallbackSignal = options.signal
57
- ? AbortSignal.any([options.signal, fallbackTimeoutSignal])
58
- : fallbackTimeoutSignal;
59
- const response = await fetch(`${apiUrl}/api${endpoint}`, {
60
- ...options,
61
- headers,
62
- signal: fallbackSignal
63
- });
64
- if (!response.ok) {
65
- await handleResponseError(endpoint, response, options);
66
- }
67
- if (response.status === 204) {
68
- return undefined;
69
- }
70
- return response.json();
71
- }
72
- throw error;
73
- }
74
- };
75
- }
76
- // ---------------------------------------------------------------------------
77
- // Plain hook — reads everything from ApiClientContext directly.
78
- // apiUrl must be provided because the context does not store it.
79
- // ---------------------------------------------------------------------------
80
- /**
81
- * Hook that returns apiRequest and deferredApiRequest bound to the current
82
- * ApiClientContext. apiUrl is the only parameter because org ID is resolved
83
- * at call time via getOrganizationId() from context.
84
- *
85
- * Usage:
86
- * ```typescript
87
- * import { useApiClient } from '@repo/ui/api'
88
- *
89
- * const API_URL = import.meta.env.VITE_API_SERVER || 'http://localhost:5170'
90
- *
91
- * function useMyClient() {
92
- * return useApiClient(API_URL)
93
- * }
94
- * ```
95
- */
96
- export function useApiClient(apiUrl) {
97
- const { getAccessToken, getOrganizationId, isOrganizationReady, onError } = useApiClientContext();
98
- const handleResponseError = useCallback(async (endpoint, response, options) => {
99
- const errorData = await response.json().catch(() => ({
100
- error: `HTTP ${response.status}`,
101
- code: 'INTERNAL_SERVER_ERROR'
102
- }));
103
- if (response.status >= 500 && onError) {
104
- onError(endpoint, new Error(errorData.error), {
105
- method: options.method || 'GET',
106
- statusCode: response.status,
107
- requestId: errorData.requestId
108
- });
109
- }
110
- throw new APIClientError(errorData.error, errorData.code, response.status, errorData.requestId, errorData.fields, errorData.retryAfter);
111
- }, [onError]);
112
- const apiRequest = useCallback((endpoint, options = {}) => buildApiRequest(getAccessToken, getOrganizationId, apiUrl, handleResponseError)(endpoint, options), [getAccessToken, getOrganizationId, apiUrl, handleResponseError]);
113
- const deferredApiRequest = useCallback(async (endpoint, options = {}) => {
114
- if (!isOrganizationReady) {
115
- throw new Error('No organization selected. Please select an organization.');
116
- }
117
- return apiRequest(endpoint, options);
118
- }, [apiRequest, isOrganizationReady]);
119
- return {
120
- apiRequest,
121
- deferredApiRequest,
122
- isOrganizationReady,
123
- isInitializing: false
124
- };
125
- }
126
- // ---------------------------------------------------------------------------
127
- // Factory — kept for backwards compatibility during migration.
128
- // ---------------------------------------------------------------------------
129
- /**
130
- * Factory function to create a useApiClient hook for your app.
131
- *
132
- * @deprecated Use the plain `useApiClient(apiUrl)` hook instead.
133
- * The factory pattern is no longer needed because org ID is resolved at
134
- * call time via getOrganizationId() from ApiClientContext.
135
- *
136
- * Migration:
137
- * ```typescript
138
- * // Before
139
- * export const useApiClient = createUseApiClient(useOrganizations, API_URL)
140
- *
141
- * // After
142
- * import { useApiClient } from '@repo/ui/api'
143
- * // call useApiClient(API_URL) directly in your hook/component
144
- * ```
145
- */
146
- export function createUseApiClient(useOrganizations, apiUrl) {
147
- return function useApiClientCompat() {
148
- const { getAccessToken, getOrganizationId, isOrganizationReady, onError } = useApiClientContext();
149
- const { isInitializing, isOrgRefreshing } = useOrganizations();
150
- /**
151
- * Handle API response errors
152
- * Logs 5xx errors via onError callback and throws APIClientError
153
- */
154
- const handleResponseError = useCallback(async (endpoint, response, options) => {
155
- const errorData = await response.json().catch(() => ({
156
- error: `HTTP ${response.status}`,
157
- code: 'INTERNAL_SERVER_ERROR'
158
- }));
159
- if (response.status >= 500 && onError) {
160
- onError(endpoint, new Error(errorData.error), {
161
- method: options.method || 'GET',
162
- statusCode: response.status,
163
- requestId: errorData.requestId
164
- });
165
- }
166
- throw new APIClientError(errorData.error, errorData.code, response.status, errorData.requestId, errorData.fields, errorData.retryAfter);
167
- }, [onError]);
168
- const apiRequest = useCallback((endpoint, options = {}) => buildApiRequest(getAccessToken, getOrganizationId, apiUrl, handleResponseError)(endpoint, options), [getAccessToken, getOrganizationId, handleResponseError]);
169
- const deferredApiRequest = useCallback(async (endpoint, options = {}) => {
170
- if (isInitializing || isOrgRefreshing) {
171
- throw new Error('Organization context is still initializing. Please wait.');
172
- }
173
- if (!isOrganizationReady) {
174
- throw new Error('No organization selected. Please select an organization.');
175
- }
176
- return apiRequest(endpoint, options);
177
- }, [apiRequest, isInitializing, isOrgRefreshing, isOrganizationReady]);
178
- return {
179
- apiRequest,
180
- deferredApiRequest,
181
- isOrganizationReady,
182
- isInitializing: isInitializing || isOrgRefreshing
183
- };
184
- };
185
- }
@@ -1,52 +0,0 @@
1
- import { Text, Box, Code, Title } from '@mantine/core';
2
- import Markdown from 'react-markdown';
3
- import { Prism } from 'react-syntax-highlighter';
4
- import { oneDark } from 'react-syntax-highlighter/dist/esm/styles/prism';
5
- import { jsx, Fragment } from 'react/jsx-runtime';
6
-
7
- // src/components/display/StyledMarkdown.tsx
8
- var customCodeTheme = Object.fromEntries(
9
- Object.entries(oneDark).map(([key, value]) => [
10
- key,
11
- typeof value === "object" && value !== null ? { ...value, background: "none", backgroundColor: "none" } : value
12
- ])
13
- );
14
- var defaultComponents = {
15
- h1: ({ children }) => /* @__PURE__ */ jsx(Title, { order: 3, c: "var(--color-primary)", mb: "xs", mt: "md", children }),
16
- h2: ({ children }) => /* @__PURE__ */ jsx(Title, { order: 4, c: "var(--color-primary)", mb: "xs", mt: "sm", children }),
17
- ul: ({ children }) => /* @__PURE__ */ jsx("ul", { style: { margin: "0.5rem 0", paddingLeft: "1.5rem" }, children }),
18
- ol: ({ children }) => /* @__PURE__ */ jsx("ol", { style: { margin: "0.5rem 0", paddingLeft: "1.5rem" }, children }),
19
- li: ({ children }) => /* @__PURE__ */ jsx("li", { style: { marginBottom: "0.25rem", fontSize: "var(--mantine-font-size-sm)" }, children }),
20
- code: ({ className, children, ...props }) => {
21
- const match = /language-(\w+)/.exec(className || "");
22
- const codeString = String(children).replace(/\n$/, "");
23
- if (match) {
24
- return /* @__PURE__ */ jsx(
25
- Prism,
26
- {
27
- style: customCodeTheme,
28
- language: match[1],
29
- PreTag: "div",
30
- customStyle: {
31
- margin: "0.5rem 0",
32
- borderRadius: "var(--mantine-radius-default)",
33
- fontSize: "0.8rem"
34
- },
35
- children: codeString
36
- }
37
- );
38
- }
39
- return /* @__PURE__ */ jsx(Code, { ...props, children });
40
- },
41
- pre: ({ children }) => /* @__PURE__ */ jsx(Fragment, { children }),
42
- blockquote: ({ children }) => /* @__PURE__ */ jsx(Box, { pl: "sm", my: "xs", style: { borderLeft: "2px solid var(--color-border)" }, children }),
43
- p: ({ children }) => /* @__PURE__ */ jsx(Text, { size: "sm", m: 0, children }),
44
- strong: ({ children }) => /* @__PURE__ */ jsx(Text, { component: "span", fw: 700, children }),
45
- em: ({ children }) => /* @__PURE__ */ jsx(Text, { component: "span", fs: "italic", children })
46
- };
47
- function StyledMarkdown({ children, components, className, style }) {
48
- const mergedComponents = components ? { ...defaultComponents, ...components } : defaultComponents;
49
- return /* @__PURE__ */ jsx("div", { className, style, children: /* @__PURE__ */ jsx(Markdown, { components: mergedComponents, children }) });
50
- }
51
-
52
- export { StyledMarkdown };
@@ -1,8 +0,0 @@
1
- // src/execution/utils/formatDuration.ts
2
- function formatDuration(ms) {
3
- if (!ms) return "0ms";
4
- if (ms < 1e3) return `${ms}ms`;
5
- return `${(ms / 1e3).toFixed(2)}s`;
6
- }
7
-
8
- export { formatDuration };
@@ -1,113 +0,0 @@
1
- import { useNotificationAdapter } from './chunk-TIRMFDM4.js';
2
- import { useElevasisServices } from './chunk-KA7LO7U5.js';
3
- import { useQueryClient, useMutation, useQuery } from '@tanstack/react-query';
4
- import { z } from 'zod';
5
-
6
- var UuidSchema = z.string().uuid();
7
- var NonEmptyStringSchema = z.string().trim().min(1).max(1e3);
8
- var ResourceTypeSchema = z.enum(["agent", "workflow"]);
9
- var OriginResourceTypeSchema = z.enum(["agent", "workflow", "scheduler", "api"]);
10
- z.string().trim().toLowerCase().min(1, "Credential name required").max(100, "Credential name too long (max 100 chars)").regex(
11
- /^[a-z0-9]+(-[a-z0-9]+)+$/,
12
- "Credential name must be lowercase letters, numbers, and hyphens in format: service-environment (e.g., gmail-prod, attio-dev)"
13
- );
14
- z.enum(["google-sheets", "dropbox"]);
15
- z.string().min(10, "Authorization code too short").max(1e3, "Authorization code too long");
16
- z.string().min(10, "State parameter too short").max(2048, "State parameter too long");
17
- z.string().trim().transform((str) => str.replace(/[<>'"]/g, ""));
18
- z.string().email();
19
- z.string().url();
20
- z.object({
21
- limit: z.coerce.number().int().min(1).max(100).default(20),
22
- offset: z.coerce.number().int().min(0).default(0)
23
- });
24
- z.string().datetime();
25
- z.object({
26
- startDate: z.string().datetime(),
27
- endDate: z.string().datetime()
28
- });
29
-
30
- // ../core/src/operations/notifications/api-schemas.ts
31
- var NotificationCategorySchema = z.enum(["info", "queue", "alert", "error", "system"]);
32
- var GetNotificationsQuerySchema = z.object({
33
- limit: z.coerce.number().int().min(1).max(100).default(50),
34
- offset: z.coerce.number().int().min(0).default(0)
35
- });
36
- var MarkAsReadParamsSchema = z.object({
37
- id: UuidSchema
38
- });
39
- z.object({
40
- userId: UuidSchema,
41
- organizationId: UuidSchema,
42
- category: NotificationCategorySchema,
43
- title: z.string().trim().min(1).max(200),
44
- message: z.string().trim().min(1).max(1e3),
45
- actionUrl: z.string().url().optional()
46
- }).strict();
47
-
48
- // src/hooks/notifications/useMarkAsRead.ts
49
- function useMarkAsRead() {
50
- const queryClient = useQueryClient();
51
- const { apiRequest } = useElevasisServices();
52
- const notify = useNotificationAdapter();
53
- return useMutation({
54
- mutationFn: async (notificationId) => {
55
- MarkAsReadParamsSchema.parse({ id: notificationId });
56
- await apiRequest(`/notifications/${notificationId}/read`, {
57
- method: "PATCH"
58
- });
59
- },
60
- onSuccess: () => {
61
- queryClient.invalidateQueries({ queryKey: ["notifications"] });
62
- },
63
- onError: (error) => {
64
- notify.apiError(error);
65
- }
66
- });
67
- }
68
- function useMarkAllAsRead() {
69
- const queryClient = useQueryClient();
70
- const { apiRequest } = useElevasisServices();
71
- const notify = useNotificationAdapter();
72
- return useMutation({
73
- mutationFn: async () => {
74
- await apiRequest("/notifications/mark-all-read", {
75
- method: "PATCH"
76
- });
77
- },
78
- onSuccess: () => {
79
- queryClient.invalidateQueries({ queryKey: ["notifications"] });
80
- },
81
- onError: (error) => {
82
- notify.apiError(error);
83
- }
84
- });
85
- }
86
- function useNotifications({ limit = 20, offset = 0 } = {}) {
87
- const { apiRequest, isReady, organizationId } = useElevasisServices();
88
- return useQuery({
89
- queryKey: ["notifications", organizationId, { limit, offset }],
90
- queryFn: async () => {
91
- const params = GetNotificationsQuerySchema.parse({ limit, offset });
92
- const response = await apiRequest(
93
- `/notifications?limit=${params.limit}&offset=${params.offset}`
94
- );
95
- return response;
96
- },
97
- enabled: isReady
98
- });
99
- }
100
- function useNotificationCount() {
101
- const { apiRequest, isReady, organizationId } = useElevasisServices();
102
- return useQuery({
103
- queryKey: ["notifications", "unread-count", organizationId],
104
- queryFn: async () => {
105
- const response = await apiRequest("/notifications/unread-count");
106
- return response.count;
107
- },
108
- enabled: isReady,
109
- staleTime: 3e4
110
- });
111
- }
112
-
113
- export { NonEmptyStringSchema, OriginResourceTypeSchema, ResourceTypeSchema, UuidSchema, useMarkAllAsRead, useMarkAsRead, useNotificationCount, useNotifications };