@oronts/vendure-data-hub-plugin 0.1.1 → 0.1.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 (235) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/dist/dashboard/components/common/ConnectionConfigEditor.tsx +589 -0
  3. package/dist/dashboard/components/common/HeadersEditor.tsx +90 -0
  4. package/dist/dashboard/components/common/ValidationFeedback.tsx +17 -0
  5. package/dist/dashboard/components/common/index.ts +10 -0
  6. package/dist/dashboard/components/pipelines/PipelineEditor.tsx +504 -0
  7. package/dist/dashboard/components/pipelines/PipelineExport.tsx +63 -0
  8. package/dist/dashboard/components/pipelines/PipelineImport.tsx +87 -0
  9. package/dist/dashboard/components/pipelines/ReactFlowPipelineEditor.tsx +539 -0
  10. package/dist/dashboard/components/pipelines/shared/NodePropertiesPanel.tsx +146 -0
  11. package/dist/dashboard/components/pipelines/shared/PipelineNode.tsx +155 -0
  12. package/dist/dashboard/components/pipelines/shared/PipelineSettingsPanel.tsx +392 -0
  13. package/dist/dashboard/components/pipelines/shared/StepListItem.tsx +144 -0
  14. package/dist/dashboard/components/pipelines/shared/index.ts +33 -0
  15. package/dist/dashboard/components/pipelines/shared/visual-node-config.ts +169 -0
  16. package/dist/dashboard/components/shared/LoadMoreButton.tsx +18 -0
  17. package/dist/dashboard/components/shared/entity-selector/EntitySelector.tsx +59 -0
  18. package/dist/dashboard/components/shared/entity-selector/index.ts +1 -0
  19. package/dist/dashboard/components/shared/error-boundary/ErrorBoundary.tsx +90 -0
  20. package/dist/dashboard/components/shared/error-boundary/index.ts +1 -0
  21. package/dist/dashboard/components/shared/feedback/EmptyState.tsx +36 -0
  22. package/dist/dashboard/components/shared/feedback/ErrorState.tsx +69 -0
  23. package/dist/dashboard/components/shared/feedback/LoadingState.tsx +104 -0
  24. package/dist/dashboard/components/shared/feedback/ValidationErrorDisplay.tsx +29 -0
  25. package/dist/dashboard/components/shared/feedback/index.ts +4 -0
  26. package/dist/dashboard/components/shared/file-dropzone/FileDropzone.tsx +167 -0
  27. package/dist/dashboard/components/shared/file-dropzone/index.ts +1 -0
  28. package/dist/dashboard/components/shared/filter-conditions-editor/FilterConditionsEditor.tsx +226 -0
  29. package/dist/dashboard/components/shared/filter-conditions-editor/index.ts +1 -0
  30. package/dist/dashboard/components/shared/index.ts +45 -0
  31. package/dist/dashboard/components/shared/schema-form/SchemaFormRenderer.tsx +248 -0
  32. package/dist/dashboard/components/shared/schema-form/fields/BooleanField.tsx +26 -0
  33. package/dist/dashboard/components/shared/schema-form/fields/FieldWrapper.tsx +28 -0
  34. package/dist/dashboard/components/shared/schema-form/fields/FileUploadField.tsx +171 -0
  35. package/dist/dashboard/components/shared/schema-form/fields/JsonField.tsx +132 -0
  36. package/dist/dashboard/components/shared/schema-form/fields/NumberField.tsx +33 -0
  37. package/dist/dashboard/components/shared/schema-form/fields/SelectField.tsx +70 -0
  38. package/dist/dashboard/components/shared/schema-form/fields/StringField.tsx +36 -0
  39. package/dist/dashboard/components/shared/schema-form/fields/TextareaField.tsx +31 -0
  40. package/dist/dashboard/components/shared/schema-form/fields/index.ts +23 -0
  41. package/dist/dashboard/components/shared/schema-form/index.ts +2 -0
  42. package/dist/dashboard/components/shared/schema-form/utils.ts +3 -0
  43. package/dist/dashboard/components/shared/selectable-card/SelectableCard.tsx +65 -0
  44. package/dist/dashboard/components/shared/selectable-card/index.ts +1 -0
  45. package/dist/dashboard/components/shared/stat-card/StatCard.tsx +121 -0
  46. package/dist/dashboard/components/shared/stat-card/index.ts +1 -0
  47. package/dist/dashboard/components/shared/step-config/AdapterRequiredWarning.tsx +25 -0
  48. package/dist/dashboard/components/shared/step-config/AdapterSelector.tsx +109 -0
  49. package/dist/dashboard/components/shared/step-config/AdvancedEditors.tsx +634 -0
  50. package/dist/dashboard/components/shared/step-config/EnrichConfigComponent.tsx +295 -0
  51. package/dist/dashboard/components/shared/step-config/ExtractTestResults.tsx +143 -0
  52. package/dist/dashboard/components/shared/step-config/GateConfigComponent.tsx +127 -0
  53. package/dist/dashboard/components/shared/step-config/LoadTestResults.tsx +104 -0
  54. package/dist/dashboard/components/shared/step-config/OperatorCard.tsx +266 -0
  55. package/dist/dashboard/components/shared/step-config/OperatorCheatSheetButton.tsx +54 -0
  56. package/dist/dashboard/components/shared/step-config/OperatorFieldInput.tsx +209 -0
  57. package/dist/dashboard/components/shared/step-config/RetrySettingsComponent.tsx +111 -0
  58. package/dist/dashboard/components/shared/step-config/RouteConfigComponent.tsx +125 -0
  59. package/dist/dashboard/components/shared/step-config/StepConfigPanel.tsx +564 -0
  60. package/dist/dashboard/components/shared/step-config/StepTester.tsx +165 -0
  61. package/dist/dashboard/components/shared/step-config/TestResultContainer.tsx +57 -0
  62. package/dist/dashboard/components/shared/step-config/TransformTestResults.tsx +130 -0
  63. package/dist/dashboard/components/shared/step-config/ValidateConfigComponent.tsx +334 -0
  64. package/dist/dashboard/components/shared/step-config/index.ts +29 -0
  65. package/dist/dashboard/components/shared/step-config/step-test-handlers.ts +297 -0
  66. package/dist/dashboard/components/shared/trigger-config/TriggerForm.tsx +478 -0
  67. package/dist/dashboard/components/shared/trigger-config/index.ts +1 -0
  68. package/dist/dashboard/components/shared/triggers-panel/TriggersPanel.tsx +281 -0
  69. package/dist/dashboard/components/shared/triggers-panel/index.ts +1 -0
  70. package/dist/dashboard/components/shared/wizard/ConfigurationNameCard.tsx +59 -0
  71. package/dist/dashboard/components/shared/wizard/SummaryCard.tsx +53 -0
  72. package/dist/dashboard/components/shared/wizard/WizardFooter.tsx +47 -0
  73. package/dist/dashboard/components/shared/wizard/WizardProgressBar.tsx +78 -0
  74. package/dist/dashboard/components/shared/wizard/index.ts +4 -0
  75. package/dist/dashboard/components/shared/wizard-trigger/TriggerSchemaFields.tsx +128 -0
  76. package/dist/dashboard/components/shared/wizard-trigger/TriggerSelector.tsx +33 -0
  77. package/dist/dashboard/components/shared/wizard-trigger/index.ts +2 -0
  78. package/dist/dashboard/components/templates/TemplateGallery.tsx +210 -0
  79. package/dist/dashboard/components/templates/TemplatePreview.tsx +214 -0
  80. package/dist/dashboard/components/templates/index.ts +4 -0
  81. package/dist/dashboard/components/wizards/export-wizard/DestinationStep.tsx +207 -0
  82. package/dist/dashboard/components/wizards/export-wizard/ExportWizard.tsx +221 -0
  83. package/dist/dashboard/components/wizards/export-wizard/FieldsStep.tsx +159 -0
  84. package/dist/dashboard/components/wizards/export-wizard/FormatStep.tsx +246 -0
  85. package/dist/dashboard/components/wizards/export-wizard/ReviewStep.tsx +231 -0
  86. package/dist/dashboard/components/wizards/export-wizard/SourceStep.tsx +154 -0
  87. package/dist/dashboard/components/wizards/export-wizard/TriggerStep.tsx +234 -0
  88. package/dist/dashboard/components/wizards/export-wizard/constants.ts +73 -0
  89. package/dist/dashboard/components/wizards/export-wizard/index.ts +2 -0
  90. package/dist/dashboard/components/wizards/export-wizard/types.ts +39 -0
  91. package/dist/dashboard/components/wizards/import-wizard/ImportWizard.tsx +350 -0
  92. package/dist/dashboard/components/wizards/import-wizard/MappingStep.tsx +286 -0
  93. package/dist/dashboard/components/wizards/import-wizard/PreviewStep.tsx +79 -0
  94. package/dist/dashboard/components/wizards/import-wizard/ReviewStep.tsx +266 -0
  95. package/dist/dashboard/components/wizards/import-wizard/SourceStep.tsx +537 -0
  96. package/dist/dashboard/components/wizards/import-wizard/StrategyStep.tsx +328 -0
  97. package/dist/dashboard/components/wizards/import-wizard/TargetStep.tsx +76 -0
  98. package/dist/dashboard/components/wizards/import-wizard/TemplateStep.tsx +116 -0
  99. package/dist/dashboard/components/wizards/import-wizard/TransformStep.tsx +666 -0
  100. package/dist/dashboard/components/wizards/import-wizard/TriggerStep.tsx +51 -0
  101. package/dist/dashboard/components/wizards/import-wizard/constants.ts +104 -0
  102. package/dist/dashboard/components/wizards/import-wizard/index.ts +3 -0
  103. package/dist/dashboard/components/wizards/import-wizard/types.ts +35 -0
  104. package/dist/dashboard/components/wizards/index.ts +7 -0
  105. package/dist/dashboard/components/wizards/shared/WizardStepContainer.tsx +27 -0
  106. package/dist/dashboard/components/wizards/shared/constants.ts +16 -0
  107. package/dist/dashboard/components/wizards/shared/index.ts +10 -0
  108. package/dist/dashboard/constants/colors.ts +25 -0
  109. package/dist/dashboard/constants/connection-defaults.ts +7 -0
  110. package/dist/dashboard/constants/connection-types.ts +1 -0
  111. package/dist/dashboard/constants/defaults.ts +18 -0
  112. package/dist/dashboard/constants/editor.ts +69 -0
  113. package/dist/dashboard/constants/enum-maps.ts +18 -0
  114. package/dist/dashboard/constants/fallbacks.ts +44 -0
  115. package/dist/dashboard/constants/file-format-registry.ts +206 -0
  116. package/dist/dashboard/constants/index.ts +24 -0
  117. package/dist/dashboard/constants/navigation.ts +29 -0
  118. package/dist/dashboard/constants/permissions.ts +41 -0
  119. package/dist/dashboard/constants/placeholders.ts +77 -0
  120. package/dist/dashboard/constants/routes.ts +12 -0
  121. package/dist/dashboard/constants/run-status.ts +1 -0
  122. package/dist/dashboard/constants/sentinel-values.ts +12 -0
  123. package/dist/dashboard/constants/step-configs.ts +9 -0
  124. package/dist/dashboard/constants/step-mappings.ts +170 -0
  125. package/dist/dashboard/constants/steps.ts +37 -0
  126. package/dist/dashboard/constants/toast-messages.ts +149 -0
  127. package/dist/dashboard/constants/triggers.ts +5 -0
  128. package/dist/dashboard/constants/ui-config.ts +139 -0
  129. package/dist/dashboard/constants/ui-dimensions.ts +145 -0
  130. package/dist/dashboard/constants/ui-states.ts +28 -0
  131. package/dist/dashboard/constants/ui-types.ts +85 -0
  132. package/dist/dashboard/constants/validation-patterns.ts +26 -0
  133. package/dist/dashboard/gql/gql.ts +370 -0
  134. package/dist/dashboard/gql/graphql.ts +10378 -0
  135. package/dist/dashboard/gql/index.ts +1 -0
  136. package/dist/dashboard/hooks/api/index.ts +115 -0
  137. package/dist/dashboard/hooks/api/mutation-helpers.ts +34 -0
  138. package/dist/dashboard/hooks/api/use-adapters.ts +92 -0
  139. package/dist/dashboard/hooks/api/use-config-options.ts +513 -0
  140. package/dist/dashboard/hooks/api/use-connections.ts +84 -0
  141. package/dist/dashboard/hooks/api/use-entity-field-schemas.ts +99 -0
  142. package/dist/dashboard/hooks/api/use-entity-loaders.ts +45 -0
  143. package/dist/dashboard/hooks/api/use-hooks.ts +68 -0
  144. package/dist/dashboard/hooks/api/use-logs.ts +102 -0
  145. package/dist/dashboard/hooks/api/use-pipeline-runs.ts +221 -0
  146. package/dist/dashboard/hooks/api/use-pipelines.ts +279 -0
  147. package/dist/dashboard/hooks/api/use-queues.ts +141 -0
  148. package/dist/dashboard/hooks/api/use-secrets.ts +75 -0
  149. package/dist/dashboard/hooks/api/use-settings.ts +55 -0
  150. package/dist/dashboard/hooks/api/use-step-tester.ts +79 -0
  151. package/dist/dashboard/hooks/index.ts +13 -0
  152. package/dist/dashboard/hooks/use-adapter-catalog.ts +253 -0
  153. package/dist/dashboard/hooks/use-export-templates.ts +80 -0
  154. package/dist/dashboard/hooks/use-import-templates.ts +139 -0
  155. package/dist/dashboard/hooks/use-load-more.ts +29 -0
  156. package/dist/dashboard/hooks/use-stable-keys.ts +54 -0
  157. package/dist/dashboard/hooks/use-trigger-types.ts +100 -0
  158. package/dist/dashboard/hooks/use-wizard-navigation.ts +128 -0
  159. package/dist/dashboard/index.tsx +55 -0
  160. package/dist/dashboard/routes/adapters/AdapterCard.tsx +102 -0
  161. package/dist/dashboard/routes/adapters/AdapterConstants.tsx +20 -0
  162. package/dist/dashboard/routes/adapters/AdapterDetail.tsx +208 -0
  163. package/dist/dashboard/routes/adapters/AdapterTypeSection.tsx +105 -0
  164. package/dist/dashboard/routes/adapters/AdaptersPage.tsx +276 -0
  165. package/dist/dashboard/routes/adapters/AdaptersTable.tsx +107 -0
  166. package/dist/dashboard/routes/adapters/index.ts +1 -0
  167. package/dist/dashboard/routes/connections/ConnectionDetail.tsx +218 -0
  168. package/dist/dashboard/routes/connections/ConnectionsList.tsx +34 -0
  169. package/dist/dashboard/routes/connections/index.ts +2 -0
  170. package/dist/dashboard/routes/hooks/Hooks.tsx +425 -0
  171. package/dist/dashboard/routes/hooks/hook-stages.ts +52 -0
  172. package/dist/dashboard/routes/hooks/index.ts +1 -0
  173. package/dist/dashboard/routes/index.ts +8 -0
  174. package/dist/dashboard/routes/logs/Logs.tsx +93 -0
  175. package/dist/dashboard/routes/logs/components/LogDetailDrawer.tsx +118 -0
  176. package/dist/dashboard/routes/logs/components/LogExplorerTab.tsx +367 -0
  177. package/dist/dashboard/routes/logs/components/LogLevelBadge.tsx +34 -0
  178. package/dist/dashboard/routes/logs/components/LogTableRow.tsx +70 -0
  179. package/dist/dashboard/routes/logs/components/LogsOverviewTab.tsx +178 -0
  180. package/dist/dashboard/routes/logs/components/RealtimeLogTab.tsx +122 -0
  181. package/dist/dashboard/routes/logs/index.ts +1 -0
  182. package/dist/dashboard/routes/pipelines/ErrorAuditList.tsx +39 -0
  183. package/dist/dashboard/routes/pipelines/ExportWizardPage.tsx +96 -0
  184. package/dist/dashboard/routes/pipelines/ImportWizardPage.tsx +104 -0
  185. package/dist/dashboard/routes/pipelines/PipelineDetail.tsx +211 -0
  186. package/dist/dashboard/routes/pipelines/PipelineRunsBlock.tsx +377 -0
  187. package/dist/dashboard/routes/pipelines/PipelinesList.tsx +87 -0
  188. package/dist/dashboard/routes/pipelines/RetryPatchHelper.tsx +51 -0
  189. package/dist/dashboard/routes/pipelines/RunDetailsPanel.tsx +238 -0
  190. package/dist/dashboard/routes/pipelines/RunErrorsList.tsx +116 -0
  191. package/dist/dashboard/routes/pipelines/StepCounters.tsx +24 -0
  192. package/dist/dashboard/routes/pipelines/StepSummaryTable.tsx +36 -0
  193. package/dist/dashboard/routes/pipelines/components/DryRunDialog.tsx +341 -0
  194. package/dist/dashboard/routes/pipelines/components/PipelineActionButtons.tsx +201 -0
  195. package/dist/dashboard/routes/pipelines/components/PipelineEditorToggle.tsx +116 -0
  196. package/dist/dashboard/routes/pipelines/components/PipelineFormFields.tsx +156 -0
  197. package/dist/dashboard/routes/pipelines/components/PipelineWebhookInfo.tsx +111 -0
  198. package/dist/dashboard/routes/pipelines/components/ReviewActionsPanel.tsx +342 -0
  199. package/dist/dashboard/routes/pipelines/components/ValidationPanel.tsx +121 -0
  200. package/dist/dashboard/routes/pipelines/components/VersionHistoryDialog.tsx +131 -0
  201. package/dist/dashboard/routes/pipelines/components/index.ts +25 -0
  202. package/dist/dashboard/routes/pipelines/hooks/index.ts +1 -0
  203. package/dist/dashboard/routes/pipelines/hooks/use-pipeline-validation.ts +114 -0
  204. package/dist/dashboard/routes/pipelines/index.ts +4 -0
  205. package/dist/dashboard/routes/pipelines/utils/index.ts +1 -0
  206. package/dist/dashboard/routes/pipelines/utils/pipeline-conversion.ts +261 -0
  207. package/dist/dashboard/routes/queues/ConsumersTable.tsx +134 -0
  208. package/dist/dashboard/routes/queues/DeadLettersTable.tsx +118 -0
  209. package/dist/dashboard/routes/queues/FailedRunsTable.tsx +74 -0
  210. package/dist/dashboard/routes/queues/QueuesPage.tsx +290 -0
  211. package/dist/dashboard/routes/queues/index.ts +1 -0
  212. package/dist/dashboard/routes/queues/types.ts +22 -0
  213. package/dist/dashboard/routes/secrets/SecretDetail.tsx +278 -0
  214. package/dist/dashboard/routes/secrets/SecretsList.tsx +34 -0
  215. package/dist/dashboard/routes/secrets/index.ts +2 -0
  216. package/dist/dashboard/routes/settings/Settings.tsx +343 -0
  217. package/dist/dashboard/routes/settings/index.ts +1 -0
  218. package/dist/dashboard/types/index.ts +89 -0
  219. package/dist/dashboard/types/pipeline.ts +51 -0
  220. package/dist/dashboard/types/ui-types.ts +400 -0
  221. package/dist/dashboard/types/wizard.ts +235 -0
  222. package/dist/dashboard/utils/adapter-grouping.ts +43 -0
  223. package/dist/dashboard/utils/column-analysis.ts +11 -0
  224. package/dist/dashboard/utils/field-preparation.ts +31 -0
  225. package/dist/dashboard/utils/form-validation.ts +373 -0
  226. package/dist/dashboard/utils/formatters.ts +92 -0
  227. package/dist/dashboard/utils/icon-resolver.ts +35 -0
  228. package/dist/dashboard/utils/index.ts +60 -0
  229. package/dist/dashboard/utils/query-key-factory.ts +54 -0
  230. package/dist/dashboard/utils/step-helpers.ts +32 -0
  231. package/dist/dashboard/utils/string-helpers.ts +4 -0
  232. package/dist/dashboard/utils/template-helpers.ts +26 -0
  233. package/dist/dashboard/utils/trigger-sync.ts +138 -0
  234. package/dist/dashboard/utils/wizard-to-pipeline.ts +569 -0
  235. package/package.json +2 -2
