@robosystems/core 0.3.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 (249) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +252 -0
  3. package/actions/entity-actions.d.ts +8 -0
  4. package/actions/entity-actions.js +16 -0
  5. package/actions/graph-actions.d.ts +3 -0
  6. package/actions/graph-actions.js +13 -0
  7. package/auth-components/AppSwitcher.d.ts +6 -0
  8. package/auth-components/AppSwitcher.js +28 -0
  9. package/auth-components/AuthGuard.d.ts +7 -0
  10. package/auth-components/AuthGuard.js +31 -0
  11. package/auth-components/AuthProvider.d.ts +9 -0
  12. package/auth-components/AuthProvider.js +565 -0
  13. package/auth-components/SessionWarningDialog.d.ts +1 -0
  14. package/auth-components/SessionWarningDialog.js +51 -0
  15. package/auth-components/SignInForm.d.ts +20 -0
  16. package/auth-components/SignInForm.js +139 -0
  17. package/auth-components/SignUpForm.d.ts +15 -0
  18. package/auth-components/SignUpForm.js +167 -0
  19. package/auth-components/TurnstileWidget.d.ts +99 -0
  20. package/auth-components/TurnstileWidget.js +224 -0
  21. package/auth-components/index.d.ts +6 -0
  22. package/auth-components/index.js +6 -0
  23. package/auth-core/cleanup.d.ts +44 -0
  24. package/auth-core/cleanup.js +157 -0
  25. package/auth-core/client.d.ts +121 -0
  26. package/auth-core/client.js +767 -0
  27. package/auth-core/config.d.ts +19 -0
  28. package/auth-core/config.js +56 -0
  29. package/auth-core/hooks.d.ts +19 -0
  30. package/auth-core/hooks.js +63 -0
  31. package/auth-core/index.d.ts +6 -0
  32. package/auth-core/index.js +6 -0
  33. package/auth-core/sso.d.ts +42 -0
  34. package/auth-core/sso.js +281 -0
  35. package/auth-core/token-storage.d.ts +58 -0
  36. package/auth-core/token-storage.js +177 -0
  37. package/auth-core/types.d.ts +145 -0
  38. package/auth-core/types.js +1 -0
  39. package/components/EntitySelector.d.ts +44 -0
  40. package/components/EntitySelector.js +64 -0
  41. package/components/EntitySelectorCore.d.ts +45 -0
  42. package/components/EntitySelectorCore.js +67 -0
  43. package/components/GraphSelectorCore.d.ts +21 -0
  44. package/components/GraphSelectorCore.js +39 -0
  45. package/components/PageLayout.d.ts +8 -0
  46. package/components/PageLayout.js +5 -0
  47. package/components/RepositoryGuard.d.ts +68 -0
  48. package/components/RepositoryGuard.js +91 -0
  49. package/components/console/ConsoleContent.d.ts +4 -0
  50. package/components/console/ConsoleContent.js +612 -0
  51. package/components/console/ConsoleMarkdown.d.ts +11 -0
  52. package/components/console/ConsoleMarkdown.js +49 -0
  53. package/components/console/ProgressiveText.d.ts +6 -0
  54. package/components/console/ProgressiveText.js +21 -0
  55. package/components/console/graphAwareConfig.d.ts +70 -0
  56. package/components/console/graphAwareConfig.js +411 -0
  57. package/components/console/index.d.ts +6 -0
  58. package/components/console/index.js +4 -0
  59. package/components/console/types.d.ts +84 -0
  60. package/components/console/types.js +1 -0
  61. package/components/graph-filters.d.ts +75 -0
  62. package/components/graph-filters.js +111 -0
  63. package/components/index.d.ts +10 -0
  64. package/components/index.js +9 -0
  65. package/components/repositories/ActiveSubscriptions.d.ts +26 -0
  66. package/components/repositories/ActiveSubscriptions.js +103 -0
  67. package/components/repositories/BrowseRepositories.d.ts +11 -0
  68. package/components/repositories/BrowseRepositories.js +184 -0
  69. package/components/repositories/index.d.ts +2 -0
  70. package/components/repositories/index.js +2 -0
  71. package/components/search/SearchContent.d.ts +4 -0
  72. package/components/search/SearchContent.js +168 -0
  73. package/components/search/index.d.ts +2 -0
  74. package/components/search/index.js +1 -0
  75. package/components/search/types.d.ts +15 -0
  76. package/components/search/types.js +1 -0
  77. package/contexts/entity-context.d.ts +28 -0
  78. package/contexts/entity-context.js +89 -0
  79. package/contexts/graph-context.d.ts +27 -0
  80. package/contexts/graph-context.js +128 -0
  81. package/contexts/index.d.ts +5 -0
  82. package/contexts/index.js +5 -0
  83. package/contexts/org-context.d.ts +25 -0
  84. package/contexts/org-context.js +64 -0
  85. package/contexts/service-offerings-context.d.ts +45 -0
  86. package/contexts/service-offerings-context.js +98 -0
  87. package/contexts/sidebar-context.d.ts +18 -0
  88. package/contexts/sidebar-context.js +44 -0
  89. package/hooks/index.d.ts +6 -0
  90. package/hooks/index.js +6 -0
  91. package/hooks/use-api-error.d.ts +3 -0
  92. package/hooks/use-api-error.js +24 -0
  93. package/hooks/use-media-query.d.ts +1 -0
  94. package/hooks/use-media-query.js +21 -0
  95. package/hooks/use-streaming-query.d.ts +22 -0
  96. package/hooks/use-streaming-query.js +142 -0
  97. package/hooks/use-toast.d.ts +37 -0
  98. package/hooks/use-toast.js +117 -0
  99. package/hooks/use-user-limits.d.ts +12 -0
  100. package/hooks/use-user-limits.js +73 -0
  101. package/hooks/use-user.d.ts +11 -0
  102. package/hooks/use-user.js +39 -0
  103. package/index.d.ts +29 -0
  104. package/index.js +77 -0
  105. package/lib/entity-cookie.d.ts +10 -0
  106. package/lib/entity-cookie.js +38 -0
  107. package/lib/graph-cookie.d.ts +11 -0
  108. package/lib/graph-cookie.js +62 -0
  109. package/lib/graph-tiers.d.ts +41 -0
  110. package/lib/graph-tiers.js +107 -0
  111. package/lib/index.d.ts +3 -0
  112. package/lib/index.js +3 -0
  113. package/lib/sidebar-cookie.d.ts +11 -0
  114. package/lib/sidebar-cookie.js +42 -0
  115. package/library/colors.d.ts +4 -0
  116. package/library/colors.js +41 -0
  117. package/library/components/ClassificationPicker.d.ts +8 -0
  118. package/library/components/ClassificationPicker.js +55 -0
  119. package/library/components/ElementBrowser.d.ts +11 -0
  120. package/library/components/ElementBrowser.js +106 -0
  121. package/library/components/ElementDetail.d.ts +7 -0
  122. package/library/components/ElementDetail.js +97 -0
  123. package/library/components/LibraryHierarchy.d.ts +13 -0
  124. package/library/components/LibraryHierarchy.js +380 -0
  125. package/library/components/TaxonomySidebar.d.ts +6 -0
  126. package/library/components/TaxonomySidebar.js +45 -0
  127. package/library/index.d.ts +8 -0
  128. package/library/index.js +7 -0
  129. package/package.json +37 -0
  130. package/research/CoverageCard.d.ts +12 -0
  131. package/research/CoverageCard.js +15 -0
  132. package/research/CoverageGrid.d.ts +6 -0
  133. package/research/CoverageGrid.js +9 -0
  134. package/research/CoverageHistory.d.ts +5 -0
  135. package/research/CoverageHistory.js +7 -0
  136. package/research/ResearchArticle.d.ts +15 -0
  137. package/research/ResearchArticle.js +26 -0
  138. package/research/catalog.d.ts +14 -0
  139. package/research/catalog.js +42 -0
  140. package/research/index.d.ts +6 -0
  141. package/research/index.js +9 -0
  142. package/research/types.d.ts +38 -0
  143. package/research/types.js +4 -0
  144. package/task-monitoring/hooks.d.ts +26 -0
  145. package/task-monitoring/hooks.js +126 -0
  146. package/task-monitoring/index.d.ts +5 -0
  147. package/task-monitoring/index.js +7 -0
  148. package/task-monitoring/operationErrors.d.ts +82 -0
  149. package/task-monitoring/operationErrors.js +251 -0
  150. package/task-monitoring/operationHooks.d.ts +117 -0
  151. package/task-monitoring/operationHooks.js +536 -0
  152. package/task-monitoring/operationMonitor.d.ts +78 -0
  153. package/task-monitoring/operationMonitor.js +200 -0
  154. package/task-monitoring/operationTypes.d.ts +236 -0
  155. package/task-monitoring/operationTypes.js +60 -0
  156. package/task-monitoring/taskMonitor.d.ts +14 -0
  157. package/task-monitoring/taskMonitor.js +132 -0
  158. package/task-monitoring/types.d.ts +31 -0
  159. package/task-monitoring/types.js +1 -0
  160. package/theme/flowbite-theme.d.ts +758 -0
  161. package/theme/flowbite-theme.js +765 -0
  162. package/theme/index.d.ts +1 -0
  163. package/theme/index.js +1 -0
  164. package/types/entity.d.ts +19 -0
  165. package/types/index.d.ts +2 -0
  166. package/types/index.js +1 -0
  167. package/types/user.d.ts +6 -0
  168. package/ui-components/ConfirmModal.d.ts +41 -0
  169. package/ui-components/ConfirmModal.js +19 -0
  170. package/ui-components/EmptyState.d.ts +22 -0
  171. package/ui-components/EmptyState.js +10 -0
  172. package/ui-components/LoadingState.d.ts +27 -0
  173. package/ui-components/LoadingState.js +12 -0
  174. package/ui-components/Logo.d.ts +28 -0
  175. package/ui-components/Logo.js +95 -0
  176. package/ui-components/Spinner.d.ts +37 -0
  177. package/ui-components/Spinner.js +48 -0
  178. package/ui-components/StatCard.d.ts +21 -0
  179. package/ui-components/StatCard.js +10 -0
  180. package/ui-components/api-keys/ApiKeyDisplay.d.ts +13 -0
  181. package/ui-components/api-keys/ApiKeyDisplay.js +7 -0
  182. package/ui-components/api-keys/ApiKeyTable.d.ts +9 -0
  183. package/ui-components/api-keys/ApiKeyTable.js +17 -0
  184. package/ui-components/api-keys/ApiKeysCard.d.ts +6 -0
  185. package/ui-components/api-keys/ApiKeysCard.js +97 -0
  186. package/ui-components/api-keys/CreateApiKeyModal.d.ts +11 -0
  187. package/ui-components/api-keys/CreateApiKeyModal.js +47 -0
  188. package/ui-components/api-keys/SecureApiKeyField.d.ts +13 -0
  189. package/ui-components/api-keys/SecureApiKeyField.js +64 -0
  190. package/ui-components/api-keys/index.d.ts +5 -0
  191. package/ui-components/api-keys/index.js +5 -0
  192. package/ui-components/chat/ChatHeader.d.ts +12 -0
  193. package/ui-components/chat/ChatHeader.js +5 -0
  194. package/ui-components/chat/ChatInputArea.d.ts +16 -0
  195. package/ui-components/chat/ChatInputArea.js +9 -0
  196. package/ui-components/chat/ChatMessage.d.ts +7 -0
  197. package/ui-components/chat/ChatMessage.js +24 -0
  198. package/ui-components/chat/DeepResearchToggle.d.ts +8 -0
  199. package/ui-components/chat/DeepResearchToggle.js +13 -0
  200. package/ui-components/chat/index.d.ts +9 -0
  201. package/ui-components/chat/index.js +8 -0
  202. package/ui-components/chat/types.d.ts +23 -0
  203. package/ui-components/chat/types.js +51 -0
  204. package/ui-components/forms/PasswordRequirements.d.ts +10 -0
  205. package/ui-components/forms/PasswordRequirements.js +15 -0
  206. package/ui-components/forms/SettingsCard.d.ts +11 -0
  207. package/ui-components/forms/SettingsCard.js +5 -0
  208. package/ui-components/forms/SettingsFormField.d.ts +18 -0
  209. package/ui-components/forms/SettingsFormField.js +17 -0
  210. package/ui-components/forms/StatusAlert.d.ts +8 -0
  211. package/ui-components/forms/StatusAlert.js +7 -0
  212. package/ui-components/forms/index.d.ts +4 -0
  213. package/ui-components/forms/index.js +4 -0
  214. package/ui-components/index.d.ts +13 -0
  215. package/ui-components/index.js +18 -0
  216. package/ui-components/layout/CoreNavbar.d.ts +14 -0
  217. package/ui-components/layout/CoreNavbar.js +53 -0
  218. package/ui-components/layout/CoreSidebar.d.ts +28 -0
  219. package/ui-components/layout/CoreSidebar.js +62 -0
  220. package/ui-components/layout/LandingFooter.d.ts +28 -0
  221. package/ui-components/layout/LandingFooter.js +34 -0
  222. package/ui-components/layout/PageContainer.d.ts +8 -0
  223. package/ui-components/layout/PageContainer.js +17 -0
  224. package/ui-components/layout/PageHeader.d.ts +23 -0
  225. package/ui-components/layout/PageHeader.js +12 -0
  226. package/ui-components/layout/SettingsContainer.d.ts +10 -0
  227. package/ui-components/layout/SettingsContainer.js +9 -0
  228. package/ui-components/layout/ThemeToggle.d.ts +4 -0
  229. package/ui-components/layout/ThemeToggle.js +6 -0
  230. package/ui-components/layout/index.d.ts +7 -0
  231. package/ui-components/layout/index.js +7 -0
  232. package/ui-components/settings/GeneralInformationCard.d.ts +12 -0
  233. package/ui-components/settings/GeneralInformationCard.js +72 -0
  234. package/ui-components/settings/PasswordInformationCard.d.ts +10 -0
  235. package/ui-components/settings/PasswordInformationCard.js +167 -0
  236. package/ui-components/settings/SettingsPageHeader.d.ts +7 -0
  237. package/ui-components/settings/SettingsPageHeader.js +6 -0
  238. package/ui-components/settings/index.d.ts +3 -0
  239. package/ui-components/settings/index.js +3 -0
  240. package/ui-components/support/SupportModal.d.ts +15 -0
  241. package/ui-components/support/SupportModal.js +74 -0
  242. package/ui-components/support/index.d.ts +2 -0
  243. package/ui-components/support/index.js +1 -0
  244. package/ui-components/types/index.d.ts +39 -0
  245. package/ui-components/types/index.js +1 -0
  246. package/utils/index.d.ts +31 -0
  247. package/utils/index.js +38 -0
  248. package/utils/turnstile-config.d.ts +11 -0
  249. package/utils/turnstile-config.js +19 -0
