@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,513 @@
1
+ import { useMemo } from 'react';
2
+ import { useQuery } from '@tanstack/react-query';
3
+ import { api } from '@vendure/dashboard';
4
+ import { graphql } from '../../gql';
5
+ import { createQueryKeys } from '../../utils/query-key-factory';
6
+ import { CACHE_TIMES, DEFAULT_STEP_CONFIGS } from '../../constants';
7
+ import { buildStepMappings, FALLBACK_STEP_MAPPINGS } from '../../constants/step-mappings';
8
+ import type { StepMappings } from '../../constants/step-mappings';
9
+ import type { StepConfig } from '../../constants/steps';
10
+ import type { StepType } from '../../../shared/types';
11
+
12
+ const base = createQueryKeys('config-options');
13
+ const configOptionKeys = {
14
+ ...base,
15
+ options: () => [...base.all, 'options'] as const,
16
+ };
17
+
18
+ const configOptionsDocument = graphql(`
19
+ query DataHubConfigOptionsApi {
20
+ dataHubConfigOptions {
21
+ stepTypes { type label description icon color bgColor borderColor inputs outputs category adapterType nodeType }
22
+ loadStrategies { value label description icon }
23
+ conflictStrategies { value label description icon }
24
+ triggerTypes { value label description icon fields { key label type required placeholder defaultValue description options { value label } optionsRef } defaultValues configKeyMap wizardScopes }
25
+ fileEncodings { value label description icon }
26
+ csvDelimiters { value label description icon }
27
+ compressionTypes { value label description icon }
28
+ httpMethods { value label description icon }
29
+ authTypes { value label description icon }
30
+ destinationTypes { value label description icon }
31
+ fileFormats { value label extensions mimeTypes supportsPreview requiresClientParser description }
32
+ cleanupStrategies { value label description icon }
33
+ newRecordStrategies { value label description icon }
34
+ validationModes { value label description icon }
35
+ queueTypes { value label description icon }
36
+ vendureEvents { value label description icon category }
37
+ comparisonOperators { value label description valueType noValue example }
38
+ approvalTypes { value label description icon fields { key label type required placeholder defaultValue description options { value label } } defaultValues }
39
+ backoffStrategies { value label description icon }
40
+ enrichmentSourceTypes { value label description icon fields { key label type required placeholder defaultValue description options { value label } } defaultValues }
41
+ validationRuleTypes { value label description icon fields { key label type required placeholder defaultValue description options { value label } } defaultValues }
42
+ exportAdapterCodes { value label adapterCode }
43
+ feedAdapterCodes { value label adapterCode }
44
+ connectionSchemas {
45
+ type
46
+ label
47
+ fields { key label type required placeholder defaultValue description options { value label } }
48
+ httpLike
49
+ }
50
+ destinationSchemas {
51
+ type
52
+ label
53
+ configKey
54
+ message
55
+ fieldMapping
56
+ fields { key label type required placeholder defaultValue description options { value label } }
57
+ }
58
+ hookStages { key label description icon category }
59
+ hookStageCategories { key label color description gridClass order }
60
+ logLevels { value label description icon }
61
+ runModes { value label description icon }
62
+ checkpointStrategies { value label description icon }
63
+ parallelErrorPolicies { value label description icon }
64
+ logPersistenceLevels { value label description icon }
65
+ adapterTypes { value label description icon }
66
+ runStatuses { value label description icon }
67
+ fieldTransformTypes { value label description icon category }
68
+ wizardStrategyMappings { wizardValue label loadStrategy conflictStrategy }
69
+ queryTypeOptions { value label description icon }
70
+ cronPresets { value label description icon }
71
+ ackModes { value label description icon }
72
+ }
73
+ }
74
+ `);
75
+
76
+ export interface StepTypeConfig {
77
+ type: string;
78
+ label: string;
79
+ description: string;
80
+ icon: string;
81
+ color: string;
82
+ bgColor: string;
83
+ borderColor: string;
84
+ inputs: number;
85
+ outputs: number;
86
+ category: string;
87
+ /** Backend adapter type for registry lookup (e.g. EXTRACTOR, OPERATOR, LOADER). Null for step types without adapters. */
88
+ adapterType: string | null;
89
+ /** Visual node type for the pipeline editor (e.g. source, transform, load). */
90
+ nodeType: string;
91
+ }
92
+
93
+ export interface ConfigOptionValue {
94
+ value: string;
95
+ label: string;
96
+ description?: string | null;
97
+ /** Lucide icon name (kebab-case) for UI display, provided by backend */
98
+ icon?: string | null;
99
+ /** Hex color code for UI display (e.g. '#3b82f6'), provided by backend */
100
+ color?: string | null;
101
+ /** Optional category for UI grouping (e.g. Catalog, Orders) */
102
+ category?: string | null;
103
+ }
104
+
105
+ export interface TypedOptionValue extends ConfigOptionValue {
106
+ /** Form field definitions for this option type */
107
+ fields: ConnectionSchemaField[];
108
+ /** Default values when creating a new entry of this type */
109
+ defaultValues?: Record<string, unknown> | null;
110
+ /** Key map for converting wizard field names to pipeline config keys */
111
+ configKeyMap?: Record<string, string> | null;
112
+ /** Which wizard scopes this option appears in */
113
+ wizardScopes?: string[] | null;
114
+ }
115
+
116
+ export interface ComparisonOperatorOption {
117
+ value: string;
118
+ label: string;
119
+ description?: string | null;
120
+ /** Value type hint for UI rendering: 'any' | 'number' | 'array' | 'regex' | 'string' */
121
+ valueType?: string | null;
122
+ /** True for operators that require no value input (e.g. isEmpty, exists) */
123
+ noValue?: boolean | null;
124
+ /** Example value hint shown in the UI (e.g. regex pattern) */
125
+ example?: string | null;
126
+ }
127
+
128
+ export interface AdapterCodeMapping {
129
+ value: string;
130
+ label: string;
131
+ adapterCode: string;
132
+ }
133
+
134
+ export interface WizardStrategyMapping {
135
+ /** Wizard-internal value for existing records strategy (e.g. SKIP, UPDATE, REPLACE, ERROR) */
136
+ wizardValue: string;
137
+ /** Human-readable label */
138
+ label: string;
139
+ /** Backend LoadStrategy to use (e.g. CREATE, UPSERT) */
140
+ loadStrategy: string;
141
+ /** Backend ConflictStrategy to use (e.g. SOURCE_WINS, MERGE) */
142
+ conflictStrategy: string;
143
+ }
144
+
145
+ export interface ConnectionSchemaFieldOption {
146
+ value: string;
147
+ label: string;
148
+ }
149
+
150
+ export interface ConnectionSchemaField {
151
+ key: string;
152
+ label: string;
153
+ type: string;
154
+ required?: boolean | null;
155
+ placeholder?: string | null;
156
+ defaultValue?: unknown;
157
+ description?: string | null;
158
+ options?: ConnectionSchemaFieldOption[] | null;
159
+ /** Reference to a dynamic option list served by configOptions (e.g. 'authTypes', 'queueTypes', 'vendureEvents') */
160
+ optionsRef?: string | null;
161
+ }
162
+
163
+ export interface ConnectionSchema {
164
+ type: string;
165
+ label: string;
166
+ fields: ConnectionSchemaField[];
167
+ /** True for HTTP-like connection types that use the dedicated HTTP editor with auth/headers support */
168
+ httpLike?: boolean | null;
169
+ }
170
+
171
+ export interface DestinationSchema {
172
+ /** Destination type key (e.g. SFTP, S3, HTTP) */
173
+ type: string;
174
+ /** Human-readable label */
175
+ label: string;
176
+ /** Key in the wizard destination state object (e.g. sftpConfig, s3Config) */
177
+ configKey: string;
178
+ /** Informational message for destination types with no configurable fields */
179
+ message?: string | null;
180
+ /**
181
+ * Maps wizard field names to pipeline config field names.
182
+ * When set, the wizard-to-pipeline converter renames fields accordingly.
183
+ * Example: `{ directory: 'path', filename: 'filenamePattern' }`.
184
+ */
185
+ fieldMapping?: Record<string, string> | null;
186
+ /** Field definitions for the destination configuration form */
187
+ fields: ConnectionSchemaField[];
188
+ }
189
+
190
+ export interface HookStageConfig {
191
+ /** Hook stage key (e.g. PIPELINE_STARTED, BEFORE_EXTRACT) */
192
+ key: string;
193
+ /** Human-readable label */
194
+ label: string;
195
+ /** Description of when this hook stage fires */
196
+ description: string;
197
+ /** Lucide icon name (kebab-case) for UI display */
198
+ icon: string;
199
+ /** Category for grouping (lifecycle, data, error) */
200
+ category: string;
201
+ }
202
+
203
+ export interface HookStageCategoryConfig {
204
+ /** Category key (e.g. lifecycle, data, error) */
205
+ key: string;
206
+ /** Human-readable label */
207
+ label: string;
208
+ /** CSS color classes for the category badge */
209
+ color: string;
210
+ /** Description of this category */
211
+ description: string;
212
+ /** CSS grid class for layout (e.g. grid-cols-3) */
213
+ gridClass: string;
214
+ /** Display order (lower = first) */
215
+ order: number;
216
+ }
217
+
218
+ /** Matches the GraphQL DataHubConfigOptions type. */
219
+ interface ConfigOptionsData {
220
+ stepTypes: StepTypeConfig[];
221
+ loadStrategies: ConfigOptionValue[];
222
+ conflictStrategies: ConfigOptionValue[];
223
+ triggerTypes: TypedOptionValue[];
224
+ fileEncodings: ConfigOptionValue[];
225
+ csvDelimiters: ConfigOptionValue[];
226
+ compressionTypes: ConfigOptionValue[];
227
+ httpMethods: ConfigOptionValue[];
228
+ authTypes: ConfigOptionValue[];
229
+ destinationTypes: ConfigOptionValue[];
230
+ fileFormats: ConfigOptionValue[];
231
+ cleanupStrategies: ConfigOptionValue[];
232
+ newRecordStrategies: ConfigOptionValue[];
233
+ validationModes: ConfigOptionValue[];
234
+ queueTypes: ConfigOptionValue[];
235
+ vendureEvents: ConfigOptionValue[];
236
+ comparisonOperators: ComparisonOperatorOption[];
237
+ approvalTypes: TypedOptionValue[];
238
+ backoffStrategies: ConfigOptionValue[];
239
+ enrichmentSourceTypes: TypedOptionValue[];
240
+ validationRuleTypes: TypedOptionValue[];
241
+ exportAdapterCodes: AdapterCodeMapping[];
242
+ feedAdapterCodes: AdapterCodeMapping[];
243
+ connectionSchemas: ConnectionSchema[];
244
+ destinationSchemas: DestinationSchema[];
245
+ hookStages: HookStageConfig[];
246
+ hookStageCategories: HookStageCategoryConfig[];
247
+ logLevels: ConfigOptionValue[];
248
+ runModes: ConfigOptionValue[];
249
+ checkpointStrategies: ConfigOptionValue[];
250
+ parallelErrorPolicies: ConfigOptionValue[];
251
+ logPersistenceLevels: ConfigOptionValue[];
252
+ adapterTypes: ConfigOptionValue[];
253
+ runStatuses: ConfigOptionValue[];
254
+ fieldTransformTypes: ConfigOptionValue[];
255
+ wizardStrategyMappings: WizardStrategyMapping[];
256
+ queryTypeOptions: ConfigOptionValue[];
257
+ cronPresets: ConfigOptionValue[];
258
+ ackModes: ConfigOptionValue[];
259
+ }
260
+
261
+ /** Fields that return ConfigOptionValue[] (value, label, description). */
262
+ type ConfigOptionValueField = Exclude<keyof ConfigOptionsData, 'stepTypes' | 'comparisonOperators' | 'exportAdapterCodes' | 'feedAdapterCodes' | 'connectionSchemas' | 'destinationSchemas' | 'hookStages' | 'hookStageCategories' | 'triggerTypes' | 'enrichmentSourceTypes' | 'validationRuleTypes' | 'approvalTypes' | 'wizardStrategyMappings'>;
263
+
264
+ /** Fields that return AdapterCodeMapping[] (value, label, adapterCode). */
265
+ type AdapterCodeMappingField = 'exportAdapterCodes' | 'feedAdapterCodes';
266
+
267
+ export type ConfigOptionsField = keyof ConfigOptionsData;
268
+
269
+ export function useConfigOptions() {
270
+ return useQuery({
271
+ queryKey: configOptionKeys.options(),
272
+ queryFn: () => api.query(configOptionsDocument).then((res) => res.dataHubConfigOptions as unknown as ConfigOptionsData),
273
+ staleTime: CACHE_TIMES.ADAPTER_CATALOG,
274
+ });
275
+ }
276
+
277
+ export function useOptionValues(field: ConfigOptionValueField): { options: ConfigOptionValue[]; isLoading: boolean } {
278
+ const { data, isLoading } = useConfigOptions();
279
+ const options = useMemo(
280
+ () => (data?.[field] ?? []).filter(o => o.value !== ''),
281
+ [data, field],
282
+ );
283
+ return { options, isLoading };
284
+ }
285
+
286
+ export function useAdapterCodeMappings(field: AdapterCodeMappingField): { mappings: AdapterCodeMapping[]; isLoading: boolean } {
287
+ const { data, isLoading } = useConfigOptions();
288
+ const mappings = useMemo(
289
+ () => data?.[field] ?? [],
290
+ [data, field],
291
+ );
292
+ return { mappings, isLoading };
293
+ }
294
+
295
+ export function useConnectionSchemas(): { schemas: ConnectionSchema[]; isLoading: boolean } {
296
+ const { data, isLoading } = useConfigOptions();
297
+ const schemas = useMemo(
298
+ () => data?.connectionSchemas ?? [],
299
+ [data],
300
+ );
301
+ return { schemas, isLoading };
302
+ }
303
+
304
+ export function useDestinationSchemas(): { schemas: DestinationSchema[]; isLoading: boolean } {
305
+ const { data, isLoading } = useConfigOptions();
306
+ const schemas = useMemo(
307
+ () => data?.destinationSchemas ?? [],
308
+ [data],
309
+ );
310
+ return { schemas, isLoading };
311
+ }
312
+
313
+ export interface UseStepConfigsResult {
314
+ /** Record of step type to config, backend-driven when loaded, static fallback while loading. */
315
+ stepConfigs: Record<StepType, StepConfig>;
316
+ /** Look up a single step config by type. */
317
+ getStepConfig: (type: StepType | string) => StepConfig | undefined;
318
+ /** Whether the backend data is still loading (using static fallback). */
319
+ isLoading: boolean;
320
+ }
321
+
322
+ /**
323
+ * Provides step type configuration from the backend (label, description, icon, colors, inputs/outputs).
324
+ * Returns `DEFAULT_STEP_CONFIGS` as fallback while backend data is loading.
325
+ */
326
+ export function useStepConfigs(): UseStepConfigsResult {
327
+ const { data, isLoading } = useConfigOptions();
328
+
329
+ const stepConfigs = useMemo<Record<StepType, StepConfig>>(() => {
330
+ if (!data?.stepTypes?.length) return DEFAULT_STEP_CONFIGS;
331
+
332
+ const record = { ...DEFAULT_STEP_CONFIGS };
333
+ for (const st of data.stepTypes) {
334
+ const type = st.type as StepType;
335
+ if (type in record) {
336
+ record[type] = {
337
+ type,
338
+ label: st.label,
339
+ description: st.description,
340
+ icon: st.icon,
341
+ color: st.color,
342
+ bgColor: st.bgColor,
343
+ borderColor: st.borderColor,
344
+ inputs: st.inputs,
345
+ outputs: st.outputs,
346
+ adapterType: st.adapterType ?? null,
347
+ nodeType: st.nodeType,
348
+ };
349
+ }
350
+ }
351
+ return record;
352
+ }, [data]);
353
+
354
+ const getStepConfig = useMemo(
355
+ () => (type: StepType | string): StepConfig | undefined => {
356
+ const normalized = String(type).toUpperCase() as StepType;
357
+ return stepConfigs[normalized];
358
+ },
359
+ [stepConfigs],
360
+ );
361
+
362
+ return { stepConfigs, getStepConfig, isLoading };
363
+ }
364
+
365
+ /**
366
+ * Provides all step mapping tables derived from backend step config data.
367
+ * Returns `FALLBACK_STEP_MAPPINGS` while backend data is loading.
368
+ *
369
+ * The returned mappings include:
370
+ * - `stepTypeToCategory`: StepType -> VisualNodeCategory
371
+ * - `categoryToStepType`: VisualNodeCategory -> StepType
372
+ * - `categoryToAdapterType`: VisualNodeCategory -> AdapterType
373
+ * - `adapterTypeToNodeType`: AdapterType -> VisualNodeCategory
374
+ * - `adapterTypeToCategory`: AdapterType -> UI category label
375
+ * - `categoryColors`: VisualNodeCategory -> hex color
376
+ */
377
+ export function useStepMappings(): { mappings: StepMappings; isLoading: boolean } {
378
+ const { stepConfigs, isLoading } = useStepConfigs();
379
+
380
+ const mappings = useMemo<StepMappings>(() => {
381
+ if (isLoading) return FALLBACK_STEP_MAPPINGS;
382
+ return buildStepMappings(stepConfigs);
383
+ }, [stepConfigs, isLoading]);
384
+
385
+ return { mappings, isLoading };
386
+ }
387
+
388
+ /**
389
+ * Provides hook stage metadata from the backend (key, label, description, icon, category).
390
+ * Returns an empty array while loading.
391
+ */
392
+ export function useHookStages(): { hookStages: HookStageConfig[]; isLoading: boolean } {
393
+ const { data, isLoading } = useConfigOptions();
394
+ const hookStages = useMemo(
395
+ () => data?.hookStages ?? [],
396
+ [data],
397
+ );
398
+ return { hookStages, isLoading };
399
+ }
400
+
401
+ /**
402
+ * Provides hook stage category metadata from the backend (key, label, color, description, gridClass, order).
403
+ * Returns an empty array while loading.
404
+ */
405
+ export function useHookStageCategories(): { categories: HookStageCategoryConfig[]; isLoading: boolean } {
406
+ const { data, isLoading } = useConfigOptions();
407
+ const categories = useMemo(
408
+ () => {
409
+ const raw = data?.hookStageCategories ?? [];
410
+ return [...raw].sort((a, b) => a.order - b.order);
411
+ },
412
+ [data],
413
+ );
414
+ return { categories, isLoading };
415
+ }
416
+
417
+ /**
418
+ * Provides comparison operator definitions from the backend, including UI hint fields
419
+ * (valueType, noValue, example). Returns an empty array while loading.
420
+ */
421
+ export function useComparisonOperators(): { operators: ComparisonOperatorOption[]; isLoading: boolean } {
422
+ const { data, isLoading } = useConfigOptions();
423
+ const operators = useMemo(
424
+ () => data?.comparisonOperators ?? [],
425
+ [data],
426
+ );
427
+ return { operators, isLoading };
428
+ }
429
+
430
+ /**
431
+ * Provides trigger type schemas from the backend, including form field definitions,
432
+ * default values, config key mappings, and wizard scope information.
433
+ */
434
+ export function useTriggerTypeSchemas(): { schemas: TypedOptionValue[]; isLoading: boolean } {
435
+ const { data, isLoading } = useConfigOptions();
436
+ const schemas = useMemo(() => data?.triggerTypes ?? [], [data]);
437
+ return { schemas, isLoading };
438
+ }
439
+
440
+ /**
441
+ * Provides enrichment source type schemas from the backend, including form field definitions
442
+ * and default values.
443
+ */
444
+ export function useEnrichmentSourceSchemas(): { schemas: TypedOptionValue[]; isLoading: boolean } {
445
+ const { data, isLoading } = useConfigOptions();
446
+ const schemas = useMemo(() => data?.enrichmentSourceTypes ?? [], [data]);
447
+ return { schemas, isLoading };
448
+ }
449
+
450
+ /**
451
+ * Provides approval type schemas from the backend for gate step configuration,
452
+ * including per-type form field definitions (e.g. timeout seconds, error threshold).
453
+ */
454
+ export function useApprovalTypeSchemas(): { schemas: TypedOptionValue[]; isLoading: boolean } {
455
+ const { data, isLoading } = useConfigOptions();
456
+ const schemas = useMemo(() => data?.approvalTypes ?? [], [data]);
457
+ return { schemas, isLoading };
458
+ }
459
+
460
+ /**
461
+ * Provides validation rule type schemas from the backend, including form field definitions
462
+ * and default values.
463
+ */
464
+ export function useValidationRuleSchemas(): { schemas: TypedOptionValue[]; isLoading: boolean } {
465
+ const { data, isLoading } = useConfigOptions();
466
+ const schemas = useMemo(() => data?.validationRuleTypes ?? [], [data]);
467
+ return { schemas, isLoading };
468
+ }
469
+
470
+ /**
471
+ * Provides operator codes suitable for field-level transforms in the export wizard.
472
+ * Returns options with value (operator code), label, and optional category grouping.
473
+ */
474
+ export function useFieldTransformTypes(): { options: ConfigOptionValue[]; isLoading: boolean } {
475
+ return useOptionValues('fieldTransformTypes');
476
+ }
477
+
478
+ /**
479
+ * Provides wizard strategy mappings from the backend.
480
+ * Maps wizard existingRecords values (SKIP, UPDATE, REPLACE, ERROR)
481
+ * to backend LoadStrategy and ConflictStrategy values.
482
+ */
483
+ export function useWizardStrategyMappings(): { mappings: WizardStrategyMapping[]; isLoading: boolean } {
484
+ const { data, isLoading } = useConfigOptions();
485
+ const mappings = useMemo(
486
+ () => data?.wizardStrategyMappings ?? [],
487
+ [data],
488
+ );
489
+ return { mappings, isLoading };
490
+ }
491
+
492
+ /**
493
+ * Provides export query type options from the backend (all, query, graphql).
494
+ */
495
+ export function useQueryTypeOptions(): { options: ConfigOptionValue[]; isLoading: boolean } {
496
+ return useOptionValues('queryTypeOptions');
497
+ }
498
+
499
+ /**
500
+ * Provides cron schedule presets from the backend for quick schedule trigger configuration.
501
+ * Each preset has a cron expression (value), human-readable label, and description.
502
+ */
503
+ export function useCronPresets(): { presets: ConfigOptionValue[]; isLoading: boolean } {
504
+ const { options, isLoading } = useOptionValues('cronPresets');
505
+ return { presets: options, isLoading };
506
+ }
507
+
508
+ /**
509
+ * Provides message acknowledgment mode options from the backend for queue consumers.
510
+ */
511
+ export function useAckModes(): { options: ConfigOptionValue[]; isLoading: boolean } {
512
+ return useOptionValues('ackModes');
513
+ }
@@ -0,0 +1,84 @@
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 { QUERY_LIMITS } from '../../constants';
6
+ import type {
7
+ DataHubConnectionListOptions,
8
+ } from '../../types';
9
+
10
+ const base = createQueryKeys('connections');
11
+ const connectionKeys = {
12
+ ...base,
13
+ list: (options?: DataHubConnectionListOptions) => [...base.lists(), options] as const,
14
+ codes: () => [...base.all, 'codes'] as const,
15
+ };
16
+
17
+ export const connectionsListDocument = graphql(`
18
+ query DataHubConnectionsForList($options: DataHubConnectionListOptions) {
19
+ dataHubConnections(options: $options) {
20
+ items {
21
+ id
22
+ code
23
+ type
24
+ }
25
+ totalItems
26
+ }
27
+ }
28
+ `);
29
+
30
+ export const connectionDetailDocument = graphql(`
31
+ query DataHubConnectionDetailApi($id: ID!) {
32
+ dataHubConnection(id: $id) {
33
+ id
34
+ code
35
+ type
36
+ config
37
+ }
38
+ }
39
+ `);
40
+
41
+ export const createConnectionDocument = graphql(`
42
+ mutation CreateDataHubConnectionApi($input: CreateDataHubConnectionInput!) {
43
+ createDataHubConnection(input: $input) {
44
+ id
45
+ code
46
+ }
47
+ }
48
+ `);
49
+
50
+ export const updateConnectionDocument = graphql(`
51
+ mutation UpdateDataHubConnectionApi($input: UpdateDataHubConnectionInput!) {
52
+ updateDataHubConnection(input: $input) {
53
+ id
54
+ code
55
+ }
56
+ }
57
+ `);
58
+
59
+ export const deleteConnectionDocument = graphql(`
60
+ mutation DeleteDataHubConnectionApi($id: ID!) {
61
+ deleteDataHubConnection(id: $id) {
62
+ result
63
+ }
64
+ }
65
+ `);
66
+
67
+ export function useConnections(options?: DataHubConnectionListOptions) {
68
+ return useQuery({
69
+ queryKey: connectionKeys.list(options),
70
+ queryFn: () =>
71
+ api.query(connectionsListDocument, { options }).then((res) => res.dataHubConnections),
72
+ });
73
+ }
74
+
75
+ export function useConnectionCodes() {
76
+ return useQuery({
77
+ queryKey: connectionKeys.codes(),
78
+ queryFn: () =>
79
+ api
80
+ .query(connectionsListDocument, { options: { take: QUERY_LIMITS.ALL_ITEMS } })
81
+ .then((res) => res.dataHubConnections.items.map((c) => c.code)),
82
+ });
83
+ }
84
+
@@ -0,0 +1,99 @@
1
+ import { useCallback, useMemo } from 'react';
2
+ import { useQuery } from '@tanstack/react-query';
3
+ import { api } from '@vendure/dashboard';
4
+ import { graphql } from '../../gql';
5
+ import { createQueryKeys } from '../../utils/query-key-factory';
6
+ import { CACHE_TIMES } from '../../constants';
7
+ import { screamingSnakeToKebab } from '../../../shared/utils/string-case';
8
+
9
+ const base = createQueryKeys('entity-field-schemas');
10
+ const entityFieldSchemaKeys = {
11
+ ...base,
12
+ schemas: () => [...base.all, 'all'] as const,
13
+ };
14
+
15
+ const entityFieldSchemasDocument = graphql(`
16
+ query DataHubEntityFieldSchemasApi {
17
+ dataHubLoaderEntitySchemas {
18
+ entityType
19
+ fields {
20
+ key
21
+ label
22
+ type
23
+ required
24
+ readonly
25
+ lookupable
26
+ }
27
+ }
28
+ }
29
+ `);
30
+
31
+ interface EntityFieldInfo {
32
+ key: string;
33
+ label: string;
34
+ type: string;
35
+ required: boolean;
36
+ readonly: boolean;
37
+ lookupable: boolean;
38
+ }
39
+
40
+ interface EntityFieldSchemaMap {
41
+ [entityCode: string]: EntityFieldInfo[];
42
+ }
43
+
44
+ /**
45
+ * Hook to load entity field schemas from the backend via
46
+ * `dataHubLoaderEntitySchemas`. Returns a map from kebab-case
47
+ * entity code to an array of field definitions.
48
+ *
49
+ * Use `getFieldNames(entityCode)` to get field keys for a given entity.
50
+ * Falls back to an empty array while loading or if the entity is unknown.
51
+ */
52
+ export function useEntityFieldSchemas() {
53
+ const { data, isLoading, ...rest } = useQuery({
54
+ queryKey: entityFieldSchemaKeys.schemas(),
55
+ queryFn: () => api.query(entityFieldSchemasDocument).then(res => res.dataHubLoaderEntitySchemas),
56
+ staleTime: CACHE_TIMES.VENDURE_SCHEMAS,
57
+ });
58
+
59
+ const schemaMap = useMemo<EntityFieldSchemaMap>(() => {
60
+ if (!data) return {};
61
+ const map: EntityFieldSchemaMap = {};
62
+ for (const schema of data) {
63
+ const code = screamingSnakeToKebab(schema.entityType);
64
+ map[code] = schema.fields.map(f => ({
65
+ key: f.key,
66
+ label: f.label,
67
+ type: f.type,
68
+ required: f.required ?? false,
69
+ readonly: f.readonly ?? false,
70
+ lookupable: f.lookupable ?? false,
71
+ }));
72
+ }
73
+ return map;
74
+ }, [data]);
75
+
76
+ const getFieldNames = useCallback(
77
+ (entityCode: string): string[] => {
78
+ const fields = schemaMap[entityCode];
79
+ if (!fields) return [];
80
+ return fields.map(f => f.key);
81
+ },
82
+ [schemaMap],
83
+ );
84
+
85
+ const getFields = useCallback(
86
+ (entityCode: string): EntityFieldInfo[] => {
87
+ return schemaMap[entityCode] ?? [];
88
+ },
89
+ [schemaMap],
90
+ );
91
+
92
+ return {
93
+ ...rest,
94
+ isLoading,
95
+ schemaMap,
96
+ getFieldNames,
97
+ getFields,
98
+ };
99
+ }