@@ -0,0 +1,279 @@
1
+ import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
2
+ import { api } from '@vendure/dashboard';
3
+ import { graphql } from '../../gql';
4
+ import { createMutationErrorHandler } from './mutation-helpers';
5
+ import { createQueryKeys } from '../../utils/query-key-factory';
6
+ import type {
7
+ DataHubPipelineListOptions,
8
+ } from '../../types';
9
+ import { runKeys } from './use-pipeline-runs';
10
+
11
+ const base = createQueryKeys('pipelines');
12
+ export const pipelineKeys = {
13
+ ...base,
14
+ list: (options?: DataHubPipelineListOptions) => [...base.lists(), options] as const,
15
+ timeline: (id: string, limit?: number) => [...base.detail(id), 'timeline', limit] as const,
16
+ };
17
+
18
+ export const pipelinesListDocument = graphql(`
19
+ query DataHubPipelinesForList($options: DataHubPipelineListOptions) {
20
+ dataHubPipelines(options: $options) {
21
+ items {
22
+ id
23
+ code
24
+ name
25
+ enabled
26
+ status
27
+ updatedAt
28
+ }
29
+ totalItems
30
+ }
31
+ }
32
+ `);
33
+
34
+ export const pipelineDetailDocument = graphql(`
35
+ query DataHubPipelineDetail($id: ID!) {
36
+ dataHubPipeline(id: $id) {
37
+ id
38
+ createdAt
39
+ updatedAt
40
+ code
41
+ name
42
+ enabled
43
+ status
44
+ version
45
+ publishedAt
46
+ definition
47
+ }
48
+ }
49
+ `);
50
+
51
+ export const createPipelineDocument = graphql(`
52
+ mutation CreateDataHubPipelineApi($input: CreateDataHubPipelineInput!) {
53
+ createDataHubPipeline(input: $input) {
54
+ id
55
+ code
56
+ name
57
+ }
58
+ }
59
+ `);
60
+
61
+ export const updatePipelineDocument = graphql(`
62
+ mutation UpdateDataHubPipelineApi($input: UpdateDataHubPipelineInput!) {
63
+ updateDataHubPipeline(input: $input) {
64
+ id
65
+ code
66
+ name
67
+ }
68
+ }
69
+ `);
70
+
71
+ export const deletePipelineDocument = graphql(`
72
+ mutation DeleteDataHubPipelineApi($id: ID!) {
73
+ deleteDataHubPipeline(id: $id) {
74
+ result
75
+ }
76
+ }
77
+ `);
78
+
79
+ const runPipelineDocument = graphql(`
80
+ mutation RunDataHubPipelineApi($pipelineId: ID!) {
81
+ startDataHubPipelineRun(pipelineId: $pipelineId) {
82
+ id
83
+ status
84
+ }
85
+ }
86
+ `);
87
+
88
+ export const validatePipelineDefinitionDocument = graphql(`
89
+ query ValidateDataHubPipelineDefinitionApi($definition: JSON!, $level: String) {
90
+ validateDataHubPipelineDefinition(definition: $definition, level: $level) {
91
+ isValid
92
+ issues {
93
+ message
94
+ stepKey
95
+ reason
96
+ field
97
+ }
98
+ warnings {
99
+ message
100
+ stepKey
101
+ reason
102
+ field
103
+ }
104
+ level
105
+ }
106
+ }
107
+ `);
108
+
109
+ const dryRunPipelineDocument = graphql(`
110
+ mutation DryRunDataHubPipelineApi($pipelineId: ID!) {
111
+ startDataHubPipelineDryRun(pipelineId: $pipelineId) {
112
+ metrics
113
+ notes
114
+ sampleRecords { step before after }
115
+ }
116
+ }
117
+ `);
118
+
119
+ export const pipelineTimelineDocument = graphql(`
120
+ query DataHubPipelineTimelineApi($pipelineId: ID!, $limit: Int) {
121
+ dataHubPipelineTimeline(pipelineId: $pipelineId, limit: $limit) {
122
+ revision {
123
+ id
124
+ createdAt
125
+ version
126
+ type
127
+ commitMessage
128
+ authorName
129
+ changesSummary
130
+ isLatest
131
+ isCurrent
132
+ }
133
+ runCount
134
+ lastRunAt
135
+ lastRunStatus
136
+ }
137
+ }
138
+ `);
139
+
140
+ const submitPipelineForReviewDocument = graphql(`
141
+ mutation SubmitDataHubPipelineForReviewApi($id: ID!) {
142
+ submitDataHubPipelineForReview(id: $id) {
143
+ id
144
+ status
145
+ }
146
+ }
147
+ `);
148
+
149
+ const approvePipelineDocument = graphql(`
150
+ mutation ApproveDataHubPipelineApi($id: ID!) {
151
+ approveDataHubPipeline(id: $id) {
152
+ id
153
+ status
154
+ }
155
+ }
156
+ `);
157
+
158
+ const rejectPipelineDocument = graphql(`
159
+ mutation RejectDataHubPipelineReviewApi($id: ID!) {
160
+ rejectDataHubPipelineReview(id: $id) {
161
+ id
162
+ status
163
+ }
164
+ }
165
+ `);
166
+
167
+ const publishPipelineDocument = graphql(`
168
+ mutation PublishDataHubPipelineApi($id: ID!) {
169
+ publishDataHubPipeline(id: $id) {
170
+ id
171
+ status
172
+ publishedAt
173
+ }
174
+ }
175
+ `);
176
+
177
+ const archivePipelineDocument = graphql(`
178
+ mutation ArchiveDataHubPipelineApi($id: ID!) {
179
+ archiveDataHubPipeline(id: $id) {
180
+ id
181
+ status
182
+ }
183
+ }
184
+ `);
185
+
186
+ export function usePipelines(options?: DataHubPipelineListOptions) {
187
+ return useQuery({
188
+ queryKey: pipelineKeys.list(options),
189
+ queryFn: () =>
190
+ api.query(pipelinesListDocument, { options }).then((res) => res.dataHubPipelines),
191
+ });
192
+ }
193
+
194
+ export function useRunPipeline() {
195
+ const queryClient = useQueryClient();
196
+
197
+ return useMutation({
198
+ mutationFn: (pipelineId: string) =>
199
+ api.mutate(runPipelineDocument, { pipelineId }).then((res) => res.startDataHubPipelineRun),
200
+ onSuccess: (_data, pipelineId) => {
201
+ queryClient.invalidateQueries({ queryKey: runKeys.lists() });
202
+ queryClient.invalidateQueries({ queryKey: pipelineKeys.detail(pipelineId) });
203
+ },
204
+ onError: createMutationErrorHandler('run pipeline'),
205
+ });
206
+ }
207
+
208
+ interface ValidatePipelineDefinitionInput {
209
+ definition: Record<string, unknown>;
210
+ level?: string;
211
+ }
212
+
213
+ export function useValidatePipelineDefinition() {
214
+ return useMutation({
215
+ mutationFn: ({ definition, level }: ValidatePipelineDefinitionInput) =>
216
+ api
217
+ .query(validatePipelineDefinitionDocument, { definition, level })
218
+ .then((res) => res.validateDataHubPipelineDefinition),
219
+ onError: createMutationErrorHandler('validate pipeline definition'),
220
+ });
221
+ }
222
+
223
+ export function useDryRunPipeline(pipelineId: string | undefined) {
224
+ const queryClient = useQueryClient();
225
+
226
+ return useMutation({
227
+ mutationFn: () => {
228
+ if (!pipelineId) {
229
+ return Promise.reject(new Error('Pipeline ID is required'));
230
+ }
231
+ return api
232
+ .mutate(dryRunPipelineDocument, { pipelineId })
233
+ .then((res) => res.startDataHubPipelineDryRun);
234
+ },
235
+ onSuccess: () => {
236
+ if (pipelineId) {
237
+ queryClient.invalidateQueries({ queryKey: pipelineKeys.detail(pipelineId) });
238
+ }
239
+ },
240
+ onError: createMutationErrorHandler('dry run pipeline'),
241
+ });
242
+ }
243
+
244
+ function createPipelineStatusHook<TDoc extends Parameters<typeof api.mutate>[0]>(
245
+ document: TDoc,
246
+ resultKey: string,
247
+ actionName: string,
248
+ ) {
249
+ return function usePipelineStatusMutation() {
250
+ const queryClient = useQueryClient();
251
+ return useMutation({
252
+ mutationFn: (id: string) =>
253
+ api.mutate(document, { id }).then((res) => (res as Record<string, unknown>)[resultKey]),
254
+ onSuccess: (data) => {
255
+ queryClient.invalidateQueries({ queryKey: pipelineKeys.lists() });
256
+ if (data && typeof data === 'object' && 'id' in data) {
257
+ queryClient.invalidateQueries({ queryKey: pipelineKeys.detail(String(data.id)) });
258
+ }
259
+ },
260
+ onError: createMutationErrorHandler(actionName),
261
+ });
262
+ };
263
+ }
264
+
265
+ export const useSubmitPipelineForReview = createPipelineStatusHook(
266
+ submitPipelineForReviewDocument, 'submitDataHubPipelineForReview', 'submit pipeline for review',
267
+ );
268
+ export const useApprovePipeline = createPipelineStatusHook(
269
+ approvePipelineDocument, 'approveDataHubPipeline', 'approve pipeline',
270
+ );
271
+ export const useRejectPipeline = createPipelineStatusHook(
272
+ rejectPipelineDocument, 'rejectDataHubPipelineReview', 'reject pipeline',
273
+ );
274
+ export const usePublishPipeline = createPipelineStatusHook(
275
+ publishPipelineDocument, 'publishDataHubPipeline', 'publish pipeline',
276
+ );
277
+ export const useArchivePipeline = createPipelineStatusHook(
278
+ archivePipelineDocument, 'archiveDataHubPipeline', 'archive pipeline',
279
+ );
@@ -0,0 +1,141 @@
1
+ import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
2
+ import { api } from '@vendure/dashboard';
3
+ import { graphql } from '../../gql';
4
+ import { createMutationErrorHandler } from './mutation-helpers';
5
+ import { createQueryKeys } from '../../utils/query-key-factory';
6
+ import { POLLING_INTERVALS } from '../../constants';
7
+
8
+ const base = createQueryKeys('queues');
9
+ export const queueKeys = {
10
+ ...base,
11
+ stats: () => [...base.all, 'stats'] as const,
12
+ deadLetters: () => [...base.all, 'deadLetters'] as const,
13
+ consumers: () => [...base.all, 'consumers'] as const,
14
+ };
15
+
16
+ const statsDocument = graphql(`
17
+ query DataHubQueueStatsApi {
18
+ dataHubQueueStats {
19
+ pending
20
+ running
21
+ failed
22
+ completedToday
23
+ byPipeline {
24
+ code
25
+ pending
26
+ running
27
+ }
28
+ recentFailed {
29
+ id
30
+ code
31
+ finishedAt
32
+ error
33
+ }
34
+ }
35
+ }
36
+ `);
37
+
38
+ const deadLettersDocument = graphql(`
39
+ query DataHubDeadLettersApi {
40
+ dataHubDeadLetters {
41
+ id
42
+ stepKey
43
+ message
44
+ payload
45
+ }
46
+ }
47
+ `);
48
+
49
+ const consumersDocument = graphql(`
50
+ query DataHubConsumersApi {
51
+ dataHubConsumers {
52
+ pipelineCode
53
+ queueName
54
+ isActive
55
+ messagesProcessed
56
+ messagesFailed
57
+ lastMessageAt
58
+ }
59
+ }
60
+ `);
61
+
62
+ const startConsumerDocument = graphql(`
63
+ mutation StartDataHubConsumerApi($pipelineCode: String!) {
64
+ startDataHubConsumer(pipelineCode: $pipelineCode)
65
+ }
66
+ `);
67
+
68
+ const stopConsumerDocument = graphql(`
69
+ mutation StopDataHubConsumerApi($pipelineCode: String!) {
70
+ stopDataHubConsumer(pipelineCode: $pipelineCode)
71
+ }
72
+ `);
73
+
74
+ const markDeadLetterDocument = graphql(`
75
+ mutation MarkDataHubDeadLetterApi($id: ID!, $deadLetter: Boolean!) {
76
+ markDataHubDeadLetter(id: $id, deadLetter: $deadLetter)
77
+ }
78
+ `);
79
+
80
+ export function useQueueStats() {
81
+ return useQuery({
82
+ queryKey: queueKeys.stats(),
83
+ queryFn: () => api.query(statsDocument).then((res) => res.dataHubQueueStats),
84
+ refetchInterval: POLLING_INTERVALS.QUEUES,
85
+ });
86
+ }
87
+
88
+ export function useDeadLetters() {
89
+ return useQuery({
90
+ queryKey: queueKeys.deadLetters(),
91
+ queryFn: () => api.query(deadLettersDocument).then((res) => res.dataHubDeadLetters),
92
+ });
93
+ }
94
+
95
+ export function useConsumers() {
96
+ return useQuery({
97
+ queryKey: queueKeys.consumers(),
98
+ queryFn: () => api.query(consumersDocument).then((res) => res.dataHubConsumers),
99
+ refetchInterval: POLLING_INTERVALS.CONSUMERS,
100
+ });
101
+ }
102
+
103
+ export function useStartConsumer() {
104
+ const queryClient = useQueryClient();
105
+
106
+ return useMutation({
107
+ mutationFn: ({ pipelineCode }: { pipelineCode: string }) =>
108
+ api.mutate(startConsumerDocument, { pipelineCode }).then((res) => res.startDataHubConsumer),
109
+ onSuccess: () => {
110
+ queryClient.invalidateQueries({ queryKey: queueKeys.consumers() });
111
+ },
112
+ onError: createMutationErrorHandler('start consumer'),
113
+ });
114
+ }
115
+
116
+ export function useStopConsumer() {
117
+ const queryClient = useQueryClient();
118
+
119
+ return useMutation({
120
+ mutationFn: ({ pipelineCode }: { pipelineCode: string }) =>
121
+ api.mutate(stopConsumerDocument, { pipelineCode }).then((res) => res.stopDataHubConsumer),
122
+ onSuccess: () => {
123
+ queryClient.invalidateQueries({ queryKey: queueKeys.consumers() });
124
+ },
125
+ onError: createMutationErrorHandler('stop consumer'),
126
+ });
127
+ }
128
+
129
+ export function useMarkDeadLetter() {
130
+ const queryClient = useQueryClient();
131
+
132
+ return useMutation({
133
+ mutationFn: ({ id, deadLetter }: { id: string; deadLetter: boolean }) =>
134
+ api.mutate(markDeadLetterDocument, { id, deadLetter }).then((res) => res.markDataHubDeadLetter),
135
+ onSuccess: () => {
136
+ queryClient.invalidateQueries({ queryKey: queueKeys.deadLetters() });
137
+ queryClient.invalidateQueries({ queryKey: queueKeys.stats() });
138
+ },
139
+ onError: createMutationErrorHandler('mark dead letter'),
140
+ });
141
+ }
@@ -0,0 +1,75 @@
1
+ import { useQuery } from '@tanstack/react-query';
2
+ import { api } from '@vendure/dashboard';
3
+ import { graphql } from '../../gql';
4
+ import { createQueryKeys } from '../../utils/query-key-factory';
5
+ import type {
6
+ DataHubSecretListOptions,
7
+ } from '../../types';
8
+
9
+ const base = createQueryKeys('secrets');
10
+ const secretKeys = {
11
+ ...base,
12
+ list: (options?: DataHubSecretListOptions) => [...base.lists(), options] as const,
13
+ codes: () => [...base.all, 'codes'] as const,
14
+ };
15
+
16
+ export const secretsListDocument = graphql(`
17
+ query DataHubSecretsForList($options: DataHubSecretListOptions) {
18
+ dataHubSecrets(options: $options) {
19
+ items {
20
+ id
21
+ code
22
+ provider
23
+ }
24
+ totalItems
25
+ }
26
+ }
27
+ `);
28
+
29
+ export const secretDetailDocument = graphql(`
30
+ query DataHubSecretDetailApi($id: ID!) {
31
+ dataHubSecret(id: $id) {
32
+ id
33
+ code
34
+ provider
35
+ value
36
+ metadata
37
+ }
38
+ }
39
+ `);
40
+
41
+ export const createSecretDocument = graphql(`
42
+ mutation CreateDataHubSecretApi($input: CreateDataHubSecretInput!) {
43
+ createDataHubSecret(input: $input) {
44
+ id
45
+ code
46
+ }
47
+ }
48
+ `);
49
+
50
+ export const updateSecretDocument = graphql(`
51
+ mutation UpdateDataHubSecretApi($input: UpdateDataHubSecretInput!) {
52
+ updateDataHubSecret(input: $input) {
53
+ id
54
+ code
55
+ }
56
+ }
57
+ `);
58
+
59
+ export const deleteSecretDocument = graphql(`
60
+ mutation DeleteDataHubSecretApi($id: ID!) {
61
+ deleteDataHubSecret(id: $id) {
62
+ result
63
+ }
64
+ }
65
+ `);
66
+
67
+ export function useSecrets(options?: DataHubSecretListOptions) {
68
+ return useQuery({
69
+ queryKey: secretKeys.list(options),
70
+ queryFn: () =>
71
+ api.query(secretsListDocument, { options }).then((res) => res.dataHubSecrets),
72
+ });
73
+ }
74
+
75
+
@@ -0,0 +1,55 @@
1
+ import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
2
+ import { api } from '@vendure/dashboard';
3
+ import { graphql } from '../../gql';
4
+ import { createMutationErrorHandler, createMutationSuccessHandler } from './mutation-helpers';
5
+ import { createQueryKeys } from '../../utils/query-key-factory';
6
+ import type { DataHubSettingsInput } from '../../types';
7
+
8
+ const base = createQueryKeys('settings');
9
+ const settingsKeys = {
10
+ all: base.all,
11
+ detail: base.details,
12
+ };
13
+
14
+ const settingsDocument = graphql(`
15
+ query DataHubSettingsApi {
16
+ dataHubSettings {
17
+ retentionDaysRuns
18
+ retentionDaysErrors
19
+ retentionDaysLogs
20
+ logPersistenceLevel
21
+ }
22
+ }
23
+ `);
24
+
25
+ const setSettingsDocument = graphql(`
26
+ mutation UpdateDataHubSettingsApi($input: DataHubSettingsInput!) {
27
+ updateDataHubSettings(input: $input) {
28
+ retentionDaysRuns
29
+ retentionDaysErrors
30
+ retentionDaysLogs
31
+ logPersistenceLevel
32
+ }
33
+ }
34
+ `);
35
+
36
+ export function useSettings() {
37
+ return useQuery({
38
+ queryKey: settingsKeys.detail(),
39
+ queryFn: () => api.query(settingsDocument).then((res) => res.dataHubSettings),
40
+ });
41
+ }
42
+
43
+ export function useUpdateSettings() {
44
+ const queryClient = useQueryClient();
45
+
46
+ return useMutation({
47
+ mutationFn: (input: DataHubSettingsInput) =>
48
+ api.mutate(setSettingsDocument, { input }).then((res) => res.updateDataHubSettings),
49
+ onSuccess: () => {
50
+ queryClient.invalidateQueries({ queryKey: settingsKeys.detail() });
51
+ createMutationSuccessHandler('Settings updated')();
52
+ },
53
+ onError: createMutationErrorHandler('update settings'),
54
+ });
55
+ }
@@ -0,0 +1,79 @@
1
+ import { api } from '@vendure/dashboard';
2
+ import { graphql } from '../../gql';
3
+ import type { JsonObject } from '../../types';
4
+
5
+ /** Record type used in step testing */
6
+ type TestRecord = JsonObject;
7
+
8
+ const previewExtractDocument = graphql(`
9
+ mutation PreviewDataHubExtractApi($step: JSON!, $limit: Int) {
10
+ previewDataHubExtract(step: $step, limit: $limit) { records }
11
+ }
12
+ `);
13
+
14
+ const simulateTransformDocument = graphql(`
15
+ mutation SimulateDataHubTransformApi($step: JSON!, $records: JSON!) {
16
+ simulateDataHubTransform(step: $step, records: $records)
17
+ }
18
+ `);
19
+
20
+ const simulateLoadDocument = graphql(`
21
+ mutation SimulateDataHubLoadApi($step: JSON!, $records: JSON!) {
22
+ simulateDataHubLoad(step: $step, records: $records)
23
+ }
24
+ `);
25
+
26
+ const simulateValidateDocument = graphql(`
27
+ mutation SimulateDataHubValidateApi($step: JSON!, $records: JSON!) {
28
+ simulateDataHubValidate(step: $step, records: $records) {
29
+ records
30
+ summary { input passed failed passRate }
31
+ }
32
+ }
33
+ `);
34
+
35
+ const previewFeedDocument = graphql(`
36
+ mutation PreviewDataHubFeedApi($feedCode: String!, $limit: Int) {
37
+ previewDataHubFeed(feedCode: $feedCode, limit: $limit) { content contentType itemCount }
38
+ }
39
+ `);
40
+
41
+ interface PreviewExtractInput {
42
+ step: JsonObject;
43
+ limit: number;
44
+ }
45
+
46
+ interface SimulateStepInput {
47
+ step: JsonObject;
48
+ records: TestRecord[];
49
+ }
50
+
51
+ interface PreviewFeedInput {
52
+ feedCode: string;
53
+ limit: number;
54
+ }
55
+
56
+ export async function previewExtract(step: JsonObject, limit: number): Promise<TestRecord[]> {
57
+ const res = await api.mutate(previewExtractDocument, { step, limit });
58
+ return (res?.previewDataHubExtract?.records ?? []) as TestRecord[];
59
+ }
60
+
61
+ export async function simulateTransform(step: JsonObject, records: TestRecord[]): Promise<TestRecord[]> {
62
+ const res = await api.mutate(simulateTransformDocument, { step, records });
63
+ return (res?.simulateDataHubTransform ?? []) as TestRecord[];
64
+ }
65
+
66
+ export async function simulateLoad(step: JsonObject, records: TestRecord[]): Promise<JsonObject> {
67
+ const res = await api.mutate(simulateLoadDocument, { step, records });
68
+ return (res?.simulateDataHubLoad ?? {}) as JsonObject;
69
+ }
70
+
71
+ export async function simulateValidate(step: JsonObject, records: TestRecord[]) {
72
+ const res = await api.mutate(simulateValidateDocument, { step, records });
73
+ return res?.simulateDataHubValidate;
74
+ }
75
+
76
+ export async function previewFeed(feedCode: string, limit: number) {
77
+ const res = await api.mutate(previewFeedDocument, { feedCode, limit });
78
+ return res?.previewDataHubFeed;
79
+ }
@@ -0,0 +1,13 @@
1
+ export { useAdapterCatalog } from './use-adapter-catalog';
2
+ export type {
3
+ AdapterMetadata,
4
+ } from './use-adapter-catalog';
5
+
6
+ export * from './api';
7
+
8
+ export { useStableKeys } from './use-stable-keys';
9
+
10
+ export { useLoadMore } from './use-load-more';
11
+
12
+ export { useTriggerTypes, useTriggerIconResolver } from './use-trigger-types';
13
+ export type { TriggerTypeConfig, WizardTriggerOption } from './use-trigger-types';