@oronts/vendure-data-hub-plugin 0.1.2 → 0.1.4
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 +33 -1
- package/README.md +36 -10
- package/dashboard/components/pipelines/PipelineEditor.tsx +159 -5
- package/dashboard/components/pipelines/ReactFlowPipelineEditor.tsx +3 -3
- package/dashboard/components/pipelines/shared/NodePropertiesPanel.tsx +42 -4
- package/dashboard/components/pipelines/shared/StepListItem.tsx +2 -2
- package/dashboard/components/shared/CodeEditor.tsx +289 -0
- package/dashboard/components/shared/schema-form/fields/TextareaField.tsx +19 -4
- package/dashboard/components/shared/step-config/AdapterSelector.tsx +2 -2
- package/dashboard/components/shared/step-config/OperatorFieldInput.tsx +19 -0
- package/dashboard/components/shared/step-config/RouteConfigComponent.tsx +218 -29
- package/dashboard/components/shared/step-config/StepConfigPanel.tsx +24 -10
- package/dashboard/constants/ui-dimensions.ts +2 -1
- package/dashboard/constants/ui-states.ts +1 -0
- 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/dashboard/hooks/use-adapter-catalog.ts +4 -32
- package/dashboard/routes/connections/ConnectionDetail.tsx +7 -1
- package/dashboard/routes/pipelines/RunDetailsPanel.tsx +1 -1
- package/dashboard/routes/pipelines/components/PipelineActionButtons.tsx +3 -3
- package/dashboard/routes/pipelines/utils/pipeline-conversion.ts +3 -5
- package/dashboard/utils/formatters.ts +6 -4
- package/dist/dashboard/components/pipelines/PipelineEditor.tsx +159 -5
- package/dist/dashboard/components/pipelines/ReactFlowPipelineEditor.tsx +3 -3
- package/dist/dashboard/components/pipelines/shared/NodePropertiesPanel.tsx +42 -4
- package/dist/dashboard/components/pipelines/shared/StepListItem.tsx +2 -2
- package/dist/dashboard/components/shared/CodeEditor.tsx +289 -0
- package/dist/dashboard/components/shared/schema-form/fields/TextareaField.tsx +19 -4
- package/dist/dashboard/components/shared/step-config/AdapterSelector.tsx +2 -2
- package/dist/dashboard/components/shared/step-config/OperatorFieldInput.tsx +19 -0
- package/dist/dashboard/components/shared/step-config/RouteConfigComponent.tsx +218 -29
- package/dist/dashboard/components/shared/step-config/StepConfigPanel.tsx +24 -10
- package/dist/dashboard/constants/ui-dimensions.ts +2 -1
- package/dist/dashboard/constants/ui-states.ts +1 -0
- package/dist/dashboard/gql/gql.ts +6 -6
- package/dist/dashboard/gql/graphql.ts +9 -4
- package/dist/dashboard/hooks/api/use-pipeline-runs.ts +1 -0
- package/dist/dashboard/hooks/api/use-queues.ts +1 -0
- package/dist/dashboard/hooks/use-adapter-catalog.ts +4 -32
- package/dist/dashboard/routes/connections/ConnectionDetail.tsx +7 -1
- package/dist/dashboard/routes/pipelines/RunDetailsPanel.tsx +1 -1
- package/dist/dashboard/routes/pipelines/components/PipelineActionButtons.tsx +3 -3
- package/dist/dashboard/routes/pipelines/utils/pipeline-conversion.ts +3 -5
- package/dist/dashboard/utils/formatters.ts +6 -4
- package/dist/shared/types/adapter-config.types.d.ts +400 -13
- 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/types/loader.types.d.ts +4 -0
- package/dist/shared/types/loader.types.d.ts.map +1 -1
- package/dist/shared/types/step.types.d.ts +6 -0
- package/dist/shared/types/step.types.d.ts.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/adapters/registry.d.ts.map +1 -1
- package/dist/src/adapters/registry.js +2 -1
- package/dist/src/adapters/registry.js.map +1 -1
- package/dist/src/api/controllers/webhook.controller.d.ts +10 -0
- package/dist/src/api/controllers/webhook.controller.d.ts.map +1 -1
- package/dist/src/api/controllers/webhook.controller.js +50 -10
- package/dist/src/api/controllers/webhook.controller.js.map +1 -1
- package/dist/src/api/resolvers/queue.resolver.d.ts +3 -1
- package/dist/src/api/resolvers/queue.resolver.d.ts.map +1 -1
- package/dist/src/api/resolvers/queue.resolver.js +6 -5
- package/dist/src/api/resolvers/queue.resolver.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 +6 -0
- package/dist/src/api/schema/pipeline.schema.js.map +1 -1
- package/dist/src/api/schema/test.schema.d.ts +1 -1
- package/dist/src/api/schema/test.schema.d.ts.map +1 -1
- package/dist/src/api/schema/test.schema.js +5 -1
- package/dist/src/api/schema/test.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/constants/adapter-schema-options.d.ts +65 -0
- package/dist/src/constants/adapter-schema-options.d.ts.map +1 -1
- package/dist/src/constants/adapter-schema-options.js +79 -3
- package/dist/src/constants/adapter-schema-options.js.map +1 -1
- package/dist/src/constants/builtin-adapters.d.ts +1 -1
- package/dist/src/constants/builtin-adapters.d.ts.map +1 -1
- package/dist/src/constants/builtin-adapters.js +19 -1
- package/dist/src/constants/builtin-adapters.js.map +1 -1
- package/dist/src/constants/core.d.ts +10 -0
- package/dist/src/constants/core.d.ts.map +1 -1
- package/dist/src/constants/core.js +10 -0
- package/dist/src/constants/core.js.map +1 -1
- package/dist/src/constants/defaults/webhook-defaults.d.ts +2 -0
- package/dist/src/constants/defaults/webhook-defaults.d.ts.map +1 -1
- package/dist/src/constants/defaults/webhook-defaults.js +2 -0
- package/dist/src/constants/defaults/webhook-defaults.js.map +1 -1
- package/dist/src/constants/enum-metadata.d.ts.map +1 -1
- package/dist/src/constants/enum-metadata.js +3 -0
- package/dist/src/constants/enum-metadata.js.map +1 -1
- package/dist/src/constants/hook-stage-metadata.d.ts.map +1 -1
- package/dist/src/constants/hook-stage-metadata.js +42 -0
- package/dist/src/constants/hook-stage-metadata.js.map +1 -1
- package/dist/src/constants/services.d.ts.map +1 -1
- package/dist/src/constants/services.js +7 -0
- package/dist/src/constants/services.js.map +1 -1
- package/dist/src/constants/time.d.ts +2 -0
- package/dist/src/constants/time.d.ts.map +1 -1
- package/dist/src/constants/time.js +2 -0
- package/dist/src/constants/time.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/entities/pipeline/pipeline-run.entity.d.ts +4 -0
- package/dist/src/entities/pipeline/pipeline-run.entity.d.ts.map +1 -1
- package/dist/src/entities/pipeline/pipeline-run.entity.js +8 -0
- package/dist/src/entities/pipeline/pipeline-run.entity.js.map +1 -1
- package/dist/src/extractors/cdc/cdc.extractor.d.ts.map +1 -1
- package/dist/src/extractors/cdc/cdc.extractor.js +7 -2
- package/dist/src/extractors/cdc/cdc.extractor.js.map +1 -1
- package/dist/src/extractors/cdc/types.d.ts +1 -1
- package/dist/src/extractors/cdc/types.d.ts.map +1 -1
- package/dist/src/extractors/extractor-handler-registry.d.ts.map +1 -1
- package/dist/src/extractors/extractor-handler-registry.js +3 -0
- package/dist/src/extractors/extractor-handler-registry.js.map +1 -1
- package/dist/src/extractors/vendure-query/helpers.d.ts +9 -4
- package/dist/src/extractors/vendure-query/helpers.d.ts.map +1 -1
- package/dist/src/extractors/vendure-query/helpers.js +98 -32
- package/dist/src/extractors/vendure-query/helpers.js.map +1 -1
- package/dist/src/extractors/vendure-query/schema.d.ts.map +1 -1
- package/dist/src/extractors/vendure-query/schema.js +13 -0
- package/dist/src/extractors/vendure-query/schema.js.map +1 -1
- package/dist/src/feeds/generators/csv-feed.generator.d.ts.map +1 -1
- package/dist/src/feeds/generators/csv-feed.generator.js +5 -4
- package/dist/src/feeds/generators/csv-feed.generator.js.map +1 -1
- package/dist/src/feeds/generators/facebook-catalog.generator.d.ts.map +1 -1
- package/dist/src/feeds/generators/facebook-catalog.generator.js +83 -114
- package/dist/src/feeds/generators/facebook-catalog.generator.js.map +1 -1
- package/dist/src/feeds/generators/feed-constants.d.ts +1 -0
- package/dist/src/feeds/generators/feed-constants.d.ts.map +1 -1
- package/dist/src/feeds/generators/feed-constants.js +1 -0
- package/dist/src/feeds/generators/feed-constants.js.map +1 -1
- package/dist/src/feeds/generators/feed-helpers.d.ts +10 -8
- package/dist/src/feeds/generators/feed-helpers.d.ts.map +1 -1
- package/dist/src/feeds/generators/feed-helpers.js +23 -3
- package/dist/src/feeds/generators/feed-helpers.js.map +1 -1
- package/dist/src/feeds/generators/feed-item-builder.d.ts +59 -0
- package/dist/src/feeds/generators/feed-item-builder.d.ts.map +1 -0
- package/dist/src/feeds/generators/feed-item-builder.js +93 -0
- package/dist/src/feeds/generators/feed-item-builder.js.map +1 -0
- package/dist/src/feeds/generators/google-shopping.generator.d.ts.map +1 -1
- package/dist/src/feeds/generators/google-shopping.generator.js +52 -64
- package/dist/src/feeds/generators/google-shopping.generator.js.map +1 -1
- package/dist/src/feeds/generators/json-feed.generator.d.ts.map +1 -1
- package/dist/src/feeds/generators/json-feed.generator.js +4 -3
- package/dist/src/feeds/generators/json-feed.generator.js.map +1 -1
- package/dist/src/feeds/generators/xml-feed.generator.d.ts.map +1 -1
- package/dist/src/feeds/generators/xml-feed.generator.js +6 -5
- package/dist/src/feeds/generators/xml-feed.generator.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/index.d.ts +3 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +7 -4
- package/dist/src/index.js.map +1 -1
- package/dist/src/loaders/asset/asset.loader.d.ts.map +1 -1
- package/dist/src/loaders/asset/asset.loader.js +5 -1
- package/dist/src/loaders/asset/asset.loader.js.map +1 -1
- package/dist/src/loaders/base/validation-builder.d.ts +128 -3
- package/dist/src/loaders/base/validation-builder.d.ts.map +1 -1
- package/dist/src/loaders/base/validation-builder.js +177 -6
- package/dist/src/loaders/base/validation-builder.js.map +1 -1
- package/dist/src/loaders/collection/collection.loader.d.ts.map +1 -1
- package/dist/src/loaders/collection/collection.loader.js +22 -1
- package/dist/src/loaders/collection/collection.loader.js.map +1 -1
- package/dist/src/loaders/collection/helpers.d.ts +16 -1
- package/dist/src/loaders/collection/helpers.d.ts.map +1 -1
- package/dist/src/loaders/collection/helpers.js +37 -0
- package/dist/src/loaders/collection/helpers.js.map +1 -1
- package/dist/src/loaders/customer/customer.loader.d.ts.map +1 -1
- package/dist/src/loaders/customer/customer.loader.js +13 -1
- package/dist/src/loaders/customer/customer.loader.js.map +1 -1
- package/dist/src/loaders/customer/helpers.d.ts +15 -3
- package/dist/src/loaders/customer/helpers.d.ts.map +1 -1
- package/dist/src/loaders/customer/helpers.js +188 -7
- package/dist/src/loaders/customer/helpers.js.map +1 -1
- package/dist/src/loaders/facet-value/facet-value.loader.d.ts.map +1 -1
- package/dist/src/loaders/facet-value/facet-value.loader.js +18 -0
- package/dist/src/loaders/facet-value/facet-value.loader.js.map +1 -1
- package/dist/src/loaders/facet-value/types.d.ts +1 -1
- package/dist/src/loaders/facet-value/types.js +1 -1
- package/dist/src/loaders/facet-value/types.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/loaders/order/helpers.d.ts +16 -2
- package/dist/src/loaders/order/helpers.d.ts.map +1 -1
- package/dist/src/loaders/order/helpers.js +108 -0
- package/dist/src/loaders/order/helpers.js.map +1 -1
- package/dist/src/loaders/order/order.loader.d.ts +38 -0
- package/dist/src/loaders/order/order.loader.d.ts.map +1 -1
- package/dist/src/loaders/order/order.loader.js +238 -24
- package/dist/src/loaders/order/order.loader.js.map +1 -1
- package/dist/src/loaders/order/types.d.ts +10 -3
- package/dist/src/loaders/order/types.d.ts.map +1 -1
- package/dist/src/loaders/order/types.js +13 -2
- package/dist/src/loaders/order/types.js.map +1 -1
- package/dist/src/loaders/product/product.loader.d.ts.map +1 -1
- package/dist/src/loaders/product/product.loader.js +18 -2
- package/dist/src/loaders/product/product.loader.js.map +1 -1
- package/dist/src/loaders/product-variant/helpers.d.ts +20 -0
- package/dist/src/loaders/product-variant/helpers.d.ts.map +1 -0
- package/dist/src/loaders/product-variant/helpers.js +103 -0
- package/dist/src/loaders/product-variant/helpers.js.map +1 -0
- package/dist/src/loaders/product-variant/product-variant.loader.d.ts.map +1 -1
- package/dist/src/loaders/product-variant/product-variant.loader.js +76 -10
- package/dist/src/loaders/product-variant/product-variant.loader.js.map +1 -1
- package/dist/src/loaders/product-variant/types.d.ts +7 -0
- package/dist/src/loaders/product-variant/types.d.ts.map +1 -1
- package/dist/src/loaders/product-variant/types.js.map +1 -1
- package/dist/src/loaders/promotion/helpers.d.ts +29 -0
- package/dist/src/loaders/promotion/helpers.d.ts.map +1 -1
- package/dist/src/loaders/promotion/helpers.js +68 -0
- package/dist/src/loaders/promotion/helpers.js.map +1 -1
- package/dist/src/loaders/promotion/promotion.loader.d.ts.map +1 -1
- package/dist/src/loaders/promotion/promotion.loader.js +12 -2
- package/dist/src/loaders/promotion/promotion.loader.js.map +1 -1
- package/dist/src/loaders/shared-helpers.d.ts +42 -2
- package/dist/src/loaders/shared-helpers.d.ts.map +1 -1
- package/dist/src/loaders/shared-helpers.js +384 -5
- package/dist/src/loaders/shared-helpers.js.map +1 -1
- package/dist/src/operators/data/copy.operator.js +2 -2
- package/dist/src/operators/data/copy.operator.js.map +1 -1
- package/dist/src/operators/data/rename.operator.js +1 -1
- package/dist/src/operators/data/rename.operator.js.map +1 -1
- package/dist/src/operators/helpers.d.ts.map +1 -1
- package/dist/src/operators/helpers.js +11 -1
- package/dist/src/operators/helpers.js.map +1 -1
- package/dist/src/operators/operator-runtime-registry.d.ts +2 -2
- package/dist/src/operators/operator-runtime-registry.d.ts.map +1 -1
- package/dist/src/operators/operator-runtime-registry.js +1 -1
- package/dist/src/operators/operator-runtime-registry.js.map +1 -1
- package/dist/src/operators/script/script.operators.d.ts.map +1 -1
- package/dist/src/operators/script/script.operators.js +9 -3
- package/dist/src/operators/script/script.operators.js.map +1 -1
- package/dist/src/runtime/config-types.d.ts +6 -0
- package/dist/src/runtime/config-types.d.ts.map +1 -1
- package/dist/src/runtime/executor-helpers.d.ts +77 -0
- package/dist/src/runtime/executor-helpers.d.ts.map +1 -0
- package/dist/src/runtime/executor-helpers.js +143 -0
- package/dist/src/runtime/executor-helpers.js.map +1 -0
- 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/export.executor.d.ts +3 -1
- package/dist/src/runtime/executors/export.executor.d.ts.map +1 -1
- package/dist/src/runtime/executors/export.executor.js +15 -3
- package/dist/src/runtime/executors/export.executor.js.map +1 -1
- package/dist/src/runtime/executors/exporters/export-handler-registry.d.ts.map +1 -1
- package/dist/src/runtime/executors/exporters/export-handler-registry.js +5 -0
- package/dist/src/runtime/executors/exporters/export-handler-registry.js.map +1 -1
- package/dist/src/runtime/executors/exporters/export-handler.types.d.ts +3 -0
- package/dist/src/runtime/executors/exporters/export-handler.types.d.ts.map +1 -1
- package/dist/src/runtime/executors/exporters/export-handler.types.js.map +1 -1
- package/dist/src/runtime/executors/exporters/export-helpers.d.ts +1 -0
- package/dist/src/runtime/executors/exporters/export-helpers.d.ts.map +1 -1
- package/dist/src/runtime/executors/exporters/export-helpers.js +33 -4
- package/dist/src/runtime/executors/exporters/export-helpers.js.map +1 -1
- package/dist/src/runtime/executors/exporters/http-export.handler.js +4 -4
- package/dist/src/runtime/executors/exporters/http-export.handler.js.map +1 -1
- package/dist/src/runtime/executors/extractors/file-extract.handler.d.ts.map +1 -1
- package/dist/src/runtime/executors/extractors/file-extract.handler.js +33 -13
- package/dist/src/runtime/executors/extractors/file-extract.handler.js.map +1 -1
- package/dist/src/runtime/executors/extractors/memory-extract.handler.d.ts.map +1 -1
- package/dist/src/runtime/executors/extractors/memory-extract.handler.js +17 -9
- package/dist/src/runtime/executors/extractors/memory-extract.handler.js.map +1 -1
- package/dist/src/runtime/executors/feed.executor.d.ts.map +1 -1
- package/dist/src/runtime/executors/feed.executor.js +11 -2
- package/dist/src/runtime/executors/feed.executor.js.map +1 -1
- package/dist/src/runtime/executors/feeds/feed-handler-registry.d.ts.map +1 -1
- package/dist/src/runtime/executors/feeds/feed-handler-registry.js +4 -0
- package/dist/src/runtime/executors/feeds/feed-handler-registry.js.map +1 -1
- package/dist/src/runtime/executors/gate.executor.d.ts +3 -1
- package/dist/src/runtime/executors/gate.executor.d.ts.map +1 -1
- package/dist/src/runtime/executors/gate.executor.js +47 -26
- package/dist/src/runtime/executors/gate.executor.js.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 +3 -1
- package/dist/src/runtime/executors/loaders/channel-handler.d.ts.map +1 -1
- package/dist/src/runtime/executors/loaders/channel-handler.js +28 -5
- package/dist/src/runtime/executors/loaders/channel-handler.js.map +1 -1
- package/dist/src/runtime/executors/loaders/collection-handler.d.ts +14 -2
- package/dist/src/runtime/executors/loaders/collection-handler.d.ts.map +1 -1
- package/dist/src/runtime/executors/loaders/collection-handler.js +113 -23
- 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 +2 -20
- package/dist/src/runtime/executors/loaders/customer-group-handler.js.map +1 -1
- package/dist/src/runtime/executors/loaders/customer-handler.d.ts +6 -1
- package/dist/src/runtime/executors/loaders/customer-handler.d.ts.map +1 -1
- package/dist/src/runtime/executors/loaders/customer-handler.js +128 -15
- package/dist/src/runtime/executors/loaders/customer-handler.js.map +1 -1
- package/dist/src/runtime/executors/loaders/deletion-handler.d.ts +39 -0
- package/dist/src/runtime/executors/loaders/deletion-handler.d.ts.map +1 -0
- package/dist/src/runtime/executors/loaders/deletion-handler.js +414 -0
- package/dist/src/runtime/executors/loaders/deletion-handler.js.map +1 -0
- package/dist/src/runtime/executors/loaders/facet-handler.d.ts +18 -3
- package/dist/src/runtime/executors/loaders/facet-handler.d.ts.map +1 -1
- package/dist/src/runtime/executors/loaders/facet-handler.js +161 -28
- 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/index.d.ts +2 -0
- package/dist/src/runtime/executors/loaders/index.d.ts.map +1 -1
- package/dist/src/runtime/executors/loaders/index.js +5 -1
- package/dist/src/runtime/executors/loaders/index.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 +2 -21
- package/dist/src/runtime/executors/loaders/inventory-adjust-handler.js.map +1 -1
- package/dist/src/runtime/executors/loaders/inventory-handler.d.ts +2 -1
- package/dist/src/runtime/executors/loaders/inventory-handler.d.ts.map +1 -1
- package/dist/src/runtime/executors/loaders/inventory-handler.js +11 -9
- 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 +150 -11
- package/dist/src/runtime/executors/loaders/loader-handler-registry.js.map +1 -1
- package/dist/src/runtime/executors/loaders/order-handler.d.ts +32 -4
- package/dist/src/runtime/executors/loaders/order-handler.d.ts.map +1 -1
- package/dist/src/runtime/executors/loaders/order-handler.js +201 -18
- package/dist/src/runtime/executors/loaders/order-handler.js.map +1 -1
- package/dist/src/runtime/executors/loaders/order-upsert-handler.d.ts +15 -0
- package/dist/src/runtime/executors/loaders/order-upsert-handler.d.ts.map +1 -0
- package/dist/src/runtime/executors/loaders/order-upsert-handler.js +89 -0
- package/dist/src/runtime/executors/loaders/order-upsert-handler.js.map +1 -0
- package/dist/src/runtime/executors/loaders/payment-method-handler.d.ts +11 -2
- package/dist/src/runtime/executors/loaders/payment-method-handler.d.ts.map +1 -1
- package/dist/src/runtime/executors/loaders/payment-method-handler.js +92 -34
- package/dist/src/runtime/executors/loaders/payment-method-handler.js.map +1 -1
- package/dist/src/runtime/executors/loaders/product-handler.d.ts +20 -0
- package/dist/src/runtime/executors/loaders/product-handler.d.ts.map +1 -1
- package/dist/src/runtime/executors/loaders/product-handler.js +121 -31
- package/dist/src/runtime/executors/loaders/product-handler.js.map +1 -1
- package/dist/src/runtime/executors/loaders/promotion-handler.d.ts +9 -2
- package/dist/src/runtime/executors/loaders/promotion-handler.d.ts.map +1 -1
- package/dist/src/runtime/executors/loaders/promotion-handler.js +134 -68
- 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 +62 -1
- package/dist/src/runtime/executors/loaders/shared-lookups.d.ts.map +1 -1
- package/dist/src/runtime/executors/loaders/shared-lookups.js +238 -0
- package/dist/src/runtime/executors/loaders/shared-lookups.js.map +1 -1
- package/dist/src/runtime/executors/loaders/shipping-method-handler.d.ts +11 -6
- package/dist/src/runtime/executors/loaders/shipping-method-handler.d.ts.map +1 -1
- package/dist/src/runtime/executors/loaders/shipping-method-handler.js +168 -54
- 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 +2 -20
- 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 +266 -47
- package/dist/src/runtime/executors/loaders/variant-handler.js.map +1 -1
- package/dist/src/runtime/executors/sink-handler-registry.d.ts +7 -11
- package/dist/src/runtime/executors/sink-handler-registry.d.ts.map +1 -1
- package/dist/src/runtime/executors/sink-handler-registry.js +376 -10
- package/dist/src/runtime/executors/sink-handler-registry.js.map +1 -1
- package/dist/src/runtime/executors/sink.executor.d.ts +1 -0
- package/dist/src/runtime/executors/sink.executor.d.ts.map +1 -1
- package/dist/src/runtime/executors/sink.executor.js +82 -12
- package/dist/src/runtime/executors/sink.executor.js.map +1 -1
- package/dist/src/runtime/executors/transform.executor.d.ts.map +1 -1
- package/dist/src/runtime/executors/transform.executor.js +31 -2
- package/dist/src/runtime/executors/transform.executor.js.map +1 -1
- package/dist/src/runtime/orchestration/graph-executor.d.ts.map +1 -1
- package/dist/src/runtime/orchestration/graph-executor.js +3 -2
- package/dist/src/runtime/orchestration/graph-executor.js.map +1 -1
- package/dist/src/runtime/orchestration/helpers.d.ts +4 -1
- package/dist/src/runtime/orchestration/helpers.d.ts.map +1 -1
- package/dist/src/runtime/orchestration/helpers.js +7 -2
- package/dist/src/runtime/orchestration/helpers.js.map +1 -1
- package/dist/src/runtime/orchestration/linear-executor.d.ts.map +1 -1
- package/dist/src/runtime/orchestration/linear-executor.js +3 -2
- package/dist/src/runtime/orchestration/linear-executor.js.map +1 -1
- package/dist/src/runtime/orchestration/replay-executor.d.ts.map +1 -1
- package/dist/src/runtime/orchestration/replay-executor.js +3 -2
- package/dist/src/runtime/orchestration/replay-executor.js.map +1 -1
- package/dist/src/runtime/orchestration/step-strategies/export-step.strategy.d.ts.map +1 -1
- package/dist/src/runtime/orchestration/step-strategies/export-step.strategy.js +12 -12
- package/dist/src/runtime/orchestration/step-strategies/export-step.strategy.js.map +1 -1
- package/dist/src/runtime/orchestration/step-strategies/feed-step.strategy.d.ts.map +1 -1
- package/dist/src/runtime/orchestration/step-strategies/feed-step.strategy.js +12 -12
- package/dist/src/runtime/orchestration/step-strategies/feed-step.strategy.js.map +1 -1
- package/dist/src/runtime/orchestration/step-strategies/load-step.strategy.js +2 -2
- package/dist/src/runtime/orchestration/step-strategies/load-step.strategy.js.map +1 -1
- package/dist/src/runtime/orchestration/step-strategies/sink-step.strategy.d.ts.map +1 -1
- package/dist/src/runtime/orchestration/step-strategies/sink-step.strategy.js +12 -12
- package/dist/src/runtime/orchestration/step-strategies/sink-step.strategy.js.map +1 -1
- package/dist/src/runtime/orchestration/step-strategies/step-dispatcher.d.ts.map +1 -1
- package/dist/src/runtime/orchestration/step-strategies/step-dispatcher.js +4 -3
- package/dist/src/runtime/orchestration/step-strategies/step-dispatcher.js.map +1 -1
- package/dist/src/runtime/orchestration/step-strategies/transform-step.strategy.js +4 -4
- package/dist/src/runtime/orchestration/step-strategies/transform-step.strategy.js.map +1 -1
- package/dist/src/runtime/orchestration/types.d.ts +1 -0
- package/dist/src/runtime/orchestration/types.d.ts.map +1 -1
- package/dist/src/runtime/utils.d.ts.map +1 -1
- package/dist/src/runtime/utils.js +8 -1
- package/dist/src/runtime/utils.js.map +1 -1
- package/dist/src/sdk/adapters/queue/index.d.ts +1 -0
- package/dist/src/sdk/adapters/queue/index.d.ts.map +1 -1
- package/dist/src/sdk/adapters/queue/index.js +1 -0
- package/dist/src/sdk/adapters/queue/index.js.map +1 -1
- package/dist/src/sdk/adapters/queue/internal.adapter.d.ts +32 -0
- package/dist/src/sdk/adapters/queue/internal.adapter.d.ts.map +1 -0
- package/dist/src/sdk/adapters/queue/internal.adapter.js +68 -0
- package/dist/src/sdk/adapters/queue/internal.adapter.js.map +1 -0
- package/dist/src/sdk/adapters/queue/queue-adapter.registry.d.ts.map +1 -1
- package/dist/src/sdk/adapters/queue/queue-adapter.registry.js +3 -0
- package/dist/src/sdk/adapters/queue/queue-adapter.registry.js.map +1 -1
- package/dist/src/sdk/adapters/queue/rabbitmq.adapter.d.ts.map +1 -1
- package/dist/src/sdk/adapters/queue/rabbitmq.adapter.js +2 -1
- package/dist/src/sdk/adapters/queue/rabbitmq.adapter.js.map +1 -1
- package/dist/src/sdk/constants.d.ts +2 -2
- package/dist/src/sdk/constants.d.ts.map +1 -1
- package/dist/src/sdk/dsl/pipeline-builder.d.ts +8 -2
- package/dist/src/sdk/dsl/pipeline-builder.d.ts.map +1 -1
- package/dist/src/sdk/dsl/pipeline-builder.js +115 -19
- package/dist/src/sdk/dsl/pipeline-builder.js.map +1 -1
- package/dist/src/sdk/dsl/step-configs.d.ts +24 -0
- package/dist/src/sdk/dsl/step-configs.d.ts.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/events/consumer-discovery.d.ts.map +1 -1
- package/dist/src/services/events/consumer-discovery.js +2 -1
- package/dist/src/services/events/consumer-discovery.js.map +1 -1
- package/dist/src/services/events/consumer-lifecycle.d.ts.map +1 -1
- package/dist/src/services/events/consumer-lifecycle.js +19 -15
- package/dist/src/services/events/consumer-lifecycle.js.map +1 -1
- package/dist/src/services/events/event-trigger.service.d.ts.map +1 -1
- package/dist/src/services/events/event-trigger.service.js +9 -3
- package/dist/src/services/events/event-trigger.service.js.map +1 -1
- package/dist/src/services/events/hook.service.d.ts.map +1 -1
- package/dist/src/services/events/hook.service.js +7 -3
- package/dist/src/services/events/hook.service.js.map +1 -1
- package/dist/src/services/events/message-processing.d.ts.map +1 -1
- package/dist/src/services/events/message-processing.js +13 -8
- package/dist/src/services/events/message-processing.js.map +1 -1
- package/dist/src/services/logger/datahub-logger.d.ts +7 -0
- package/dist/src/services/logger/datahub-logger.d.ts.map +1 -1
- package/dist/src/services/logger/datahub-logger.js +9 -0
- package/dist/src/services/logger/datahub-logger.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 +3 -1
- package/dist/src/services/pipeline/pipeline-runner.service.d.ts.map +1 -1
- package/dist/src/services/pipeline/pipeline-runner.service.js +17 -7
- package/dist/src/services/pipeline/pipeline-runner.service.js.map +1 -1
- package/dist/src/services/pipeline/pipeline.service.d.ts.map +1 -1
- package/dist/src/services/pipeline/pipeline.service.js +8 -2
- package/dist/src/services/pipeline/pipeline.service.js.map +1 -1
- package/dist/src/services/storage/retention.service.d.ts.map +1 -1
- package/dist/src/services/storage/retention.service.js +22 -0
- package/dist/src/services/storage/retention.service.js.map +1 -1
- package/dist/src/services/testing/step-test.service.d.ts.map +1 -1
- package/dist/src/services/testing/step-test.service.js +17 -1
- package/dist/src/services/testing/step-test.service.js.map +1 -1
- package/dist/src/services/validation/definition-validation.service.d.ts.map +1 -1
- package/dist/src/services/validation/definition-validation.service.js +4 -1
- package/dist/src/services/validation/definition-validation.service.js.map +1 -1
- package/dist/src/services/validation/trigger-validation.d.ts.map +1 -1
- package/dist/src/services/validation/trigger-validation.js +76 -2
- package/dist/src/services/validation/trigger-validation.js.map +1 -1
- package/dist/src/types/index.d.ts +1 -0
- package/dist/src/types/index.d.ts.map +1 -1
- package/dist/src/types/index.js.map +1 -1
- package/dist/src/types/loader-configs.d.ts +1071 -0
- package/dist/src/types/loader-configs.d.ts.map +1 -0
- package/dist/src/types/loader-configs.js +54 -0
- package/dist/src/types/loader-configs.js.map +1 -0
- package/dist/src/types/step-configs.d.ts +1 -0
- package/dist/src/types/step-configs.d.ts.map +1 -1
- package/dist/src/types/step-configs.js +3 -0
- package/dist/src/types/step-configs.js.map +1 -1
- package/dist/src/utils/code-security.utils.d.ts +18 -0
- package/dist/src/utils/code-security.utils.d.ts.map +1 -1
- package/dist/src/utils/code-security.utils.js +125 -9
- package/dist/src/utils/code-security.utils.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/dist/src/validation/pipeline-definition.validator.js +2 -1
- package/dist/src/validation/pipeline-definition.validator.js.map +1 -1
- package/docs/developer-guide/README.md +2 -0
- package/docs/developer-guide/dsl/pipeline-builder.md +12 -0
- package/docs/developer-guide/extending/README.md +230 -10
- package/docs/developer-guide/extending/custom-sinks.md +87 -0
- package/docs/developer-guide/extending/events.md +4 -1
- package/docs/examples/validation-error-messages.md +246 -0
- package/docs/guides/multi-channel.md +1190 -0
- package/docs/guides/multi-currency.md +881 -0
- package/docs/guides/multi-entity.md +597 -0
- package/docs/guides/multi-language.md +957 -0
- package/docs/reference/README.md +11 -4
- package/docs/reference/extractors.md +30 -0
- package/docs/reference/loaders.md +396 -21
- package/docs/reference/operators-complete.md +1251 -0
- package/docs/reference/operators.md +36 -2
- package/docs/reference/sinks.md +7 -6
- package/docs/reference/step-types.md +12 -5
- package/docs/user-guide/pipelines.md +82 -13
- package/package.json +1 -1
- package/shared/types/adapter-config.types.ts +439 -10
- package/shared/types/index.ts +25 -0
- package/shared/types/loader.types.ts +4 -0
- package/shared/types/step.types.ts +6 -0
- package/shared/utils/error.ts +11 -0
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useCallback, useRef, useMemo, useState } from 'react';
|
|
3
|
+
import {
|
|
4
|
+
Button,
|
|
5
|
+
Dialog,
|
|
6
|
+
DialogContent,
|
|
7
|
+
DialogHeader,
|
|
8
|
+
DialogTitle,
|
|
9
|
+
} from '@vendure/dashboard';
|
|
10
|
+
import { Maximize2, Minimize2, WandSparkles } from 'lucide-react';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Lightweight JavaScript formatter. Handles indentation, brace/bracket alignment,
|
|
14
|
+
* semicolon insertion, and basic whitespace normalization without external deps.
|
|
15
|
+
*/
|
|
16
|
+
function formatJavaScript(code: string): string {
|
|
17
|
+
if (!code.trim()) return code;
|
|
18
|
+
|
|
19
|
+
const lines = code.split('\n');
|
|
20
|
+
let indent = 0;
|
|
21
|
+
const indentStr = ' ';
|
|
22
|
+
const result: string[] = [];
|
|
23
|
+
|
|
24
|
+
for (const rawLine of lines) {
|
|
25
|
+
let line = rawLine.trim();
|
|
26
|
+
if (!line) {
|
|
27
|
+
// Preserve blank lines (max 1 consecutive)
|
|
28
|
+
if (result.length > 0 && result[result.length - 1] !== '') {
|
|
29
|
+
result.push('');
|
|
30
|
+
}
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Decrease indent for closing braces/brackets/parens
|
|
35
|
+
if (/^[}\])]/.test(line)) {
|
|
36
|
+
indent = Math.max(0, indent - 1);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Apply current indentation
|
|
40
|
+
result.push(indentStr.repeat(indent) + line);
|
|
41
|
+
|
|
42
|
+
// Increase indent for opening braces/brackets (not in strings/comments)
|
|
43
|
+
const stripped = line.replace(/\/\/.*$/, '').replace(/'[^']*'|"[^"]*"|`[^`]*`/g, '""');
|
|
44
|
+
const opens = (stripped.match(/[{(\[]/g) || []).length;
|
|
45
|
+
const closes = (stripped.match(/[})\]]/g) || []).length;
|
|
46
|
+
indent = Math.max(0, indent + opens - closes);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// Remove trailing blank lines
|
|
50
|
+
while (result.length > 0 && result[result.length - 1] === '') {
|
|
51
|
+
result.pop();
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return result.join('\n');
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export interface CodeEditorProps {
|
|
58
|
+
id: string;
|
|
59
|
+
value: string;
|
|
60
|
+
onChange: (value: string) => void;
|
|
61
|
+
placeholder?: string;
|
|
62
|
+
disabled?: boolean;
|
|
63
|
+
rows: number;
|
|
64
|
+
className?: string;
|
|
65
|
+
showFormatButton?: boolean;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Code editor with line numbers, Tab key support, and synchronized scroll.
|
|
70
|
+
* Used by both SchemaFormRenderer (TextareaField) and OperatorFieldInput.
|
|
71
|
+
*/
|
|
72
|
+
export function CodeEditor({
|
|
73
|
+
id,
|
|
74
|
+
value,
|
|
75
|
+
onChange,
|
|
76
|
+
placeholder,
|
|
77
|
+
disabled,
|
|
78
|
+
rows,
|
|
79
|
+
className,
|
|
80
|
+
showFormatButton,
|
|
81
|
+
}: CodeEditorProps) {
|
|
82
|
+
const textareaRef = useRef<HTMLTextAreaElement>(null);
|
|
83
|
+
|
|
84
|
+
const lineCount = useMemo(() => {
|
|
85
|
+
const lines = (value || '').split('\n').length;
|
|
86
|
+
return Math.max(lines, rows);
|
|
87
|
+
}, [value, rows]);
|
|
88
|
+
|
|
89
|
+
const lineNumbers = useMemo(
|
|
90
|
+
() => Array.from({ length: lineCount }, (_, i) => i + 1),
|
|
91
|
+
[lineCount],
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
const handleChange = useCallback(
|
|
95
|
+
(e: React.ChangeEvent<HTMLTextAreaElement>) => {
|
|
96
|
+
onChange(e.target.value);
|
|
97
|
+
},
|
|
98
|
+
[onChange],
|
|
99
|
+
);
|
|
100
|
+
|
|
101
|
+
const handleKeyDown = useCallback(
|
|
102
|
+
(e: React.KeyboardEvent<HTMLTextAreaElement>) => {
|
|
103
|
+
if (e.key === 'Tab') {
|
|
104
|
+
e.preventDefault();
|
|
105
|
+
const ta = e.currentTarget;
|
|
106
|
+
const start = ta.selectionStart;
|
|
107
|
+
const end = ta.selectionEnd;
|
|
108
|
+
const newValue = value.substring(0, start) + ' ' + value.substring(end);
|
|
109
|
+
onChange(newValue);
|
|
110
|
+
requestAnimationFrame(() => {
|
|
111
|
+
ta.selectionStart = ta.selectionEnd = start + 2;
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
// Enter key: auto-indent to match current line
|
|
115
|
+
if (e.key === 'Enter') {
|
|
116
|
+
const ta = e.currentTarget;
|
|
117
|
+
const start = ta.selectionStart;
|
|
118
|
+
const lineStart = value.lastIndexOf('\n', start - 1) + 1;
|
|
119
|
+
const currentLine = value.substring(lineStart, start);
|
|
120
|
+
const match = currentLine.match(/^(\s*)/);
|
|
121
|
+
const currentIndent = match ? match[1] : '';
|
|
122
|
+
|
|
123
|
+
// Add extra indent if line ends with { or (
|
|
124
|
+
const trimmed = currentLine.trimEnd();
|
|
125
|
+
const extraIndent = /[{(\[]$/.test(trimmed) ? ' ' : '';
|
|
126
|
+
|
|
127
|
+
e.preventDefault();
|
|
128
|
+
const newValue = value.substring(0, start) + '\n' + currentIndent + extraIndent + value.substring(ta.selectionEnd);
|
|
129
|
+
onChange(newValue);
|
|
130
|
+
const newPos = start + 1 + currentIndent.length + extraIndent.length;
|
|
131
|
+
requestAnimationFrame(() => {
|
|
132
|
+
ta.selectionStart = ta.selectionEnd = newPos;
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
[value, onChange],
|
|
137
|
+
);
|
|
138
|
+
|
|
139
|
+
const handleScroll = useCallback(() => {
|
|
140
|
+
const ta = textareaRef.current;
|
|
141
|
+
const gutter = ta?.parentElement?.querySelector('[data-gutter]') as HTMLElement | null;
|
|
142
|
+
if (ta && gutter) {
|
|
143
|
+
gutter.scrollTop = ta.scrollTop;
|
|
144
|
+
}
|
|
145
|
+
}, []);
|
|
146
|
+
|
|
147
|
+
const handleFormat = useCallback(() => {
|
|
148
|
+
onChange(formatJavaScript(value));
|
|
149
|
+
}, [value, onChange]);
|
|
150
|
+
|
|
151
|
+
return (
|
|
152
|
+
<div className={`relative rounded-md border border-input bg-background overflow-hidden focus-within:ring-1 focus-within:ring-ring ${className ?? ''}`}>
|
|
153
|
+
{showFormatButton && (
|
|
154
|
+
<div className="flex items-center justify-between px-2 py-1 bg-muted/30 border-b border-input">
|
|
155
|
+
<span className="text-[10px] font-mono text-muted-foreground uppercase tracking-wider">JavaScript</span>
|
|
156
|
+
<Button
|
|
157
|
+
variant="ghost"
|
|
158
|
+
size="sm"
|
|
159
|
+
className="h-5 text-[10px] gap-1 px-1.5 text-muted-foreground hover:text-foreground"
|
|
160
|
+
onClick={handleFormat}
|
|
161
|
+
type="button"
|
|
162
|
+
disabled={disabled}
|
|
163
|
+
>
|
|
164
|
+
<WandSparkles className="h-3 w-3" />
|
|
165
|
+
Format
|
|
166
|
+
</Button>
|
|
167
|
+
</div>
|
|
168
|
+
)}
|
|
169
|
+
<div className="flex">
|
|
170
|
+
<div
|
|
171
|
+
data-gutter
|
|
172
|
+
className="flex flex-col items-end pt-2 pb-2 px-2 bg-muted/50 text-muted-foreground text-xs font-mono select-none overflow-hidden border-r border-input"
|
|
173
|
+
style={{ minWidth: '2.5rem' }}
|
|
174
|
+
aria-hidden="true"
|
|
175
|
+
>
|
|
176
|
+
{lineNumbers.map((n) => (
|
|
177
|
+
<div key={n} className="leading-5 h-5">{n}</div>
|
|
178
|
+
))}
|
|
179
|
+
</div>
|
|
180
|
+
<textarea
|
|
181
|
+
ref={textareaRef}
|
|
182
|
+
id={id}
|
|
183
|
+
value={value ?? ''}
|
|
184
|
+
onChange={handleChange}
|
|
185
|
+
onKeyDown={handleKeyDown}
|
|
186
|
+
onScroll={handleScroll}
|
|
187
|
+
placeholder={placeholder}
|
|
188
|
+
disabled={disabled}
|
|
189
|
+
rows={rows}
|
|
190
|
+
spellCheck={false}
|
|
191
|
+
className="flex-1 resize-none bg-transparent p-2 font-mono text-sm leading-5 outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50"
|
|
192
|
+
style={{ tabSize: 2 }}
|
|
193
|
+
/>
|
|
194
|
+
</div>
|
|
195
|
+
</div>
|
|
196
|
+
);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
export interface CodeEditorWithExpandProps {
|
|
200
|
+
id: string;
|
|
201
|
+
label: string;
|
|
202
|
+
value: string;
|
|
203
|
+
onChange: (value: string) => void;
|
|
204
|
+
placeholder?: string;
|
|
205
|
+
disabled?: boolean;
|
|
206
|
+
rows?: number;
|
|
207
|
+
description?: string;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Code editor with an Expand button that opens a fullscreen dialog.
|
|
212
|
+
* Wraps CodeEditor with expand/collapse functionality.
|
|
213
|
+
* Includes Format button for JavaScript code formatting.
|
|
214
|
+
*/
|
|
215
|
+
export function CodeEditorWithExpand({
|
|
216
|
+
id,
|
|
217
|
+
label,
|
|
218
|
+
value,
|
|
219
|
+
onChange,
|
|
220
|
+
placeholder,
|
|
221
|
+
disabled,
|
|
222
|
+
rows = 10,
|
|
223
|
+
description,
|
|
224
|
+
}: CodeEditorWithExpandProps) {
|
|
225
|
+
const [expanded, setExpanded] = useState(false);
|
|
226
|
+
|
|
227
|
+
return (
|
|
228
|
+
<div className="space-y-1">
|
|
229
|
+
<div className="flex justify-end">
|
|
230
|
+
<Button
|
|
231
|
+
variant="ghost"
|
|
232
|
+
size="sm"
|
|
233
|
+
className="h-6 text-xs gap-1"
|
|
234
|
+
onClick={() => setExpanded(true)}
|
|
235
|
+
type="button"
|
|
236
|
+
>
|
|
237
|
+
<Maximize2 className="h-3 w-3" />
|
|
238
|
+
Expand
|
|
239
|
+
</Button>
|
|
240
|
+
</div>
|
|
241
|
+
|
|
242
|
+
<CodeEditor
|
|
243
|
+
id={id}
|
|
244
|
+
value={value}
|
|
245
|
+
onChange={onChange}
|
|
246
|
+
placeholder={placeholder}
|
|
247
|
+
disabled={disabled}
|
|
248
|
+
rows={rows}
|
|
249
|
+
showFormatButton
|
|
250
|
+
/>
|
|
251
|
+
|
|
252
|
+
{description && (
|
|
253
|
+
<p className="text-[11px] text-muted-foreground leading-relaxed mt-1">{description}</p>
|
|
254
|
+
)}
|
|
255
|
+
|
|
256
|
+
<Dialog open={expanded} onOpenChange={setExpanded}>
|
|
257
|
+
<DialogContent className="max-w-4xl h-[80vh] flex flex-col">
|
|
258
|
+
<DialogHeader className="flex-row items-center justify-between pr-8">
|
|
259
|
+
<DialogTitle className="font-mono text-sm">
|
|
260
|
+
{label}
|
|
261
|
+
</DialogTitle>
|
|
262
|
+
<Button
|
|
263
|
+
variant="ghost"
|
|
264
|
+
size="sm"
|
|
265
|
+
className="h-6 text-xs gap-1"
|
|
266
|
+
onClick={() => setExpanded(false)}
|
|
267
|
+
type="button"
|
|
268
|
+
>
|
|
269
|
+
<Minimize2 className="h-3 w-3" />
|
|
270
|
+
Collapse
|
|
271
|
+
</Button>
|
|
272
|
+
</DialogHeader>
|
|
273
|
+
<div className="flex-1 min-h-0">
|
|
274
|
+
<CodeEditor
|
|
275
|
+
id={`${id}-expanded`}
|
|
276
|
+
value={value}
|
|
277
|
+
onChange={onChange}
|
|
278
|
+
placeholder={placeholder}
|
|
279
|
+
disabled={disabled}
|
|
280
|
+
rows={30}
|
|
281
|
+
className="h-full"
|
|
282
|
+
showFormatButton
|
|
283
|
+
/>
|
|
284
|
+
</div>
|
|
285
|
+
</DialogContent>
|
|
286
|
+
</Dialog>
|
|
287
|
+
</div>
|
|
288
|
+
);
|
|
289
|
+
}
|
|
@@ -2,6 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import { useCallback } from 'react';
|
|
3
3
|
import { Textarea } from '@vendure/dashboard';
|
|
4
4
|
import type { AdapterSchemaField } from '../../../../types';
|
|
5
|
+
import { CodeEditorWithExpand } from '../../CodeEditor';
|
|
5
6
|
|
|
6
7
|
export interface TextareaFieldProps {
|
|
7
8
|
field: AdapterSchemaField;
|
|
@@ -17,15 +18,29 @@ export function TextareaField({ field, value, onChange, compact, disabled, isCod
|
|
|
17
18
|
onChange(e.target.value);
|
|
18
19
|
}, [onChange]);
|
|
19
20
|
|
|
21
|
+
if (!isCode) {
|
|
22
|
+
return (
|
|
23
|
+
<Textarea
|
|
24
|
+
id={field.key}
|
|
25
|
+
value={value ?? field.default ?? ''}
|
|
26
|
+
onChange={handleChange}
|
|
27
|
+
placeholder={field.placeholder}
|
|
28
|
+
disabled={disabled}
|
|
29
|
+
rows={compact ? 2 : 5}
|
|
30
|
+
className={compact ? 'text-sm' : ''}
|
|
31
|
+
/>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
20
35
|
return (
|
|
21
|
-
<
|
|
36
|
+
<CodeEditorWithExpand
|
|
22
37
|
id={field.key}
|
|
38
|
+
label={field.label || field.key}
|
|
23
39
|
value={value ?? field.default ?? ''}
|
|
24
|
-
onChange={
|
|
40
|
+
onChange={onChange}
|
|
25
41
|
placeholder={field.placeholder}
|
|
26
42
|
disabled={disabled}
|
|
27
|
-
rows={compact ?
|
|
28
|
-
className={isCode ? 'font-mono text-sm' : (compact ? 'text-sm' : '')}
|
|
43
|
+
rows={compact ? 6 : 12}
|
|
29
44
|
/>
|
|
30
45
|
);
|
|
31
46
|
}
|
|
@@ -44,7 +44,7 @@ export function AdapterSelector({
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
return (
|
|
47
|
-
<Select value={value} onValueChange={onChange} disabled={disabled}>
|
|
47
|
+
<Select value={value ?? ''} onValueChange={onChange} disabled={disabled}>
|
|
48
48
|
<SelectTrigger className="w-full">
|
|
49
49
|
<SelectValue placeholder={placeholder}>
|
|
50
50
|
{selectedAdapter && (
|
|
@@ -92,7 +92,7 @@ export function AdapterSelector({
|
|
|
92
92
|
<div className="flex flex-col gap-0.5">
|
|
93
93
|
<span className="font-medium">{adapter.name}</span>
|
|
94
94
|
{adapter.description && (
|
|
95
|
-
<span className="text-xs text-muted-foreground line-clamp-
|
|
95
|
+
<span className="text-xs text-muted-foreground line-clamp-2">
|
|
96
96
|
{adapter.description}
|
|
97
97
|
</span>
|
|
98
98
|
)}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { Input, Label, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, Textarea } from '@vendure/dashboard';
|
|
3
3
|
import { FIELD_TYPE } from '../../../constants';
|
|
4
|
+
import { CodeEditorWithExpand } from '../CodeEditor';
|
|
4
5
|
|
|
5
6
|
export interface OperatorSchemaField {
|
|
6
7
|
key: string;
|
|
@@ -79,6 +80,24 @@ export function OperatorFieldInput({ field, value, onChange }: OperatorFieldInpu
|
|
|
79
80
|
);
|
|
80
81
|
}
|
|
81
82
|
|
|
83
|
+
// Code field type — full code editor with line numbers, Tab support, and expand dialog
|
|
84
|
+
if (field.type === FIELD_TYPE.CODE || field.type === FIELD_TYPE.EXPRESSION) {
|
|
85
|
+
return (
|
|
86
|
+
<div className="space-y-1.5">
|
|
87
|
+
<FieldLabel field={field} />
|
|
88
|
+
<CodeEditorWithExpand
|
|
89
|
+
id={`operator-${field.key}`}
|
|
90
|
+
label={field.label || field.key}
|
|
91
|
+
value={String(value ?? '')}
|
|
92
|
+
onChange={(v) => handleChange(v)}
|
|
93
|
+
placeholder={field.placeholder}
|
|
94
|
+
rows={10}
|
|
95
|
+
description={field.description}
|
|
96
|
+
/>
|
|
97
|
+
</div>
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
|
|
82
101
|
// JSON/Object/Array field type
|
|
83
102
|
if (isObject) {
|
|
84
103
|
return (
|
|
@@ -1,8 +1,19 @@
|
|
|
1
1
|
import React, { useCallback } from 'react';
|
|
2
|
-
import { Plus, Trash2, AlertTriangle } from 'lucide-react';
|
|
3
|
-
import {
|
|
2
|
+
import { Plus, Trash2, AlertTriangle, ChevronDown, ChevronRight } from 'lucide-react';
|
|
3
|
+
import {
|
|
4
|
+
Button,
|
|
5
|
+
Input,
|
|
6
|
+
Label,
|
|
7
|
+
Select,
|
|
8
|
+
SelectContent,
|
|
9
|
+
SelectItem,
|
|
10
|
+
SelectTrigger,
|
|
11
|
+
SelectValue,
|
|
12
|
+
} from '@vendure/dashboard';
|
|
4
13
|
import { ROUTE_BRANCH_DEFAULTS, ERROR_MESSAGES } from '../../../constants';
|
|
5
14
|
import { useStableKeys } from '../../../hooks';
|
|
15
|
+
import { useComparisonOperators } from '../../../hooks/api/use-config-options';
|
|
16
|
+
import type { ComparisonOperatorOption } from '../../../hooks/api/use-config-options';
|
|
6
17
|
|
|
7
18
|
export interface RouteConfigComponentProps {
|
|
8
19
|
readonly config: Record<string, unknown>;
|
|
@@ -10,9 +21,15 @@ export interface RouteConfigComponentProps {
|
|
|
10
21
|
readonly showDuplicateWarning?: boolean;
|
|
11
22
|
}
|
|
12
23
|
|
|
24
|
+
interface BranchCondition {
|
|
25
|
+
field: string;
|
|
26
|
+
cmp: string;
|
|
27
|
+
value?: unknown;
|
|
28
|
+
}
|
|
29
|
+
|
|
13
30
|
interface Branch {
|
|
14
31
|
name: string;
|
|
15
|
-
|
|
32
|
+
when?: BranchCondition[];
|
|
16
33
|
}
|
|
17
34
|
|
|
18
35
|
export function RouteConfigComponent({
|
|
@@ -22,6 +39,7 @@ export function RouteConfigComponent({
|
|
|
22
39
|
}: RouteConfigComponentProps) {
|
|
23
40
|
const branches = (config.branches as Branch[]) ?? [];
|
|
24
41
|
const branchKeys = useStableKeys(branches, 'branch');
|
|
42
|
+
const { operators: comparisonOperators } = useComparisonOperators();
|
|
25
43
|
|
|
26
44
|
const getDuplicateBranches = React.useCallback((branchList: Branch[]) => {
|
|
27
45
|
const names = branchList.map((b) => b.name.trim().toLowerCase());
|
|
@@ -50,11 +68,11 @@ export function RouteConfigComponent({
|
|
|
50
68
|
|
|
51
69
|
onChange({
|
|
52
70
|
...config,
|
|
53
|
-
branches: [...branches, { name: newName,
|
|
71
|
+
branches: [...branches, { name: newName, when: [] }],
|
|
54
72
|
});
|
|
55
73
|
}, [branches, config, onChange]);
|
|
56
74
|
|
|
57
|
-
const updateBranch = useCallback((index: number, patch:
|
|
75
|
+
const updateBranch = useCallback((index: number, patch: Partial<Branch>) => {
|
|
58
76
|
const newBranches = [...branches];
|
|
59
77
|
newBranches[index] = { ...newBranches[index], ...patch };
|
|
60
78
|
onChange({ ...config, branches: newBranches });
|
|
@@ -78,41 +96,28 @@ export function RouteConfigComponent({
|
|
|
78
96
|
</Button>
|
|
79
97
|
</div>
|
|
80
98
|
|
|
81
|
-
|
|
99
|
+
{showDuplicateWarning && hasDuplicates && (
|
|
82
100
|
<div className="p-3 bg-amber-50 dark:bg-amber-950/30 border border-amber-200 dark:border-amber-800 rounded-md">
|
|
83
101
|
<div className="flex items-center gap-2 text-amber-800 dark:text-amber-400">
|
|
84
102
|
<AlertTriangle className="h-4 w-4" />
|
|
85
103
|
<span className="text-sm font-medium">Duplicate branch names detected</span>
|
|
86
104
|
</div>
|
|
87
|
-
<p className="text-xs text-amber-700 mt-1">
|
|
105
|
+
<p className="text-xs text-amber-700 dark:text-amber-500 mt-1">
|
|
88
106
|
{ERROR_MESSAGES.DUPLICATE_BRANCH_NAMES}. Duplicate: {Array.from(duplicates).join(', ')}
|
|
89
107
|
</p>
|
|
90
108
|
</div>
|
|
91
109
|
)}
|
|
92
110
|
|
|
93
111
|
{branches.map((branch, i) => (
|
|
94
|
-
<
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
<p className="text-xs text-destructive mt-1">{ERROR_MESSAGES.BRANCH_NAME_EMPTY}</p>
|
|
104
|
-
)}
|
|
105
|
-
</div>
|
|
106
|
-
<Button
|
|
107
|
-
variant="ghost"
|
|
108
|
-
size="sm"
|
|
109
|
-
onClick={() => removeBranch(i)}
|
|
110
|
-
className="text-destructive"
|
|
111
|
-
aria-label={`Remove branch ${branch.name || i + 1}`}
|
|
112
|
-
>
|
|
113
|
-
<Trash2 className="h-4 w-4" />
|
|
114
|
-
</Button>
|
|
115
|
-
</div>
|
|
112
|
+
<BranchEditor
|
|
113
|
+
key={branchKeys[i]}
|
|
114
|
+
branch={branch}
|
|
115
|
+
isDuplicate={isBranchDuplicate(branch.name)}
|
|
116
|
+
comparisonOperators={comparisonOperators}
|
|
117
|
+
onUpdate={(patch) => updateBranch(i, patch)}
|
|
118
|
+
onRemove={() => removeBranch(i)}
|
|
119
|
+
index={i}
|
|
120
|
+
/>
|
|
116
121
|
))}
|
|
117
122
|
|
|
118
123
|
{branches.length === 0 && (
|
|
@@ -123,3 +128,187 @@ export function RouteConfigComponent({
|
|
|
123
128
|
</div>
|
|
124
129
|
);
|
|
125
130
|
}
|
|
131
|
+
|
|
132
|
+
interface BranchEditorProps {
|
|
133
|
+
branch: Branch;
|
|
134
|
+
isDuplicate: boolean;
|
|
135
|
+
comparisonOperators: ComparisonOperatorOption[];
|
|
136
|
+
onUpdate: (patch: Partial<Branch>) => void;
|
|
137
|
+
onRemove: () => void;
|
|
138
|
+
index: number;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function BranchEditor({
|
|
142
|
+
branch,
|
|
143
|
+
isDuplicate,
|
|
144
|
+
comparisonOperators,
|
|
145
|
+
onUpdate,
|
|
146
|
+
onRemove,
|
|
147
|
+
index,
|
|
148
|
+
}: BranchEditorProps) {
|
|
149
|
+
const conditions = branch.when ?? [];
|
|
150
|
+
const [expanded, setExpanded] = React.useState(conditions.length > 0);
|
|
151
|
+
|
|
152
|
+
const addCondition = useCallback(() => {
|
|
153
|
+
const newConditions: BranchCondition[] = [...conditions, { field: '', cmp: 'eq', value: '' }];
|
|
154
|
+
onUpdate({ when: newConditions });
|
|
155
|
+
setExpanded(true);
|
|
156
|
+
}, [conditions, onUpdate]);
|
|
157
|
+
|
|
158
|
+
const updateCondition = useCallback((condIndex: number, patch: Partial<BranchCondition>) => {
|
|
159
|
+
const newConditions = [...conditions];
|
|
160
|
+
newConditions[condIndex] = { ...newConditions[condIndex], ...patch };
|
|
161
|
+
onUpdate({ when: newConditions });
|
|
162
|
+
}, [conditions, onUpdate]);
|
|
163
|
+
|
|
164
|
+
const removeCondition = useCallback((condIndex: number) => {
|
|
165
|
+
onUpdate({ when: conditions.filter((_, i) => i !== condIndex) });
|
|
166
|
+
}, [conditions, onUpdate]);
|
|
167
|
+
|
|
168
|
+
return (
|
|
169
|
+
<div className="border rounded-md overflow-hidden">
|
|
170
|
+
{/* Branch header: name + delete */}
|
|
171
|
+
<div className="flex items-center gap-2 p-2 bg-muted/30">
|
|
172
|
+
<button
|
|
173
|
+
type="button"
|
|
174
|
+
className="flex items-center text-muted-foreground hover:text-foreground transition-colors"
|
|
175
|
+
onClick={() => setExpanded(!expanded)}
|
|
176
|
+
aria-label={expanded ? 'Collapse conditions' : 'Expand conditions'}
|
|
177
|
+
>
|
|
178
|
+
{expanded ? <ChevronDown className="h-3.5 w-3.5" /> : <ChevronRight className="h-3.5 w-3.5" />}
|
|
179
|
+
</button>
|
|
180
|
+
<div className="flex-1">
|
|
181
|
+
<Input
|
|
182
|
+
value={branch.name}
|
|
183
|
+
onChange={(e) => onUpdate({ name: e.target.value })}
|
|
184
|
+
placeholder="Branch name"
|
|
185
|
+
className={`h-8 ${isDuplicate ? 'border-amber-300 focus:border-amber-500' : ''}`}
|
|
186
|
+
/>
|
|
187
|
+
{!branch.name.trim() && (
|
|
188
|
+
<p className="text-xs text-destructive mt-1">{ERROR_MESSAGES.BRANCH_NAME_EMPTY}</p>
|
|
189
|
+
)}
|
|
190
|
+
</div>
|
|
191
|
+
<span className="text-xs text-muted-foreground tabular-nums whitespace-nowrap">
|
|
192
|
+
{conditions.length === 0 ? 'catch-all' : `${conditions.length} rule${conditions.length !== 1 ? 's' : ''}`}
|
|
193
|
+
</span>
|
|
194
|
+
<Button
|
|
195
|
+
variant="ghost"
|
|
196
|
+
size="sm"
|
|
197
|
+
onClick={onRemove}
|
|
198
|
+
className="text-destructive h-8 w-8 p-0"
|
|
199
|
+
aria-label={`Remove branch ${branch.name || index + 1}`}
|
|
200
|
+
>
|
|
201
|
+
<Trash2 className="h-4 w-4" />
|
|
202
|
+
</Button>
|
|
203
|
+
</div>
|
|
204
|
+
|
|
205
|
+
{/* Conditions section */}
|
|
206
|
+
{expanded && (
|
|
207
|
+
<div className="p-2 space-y-2 border-t">
|
|
208
|
+
{conditions.length === 0 ? (
|
|
209
|
+
<p className="text-xs text-muted-foreground italic py-1">
|
|
210
|
+
All records (catch-all) -- add conditions to filter records into this branch
|
|
211
|
+
</p>
|
|
212
|
+
) : (
|
|
213
|
+
<>
|
|
214
|
+
<p className="text-xs text-muted-foreground font-medium">
|
|
215
|
+
Conditions (all must match):
|
|
216
|
+
</p>
|
|
217
|
+
{conditions.map((cond, ci) => (
|
|
218
|
+
<ConditionRow
|
|
219
|
+
key={ci}
|
|
220
|
+
condition={cond}
|
|
221
|
+
comparisonOperators={comparisonOperators}
|
|
222
|
+
onUpdate={(patch) => updateCondition(ci, patch)}
|
|
223
|
+
onRemove={() => removeCondition(ci)}
|
|
224
|
+
/>
|
|
225
|
+
))}
|
|
226
|
+
</>
|
|
227
|
+
)}
|
|
228
|
+
<Button variant="outline" size="sm" className="h-7 text-xs" onClick={addCondition}>
|
|
229
|
+
<Plus className="h-3 w-3 mr-1" />
|
|
230
|
+
Add Condition
|
|
231
|
+
</Button>
|
|
232
|
+
</div>
|
|
233
|
+
)}
|
|
234
|
+
</div>
|
|
235
|
+
);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
interface ConditionRowProps {
|
|
239
|
+
condition: BranchCondition;
|
|
240
|
+
comparisonOperators: ComparisonOperatorOption[];
|
|
241
|
+
onUpdate: (patch: Partial<BranchCondition>) => void;
|
|
242
|
+
onRemove: () => void;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
function ConditionRow({ condition, comparisonOperators, onUpdate, onRemove }: ConditionRowProps) {
|
|
246
|
+
const operatorDef = comparisonOperators.find((op) => op.value === condition.cmp);
|
|
247
|
+
const showValueInput = !operatorDef?.noValue;
|
|
248
|
+
|
|
249
|
+
return (
|
|
250
|
+
<div className="flex items-center gap-1.5">
|
|
251
|
+
{/* Field path */}
|
|
252
|
+
<Input
|
|
253
|
+
value={condition.field}
|
|
254
|
+
onChange={(e) => onUpdate({ field: e.target.value })}
|
|
255
|
+
placeholder="field.path"
|
|
256
|
+
className="flex-1 h-7 text-xs font-mono"
|
|
257
|
+
/>
|
|
258
|
+
|
|
259
|
+
{/* Comparison operator */}
|
|
260
|
+
<Select value={condition.cmp} onValueChange={(v) => onUpdate({ cmp: v })}>
|
|
261
|
+
<SelectTrigger className="w-[120px] h-7 text-xs">
|
|
262
|
+
<SelectValue />
|
|
263
|
+
</SelectTrigger>
|
|
264
|
+
<SelectContent>
|
|
265
|
+
{comparisonOperators.map((op) => (
|
|
266
|
+
<SelectItem key={op.value} value={op.value}>
|
|
267
|
+
{op.label}
|
|
268
|
+
</SelectItem>
|
|
269
|
+
))}
|
|
270
|
+
</SelectContent>
|
|
271
|
+
</Select>
|
|
272
|
+
|
|
273
|
+
{/* Value */}
|
|
274
|
+
{showValueInput && (
|
|
275
|
+
<Input
|
|
276
|
+
value={formatConditionValue(condition.value)}
|
|
277
|
+
onChange={(e) => onUpdate({ value: parseConditionValue(e.target.value) })}
|
|
278
|
+
placeholder="value"
|
|
279
|
+
className="flex-1 h-7 text-xs"
|
|
280
|
+
/>
|
|
281
|
+
)}
|
|
282
|
+
|
|
283
|
+
{/* Remove */}
|
|
284
|
+
<Button
|
|
285
|
+
variant="ghost"
|
|
286
|
+
size="sm"
|
|
287
|
+
className="h-7 w-7 p-0 shrink-0"
|
|
288
|
+
onClick={onRemove}
|
|
289
|
+
aria-label="Remove condition"
|
|
290
|
+
>
|
|
291
|
+
<Trash2 className="h-3 w-3 text-destructive" />
|
|
292
|
+
</Button>
|
|
293
|
+
</div>
|
|
294
|
+
);
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
function formatConditionValue(value: unknown): string {
|
|
298
|
+
if (value === null) return 'null';
|
|
299
|
+
if (value === undefined) return '';
|
|
300
|
+
if (typeof value === 'boolean') return String(value);
|
|
301
|
+
if (typeof value === 'number') return String(value);
|
|
302
|
+
return String(value);
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
function parseConditionValue(raw: string): unknown {
|
|
306
|
+
const trimmed = raw.trim();
|
|
307
|
+
if (trimmed === 'null') return null;
|
|
308
|
+
if (trimmed === 'true') return true;
|
|
309
|
+
if (trimmed === 'false') return false;
|
|
310
|
+
if (trimmed !== '' && !isNaN(Number(trimmed)) && trimmed === String(Number(trimmed))) {
|
|
311
|
+
return Number(trimmed);
|
|
312
|
+
}
|
|
313
|
+
return raw;
|
|
314
|
+
}
|