@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.
- package/CHANGELOG.md +5 -0
- package/dist/dashboard/components/common/ConnectionConfigEditor.tsx +589 -0
- package/dist/dashboard/components/common/HeadersEditor.tsx +90 -0
- package/dist/dashboard/components/common/ValidationFeedback.tsx +17 -0
- package/dist/dashboard/components/common/index.ts +10 -0
- package/dist/dashboard/components/pipelines/PipelineEditor.tsx +504 -0
- package/dist/dashboard/components/pipelines/PipelineExport.tsx +63 -0
- package/dist/dashboard/components/pipelines/PipelineImport.tsx +87 -0
- package/dist/dashboard/components/pipelines/ReactFlowPipelineEditor.tsx +539 -0
- package/dist/dashboard/components/pipelines/shared/NodePropertiesPanel.tsx +146 -0
- package/dist/dashboard/components/pipelines/shared/PipelineNode.tsx +155 -0
- package/dist/dashboard/components/pipelines/shared/PipelineSettingsPanel.tsx +392 -0
- package/dist/dashboard/components/pipelines/shared/StepListItem.tsx +144 -0
- package/dist/dashboard/components/pipelines/shared/index.ts +33 -0
- package/dist/dashboard/components/pipelines/shared/visual-node-config.ts +169 -0
- package/dist/dashboard/components/shared/LoadMoreButton.tsx +18 -0
- package/dist/dashboard/components/shared/entity-selector/EntitySelector.tsx +59 -0
- package/dist/dashboard/components/shared/entity-selector/index.ts +1 -0
- package/dist/dashboard/components/shared/error-boundary/ErrorBoundary.tsx +90 -0
- package/dist/dashboard/components/shared/error-boundary/index.ts +1 -0
- package/dist/dashboard/components/shared/feedback/EmptyState.tsx +36 -0
- package/dist/dashboard/components/shared/feedback/ErrorState.tsx +69 -0
- package/dist/dashboard/components/shared/feedback/LoadingState.tsx +104 -0
- package/dist/dashboard/components/shared/feedback/ValidationErrorDisplay.tsx +29 -0
- package/dist/dashboard/components/shared/feedback/index.ts +4 -0
- package/dist/dashboard/components/shared/file-dropzone/FileDropzone.tsx +167 -0
- package/dist/dashboard/components/shared/file-dropzone/index.ts +1 -0
- package/dist/dashboard/components/shared/filter-conditions-editor/FilterConditionsEditor.tsx +226 -0
- package/dist/dashboard/components/shared/filter-conditions-editor/index.ts +1 -0
- package/dist/dashboard/components/shared/index.ts +45 -0
- package/dist/dashboard/components/shared/schema-form/SchemaFormRenderer.tsx +248 -0
- package/dist/dashboard/components/shared/schema-form/fields/BooleanField.tsx +26 -0
- package/dist/dashboard/components/shared/schema-form/fields/FieldWrapper.tsx +28 -0
- package/dist/dashboard/components/shared/schema-form/fields/FileUploadField.tsx +171 -0
- package/dist/dashboard/components/shared/schema-form/fields/JsonField.tsx +132 -0
- package/dist/dashboard/components/shared/schema-form/fields/NumberField.tsx +33 -0
- package/dist/dashboard/components/shared/schema-form/fields/SelectField.tsx +70 -0
- package/dist/dashboard/components/shared/schema-form/fields/StringField.tsx +36 -0
- package/dist/dashboard/components/shared/schema-form/fields/TextareaField.tsx +31 -0
- package/dist/dashboard/components/shared/schema-form/fields/index.ts +23 -0
- package/dist/dashboard/components/shared/schema-form/index.ts +2 -0
- package/dist/dashboard/components/shared/schema-form/utils.ts +3 -0
- package/dist/dashboard/components/shared/selectable-card/SelectableCard.tsx +65 -0
- package/dist/dashboard/components/shared/selectable-card/index.ts +1 -0
- package/dist/dashboard/components/shared/stat-card/StatCard.tsx +121 -0
- package/dist/dashboard/components/shared/stat-card/index.ts +1 -0
- package/dist/dashboard/components/shared/step-config/AdapterRequiredWarning.tsx +25 -0
- package/dist/dashboard/components/shared/step-config/AdapterSelector.tsx +109 -0
- package/dist/dashboard/components/shared/step-config/AdvancedEditors.tsx +634 -0
- package/dist/dashboard/components/shared/step-config/EnrichConfigComponent.tsx +295 -0
- package/dist/dashboard/components/shared/step-config/ExtractTestResults.tsx +143 -0
- package/dist/dashboard/components/shared/step-config/GateConfigComponent.tsx +127 -0
- package/dist/dashboard/components/shared/step-config/LoadTestResults.tsx +104 -0
- package/dist/dashboard/components/shared/step-config/OperatorCard.tsx +266 -0
- package/dist/dashboard/components/shared/step-config/OperatorCheatSheetButton.tsx +54 -0
- package/dist/dashboard/components/shared/step-config/OperatorFieldInput.tsx +209 -0
- package/dist/dashboard/components/shared/step-config/RetrySettingsComponent.tsx +111 -0
- package/dist/dashboard/components/shared/step-config/RouteConfigComponent.tsx +125 -0
- package/dist/dashboard/components/shared/step-config/StepConfigPanel.tsx +564 -0
- package/dist/dashboard/components/shared/step-config/StepTester.tsx +165 -0
- package/dist/dashboard/components/shared/step-config/TestResultContainer.tsx +57 -0
- package/dist/dashboard/components/shared/step-config/TransformTestResults.tsx +130 -0
- package/dist/dashboard/components/shared/step-config/ValidateConfigComponent.tsx +334 -0
- package/dist/dashboard/components/shared/step-config/index.ts +29 -0
- package/dist/dashboard/components/shared/step-config/step-test-handlers.ts +297 -0
- package/dist/dashboard/components/shared/trigger-config/TriggerForm.tsx +478 -0
- package/dist/dashboard/components/shared/trigger-config/index.ts +1 -0
- package/dist/dashboard/components/shared/triggers-panel/TriggersPanel.tsx +281 -0
- package/dist/dashboard/components/shared/triggers-panel/index.ts +1 -0
- package/dist/dashboard/components/shared/wizard/ConfigurationNameCard.tsx +59 -0
- package/dist/dashboard/components/shared/wizard/SummaryCard.tsx +53 -0
- package/dist/dashboard/components/shared/wizard/WizardFooter.tsx +47 -0
- package/dist/dashboard/components/shared/wizard/WizardProgressBar.tsx +78 -0
- package/dist/dashboard/components/shared/wizard/index.ts +4 -0
- package/dist/dashboard/components/shared/wizard-trigger/TriggerSchemaFields.tsx +128 -0
- package/dist/dashboard/components/shared/wizard-trigger/TriggerSelector.tsx +33 -0
- package/dist/dashboard/components/shared/wizard-trigger/index.ts +2 -0
- package/dist/dashboard/components/templates/TemplateGallery.tsx +210 -0
- package/dist/dashboard/components/templates/TemplatePreview.tsx +214 -0
- package/dist/dashboard/components/templates/index.ts +4 -0
- package/dist/dashboard/components/wizards/export-wizard/DestinationStep.tsx +207 -0
- package/dist/dashboard/components/wizards/export-wizard/ExportWizard.tsx +221 -0
- package/dist/dashboard/components/wizards/export-wizard/FieldsStep.tsx +159 -0
- package/dist/dashboard/components/wizards/export-wizard/FormatStep.tsx +246 -0
- package/dist/dashboard/components/wizards/export-wizard/ReviewStep.tsx +231 -0
- package/dist/dashboard/components/wizards/export-wizard/SourceStep.tsx +154 -0
- package/dist/dashboard/components/wizards/export-wizard/TriggerStep.tsx +234 -0
- package/dist/dashboard/components/wizards/export-wizard/constants.ts +73 -0
- package/dist/dashboard/components/wizards/export-wizard/index.ts +2 -0
- package/dist/dashboard/components/wizards/export-wizard/types.ts +39 -0
- package/dist/dashboard/components/wizards/import-wizard/ImportWizard.tsx +350 -0
- package/dist/dashboard/components/wizards/import-wizard/MappingStep.tsx +286 -0
- package/dist/dashboard/components/wizards/import-wizard/PreviewStep.tsx +79 -0
- package/dist/dashboard/components/wizards/import-wizard/ReviewStep.tsx +266 -0
- package/dist/dashboard/components/wizards/import-wizard/SourceStep.tsx +537 -0
- package/dist/dashboard/components/wizards/import-wizard/StrategyStep.tsx +328 -0
- package/dist/dashboard/components/wizards/import-wizard/TargetStep.tsx +76 -0
- package/dist/dashboard/components/wizards/import-wizard/TemplateStep.tsx +116 -0
- package/dist/dashboard/components/wizards/import-wizard/TransformStep.tsx +666 -0
- package/dist/dashboard/components/wizards/import-wizard/TriggerStep.tsx +51 -0
- package/dist/dashboard/components/wizards/import-wizard/constants.ts +104 -0
- package/dist/dashboard/components/wizards/import-wizard/index.ts +3 -0
- package/dist/dashboard/components/wizards/import-wizard/types.ts +35 -0
- package/dist/dashboard/components/wizards/index.ts +7 -0
- package/dist/dashboard/components/wizards/shared/WizardStepContainer.tsx +27 -0
- package/dist/dashboard/components/wizards/shared/constants.ts +16 -0
- package/dist/dashboard/components/wizards/shared/index.ts +10 -0
- package/dist/dashboard/constants/colors.ts +25 -0
- package/dist/dashboard/constants/connection-defaults.ts +7 -0
- package/dist/dashboard/constants/connection-types.ts +1 -0
- package/dist/dashboard/constants/defaults.ts +18 -0
- package/dist/dashboard/constants/editor.ts +69 -0
- package/dist/dashboard/constants/enum-maps.ts +18 -0
- package/dist/dashboard/constants/fallbacks.ts +44 -0
- package/dist/dashboard/constants/file-format-registry.ts +206 -0
- package/dist/dashboard/constants/index.ts +24 -0
- package/dist/dashboard/constants/navigation.ts +29 -0
- package/dist/dashboard/constants/permissions.ts +41 -0
- package/dist/dashboard/constants/placeholders.ts +77 -0
- package/dist/dashboard/constants/routes.ts +12 -0
- package/dist/dashboard/constants/run-status.ts +1 -0
- package/dist/dashboard/constants/sentinel-values.ts +12 -0
- package/dist/dashboard/constants/step-configs.ts +9 -0
- package/dist/dashboard/constants/step-mappings.ts +170 -0
- package/dist/dashboard/constants/steps.ts +37 -0
- package/dist/dashboard/constants/toast-messages.ts +149 -0
- package/dist/dashboard/constants/triggers.ts +5 -0
- package/dist/dashboard/constants/ui-config.ts +139 -0
- package/dist/dashboard/constants/ui-dimensions.ts +145 -0
- package/dist/dashboard/constants/ui-states.ts +28 -0
- package/dist/dashboard/constants/ui-types.ts +85 -0
- package/dist/dashboard/constants/validation-patterns.ts +26 -0
- package/dist/dashboard/gql/gql.ts +370 -0
- package/dist/dashboard/gql/graphql.ts +10378 -0
- package/dist/dashboard/gql/index.ts +1 -0
- package/dist/dashboard/hooks/api/index.ts +115 -0
- package/dist/dashboard/hooks/api/mutation-helpers.ts +34 -0
- package/dist/dashboard/hooks/api/use-adapters.ts +92 -0
- package/dist/dashboard/hooks/api/use-config-options.ts +513 -0
- package/dist/dashboard/hooks/api/use-connections.ts +84 -0
- package/dist/dashboard/hooks/api/use-entity-field-schemas.ts +99 -0
- package/dist/dashboard/hooks/api/use-entity-loaders.ts +45 -0
- package/dist/dashboard/hooks/api/use-hooks.ts +68 -0
- package/dist/dashboard/hooks/api/use-logs.ts +102 -0
- package/dist/dashboard/hooks/api/use-pipeline-runs.ts +221 -0
- package/dist/dashboard/hooks/api/use-pipelines.ts +279 -0
- package/dist/dashboard/hooks/api/use-queues.ts +141 -0
- package/dist/dashboard/hooks/api/use-secrets.ts +75 -0
- package/dist/dashboard/hooks/api/use-settings.ts +55 -0
- package/dist/dashboard/hooks/api/use-step-tester.ts +79 -0
- package/dist/dashboard/hooks/index.ts +13 -0
- package/dist/dashboard/hooks/use-adapter-catalog.ts +253 -0
- package/dist/dashboard/hooks/use-export-templates.ts +80 -0
- package/dist/dashboard/hooks/use-import-templates.ts +139 -0
- package/dist/dashboard/hooks/use-load-more.ts +29 -0
- package/dist/dashboard/hooks/use-stable-keys.ts +54 -0
- package/dist/dashboard/hooks/use-trigger-types.ts +100 -0
- package/dist/dashboard/hooks/use-wizard-navigation.ts +128 -0
- package/dist/dashboard/index.tsx +55 -0
- package/dist/dashboard/routes/adapters/AdapterCard.tsx +102 -0
- package/dist/dashboard/routes/adapters/AdapterConstants.tsx +20 -0
- package/dist/dashboard/routes/adapters/AdapterDetail.tsx +208 -0
- package/dist/dashboard/routes/adapters/AdapterTypeSection.tsx +105 -0
- package/dist/dashboard/routes/adapters/AdaptersPage.tsx +276 -0
- package/dist/dashboard/routes/adapters/AdaptersTable.tsx +107 -0
- package/dist/dashboard/routes/adapters/index.ts +1 -0
- package/dist/dashboard/routes/connections/ConnectionDetail.tsx +218 -0
- package/dist/dashboard/routes/connections/ConnectionsList.tsx +34 -0
- package/dist/dashboard/routes/connections/index.ts +2 -0
- package/dist/dashboard/routes/hooks/Hooks.tsx +425 -0
- package/dist/dashboard/routes/hooks/hook-stages.ts +52 -0
- package/dist/dashboard/routes/hooks/index.ts +1 -0
- package/dist/dashboard/routes/index.ts +8 -0
- package/dist/dashboard/routes/logs/Logs.tsx +93 -0
- package/dist/dashboard/routes/logs/components/LogDetailDrawer.tsx +118 -0
- package/dist/dashboard/routes/logs/components/LogExplorerTab.tsx +367 -0
- package/dist/dashboard/routes/logs/components/LogLevelBadge.tsx +34 -0
- package/dist/dashboard/routes/logs/components/LogTableRow.tsx +70 -0
- package/dist/dashboard/routes/logs/components/LogsOverviewTab.tsx +178 -0
- package/dist/dashboard/routes/logs/components/RealtimeLogTab.tsx +122 -0
- package/dist/dashboard/routes/logs/index.ts +1 -0
- package/dist/dashboard/routes/pipelines/ErrorAuditList.tsx +39 -0
- package/dist/dashboard/routes/pipelines/ExportWizardPage.tsx +96 -0
- package/dist/dashboard/routes/pipelines/ImportWizardPage.tsx +104 -0
- package/dist/dashboard/routes/pipelines/PipelineDetail.tsx +211 -0
- package/dist/dashboard/routes/pipelines/PipelineRunsBlock.tsx +377 -0
- package/dist/dashboard/routes/pipelines/PipelinesList.tsx +87 -0
- package/dist/dashboard/routes/pipelines/RetryPatchHelper.tsx +51 -0
- package/dist/dashboard/routes/pipelines/RunDetailsPanel.tsx +238 -0
- package/dist/dashboard/routes/pipelines/RunErrorsList.tsx +116 -0
- package/dist/dashboard/routes/pipelines/StepCounters.tsx +24 -0
- package/dist/dashboard/routes/pipelines/StepSummaryTable.tsx +36 -0
- package/dist/dashboard/routes/pipelines/components/DryRunDialog.tsx +341 -0
- package/dist/dashboard/routes/pipelines/components/PipelineActionButtons.tsx +201 -0
- package/dist/dashboard/routes/pipelines/components/PipelineEditorToggle.tsx +116 -0
- package/dist/dashboard/routes/pipelines/components/PipelineFormFields.tsx +156 -0
- package/dist/dashboard/routes/pipelines/components/PipelineWebhookInfo.tsx +111 -0
- package/dist/dashboard/routes/pipelines/components/ReviewActionsPanel.tsx +342 -0
- package/dist/dashboard/routes/pipelines/components/ValidationPanel.tsx +121 -0
- package/dist/dashboard/routes/pipelines/components/VersionHistoryDialog.tsx +131 -0
- package/dist/dashboard/routes/pipelines/components/index.ts +25 -0
- package/dist/dashboard/routes/pipelines/hooks/index.ts +1 -0
- package/dist/dashboard/routes/pipelines/hooks/use-pipeline-validation.ts +114 -0
- package/dist/dashboard/routes/pipelines/index.ts +4 -0
- package/dist/dashboard/routes/pipelines/utils/index.ts +1 -0
- package/dist/dashboard/routes/pipelines/utils/pipeline-conversion.ts +261 -0
- package/dist/dashboard/routes/queues/ConsumersTable.tsx +134 -0
- package/dist/dashboard/routes/queues/DeadLettersTable.tsx +118 -0
- package/dist/dashboard/routes/queues/FailedRunsTable.tsx +74 -0
- package/dist/dashboard/routes/queues/QueuesPage.tsx +290 -0
- package/dist/dashboard/routes/queues/index.ts +1 -0
- package/dist/dashboard/routes/queues/types.ts +22 -0
- package/dist/dashboard/routes/secrets/SecretDetail.tsx +278 -0
- package/dist/dashboard/routes/secrets/SecretsList.tsx +34 -0
- package/dist/dashboard/routes/secrets/index.ts +2 -0
- package/dist/dashboard/routes/settings/Settings.tsx +343 -0
- package/dist/dashboard/routes/settings/index.ts +1 -0
- package/dist/dashboard/types/index.ts +89 -0
- package/dist/dashboard/types/pipeline.ts +51 -0
- package/dist/dashboard/types/ui-types.ts +400 -0
- package/dist/dashboard/types/wizard.ts +235 -0
- package/dist/dashboard/utils/adapter-grouping.ts +43 -0
- package/dist/dashboard/utils/column-analysis.ts +11 -0
- package/dist/dashboard/utils/field-preparation.ts +31 -0
- package/dist/dashboard/utils/form-validation.ts +373 -0
- package/dist/dashboard/utils/formatters.ts +92 -0
- package/dist/dashboard/utils/icon-resolver.ts +35 -0
- package/dist/dashboard/utils/index.ts +60 -0
- package/dist/dashboard/utils/query-key-factory.ts +54 -0
- package/dist/dashboard/utils/step-helpers.ts +32 -0
- package/dist/dashboard/utils/string-helpers.ts +4 -0
- package/dist/dashboard/utils/template-helpers.ts +26 -0
- package/dist/dashboard/utils/trigger-sync.ts +138 -0
- package/dist/dashboard/utils/wizard-to-pipeline.ts +569 -0
- package/package.json +2 -2
|
@@ -0,0 +1,569 @@
|
|
|
1
|
+
import type { PipelineDefinition, PipelineStepDefinition, PipelineEdge, OperatorConfig } from '../../shared/types';
|
|
2
|
+
import type { ImportSourceConfig, DestinationConfig } from '../types/wizard';
|
|
3
|
+
import type { ImportConfiguration } from '../components/wizards/import-wizard/types';
|
|
4
|
+
import type { ExportConfiguration } from '../components/wizards/export-wizard/types';
|
|
5
|
+
import { DEFAULT_CHANNEL_CODE } from '../../shared/constants';
|
|
6
|
+
import type { DestinationSchema, TypedOptionValue, WizardStrategyMapping } from '../hooks/api/use-config-options';
|
|
7
|
+
|
|
8
|
+
/** Minimal adapter info shape for loader field mapping resolution. */
|
|
9
|
+
export interface LoaderAdapterInfo {
|
|
10
|
+
code: string;
|
|
11
|
+
entityType?: string | null;
|
|
12
|
+
schema?: { fields?: Array<{ key: string }> };
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Generate a URL-safe pipeline code from a name.
|
|
17
|
+
* Example: "My Product Import" -> "my-product-import"
|
|
18
|
+
*/
|
|
19
|
+
export function generatePipelineCode(name: string): string {
|
|
20
|
+
return name
|
|
21
|
+
.toLowerCase()
|
|
22
|
+
.trim()
|
|
23
|
+
.replace(/[^a-z0-9]+/g, '-')
|
|
24
|
+
.replace(/^-+|-+$/g, '')
|
|
25
|
+
|| 'untitled-pipeline';
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// --- AdapterResolver: dynamic adapter code resolution ---
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Resolves adapter codes dynamically using backend adapter metadata.
|
|
32
|
+
* When adapter data is unavailable, falls back to convention-based defaults.
|
|
33
|
+
*/
|
|
34
|
+
export interface AdapterResolver {
|
|
35
|
+
getLoaderAdapterCode(entityType: string): string | undefined;
|
|
36
|
+
getExportAdapterCode(formatType: string): string | undefined;
|
|
37
|
+
getFeedAdapterCode(formatType: string): string | undefined;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// --- Dynamic resolution with convention-based fallbacks ---
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Resolve loader adapter code from entity type.
|
|
44
|
+
* Searches backend loader adapters by entityType metadata first,
|
|
45
|
+
* then falls back to convention: kebab-to-camelCase + 'Upsert'.
|
|
46
|
+
*/
|
|
47
|
+
function resolveLoaderCode(entityType: string, loaders?: Array<{ code: string; entityType?: string | null }>): string {
|
|
48
|
+
if (loaders?.length) {
|
|
49
|
+
const loader = loaders.find(l => l.entityType === entityType);
|
|
50
|
+
if (loader) return loader.code;
|
|
51
|
+
}
|
|
52
|
+
// Convention fallback: 'product' -> 'productUpsert', 'product-variant' -> 'productVariantUpsert'
|
|
53
|
+
return `${entityType.replace(/-([a-z])/g, (_, c: string) => c.toUpperCase())}Upsert`;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Resolve export adapter code from format type.
|
|
58
|
+
* Searches backend exporter adapters by formatType metadata first,
|
|
59
|
+
* then falls back to convention: lowercase format + 'Export'.
|
|
60
|
+
*/
|
|
61
|
+
function resolveExporterCode(formatType: string, exporters?: Array<{ code: string; formatType?: string | null }>): string {
|
|
62
|
+
if (exporters?.length) {
|
|
63
|
+
const exporter = exporters.find(e => e.formatType === formatType);
|
|
64
|
+
if (exporter) return exporter.code;
|
|
65
|
+
}
|
|
66
|
+
// Convention fallback: 'CSV' -> 'csvExport'
|
|
67
|
+
return `${formatType.toLowerCase()}Export`;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Resolve field mappings for a loader from its schema metadata.
|
|
72
|
+
* Derives which record fields map to loader config fields by reading the
|
|
73
|
+
* adapter's schema. Excludes meta/config fields that are not record data.
|
|
74
|
+
*/
|
|
75
|
+
function resolveFieldMappings(
|
|
76
|
+
loaderCode: string,
|
|
77
|
+
loaders?: Array<{ code: string; schema?: { fields?: Array<{ key: string }> } }>,
|
|
78
|
+
): Record<string, string> {
|
|
79
|
+
if (!loaders?.length) return {};
|
|
80
|
+
const loader = loaders.find(l => l.code === loaderCode);
|
|
81
|
+
if (!loader?.schema?.fields) return {};
|
|
82
|
+
|
|
83
|
+
// Exclude meta/config fields - these are not record data fields
|
|
84
|
+
const META_FIELDS = new Set(['strategy', 'conflictStrategy', 'channel', 'lookupFields', 'connectionCode']);
|
|
85
|
+
|
|
86
|
+
return Object.fromEntries(
|
|
87
|
+
loader.schema.fields
|
|
88
|
+
.filter(f => !META_FIELDS.has(f.key))
|
|
89
|
+
.map(f => [f.key, f.key])
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Default resolver using convention-based fallbacks (no adapter data).
|
|
95
|
+
* Used when no backend adapter data is available.
|
|
96
|
+
*/
|
|
97
|
+
const defaultResolver: AdapterResolver = {
|
|
98
|
+
getLoaderAdapterCode: (entityType) => resolveLoaderCode(entityType),
|
|
99
|
+
getExportAdapterCode: (formatType) => resolveExporterCode(formatType),
|
|
100
|
+
getFeedAdapterCode: () => undefined,
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
function resolveStrategyMapping(
|
|
104
|
+
wizardValue: string,
|
|
105
|
+
mappings: WizardStrategyMapping[],
|
|
106
|
+
): { loadStrategy: string; conflictStrategy: string } {
|
|
107
|
+
if (!mappings?.length) {
|
|
108
|
+
throw new Error('Strategy mappings not loaded from backend');
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
const mapping = mappings.find(m => m.wizardValue === wizardValue);
|
|
112
|
+
|
|
113
|
+
if (!mapping) {
|
|
114
|
+
throw new Error(`Unknown strategy: ${wizardValue}`);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
return {
|
|
118
|
+
loadStrategy: mapping.loadStrategy,
|
|
119
|
+
conflictStrategy: mapping.conflictStrategy,
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// --- Helper: build linear edges ---
|
|
124
|
+
|
|
125
|
+
function buildLinearEdges(stepKeys: string[]): PipelineEdge[] {
|
|
126
|
+
const edges: PipelineEdge[] = [];
|
|
127
|
+
for (let i = 0; i < stepKeys.length - 1; i++) {
|
|
128
|
+
edges.push({ from: stepKeys[i], to: stepKeys[i + 1] });
|
|
129
|
+
}
|
|
130
|
+
return edges;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// --- Shared trigger builder ---
|
|
134
|
+
|
|
135
|
+
function buildTriggerConfig(
|
|
136
|
+
trigger: { type: string; [key: string]: unknown },
|
|
137
|
+
triggerSchemas?: TypedOptionValue[],
|
|
138
|
+
): Record<string, unknown> {
|
|
139
|
+
const config: Record<string, unknown> = { type: trigger.type };
|
|
140
|
+
|
|
141
|
+
// Schema-driven config building
|
|
142
|
+
if (triggerSchemas?.length) {
|
|
143
|
+
const schema = triggerSchemas.find(s => s.value === trigger.type);
|
|
144
|
+
if (schema) {
|
|
145
|
+
for (const field of schema.fields) {
|
|
146
|
+
const value = trigger[field.key];
|
|
147
|
+
if (value !== undefined && value !== null && value !== '') {
|
|
148
|
+
// Apply configKeyMap if defined (e.g. schedule -> cron)
|
|
149
|
+
const configKey = schema.configKeyMap?.[field.key] ?? field.key;
|
|
150
|
+
config[configKey] = value;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
return config;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// Convention-based fallback when trigger schemas are unavailable (intentional design)
|
|
158
|
+
if (trigger.type === 'SCHEDULE' && trigger.schedule) {
|
|
159
|
+
config.cron = trigger.schedule;
|
|
160
|
+
}
|
|
161
|
+
if (trigger.type === 'WEBHOOK' && trigger.webhookPath) {
|
|
162
|
+
config.path = trigger.webhookPath;
|
|
163
|
+
}
|
|
164
|
+
if (trigger.type === 'FILE' && trigger.fileWatchPath) {
|
|
165
|
+
config.fileWatchPath = trigger.fileWatchPath;
|
|
166
|
+
}
|
|
167
|
+
if (trigger.type === 'EVENT' && trigger.events) {
|
|
168
|
+
config.events = trigger.events;
|
|
169
|
+
}
|
|
170
|
+
return config;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// --- Import conversion ---
|
|
174
|
+
|
|
175
|
+
function buildImportTriggerStep(config: ImportConfiguration, triggerSchemas?: TypedOptionValue[]): PipelineStepDefinition {
|
|
176
|
+
return {
|
|
177
|
+
key: 'trigger',
|
|
178
|
+
type: 'TRIGGER',
|
|
179
|
+
config: buildTriggerConfig(config.trigger, triggerSchemas),
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// --- Source config builders: registry mapping wizard source types to extract step configs ---
|
|
184
|
+
|
|
185
|
+
interface ExtractResult {
|
|
186
|
+
adapterCode: string;
|
|
187
|
+
config: Record<string, unknown>;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
type SourceConfigBuilder = (source: ImportSourceConfig) => ExtractResult;
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Formats where the extractor adapter code differs from format.toLowerCase().
|
|
194
|
+
* XLSX is parsed client-side into JSON records, so it uses the json extractor.
|
|
195
|
+
*/
|
|
196
|
+
const FORMAT_EXTRACTOR_OVERRIDES: Record<string, string> = {
|
|
197
|
+
XLSX: 'json',
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Maps wizard FileSourceConfig field names to extractor config field names
|
|
202
|
+
* where they differ. Unmapped fields pass through with the same key.
|
|
203
|
+
*/
|
|
204
|
+
const FILE_CONFIG_KEY_MAP: Record<string, string> = {
|
|
205
|
+
hasHeaders: 'hasHeader',
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Resolve extractor adapter code + config from a file format.
|
|
210
|
+
* Convention: format.toLowerCase() matches the adapter code (csv, json, xml).
|
|
211
|
+
* File config fields (delimiter, encoding, hasHeaders) pass through to the
|
|
212
|
+
* extractor config generically, with field name remapping where needed.
|
|
213
|
+
*/
|
|
214
|
+
function resolveFileFormatExtractor(
|
|
215
|
+
format: string,
|
|
216
|
+
file: NonNullable<ImportSourceConfig['fileConfig']>,
|
|
217
|
+
): ExtractResult {
|
|
218
|
+
const adapterCode = FORMAT_EXTRACTOR_OVERRIDES[format] ?? format.toLowerCase();
|
|
219
|
+
|
|
220
|
+
// Pass through all file config fields except 'format' and 'sheetName' (wizard-only)
|
|
221
|
+
const config: Record<string, unknown> = {};
|
|
222
|
+
const WIZARD_ONLY_KEYS = new Set(['format', 'sheetName']);
|
|
223
|
+
for (const [key, value] of Object.entries(file)) {
|
|
224
|
+
if (WIZARD_ONLY_KEYS.has(key) || value === undefined || value === null || value === '') continue;
|
|
225
|
+
const configKey = FILE_CONFIG_KEY_MAP[key] ?? key;
|
|
226
|
+
config[configKey] = value;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
return { adapterCode, config };
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
const SOURCE_CONFIG_BUILDERS: Record<string, SourceConfigBuilder> = {
|
|
233
|
+
FILE: (source) => {
|
|
234
|
+
const file = source.fileConfig;
|
|
235
|
+
if (!file) return { adapterCode: 'csv', config: {} };
|
|
236
|
+
return resolveFileFormatExtractor(file.format, file);
|
|
237
|
+
},
|
|
238
|
+
API: (source) => {
|
|
239
|
+
const apiCfg = source.apiConfig;
|
|
240
|
+
return {
|
|
241
|
+
adapterCode: 'httpApi',
|
|
242
|
+
config: apiCfg
|
|
243
|
+
? { url: apiCfg.url, method: apiCfg.method, headers: apiCfg.headers, body: apiCfg.body, pagination: apiCfg.pagination }
|
|
244
|
+
: {},
|
|
245
|
+
};
|
|
246
|
+
},
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
function buildImportExtractStep(config: ImportConfiguration): PipelineStepDefinition {
|
|
250
|
+
const source = config.source;
|
|
251
|
+
const builder = SOURCE_CONFIG_BUILDERS[source.type];
|
|
252
|
+
|
|
253
|
+
let adapterCode: string;
|
|
254
|
+
let extractConfig: Record<string, unknown>;
|
|
255
|
+
|
|
256
|
+
if (builder) {
|
|
257
|
+
const result = builder(source);
|
|
258
|
+
adapterCode = result.adapterCode;
|
|
259
|
+
extractConfig = result.config;
|
|
260
|
+
} else {
|
|
261
|
+
// Dynamic source type -- adapter code is lowercase of source type
|
|
262
|
+
adapterCode = source.type.toLowerCase();
|
|
263
|
+
const dynamicConfigKey = `${source.type.toLowerCase()}Config`;
|
|
264
|
+
const dynamicConfig = (source as Record<string, unknown>)[dynamicConfigKey];
|
|
265
|
+
extractConfig = dynamicConfig && typeof dynamicConfig === 'object'
|
|
266
|
+
? { ...(dynamicConfig as Record<string, unknown>) }
|
|
267
|
+
: {};
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
return {
|
|
271
|
+
key: 'extract',
|
|
272
|
+
type: 'EXTRACT',
|
|
273
|
+
config: { adapterCode, ...extractConfig },
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
function buildImportTransformStep(config: ImportConfiguration): PipelineStepDefinition {
|
|
278
|
+
const operators: OperatorConfig[] = [];
|
|
279
|
+
|
|
280
|
+
// Build rename operators from field mappings (only when source !== target)
|
|
281
|
+
for (const mapping of config.mappings) {
|
|
282
|
+
if (mapping.sourceField !== mapping.targetField) {
|
|
283
|
+
operators.push({
|
|
284
|
+
op: 'rename',
|
|
285
|
+
args: { from: mapping.sourceField, to: mapping.targetField },
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
// Build defaults operators for mappings with default values
|
|
291
|
+
for (const mapping of config.mappings) {
|
|
292
|
+
if (mapping.defaultValue !== undefined && mapping.defaultValue !== null && mapping.defaultValue !== '') {
|
|
293
|
+
operators.push({
|
|
294
|
+
op: 'defaults',
|
|
295
|
+
args: { [mapping.targetField]: mapping.defaultValue },
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
// Append user-defined transformations
|
|
301
|
+
for (const transform of config.transformations) {
|
|
302
|
+
if (transform.enabled !== false) {
|
|
303
|
+
operators.push({
|
|
304
|
+
op: transform.type,
|
|
305
|
+
args: transform.config,
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
return {
|
|
311
|
+
key: 'transform',
|
|
312
|
+
type: 'TRANSFORM',
|
|
313
|
+
config: { operators },
|
|
314
|
+
};
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
function buildImportLoadStep(
|
|
318
|
+
config: ImportConfiguration,
|
|
319
|
+
resolver: AdapterResolver,
|
|
320
|
+
loaderAdapters: LoaderAdapterInfo[] | undefined,
|
|
321
|
+
strategyMappings: WizardStrategyMapping[],
|
|
322
|
+
): PipelineStepDefinition {
|
|
323
|
+
const adapterCode = resolver.getLoaderAdapterCode(config.targetEntity) ?? resolveLoaderCode(config.targetEntity);
|
|
324
|
+
const { loadStrategy, conflictStrategy } = resolveStrategyMapping(config.strategies.existingRecords, strategyMappings);
|
|
325
|
+
|
|
326
|
+
// Auto-derive entity-specific field mappings from backend adapter schemas.
|
|
327
|
+
// After the transform step renames source -> target, the loader reads from target field names.
|
|
328
|
+
const schemaFieldMap = resolveFieldMappings(adapterCode, loaderAdapters);
|
|
329
|
+
const fieldConfig: Record<string, string> = {};
|
|
330
|
+
if (Object.keys(schemaFieldMap).length > 0) {
|
|
331
|
+
for (const mapping of config.mappings) {
|
|
332
|
+
if (mapping.targetField && schemaFieldMap[mapping.targetField]) {
|
|
333
|
+
fieldConfig[schemaFieldMap[mapping.targetField]] = mapping.targetField;
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
return {
|
|
339
|
+
key: 'load',
|
|
340
|
+
type: 'LOAD',
|
|
341
|
+
config: {
|
|
342
|
+
adapterCode,
|
|
343
|
+
strategy: loadStrategy,
|
|
344
|
+
channel: DEFAULT_CHANNEL_CODE,
|
|
345
|
+
conflictStrategy: conflictStrategy,
|
|
346
|
+
lookupFields: config.strategies.lookupFields,
|
|
347
|
+
batchSize: config.strategies.batchSize,
|
|
348
|
+
continueOnError: config.strategies.continueOnError,
|
|
349
|
+
errorThreshold: config.strategies.errorThreshold,
|
|
350
|
+
...fieldConfig,
|
|
351
|
+
},
|
|
352
|
+
};
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
export function importConfigToPipelineDefinition(
|
|
356
|
+
config: ImportConfiguration,
|
|
357
|
+
resolver: AdapterResolver = defaultResolver,
|
|
358
|
+
loaderAdapters?: LoaderAdapterInfo[],
|
|
359
|
+
triggerSchemas?: TypedOptionValue[],
|
|
360
|
+
strategyMappings: WizardStrategyMapping[],
|
|
361
|
+
): PipelineDefinition {
|
|
362
|
+
const trigger = buildImportTriggerStep(config, triggerSchemas);
|
|
363
|
+
const extract = buildImportExtractStep(config);
|
|
364
|
+
const transform = buildImportTransformStep(config);
|
|
365
|
+
const load = buildImportLoadStep(config, resolver, loaderAdapters, strategyMappings);
|
|
366
|
+
|
|
367
|
+
const steps = [trigger, extract, transform, load];
|
|
368
|
+
const edges = buildLinearEdges(steps.map(s => s.key));
|
|
369
|
+
|
|
370
|
+
return {
|
|
371
|
+
version: 1,
|
|
372
|
+
name: config.name,
|
|
373
|
+
description: config.description,
|
|
374
|
+
steps,
|
|
375
|
+
edges,
|
|
376
|
+
};
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
// --- Export conversion ---
|
|
380
|
+
|
|
381
|
+
function buildExportTriggerStep(config: ExportConfiguration, triggerSchemas?: TypedOptionValue[]): PipelineStepDefinition {
|
|
382
|
+
return {
|
|
383
|
+
key: 'trigger',
|
|
384
|
+
type: 'TRIGGER',
|
|
385
|
+
config: buildTriggerConfig(config.trigger, triggerSchemas),
|
|
386
|
+
};
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
function buildExportExtractStep(config: ExportConfiguration): PipelineStepDefinition {
|
|
390
|
+
const extractConfig: Record<string, unknown> = {
|
|
391
|
+
entity: config.sourceEntity,
|
|
392
|
+
batchSize: config.options.batchSize,
|
|
393
|
+
};
|
|
394
|
+
|
|
395
|
+
if (config.sourceQuery?.customQuery) {
|
|
396
|
+
extractConfig.customQuery = config.sourceQuery.customQuery;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
return {
|
|
400
|
+
key: 'extract',
|
|
401
|
+
type: 'EXTRACT',
|
|
402
|
+
config: { adapterCode: 'vendureQuery', ...extractConfig },
|
|
403
|
+
};
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
function buildExportTransformStep(config: ExportConfiguration): PipelineStepDefinition {
|
|
407
|
+
const operators: OperatorConfig[] = [];
|
|
408
|
+
|
|
409
|
+
// Pick only included fields
|
|
410
|
+
const includedFields = config.fields.filter(f => f.include);
|
|
411
|
+
if (includedFields.length > 0) {
|
|
412
|
+
operators.push({
|
|
413
|
+
op: 'pick',
|
|
414
|
+
args: { fields: includedFields.map(f => f.sourceField) },
|
|
415
|
+
});
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
// Rename fields where outputName differs from sourceField
|
|
419
|
+
for (const field of includedFields) {
|
|
420
|
+
if (field.outputName !== field.sourceField) {
|
|
421
|
+
operators.push({
|
|
422
|
+
op: 'rename',
|
|
423
|
+
args: { from: field.sourceField, to: field.outputName },
|
|
424
|
+
});
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
return {
|
|
429
|
+
key: 'transform',
|
|
430
|
+
type: 'TRANSFORM',
|
|
431
|
+
config: { operators },
|
|
432
|
+
};
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
function buildExportOutputStep(
|
|
436
|
+
config: ExportConfiguration,
|
|
437
|
+
resolver: AdapterResolver,
|
|
438
|
+
destinationSchemas?: DestinationSchema[],
|
|
439
|
+
): PipelineStepDefinition {
|
|
440
|
+
const formatType = config.format.type;
|
|
441
|
+
const formatOptions = config.format.options;
|
|
442
|
+
const destinationConfig = buildDestinationConfig(config.destination, destinationSchemas);
|
|
443
|
+
|
|
444
|
+
// Feed formats
|
|
445
|
+
const feedAdapter = resolver.getFeedAdapterCode(formatType);
|
|
446
|
+
if (feedAdapter) {
|
|
447
|
+
return {
|
|
448
|
+
key: 'feed',
|
|
449
|
+
type: 'FEED',
|
|
450
|
+
config: {
|
|
451
|
+
adapterCode: feedAdapter,
|
|
452
|
+
...formatOptions,
|
|
453
|
+
...destinationConfig,
|
|
454
|
+
},
|
|
455
|
+
};
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
// Standard export formats
|
|
459
|
+
const exportAdapter = resolver.getExportAdapterCode(formatType) ?? 'csvExport';
|
|
460
|
+
|
|
461
|
+
return {
|
|
462
|
+
key: 'export',
|
|
463
|
+
type: 'EXPORT',
|
|
464
|
+
config: {
|
|
465
|
+
adapterCode: exportAdapter,
|
|
466
|
+
...formatOptions,
|
|
467
|
+
...destinationConfig,
|
|
468
|
+
},
|
|
469
|
+
};
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
// --- Destination config builder ---
|
|
473
|
+
|
|
474
|
+
/** Fallback field mapping for FILE destinations, used when backend schema data is unavailable. */
|
|
475
|
+
const FALLBACK_FILE_FIELD_MAPPING: Record<string, string> = { directory: 'path', filename: 'filenamePattern' };
|
|
476
|
+
|
|
477
|
+
/**
|
|
478
|
+
* Build destination config for the pipeline step from wizard state.
|
|
479
|
+
*
|
|
480
|
+
* Uses backend destination schema metadata when available:
|
|
481
|
+
* - Empty configKey (e.g. DOWNLOAD) -> no additional config beyond destinationType.
|
|
482
|
+
* - Non-empty fieldMapping -> renames wizard fields to pipeline config field names.
|
|
483
|
+
* - Otherwise -> spreads the wizard sub-object (`${configKey}`) verbatim.
|
|
484
|
+
*
|
|
485
|
+
* Falls back to convention-based logic when destination schemas are not provided.
|
|
486
|
+
*/
|
|
487
|
+
function buildDestinationConfig(
|
|
488
|
+
destination: DestinationConfig,
|
|
489
|
+
destinationSchemas?: DestinationSchema[],
|
|
490
|
+
): Record<string, unknown> {
|
|
491
|
+
const result: Record<string, unknown> = {
|
|
492
|
+
destinationType: destination.type,
|
|
493
|
+
};
|
|
494
|
+
|
|
495
|
+
const schema = destinationSchemas?.find(s => s.type === destination.type);
|
|
496
|
+
|
|
497
|
+
// Schema-driven path
|
|
498
|
+
if (schema) {
|
|
499
|
+
// No configKey means no additional config (e.g. DOWNLOAD)
|
|
500
|
+
if (!schema.configKey) return result;
|
|
501
|
+
|
|
502
|
+
const subConfig = (destination as Record<string, unknown>)[schema.configKey];
|
|
503
|
+
if (!subConfig || typeof subConfig !== 'object') return result;
|
|
504
|
+
|
|
505
|
+
const sourceObj = subConfig as Record<string, unknown>;
|
|
506
|
+
const fieldMapping = schema.fieldMapping;
|
|
507
|
+
|
|
508
|
+
if (fieldMapping && Object.keys(fieldMapping).length > 0) {
|
|
509
|
+
// Apply field renaming from schema metadata
|
|
510
|
+
for (const [wizardKey, value] of Object.entries(sourceObj)) {
|
|
511
|
+
if (value === undefined || value === null) continue;
|
|
512
|
+
const pipelineKey = fieldMapping[wizardKey] ?? wizardKey;
|
|
513
|
+
result[pipelineKey] = value;
|
|
514
|
+
}
|
|
515
|
+
} else {
|
|
516
|
+
Object.assign(result, sourceObj);
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
return result;
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
// Convention-based fallback when destination schemas are unavailable (intentional design)
|
|
523
|
+
const configKey = `${destination.type.toLowerCase()}Config`;
|
|
524
|
+
const config = (destination as Record<string, unknown>)[configKey];
|
|
525
|
+
if (!config || typeof config !== 'object') return result;
|
|
526
|
+
|
|
527
|
+
if (destination.type === 'FILE') {
|
|
528
|
+
const sourceObj = config as Record<string, unknown>;
|
|
529
|
+
for (const [wizardKey, value] of Object.entries(sourceObj)) {
|
|
530
|
+
if (value === undefined || value === null) continue;
|
|
531
|
+
const pipelineKey = FALLBACK_FILE_FIELD_MAPPING[wizardKey] ?? wizardKey;
|
|
532
|
+
result[pipelineKey] = value;
|
|
533
|
+
}
|
|
534
|
+
return result;
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
Object.assign(result, config);
|
|
538
|
+
return result;
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
/**
|
|
542
|
+
* Convert an export wizard configuration into a PipelineDefinition.
|
|
543
|
+
* Accepts an optional AdapterResolver for dynamic adapter code lookups,
|
|
544
|
+
* optional trigger type schemas for schema-driven trigger config building,
|
|
545
|
+
* and optional destination schemas for data-driven destination config building.
|
|
546
|
+
* Falls back to convention-based defaults when not provided.
|
|
547
|
+
*/
|
|
548
|
+
export function exportConfigToPipelineDefinition(
|
|
549
|
+
config: ExportConfiguration,
|
|
550
|
+
resolver: AdapterResolver = defaultResolver,
|
|
551
|
+
triggerSchemas?: TypedOptionValue[],
|
|
552
|
+
destinationSchemas?: DestinationSchema[],
|
|
553
|
+
): PipelineDefinition {
|
|
554
|
+
const trigger = buildExportTriggerStep(config, triggerSchemas);
|
|
555
|
+
const extract = buildExportExtractStep(config);
|
|
556
|
+
const transform = buildExportTransformStep(config);
|
|
557
|
+
const output = buildExportOutputStep(config, resolver, destinationSchemas);
|
|
558
|
+
|
|
559
|
+
const steps = [trigger, extract, transform, output];
|
|
560
|
+
const edges = buildLinearEdges(steps.map(s => s.key));
|
|
561
|
+
|
|
562
|
+
return {
|
|
563
|
+
version: 1,
|
|
564
|
+
name: config.name,
|
|
565
|
+
description: config.description,
|
|
566
|
+
steps,
|
|
567
|
+
edges,
|
|
568
|
+
};
|
|
569
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oronts/vendure-data-hub-plugin",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "ETL data integration plugin for Vendure e-commerce",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Oronts Website",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"dev": "npm run build:dev && npm run start",
|
|
54
54
|
"start": "ts-node dev-server/index.ts",
|
|
55
55
|
"populate": "ts-node dev-server/populate.ts",
|
|
56
|
-
"build": "rimraf dist && npm run compile && npm run build:dashboard",
|
|
56
|
+
"build": "rimraf dist && npm run compile && cp -r dashboard dist/dashboard && npm run build:dashboard",
|
|
57
57
|
"build:dev": "vite build --config vite.dev.config.mts",
|
|
58
58
|
"build:dashboard": "vite build",
|
|
59
59
|
"compile": "tsc -p tsconfig.build.json",
|