@@ -0,0 +1,251 @@
1
+ /**
2
+ * Error handling for operation-based monitoring
3
+ */
4
+ export var OperationErrorCode;
5
+ (function (OperationErrorCode) {
6
+ // Network errors
7
+ OperationErrorCode["CONNECTION_FAILED"] = "CONNECTION_FAILED";
8
+ OperationErrorCode["CONNECTION_LOST"] = "CONNECTION_LOST";
9
+ OperationErrorCode["TIMEOUT"] = "TIMEOUT";
10
+ // Operation errors
11
+ OperationErrorCode["OPERATION_NOT_FOUND"] = "OPERATION_NOT_FOUND";
12
+ OperationErrorCode["OPERATION_CANCELLED"] = "OPERATION_CANCELLED";
13
+ OperationErrorCode["OPERATION_FAILED"] = "OPERATION_FAILED";
14
+ // Permission errors
15
+ OperationErrorCode["UNAUTHORIZED"] = "UNAUTHORIZED";
16
+ OperationErrorCode["FORBIDDEN"] = "FORBIDDEN";
17
+ OperationErrorCode["INSUFFICIENT_CREDITS"] = "INSUFFICIENT_CREDITS";
18
+ // Resource errors
19
+ OperationErrorCode["RESOURCE_NOT_FOUND"] = "RESOURCE_NOT_FOUND";
20
+ OperationErrorCode["RESOURCE_LOCKED"] = "RESOURCE_LOCKED";
21
+ OperationErrorCode["RESOURCE_LIMIT_EXCEEDED"] = "RESOURCE_LIMIT_EXCEEDED";
22
+ // Validation errors
23
+ OperationErrorCode["INVALID_INPUT"] = "INVALID_INPUT";
24
+ OperationErrorCode["INVALID_QUERY"] = "INVALID_QUERY";
25
+ OperationErrorCode["SCHEMA_VIOLATION"] = "SCHEMA_VIOLATION";
26
+ // System errors
27
+ OperationErrorCode["INTERNAL_ERROR"] = "INTERNAL_ERROR";
28
+ OperationErrorCode["SERVICE_UNAVAILABLE"] = "SERVICE_UNAVAILABLE";
29
+ OperationErrorCode["RATE_LIMITED"] = "RATE_LIMITED";
30
+ })(OperationErrorCode || (OperationErrorCode = {}));
31
+ export class OperationError extends Error {
32
+ constructor(code, message, details) {
33
+ super(message);
34
+ this.code = code;
35
+ this.details = details;
36
+ this.name = 'OperationError';
37
+ }
38
+ /**
39
+ * Check if error is recoverable
40
+ */
41
+ isRecoverable() {
42
+ return [
43
+ OperationErrorCode.CONNECTION_LOST,
44
+ OperationErrorCode.TIMEOUT,
45
+ OperationErrorCode.SERVICE_UNAVAILABLE,
46
+ OperationErrorCode.RATE_LIMITED,
47
+ ].includes(this.code);
48
+ }
49
+ /**
50
+ * Check if error requires user action
51
+ */
52
+ requiresUserAction() {
53
+ return [
54
+ OperationErrorCode.UNAUTHORIZED,
55
+ OperationErrorCode.FORBIDDEN,
56
+ OperationErrorCode.INSUFFICIENT_CREDITS,
57
+ OperationErrorCode.INVALID_INPUT,
58
+ OperationErrorCode.INVALID_QUERY,
59
+ ].includes(this.code);
60
+ }
61
+ /**
62
+ * Get user-friendly message
63
+ */
64
+ getUserMessage() {
65
+ switch (this.code) {
66
+ case OperationErrorCode.CONNECTION_FAILED:
67
+ return 'Unable to connect to the server. Please check your internet connection.';
68
+ case OperationErrorCode.CONNECTION_LOST:
69
+ return 'Connection to the server was lost. Attempting to reconnect...';
70
+ case OperationErrorCode.TIMEOUT:
71
+ return 'The operation took too long to complete. Please try again.';
72
+ case OperationErrorCode.OPERATION_NOT_FOUND:
73
+ return 'The operation could not be found. It may have expired.';
74
+ case OperationErrorCode.OPERATION_CANCELLED:
75
+ return 'The operation was cancelled.';
76
+ case OperationErrorCode.OPERATION_FAILED:
77
+ return 'The operation failed. Please check the details and try again.';
78
+ case OperationErrorCode.UNAUTHORIZED:
79
+ return 'You are not authorized. Please log in and try again.';
80
+ case OperationErrorCode.FORBIDDEN:
81
+ return 'You do not have permission to perform this action.';
82
+ case OperationErrorCode.INSUFFICIENT_CREDITS:
83
+ return 'You have insufficient credits. Please upgrade your plan.';
84
+ case OperationErrorCode.RESOURCE_NOT_FOUND:
85
+ return 'The requested resource could not be found.';
86
+ case OperationErrorCode.RESOURCE_LOCKED:
87
+ return 'The resource is currently locked. Please try again later.';
88
+ case OperationErrorCode.RESOURCE_LIMIT_EXCEEDED:
89
+ return 'You have exceeded the resource limit for your plan.';
90
+ case OperationErrorCode.INVALID_INPUT:
91
+ return 'The provided input is invalid. Please check and try again.';
92
+ case OperationErrorCode.INVALID_QUERY:
93
+ return 'The query syntax is invalid. Please check your query.';
94
+ case OperationErrorCode.SCHEMA_VIOLATION:
95
+ return 'The operation violates the schema constraints.';
96
+ case OperationErrorCode.INTERNAL_ERROR:
97
+ return 'An internal error occurred. Please try again later.';
98
+ case OperationErrorCode.SERVICE_UNAVAILABLE:
99
+ return 'The service is temporarily unavailable. Please try again later.';
100
+ case OperationErrorCode.RATE_LIMITED:
101
+ return 'Too many requests. Please slow down and try again.';
102
+ default:
103
+ return this.message || 'An unexpected error occurred.';
104
+ }
105
+ }
106
+ /**
107
+ * Get recommended action for the user
108
+ */
109
+ getRecommendedAction() {
110
+ switch (this.code) {
111
+ case OperationErrorCode.CONNECTION_FAILED:
112
+ case OperationErrorCode.CONNECTION_LOST:
113
+ return 'Check your internet connection and refresh the page.';
114
+ case OperationErrorCode.TIMEOUT:
115
+ return 'Try running the operation with smaller data or during off-peak hours.';
116
+ case OperationErrorCode.UNAUTHORIZED:
117
+ return 'Please log in again to continue.';
118
+ case OperationErrorCode.FORBIDDEN:
119
+ return 'Contact your administrator for access.';
120
+ case OperationErrorCode.INSUFFICIENT_CREDITS:
121
+ return 'Upgrade your plan or purchase additional credits.';
122
+ case OperationErrorCode.INVALID_QUERY:
123
+ return 'Review the query syntax documentation.';
124
+ case OperationErrorCode.RATE_LIMITED:
125
+ return 'Wait a few moments before trying again.';
126
+ default:
127
+ return null;
128
+ }
129
+ }
130
+ }
131
+ /**
132
+ * Parse SSE error events into OperationError
133
+ */
134
+ export function parseOperationError(event) {
135
+ // Check for specific error codes in the event
136
+ if (event.code) {
137
+ const code = event.code;
138
+ return new OperationError(code, event.message || 'Unknown error', event.details);
139
+ }
140
+ // Map error messages to codes
141
+ const message = event.message || event.error || '';
142
+ if (message.includes('unauthorized') || message.includes('401')) {
143
+ return new OperationError(OperationErrorCode.UNAUTHORIZED, message);
144
+ }
145
+ if (message.includes('forbidden') || message.includes('403')) {
146
+ return new OperationError(OperationErrorCode.FORBIDDEN, message);
147
+ }
148
+ if (message.includes('credits') || message.includes('quota')) {
149
+ return new OperationError(OperationErrorCode.INSUFFICIENT_CREDITS, message);
150
+ }
151
+ if (message.includes('not found') || message.includes('404')) {
152
+ return new OperationError(OperationErrorCode.RESOURCE_NOT_FOUND, message);
153
+ }
154
+ if (message.includes('timeout')) {
155
+ return new OperationError(OperationErrorCode.TIMEOUT, message);
156
+ }
157
+ if (message.includes('rate limit') || message.includes('429')) {
158
+ return new OperationError(OperationErrorCode.RATE_LIMITED, message);
159
+ }
160
+ if (message.includes('invalid') || message.includes('validation')) {
161
+ return new OperationError(OperationErrorCode.INVALID_INPUT, message);
162
+ }
163
+ if (message.includes('syntax') || message.includes('query')) {
164
+ return new OperationError(OperationErrorCode.INVALID_QUERY, message);
165
+ }
166
+ if (message.includes('connection')) {
167
+ return new OperationError(OperationErrorCode.CONNECTION_FAILED, message);
168
+ }
169
+ if (message.includes('cancelled')) {
170
+ return new OperationError(OperationErrorCode.OPERATION_CANCELLED, message);
171
+ }
172
+ // Default to internal error
173
+ return new OperationError(OperationErrorCode.INTERNAL_ERROR, message);
174
+ }
175
+ /**
176
+ * Error recovery strategies
177
+ */
178
+ export class ErrorRecovery {
179
+ constructor() {
180
+ this.retryCount = new Map();
181
+ this.maxRetries = 3;
182
+ this.baseDelay = 1000;
183
+ }
184
+ /**
185
+ * Determine if we should retry
186
+ */
187
+ shouldRetry(operationId, error) {
188
+ if (!error.isRecoverable()) {
189
+ return false;
190
+ }
191
+ const count = this.retryCount.get(operationId) || 0;
192
+ if (count >= this.maxRetries) {
193
+ return false;
194
+ }
195
+ this.retryCount.set(operationId, count + 1);
196
+ return true;
197
+ }
198
+ /**
199
+ * Get retry delay with exponential backoff
200
+ */
201
+ getRetryDelay(operationId) {
202
+ const count = this.retryCount.get(operationId) || 0;
203
+ return this.baseDelay * Math.pow(2, count);
204
+ }
205
+ /**
206
+ * Reset retry count for an operation
207
+ */
208
+ reset(operationId) {
209
+ this.retryCount.delete(operationId);
210
+ }
211
+ /**
212
+ * Clear all retry counts
213
+ */
214
+ clear() {
215
+ this.retryCount.clear();
216
+ }
217
+ }
218
+ export function createErrorNotification(error) {
219
+ const severity = error.requiresUserAction()
220
+ ? 'error'
221
+ : error.isRecoverable()
222
+ ? 'warning'
223
+ : 'error';
224
+ return {
225
+ title: getErrorTitle(error.code),
226
+ message: error.getUserMessage(),
227
+ action: error.getRecommendedAction() || undefined,
228
+ severity,
229
+ };
230
+ }
231
+ function getErrorTitle(code) {
232
+ switch (code) {
233
+ case OperationErrorCode.CONNECTION_FAILED:
234
+ case OperationErrorCode.CONNECTION_LOST:
235
+ return 'Connection Error';
236
+ case OperationErrorCode.UNAUTHORIZED:
237
+ case OperationErrorCode.FORBIDDEN:
238
+ return 'Access Denied';
239
+ case OperationErrorCode.INSUFFICIENT_CREDITS:
240
+ return 'Insufficient Credits';
241
+ case OperationErrorCode.INVALID_INPUT:
242
+ case OperationErrorCode.INVALID_QUERY:
243
+ return 'Validation Error';
244
+ case OperationErrorCode.RATE_LIMITED:
245
+ return 'Rate Limited';
246
+ case OperationErrorCode.TIMEOUT:
247
+ return 'Timeout';
248
+ default:
249
+ return 'Operation Error';
250
+ }
251
+ }
@@ -0,0 +1,117 @@
1
+ import type { OperationStatus } from './operationMonitor';
2
+ export interface OperationMonitorState {
3
+ isLoading: boolean;
4
+ isMonitoring: boolean;
5
+ progress: number | null;
6
+ currentStep: string | null;
7
+ error: string | null;
8
+ operationId: string | null;
9
+ result: any | null;
10
+ status: OperationStatus | null;
11
+ }
12
+ export interface UseOperationMonitoringResult extends OperationMonitorState {
13
+ startMonitoring: (operationId: string, options?: {
14
+ timeout?: number;
15
+ }) => Promise<any>;
16
+ cancelOperation: () => Promise<void>;
17
+ reset: () => void;
18
+ cancelMonitoring: () => Promise<void>;
19
+ }
20
+ /**
21
+ * Hook for monitoring operations using SSE
22
+ */
23
+ export declare function useOperationMonitoring(): UseOperationMonitoringResult;
24
+ /**
25
+ * Hook for graph creation using the new unified endpoint
26
+ */
27
+ export declare function useGraphCreation(): {
28
+ isLoading: boolean;
29
+ createGraph: (graphData: {
30
+ graph_type: "generic" | "company" | "entity";
31
+ graph_name: string;
32
+ description?: string;
33
+ tags?: string[];
34
+ instance_tier?: string;
35
+ schema_extensions?: string[];
36
+ create_entity?: boolean;
37
+ company_name?: string;
38
+ company_identifier?: string;
39
+ company_identifier_type?: "ein" | "name";
40
+ entity_name?: string;
41
+ entity_identifier?: string;
42
+ entity_identifier_type?: "ein" | "name";
43
+ org_id?: string;
44
+ }) => Promise<any>;
45
+ createEntityGraph: (entityData: {
46
+ entity_name: string;
47
+ entity_identifier?: string;
48
+ entity_identifier_type?: "ein" | "name";
49
+ instance_tier?: string;
50
+ schema_extensions?: string[];
51
+ create_entity?: boolean;
52
+ description?: string;
53
+ tags?: string[];
54
+ org_id?: string;
55
+ }) => Promise<any>;
56
+ createGenericGraph: (graphData: {
57
+ graph_name: string;
58
+ description?: string;
59
+ instance_tier?: string;
60
+ schema_extensions?: string[];
61
+ org_id?: string;
62
+ }) => Promise<any>;
63
+ startMonitoring: (operationId: string, options?: {
64
+ timeout?: number;
65
+ }) => Promise<any>;
66
+ cancelOperation: () => Promise<void>;
67
+ reset: () => void;
68
+ cancelMonitoring: () => Promise<void>;
69
+ isMonitoring: boolean;
70
+ progress: number | null;
71
+ currentStep: string | null;
72
+ error: string | null;
73
+ operationId: string | null;
74
+ result: any | null;
75
+ status: OperationStatus | null;
76
+ };
77
+ /**
78
+ * Hook for creating repository subscriptions with billing integration
79
+ * Mirrors the graph creation pattern for consistency
80
+ */
81
+ export declare function useRepositorySubscription(): {
82
+ isSubscribing: boolean;
83
+ subscribe: (subscriptionData: {
84
+ repository_name: string;
85
+ plan_name: string;
86
+ org_id: string;
87
+ }) => Promise<import("@robosystems/client").GraphSubscriptionResponse | {
88
+ requires_checkout: boolean;
89
+ checkout_url: string;
90
+ session_id: string;
91
+ subscription_id: string;
92
+ }>;
93
+ changePlan: (data: {
94
+ repository_name: string;
95
+ new_plan_name: string;
96
+ }) => Promise<import("@robosystems/client").GraphSubscriptionResponse>;
97
+ };
98
+ /**
99
+ * Hook for monitoring multiple operations simultaneously
100
+ */
101
+ export declare function useMultipleOperations(): {
102
+ operations: OperationMonitorState[];
103
+ addOperation: (operationId: string, options?: {
104
+ timeout?: number;
105
+ }) => Promise<import("./operationMonitor").OperationResult>;
106
+ cancelOperation: (operationId: string) => Promise<void>;
107
+ removeOperation: (operationId: string) => void;
108
+ clearAll: () => void;
109
+ };
110
+ /**
111
+ * Helper to determine if an operation is still active
112
+ */
113
+ export declare function isOperationActive(status: OperationStatus | null): boolean;
114
+ /**
115
+ * Helper to get progress color based on status
116
+ */
117
+ export declare function getProgressColor(status: OperationStatus | null): string;