@oronts/vendure-data-hub-plugin 0.1.1 → 0.1.3
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 +17 -0
- package/README.md +6 -2
- package/dashboard/gql/gql.ts +6 -6
- package/dashboard/gql/graphql.ts +9 -4
- package/dashboard/hooks/api/use-pipeline-runs.ts +1 -0
- package/dashboard/hooks/api/use-queues.ts +1 -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 +10383 -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 +222 -0
- package/dist/dashboard/hooks/api/use-pipelines.ts +279 -0
- package/dist/dashboard/hooks/api/use-queues.ts +142 -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/dist/shared/types/adapter-config.types.d.ts +254 -11
- package/dist/shared/types/adapter-config.types.d.ts.map +1 -1
- package/dist/shared/types/index.d.ts +1 -1
- package/dist/shared/types/index.d.ts.map +1 -1
- package/dist/shared/types/index.js.map +1 -1
- package/dist/shared/utils/error.d.ts +5 -0
- package/dist/shared/utils/error.d.ts.map +1 -1
- package/dist/shared/utils/error.js +11 -0
- package/dist/shared/utils/error.js.map +1 -1
- package/dist/src/api/schema/pipeline.schema.d.ts +1 -1
- package/dist/src/api/schema/pipeline.schema.d.ts.map +1 -1
- package/dist/src/api/schema/pipeline.schema.js +2 -0
- package/dist/src/api/schema/pipeline.schema.js.map +1 -1
- package/dist/src/bootstrap/initialization.d.ts.map +1 -1
- package/dist/src/bootstrap/initialization.js +6 -0
- package/dist/src/bootstrap/initialization.js.map +1 -1
- package/dist/src/entities/data/error-record.entity.d.ts +1 -0
- package/dist/src/entities/data/error-record.entity.d.ts.map +1 -1
- package/dist/src/entities/data/error-record.entity.js +4 -0
- package/dist/src/entities/data/error-record.entity.js.map +1 -1
- package/dist/src/gql/generated.d.ts +5 -0
- package/dist/src/gql/generated.d.ts.map +1 -1
- package/dist/src/gql/generated.js.map +1 -1
- package/dist/src/loaders/inventory/inventory.loader.d.ts.map +1 -1
- package/dist/src/loaders/inventory/inventory.loader.js +1 -2
- package/dist/src/loaders/inventory/inventory.loader.js.map +1 -1
- package/dist/src/runtime/executor-types.d.ts +3 -2
- package/dist/src/runtime/executor-types.d.ts.map +1 -1
- package/dist/src/runtime/executors/loaders/asset-handler.js +1 -1
- package/dist/src/runtime/executors/loaders/asset-handler.js.map +1 -1
- package/dist/src/runtime/executors/loaders/asset-import-handler.js +1 -1
- package/dist/src/runtime/executors/loaders/asset-import-handler.js.map +1 -1
- package/dist/src/runtime/executors/loaders/channel-handler.d.ts.map +1 -1
- package/dist/src/runtime/executors/loaders/channel-handler.js +14 -1
- package/dist/src/runtime/executors/loaders/channel-handler.js.map +1 -1
- package/dist/src/runtime/executors/loaders/collection-handler.d.ts.map +1 -1
- package/dist/src/runtime/executors/loaders/collection-handler.js +22 -3
- package/dist/src/runtime/executors/loaders/collection-handler.js.map +1 -1
- package/dist/src/runtime/executors/loaders/customer-group-handler.d.ts.map +1 -1
- package/dist/src/runtime/executors/loaders/customer-group-handler.js +8 -1
- package/dist/src/runtime/executors/loaders/customer-group-handler.js.map +1 -1
- package/dist/src/runtime/executors/loaders/customer-handler.d.ts.map +1 -1
- package/dist/src/runtime/executors/loaders/customer-handler.js +33 -2
- package/dist/src/runtime/executors/loaders/customer-handler.js.map +1 -1
- package/dist/src/runtime/executors/loaders/facet-handler.d.ts.map +1 -1
- package/dist/src/runtime/executors/loaders/facet-handler.js +34 -2
- package/dist/src/runtime/executors/loaders/facet-handler.js.map +1 -1
- package/dist/src/runtime/executors/loaders/graphql-mutation-handler.js +1 -1
- package/dist/src/runtime/executors/loaders/graphql-mutation-handler.js.map +1 -1
- package/dist/src/runtime/executors/loaders/inventory-adjust-handler.d.ts.map +1 -1
- package/dist/src/runtime/executors/loaders/inventory-adjust-handler.js +8 -1
- package/dist/src/runtime/executors/loaders/inventory-adjust-handler.js.map +1 -1
- package/dist/src/runtime/executors/loaders/inventory-handler.js +3 -3
- package/dist/src/runtime/executors/loaders/inventory-handler.js.map +1 -1
- package/dist/src/runtime/executors/loaders/loader-handler-registry.d.ts.map +1 -1
- package/dist/src/runtime/executors/loaders/loader-handler-registry.js +35 -10
- package/dist/src/runtime/executors/loaders/loader-handler-registry.js.map +1 -1
- package/dist/src/runtime/executors/loaders/order-handler.d.ts +1 -1
- package/dist/src/runtime/executors/loaders/order-handler.d.ts.map +1 -1
- package/dist/src/runtime/executors/loaders/order-handler.js +7 -4
- package/dist/src/runtime/executors/loaders/order-handler.js.map +1 -1
- package/dist/src/runtime/executors/loaders/payment-method-handler.d.ts.map +1 -1
- package/dist/src/runtime/executors/loaders/payment-method-handler.js +14 -1
- package/dist/src/runtime/executors/loaders/payment-method-handler.js.map +1 -1
- package/dist/src/runtime/executors/loaders/product-handler.d.ts +6 -0
- package/dist/src/runtime/executors/loaders/product-handler.d.ts.map +1 -1
- package/dist/src/runtime/executors/loaders/product-handler.js +31 -13
- package/dist/src/runtime/executors/loaders/product-handler.js.map +1 -1
- package/dist/src/runtime/executors/loaders/promotion-handler.d.ts.map +1 -1
- package/dist/src/runtime/executors/loaders/promotion-handler.js +21 -2
- package/dist/src/runtime/executors/loaders/promotion-handler.js.map +1 -1
- package/dist/src/runtime/executors/loaders/rest-handler.js +1 -1
- package/dist/src/runtime/executors/loaders/rest-handler.js.map +1 -1
- package/dist/src/runtime/executors/loaders/shared-lookups.d.ts +28 -1
- package/dist/src/runtime/executors/loaders/shared-lookups.d.ts.map +1 -1
- package/dist/src/runtime/executors/loaders/shared-lookups.js +136 -0
- package/dist/src/runtime/executors/loaders/shared-lookups.js.map +1 -1
- package/dist/src/runtime/executors/loaders/shipping-method-handler.d.ts.map +1 -1
- package/dist/src/runtime/executors/loaders/shipping-method-handler.js +8 -1
- package/dist/src/runtime/executors/loaders/shipping-method-handler.js.map +1 -1
- package/dist/src/runtime/executors/loaders/stock-location-handler.d.ts.map +1 -1
- package/dist/src/runtime/executors/loaders/stock-location-handler.js +8 -1
- package/dist/src/runtime/executors/loaders/stock-location-handler.js.map +1 -1
- package/dist/src/runtime/executors/loaders/tax-rate-handler.d.ts.map +1 -1
- package/dist/src/runtime/executors/loaders/tax-rate-handler.js +14 -1
- package/dist/src/runtime/executors/loaders/tax-rate-handler.js.map +1 -1
- package/dist/src/runtime/executors/loaders/types.d.ts +2 -0
- package/dist/src/runtime/executors/loaders/types.d.ts.map +1 -1
- package/dist/src/runtime/executors/loaders/variant-handler.d.ts +24 -2
- package/dist/src/runtime/executors/loaders/variant-handler.d.ts.map +1 -1
- package/dist/src/runtime/executors/loaders/variant-handler.js +190 -44
- package/dist/src/runtime/executors/loaders/variant-handler.js.map +1 -1
- package/dist/src/runtime/executors/sink-handler-registry.js +2 -2
- package/dist/src/runtime/executors/sink-handler-registry.js.map +1 -1
- package/dist/src/services/data/record-error.service.d.ts +1 -1
- package/dist/src/services/data/record-error.service.d.ts.map +1 -1
- package/dist/src/services/data/record-error.service.js +4 -1
- package/dist/src/services/data/record-error.service.js.map +1 -1
- package/dist/src/services/logger/execution-logger.d.ts +1 -1
- package/dist/src/services/logger/execution-logger.d.ts.map +1 -1
- package/dist/src/services/logger/execution-logger.js +8 -4
- package/dist/src/services/logger/execution-logger.js.map +1 -1
- package/dist/src/services/pipeline/pipeline-runner.service.d.ts.map +1 -1
- package/dist/src/services/pipeline/pipeline-runner.service.js +3 -3
- package/dist/src/services/pipeline/pipeline-runner.service.js.map +1 -1
- package/dist/src/utils/error.utils.d.ts +1 -1
- package/dist/src/utils/error.utils.d.ts.map +1 -1
- package/dist/src/utils/error.utils.js +2 -1
- package/dist/src/utils/error.utils.js.map +1 -1
- package/dist/src/utils/url-security.utils.d.ts +5 -3
- package/dist/src/utils/url-security.utils.d.ts.map +1 -1
- package/dist/src/utils/url-security.utils.js +20 -4
- package/dist/src/utils/url-security.utils.js.map +1 -1
- package/docs/reference/loaders.md +39 -2
- package/package.json +2 -2
- package/shared/types/adapter-config.types.ts +278 -9
- package/shared/types/index.ts +13 -0
- package/shared/utils/error.ts +11 -0
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useCallback, useEffect, useRef, useMemo, memo } from 'react';
|
|
3
|
+
import {
|
|
4
|
+
Label,
|
|
5
|
+
Select,
|
|
6
|
+
SelectContent,
|
|
7
|
+
SelectItem,
|
|
8
|
+
SelectTrigger,
|
|
9
|
+
SelectValue,
|
|
10
|
+
Input,
|
|
11
|
+
Button,
|
|
12
|
+
} from '@vendure/dashboard';
|
|
13
|
+
import { Plus, Trash2 } from 'lucide-react';
|
|
14
|
+
import { useEntityLoaders } from '../../../hooks/api/use-entity-loaders';
|
|
15
|
+
import { useEnrichmentSourceSchemas, type ConnectionSchemaField } from '../../../hooks/api/use-config-options';
|
|
16
|
+
import { useStableIndexIds } from '../../../hooks/use-stable-keys';
|
|
17
|
+
|
|
18
|
+
export interface EnrichConfigComponentProps {
|
|
19
|
+
readonly config: Record<string, unknown>;
|
|
20
|
+
readonly onChange: (config: Record<string, unknown>) => void;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
interface DefaultValue {
|
|
24
|
+
id: string;
|
|
25
|
+
field: string;
|
|
26
|
+
value: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
let defaultValueIdCounter = 0;
|
|
30
|
+
function generateDefaultValueId(): string {
|
|
31
|
+
return `default-value-${Date.now()}-${++defaultValueIdCounter}`;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function EnrichConfigComponent({
|
|
35
|
+
config,
|
|
36
|
+
onChange,
|
|
37
|
+
}: EnrichConfigComponentProps) {
|
|
38
|
+
const { schemas: sourceTypeSchemas } = useEnrichmentSourceSchemas();
|
|
39
|
+
const { entities } = useEntityLoaders();
|
|
40
|
+
const entityOptions = useMemo(
|
|
41
|
+
() => entities.map(e => ({ value: e.code, label: e.name })),
|
|
42
|
+
[entities],
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
const sourceType = (config.sourceType as string) || 'STATIC';
|
|
46
|
+
const currentSourceSchema = sourceTypeSchemas.find(s => s.value === sourceType);
|
|
47
|
+
|
|
48
|
+
// Use refs to avoid stale closures in the initialization effect
|
|
49
|
+
const configRef = useRef(config);
|
|
50
|
+
const onChangeRef = useRef(onChange);
|
|
51
|
+
configRef.current = config;
|
|
52
|
+
onChangeRef.current = onChange;
|
|
53
|
+
|
|
54
|
+
// Initialize sourceType if not set - ensures validation passes
|
|
55
|
+
useEffect(() => {
|
|
56
|
+
if (!configRef.current.sourceType) {
|
|
57
|
+
onChangeRef.current({ ...configRef.current, sourceType: 'STATIC' });
|
|
58
|
+
}
|
|
59
|
+
}, []);
|
|
60
|
+
const defaults = (config.defaults as Record<string, unknown>) || {};
|
|
61
|
+
|
|
62
|
+
const defaultsEntries = Object.entries(defaults);
|
|
63
|
+
const stableIds = useStableIndexIds(defaultsEntries, 'default-value');
|
|
64
|
+
|
|
65
|
+
const defaultsList: DefaultValue[] = defaultsEntries.map(([field, value], index) => ({
|
|
66
|
+
id: stableIds[index] || generateDefaultValueId(),
|
|
67
|
+
field,
|
|
68
|
+
value: typeof value === 'string' ? value : JSON.stringify(value),
|
|
69
|
+
}));
|
|
70
|
+
|
|
71
|
+
const updateField = useCallback((key: string, value: unknown) => {
|
|
72
|
+
onChange({ ...config, [key]: value });
|
|
73
|
+
}, [config, onChange]);
|
|
74
|
+
|
|
75
|
+
const updateDefaults = useCallback((list: DefaultValue[]) => {
|
|
76
|
+
const newDefaults: Record<string, unknown> = {};
|
|
77
|
+
for (const item of list) {
|
|
78
|
+
if (item.field.trim()) {
|
|
79
|
+
try {
|
|
80
|
+
newDefaults[item.field] = JSON.parse(item.value);
|
|
81
|
+
} catch {
|
|
82
|
+
newDefaults[item.field] = item.value;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
onChange({ ...config, defaults: newDefaults });
|
|
87
|
+
}, [config, onChange]);
|
|
88
|
+
|
|
89
|
+
const addDefault = useCallback(() => {
|
|
90
|
+
updateDefaults([...defaultsList, { id: generateDefaultValueId(), field: '', value: '' }]);
|
|
91
|
+
}, [defaultsList, updateDefaults]);
|
|
92
|
+
|
|
93
|
+
const updateDefaultItem = useCallback((index: number, field: string, value: string) => {
|
|
94
|
+
const newList = [...defaultsList];
|
|
95
|
+
newList[index] = { ...newList[index], field, value };
|
|
96
|
+
updateDefaults(newList);
|
|
97
|
+
}, [defaultsList, updateDefaults]);
|
|
98
|
+
|
|
99
|
+
const removeDefault = useCallback((index: number) => {
|
|
100
|
+
const newList = defaultsList.filter((_, i) => i !== index);
|
|
101
|
+
updateDefaults(newList);
|
|
102
|
+
}, [defaultsList, updateDefaults]);
|
|
103
|
+
|
|
104
|
+
return (
|
|
105
|
+
<div className="space-y-4">
|
|
106
|
+
<div className="space-y-2">
|
|
107
|
+
<Label className="text-sm font-medium">Enrichment Source</Label>
|
|
108
|
+
<Select
|
|
109
|
+
value={sourceType}
|
|
110
|
+
onValueChange={(v) => updateField('sourceType', v)}
|
|
111
|
+
>
|
|
112
|
+
<SelectTrigger className="w-full" data-testid="datahub-enrich-source-select">
|
|
113
|
+
<SelectValue />
|
|
114
|
+
</SelectTrigger>
|
|
115
|
+
<SelectContent>
|
|
116
|
+
{sourceTypeSchemas.map((st) => (
|
|
117
|
+
<SelectItem key={st.value} value={st.value}>
|
|
118
|
+
{st.label}
|
|
119
|
+
</SelectItem>
|
|
120
|
+
))}
|
|
121
|
+
</SelectContent>
|
|
122
|
+
</Select>
|
|
123
|
+
<p className="text-xs text-muted-foreground">
|
|
124
|
+
{currentSourceSchema?.description}
|
|
125
|
+
</p>
|
|
126
|
+
</div>
|
|
127
|
+
|
|
128
|
+
{currentSourceSchema && currentSourceSchema.fields.length > 0 && (
|
|
129
|
+
<div className="space-y-3">
|
|
130
|
+
{currentSourceSchema.fields.map(field => (
|
|
131
|
+
<EnrichSchemaField
|
|
132
|
+
key={field.key}
|
|
133
|
+
field={field}
|
|
134
|
+
value={field.type === 'keyValuePairs' ? defaults : (config[field.key] as string || '')}
|
|
135
|
+
onChange={(value) => {
|
|
136
|
+
if (field.type === 'keyValuePairs') {
|
|
137
|
+
onChange({ ...config, defaults: value });
|
|
138
|
+
} else {
|
|
139
|
+
updateField(field.key, value);
|
|
140
|
+
}
|
|
141
|
+
}}
|
|
142
|
+
entityOptions={entityOptions}
|
|
143
|
+
defaultsList={defaultsList}
|
|
144
|
+
addDefault={addDefault}
|
|
145
|
+
updateDefaultItem={updateDefaultItem}
|
|
146
|
+
removeDefault={removeDefault}
|
|
147
|
+
/>
|
|
148
|
+
))}
|
|
149
|
+
</div>
|
|
150
|
+
)}
|
|
151
|
+
</div>
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
interface EnrichSchemaFieldProps {
|
|
156
|
+
field: ConnectionSchemaField;
|
|
157
|
+
value: unknown;
|
|
158
|
+
onChange: (value: unknown) => void;
|
|
159
|
+
entityOptions: Array<{ value: string; label: string }>;
|
|
160
|
+
defaultsList: DefaultValue[];
|
|
161
|
+
addDefault: () => void;
|
|
162
|
+
updateDefaultItem: (index: number, field: string, value: string) => void;
|
|
163
|
+
removeDefault: (index: number) => void;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/** Field type renderer registry -- maps field.type to a render function. */
|
|
167
|
+
type EnrichFieldRenderer = (props: EnrichSchemaFieldProps) => React.JSX.Element;
|
|
168
|
+
|
|
169
|
+
const ENRICH_FIELD_RENDERERS: Record<string, EnrichFieldRenderer> = {
|
|
170
|
+
keyValuePairs: ({ field, defaultsList, addDefault, updateDefaultItem, removeDefault }) => (
|
|
171
|
+
<div className="space-y-3">
|
|
172
|
+
<div className="flex items-center justify-between">
|
|
173
|
+
<Label className="text-sm font-medium">{field.label}</Label>
|
|
174
|
+
<Button
|
|
175
|
+
variant="outline"
|
|
176
|
+
size="sm"
|
|
177
|
+
onClick={addDefault}
|
|
178
|
+
aria-label="Add default field value"
|
|
179
|
+
data-testid="datahub-enrich-add-default-btn"
|
|
180
|
+
>
|
|
181
|
+
<Plus className="h-3 w-3 mr-1" />
|
|
182
|
+
Add Field
|
|
183
|
+
</Button>
|
|
184
|
+
</div>
|
|
185
|
+
{defaultsList.length === 0 && (
|
|
186
|
+
<p className="text-sm text-muted-foreground p-3 bg-muted/50 rounded-md">
|
|
187
|
+
No default values defined. Add fields to set on each record.
|
|
188
|
+
</p>
|
|
189
|
+
)}
|
|
190
|
+
{defaultsList.map((item, index) => (
|
|
191
|
+
<DefaultValueRow
|
|
192
|
+
key={item.id}
|
|
193
|
+
item={item}
|
|
194
|
+
index={index}
|
|
195
|
+
updateDefaultItem={updateDefaultItem}
|
|
196
|
+
removeDefault={removeDefault}
|
|
197
|
+
/>
|
|
198
|
+
))}
|
|
199
|
+
</div>
|
|
200
|
+
),
|
|
201
|
+
|
|
202
|
+
entitySelect: ({ field, value, onChange, entityOptions }) => (
|
|
203
|
+
<div className="space-y-2">
|
|
204
|
+
<Label className="text-sm font-medium">{field.label}</Label>
|
|
205
|
+
<Select value={String(value || '')} onValueChange={(v) => onChange(v)}>
|
|
206
|
+
<SelectTrigger className="w-full">
|
|
207
|
+
<SelectValue placeholder="Select entity..." />
|
|
208
|
+
</SelectTrigger>
|
|
209
|
+
<SelectContent>
|
|
210
|
+
{entityOptions.map((opt) => (
|
|
211
|
+
<SelectItem key={opt.value} value={opt.value}>{opt.label}</SelectItem>
|
|
212
|
+
))}
|
|
213
|
+
</SelectContent>
|
|
214
|
+
</Select>
|
|
215
|
+
{field.description && (
|
|
216
|
+
<p className="text-xs text-muted-foreground">{field.description}</p>
|
|
217
|
+
)}
|
|
218
|
+
</div>
|
|
219
|
+
),
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
/** Default renderer for unrecognized field types (text input). */
|
|
223
|
+
function defaultEnrichFieldRenderer({ field, value, onChange }: EnrichSchemaFieldProps): React.JSX.Element {
|
|
224
|
+
return (
|
|
225
|
+
<div className="space-y-2">
|
|
226
|
+
<Label className="text-sm font-medium">{field.label}</Label>
|
|
227
|
+
<Input
|
|
228
|
+
value={String(value || '')}
|
|
229
|
+
onChange={(e) => onChange(e.target.value)}
|
|
230
|
+
placeholder={field.placeholder ?? undefined}
|
|
231
|
+
/>
|
|
232
|
+
{field.description && (
|
|
233
|
+
<p className="text-xs text-muted-foreground">{field.description}</p>
|
|
234
|
+
)}
|
|
235
|
+
</div>
|
|
236
|
+
);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
function EnrichSchemaField(props: EnrichSchemaFieldProps) {
|
|
240
|
+
const renderer = ENRICH_FIELD_RENDERERS[props.field.type] ?? defaultEnrichFieldRenderer;
|
|
241
|
+
return renderer(props);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
interface DefaultValueRowProps {
|
|
245
|
+
item: DefaultValue;
|
|
246
|
+
index: number;
|
|
247
|
+
updateDefaultItem: (index: number, field: string, value: string) => void;
|
|
248
|
+
removeDefault: (index: number) => void;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
const DefaultValueRow = memo(function DefaultValueRow({
|
|
252
|
+
item,
|
|
253
|
+
index,
|
|
254
|
+
updateDefaultItem,
|
|
255
|
+
removeDefault,
|
|
256
|
+
}: DefaultValueRowProps) {
|
|
257
|
+
const handleFieldChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {
|
|
258
|
+
updateDefaultItem(index, e.target.value, item.value);
|
|
259
|
+
}, [index, item.value, updateDefaultItem]);
|
|
260
|
+
|
|
261
|
+
const handleValueChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {
|
|
262
|
+
updateDefaultItem(index, item.field, e.target.value);
|
|
263
|
+
}, [index, item.field, updateDefaultItem]);
|
|
264
|
+
|
|
265
|
+
const handleRemove = useCallback(() => {
|
|
266
|
+
removeDefault(index);
|
|
267
|
+
}, [index, removeDefault]);
|
|
268
|
+
|
|
269
|
+
return (
|
|
270
|
+
<div className="flex items-start gap-2" data-testid={`datahub-enrich-default-row-${index}`}>
|
|
271
|
+
<Input
|
|
272
|
+
value={item.field}
|
|
273
|
+
onChange={handleFieldChange}
|
|
274
|
+
placeholder="Field name"
|
|
275
|
+
className="w-40"
|
|
276
|
+
/>
|
|
277
|
+
<Input
|
|
278
|
+
value={item.value}
|
|
279
|
+
onChange={handleValueChange}
|
|
280
|
+
placeholder="Value (JSON or string)"
|
|
281
|
+
className="flex-1"
|
|
282
|
+
/>
|
|
283
|
+
<Button
|
|
284
|
+
variant="ghost"
|
|
285
|
+
size="sm"
|
|
286
|
+
onClick={handleRemove}
|
|
287
|
+
className="text-destructive hover:text-destructive"
|
|
288
|
+
aria-label={`Remove default value for ${item.field || 'field'}`}
|
|
289
|
+
data-testid={`datahub-enrich-remove-default-${index}-btn`}
|
|
290
|
+
>
|
|
291
|
+
<Trash2 className="h-4 w-4" />
|
|
292
|
+
</Button>
|
|
293
|
+
</div>
|
|
294
|
+
);
|
|
295
|
+
});
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { memo } from 'react';
|
|
3
|
+
import {
|
|
4
|
+
Badge,
|
|
5
|
+
Tabs,
|
|
6
|
+
TabsList,
|
|
7
|
+
TabsTrigger,
|
|
8
|
+
Table,
|
|
9
|
+
TableBody,
|
|
10
|
+
TableCell,
|
|
11
|
+
TableHead,
|
|
12
|
+
TableHeader,
|
|
13
|
+
TableRow,
|
|
14
|
+
} from '@vendure/dashboard';
|
|
15
|
+
import { CheckCircle2, XCircle, AlertCircle } from 'lucide-react';
|
|
16
|
+
import { formatCellValue } from '../../../utils';
|
|
17
|
+
import { TEST_STATUS, UI_LIMITS, COMPONENT_HEIGHTS } from '../../../constants';
|
|
18
|
+
import type { TestResult } from './step-test-handlers';
|
|
19
|
+
import { TestResultContainer, JsonDisplay } from './TestResultContainer';
|
|
20
|
+
|
|
21
|
+
interface ExtractTestResultsProps {
|
|
22
|
+
result: TestResult;
|
|
23
|
+
resultView: 'table' | 'json';
|
|
24
|
+
onViewChange: (view: 'table' | 'json') => void;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Status badge component for test results
|
|
29
|
+
*/
|
|
30
|
+
export const StatusBadge = memo(function StatusBadge({ status }: { status: TestResult['status'] }) {
|
|
31
|
+
switch (status) {
|
|
32
|
+
case TEST_STATUS.SUCCESS:
|
|
33
|
+
return (
|
|
34
|
+
<Badge variant="default" className="gap-1">
|
|
35
|
+
<CheckCircle2 className="h-3 w-3" /> Success
|
|
36
|
+
</Badge>
|
|
37
|
+
);
|
|
38
|
+
case TEST_STATUS.ERROR:
|
|
39
|
+
return (
|
|
40
|
+
<Badge variant="destructive" className="gap-1">
|
|
41
|
+
<XCircle className="h-3 w-3" /> Error
|
|
42
|
+
</Badge>
|
|
43
|
+
);
|
|
44
|
+
case TEST_STATUS.WARNING:
|
|
45
|
+
return (
|
|
46
|
+
<Badge variant="secondary" className="gap-1">
|
|
47
|
+
<AlertCircle className="h-3 w-3" /> Warning
|
|
48
|
+
</Badge>
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Table display for record arrays
|
|
55
|
+
*/
|
|
56
|
+
export const RecordsTable = memo(function RecordsTable({ records }: { records: Array<Record<string, unknown>> }) {
|
|
57
|
+
if (!records.length) {
|
|
58
|
+
return <div className="text-muted-foreground text-sm">No records</div>;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const allKeys = Array.from(new Set(records.flatMap(r => Object.keys(r)))).slice(0, UI_LIMITS.TABLE_PREVIEW_COLUMNS);
|
|
62
|
+
|
|
63
|
+
return (
|
|
64
|
+
<div className={`border rounded overflow-auto ${COMPONENT_HEIGHTS.SCROLL_AREA_SM}`}>
|
|
65
|
+
<Table>
|
|
66
|
+
<TableHeader>
|
|
67
|
+
<TableRow>
|
|
68
|
+
{allKeys.map(key => (
|
|
69
|
+
<TableHead key={key} className="text-xs whitespace-nowrap">
|
|
70
|
+
{key}
|
|
71
|
+
</TableHead>
|
|
72
|
+
))}
|
|
73
|
+
</TableRow>
|
|
74
|
+
</TableHeader>
|
|
75
|
+
<TableBody>
|
|
76
|
+
{/* Index as key acceptable - static test result data, not reordered */}
|
|
77
|
+
{records.slice(0, UI_LIMITS.TABLE_PREVIEW_ROWS).map((rec, recordIndex) => (
|
|
78
|
+
<TableRow key={`record-${recordIndex}`}>
|
|
79
|
+
{allKeys.map(key => (
|
|
80
|
+
<TableCell key={key} className="text-xs py-1 max-w-[200px] truncate">
|
|
81
|
+
{formatCellValue(rec[key])}
|
|
82
|
+
</TableCell>
|
|
83
|
+
))}
|
|
84
|
+
</TableRow>
|
|
85
|
+
))}
|
|
86
|
+
</TableBody>
|
|
87
|
+
</Table>
|
|
88
|
+
{records.length > UI_LIMITS.TABLE_PREVIEW_ROWS && (
|
|
89
|
+
<div className="text-xs text-muted-foreground p-2 border-t">
|
|
90
|
+
Showing {UI_LIMITS.TABLE_PREVIEW_ROWS} of {records.length} records
|
|
91
|
+
</div>
|
|
92
|
+
)}
|
|
93
|
+
</div>
|
|
94
|
+
);
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* View toggle for switching between table and JSON views
|
|
99
|
+
*/
|
|
100
|
+
export const ViewToggle = memo(function ViewToggle({
|
|
101
|
+
resultView,
|
|
102
|
+
onViewChange,
|
|
103
|
+
}: {
|
|
104
|
+
resultView: 'table' | 'json';
|
|
105
|
+
onViewChange: (view: 'table' | 'json') => void;
|
|
106
|
+
}) {
|
|
107
|
+
return (
|
|
108
|
+
<Tabs value={resultView} onValueChange={v => onViewChange(v as 'table' | 'json')}>
|
|
109
|
+
<TabsList className="h-7">
|
|
110
|
+
<TabsTrigger value="table" className="text-xs h-6 px-2">
|
|
111
|
+
Table
|
|
112
|
+
</TabsTrigger>
|
|
113
|
+
<TabsTrigger value="json" className="text-xs h-6 px-2">
|
|
114
|
+
JSON
|
|
115
|
+
</TabsTrigger>
|
|
116
|
+
</TabsList>
|
|
117
|
+
</Tabs>
|
|
118
|
+
);
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Display component for EXTRACT step test results
|
|
123
|
+
*/
|
|
124
|
+
export const ExtractTestResults = memo(function ExtractTestResults({ result, resultView, onViewChange }: ExtractTestResultsProps) {
|
|
125
|
+
if (!result.records) {
|
|
126
|
+
return null;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
return (
|
|
130
|
+
<TestResultContainer
|
|
131
|
+
result={result}
|
|
132
|
+
showViewToggle
|
|
133
|
+
resultView={resultView}
|
|
134
|
+
onViewChange={onViewChange}
|
|
135
|
+
>
|
|
136
|
+
{resultView === 'table' ? (
|
|
137
|
+
<RecordsTable records={result.records} />
|
|
138
|
+
) : (
|
|
139
|
+
<JsonDisplay data={result.records} />
|
|
140
|
+
)}
|
|
141
|
+
</TestResultContainer>
|
|
142
|
+
);
|
|
143
|
+
});
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useCallback, useEffect, useRef } from 'react';
|
|
3
|
+
import {
|
|
4
|
+
Label,
|
|
5
|
+
Select,
|
|
6
|
+
SelectContent,
|
|
7
|
+
SelectItem,
|
|
8
|
+
SelectTrigger,
|
|
9
|
+
SelectValue,
|
|
10
|
+
Input,
|
|
11
|
+
} from '@vendure/dashboard';
|
|
12
|
+
import { useApprovalTypeSchemas, type ConnectionSchemaField } from '../../../hooks/api/use-config-options';
|
|
13
|
+
|
|
14
|
+
export interface GateConfigComponentProps {
|
|
15
|
+
readonly config: Record<string, unknown>;
|
|
16
|
+
readonly onChange: (config: Record<string, unknown>) => void;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function GateConfigComponent({
|
|
20
|
+
config,
|
|
21
|
+
onChange,
|
|
22
|
+
}: GateConfigComponentProps) {
|
|
23
|
+
const { schemas: approvalTypeSchemas } = useApprovalTypeSchemas();
|
|
24
|
+
const approvalType = (config.approvalType as string) || 'MANUAL';
|
|
25
|
+
const currentSchema = approvalTypeSchemas.find(s => s.value === approvalType);
|
|
26
|
+
|
|
27
|
+
// Use refs to avoid stale closures in the initialization effect
|
|
28
|
+
const configRef = useRef(config);
|
|
29
|
+
const onChangeRef = useRef(onChange);
|
|
30
|
+
configRef.current = config;
|
|
31
|
+
onChangeRef.current = onChange;
|
|
32
|
+
|
|
33
|
+
// Initialize approvalType if not set
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
if (!configRef.current.approvalType) {
|
|
36
|
+
onChangeRef.current({ ...configRef.current, approvalType: 'MANUAL' });
|
|
37
|
+
}
|
|
38
|
+
}, []);
|
|
39
|
+
|
|
40
|
+
const updateField = useCallback((key: string, value: unknown) => {
|
|
41
|
+
onChange({ ...config, [key]: value });
|
|
42
|
+
}, [config, onChange]);
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<div className="space-y-4">
|
|
46
|
+
<div className="space-y-2">
|
|
47
|
+
<Label className="text-sm font-medium">Approval Type</Label>
|
|
48
|
+
<Select
|
|
49
|
+
value={approvalType}
|
|
50
|
+
onValueChange={(v) => updateField('approvalType', v)}
|
|
51
|
+
>
|
|
52
|
+
<SelectTrigger className="w-full" data-testid="datahub-gate-approval-type-select">
|
|
53
|
+
<SelectValue />
|
|
54
|
+
</SelectTrigger>
|
|
55
|
+
<SelectContent>
|
|
56
|
+
{approvalTypeSchemas.map((at) => (
|
|
57
|
+
<SelectItem key={at.value} value={at.value}>
|
|
58
|
+
{at.label}
|
|
59
|
+
</SelectItem>
|
|
60
|
+
))}
|
|
61
|
+
</SelectContent>
|
|
62
|
+
</Select>
|
|
63
|
+
<p className="text-xs text-muted-foreground">
|
|
64
|
+
{currentSchema?.description}
|
|
65
|
+
</p>
|
|
66
|
+
</div>
|
|
67
|
+
|
|
68
|
+
{currentSchema && currentSchema.fields.length > 0 && (
|
|
69
|
+
<div className="space-y-3">
|
|
70
|
+
{currentSchema.fields.map(field => (
|
|
71
|
+
<GateSchemaField
|
|
72
|
+
key={field.key}
|
|
73
|
+
field={field}
|
|
74
|
+
value={config[field.key]}
|
|
75
|
+
onChange={(value) => updateField(field.key, value)}
|
|
76
|
+
/>
|
|
77
|
+
))}
|
|
78
|
+
</div>
|
|
79
|
+
)}
|
|
80
|
+
</div>
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
interface GateSchemaFieldProps {
|
|
85
|
+
field: ConnectionSchemaField;
|
|
86
|
+
value: unknown;
|
|
87
|
+
onChange: (value: unknown) => void;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function GateSchemaField({ field, value, onChange }: GateSchemaFieldProps) {
|
|
91
|
+
if (field.type === 'number') {
|
|
92
|
+
return (
|
|
93
|
+
<div className="space-y-2">
|
|
94
|
+
<Label className="text-sm font-medium">{field.label}</Label>
|
|
95
|
+
<Input
|
|
96
|
+
type="number"
|
|
97
|
+
value={value != null ? String(value) : ''}
|
|
98
|
+
onChange={(e) => {
|
|
99
|
+
const val = e.target.value ? Number(e.target.value) : undefined;
|
|
100
|
+
onChange(val);
|
|
101
|
+
}}
|
|
102
|
+
placeholder={field.placeholder ?? undefined}
|
|
103
|
+
data-testid={`datahub-gate-${field.key}-input`}
|
|
104
|
+
/>
|
|
105
|
+
{field.description && (
|
|
106
|
+
<p className="text-xs text-muted-foreground">{field.description}</p>
|
|
107
|
+
)}
|
|
108
|
+
</div>
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// Default: string/text input
|
|
113
|
+
return (
|
|
114
|
+
<div className="space-y-2">
|
|
115
|
+
<Label className="text-sm font-medium">{field.label}</Label>
|
|
116
|
+
<Input
|
|
117
|
+
value={value != null ? String(value) : ''}
|
|
118
|
+
onChange={(e) => onChange(e.target.value)}
|
|
119
|
+
placeholder={field.placeholder ?? undefined}
|
|
120
|
+
data-testid={`datahub-gate-${field.key}-input`}
|
|
121
|
+
/>
|
|
122
|
+
{field.description && (
|
|
123
|
+
<p className="text-xs text-muted-foreground">{field.description}</p>
|
|
124
|
+
)}
|
|
125
|
+
</div>
|
|
126
|
+
);
|
|
127
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { formatKey, formatValue } from '../../../utils';
|
|
3
|
+
import { COMPONENT_HEIGHTS } from '../../../constants';
|
|
4
|
+
import { TestResultContainer, JsonDisplay } from './TestResultContainer';
|
|
5
|
+
import type { TestResult } from './step-test-handlers';
|
|
6
|
+
|
|
7
|
+
interface LoadTestResultsProps {
|
|
8
|
+
result: TestResult;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
interface FeedPreviewProps {
|
|
12
|
+
feedContent: { content: string; contentType: string; itemCount: number };
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Display component for LOAD step simulation results
|
|
17
|
+
*/
|
|
18
|
+
function LoadSimulationResult({
|
|
19
|
+
simulation,
|
|
20
|
+
}: {
|
|
21
|
+
simulation: Record<string, unknown>;
|
|
22
|
+
}) {
|
|
23
|
+
const entries = Object.entries(simulation);
|
|
24
|
+
|
|
25
|
+
if (!entries.length) {
|
|
26
|
+
return <div className="text-muted-foreground text-sm">No simulation data returned</div>;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<div className="space-y-2">
|
|
31
|
+
{entries.map(([key, value]) => (
|
|
32
|
+
<div key={key} className="flex items-center justify-between border rounded p-2">
|
|
33
|
+
<span className="text-sm font-medium">{formatKey(key)}</span>
|
|
34
|
+
<span className="text-sm font-mono">{formatValue(value)}</span>
|
|
35
|
+
</div>
|
|
36
|
+
))}
|
|
37
|
+
</div>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Display component for FEED step preview results
|
|
43
|
+
*/
|
|
44
|
+
function FeedPreview({ feedContent }: FeedPreviewProps) {
|
|
45
|
+
return (
|
|
46
|
+
<div className="space-y-2">
|
|
47
|
+
<div className="flex items-center gap-4 text-sm">
|
|
48
|
+
<span>
|
|
49
|
+
<strong>Items:</strong> {feedContent.itemCount}
|
|
50
|
+
</span>
|
|
51
|
+
<span>
|
|
52
|
+
<strong>Type:</strong> {feedContent.contentType}
|
|
53
|
+
</span>
|
|
54
|
+
</div>
|
|
55
|
+
<pre className={`text-xs bg-muted p-3 rounded overflow-auto ${COMPONENT_HEIGHTS.SCROLL_AREA_SM} whitespace-pre-wrap`}>
|
|
56
|
+
{feedContent.content || '(empty)'}
|
|
57
|
+
</pre>
|
|
58
|
+
</div>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Display component for LOAD step test results
|
|
64
|
+
*/
|
|
65
|
+
export function LoadTestResults({ result }: LoadTestResultsProps) {
|
|
66
|
+
if (!result.loadSimulation) {
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return (
|
|
71
|
+
<TestResultContainer result={result}>
|
|
72
|
+
<LoadSimulationResult simulation={result.loadSimulation} />
|
|
73
|
+
</TestResultContainer>
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Display component for FEED step test results
|
|
79
|
+
*/
|
|
80
|
+
export function FeedTestResults({ result }: LoadTestResultsProps) {
|
|
81
|
+
if (!result.feedContent) {
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return (
|
|
86
|
+
<TestResultContainer result={result}>
|
|
87
|
+
<FeedPreview feedContent={result.feedContent} />
|
|
88
|
+
</TestResultContainer>
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Generic result display for steps that only show data/message
|
|
94
|
+
* Used for TRIGGER, EXPORT, SINK, and unknown step types
|
|
95
|
+
*/
|
|
96
|
+
export function GenericTestResults({ result }: LoadTestResultsProps) {
|
|
97
|
+
return (
|
|
98
|
+
<TestResultContainer result={result}>
|
|
99
|
+
{result.data && (
|
|
100
|
+
<JsonDisplay data={result.data} maxHeight="200px" />
|
|
101
|
+
)}
|
|
102
|
+
</TestResultContainer>
|
|
103
|
+
);
|
|
104
|
+
}
|