@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,62 @@
|
|
|
1
|
+
import { Migration } from '@mikro-orm/migrations'
|
|
2
|
+
|
|
3
|
+
export class Migration20260411000000_cpq_orders extends Migration {
|
|
4
|
+
async up(): Promise<void> {
|
|
5
|
+
this.addSql(`create table if not exists "cpq_order_configurations" (
|
|
6
|
+
"id" uuid not null default gen_random_uuid(),
|
|
7
|
+
"organization_id" uuid not null,
|
|
8
|
+
"tenant_id" uuid not null,
|
|
9
|
+
"order_id" uuid not null,
|
|
10
|
+
"source_quote_id" uuid null,
|
|
11
|
+
"customer_id" uuid not null,
|
|
12
|
+
"cpq_status" text not null default 'draft',
|
|
13
|
+
"currency_code" text not null default 'USD',
|
|
14
|
+
"pricing_summary" jsonb null,
|
|
15
|
+
"metadata" jsonb null,
|
|
16
|
+
"activated_at" timestamptz null,
|
|
17
|
+
"created_at" timestamptz not null,
|
|
18
|
+
"updated_at" timestamptz not null,
|
|
19
|
+
"deleted_at" timestamptz null,
|
|
20
|
+
constraint "cpq_order_configurations_pkey" primary key ("id")
|
|
21
|
+
);`)
|
|
22
|
+
this.addSql(`create unique index if not exists "cpq_order_configurations_order_unique" on "cpq_order_configurations" ("organization_id", "tenant_id", "order_id");`)
|
|
23
|
+
this.addSql(`create index if not exists "cpq_order_configurations_scope_idx" on "cpq_order_configurations" ("organization_id", "tenant_id");`)
|
|
24
|
+
this.addSql(`create index if not exists "cpq_order_configurations_customer_idx" on "cpq_order_configurations" ("organization_id", "tenant_id", "customer_id");`)
|
|
25
|
+
this.addSql(`create index if not exists "cpq_order_configurations_source_quote_idx" on "cpq_order_configurations" ("organization_id", "tenant_id", "source_quote_id");`)
|
|
26
|
+
this.addSql(`create index if not exists "cpq_order_configurations_status_idx" on "cpq_order_configurations" ("organization_id", "tenant_id", "cpq_status");`)
|
|
27
|
+
|
|
28
|
+
this.addSql(`create table if not exists "cpq_order_line_configurations" (
|
|
29
|
+
"id" uuid not null default gen_random_uuid(),
|
|
30
|
+
"organization_id" uuid not null,
|
|
31
|
+
"tenant_id" uuid not null,
|
|
32
|
+
"order_line_id" uuid not null,
|
|
33
|
+
"order_configuration_id" uuid not null,
|
|
34
|
+
"offering_id" uuid null,
|
|
35
|
+
"product_id" uuid null,
|
|
36
|
+
"spec_id" uuid null,
|
|
37
|
+
"action" text not null default 'add',
|
|
38
|
+
"parent_line_id" uuid null,
|
|
39
|
+
"start_date" date null,
|
|
40
|
+
"term_months" int null,
|
|
41
|
+
"end_date" date null,
|
|
42
|
+
"configuration" jsonb not null default '{}',
|
|
43
|
+
"quantity" int not null default 1,
|
|
44
|
+
"charges" jsonb null,
|
|
45
|
+
"nrc_total" numeric(18, 4) not null default 0,
|
|
46
|
+
"mrc_total" numeric(18, 4) not null default 0,
|
|
47
|
+
"source_quote_line_id" uuid null,
|
|
48
|
+
"created_at" timestamptz not null,
|
|
49
|
+
"updated_at" timestamptz not null,
|
|
50
|
+
"deleted_at" timestamptz null,
|
|
51
|
+
constraint "cpq_order_line_configurations_pkey" primary key ("id")
|
|
52
|
+
);`)
|
|
53
|
+
this.addSql(`create unique index if not exists "cpq_olc_order_line_unique" on "cpq_order_line_configurations" ("organization_id", "tenant_id", "order_line_id");`)
|
|
54
|
+
this.addSql(`create index if not exists "cpq_olc_order_config_idx" on "cpq_order_line_configurations" ("organization_id", "tenant_id", "order_configuration_id");`)
|
|
55
|
+
this.addSql(`create index if not exists "cpq_olc_parent_line_idx" on "cpq_order_line_configurations" ("organization_id", "tenant_id", "parent_line_id");`)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
async down(): Promise<void> {
|
|
59
|
+
this.addSql(`drop table if exists "cpq_order_line_configurations" cascade;`)
|
|
60
|
+
this.addSql(`drop table if exists "cpq_order_configurations" cascade;`)
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Migration } from '@mikro-orm/migrations'
|
|
2
|
+
|
|
3
|
+
export class Migration20260412000000_cpq_bundled_offerings extends Migration {
|
|
4
|
+
async up(): Promise<void> {
|
|
5
|
+
// Extend CpqProductSpecification with spec_type and is_assetizable
|
|
6
|
+
this.addSql(`alter table "cpq_product_specifications" add column "spec_type" text not null default 'simple';`)
|
|
7
|
+
this.addSql(`alter table "cpq_product_specifications" add column "is_assetizable" boolean not null default false;`)
|
|
8
|
+
|
|
9
|
+
// Extend CpqProductOffering with offering_type
|
|
10
|
+
this.addSql(`alter table "cpq_product_offerings" add column "offering_type" text not null default 'simple';`)
|
|
11
|
+
|
|
12
|
+
// CpqBundleSlot — structural slot within a bundle specification
|
|
13
|
+
this.addSql(`create table "cpq_bundle_slots" ("id" uuid not null default gen_random_uuid(), "organization_id" uuid not null, "tenant_id" uuid not null, "spec_id" uuid not null, "target_spec_id" uuid not null, "component_group" text not null, "name" text not null, "description" text null, "cardinality_min" integer not null default 0, "cardinality_max" integer null, "sort_order" integer not null default 0, "is_active" boolean not null default true, "metadata" jsonb null, "created_at" timestamptz not null, "updated_at" timestamptz not null, "deleted_at" timestamptz null, constraint "cpq_bundle_slots_pkey" primary key ("id"));`)
|
|
14
|
+
this.addSql(`create index "cpq_bundle_slot_spec_idx" on "cpq_bundle_slots" ("organization_id", "tenant_id", "spec_id");`)
|
|
15
|
+
this.addSql(`create index "cpq_bundle_slot_target_idx" on "cpq_bundle_slots" ("organization_id", "tenant_id", "target_spec_id");`)
|
|
16
|
+
this.addSql(`create index "cpq_bundle_slot_group_idx" on "cpq_bundle_slots" ("organization_id", "tenant_id", "spec_id", "component_group");`)
|
|
17
|
+
|
|
18
|
+
// CpqOfferingComponent — links bundle offering to component offerings
|
|
19
|
+
this.addSql(`create table "cpq_offering_components" ("id" uuid not null default gen_random_uuid(), "organization_id" uuid not null, "tenant_id" uuid not null, "offering_id" uuid not null, "slot_id" uuid not null, "child_offering_id" uuid not null, "is_default" boolean not null default false, "sort_order" integer not null default 0, "is_active" boolean not null default true, "metadata" jsonb null, "created_at" timestamptz not null, "updated_at" timestamptz not null, "deleted_at" timestamptz null, constraint "cpq_offering_components_pkey" primary key ("id"));`)
|
|
20
|
+
this.addSql(`create index "cpq_off_comp_offering_idx" on "cpq_offering_components" ("organization_id", "tenant_id", "offering_id");`)
|
|
21
|
+
this.addSql(`create index "cpq_off_comp_slot_idx" on "cpq_offering_components" ("organization_id", "tenant_id", "offering_id", "slot_id");`)
|
|
22
|
+
this.addSql(`create index "cpq_off_comp_child_idx" on "cpq_offering_components" ("organization_id", "tenant_id", "child_offering_id");`)
|
|
23
|
+
this.addSql(`alter table "cpq_offering_components" add constraint "cpq_off_comp_unique" unique ("organization_id", "tenant_id", "offering_id", "child_offering_id");`)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
async down(): Promise<void> {
|
|
27
|
+
this.addSql(`drop table if exists "cpq_offering_components" cascade;`)
|
|
28
|
+
this.addSql(`drop table if exists "cpq_bundle_slots" cascade;`)
|
|
29
|
+
this.addSql(`alter table "cpq_product_offerings" drop column if exists "offering_type";`)
|
|
30
|
+
this.addSql(`alter table "cpq_product_specifications" drop column if exists "is_assetizable";`)
|
|
31
|
+
this.addSql(`alter table "cpq_product_specifications" drop column if exists "spec_type";`)
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { Migration } from '@mikro-orm/migrations'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* XD-250 ARC (Amend / Renew / Cancel) — Phase 1 schema.
|
|
5
|
+
*
|
|
6
|
+
* Adds:
|
|
7
|
+
* - `cpq_quote_target_subscriptions` (junction quote ↔ subscription target)
|
|
8
|
+
* - `cpq_subscription_change_logs` (append-only audit per ARC operation)
|
|
9
|
+
* - ARC discriminator + meta columns on `cpq_quote_configurations`
|
|
10
|
+
* - per-line target / source-item columns on `cpq_quote_line_configurations`
|
|
11
|
+
* - term-start, merged-into, last-change-log + optimistic-lock `version`
|
|
12
|
+
* on `cpq_inventory_subscriptions`
|
|
13
|
+
*/
|
|
14
|
+
export class Migration20260504064621_cpq_arc extends Migration {
|
|
15
|
+
|
|
16
|
+
override async up(): Promise<void> {
|
|
17
|
+
// ── New table: cpq_quote_target_subscriptions ─────────────────
|
|
18
|
+
this.addSql(`create table "cpq_quote_target_subscriptions" ("id" uuid not null default gen_random_uuid(), "organization_id" uuid not null, "tenant_id" uuid not null, "quote_id" uuid not null, "subscription_id" uuid not null, "quote_type" text not null, "merge_action" text null, "new_term_start" date null, "new_term_end" date null, "new_term_months" int null, "created_at" timestamptz not null, "updated_at" timestamptz not null, "deleted_at" timestamptz null, constraint "cpq_quote_target_subscriptions_pkey" primary key ("id"));`)
|
|
19
|
+
this.addSql(`create index "cpq_qts_sub_type_idx" on "cpq_quote_target_subscriptions" ("organization_id", "tenant_id", "subscription_id", "quote_type");`)
|
|
20
|
+
this.addSql(`create index "cpq_qts_quote_idx" on "cpq_quote_target_subscriptions" ("organization_id", "tenant_id", "quote_id");`)
|
|
21
|
+
this.addSql(`alter table "cpq_quote_target_subscriptions" add constraint "cpq_qts_quote_sub_unique" unique ("organization_id", "tenant_id", "quote_id", "subscription_id");`)
|
|
22
|
+
|
|
23
|
+
// ── New table: cpq_subscription_change_logs (append-only audit) ──
|
|
24
|
+
this.addSql(`create table "cpq_subscription_change_logs" ("id" uuid not null default gen_random_uuid(), "organization_id" uuid not null, "tenant_id" uuid not null, "subscription_id" uuid not null, "change_type" text not null, "source_quote_id" uuid null, "source_order_id" uuid null, "performed_by_user_id" uuid null, "effective_at" timestamptz not null, "before_snapshot" jsonb null, "after_snapshot" jsonb null, "line_changes" jsonb null, "term_change" jsonb null, "merged_into_subscription_id" uuid null, "merged_from_subscription_ids" jsonb null, "reason_code" text null, "reason_text" text null, "etf_amount" numeric(18, 4) null, "etf_currency" text null, "created_at" timestamptz not null, "deleted_at" timestamptz null, constraint "cpq_subscription_change_logs_pkey" primary key ("id"));`)
|
|
25
|
+
this.addSql(`create index "cpq_scl_merged_into_idx" on "cpq_subscription_change_logs" ("merged_into_subscription_id");`)
|
|
26
|
+
this.addSql(`create index "cpq_scl_source_order_idx" on "cpq_subscription_change_logs" ("source_order_id");`)
|
|
27
|
+
this.addSql(`create index "cpq_scl_sub_history_idx" on "cpq_subscription_change_logs" ("organization_id", "tenant_id", "subscription_id", "created_at");`)
|
|
28
|
+
// Activation idempotency: PostgreSQL treats NULLs as distinct, so multiple
|
|
29
|
+
// rows with NULL source_order_id can coexist for the same subscription.
|
|
30
|
+
this.addSql(`alter table "cpq_subscription_change_logs" add constraint "cpq_scl_order_sub_unique" unique ("source_order_id", "subscription_id");`)
|
|
31
|
+
|
|
32
|
+
// ── Existing table: cpq_inventory_subscriptions ───────────────
|
|
33
|
+
// currentTermStart complements existing currentTermEnd; mergedIntoSubscriptionId
|
|
34
|
+
// is set only when this row is a merge source; lastChangeLogId is a
|
|
35
|
+
// convenience pointer; version is a MikroORM optimistic-lock counter.
|
|
36
|
+
this.addSql(`alter table "cpq_inventory_subscriptions" add column "current_term_start" date null, add column "merged_into_subscription_id" uuid null, add column "last_change_log_id" uuid null, add column "version" int not null default 1;`)
|
|
37
|
+
this.addSql(`create index "cpq_inventory_subscriptions_merged_into_idx" on "cpq_inventory_subscriptions" ("organization_id", "tenant_id", "merged_into_subscription_id");`)
|
|
38
|
+
this.addSql(`create index "cpq_inventory_subscriptions_term_end_idx" on "cpq_inventory_subscriptions" ("organization_id", "tenant_id", "current_term_end");`)
|
|
39
|
+
|
|
40
|
+
// ── Existing table: cpq_quote_configurations ──────────────────
|
|
41
|
+
// quote_type discriminates ARC quotes; arc_reason_*/etf_*/merge_* fields
|
|
42
|
+
// carry ARC meta forward to order activation.
|
|
43
|
+
this.addSql(`alter table "cpq_quote_configurations" add column "quote_type" text not null default 'new', add column "arc_reason_code" text null, add column "arc_reason_text" text null, add column "arc_etf_amount" numeric(18, 4) null, add column "arc_etf_currency" text null, add column "arc_merge_new_term_start" date null, add column "arc_merge_new_term_end" date null, add column "arc_merge_new_term_months" int null, add column "arc_merge_new_sub_code" text null, add column "arc_merge_new_sub_name" text null;`)
|
|
44
|
+
this.addSql(`create index "cpq_quote_configurations_quote_type_idx" on "cpq_quote_configurations" ("organization_id", "tenant_id", "quote_type");`)
|
|
45
|
+
|
|
46
|
+
// ── Existing table: cpq_quote_line_configurations ─────────────
|
|
47
|
+
// target_subscription_id identifies which target sub the line affects;
|
|
48
|
+
// source_subscription_item_id points at the item being changed for
|
|
49
|
+
// cancel/modify lines.
|
|
50
|
+
this.addSql(`alter table "cpq_quote_line_configurations" add column "target_subscription_id" uuid null, add column "source_subscription_item_id" uuid null;`)
|
|
51
|
+
this.addSql(`create index "cpq_qlc_target_sub_idx" on "cpq_quote_line_configurations" ("organization_id", "tenant_id", "target_subscription_id");`)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
override async down(): Promise<void> {
|
|
55
|
+
this.addSql(`drop index "cpq_qlc_target_sub_idx";`)
|
|
56
|
+
this.addSql(`alter table "cpq_quote_line_configurations" drop column "target_subscription_id", drop column "source_subscription_item_id";`)
|
|
57
|
+
|
|
58
|
+
this.addSql(`drop index "cpq_quote_configurations_quote_type_idx";`)
|
|
59
|
+
this.addSql(`alter table "cpq_quote_configurations" drop column "quote_type", drop column "arc_reason_code", drop column "arc_reason_text", drop column "arc_etf_amount", drop column "arc_etf_currency", drop column "arc_merge_new_term_start", drop column "arc_merge_new_term_end", drop column "arc_merge_new_term_months", drop column "arc_merge_new_sub_code", drop column "arc_merge_new_sub_name";`)
|
|
60
|
+
|
|
61
|
+
this.addSql(`drop index "cpq_inventory_subscriptions_merged_into_idx";`)
|
|
62
|
+
this.addSql(`drop index "cpq_inventory_subscriptions_term_end_idx";`)
|
|
63
|
+
this.addSql(`alter table "cpq_inventory_subscriptions" drop column "current_term_start", drop column "merged_into_subscription_id", drop column "last_change_log_id", drop column "version";`)
|
|
64
|
+
|
|
65
|
+
this.addSql(`drop table if exists "cpq_subscription_change_logs" cascade;`)
|
|
66
|
+
this.addSql(`drop table if exists "cpq_quote_target_subscriptions" cascade;`)
|
|
67
|
+
}
|
|
68
|
+
}
|
package/src/modules/cpq/migrations/Migration20260514000000_cpq_spec_merge_retired_deprecated.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Migration } from '@mikro-orm/migrations'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Merge the `retired` lifecycle status into `deprecated` for product
|
|
5
|
+
* specifications. Reviewers found the two states redundant for spec
|
|
6
|
+
* semantics (`deprecated` already conveys "do not use for new work").
|
|
7
|
+
*
|
|
8
|
+
* Scope: ONLY `cpq_product_specifications`. Offerings keep four states
|
|
9
|
+
* because the user-facing semantics differ — a `retired` offering cannot
|
|
10
|
+
* be sold at all, while `deprecated` offerings can still be sold but are
|
|
11
|
+
* discouraged. That distinction does not apply at the specification
|
|
12
|
+
* level (specs describe the product shape, not the sellability).
|
|
13
|
+
*
|
|
14
|
+
* Data-only migration: the underlying column is `text` so no schema
|
|
15
|
+
* change is required. The Zod validator on the API now rejects
|
|
16
|
+
* `'retired'` for new writes.
|
|
17
|
+
*/
|
|
18
|
+
export class Migration20260514000000_cpq_spec_merge_retired_deprecated extends Migration {
|
|
19
|
+
async up(): Promise<void> {
|
|
20
|
+
this.addSql(
|
|
21
|
+
`update "cpq_product_specifications" set "lifecycle_status" = 'deprecated' where "lifecycle_status" = 'retired';`,
|
|
22
|
+
)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
async down(): Promise<void> {
|
|
26
|
+
// Lossy: there's no way to know which rows were originally `retired`
|
|
27
|
+
// vs originally `deprecated` once the merge runs. Down() is a no-op
|
|
28
|
+
// so a rollback doesn't silently fabricate a status.
|
|
29
|
+
}
|
|
30
|
+
}
|
package/src/modules/cpq/migrations/Migration20260514100000_cpq_offering_merge_retired_deprecated.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Migration } from '@mikro-orm/migrations'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Merge the `retired` lifecycle status into `deprecated` for product
|
|
5
|
+
* offerings — same call as the earlier specifications merge
|
|
6
|
+
* (`Migration20260514000000`). Reviewer wanted the offering UI to mirror
|
|
7
|
+
* the specification's 3-state ladder, so we collapse the redundant state
|
|
8
|
+
* and unify both surfaces through the single `LifecycleStatus` type and
|
|
9
|
+
* `lifecycleStatusMap` in `components/statusMaps.ts`.
|
|
10
|
+
*
|
|
11
|
+
* Data-only migration: the underlying column is `text` so no schema
|
|
12
|
+
* change is required. The Zod validator on the API now rejects
|
|
13
|
+
* `'retired'` for new offering writes.
|
|
14
|
+
*/
|
|
15
|
+
export class Migration20260514100000_cpq_offering_merge_retired_deprecated extends Migration {
|
|
16
|
+
async up(): Promise<void> {
|
|
17
|
+
this.addSql(
|
|
18
|
+
`update "cpq_product_offerings" set "lifecycle_status" = 'deprecated' where "lifecycle_status" = 'retired';`,
|
|
19
|
+
)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
async down(): Promise<void> {
|
|
23
|
+
// Lossy: there's no way to tell which rows were originally `retired`
|
|
24
|
+
// vs originally `deprecated` once merged. Same rationale as the
|
|
25
|
+
// specifications merge — leave down() as a no-op.
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { Migration } from '@mikro-orm/migrations'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Scale-prep indexes for the two highest-traffic CPQ list pages
|
|
5
|
+
* (`/backend/cpq/offerings` and `/backend/cpq/specifications`).
|
|
6
|
+
*
|
|
7
|
+
* Why: both endpoints implement free-text search as
|
|
8
|
+
* `$ilike '%term%'` against `code`, `name`, and `description`, which
|
|
9
|
+
* forces a sequential scan on every request once row counts grow.
|
|
10
|
+
* The default sort (`createdAt DESC`) also has no covering index, so
|
|
11
|
+
* pagination of a filtered set degrades linearly with table size.
|
|
12
|
+
*
|
|
13
|
+
* Target: keep both lists snappy at 10k+ rows per tenant — production
|
|
14
|
+
* customers are expected to import multiple thousands of offerings on
|
|
15
|
+
* day one. Hand-written because MikroORM's schema generator does not
|
|
16
|
+
* emit `pg_trgm` GIN operator classes or partial-index predicates.
|
|
17
|
+
*
|
|
18
|
+
* Indexes added per table (`cpq_product_offerings`, `cpq_product_specifications`):
|
|
19
|
+
* - GIN trigram on `code`, `name`, `description` (partial: `deleted_at IS NULL`)
|
|
20
|
+
* - B-tree `(organization_id, tenant_id, deleted_at, created_at DESC)`
|
|
21
|
+
* to cover the default-list scan + sort path.
|
|
22
|
+
*/
|
|
23
|
+
export class Migration20260514110000_cpq_list_search_indexes extends Migration {
|
|
24
|
+
async up(): Promise<void> {
|
|
25
|
+
this.addSql(`create extension if not exists "pg_trgm";`)
|
|
26
|
+
|
|
27
|
+
// ── Offerings ────────────────────────────────────────────────
|
|
28
|
+
this.addSql(
|
|
29
|
+
`create index if not exists "cpq_product_offerings_code_trgm_idx"
|
|
30
|
+
on "cpq_product_offerings" using gin ("code" gin_trgm_ops)
|
|
31
|
+
where "deleted_at" is null;`,
|
|
32
|
+
)
|
|
33
|
+
this.addSql(
|
|
34
|
+
`create index if not exists "cpq_product_offerings_name_trgm_idx"
|
|
35
|
+
on "cpq_product_offerings" using gin ("name" gin_trgm_ops)
|
|
36
|
+
where "deleted_at" is null;`,
|
|
37
|
+
)
|
|
38
|
+
this.addSql(
|
|
39
|
+
`create index if not exists "cpq_product_offerings_description_trgm_idx"
|
|
40
|
+
on "cpq_product_offerings" using gin ("description" gin_trgm_ops)
|
|
41
|
+
where "deleted_at" is null and "description" is not null;`,
|
|
42
|
+
)
|
|
43
|
+
this.addSql(
|
|
44
|
+
`create index if not exists "cpq_product_offerings_list_created_idx"
|
|
45
|
+
on "cpq_product_offerings" ("organization_id", "tenant_id", "deleted_at", "created_at" desc);`,
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
// ── Specifications ───────────────────────────────────────────
|
|
49
|
+
this.addSql(
|
|
50
|
+
`create index if not exists "cpq_product_specifications_code_trgm_idx"
|
|
51
|
+
on "cpq_product_specifications" using gin ("code" gin_trgm_ops)
|
|
52
|
+
where "deleted_at" is null;`,
|
|
53
|
+
)
|
|
54
|
+
this.addSql(
|
|
55
|
+
`create index if not exists "cpq_product_specifications_name_trgm_idx"
|
|
56
|
+
on "cpq_product_specifications" using gin ("name" gin_trgm_ops)
|
|
57
|
+
where "deleted_at" is null;`,
|
|
58
|
+
)
|
|
59
|
+
this.addSql(
|
|
60
|
+
`create index if not exists "cpq_product_specifications_description_trgm_idx"
|
|
61
|
+
on "cpq_product_specifications" using gin ("description" gin_trgm_ops)
|
|
62
|
+
where "deleted_at" is null and "description" is not null;`,
|
|
63
|
+
)
|
|
64
|
+
this.addSql(
|
|
65
|
+
`create index if not exists "cpq_product_specifications_list_created_idx"
|
|
66
|
+
on "cpq_product_specifications" ("organization_id", "tenant_id", "deleted_at", "created_at" desc);`,
|
|
67
|
+
)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
async down(): Promise<void> {
|
|
71
|
+
this.addSql(`drop index if exists "cpq_product_specifications_list_created_idx";`)
|
|
72
|
+
this.addSql(`drop index if exists "cpq_product_specifications_description_trgm_idx";`)
|
|
73
|
+
this.addSql(`drop index if exists "cpq_product_specifications_name_trgm_idx";`)
|
|
74
|
+
this.addSql(`drop index if exists "cpq_product_specifications_code_trgm_idx";`)
|
|
75
|
+
|
|
76
|
+
this.addSql(`drop index if exists "cpq_product_offerings_list_created_idx";`)
|
|
77
|
+
this.addSql(`drop index if exists "cpq_product_offerings_description_trgm_idx";`)
|
|
78
|
+
this.addSql(`drop index if exists "cpq_product_offerings_name_trgm_idx";`)
|
|
79
|
+
this.addSql(`drop index if exists "cpq_product_offerings_code_trgm_idx";`)
|
|
80
|
+
// Extension left in place — other modules may also rely on it.
|
|
81
|
+
}
|
|
82
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Migration } from '@mikro-orm/migrations'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Scale-prep indexes for the customer-inventory subscriptions list.
|
|
5
|
+
*
|
|
6
|
+
* `/backend/cpq/inventory` (Subscriptions tab) lets operators search by
|
|
7
|
+
* code or name with `$ilike '%term%'`, which forces a sequential scan as
|
|
8
|
+
* soon as a tenant accumulates a few thousand subscriptions. The new
|
|
9
|
+
* "Expiring within X days" perspective filters by `currentTermEnd` —
|
|
10
|
+
* already covered by `cpq_inventory_subscriptions_term_end_idx`, but
|
|
11
|
+
* the default sort path `(organization_id, tenant_id, deleted_at,
|
|
12
|
+
* created_at DESC)` had no covering index either.
|
|
13
|
+
*
|
|
14
|
+
* Target: keep the subscriptions list snappy at 10k+ subs per tenant
|
|
15
|
+
* (production telecom-style customers easily hit that).
|
|
16
|
+
*
|
|
17
|
+
* Indexes added (`cpq_inventory_subscriptions`):
|
|
18
|
+
* - GIN trigram on `code` (partial: `deleted_at IS NULL`)
|
|
19
|
+
* - GIN trigram on `name` (partial: `deleted_at IS NULL`)
|
|
20
|
+
* - B-tree `(organization_id, tenant_id, deleted_at, created_at DESC)`
|
|
21
|
+
*
|
|
22
|
+
* Hand-written because MikroORM's schema generator can't emit
|
|
23
|
+
* `gin_trgm_ops` or partial-index predicates. `pg_trgm` is already
|
|
24
|
+
* installed by `Migration20260514110000_cpq_list_search_indexes`.
|
|
25
|
+
*/
|
|
26
|
+
export class Migration20260515000000_cpq_inventory_subscriptions_search_indexes extends Migration {
|
|
27
|
+
async up(): Promise<void> {
|
|
28
|
+
this.addSql(`create extension if not exists "pg_trgm";`)
|
|
29
|
+
|
|
30
|
+
this.addSql(
|
|
31
|
+
`create index if not exists "cpq_inventory_subscriptions_code_trgm_idx"
|
|
32
|
+
on "cpq_inventory_subscriptions" using gin ("code" gin_trgm_ops)
|
|
33
|
+
where "deleted_at" is null;`,
|
|
34
|
+
)
|
|
35
|
+
this.addSql(
|
|
36
|
+
`create index if not exists "cpq_inventory_subscriptions_name_trgm_idx"
|
|
37
|
+
on "cpq_inventory_subscriptions" using gin ("name" gin_trgm_ops)
|
|
38
|
+
where "deleted_at" is null;`,
|
|
39
|
+
)
|
|
40
|
+
this.addSql(
|
|
41
|
+
`create index if not exists "cpq_inventory_subscriptions_list_created_idx"
|
|
42
|
+
on "cpq_inventory_subscriptions" ("organization_id", "tenant_id", "deleted_at", "created_at" desc);`,
|
|
43
|
+
)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
async down(): Promise<void> {
|
|
47
|
+
this.addSql(`drop index if exists "cpq_inventory_subscriptions_list_created_idx";`)
|
|
48
|
+
this.addSql(`drop index if exists "cpq_inventory_subscriptions_name_trgm_idx";`)
|
|
49
|
+
this.addSql(`drop index if exists "cpq_inventory_subscriptions_code_trgm_idx";`)
|
|
50
|
+
// pg_trgm extension left in place — owned by the earlier migration.
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { TenantScope } from '../../types'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Shared MikroORM EntityManager mock for cpqInventoryService /
|
|
5
|
+
* cpqQuotingService / cpqOrderService unit tests.
|
|
6
|
+
*
|
|
7
|
+
* Mirrors the subset of EM surface those services touch:
|
|
8
|
+
* findOne / find / findAndCount / count / create / persist / flush.
|
|
9
|
+
*
|
|
10
|
+
* `create` returns a shallow-cloned input with a synthetic id when none was
|
|
11
|
+
* supplied — this matches the runtime behavior of `em.create()` returning
|
|
12
|
+
* an entity instance whose primary key gets populated either by user
|
|
13
|
+
* (pre-generated UUID) or by DB default at flush time. ARC tests (which
|
|
14
|
+
* read `result.id` immediately after creation) rely on the synthetic id;
|
|
15
|
+
* pre-existing tests that only inspect `em.create.mock.calls` are unaffected.
|
|
16
|
+
*/
|
|
17
|
+
export interface MockEm {
|
|
18
|
+
findOne: jest.MockedFunction<(entity: unknown, where: Record<string, unknown>) => Promise<unknown>>
|
|
19
|
+
find: jest.MockedFunction<
|
|
20
|
+
(
|
|
21
|
+
entity: unknown,
|
|
22
|
+
where: Record<string, unknown>,
|
|
23
|
+
options?: Record<string, unknown>,
|
|
24
|
+
) => Promise<unknown[]>
|
|
25
|
+
>
|
|
26
|
+
findAndCount: jest.MockedFunction<
|
|
27
|
+
(
|
|
28
|
+
entity: unknown,
|
|
29
|
+
where: Record<string, unknown>,
|
|
30
|
+
options?: Record<string, unknown>,
|
|
31
|
+
) => Promise<[unknown[], number]>
|
|
32
|
+
>
|
|
33
|
+
count: jest.MockedFunction<(entity: unknown, where: Record<string, unknown>) => Promise<number>>
|
|
34
|
+
create: jest.MockedFunction<(entity: unknown, data: Record<string, unknown>) => unknown>
|
|
35
|
+
persist: jest.MockedFunction<(entity: unknown) => unknown>
|
|
36
|
+
flush: jest.MockedFunction<() => Promise<void>>
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
let __syntheticIdSequence = 0
|
|
40
|
+
|
|
41
|
+
export function createMockEm(): MockEm {
|
|
42
|
+
return {
|
|
43
|
+
findOne: jest.fn(),
|
|
44
|
+
find: jest.fn(),
|
|
45
|
+
findAndCount: jest.fn(),
|
|
46
|
+
count: jest.fn().mockResolvedValue(0),
|
|
47
|
+
create: jest.fn().mockImplementation((_e, data: Record<string, unknown>) => ({
|
|
48
|
+
...data,
|
|
49
|
+
id: (data.id as string | undefined) ?? `gen-${++__syntheticIdSequence}`,
|
|
50
|
+
})),
|
|
51
|
+
persist: jest.fn(),
|
|
52
|
+
flush: jest.fn().mockResolvedValue(undefined),
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export const TEST_SCOPE: TenantScope = {
|
|
57
|
+
tenantId: '00000000-0000-0000-0000-000000000001',
|
|
58
|
+
organizationId: '00000000-0000-0000-0000-000000000002',
|
|
59
|
+
}
|