@dainamite/cpq 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +70 -0
- package/LICENSE +21 -0
- package/MIGRATION.md +236 -0
- package/README.md +108 -0
- package/dist/modules/cpq/acl.js +30 -0
- package/dist/modules/cpq/acl.js.map +7 -0
- package/dist/modules/cpq/api/_helpers/handleArcError.js +37 -0
- package/dist/modules/cpq/api/_helpers/handleArcError.js.map +7 -0
- package/dist/modules/cpq/api/attribute-options/route.js +47 -0
- package/dist/modules/cpq/api/attribute-options/route.js.map +7 -0
- package/dist/modules/cpq/api/bundle-slots/route.js +101 -0
- package/dist/modules/cpq/api/bundle-slots/route.js.map +7 -0
- package/dist/modules/cpq/api/bundle-tree/route.js +28 -0
- package/dist/modules/cpq/api/bundle-tree/route.js.map +7 -0
- package/dist/modules/cpq/api/context.js +29 -0
- package/dist/modules/cpq/api/context.js.map +7 -0
- package/dist/modules/cpq/api/inventory/assets/route.js +113 -0
- package/dist/modules/cpq/api/inventory/assets/route.js.map +7 -0
- package/dist/modules/cpq/api/inventory/assets/status/route.js +35 -0
- package/dist/modules/cpq/api/inventory/assets/status/route.js.map +7 -0
- package/dist/modules/cpq/api/inventory/customer/[customerId]/parent-items/route.js +30 -0
- package/dist/modules/cpq/api/inventory/customer/[customerId]/parent-items/route.js.map +7 -0
- package/dist/modules/cpq/api/inventory/customer/[customerId]/route.js +31 -0
- package/dist/modules/cpq/api/inventory/customer/[customerId]/route.js.map +7 -0
- package/dist/modules/cpq/api/inventory/subscription-items/route.js +99 -0
- package/dist/modules/cpq/api/inventory/subscription-items/route.js.map +7 -0
- package/dist/modules/cpq/api/inventory/subscriptions/[subscriptionId]/change-log/route.js +57 -0
- package/dist/modules/cpq/api/inventory/subscriptions/[subscriptionId]/change-log/route.js.map +7 -0
- package/dist/modules/cpq/api/inventory/subscriptions/expiring/route.js +62 -0
- package/dist/modules/cpq/api/inventory/subscriptions/expiring/route.js.map +7 -0
- package/dist/modules/cpq/api/inventory/subscriptions/route.js +116 -0
- package/dist/modules/cpq/api/inventory/subscriptions/route.js.map +7 -0
- package/dist/modules/cpq/api/inventory/subscriptions/status/route.js +35 -0
- package/dist/modules/cpq/api/inventory/subscriptions/status/route.js.map +7 -0
- package/dist/modules/cpq/api/offering-components/route.js +91 -0
- package/dist/modules/cpq/api/offering-components/route.js.map +7 -0
- package/dist/modules/cpq/api/orders/[orderId]/activate/route.js +39 -0
- package/dist/modules/cpq/api/orders/[orderId]/activate/route.js.map +7 -0
- package/dist/modules/cpq/api/orders/[orderId]/route.js +28 -0
- package/dist/modules/cpq/api/orders/[orderId]/route.js.map +7 -0
- package/dist/modules/cpq/api/orders/[orderId]/status/route.js +38 -0
- package/dist/modules/cpq/api/orders/[orderId]/status/route.js.map +7 -0
- package/dist/modules/cpq/api/orders/route.js +71 -0
- package/dist/modules/cpq/api/orders/route.js.map +7 -0
- package/dist/modules/cpq/api/price-rules/route.js +180 -0
- package/dist/modules/cpq/api/price-rules/route.js.map +7 -0
- package/dist/modules/cpq/api/pricing-table-entries/route.js +142 -0
- package/dist/modules/cpq/api/pricing-table-entries/route.js.map +7 -0
- package/dist/modules/cpq/api/pricing-tables/route.js +179 -0
- package/dist/modules/cpq/api/pricing-tables/route.js.map +7 -0
- package/dist/modules/cpq/api/product-attributes/route.js +160 -0
- package/dist/modules/cpq/api/product-attributes/route.js.map +7 -0
- package/dist/modules/cpq/api/product-charges/route.js +166 -0
- package/dist/modules/cpq/api/product-charges/route.js.map +7 -0
- package/dist/modules/cpq/api/product-offerings/route.js +294 -0
- package/dist/modules/cpq/api/product-offerings/route.js.map +7 -0
- package/dist/modules/cpq/api/product-relationships/route.js +144 -0
- package/dist/modules/cpq/api/product-relationships/route.js.map +7 -0
- package/dist/modules/cpq/api/product-specifications/route.js +292 -0
- package/dist/modules/cpq/api/product-specifications/route.js.map +7 -0
- package/dist/modules/cpq/api/quotes/[quoteId]/cancel-meta/route.js +71 -0
- package/dist/modules/cpq/api/quotes/[quoteId]/cancel-meta/route.js.map +7 -0
- package/dist/modules/cpq/api/quotes/[quoteId]/clone/route.js +29 -0
- package/dist/modules/cpq/api/quotes/[quoteId]/clone/route.js.map +7 -0
- package/dist/modules/cpq/api/quotes/[quoteId]/items/[lineId]/route.js +54 -0
- package/dist/modules/cpq/api/quotes/[quoteId]/items/[lineId]/route.js.map +7 -0
- package/dist/modules/cpq/api/quotes/[quoteId]/items/route.js +27 -0
- package/dist/modules/cpq/api/quotes/[quoteId]/items/route.js.map +7 -0
- package/dist/modules/cpq/api/quotes/[quoteId]/merge-meta/route.js +72 -0
- package/dist/modules/cpq/api/quotes/[quoteId]/merge-meta/route.js.map +7 -0
- package/dist/modules/cpq/api/quotes/[quoteId]/recalculate/route.js +35 -0
- package/dist/modules/cpq/api/quotes/[quoteId]/recalculate/route.js.map +7 -0
- package/dist/modules/cpq/api/quotes/[quoteId]/route.js +102 -0
- package/dist/modules/cpq/api/quotes/[quoteId]/route.js.map +7 -0
- package/dist/modules/cpq/api/quotes/[quoteId]/status/route.js +27 -0
- package/dist/modules/cpq/api/quotes/[quoteId]/status/route.js.map +7 -0
- package/dist/modules/cpq/api/quotes/[quoteId]/target-subscriptions/[targetId]/route.js +79 -0
- package/dist/modules/cpq/api/quotes/[quoteId]/target-subscriptions/[targetId]/route.js.map +7 -0
- package/dist/modules/cpq/api/quotes/[quoteId]/target-subscriptions/route.js +95 -0
- package/dist/modules/cpq/api/quotes/[quoteId]/target-subscriptions/route.js.map +7 -0
- package/dist/modules/cpq/api/quotes/attributes/route.js +52 -0
- package/dist/modules/cpq/api/quotes/attributes/route.js.map +7 -0
- package/dist/modules/cpq/api/quotes/from-subscription/route.js +72 -0
- package/dist/modules/cpq/api/quotes/from-subscription/route.js.map +7 -0
- package/dist/modules/cpq/api/quotes/price/route.js +69 -0
- package/dist/modules/cpq/api/quotes/price/route.js.map +7 -0
- package/dist/modules/cpq/api/quotes/route.js +97 -0
- package/dist/modules/cpq/api/quotes/route.js.map +7 -0
- package/dist/modules/cpq/api/quotes/validate-relationships/route.js +86 -0
- package/dist/modules/cpq/api/quotes/validate-relationships/route.js.map +7 -0
- package/dist/modules/cpq/api/resolveQuotingService.js +7 -0
- package/dist/modules/cpq/api/resolveQuotingService.js.map +7 -0
- package/dist/modules/cpq/api/wizards/resolve/route.js +38 -0
- package/dist/modules/cpq/api/wizards/resolve/route.js.map +7 -0
- package/dist/modules/cpq/api/wizards/route.js +111 -0
- package/dist/modules/cpq/api/wizards/route.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/inventory/AssetsTable.js +136 -0
- package/dist/modules/cpq/backend/cpq/inventory/AssetsTable.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/inventory/SubscriptionsTable.js +185 -0
- package/dist/modules/cpq/backend/cpq/inventory/SubscriptionsTable.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/inventory/assets/[id]/page.js +343 -0
- package/dist/modules/cpq/backend/cpq/inventory/assets/[id]/page.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/inventory/assets/[id]/page.meta.js +13 -0
- package/dist/modules/cpq/backend/cpq/inventory/assets/[id]/page.meta.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/inventory/page.js +35 -0
- package/dist/modules/cpq/backend/cpq/inventory/page.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/inventory/page.meta.js +18 -0
- package/dist/modules/cpq/backend/cpq/inventory/page.meta.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/inventory/shared.js +20 -0
- package/dist/modules/cpq/backend/cpq/inventory/shared.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/inventory/subscriptions/[id]/page.js +794 -0
- package/dist/modules/cpq/backend/cpq/inventory/subscriptions/[id]/page.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/inventory/subscriptions/[id]/page.meta.js +13 -0
- package/dist/modules/cpq/backend/cpq/inventory/subscriptions/[id]/page.meta.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/offerings/[id]/page.js +917 -0
- package/dist/modules/cpq/backend/cpq/offerings/[id]/page.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/offerings/page.js +405 -0
- package/dist/modules/cpq/backend/cpq/offerings/page.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/offerings/page.meta.js +18 -0
- package/dist/modules/cpq/backend/cpq/offerings/page.meta.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/orders/[id]/page.js +677 -0
- package/dist/modules/cpq/backend/cpq/orders/[id]/page.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/orders/page.js +134 -0
- package/dist/modules/cpq/backend/cpq/orders/page.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/orders/page.meta.js +18 -0
- package/dist/modules/cpq/backend/cpq/orders/page.meta.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/price-rules/PriceRuleForm.js +272 -0
- package/dist/modules/cpq/backend/cpq/price-rules/PriceRuleForm.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/price-rules/[id]/page.js +407 -0
- package/dist/modules/cpq/backend/cpq/price-rules/[id]/page.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/price-rules/[id]/page.meta.js +13 -0
- package/dist/modules/cpq/backend/cpq/price-rules/[id]/page.meta.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/price-rules/page.js +211 -0
- package/dist/modules/cpq/backend/cpq/price-rules/page.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/price-rules/page.meta.js +18 -0
- package/dist/modules/cpq/backend/cpq/price-rules/page.meta.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/pricing/[id]/EntriesEditor.js +275 -0
- package/dist/modules/cpq/backend/cpq/pricing/[id]/EntriesEditor.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/pricing/[id]/ImportPreview.js +112 -0
- package/dist/modules/cpq/backend/cpq/pricing/[id]/ImportPreview.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/pricing/[id]/page.js +492 -0
- package/dist/modules/cpq/backend/cpq/pricing/[id]/page.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/pricing/[id]/xlsxExport.js +50 -0
- package/dist/modules/cpq/backend/cpq/pricing/[id]/xlsxExport.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/pricing/[id]/xlsxImport.js +249 -0
- package/dist/modules/cpq/backend/cpq/pricing/[id]/xlsxImport.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/pricing/page.js +87 -0
- package/dist/modules/cpq/backend/cpq/pricing/page.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/pricing/page.meta.js +18 -0
- package/dist/modules/cpq/backend/cpq/pricing/page.meta.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/quotes/[id]/_components/ArcQuoteConfigurator.js +652 -0
- package/dist/modules/cpq/backend/cpq/quotes/[id]/_components/ArcQuoteConfigurator.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/quotes/[id]/page.js +1289 -0
- package/dist/modules/cpq/backend/cpq/quotes/[id]/page.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/quotes/page.js +283 -0
- package/dist/modules/cpq/backend/cpq/quotes/page.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/quotes/page.meta.js +18 -0
- package/dist/modules/cpq/backend/cpq/quotes/page.meta.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/specifications/[id]/DependsOnRulesEditor.js +214 -0
- package/dist/modules/cpq/backend/cpq/specifications/[id]/DependsOnRulesEditor.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/specifications/[id]/page.js +1399 -0
- package/dist/modules/cpq/backend/cpq/specifications/[id]/page.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/specifications/page.js +148 -0
- package/dist/modules/cpq/backend/cpq/specifications/page.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/specifications/page.meta.js +18 -0
- package/dist/modules/cpq/backend/cpq/specifications/page.meta.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/wizards/[definitionCode]/detail/page.js +204 -0
- package/dist/modules/cpq/backend/cpq/wizards/[definitionCode]/detail/page.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/wizards/[definitionCode]/page.js +191 -0
- package/dist/modules/cpq/backend/cpq/wizards/[definitionCode]/page.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/wizards/page.js +119 -0
- package/dist/modules/cpq/backend/cpq/wizards/page.js.map +7 -0
- package/dist/modules/cpq/backend/cpq/wizards/page.meta.js +18 -0
- package/dist/modules/cpq/backend/cpq/wizards/page.meta.js.map +7 -0
- package/dist/modules/cpq/ce.js +151 -0
- package/dist/modules/cpq/ce.js.map +7 -0
- package/dist/modules/cpq/cli.js +11 -0
- package/dist/modules/cpq/cli.js.map +7 -0
- package/dist/modules/cpq/components/CpqListView.js +265 -0
- package/dist/modules/cpq/components/CpqListView.js.map +7 -0
- package/dist/modules/cpq/components/NumberInput.js +95 -0
- package/dist/modules/cpq/components/NumberInput.js.map +7 -0
- package/dist/modules/cpq/components/StatusPath.js +60 -0
- package/dist/modules/cpq/components/StatusPath.js.map +7 -0
- package/dist/modules/cpq/components/statusMaps.js +66 -0
- package/dist/modules/cpq/components/statusMaps.js.map +7 -0
- package/dist/modules/cpq/components/useCpqRowActions.js +125 -0
- package/dist/modules/cpq/components/useCpqRowActions.js.map +7 -0
- package/dist/modules/cpq/data/entities.js +1556 -0
- package/dist/modules/cpq/data/entities.js.map +7 -0
- package/dist/modules/cpq/data/validators.js +575 -0
- package/dist/modules/cpq/data/validators.js.map +7 -0
- package/dist/modules/cpq/di.js +57 -0
- package/dist/modules/cpq/di.js.map +7 -0
- package/dist/modules/cpq/events.js +50 -0
- package/dist/modules/cpq/events.js.map +7 -0
- package/dist/modules/cpq/index.js +16 -0
- package/dist/modules/cpq/index.js.map +7 -0
- package/dist/modules/cpq/lib/seeds/api.js +32 -0
- package/dist/modules/cpq/lib/seeds/api.js.map +7 -0
- package/dist/modules/cpq/lib/seeds/tenant-provisioning.js +158 -0
- package/dist/modules/cpq/lib/seeds/tenant-provisioning.js.map +7 -0
- package/dist/modules/cpq/lib/seeds.js +6 -0
- package/dist/modules/cpq/lib/seeds.js.map +7 -0
- package/dist/modules/cpq/migrations/Migration20260220220000_cpq.js +40 -0
- package/dist/modules/cpq/migrations/Migration20260220220000_cpq.js.map +7 -0
- package/dist/modules/cpq/migrations/Migration20260330000000_cpq_product_domain.js +54 -0
- package/dist/modules/cpq/migrations/Migration20260330000000_cpq_product_domain.js.map +7 -0
- package/dist/modules/cpq/migrations/Migration20260331000000_cpq_charge_unique_per_offering.js +15 -0
- package/dist/modules/cpq/migrations/Migration20260331000000_cpq_charge_unique_per_offering.js.map +7 -0
- package/dist/modules/cpq/migrations/Migration20260401000000_cpq_quoting_v2.js +62 -0
- package/dist/modules/cpq/migrations/Migration20260401000000_cpq_quoting_v2.js.map +7 -0
- package/dist/modules/cpq/migrations/Migration20260402000000_cpq_workflows.js +56 -0
- package/dist/modules/cpq/migrations/Migration20260402000000_cpq_workflows.js.map +7 -0
- package/dist/modules/cpq/migrations/Migration20260407000000_cpq_pricing_tables_v2.js +26 -0
- package/dist/modules/cpq/migrations/Migration20260407000000_cpq_pricing_tables_v2.js.map +7 -0
- package/dist/modules/cpq/migrations/Migration20260407100000_cpq_price_rules.js +37 -0
- package/dist/modules/cpq/migrations/Migration20260407100000_cpq_price_rules.js.map +7 -0
- package/dist/modules/cpq/migrations/Migration20260408000000_cpq_price_rules.js +35 -0
- package/dist/modules/cpq/migrations/Migration20260408000000_cpq_price_rules.js.map +7 -0
- package/dist/modules/cpq/migrations/Migration20260410000000_cpq_drop_datacentres_inventory.js +21 -0
- package/dist/modules/cpq/migrations/Migration20260410000000_cpq_drop_datacentres_inventory.js.map +7 -0
- package/dist/modules/cpq/migrations/Migration20260410000000_cpq_wizard_rename.js +46 -0
- package/dist/modules/cpq/migrations/Migration20260410000000_cpq_wizard_rename.js.map +7 -0
- package/dist/modules/cpq/migrations/Migration20260410100000_cpq_inventory.js +118 -0
- package/dist/modules/cpq/migrations/Migration20260410100000_cpq_inventory.js.map +7 -0
- package/dist/modules/cpq/migrations/Migration20260411000000_cpq_orders.js +63 -0
- package/dist/modules/cpq/migrations/Migration20260411000000_cpq_orders.js.map +7 -0
- package/dist/modules/cpq/migrations/Migration20260412000000_cpq_bundled_offerings.js +28 -0
- package/dist/modules/cpq/migrations/Migration20260412000000_cpq_bundled_offerings.js.map +7 -0
- package/dist/modules/cpq/migrations/Migration20260504064621_cpq_arc.js +36 -0
- package/dist/modules/cpq/migrations/Migration20260504064621_cpq_arc.js.map +7 -0
- package/dist/modules/cpq/migrations/Migration20260514000000_cpq_spec_merge_retired_deprecated.js +14 -0
- package/dist/modules/cpq/migrations/Migration20260514000000_cpq_spec_merge_retired_deprecated.js.map +7 -0
- package/dist/modules/cpq/migrations/Migration20260514100000_cpq_offering_merge_retired_deprecated.js +14 -0
- package/dist/modules/cpq/migrations/Migration20260514100000_cpq_offering_merge_retired_deprecated.js.map +7 -0
- package/dist/modules/cpq/migrations/Migration20260514110000_cpq_list_search_indexes.js +58 -0
- package/dist/modules/cpq/migrations/Migration20260514110000_cpq_list_search_indexes.js.map +7 -0
- package/dist/modules/cpq/migrations/Migration20260515000000_cpq_inventory_subscriptions_search_indexes.js +29 -0
- package/dist/modules/cpq/migrations/Migration20260515000000_cpq_inventory_subscriptions_search_indexes.js.map +7 -0
- package/dist/modules/cpq/services/cpqBundleService.js +447 -0
- package/dist/modules/cpq/services/cpqBundleService.js.map +7 -0
- package/dist/modules/cpq/services/cpqInventoryService.js +1371 -0
- package/dist/modules/cpq/services/cpqInventoryService.js.map +7 -0
- package/dist/modules/cpq/services/cpqOrderService.js +901 -0
- package/dist/modules/cpq/services/cpqOrderService.js.map +7 -0
- package/dist/modules/cpq/services/cpqPricingService.js +289 -0
- package/dist/modules/cpq/services/cpqPricingService.js.map +7 -0
- package/dist/modules/cpq/services/cpqProductService.js +204 -0
- package/dist/modules/cpq/services/cpqProductService.js.map +7 -0
- package/dist/modules/cpq/services/cpqQuotingService.js +1867 -0
- package/dist/modules/cpq/services/cpqQuotingService.js.map +7 -0
- package/dist/modules/cpq/services/cpqValidationService.js +234 -0
- package/dist/modules/cpq/services/cpqValidationService.js.map +7 -0
- package/dist/modules/cpq/services/cpqWizardService.js +137 -0
- package/dist/modules/cpq/services/cpqWizardService.js.map +7 -0
- package/dist/modules/cpq/services/types.js +114 -0
- package/dist/modules/cpq/services/types.js.map +7 -0
- package/dist/modules/cpq/setup.js +49 -0
- package/dist/modules/cpq/setup.js.map +7 -0
- package/dist/modules/cpq/subscribers/subscription-amended-log.js +18 -0
- package/dist/modules/cpq/subscribers/subscription-amended-log.js.map +7 -0
- package/dist/modules/cpq/subscribers/subscription-cancelled-log.js +19 -0
- package/dist/modules/cpq/subscribers/subscription-cancelled-log.js.map +7 -0
- package/dist/modules/cpq/subscribers/subscription-merged-log.js +20 -0
- package/dist/modules/cpq/subscribers/subscription-merged-log.js.map +7 -0
- package/dist/modules/cpq/subscribers/subscription-renewed-log.js +18 -0
- package/dist/modules/cpq/subscribers/subscription-renewed-log.js.map +7 -0
- package/dist/modules/cpq/subscribers/subscription-superseded-log.js +18 -0
- package/dist/modules/cpq/subscribers/subscription-superseded-log.js.map +7 -0
- package/dist/modules/cpq/widgets/injection/customer-inventory/widget.client.js +192 -0
- package/dist/modules/cpq/widgets/injection/customer-inventory/widget.client.js.map +7 -0
- package/dist/modules/cpq/widgets/injection/customer-inventory/widget.js +17 -0
- package/dist/modules/cpq/widgets/injection/customer-inventory/widget.js.map +7 -0
- package/dist/modules/cpq/widgets/injection/order-cpq-tab/widget.client.js +79 -0
- package/dist/modules/cpq/widgets/injection/order-cpq-tab/widget.client.js.map +7 -0
- package/dist/modules/cpq/widgets/injection/order-cpq-tab/widget.js +17 -0
- package/dist/modules/cpq/widgets/injection/order-cpq-tab/widget.js.map +7 -0
- package/dist/modules/cpq/widgets/injection/quote-configurator/widget.client.js +181 -0
- package/dist/modules/cpq/widgets/injection/quote-configurator/widget.client.js.map +7 -0
- package/dist/modules/cpq/widgets/injection/quote-configurator/widget.js +17 -0
- package/dist/modules/cpq/widgets/injection/quote-configurator/widget.js.map +7 -0
- package/dist/modules/cpq/widgets/injection-table.js +44 -0
- package/dist/modules/cpq/widgets/injection-table.js.map +7 -0
- package/dist/modules/cpq/workflows/WizardRunner.js +113 -0
- package/dist/modules/cpq/workflows/WizardRunner.js.map +7 -0
- package/dist/modules/cpq/workflows/WizardTrigger.js +116 -0
- package/dist/modules/cpq/workflows/WizardTrigger.js.map +7 -0
- package/dist/modules/cpq/workflows/engine.js +188 -0
- package/dist/modules/cpq/workflows/engine.js.map +7 -0
- package/dist/modules/cpq/workflows/registry.js +16 -0
- package/dist/modules/cpq/workflows/registry.js.map +7 -0
- package/dist/modules/cpq/workflows/steps/CustomerSelectStep.js +119 -0
- package/dist/modules/cpq/workflows/steps/CustomerSelectStep.js.map +7 -0
- package/dist/modules/cpq/workflows/steps/InventorySelectStep.js +24 -0
- package/dist/modules/cpq/workflows/steps/InventorySelectStep.js.map +7 -0
- package/dist/modules/cpq/workflows/steps/ItemListStep.js +115 -0
- package/dist/modules/cpq/workflows/steps/ItemListStep.js.map +7 -0
- package/dist/modules/cpq/workflows/steps/OfferingSelectStep.js +327 -0
- package/dist/modules/cpq/workflows/steps/OfferingSelectStep.js.map +7 -0
- package/dist/modules/cpq/workflows/steps/ProductConfigureStep.js +231 -0
- package/dist/modules/cpq/workflows/steps/ProductConfigureStep.js.map +7 -0
- package/dist/modules/cpq/workflows/steps/ReviewStep.js +152 -0
- package/dist/modules/cpq/workflows/steps/ReviewStep.js.map +7 -0
- package/dist/modules/cpq/workflows/steps/index.js +49 -0
- package/dist/modules/cpq/workflows/steps/index.js.map +7 -0
- package/dist/modules/cpq/workflows/types.js +1 -0
- package/dist/modules/cpq/workflows/types.js.map +7 -0
- package/package.json +150 -0
- package/src/modules/cpq/__integration__/TC-CPQ-001.spec.ts +177 -0
- package/src/modules/cpq/__integration__/TC-CPQ-002.spec.ts +123 -0
- package/src/modules/cpq/__integration__/TC-CPQ-003.spec.ts +115 -0
- package/src/modules/cpq/__integration__/TC-CPQ-004.spec.ts +184 -0
- package/src/modules/cpq/__integration__/TC-CPQ-005.spec.ts +43 -0
- package/src/modules/cpq/__integration__/TC-CPQ-006.spec.ts +87 -0
- package/src/modules/cpq/__integration__/TC-CPQ-007.spec.ts +79 -0
- package/src/modules/cpq/__integration__/TC-CPQ-008.spec.ts +55 -0
- package/src/modules/cpq/__integration__/TC-CPQ-009.spec.ts +45 -0
- package/src/modules/cpq/__integration__/TC-CPQ-010.spec.ts +54 -0
- package/src/modules/cpq/__integration__/TC-CPQ-011.spec.ts +24 -0
- package/src/modules/cpq/__integration__/TC-CPQ-012.spec.ts +62 -0
- package/src/modules/cpq/__integration__/TC-CPQ-ARC-001.spec.ts +52 -0
- package/src/modules/cpq/__integration__/TC-CPQ-ARC-002.spec.ts +65 -0
- package/src/modules/cpq/__integration__/TC-CPQ-ARC-003.spec.ts +107 -0
- package/src/modules/cpq/__integration__/TC-CPQ-ARC-004.spec.ts +74 -0
- package/src/modules/cpq/__integration__/TC-CPQ-ARC-005.spec.ts +86 -0
- package/src/modules/cpq/__integration__/TC-CPQ-ARC-006.spec.ts +79 -0
- package/src/modules/cpq/__integration__/TC-CPQ-ARC-007.spec.ts +63 -0
- package/src/modules/cpq/__integration__/TC-CPQ-ARC-008.spec.ts +62 -0
- package/src/modules/cpq/__integration__/TC-CPQ-ARC-009.spec.ts +62 -0
- package/src/modules/cpq/__integration__/TC-CPQ-ARC-010.spec.ts +59 -0
- package/src/modules/cpq/__integration__/TC-CPQ-ARC-011.spec.ts +128 -0
- package/src/modules/cpq/__integration__/_helpers/cpqArcFixtures.ts +208 -0
- package/src/modules/cpq/__tests__/package-isolation.test.ts +232 -0
- package/src/modules/cpq/acl.ts +26 -0
- package/src/modules/cpq/api/_helpers/__tests__/handleArcError.test.ts +117 -0
- package/src/modules/cpq/api/_helpers/handleArcError.ts +81 -0
- package/src/modules/cpq/api/attribute-options/route.ts +55 -0
- package/src/modules/cpq/api/bundle-slots/route.ts +112 -0
- package/src/modules/cpq/api/bundle-tree/route.ts +31 -0
- package/src/modules/cpq/api/context.ts +39 -0
- package/src/modules/cpq/api/inventory/assets/route.ts +123 -0
- package/src/modules/cpq/api/inventory/assets/status/route.ts +34 -0
- package/src/modules/cpq/api/inventory/customer/[customerId]/parent-items/route.ts +30 -0
- package/src/modules/cpq/api/inventory/customer/[customerId]/route.ts +31 -0
- package/src/modules/cpq/api/inventory/subscription-items/route.ts +107 -0
- package/src/modules/cpq/api/inventory/subscriptions/[subscriptionId]/change-log/route.ts +64 -0
- package/src/modules/cpq/api/inventory/subscriptions/expiring/route.ts +66 -0
- package/src/modules/cpq/api/inventory/subscriptions/route.ts +126 -0
- package/src/modules/cpq/api/inventory/subscriptions/status/route.ts +34 -0
- package/src/modules/cpq/api/offering-components/route.ts +103 -0
- package/src/modules/cpq/api/orders/[orderId]/activate/route.ts +48 -0
- package/src/modules/cpq/api/orders/[orderId]/route.ts +28 -0
- package/src/modules/cpq/api/orders/[orderId]/status/route.ts +38 -0
- package/src/modules/cpq/api/orders/route.ts +77 -0
- package/src/modules/cpq/api/price-rules/route.ts +210 -0
- package/src/modules/cpq/api/pricing-table-entries/route.ts +159 -0
- package/src/modules/cpq/api/pricing-tables/route.ts +202 -0
- package/src/modules/cpq/api/product-attributes/route.ts +175 -0
- package/src/modules/cpq/api/product-charges/route.ts +181 -0
- package/src/modules/cpq/api/product-offerings/route.ts +329 -0
- package/src/modules/cpq/api/product-relationships/route.ts +156 -0
- package/src/modules/cpq/api/product-specifications/route.ts +325 -0
- package/src/modules/cpq/api/quotes/[quoteId]/cancel-meta/route.ts +77 -0
- package/src/modules/cpq/api/quotes/[quoteId]/clone/route.ts +28 -0
- package/src/modules/cpq/api/quotes/[quoteId]/items/[lineId]/route.ts +55 -0
- package/src/modules/cpq/api/quotes/[quoteId]/items/route.ts +26 -0
- package/src/modules/cpq/api/quotes/[quoteId]/merge-meta/route.ts +78 -0
- package/src/modules/cpq/api/quotes/[quoteId]/recalculate/route.ts +34 -0
- package/src/modules/cpq/api/quotes/[quoteId]/route.ts +109 -0
- package/src/modules/cpq/api/quotes/[quoteId]/status/route.ts +26 -0
- package/src/modules/cpq/api/quotes/[quoteId]/target-subscriptions/[targetId]/route.ts +91 -0
- package/src/modules/cpq/api/quotes/[quoteId]/target-subscriptions/route.ts +107 -0
- package/src/modules/cpq/api/quotes/attributes/route.ts +61 -0
- package/src/modules/cpq/api/quotes/from-subscription/route.ts +85 -0
- package/src/modules/cpq/api/quotes/price/route.ts +81 -0
- package/src/modules/cpq/api/quotes/route.ts +114 -0
- package/src/modules/cpq/api/quotes/validate-relationships/route.ts +100 -0
- package/src/modules/cpq/api/resolveQuotingService.ts +11 -0
- package/src/modules/cpq/api/wizards/resolve/route.ts +39 -0
- package/src/modules/cpq/api/wizards/route.ts +127 -0
- package/src/modules/cpq/backend/cpq/inventory/AssetsTable.tsx +166 -0
- package/src/modules/cpq/backend/cpq/inventory/SubscriptionsTable.tsx +251 -0
- package/src/modules/cpq/backend/cpq/inventory/assets/[id]/page.meta.ts +9 -0
- package/src/modules/cpq/backend/cpq/inventory/assets/[id]/page.tsx +440 -0
- package/src/modules/cpq/backend/cpq/inventory/page.meta.ts +16 -0
- package/src/modules/cpq/backend/cpq/inventory/page.tsx +49 -0
- package/src/modules/cpq/backend/cpq/inventory/shared.tsx +32 -0
- package/src/modules/cpq/backend/cpq/inventory/subscriptions/[id]/page.meta.ts +9 -0
- package/src/modules/cpq/backend/cpq/inventory/subscriptions/[id]/page.tsx +1085 -0
- package/src/modules/cpq/backend/cpq/offerings/[id]/page.tsx +1165 -0
- package/src/modules/cpq/backend/cpq/offerings/page.meta.ts +16 -0
- package/src/modules/cpq/backend/cpq/offerings/page.tsx +468 -0
- package/src/modules/cpq/backend/cpq/orders/[id]/page.tsx +921 -0
- package/src/modules/cpq/backend/cpq/orders/page.meta.ts +16 -0
- package/src/modules/cpq/backend/cpq/orders/page.tsx +182 -0
- package/src/modules/cpq/backend/cpq/price-rules/PriceRuleForm.tsx +310 -0
- package/src/modules/cpq/backend/cpq/price-rules/[id]/page.meta.ts +9 -0
- package/src/modules/cpq/backend/cpq/price-rules/[id]/page.tsx +472 -0
- package/src/modules/cpq/backend/cpq/price-rules/page.meta.ts +16 -0
- package/src/modules/cpq/backend/cpq/price-rules/page.tsx +253 -0
- package/src/modules/cpq/backend/cpq/pricing/[id]/EntriesEditor.tsx +431 -0
- package/src/modules/cpq/backend/cpq/pricing/[id]/ImportPreview.tsx +122 -0
- package/src/modules/cpq/backend/cpq/pricing/[id]/page.tsx +588 -0
- package/src/modules/cpq/backend/cpq/pricing/[id]/xlsxExport.ts +90 -0
- package/src/modules/cpq/backend/cpq/pricing/[id]/xlsxImport.ts +338 -0
- package/src/modules/cpq/backend/cpq/pricing/page.meta.ts +16 -0
- package/src/modules/cpq/backend/cpq/pricing/page.tsx +111 -0
- package/src/modules/cpq/backend/cpq/quotes/[id]/_components/ArcQuoteConfigurator.tsx +737 -0
- package/src/modules/cpq/backend/cpq/quotes/[id]/page.tsx +1721 -0
- package/src/modules/cpq/backend/cpq/quotes/page.meta.ts +16 -0
- package/src/modules/cpq/backend/cpq/quotes/page.tsx +370 -0
- package/src/modules/cpq/backend/cpq/specifications/[id]/DependsOnRulesEditor.tsx +300 -0
- package/src/modules/cpq/backend/cpq/specifications/[id]/page.tsx +1722 -0
- package/src/modules/cpq/backend/cpq/specifications/page.meta.ts +16 -0
- package/src/modules/cpq/backend/cpq/specifications/page.tsx +191 -0
- package/src/modules/cpq/backend/cpq/wizards/[definitionCode]/detail/page.tsx +319 -0
- package/src/modules/cpq/backend/cpq/wizards/[definitionCode]/page.tsx +234 -0
- package/src/modules/cpq/backend/cpq/wizards/page.meta.ts +16 -0
- package/src/modules/cpq/backend/cpq/wizards/page.tsx +141 -0
- package/src/modules/cpq/ce.ts +150 -0
- package/src/modules/cpq/cli.ts +10 -0
- package/src/modules/cpq/components/CpqListView.tsx +431 -0
- package/src/modules/cpq/components/NumberInput.tsx +166 -0
- package/src/modules/cpq/components/StatusPath.tsx +116 -0
- package/src/modules/cpq/components/statusMaps.ts +148 -0
- package/src/modules/cpq/components/useCpqRowActions.tsx +183 -0
- package/src/modules/cpq/data/__tests__/validators.arc.test.ts +271 -0
- package/src/modules/cpq/data/__tests__/validators.test.ts +782 -0
- package/src/modules/cpq/data/entities.ts +1467 -0
- package/src/modules/cpq/data/validators.ts +663 -0
- package/src/modules/cpq/di.ts +70 -0
- package/src/modules/cpq/events.ts +62 -0
- package/src/modules/cpq/index.ts +15 -0
- package/src/modules/cpq/lib/seeds/__tests__/api.test.ts +86 -0
- package/src/modules/cpq/lib/seeds/__tests__/tenant-provisioning.test.ts +349 -0
- package/src/modules/cpq/lib/seeds/api.ts +119 -0
- package/src/modules/cpq/lib/seeds/tenant-provisioning.ts +239 -0
- package/src/modules/cpq/lib/seeds.ts +18 -0
- package/src/modules/cpq/migrations/.snapshot-open-mercato.json +7473 -0
- package/src/modules/cpq/migrations/Migration20260220220000_cpq.ts +51 -0
- package/src/modules/cpq/migrations/Migration20260330000000_cpq_product_domain.ts +70 -0
- package/src/modules/cpq/migrations/Migration20260331000000_cpq_charge_unique_per_offering.ts +15 -0
- package/src/modules/cpq/migrations/Migration20260401000000_cpq_quoting_v2.ts +73 -0
- package/src/modules/cpq/migrations/Migration20260402000000_cpq_workflows.ts +59 -0
- package/src/modules/cpq/migrations/Migration20260407000000_cpq_pricing_tables_v2.ts +30 -0
- package/src/modules/cpq/migrations/Migration20260407100000_cpq_price_rules.ts +36 -0
- package/src/modules/cpq/migrations/Migration20260408000000_cpq_price_rules.ts +33 -0
- package/src/modules/cpq/migrations/Migration20260410000000_cpq_drop_datacentres_inventory.ts +22 -0
- package/src/modules/cpq/migrations/Migration20260410000000_cpq_wizard_rename.ts +56 -0
- package/src/modules/cpq/migrations/Migration20260410100000_cpq_inventory.ts +118 -0
- package/src/modules/cpq/migrations/Migration20260411000000_cpq_orders.ts +62 -0
- package/src/modules/cpq/migrations/Migration20260412000000_cpq_bundled_offerings.ts +33 -0
- package/src/modules/cpq/migrations/Migration20260504064621_cpq_arc.ts +68 -0
- package/src/modules/cpq/migrations/Migration20260514000000_cpq_spec_merge_retired_deprecated.ts +30 -0
- package/src/modules/cpq/migrations/Migration20260514100000_cpq_offering_merge_retired_deprecated.ts +27 -0
- package/src/modules/cpq/migrations/Migration20260514110000_cpq_list_search_indexes.ts +82 -0
- package/src/modules/cpq/migrations/Migration20260515000000_cpq_inventory_subscriptions_search_indexes.ts +52 -0
- package/src/modules/cpq/services/__tests__/_helpers/mockEm.ts +59 -0
- package/src/modules/cpq/services/__tests__/cpqBundleService.test.ts +661 -0
- package/src/modules/cpq/services/__tests__/cpqInventoryService.arc.test.ts +357 -0
- package/src/modules/cpq/services/__tests__/cpqInventoryService.test.ts +718 -0
- package/src/modules/cpq/services/__tests__/cpqOrderService.test.ts +603 -0
- package/src/modules/cpq/services/__tests__/cpqPricingService.test.ts +1012 -0
- package/src/modules/cpq/services/__tests__/cpqProductService.test.ts +603 -0
- package/src/modules/cpq/services/__tests__/cpqQuotingService.arc.test.ts +143 -0
- package/src/modules/cpq/services/__tests__/cpqQuotingService.test.ts +658 -0
- package/src/modules/cpq/services/__tests__/cpqValidationService.test.ts +811 -0
- package/src/modules/cpq/services/__tests__/cpqWizardService.test.ts +389 -0
- package/src/modules/cpq/services/__tests__/types.test.ts +359 -0
- package/src/modules/cpq/services/cpqBundleService.ts +671 -0
- package/src/modules/cpq/services/cpqInventoryService.ts +1929 -0
- package/src/modules/cpq/services/cpqOrderService.ts +1230 -0
- package/src/modules/cpq/services/cpqPricingService.ts +412 -0
- package/src/modules/cpq/services/cpqProductService.ts +311 -0
- package/src/modules/cpq/services/cpqQuotingService.ts +2638 -0
- package/src/modules/cpq/services/cpqValidationService.ts +323 -0
- package/src/modules/cpq/services/cpqWizardService.ts +204 -0
- package/src/modules/cpq/services/types.ts +303 -0
- package/src/modules/cpq/setup.ts +63 -0
- package/src/modules/cpq/subscribers/subscription-amended-log.ts +20 -0
- package/src/modules/cpq/subscribers/subscription-cancelled-log.ts +19 -0
- package/src/modules/cpq/subscribers/subscription-merged-log.ts +22 -0
- package/src/modules/cpq/subscribers/subscription-renewed-log.ts +18 -0
- package/src/modules/cpq/subscribers/subscription-superseded-log.ts +19 -0
- package/src/modules/cpq/widgets/injection/customer-inventory/widget.client.tsx +339 -0
- package/src/modules/cpq/widgets/injection/customer-inventory/widget.ts +16 -0
- package/src/modules/cpq/widgets/injection/order-cpq-tab/widget.client.tsx +96 -0
- package/src/modules/cpq/widgets/injection/order-cpq-tab/widget.ts +16 -0
- package/src/modules/cpq/widgets/injection/quote-configurator/widget.client.tsx +265 -0
- package/src/modules/cpq/widgets/injection/quote-configurator/widget.ts +16 -0
- package/src/modules/cpq/widgets/injection-table.ts +42 -0
- package/src/modules/cpq/workflows/WizardRunner.tsx +158 -0
- package/src/modules/cpq/workflows/WizardTrigger.tsx +142 -0
- package/src/modules/cpq/workflows/engine.tsx +278 -0
- package/src/modules/cpq/workflows/registry.ts +15 -0
- package/src/modules/cpq/workflows/steps/CustomerSelectStep.tsx +136 -0
- package/src/modules/cpq/workflows/steps/InventorySelectStep.tsx +34 -0
- package/src/modules/cpq/workflows/steps/ItemListStep.tsx +146 -0
- package/src/modules/cpq/workflows/steps/OfferingSelectStep.tsx +438 -0
- package/src/modules/cpq/workflows/steps/ProductConfigureStep.tsx +287 -0
- package/src/modules/cpq/workflows/steps/ReviewStep.tsx +219 -0
- package/src/modules/cpq/workflows/steps/index.ts +51 -0
- package/src/modules/cpq/workflows/types.ts +102 -0
|
@@ -0,0 +1,782 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cpqProductSpecificationCreateSchema,
|
|
3
|
+
cpqProductSpecificationUpdateSchema,
|
|
4
|
+
cpqProductOfferingCreateSchema,
|
|
5
|
+
cpqBundleSlotCreateSchema,
|
|
6
|
+
cpqProductRelationshipCreateSchema,
|
|
7
|
+
cpqProductAttributeCreateSchema,
|
|
8
|
+
cpqProductChargeCreateSchema,
|
|
9
|
+
cpqPriceRuleCreateSchema,
|
|
10
|
+
cpqPricingTableCreateSchema,
|
|
11
|
+
cpqPricingTableEntryCreateSchema,
|
|
12
|
+
cpqCreateQuoteSchema,
|
|
13
|
+
cpqAddQuoteItemSchema,
|
|
14
|
+
cpqUpdateQuoteItemSchema,
|
|
15
|
+
cpqRecalculateSchema,
|
|
16
|
+
cpqTransitionStatusSchema,
|
|
17
|
+
cpqValidateRelationshipsSchema,
|
|
18
|
+
cpqPricePreviewSchema,
|
|
19
|
+
cpqWizardDefinitionCreateSchema,
|
|
20
|
+
cpqInventorySubscriptionCreateSchema,
|
|
21
|
+
cpqInventoryAssetCreateSchema,
|
|
22
|
+
cpqConvertQuoteToOrderSchema,
|
|
23
|
+
cpqOrderStatusTransitionSchema,
|
|
24
|
+
} from '../validators'
|
|
25
|
+
|
|
26
|
+
const VALID_UUID = '11111111-1111-4111-8111-111111111111'
|
|
27
|
+
const VALID_UUID_2 = '22222222-2222-4222-8222-222222222222'
|
|
28
|
+
|
|
29
|
+
describe('cpqProductSpecificationCreateSchema', () => {
|
|
30
|
+
it('parses a minimal valid input and applies defaults', () => {
|
|
31
|
+
const result = cpqProductSpecificationCreateSchema.safeParse({
|
|
32
|
+
code: 'GIX-ACCESS-PORT',
|
|
33
|
+
name: 'GIX Access Port',
|
|
34
|
+
})
|
|
35
|
+
expect(result.success).toBe(true)
|
|
36
|
+
if (!result.success) return
|
|
37
|
+
expect(result.data).toMatchObject({
|
|
38
|
+
code: 'GIX-ACCESS-PORT',
|
|
39
|
+
name: 'GIX Access Port',
|
|
40
|
+
specType: 'simple',
|
|
41
|
+
isAssetizable: false,
|
|
42
|
+
lifecycleStatus: 'draft',
|
|
43
|
+
version: 1,
|
|
44
|
+
isActive: true,
|
|
45
|
+
})
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
it('rejects missing code', () => {
|
|
49
|
+
const result = cpqProductSpecificationCreateSchema.safeParse({ name: 'No Code' })
|
|
50
|
+
expect(result.success).toBe(false)
|
|
51
|
+
if (result.success) return
|
|
52
|
+
expect(result.error.issues.some((i) => i.path[0] === 'code')).toBe(true)
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
it('rejects an empty code (min(1))', () => {
|
|
56
|
+
const result = cpqProductSpecificationCreateSchema.safeParse({ code: '', name: 'X' })
|
|
57
|
+
expect(result.success).toBe(false)
|
|
58
|
+
if (result.success) return
|
|
59
|
+
expect(result.error.issues.some((i) => i.path[0] === 'code')).toBe(true)
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
it('rejects an unknown specType enum value', () => {
|
|
63
|
+
const result = cpqProductSpecificationCreateSchema.safeParse({
|
|
64
|
+
code: 'X',
|
|
65
|
+
name: 'X',
|
|
66
|
+
specType: 'composite',
|
|
67
|
+
})
|
|
68
|
+
expect(result.success).toBe(false)
|
|
69
|
+
if (result.success) return
|
|
70
|
+
expect(result.error.issues.some((i) => i.path[0] === 'specType')).toBe(true)
|
|
71
|
+
})
|
|
72
|
+
|
|
73
|
+
it('accepts both bundle and simple specTypes', () => {
|
|
74
|
+
expect(
|
|
75
|
+
cpqProductSpecificationCreateSchema.safeParse({ code: 'A', name: 'A', specType: 'simple' }).success,
|
|
76
|
+
).toBe(true)
|
|
77
|
+
expect(
|
|
78
|
+
cpqProductSpecificationCreateSchema.safeParse({ code: 'A', name: 'A', specType: 'bundle' }).success,
|
|
79
|
+
).toBe(true)
|
|
80
|
+
})
|
|
81
|
+
|
|
82
|
+
it('rejects invalid productId UUID', () => {
|
|
83
|
+
const result = cpqProductSpecificationCreateSchema.safeParse({
|
|
84
|
+
code: 'X',
|
|
85
|
+
name: 'X',
|
|
86
|
+
productId: 'not-a-uuid',
|
|
87
|
+
})
|
|
88
|
+
expect(result.success).toBe(false)
|
|
89
|
+
if (result.success) return
|
|
90
|
+
expect(result.error.issues.some((i) => i.path[0] === 'productId')).toBe(true)
|
|
91
|
+
})
|
|
92
|
+
|
|
93
|
+
it('rejects invalid datetime format on effectiveFrom', () => {
|
|
94
|
+
const result = cpqProductSpecificationCreateSchema.safeParse({
|
|
95
|
+
code: 'X',
|
|
96
|
+
name: 'X',
|
|
97
|
+
effectiveFrom: '2026-04-28', // not a full ISO datetime
|
|
98
|
+
})
|
|
99
|
+
expect(result.success).toBe(false)
|
|
100
|
+
if (result.success) return
|
|
101
|
+
expect(result.error.issues.some((i) => i.path[0] === 'effectiveFrom')).toBe(true)
|
|
102
|
+
})
|
|
103
|
+
})
|
|
104
|
+
|
|
105
|
+
describe('cpqProductSpecificationUpdateSchema', () => {
|
|
106
|
+
it('requires id', () => {
|
|
107
|
+
const result = cpqProductSpecificationUpdateSchema.safeParse({ name: 'New Name' })
|
|
108
|
+
expect(result.success).toBe(false)
|
|
109
|
+
if (result.success) return
|
|
110
|
+
expect(result.error.issues.some((i) => i.path[0] === 'id')).toBe(true)
|
|
111
|
+
})
|
|
112
|
+
|
|
113
|
+
it('accepts id with partial fields', () => {
|
|
114
|
+
const result = cpqProductSpecificationUpdateSchema.safeParse({
|
|
115
|
+
id: VALID_UUID,
|
|
116
|
+
name: 'New Name',
|
|
117
|
+
})
|
|
118
|
+
expect(result.success).toBe(true)
|
|
119
|
+
})
|
|
120
|
+
})
|
|
121
|
+
|
|
122
|
+
describe('cpqProductOfferingCreateSchema', () => {
|
|
123
|
+
it('requires specId UUID', () => {
|
|
124
|
+
const result = cpqProductOfferingCreateSchema.safeParse({
|
|
125
|
+
code: 'O',
|
|
126
|
+
name: 'O',
|
|
127
|
+
})
|
|
128
|
+
expect(result.success).toBe(false)
|
|
129
|
+
if (result.success) return
|
|
130
|
+
expect(result.error.issues.some((i) => i.path[0] === 'specId')).toBe(true)
|
|
131
|
+
})
|
|
132
|
+
|
|
133
|
+
it('defaults designTimeValues to {}', () => {
|
|
134
|
+
const result = cpqProductOfferingCreateSchema.safeParse({
|
|
135
|
+
specId: VALID_UUID,
|
|
136
|
+
code: 'O',
|
|
137
|
+
name: 'O',
|
|
138
|
+
})
|
|
139
|
+
expect(result.success).toBe(true)
|
|
140
|
+
if (!result.success) return
|
|
141
|
+
expect(result.data.designTimeValues).toEqual({})
|
|
142
|
+
})
|
|
143
|
+
})
|
|
144
|
+
|
|
145
|
+
describe('cpqBundleSlotCreateSchema', () => {
|
|
146
|
+
it('rejects negative cardinalityMin', () => {
|
|
147
|
+
const result = cpqBundleSlotCreateSchema.safeParse({
|
|
148
|
+
specId: VALID_UUID,
|
|
149
|
+
targetSpecId: VALID_UUID_2,
|
|
150
|
+
componentGroup: 'access',
|
|
151
|
+
name: 'Access slot',
|
|
152
|
+
cardinalityMin: -1,
|
|
153
|
+
})
|
|
154
|
+
expect(result.success).toBe(false)
|
|
155
|
+
if (result.success) return
|
|
156
|
+
expect(result.error.issues.some((i) => i.path[0] === 'cardinalityMin')).toBe(true)
|
|
157
|
+
})
|
|
158
|
+
|
|
159
|
+
it('accepts cardinalityMax: null', () => {
|
|
160
|
+
const result = cpqBundleSlotCreateSchema.safeParse({
|
|
161
|
+
specId: VALID_UUID,
|
|
162
|
+
targetSpecId: VALID_UUID_2,
|
|
163
|
+
componentGroup: 'access',
|
|
164
|
+
name: 'Access slot',
|
|
165
|
+
cardinalityMax: null,
|
|
166
|
+
})
|
|
167
|
+
expect(result.success).toBe(true)
|
|
168
|
+
})
|
|
169
|
+
})
|
|
170
|
+
|
|
171
|
+
describe('cpqProductRelationshipCreateSchema', () => {
|
|
172
|
+
it.each(['parent_child', 'requires', 'excludes'] as const)(
|
|
173
|
+
'accepts relationshipType=%s',
|
|
174
|
+
(type) => {
|
|
175
|
+
const result = cpqProductRelationshipCreateSchema.safeParse({
|
|
176
|
+
sourceSpecId: VALID_UUID,
|
|
177
|
+
targetSpecId: VALID_UUID_2,
|
|
178
|
+
relationshipType: type,
|
|
179
|
+
})
|
|
180
|
+
expect(result.success).toBe(true)
|
|
181
|
+
},
|
|
182
|
+
)
|
|
183
|
+
|
|
184
|
+
it('rejects unknown relationshipType', () => {
|
|
185
|
+
const result = cpqProductRelationshipCreateSchema.safeParse({
|
|
186
|
+
sourceSpecId: VALID_UUID,
|
|
187
|
+
targetSpecId: VALID_UUID_2,
|
|
188
|
+
relationshipType: 'depends_on',
|
|
189
|
+
})
|
|
190
|
+
expect(result.success).toBe(false)
|
|
191
|
+
})
|
|
192
|
+
})
|
|
193
|
+
|
|
194
|
+
describe('cpqProductAttributeCreateSchema', () => {
|
|
195
|
+
it('requires attributeType from the enum', () => {
|
|
196
|
+
const result = cpqProductAttributeCreateSchema.safeParse({
|
|
197
|
+
code: 'port_speed',
|
|
198
|
+
name: 'Port Speed',
|
|
199
|
+
attributeType: 'unknown',
|
|
200
|
+
})
|
|
201
|
+
expect(result.success).toBe(false)
|
|
202
|
+
if (result.success) return
|
|
203
|
+
expect(result.error.issues.some((i) => i.path[0] === 'attributeType')).toBe(true)
|
|
204
|
+
})
|
|
205
|
+
|
|
206
|
+
it('defaults resolutionTime to run_time and isRequired to true', () => {
|
|
207
|
+
const result = cpqProductAttributeCreateSchema.safeParse({
|
|
208
|
+
code: 'port_speed',
|
|
209
|
+
name: 'Port Speed',
|
|
210
|
+
attributeType: 'enum',
|
|
211
|
+
})
|
|
212
|
+
expect(result.success).toBe(true)
|
|
213
|
+
if (!result.success) return
|
|
214
|
+
expect(result.data.resolutionTime).toBe('run_time')
|
|
215
|
+
expect(result.data.isRequired).toBe(true)
|
|
216
|
+
})
|
|
217
|
+
|
|
218
|
+
it('accepts options array with value/label pairs', () => {
|
|
219
|
+
const result = cpqProductAttributeCreateSchema.safeParse({
|
|
220
|
+
code: 'port_speed',
|
|
221
|
+
name: 'Port Speed',
|
|
222
|
+
attributeType: 'select',
|
|
223
|
+
options: [
|
|
224
|
+
{ value: '1G', label: '1 Gbps' },
|
|
225
|
+
{ value: '10G', label: '10 Gbps' },
|
|
226
|
+
],
|
|
227
|
+
})
|
|
228
|
+
expect(result.success).toBe(true)
|
|
229
|
+
})
|
|
230
|
+
})
|
|
231
|
+
|
|
232
|
+
describe('cpqProductChargeCreateSchema', () => {
|
|
233
|
+
// Baseline flat-pricing payload — fixedPrice + currencyCode required by V-CHG-1.
|
|
234
|
+
const flatBase = {
|
|
235
|
+
code: 'setup',
|
|
236
|
+
name: 'Setup Fee',
|
|
237
|
+
chargeType: 'nrc' as const,
|
|
238
|
+
pricingMethod: 'flat' as const,
|
|
239
|
+
fixedPrice: '1500.00',
|
|
240
|
+
currencyCode: 'USD',
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
const perUnitBase = {
|
|
244
|
+
code: 'bw',
|
|
245
|
+
name: 'Bandwidth',
|
|
246
|
+
chargeType: 'mrc' as const,
|
|
247
|
+
pricingMethod: 'per_unit' as const,
|
|
248
|
+
pricingTableId: VALID_UUID,
|
|
249
|
+
priceColumnKey: 'per_mb',
|
|
250
|
+
quantityAttributeCode: 'bandwidth_mb',
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
it('coerces numeric fixedPrice to string (per the union/transform)', () => {
|
|
254
|
+
const result = cpqProductChargeCreateSchema.safeParse({ ...flatBase, fixedPrice: 1500 })
|
|
255
|
+
expect(result.success).toBe(true)
|
|
256
|
+
if (!result.success) return
|
|
257
|
+
expect(result.data.fixedPrice).toBe('1500')
|
|
258
|
+
})
|
|
259
|
+
|
|
260
|
+
it('keeps string fixedPrice as-is', () => {
|
|
261
|
+
const result = cpqProductChargeCreateSchema.safeParse(flatBase)
|
|
262
|
+
expect(result.success).toBe(true)
|
|
263
|
+
if (!result.success) return
|
|
264
|
+
expect(result.data.fixedPrice).toBe('1500.00')
|
|
265
|
+
})
|
|
266
|
+
|
|
267
|
+
it.each(['nrc', 'mrc', 'usage'] as const)('accepts chargeType=%s', (chargeType) => {
|
|
268
|
+
expect(cpqProductChargeCreateSchema.safeParse({ ...flatBase, chargeType }).success).toBe(true)
|
|
269
|
+
})
|
|
270
|
+
|
|
271
|
+
it('rejects unknown pricingMethod', () => {
|
|
272
|
+
const result = cpqProductChargeCreateSchema.safeParse({ ...flatBase, pricingMethod: 'graduated' })
|
|
273
|
+
expect(result.success).toBe(false)
|
|
274
|
+
})
|
|
275
|
+
|
|
276
|
+
// ─── V-CHG-1: flat pricing shape ────────────────────────────
|
|
277
|
+
it('V-CHG-1: rejects flat without fixedPrice', () => {
|
|
278
|
+
const { fixedPrice: _, ...partial } = flatBase
|
|
279
|
+
const result = cpqProductChargeCreateSchema.safeParse(partial)
|
|
280
|
+
expect(result.success).toBe(false)
|
|
281
|
+
if (result.success) return
|
|
282
|
+
expect(result.error.issues.some((i) => i.path[0] === 'fixedPrice')).toBe(true)
|
|
283
|
+
})
|
|
284
|
+
|
|
285
|
+
it('V-CHG-1: rejects flat without currencyCode', () => {
|
|
286
|
+
const { currencyCode: _, ...partial } = flatBase
|
|
287
|
+
const result = cpqProductChargeCreateSchema.safeParse(partial)
|
|
288
|
+
expect(result.success).toBe(false)
|
|
289
|
+
if (result.success) return
|
|
290
|
+
expect(result.error.issues.some((i) => i.path[0] === 'currencyCode')).toBe(true)
|
|
291
|
+
})
|
|
292
|
+
|
|
293
|
+
it('V-CHG-1: rejects flat with stray pricingTableId', () => {
|
|
294
|
+
const result = cpqProductChargeCreateSchema.safeParse({ ...flatBase, pricingTableId: VALID_UUID })
|
|
295
|
+
expect(result.success).toBe(false)
|
|
296
|
+
if (result.success) return
|
|
297
|
+
expect(result.error.issues.some((i) => i.path[0] === 'pricingTableId')).toBe(true)
|
|
298
|
+
})
|
|
299
|
+
|
|
300
|
+
// ─── V-CHG-1: per_unit / tiered pricing shape ──────────────
|
|
301
|
+
it.each(['per_unit', 'tiered'] as const)('V-CHG-1: accepts complete %s config', (method) => {
|
|
302
|
+
const result = cpqProductChargeCreateSchema.safeParse({ ...perUnitBase, pricingMethod: method })
|
|
303
|
+
expect(result.success).toBe(true)
|
|
304
|
+
})
|
|
305
|
+
|
|
306
|
+
it.each(['per_unit', 'tiered'] as const)('V-CHG-1: rejects %s without pricingTableId', (method) => {
|
|
307
|
+
const { pricingTableId: _, ...partial } = perUnitBase
|
|
308
|
+
const result = cpqProductChargeCreateSchema.safeParse({ ...partial, pricingMethod: method })
|
|
309
|
+
expect(result.success).toBe(false)
|
|
310
|
+
if (result.success) return
|
|
311
|
+
expect(result.error.issues.some((i) => i.path[0] === 'pricingTableId')).toBe(true)
|
|
312
|
+
})
|
|
313
|
+
|
|
314
|
+
it.each(['per_unit', 'tiered'] as const)('V-CHG-1: rejects %s without priceColumnKey', (method) => {
|
|
315
|
+
const { priceColumnKey: _, ...partial } = perUnitBase
|
|
316
|
+
const result = cpqProductChargeCreateSchema.safeParse({ ...partial, pricingMethod: method })
|
|
317
|
+
expect(result.success).toBe(false)
|
|
318
|
+
if (result.success) return
|
|
319
|
+
expect(result.error.issues.some((i) => i.path[0] === 'priceColumnKey')).toBe(true)
|
|
320
|
+
})
|
|
321
|
+
|
|
322
|
+
it.each(['per_unit', 'tiered'] as const)('V-CHG-1: rejects %s without quantityAttributeCode', (method) => {
|
|
323
|
+
const { quantityAttributeCode: _, ...partial } = perUnitBase
|
|
324
|
+
const result = cpqProductChargeCreateSchema.safeParse({ ...partial, pricingMethod: method })
|
|
325
|
+
expect(result.success).toBe(false)
|
|
326
|
+
if (result.success) return
|
|
327
|
+
expect(result.error.issues.some((i) => i.path[0] === 'quantityAttributeCode')).toBe(true)
|
|
328
|
+
})
|
|
329
|
+
|
|
330
|
+
it.each(['per_unit', 'tiered'] as const)('V-CHG-1: rejects %s with stray fixedPrice', (method) => {
|
|
331
|
+
const result = cpqProductChargeCreateSchema.safeParse({ ...perUnitBase, pricingMethod: method, fixedPrice: '5' })
|
|
332
|
+
expect(result.success).toBe(false)
|
|
333
|
+
if (result.success) return
|
|
334
|
+
expect(result.error.issues.some((i) => i.path[0] === 'fixedPrice')).toBe(true)
|
|
335
|
+
})
|
|
336
|
+
|
|
337
|
+
// ─── Legacy `fixed` alias ──────────────────────────────────
|
|
338
|
+
it('normalises legacy `fixed` to `flat` on input', () => {
|
|
339
|
+
const result = cpqProductChargeCreateSchema.safeParse({ ...flatBase, pricingMethod: 'fixed' })
|
|
340
|
+
expect(result.success).toBe(true)
|
|
341
|
+
if (!result.success) return
|
|
342
|
+
expect(result.data.pricingMethod).toBe('flat')
|
|
343
|
+
})
|
|
344
|
+
|
|
345
|
+
it('legacy `fixed` still requires fixedPrice + currencyCode', () => {
|
|
346
|
+
const { fixedPrice: _, currencyCode: __, ...partial } = flatBase
|
|
347
|
+
const result = cpqProductChargeCreateSchema.safeParse({ ...partial, pricingMethod: 'fixed' })
|
|
348
|
+
expect(result.success).toBe(false)
|
|
349
|
+
})
|
|
350
|
+
})
|
|
351
|
+
|
|
352
|
+
describe('cpqPriceRuleCreateSchema', () => {
|
|
353
|
+
it('rejects negative value (min(0))', () => {
|
|
354
|
+
const result = cpqPriceRuleCreateSchema.safeParse({
|
|
355
|
+
code: 'X',
|
|
356
|
+
name: 'X',
|
|
357
|
+
ruleType: 'discount_percent',
|
|
358
|
+
value: -5,
|
|
359
|
+
})
|
|
360
|
+
expect(result.success).toBe(false)
|
|
361
|
+
if (result.success) return
|
|
362
|
+
expect(result.error.issues.some((i) => i.path[0] === 'value')).toBe(true)
|
|
363
|
+
})
|
|
364
|
+
|
|
365
|
+
it.each([
|
|
366
|
+
'discount_percent',
|
|
367
|
+
'discount_absolute',
|
|
368
|
+
'surcharge_percent',
|
|
369
|
+
'surcharge_absolute',
|
|
370
|
+
'price_override',
|
|
371
|
+
] as const)('accepts ruleType=%s', (ruleType) => {
|
|
372
|
+
const result = cpqPriceRuleCreateSchema.safeParse({
|
|
373
|
+
code: 'X',
|
|
374
|
+
name: 'X',
|
|
375
|
+
ruleType,
|
|
376
|
+
value: 10,
|
|
377
|
+
})
|
|
378
|
+
expect(result.success).toBe(true)
|
|
379
|
+
})
|
|
380
|
+
|
|
381
|
+
it('rejects unknown ruleType', () => {
|
|
382
|
+
const result = cpqPriceRuleCreateSchema.safeParse({
|
|
383
|
+
code: 'X',
|
|
384
|
+
name: 'X',
|
|
385
|
+
ruleType: 'unknown_rule',
|
|
386
|
+
value: 0,
|
|
387
|
+
})
|
|
388
|
+
expect(result.success).toBe(false)
|
|
389
|
+
})
|
|
390
|
+
})
|
|
391
|
+
|
|
392
|
+
describe('cpqPricingTableCreateSchema', () => {
|
|
393
|
+
it('requires at least one currency code', () => {
|
|
394
|
+
const result = cpqPricingTableCreateSchema.safeParse({
|
|
395
|
+
code: 'PT',
|
|
396
|
+
name: 'PT',
|
|
397
|
+
dimensions: [{ key: 'dc', label: 'Datacenter' }],
|
|
398
|
+
priceColumns: [{ key: 'list', label: 'List' }],
|
|
399
|
+
currencyCodeList: [],
|
|
400
|
+
})
|
|
401
|
+
expect(result.success).toBe(false)
|
|
402
|
+
if (result.success) return
|
|
403
|
+
expect(result.error.issues.some((i) => i.path[0] === 'currencyCodeList')).toBe(true)
|
|
404
|
+
})
|
|
405
|
+
|
|
406
|
+
it('accepts a fully-formed pricing table', () => {
|
|
407
|
+
const result = cpqPricingTableCreateSchema.safeParse({
|
|
408
|
+
code: 'PT',
|
|
409
|
+
name: 'PT',
|
|
410
|
+
dimensions: [{ key: 'dc', label: 'Datacenter' }],
|
|
411
|
+
priceColumns: [{ key: 'list', label: 'List' }],
|
|
412
|
+
currencyCodeList: ['USD', 'EUR'],
|
|
413
|
+
})
|
|
414
|
+
expect(result.success).toBe(true)
|
|
415
|
+
})
|
|
416
|
+
|
|
417
|
+
// ─── V-PT-1: key/label required + unique ──────────────────
|
|
418
|
+
it('V-PT-1: rejects dimension with empty key', () => {
|
|
419
|
+
const result = cpqPricingTableCreateSchema.safeParse({
|
|
420
|
+
code: 'PT',
|
|
421
|
+
name: 'PT',
|
|
422
|
+
dimensions: [{ key: '', label: 'Datacenter' }],
|
|
423
|
+
priceColumns: [{ key: 'list', label: 'List' }],
|
|
424
|
+
currencyCodeList: ['USD'],
|
|
425
|
+
})
|
|
426
|
+
expect(result.success).toBe(false)
|
|
427
|
+
if (result.success) return
|
|
428
|
+
expect(result.error.issues.some((i) => i.path.includes('dimensions') && i.path.includes('key'))).toBe(true)
|
|
429
|
+
})
|
|
430
|
+
|
|
431
|
+
it('V-PT-1: rejects dimension with empty label', () => {
|
|
432
|
+
const result = cpqPricingTableCreateSchema.safeParse({
|
|
433
|
+
code: 'PT',
|
|
434
|
+
name: 'PT',
|
|
435
|
+
dimensions: [{ key: 'dc', label: '' }],
|
|
436
|
+
priceColumns: [{ key: 'list', label: 'List' }],
|
|
437
|
+
currencyCodeList: ['USD'],
|
|
438
|
+
})
|
|
439
|
+
expect(result.success).toBe(false)
|
|
440
|
+
if (result.success) return
|
|
441
|
+
expect(result.error.issues.some((i) => i.path.includes('dimensions') && i.path.includes('label'))).toBe(true)
|
|
442
|
+
})
|
|
443
|
+
|
|
444
|
+
it('V-PT-1: rejects priceColumn with empty key', () => {
|
|
445
|
+
const result = cpqPricingTableCreateSchema.safeParse({
|
|
446
|
+
code: 'PT',
|
|
447
|
+
name: 'PT',
|
|
448
|
+
dimensions: [{ key: 'dc', label: 'Datacenter' }],
|
|
449
|
+
priceColumns: [{ key: '', label: 'List' }],
|
|
450
|
+
currencyCodeList: ['USD'],
|
|
451
|
+
})
|
|
452
|
+
expect(result.success).toBe(false)
|
|
453
|
+
if (result.success) return
|
|
454
|
+
expect(result.error.issues.some((i) => i.path.includes('priceColumns') && i.path.includes('key'))).toBe(true)
|
|
455
|
+
})
|
|
456
|
+
|
|
457
|
+
it('V-PT-1: rejects priceColumn with empty label', () => {
|
|
458
|
+
const result = cpqPricingTableCreateSchema.safeParse({
|
|
459
|
+
code: 'PT',
|
|
460
|
+
name: 'PT',
|
|
461
|
+
dimensions: [{ key: 'dc', label: 'Datacenter' }],
|
|
462
|
+
priceColumns: [{ key: 'list', label: '' }],
|
|
463
|
+
currencyCodeList: ['USD'],
|
|
464
|
+
})
|
|
465
|
+
expect(result.success).toBe(false)
|
|
466
|
+
if (result.success) return
|
|
467
|
+
expect(result.error.issues.some((i) => i.path.includes('priceColumns') && i.path.includes('label'))).toBe(true)
|
|
468
|
+
})
|
|
469
|
+
|
|
470
|
+
it('V-PT-1: rejects duplicate dimension keys', () => {
|
|
471
|
+
const result = cpqPricingTableCreateSchema.safeParse({
|
|
472
|
+
code: 'PT',
|
|
473
|
+
name: 'PT',
|
|
474
|
+
dimensions: [
|
|
475
|
+
{ key: 'dc', label: 'Datacenter' },
|
|
476
|
+
{ key: 'dc', label: 'Datacenter again' },
|
|
477
|
+
],
|
|
478
|
+
priceColumns: [{ key: 'list', label: 'List' }],
|
|
479
|
+
currencyCodeList: ['USD'],
|
|
480
|
+
})
|
|
481
|
+
expect(result.success).toBe(false)
|
|
482
|
+
if (result.success) return
|
|
483
|
+
expect(result.error.issues.some((i) => /duplicate/.test(i.message))).toBe(true)
|
|
484
|
+
})
|
|
485
|
+
|
|
486
|
+
it('V-PT-1: rejects duplicate priceColumn keys', () => {
|
|
487
|
+
const result = cpqPricingTableCreateSchema.safeParse({
|
|
488
|
+
code: 'PT',
|
|
489
|
+
name: 'PT',
|
|
490
|
+
dimensions: [{ key: 'dc', label: 'Datacenter' }],
|
|
491
|
+
priceColumns: [
|
|
492
|
+
{ key: 'list', label: 'List' },
|
|
493
|
+
{ key: 'list', label: 'List dup' },
|
|
494
|
+
],
|
|
495
|
+
currencyCodeList: ['USD'],
|
|
496
|
+
})
|
|
497
|
+
expect(result.success).toBe(false)
|
|
498
|
+
if (result.success) return
|
|
499
|
+
expect(result.error.issues.some((i) => /duplicate/.test(i.message))).toBe(true)
|
|
500
|
+
})
|
|
501
|
+
|
|
502
|
+
it('V-PT-1: accepts empty dimensions / priceColumns arrays (table with no lookup keys yet)', () => {
|
|
503
|
+
const result = cpqPricingTableCreateSchema.safeParse({
|
|
504
|
+
code: 'PT',
|
|
505
|
+
name: 'PT',
|
|
506
|
+
dimensions: [],
|
|
507
|
+
priceColumns: [],
|
|
508
|
+
currencyCodeList: ['USD'],
|
|
509
|
+
})
|
|
510
|
+
expect(result.success).toBe(true)
|
|
511
|
+
})
|
|
512
|
+
})
|
|
513
|
+
|
|
514
|
+
describe('cpqPricingTableEntryCreateSchema', () => {
|
|
515
|
+
it('defaults currencyCode to USD', () => {
|
|
516
|
+
const result = cpqPricingTableEntryCreateSchema.safeParse({
|
|
517
|
+
pricingTableId: VALID_UUID,
|
|
518
|
+
dimensionValues: { dc: 'equinix-ld5' },
|
|
519
|
+
prices: { list: 100 },
|
|
520
|
+
})
|
|
521
|
+
expect(result.success).toBe(true)
|
|
522
|
+
if (!result.success) return
|
|
523
|
+
expect(result.data.currencyCode).toBe('USD')
|
|
524
|
+
})
|
|
525
|
+
|
|
526
|
+
it('rejects missing prices', () => {
|
|
527
|
+
const result = cpqPricingTableEntryCreateSchema.safeParse({
|
|
528
|
+
pricingTableId: VALID_UUID,
|
|
529
|
+
dimensionValues: { dc: 'equinix-ld5' },
|
|
530
|
+
})
|
|
531
|
+
expect(result.success).toBe(false)
|
|
532
|
+
})
|
|
533
|
+
})
|
|
534
|
+
|
|
535
|
+
describe('cpqCreateQuoteSchema', () => {
|
|
536
|
+
it('requires customerId UUID', () => {
|
|
537
|
+
const result = cpqCreateQuoteSchema.safeParse({})
|
|
538
|
+
expect(result.success).toBe(false)
|
|
539
|
+
if (result.success) return
|
|
540
|
+
expect(result.error.issues.some((i) => i.path[0] === 'customerId')).toBe(true)
|
|
541
|
+
})
|
|
542
|
+
|
|
543
|
+
it('accepts customerId only', () => {
|
|
544
|
+
const result = cpqCreateQuoteSchema.safeParse({ customerId: VALID_UUID })
|
|
545
|
+
expect(result.success).toBe(true)
|
|
546
|
+
})
|
|
547
|
+
})
|
|
548
|
+
|
|
549
|
+
describe('cpqAddQuoteItemSchema', () => {
|
|
550
|
+
it('defaults action=add, quantity=1, configuration={}', () => {
|
|
551
|
+
const result = cpqAddQuoteItemSchema.safeParse({})
|
|
552
|
+
expect(result.success).toBe(true)
|
|
553
|
+
if (!result.success) return
|
|
554
|
+
expect(result.data.action).toBe('add')
|
|
555
|
+
expect(result.data.quantity).toBe(1)
|
|
556
|
+
expect(result.data.configuration).toEqual({})
|
|
557
|
+
})
|
|
558
|
+
|
|
559
|
+
it('rejects quantity < 1', () => {
|
|
560
|
+
const result = cpqAddQuoteItemSchema.safeParse({ quantity: 0 })
|
|
561
|
+
expect(result.success).toBe(false)
|
|
562
|
+
})
|
|
563
|
+
|
|
564
|
+
it.each(['add', 'modify', 'cancel'] as const)('accepts action=%s', (action) => {
|
|
565
|
+
expect(cpqAddQuoteItemSchema.safeParse({ action }).success).toBe(true)
|
|
566
|
+
})
|
|
567
|
+
|
|
568
|
+
it('accepts usage estimates with chargeCode and estimatedQuantity', () => {
|
|
569
|
+
const result = cpqAddQuoteItemSchema.safeParse({
|
|
570
|
+
usageEstimates: [{ chargeCode: 'data_xfer', estimatedQuantity: 100 }],
|
|
571
|
+
})
|
|
572
|
+
expect(result.success).toBe(true)
|
|
573
|
+
})
|
|
574
|
+
|
|
575
|
+
it('rejects negative estimatedQuantity', () => {
|
|
576
|
+
const result = cpqAddQuoteItemSchema.safeParse({
|
|
577
|
+
usageEstimates: [{ chargeCode: 'data_xfer', estimatedQuantity: -1 }],
|
|
578
|
+
})
|
|
579
|
+
expect(result.success).toBe(false)
|
|
580
|
+
})
|
|
581
|
+
})
|
|
582
|
+
|
|
583
|
+
describe('cpqUpdateQuoteItemSchema', () => {
|
|
584
|
+
it('requires configuration', () => {
|
|
585
|
+
const result = cpqUpdateQuoteItemSchema.safeParse({ quantity: 5 })
|
|
586
|
+
expect(result.success).toBe(false)
|
|
587
|
+
if (result.success) return
|
|
588
|
+
expect(result.error.issues.some((i) => i.path[0] === 'configuration')).toBe(true)
|
|
589
|
+
})
|
|
590
|
+
})
|
|
591
|
+
|
|
592
|
+
describe('cpqRecalculateSchema', () => {
|
|
593
|
+
it('requires save: boolean', () => {
|
|
594
|
+
expect(cpqRecalculateSchema.safeParse({ save: true }).success).toBe(true)
|
|
595
|
+
expect(cpqRecalculateSchema.safeParse({ save: false }).success).toBe(true)
|
|
596
|
+
expect(cpqRecalculateSchema.safeParse({}).success).toBe(false)
|
|
597
|
+
expect(cpqRecalculateSchema.safeParse({ save: 'yes' }).success).toBe(false)
|
|
598
|
+
})
|
|
599
|
+
})
|
|
600
|
+
|
|
601
|
+
describe('cpqTransitionStatusSchema', () => {
|
|
602
|
+
it('requires non-empty targetStatus', () => {
|
|
603
|
+
expect(cpqTransitionStatusSchema.safeParse({ targetStatus: 'ready' }).success).toBe(true)
|
|
604
|
+
expect(cpqTransitionStatusSchema.safeParse({ targetStatus: '' }).success).toBe(false)
|
|
605
|
+
expect(cpqTransitionStatusSchema.safeParse({}).success).toBe(false)
|
|
606
|
+
})
|
|
607
|
+
})
|
|
608
|
+
|
|
609
|
+
describe('cpqValidateRelationshipsSchema', () => {
|
|
610
|
+
it('accepts a list of UUIDs', () => {
|
|
611
|
+
const result = cpqValidateRelationshipsSchema.safeParse({
|
|
612
|
+
offeringIds: [VALID_UUID, VALID_UUID_2],
|
|
613
|
+
})
|
|
614
|
+
expect(result.success).toBe(true)
|
|
615
|
+
})
|
|
616
|
+
|
|
617
|
+
it('rejects non-UUID entries', () => {
|
|
618
|
+
const result = cpqValidateRelationshipsSchema.safeParse({
|
|
619
|
+
offeringIds: ['not-a-uuid'],
|
|
620
|
+
})
|
|
621
|
+
expect(result.success).toBe(false)
|
|
622
|
+
})
|
|
623
|
+
|
|
624
|
+
it('accepts optional parentChildPairs', () => {
|
|
625
|
+
const result = cpqValidateRelationshipsSchema.safeParse({
|
|
626
|
+
offeringIds: [VALID_UUID],
|
|
627
|
+
parentChildPairs: [{ parentOfferingId: VALID_UUID, childOfferingId: VALID_UUID_2 }],
|
|
628
|
+
})
|
|
629
|
+
expect(result.success).toBe(true)
|
|
630
|
+
})
|
|
631
|
+
})
|
|
632
|
+
|
|
633
|
+
describe('cpqPricePreviewSchema', () => {
|
|
634
|
+
it('requires childItems even when empty', () => {
|
|
635
|
+
expect(cpqPricePreviewSchema.safeParse({ childItems: [] }).success).toBe(true)
|
|
636
|
+
expect(cpqPricePreviewSchema.safeParse({}).success).toBe(false)
|
|
637
|
+
})
|
|
638
|
+
|
|
639
|
+
it('refines: each item must supply offeringId or productId', () => {
|
|
640
|
+
const result = cpqPricePreviewSchema.safeParse({
|
|
641
|
+
primaryItem: { configuration: {} },
|
|
642
|
+
childItems: [],
|
|
643
|
+
})
|
|
644
|
+
expect(result.success).toBe(false)
|
|
645
|
+
if (result.success) return
|
|
646
|
+
expect(result.error.issues[0]?.message).toMatch(/offeringId or productId/)
|
|
647
|
+
})
|
|
648
|
+
|
|
649
|
+
it('accepts a primary with offeringId only', () => {
|
|
650
|
+
const result = cpqPricePreviewSchema.safeParse({
|
|
651
|
+
primaryItem: { offeringId: VALID_UUID, configuration: {} },
|
|
652
|
+
childItems: [],
|
|
653
|
+
})
|
|
654
|
+
expect(result.success).toBe(true)
|
|
655
|
+
})
|
|
656
|
+
})
|
|
657
|
+
|
|
658
|
+
describe('cpqWizardDefinitionCreateSchema', () => {
|
|
659
|
+
it('requires at least one step', () => {
|
|
660
|
+
const result = cpqWizardDefinitionCreateSchema.safeParse({
|
|
661
|
+
code: 'wiz',
|
|
662
|
+
name: 'Wiz',
|
|
663
|
+
steps: [],
|
|
664
|
+
})
|
|
665
|
+
expect(result.success).toBe(false)
|
|
666
|
+
if (result.success) return
|
|
667
|
+
expect(result.error.issues.some((i) => i.path[0] === 'steps')).toBe(true)
|
|
668
|
+
})
|
|
669
|
+
|
|
670
|
+
it('rejects an unknown transition operator', () => {
|
|
671
|
+
const result = cpqWizardDefinitionCreateSchema.safeParse({
|
|
672
|
+
code: 'wiz',
|
|
673
|
+
name: 'Wiz',
|
|
674
|
+
steps: [
|
|
675
|
+
{
|
|
676
|
+
stepId: 's1',
|
|
677
|
+
type: 'form',
|
|
678
|
+
title: 'Step 1',
|
|
679
|
+
transitions: [
|
|
680
|
+
{
|
|
681
|
+
targetStepId: 's2',
|
|
682
|
+
condition: { field: 'x', operator: 'unknown' as never },
|
|
683
|
+
},
|
|
684
|
+
],
|
|
685
|
+
},
|
|
686
|
+
],
|
|
687
|
+
})
|
|
688
|
+
expect(result.success).toBe(false)
|
|
689
|
+
})
|
|
690
|
+
|
|
691
|
+
it('defaults isOptional=false and surface=backend', () => {
|
|
692
|
+
const result = cpqWizardDefinitionCreateSchema.safeParse({
|
|
693
|
+
code: 'wiz',
|
|
694
|
+
name: 'Wiz',
|
|
695
|
+
steps: [{ stepId: 's1', type: 'form', title: 'Step 1' }],
|
|
696
|
+
})
|
|
697
|
+
expect(result.success).toBe(true)
|
|
698
|
+
if (!result.success) return
|
|
699
|
+
expect(result.data.steps[0].isOptional).toBe(false)
|
|
700
|
+
expect(result.data.surface).toBe('backend')
|
|
701
|
+
})
|
|
702
|
+
})
|
|
703
|
+
|
|
704
|
+
describe('cpqInventorySubscriptionCreateSchema', () => {
|
|
705
|
+
it('requires at least one item', () => {
|
|
706
|
+
const result = cpqInventorySubscriptionCreateSchema.safeParse({
|
|
707
|
+
customerId: VALID_UUID,
|
|
708
|
+
name: 'Sub',
|
|
709
|
+
items: [],
|
|
710
|
+
})
|
|
711
|
+
expect(result.success).toBe(false)
|
|
712
|
+
if (result.success) return
|
|
713
|
+
expect(result.error.issues.some((i) => i.path[0] === 'items')).toBe(true)
|
|
714
|
+
})
|
|
715
|
+
|
|
716
|
+
it('defaults billingCycle to monthly and autoRenew to true', () => {
|
|
717
|
+
const result = cpqInventorySubscriptionCreateSchema.safeParse({
|
|
718
|
+
customerId: VALID_UUID,
|
|
719
|
+
name: 'Sub',
|
|
720
|
+
items: [{ name: 'Line 1' }],
|
|
721
|
+
})
|
|
722
|
+
expect(result.success).toBe(true)
|
|
723
|
+
if (!result.success) return
|
|
724
|
+
expect(result.data.billingCycle).toBe('monthly')
|
|
725
|
+
expect(result.data.autoRenew).toBe(true)
|
|
726
|
+
})
|
|
727
|
+
|
|
728
|
+
it.each(['monthly', 'quarterly', 'annually'] as const)(
|
|
729
|
+
'accepts billingCycle=%s',
|
|
730
|
+
(billingCycle) => {
|
|
731
|
+
expect(
|
|
732
|
+
cpqInventorySubscriptionCreateSchema.safeParse({
|
|
733
|
+
customerId: VALID_UUID,
|
|
734
|
+
name: 'Sub',
|
|
735
|
+
billingCycle,
|
|
736
|
+
items: [{ name: 'Line 1' }],
|
|
737
|
+
}).success,
|
|
738
|
+
).toBe(true)
|
|
739
|
+
},
|
|
740
|
+
)
|
|
741
|
+
})
|
|
742
|
+
|
|
743
|
+
describe('cpqInventoryAssetCreateSchema', () => {
|
|
744
|
+
it('defaults assetType to one_time and quantity to 1', () => {
|
|
745
|
+
const result = cpqInventoryAssetCreateSchema.safeParse({
|
|
746
|
+
customerId: VALID_UUID,
|
|
747
|
+
name: 'Asset',
|
|
748
|
+
})
|
|
749
|
+
expect(result.success).toBe(true)
|
|
750
|
+
if (!result.success) return
|
|
751
|
+
expect(result.data.assetType).toBe('one_time')
|
|
752
|
+
expect(result.data.quantity).toBe(1)
|
|
753
|
+
})
|
|
754
|
+
|
|
755
|
+
it.each(['one_time', 'license', 'physical', 'logical'] as const)(
|
|
756
|
+
'accepts assetType=%s',
|
|
757
|
+
(assetType) => {
|
|
758
|
+
expect(
|
|
759
|
+
cpqInventoryAssetCreateSchema.safeParse({
|
|
760
|
+
customerId: VALID_UUID,
|
|
761
|
+
name: 'Asset',
|
|
762
|
+
assetType,
|
|
763
|
+
}).success,
|
|
764
|
+
).toBe(true)
|
|
765
|
+
},
|
|
766
|
+
)
|
|
767
|
+
})
|
|
768
|
+
|
|
769
|
+
describe('cpqConvertQuoteToOrderSchema', () => {
|
|
770
|
+
it('requires quoteId UUID', () => {
|
|
771
|
+
expect(cpqConvertQuoteToOrderSchema.safeParse({ quoteId: VALID_UUID }).success).toBe(true)
|
|
772
|
+
expect(cpqConvertQuoteToOrderSchema.safeParse({}).success).toBe(false)
|
|
773
|
+
expect(cpqConvertQuoteToOrderSchema.safeParse({ quoteId: 'nope' }).success).toBe(false)
|
|
774
|
+
})
|
|
775
|
+
})
|
|
776
|
+
|
|
777
|
+
describe('cpqOrderStatusTransitionSchema', () => {
|
|
778
|
+
it('requires non-empty targetStatus', () => {
|
|
779
|
+
expect(cpqOrderStatusTransitionSchema.safeParse({ targetStatus: 'active' }).success).toBe(true)
|
|
780
|
+
expect(cpqOrderStatusTransitionSchema.safeParse({ targetStatus: '' }).success).toBe(false)
|
|
781
|
+
})
|
|
782
|
+
})
|