@divmain/jdm-asm 0.2.0 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +2227 -29
- package/dist/index.js.map +1 -1
- package/package.json +8 -2
- package/.github/workflows/ci.yml +0 -53
- package/.oxfmtrc.json +0 -16
- package/.oxlintrc.json +0 -183
- package/AGENTS.md +0 -81
- package/asconfig.json +0 -23
- package/benchmarks/fixtures.ts +0 -111
- package/benchmarks/input-fixtures.ts +0 -80
- package/benchmarks/run.ts +0 -913
- package/benchmarks/worker-pool.ts +0 -223
- package/benchmarks/worker.ts +0 -374
- package/scripts/run-all-tests.ts +0 -220
- package/src/compiler/EXPRESSION_SUBSETS.md +0 -228
- package/src/compiler/asc-compiler.ts +0 -315
- package/src/compiler/ast-types.ts +0 -215
- package/src/compiler/build.ts +0 -56
- package/src/compiler/cache.ts +0 -414
- package/src/compiler/code-generators.ts +0 -211
- package/src/compiler/codegen/index.ts +0 -15
- package/src/compiler/codegen/js-marshal.ts +0 -999
- package/src/compiler/codegen/js-validation.ts +0 -243
- package/src/compiler/codegen.ts +0 -19
- package/src/compiler/compile-time-validation.ts +0 -507
- package/src/compiler/cst-visitor.ts +0 -434
- package/src/compiler/errors.ts +0 -227
- package/src/compiler/expression-parser.ts +0 -536
- package/src/compiler/graph.ts +0 -197
- package/src/compiler/index.ts +0 -199
- package/src/compiler/input-validation.ts +0 -33
- package/src/compiler/marshal-gen.ts +0 -21
- package/src/compiler/nodes/context-resolvers.ts +0 -197
- package/src/compiler/nodes/decision-table.ts +0 -507
- package/src/compiler/nodes/decision.ts +0 -292
- package/src/compiler/nodes/expression-compiler.ts +0 -526
- package/src/compiler/nodes/expression.ts +0 -425
- package/src/compiler/nodes/function.ts +0 -316
- package/src/compiler/nodes/input.ts +0 -60
- package/src/compiler/nodes/switch.ts +0 -547
- package/src/compiler/optimizer.ts +0 -948
- package/src/compiler/orchestrator.ts +0 -352
- package/src/compiler/parser.ts +0 -115
- package/src/compiler/result-selection.ts +0 -161
- package/src/compiler/runtime/index.ts +0 -26
- package/src/compiler/runtime-codegen.ts +0 -211
- package/src/compiler/runtime-validation-codegen.ts +0 -294
- package/src/compiler/runtime.ts +0 -452
- package/src/compiler/schema.ts +0 -245
- package/src/compiler/switch-branch-detection.ts +0 -92
- package/src/compiler/types.ts +0 -136
- package/src/compiler/unary-ast-transforms.ts +0 -148
- package/src/compiler/unary-parser.ts +0 -301
- package/src/compiler/unary-transform.ts +0 -161
- package/src/compiler/utils.ts +0 -27
- package/src/compiler/virtual-fs.ts +0 -90
- package/src/compiler/wasm-instantiate.ts +0 -127
- package/src/index.ts +0 -1
- package/src/runtime/arrays.ts +0 -579
- package/src/runtime/context.ts +0 -189
- package/src/runtime/expressions.ts +0 -1811
- package/src/runtime/index.ts +0 -8
- package/src/runtime/memory.ts +0 -607
- package/src/runtime/strings.ts +0 -260
- package/src/runtime/tables.ts +0 -96
- package/src/runtime/tsconfig.json +0 -4
- package/src/runtime/values.ts +0 -209
- package/test-data/README.md +0 -83
- package/test-data/decision-tables/basic/8k.json +0 -87992
- package/test-data/decision-tables/basic/affiliate-commission-calculator.json +0 -228
- package/test-data/decision-tables/basic/airline-loyalty-points-calculations.json +0 -285
- package/test-data/decision-tables/basic/airline-upgrade-eligibility.json +0 -466
- package/test-data/decision-tables/basic/auto-insurance-premium-calculator.json +0 -412
- package/test-data/decision-tables/basic/booking-personalization-system.json +0 -553
- package/test-data/decision-tables/basic/care-team-assignment-system.json +0 -585
- package/test-data/decision-tables/basic/claim-validation-system.json +0 -307
- package/test-data/decision-tables/basic/clinical-lab-result-interpreter.json +0 -433
- package/test-data/decision-tables/basic/clinical-treatment-protocol.json +0 -474
- package/test-data/decision-tables/basic/credit-limit-adjustment.json +0 -479
- package/test-data/decision-tables/basic/customer-eligibility-engine.json +0 -551
- package/test-data/decision-tables/basic/customer-lifetime-value.json +0 -200
- package/test-data/decision-tables/basic/customer-onboarding-kyc-verification.json +0 -611
- package/test-data/decision-tables/basic/customer-service-escalation.json +0 -191
- package/test-data/decision-tables/basic/decision-table-discounts.json +0 -168
- package/test-data/decision-tables/basic/decision-table-shipping.json +0 -398
- package/test-data/decision-tables/basic/delivery-route-optimizer.json +0 -271
- package/test-data/decision-tables/basic/device-compatibility-checker.json +0 -303
- package/test-data/decision-tables/basic/disaster-relief-fund-allocation.json +0 -296
- package/test-data/decision-tables/basic/dynamic-fx-rate-pricing-system.json +0 -237
- package/test-data/decision-tables/basic/dynamic-marketplace-comission-calculator.json +0 -242
- package/test-data/decision-tables/basic/dynamic-shipping-cost-calculator.json +0 -378
- package/test-data/decision-tables/basic/dynamic-tarrif-engine.json +0 -289
- package/test-data/decision-tables/basic/dynamic-ticket-pricing.json +0 -325
- package/test-data/decision-tables/basic/empty-column-with-space.json +0 -100
- package/test-data/decision-tables/basic/empty-column-without-space.json +0 -100
- package/test-data/decision-tables/basic/environment-compliance-assessment.json +0 -386
- package/test-data/decision-tables/basic/expression-table-map.json +0 -313
- package/test-data/decision-tables/basic/flash-sale-eligibility.json +0 -366
- package/test-data/decision-tables/basic/flight-dispatch-decision-system.json +0 -455
- package/test-data/decision-tables/basic/flight-rebooking-fee-calculator.json +0 -406
- package/test-data/decision-tables/basic/government-assistance.json +0 -299
- package/test-data/decision-tables/basic/grant-funding-distribution.json +0 -307
- package/test-data/decision-tables/basic/hazardous-materials-management-system.json +0 -414
- package/test-data/decision-tables/basic/immigration-eligibility-evaluator.json +0 -765
- package/test-data/decision-tables/basic/import-duties-calculator.json +0 -318
- package/test-data/decision-tables/basic/insurance-agent-commission.json +0 -228
- package/test-data/decision-tables/basic/insurance-coverage-calculator.json +0 -362
- package/test-data/decision-tables/basic/insurance-underwriting-risk.json +0 -321
- package/test-data/decision-tables/basic/international-roaming-policy-manager.json +0 -199
- package/test-data/decision-tables/basic/legacy-plan-management.json +0 -434
- package/test-data/decision-tables/basic/marketplace-listing-verification-system.json +0 -334
- package/test-data/decision-tables/basic/medication-dosage-calculator.json +0 -318
- package/test-data/decision-tables/basic/merch-bags.json +0 -171
- package/test-data/decision-tables/basic/municipal-permit-evaluation-system.json +0 -364
- package/test-data/decision-tables/basic/mvno-partner-enablement.json +0 -313
- package/test-data/decision-tables/basic/partner-revenue-sharing.json +0 -244
- package/test-data/decision-tables/basic/payment-routing-and-fee-calculator.json +0 -475
- package/test-data/decision-tables/basic/policy-discount-calculator.json +0 -307
- package/test-data/decision-tables/basic/policy-eligibility-analyzer.json +0 -299
- package/test-data/decision-tables/basic/product-listing-scoring.json +0 -358
- package/test-data/decision-tables/basic/realtime-fraud-detection.json +0 -235
- package/test-data/decision-tables/basic/regional-compliance-manager.json +0 -278
- package/test-data/decision-tables/basic/returns-and-refund-policy.json +0 -366
- package/test-data/decision-tables/basic/returns-processing-system.json +0 -448
- package/test-data/decision-tables/basic/school-district-resource-allocation.json +0 -282
- package/test-data/decision-tables/basic/seat-map-optimization.json +0 -325
- package/test-data/decision-tables/basic/seller-fee-calculator.json +0 -307
- package/test-data/decision-tables/basic/service-level-agreement-enforcement.json +0 -575
- package/test-data/decision-tables/basic/smart-financial-product-matcher.json +0 -249
- package/test-data/decision-tables/basic/supply-chain-risk.json +0 -316
- package/test-data/decision-tables/basic/table-loop.json +0 -93
- package/test-data/decision-tables/basic/table.json +0 -76
- package/test-data/decision-tables/basic/traffic-violation-penalty-calculator.json +0 -436
- package/test-data/decision-tables/basic/transaction-compliance-classifier.json +0 -525
- package/test-data/decision-tables/basic/vehicle-claims-resolution.json +0 -310
- package/test-data/decision-tables/basic/warehouse-storage-location.json +0 -345
- package/test-data/decision-tables/hit-policy-collect/collect-multiple-matches.json +0 -127
- package/test-data/decision-tables/hit-policy-collect/collect-no-match.json +0 -95
- package/test-data/decision-tables/hit-policy-first/first-match.json +0 -103
- package/test-data/decision-tables/hit-policy-first/no-match.json +0 -95
- package/test-data/decision-tables/hit-policy-output-order/output-order-respected.json +0 -94
- package/test-data/decision-tables/hit-policy-output-order/string-output-order.json +0 -94
- package/test-data/decision-tables/hit-policy-priority/priority-respected.json +0 -86
- package/test-data/decision-tables/hit-policy-rule-order/rule-order-respected.json +0 -94
- package/test-data/decision-tables/hit-policy-unique/all-match-error.json +0 -89
- package/test-data/decision-tables/hit-policy-unique/multiple-match-error.json +0 -89
- package/test-data/decision-tables/hit-policy-unique/no-match.json +0 -88
- package/test-data/decision-tables/hit-policy-unique/unique-match.json +0 -99
- package/test-data/expressions/arithmetic/error-cyclic.json +0 -114
- package/test-data/expressions/arithmetic/error-missing-input.json +0 -54
- package/test-data/expressions/arithmetic/error-missing-output.json +0 -54
- package/test-data/expressions/arithmetic/expression-default.json +0 -93
- package/test-data/expressions/arithmetic/expression-fields.json +0 -94
- package/test-data/expressions/arithmetic/expression-loop.json +0 -94
- package/test-data/expressions/arithmetic/expression-passthrough.json +0 -108
- package/test-data/expressions/arithmetic/expression.json +0 -69
- package/test-data/expressions/arithmetic/nested-request.json +0 -125
- package/test-data/expressions/arithmetic/number-function.json +0 -58
- package/test-data/expressions/arithmetic/test-number-functions.json +0 -68
- package/test-data/expressions/functions/all.json +0 -149
- package/test-data/expressions/functions/avg.json +0 -89
- package/test-data/expressions/functions/filter.json +0 -109
- package/test-data/expressions/functions/flat.json +0 -167
- package/test-data/expressions/functions/map-strings.json +0 -65
- package/test-data/expressions/functions/map.json +0 -73
- package/test-data/expressions/functions/reduce.json +0 -49
- package/test-data/expressions/functions/some.json +0 -175
- package/test-data/expressions/functions/sort-strings.json +0 -97
- package/test-data/expressions/functions/sort.json +0 -97
- package/test-data/expressions/logical/logical-and.json +0 -116
- package/test-data/expressions/logical/logical-complex.json +0 -260
- package/test-data/expressions/logical/logical-not.json +0 -111
- package/test-data/expressions/logical/logical-or.json +0 -123
- package/test-data/expressions/string/string-comparison.json +0 -128
- package/test-data/expressions/string/string-concat.json +0 -106
- package/test-data/expressions/string/string-contains.json +0 -125
- package/test-data/expressions/string/string-endsWith.json +0 -113
- package/test-data/expressions/string/string-indexOf.json +0 -131
- package/test-data/expressions/string/string-join.json +0 -92
- package/test-data/expressions/string/string-lower.json +0 -94
- package/test-data/expressions/string/string-replace.json +0 -130
- package/test-data/expressions/string/string-split.json +0 -101
- package/test-data/expressions/string/string-startsWith.json +0 -113
- package/test-data/expressions/string/string-substring.json +0 -138
- package/test-data/expressions/string/string-trim.json +0 -100
- package/test-data/expressions/string/string-upper.json +0 -94
- package/test-data/other/custom.json +0 -51
- package/test-data/other/customer-input-schema.json +0 -34
- package/test-data/other/customer-output-schema.json +0 -34
- package/test-data/other/passthrough.json +0 -31
- package/test-data/sub-decisions/basic/$nodes-child.json +0 -31
- package/test-data/sub-decisions/basic/$nodes-parent.json +0 -49
- package/test-data/sub-decisions/basic/recursive-table1.json +0 -49
- package/test-data/sub-decisions/basic/recursive-table2.json +0 -49
- package/test-data/sub-decisions/complex-multi/approval-decision.json +0 -31
- package/test-data/sub-decisions/complex-multi/complex-dag.json +0 -175
- package/test-data/sub-decisions/complex-multi/credit-check.json +0 -31
- package/test-data/sub-decisions/complex-multi/customer-segmentation.json +0 -31
- package/test-data/sub-decisions/complex-multi/discount-eligibility.json +0 -31
- package/test-data/sub-decisions/complex-multi/eligibility-check.json +0 -31
- package/test-data/sub-decisions/complex-multi/final-offer.json +0 -31
- package/test-data/sub-decisions/complex-multi/income-verification.json +0 -31
- package/test-data/sub-decisions/complex-multi/linear-chain.json +0 -121
- package/test-data/sub-decisions/complex-multi/pricing-calculation.json +0 -31
- package/test-data/sub-decisions/complex-multi/product-eligibility.json +0 -31
- package/test-data/sub-decisions/complex-multi/risk-assessment.json +0 -31
- package/test-data/sub-decisions/complex-multi/shared-validation.json +0 -31
- package/test-data/sub-decisions/complex-multi/validation.json +0 -31
- package/test-data/sub-decisions/diamond/decision-a.json +0 -31
- package/test-data/sub-decisions/diamond/decision-b.json +0 -31
- package/test-data/sub-decisions/diamond/decision-c.json +0 -31
- package/test-data/sub-decisions/diamond/decision-shared.json +0 -31
- package/test-data/sub-decisions/diamond/diamond-pattern.json +0 -109
- package/test-data/sub-decisions/error-propagation/parent-calls-error.json +0 -44
- package/test-data/sub-decisions/error-propagation/sub-decision-with-error.json +0 -60
- package/test-data/switch-nodes/basic/account-dormancy-management.json +0 -245
- package/test-data/switch-nodes/basic/application-risk-assessment.json +0 -474
- package/test-data/switch-nodes/basic/cellular-data-rollover-system.json +0 -281
- package/test-data/switch-nodes/basic/clinical-pathway-selection.json +0 -454
- package/test-data/switch-nodes/basic/insurance-prior-authorization.json +0 -467
- package/test-data/switch-nodes/basic/last-mile-delivery-assignment.json +0 -373
- package/test-data/switch-nodes/basic/loan-approval.json +0 -469
- package/test-data/switch-nodes/basic/multi-switch.json +0 -498
- package/test-data/switch-nodes/basic/online-checkin-eligibility.json +0 -285
- package/test-data/switch-nodes/basic/order-consolidation-system.json +0 -493
- package/test-data/switch-nodes/basic/seller-approval-workflow.json +0 -383
- package/test-data/switch-nodes/basic/set-fee.json +0 -243
- package/test-data/switch-nodes/basic/shipping-carrier-selector.json +0 -379
- package/test-data/switch-nodes/basic/switch-node.json +0 -167
- package/test-data/switch-nodes/basic/switch-performance-2.json +0 -1307
- package/test-data/switch-nodes/basic/switch-performance.json +0 -691
- package/test-data/switch-nodes/basic/tax-exemption.json +0 -295
- package/test-data/switch-nodes/basic/warehouse-cross-docking.json +0 -313
- package/test-data/switch-nodes/default-cases/switch-with-default.json +0 -134
- package/test-data/zen-reference/$nodes-child.json +0 -69
- package/test-data/zen-reference/$nodes-parent.json +0 -34
- package/test-data/zen-reference/8k.json +0 -87992
- package/test-data/zen-reference/credit-analysis.json +0 -324
- package/test-data/zen-reference/custom.json +0 -51
- package/test-data/zen-reference/customer-input-schema.json +0 -34
- package/test-data/zen-reference/customer-output-schema.json +0 -34
- package/test-data/zen-reference/error-cyclic.json +0 -114
- package/test-data/zen-reference/error-missing-input.json +0 -54
- package/test-data/zen-reference/error-missing-output.json +0 -54
- package/test-data/zen-reference/expression.json +0 -69
- package/test-data/zen-reference/function-v2.json +0 -48
- package/test-data/zen-reference/function.json +0 -46
- package/test-data/zen-reference/graphs/account-dormancy-management.json +0 -245
- package/test-data/zen-reference/graphs/affiliate-commission-calculator.json +0 -228
- package/test-data/zen-reference/graphs/airline-loyalty-points-calculations.json +0 -285
- package/test-data/zen-reference/graphs/airline-upgrade-eligibility.json +0 -466
- package/test-data/zen-reference/graphs/aml.json +0 -537
- package/test-data/zen-reference/graphs/application-risk-assessment.json +0 -474
- package/test-data/zen-reference/graphs/auto-insurance-premium-calculator.json +0 -412
- package/test-data/zen-reference/graphs/booking-personalization-system.json +0 -553
- package/test-data/zen-reference/graphs/care-team-assignment-system.json +0 -585
- package/test-data/zen-reference/graphs/cellular-data-rollover-system.json +0 -281
- package/test-data/zen-reference/graphs/claim-validation-system.json +0 -307
- package/test-data/zen-reference/graphs/clinical-lab-result-interpreter.json +0 -433
- package/test-data/zen-reference/graphs/clinical-pathway-selection.json +0 -454
- package/test-data/zen-reference/graphs/clinical-treatment-protocol.json +0 -474
- package/test-data/zen-reference/graphs/company-analysis.json +0 -390
- package/test-data/zen-reference/graphs/credit-limit-adjustment.json +0 -479
- package/test-data/zen-reference/graphs/customer-eligibility-engine.json +0 -551
- package/test-data/zen-reference/graphs/customer-lifetime-value.json +0 -200
- package/test-data/zen-reference/graphs/customer-onboarding-kyc-verification.json +0 -611
- package/test-data/zen-reference/graphs/customer-service-escalation.json +0 -191
- package/test-data/zen-reference/graphs/decision-table-discounts.json +0 -168
- package/test-data/zen-reference/graphs/decision-table-shipping.json +0 -398
- package/test-data/zen-reference/graphs/delivery-route-optimizer.json +0 -271
- package/test-data/zen-reference/graphs/device-compatibility-checker.json +0 -303
- package/test-data/zen-reference/graphs/disaster-relief-fund-allocation.json +0 -296
- package/test-data/zen-reference/graphs/dynamic-fx-rate-pricing-system.json +0 -237
- package/test-data/zen-reference/graphs/dynamic-marketplace-comission-calculator.json +0 -242
- package/test-data/zen-reference/graphs/dynamic-shipping-cost-calculator.json +0 -378
- package/test-data/zen-reference/graphs/dynamic-tarrif-engine.json +0 -289
- package/test-data/zen-reference/graphs/dynamic-ticket-pricing.json +0 -325
- package/test-data/zen-reference/graphs/empty-column-with-space.json +0 -100
- package/test-data/zen-reference/graphs/empty-column-without-space.json +0 -100
- package/test-data/zen-reference/graphs/environment-compliance-assessment.json +0 -386
- package/test-data/zen-reference/graphs/expression-default.json +0 -93
- package/test-data/zen-reference/graphs/expression-fields.json +0 -94
- package/test-data/zen-reference/graphs/expression-loop.json +0 -94
- package/test-data/zen-reference/graphs/expression-passthrough.json +0 -108
- package/test-data/zen-reference/graphs/expression-table-map.json +0 -313
- package/test-data/zen-reference/graphs/flash-sale-eligibility.json +0 -366
- package/test-data/zen-reference/graphs/flight-dispatch-decision-system.json +0 -455
- package/test-data/zen-reference/graphs/flight-rebooking-fee-calculator.json +0 -406
- package/test-data/zen-reference/graphs/government-assistance.json +0 -299
- package/test-data/zen-reference/graphs/grant-funding-distribution.json +0 -307
- package/test-data/zen-reference/graphs/hazardous-materials-management-system.json +0 -414
- package/test-data/zen-reference/graphs/immigration-eligibility-evaluator.json +0 -765
- package/test-data/zen-reference/graphs/import-duties-calculator.json +0 -318
- package/test-data/zen-reference/graphs/insurance-agent-commission.json +0 -228
- package/test-data/zen-reference/graphs/insurance-breakdown.json +0 -421
- package/test-data/zen-reference/graphs/insurance-coverage-calculator.json +0 -362
- package/test-data/zen-reference/graphs/insurance-prior-authorization.json +0 -467
- package/test-data/zen-reference/graphs/insurance-underwriting-risk.json +0 -321
- package/test-data/zen-reference/graphs/international-roaming-policy-manager.json +0 -199
- package/test-data/zen-reference/graphs/last-mile-delivery-assignment.json +0 -373
- package/test-data/zen-reference/graphs/legacy-plan-management.json +0 -434
- package/test-data/zen-reference/graphs/loan-approval.json +0 -469
- package/test-data/zen-reference/graphs/marketplace-listing-verification-system.json +0 -334
- package/test-data/zen-reference/graphs/medication-dosage-calculator.json +0 -318
- package/test-data/zen-reference/graphs/merch-bags.json +0 -171
- package/test-data/zen-reference/graphs/multi-switch.json +0 -498
- package/test-data/zen-reference/graphs/municipal-permit-evaluation-system.json +0 -364
- package/test-data/zen-reference/graphs/mvno-partner-enablement.json +0 -313
- package/test-data/zen-reference/graphs/nested-request.json +0 -125
- package/test-data/zen-reference/graphs/online-checkin-eligibility.json +0 -285
- package/test-data/zen-reference/graphs/order-consolidation-system.json +0 -493
- package/test-data/zen-reference/graphs/partner-revenue-sharing.json +0 -244
- package/test-data/zen-reference/graphs/payment-routing-and-fee-calculator.json +0 -475
- package/test-data/zen-reference/graphs/policy-discount-calculator.json +0 -307
- package/test-data/zen-reference/graphs/policy-eligibility-analyzer.json +0 -299
- package/test-data/zen-reference/graphs/product-listing-scoring.json +0 -358
- package/test-data/zen-reference/graphs/realtime-fraud-detection.json +0 -235
- package/test-data/zen-reference/graphs/regional-compliance-manager.json +0 -278
- package/test-data/zen-reference/graphs/returns-and-refund-policy.json +0 -366
- package/test-data/zen-reference/graphs/returns-processing-system.json +0 -448
- package/test-data/zen-reference/graphs/school-district-resource-allocation.json +0 -282
- package/test-data/zen-reference/graphs/seat-map-optimization.json +0 -325
- package/test-data/zen-reference/graphs/seller-approval-workflow.json +0 -383
- package/test-data/zen-reference/graphs/seller-fee-calculator.json +0 -307
- package/test-data/zen-reference/graphs/service-level-agreement-enforcement.json +0 -575
- package/test-data/zen-reference/graphs/set-fee.json +0 -243
- package/test-data/zen-reference/graphs/shipping-carrier-selector.json +0 -379
- package/test-data/zen-reference/graphs/smart-financial-product-matcher.json +0 -249
- package/test-data/zen-reference/graphs/supply-chain-risk.json +0 -316
- package/test-data/zen-reference/graphs/table-loop.json +0 -93
- package/test-data/zen-reference/graphs/tax-exemption.json +0 -295
- package/test-data/zen-reference/graphs/traffic-violation-penalty-calculator.json +0 -436
- package/test-data/zen-reference/graphs/transaction-compliance-classifier.json +0 -525
- package/test-data/zen-reference/graphs/vehicle-claims-resolution.json +0 -310
- package/test-data/zen-reference/graphs/warehouse-cross-docking.json +0 -313
- package/test-data/zen-reference/graphs/warehouse-storage-location.json +0 -345
- package/test-data/zen-reference/http-function.json +0 -34
- package/test-data/zen-reference/infinite-function.json +0 -46
- package/test-data/zen-reference/js/imports.js +0 -25
- package/test-data/zen-reference/passthrough.json +0 -31
- package/test-data/zen-reference/recursive-table1.json +0 -49
- package/test-data/zen-reference/recursive-table2.json +0 -49
- package/test-data/zen-reference/sleep-function.json +0 -34
- package/test-data/zen-reference/switch-node.json +0 -167
- package/test-data/zen-reference/switch-performance-2.json +0 -1307
- package/test-data/zen-reference/switch-performance.json +0 -691
- package/test-data/zen-reference/table.json +0 -76
- package/tests/helpers/index.ts +0 -73
- package/tests/helpers/mock-context.ts +0 -231
- package/tests/helpers/round-trip.ts +0 -398
- package/tests/helpers/test-harness-comparison.ts +0 -325
- package/tests/helpers/test-harness-wasm.ts +0 -710
- package/tests/helpers/test-harness.ts +0 -28
- package/tests/helpers/wasm-test.ts +0 -659
- package/tests/integration/compilation-errors.test.ts +0 -864
- package/tests/integration/decision-tables.test.ts +0 -531
- package/tests/integration/edge-cases.test.ts +0 -787
- package/tests/integration/expressions.test.ts +0 -513
- package/tests/integration/function-node-integration.test.ts +0 -182
- package/tests/integration/sub-decisions.test.ts +0 -108
- package/tests/integration/switch-nodes.test.ts +0 -399
- package/tests/integration/unary-or-matching.test.ts +0 -53
- package/tests/integration/wasm-data-types.test.ts +0 -398
- package/tests/integration/wasm-errors.test.ts +0 -199
- package/tests/integration/wasm-execution.test.ts +0 -348
- package/tests/integration/wasm-memory.test.ts +0 -228
- package/tests/scripts/analyze-coverage.ts +0 -166
- package/tests/scripts/categorize-tests.ts +0 -396
- package/tests/scripts/coverage-analysis.ts +0 -836
- package/tests/unit/compiler/cache.test.ts +0 -238
- package/tests/unit/compiler/errors.test.ts +0 -316
- package/tests/unit/compiler/graph-scalability.test.ts +0 -510
- package/tests/unit/compiler/graph.test.ts +0 -878
- package/tests/unit/compiler/input-validation.test.ts +0 -447
- package/tests/unit/compiler/logical-and-parser.test.ts +0 -143
- package/tests/unit/compiler/logical-not-parser.test.ts +0 -107
- package/tests/unit/compiler/logical-or-parser.test.ts +0 -236
- package/tests/unit/compiler/marshal-gen/marshal-gen.test.ts +0 -97
- package/tests/unit/compiler/nodes/decision-table.test.ts +0 -103
- package/tests/unit/compiler/nodes/decision.test.ts +0 -182
- package/tests/unit/compiler/nodes/function-compile.test.ts +0 -204
- package/tests/unit/compiler/nodes/function.test.ts +0 -176
- package/tests/unit/compiler/nodes/input.test.ts +0 -30
- package/tests/unit/compiler/nodes/switch.test.ts +0 -127
- package/tests/unit/compiler/optimizer-cache.test.ts +0 -327
- package/tests/unit/compiler/optimizer-implementation.test.ts +0 -625
- package/tests/unit/compiler/parser.test.ts +0 -508
- package/tests/unit/compiler/runtime-error-cleanup.test.ts +0 -426
- package/tests/unit/compiler/runtime-validation.test.ts +0 -303
- package/tests/unit/compiler/runtime.test.ts +0 -221
- package/tests/unit/compiler/schema/schema.test.ts +0 -248
- package/tests/unit/compiler/unary-ast-transforms.test.ts +0 -245
- package/tsconfig.json +0 -27
- package/tsup.config.ts +0 -11
- package/vitest.config.ts +0 -12
|
@@ -1,836 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Coverage Gap Analysis
|
|
3
|
-
*
|
|
4
|
-
* Analyze zen-engine test coverage and identify gaps
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import * as fs from 'fs';
|
|
8
|
-
import * as path from 'path';
|
|
9
|
-
|
|
10
|
-
export interface FeatureCoverage {
|
|
11
|
-
tested: boolean;
|
|
12
|
-
testCount: number;
|
|
13
|
-
testFiles: string[];
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export interface BuiltInFunctionCoverage {
|
|
17
|
-
sum: FeatureCoverage;
|
|
18
|
-
min: FeatureCoverage;
|
|
19
|
-
max: FeatureCoverage;
|
|
20
|
-
avg: FeatureCoverage;
|
|
21
|
-
count: FeatureCoverage;
|
|
22
|
-
filter: FeatureCoverage;
|
|
23
|
-
map: FeatureCoverage;
|
|
24
|
-
contains: FeatureCoverage;
|
|
25
|
-
any: FeatureCoverage;
|
|
26
|
-
all: FeatureCoverage;
|
|
27
|
-
not: FeatureCoverage;
|
|
28
|
-
date: FeatureCoverage;
|
|
29
|
-
string: FeatureCoverage;
|
|
30
|
-
number: FeatureCoverage;
|
|
31
|
-
abs: FeatureCoverage;
|
|
32
|
-
ceil: FeatureCoverage;
|
|
33
|
-
floor: FeatureCoverage;
|
|
34
|
-
round: FeatureCoverage;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export interface DecisionTableCoverage {
|
|
38
|
-
unary: FeatureCoverage;
|
|
39
|
-
expression: FeatureCoverage;
|
|
40
|
-
hitPolicyFirst: FeatureCoverage;
|
|
41
|
-
hitPolicyCollect: FeatureCoverage;
|
|
42
|
-
hitPolicyUnique: FeatureCoverage;
|
|
43
|
-
hitPolicyPriority: FeatureCoverage;
|
|
44
|
-
hitPolicyAny: FeatureCoverage;
|
|
45
|
-
hitPolicyRuleOrder: FeatureCoverage;
|
|
46
|
-
hitPolicyOutputOrder: FeatureCoverage;
|
|
47
|
-
emptyCells: FeatureCoverage;
|
|
48
|
-
loop: FeatureCoverage;
|
|
49
|
-
passThrough: FeatureCoverage;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export interface SwitchNodeCoverage {
|
|
53
|
-
basic: FeatureCoverage;
|
|
54
|
-
collect: FeatureCoverage;
|
|
55
|
-
multipleCases: FeatureCoverage;
|
|
56
|
-
defaultCase: FeatureCoverage;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export interface SubDecisionsCoverage {
|
|
60
|
-
nesting: FeatureCoverage;
|
|
61
|
-
recursion: FeatureCoverage;
|
|
62
|
-
crossReferences: FeatureCoverage;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export interface CoverageReport {
|
|
66
|
-
arithmetic: FeatureCoverage;
|
|
67
|
-
comparisons: FeatureCoverage;
|
|
68
|
-
logicalOps: FeatureCoverage;
|
|
69
|
-
stringOps: FeatureCoverage;
|
|
70
|
-
arrayAccess: FeatureCoverage;
|
|
71
|
-
objectAccess: FeatureCoverage;
|
|
72
|
-
builtInFuncs: BuiltInFunctionCoverage;
|
|
73
|
-
decisionTable: DecisionTableCoverage;
|
|
74
|
-
switchNode: SwitchNodeCoverage;
|
|
75
|
-
subDecisions: SubDecisionsCoverage;
|
|
76
|
-
existingTests: number;
|
|
77
|
-
gaps: string[];
|
|
78
|
-
coverage: number;
|
|
79
|
-
testFiles: string[];
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Initialize empty feature coverage
|
|
84
|
-
*/
|
|
85
|
-
function initFeatureCoverage(): FeatureCoverage {
|
|
86
|
-
return {
|
|
87
|
-
tested: false,
|
|
88
|
-
testCount: 0,
|
|
89
|
-
testFiles: [],
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Initialize built-in function coverage
|
|
95
|
-
*/
|
|
96
|
-
function initBuiltInFunctionCoverage(): BuiltInFunctionCoverage {
|
|
97
|
-
const functions = [
|
|
98
|
-
'sum',
|
|
99
|
-
'min',
|
|
100
|
-
'max',
|
|
101
|
-
'avg',
|
|
102
|
-
'count',
|
|
103
|
-
'filter',
|
|
104
|
-
'map',
|
|
105
|
-
'contains',
|
|
106
|
-
'any',
|
|
107
|
-
'all',
|
|
108
|
-
'not',
|
|
109
|
-
'date',
|
|
110
|
-
'string',
|
|
111
|
-
'number',
|
|
112
|
-
'abs',
|
|
113
|
-
'ceil',
|
|
114
|
-
'floor',
|
|
115
|
-
'round',
|
|
116
|
-
];
|
|
117
|
-
const result: any = {};
|
|
118
|
-
for (const fn of functions) {
|
|
119
|
-
result[fn] = initFeatureCoverage();
|
|
120
|
-
}
|
|
121
|
-
return result as BuiltInFunctionCoverage;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* Initialize decision table coverage
|
|
126
|
-
*/
|
|
127
|
-
function initDecisionTableCoverage(): DecisionTableCoverage {
|
|
128
|
-
return {
|
|
129
|
-
unary: initFeatureCoverage(),
|
|
130
|
-
expression: initFeatureCoverage(),
|
|
131
|
-
hitPolicyFirst: initFeatureCoverage(),
|
|
132
|
-
hitPolicyCollect: initFeatureCoverage(),
|
|
133
|
-
hitPolicyUnique: initFeatureCoverage(),
|
|
134
|
-
hitPolicyPriority: initFeatureCoverage(),
|
|
135
|
-
hitPolicyAny: initFeatureCoverage(),
|
|
136
|
-
hitPolicyRuleOrder: initFeatureCoverage(),
|
|
137
|
-
hitPolicyOutputOrder: initFeatureCoverage(),
|
|
138
|
-
emptyCells: initFeatureCoverage(),
|
|
139
|
-
loop: initFeatureCoverage(),
|
|
140
|
-
passThrough: initFeatureCoverage(),
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* Initialize switch node coverage
|
|
146
|
-
*/
|
|
147
|
-
function initSwitchNodeCoverage(): SwitchNodeCoverage {
|
|
148
|
-
return {
|
|
149
|
-
basic: initFeatureCoverage(),
|
|
150
|
-
collect: initFeatureCoverage(),
|
|
151
|
-
multipleCases: initFeatureCoverage(),
|
|
152
|
-
defaultCase: initFeatureCoverage(),
|
|
153
|
-
};
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
/**
|
|
157
|
-
* Initialize sub-decision coverage
|
|
158
|
-
*/
|
|
159
|
-
function initSubDecisionsCoverage(): SubDecisionsCoverage {
|
|
160
|
-
return {
|
|
161
|
-
nesting: initFeatureCoverage(),
|
|
162
|
-
recursion: initFeatureCoverage(),
|
|
163
|
-
crossReferences: initFeatureCoverage(),
|
|
164
|
-
};
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
/**
|
|
168
|
-
* Check if content contains arithmetic operations
|
|
169
|
-
*/
|
|
170
|
-
function hasArithmetic(content: string): boolean {
|
|
171
|
-
return /[+\-*/%]/.test(content) && !/\/\/|\/\*/.test(content);
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
* Check if content contains comparison operations
|
|
176
|
-
*/
|
|
177
|
-
function hasComparisons(content: string): boolean {
|
|
178
|
-
return (
|
|
179
|
-
/[=!<>]=?|!=|<>/.test(content) && !/(\/\/|\/\*)|[^=!==<>/]=(!==|<=|>=|=|<|>)/.test(content)
|
|
180
|
-
);
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
/**
|
|
184
|
-
* Check if content contains logical operations
|
|
185
|
-
*/
|
|
186
|
-
function hasLogicalOps(content: string): boolean {
|
|
187
|
-
return /\b(and|or|not|xor)\b/i.test(content);
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
/**
|
|
191
|
-
* Check if content contains string operations
|
|
192
|
-
*/
|
|
193
|
-
function hasStringOps(content: string): boolean {
|
|
194
|
-
return /["']|string\s*\(|substring\s*\(|concat\s*\(|upper\s*\(|lower\s*\(|trim\s*\(/i.test(
|
|
195
|
-
content,
|
|
196
|
-
);
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
/**
|
|
200
|
-
* Check if content contains array access
|
|
201
|
-
*/
|
|
202
|
-
function hasArrayAccess(content: string): boolean {
|
|
203
|
-
return /\w+\[[0-9]+\]|\[[^\]]+\]\.\w+/.test(content);
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
/**
|
|
207
|
-
* Check if content contains object access
|
|
208
|
-
*/
|
|
209
|
-
function hasObjectAccess(content: string): boolean {
|
|
210
|
-
return /\.\w+/.test(content) && !/[()[]\]]/.test(content);
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
/**
|
|
214
|
-
* Extract built-in function usage
|
|
215
|
-
*/
|
|
216
|
-
function extractBuiltInFunctions(content: string): string[] {
|
|
217
|
-
const functionPattern =
|
|
218
|
-
/\b(sum|min|max|avg|count|filter|map|contains|any|all|not|date|string|number|abs|ceil|floor|round)\s*\(/gi;
|
|
219
|
-
const matches = content.match(functionPattern);
|
|
220
|
-
if (!matches) {
|
|
221
|
-
return [];
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
const functions = matches.map((m) => m.toLowerCase().replace(/\s*\($/, ''));
|
|
225
|
-
return [...new Set(functions)];
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
/**
|
|
229
|
-
* Extract decision table features
|
|
230
|
-
*/
|
|
231
|
-
function extractDecisionTableFeatures(node: any): string[] {
|
|
232
|
-
const features: string[] = [];
|
|
233
|
-
const content = node.content;
|
|
234
|
-
|
|
235
|
-
if (!content) {
|
|
236
|
-
return features;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
// Check hit policy
|
|
240
|
-
if (content.hitPolicy) {
|
|
241
|
-
features.push(
|
|
242
|
-
`hitPolicy${content.hitPolicy.charAt(0).toUpperCase() + content.hitPolicy.slice(1).toLowerCase()}`,
|
|
243
|
-
);
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
// Check input types (unary vs expression)
|
|
247
|
-
if (content.inputs) {
|
|
248
|
-
const expressionInputs = content.inputs.filter((i: any) => i.type === 'expression');
|
|
249
|
-
if (expressionInputs.length > 0 && expressionInputs.length === content.inputs.length) {
|
|
250
|
-
features.push('expression');
|
|
251
|
-
} else if (expressionInputs.length === 0) {
|
|
252
|
-
features.push('unary');
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
// Check for empty cells
|
|
257
|
-
if (content.rules) {
|
|
258
|
-
for (const rule of content.rules) {
|
|
259
|
-
for (const [key, value] of Object.entries(rule)) {
|
|
260
|
-
if (key !== '_id' && (value === '' || value === null || value === undefined)) {
|
|
261
|
-
features.push('emptyCells');
|
|
262
|
-
break;
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
// Check for execution mode
|
|
269
|
-
if (content.executionMode === 'loop') {
|
|
270
|
-
features.push('loop');
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
// Check for pass through
|
|
274
|
-
if (content.passThrough) {
|
|
275
|
-
features.push('passThrough');
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
return features;
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
/**
|
|
282
|
-
* Extract switch node features
|
|
283
|
-
*/
|
|
284
|
-
function extractSwitchFeatures(node: any): string[] {
|
|
285
|
-
const features: string[] = [];
|
|
286
|
-
const content = node.content;
|
|
287
|
-
|
|
288
|
-
if (!content) {
|
|
289
|
-
return features;
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
// Check for collect property
|
|
293
|
-
if (content.collect) {
|
|
294
|
-
features.push('collect');
|
|
295
|
-
} else {
|
|
296
|
-
features.push('basic');
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
// Check for multiple cases
|
|
300
|
-
if (content.statements && content.statements.length > 2) {
|
|
301
|
-
features.push('multipleCases');
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
// Check for default case (empty condition)
|
|
305
|
-
if (content.statements) {
|
|
306
|
-
const hasDefault = content.statements.some((s: any) => !s.condition || s.condition === '');
|
|
307
|
-
if (hasDefault) {
|
|
308
|
-
features.push('defaultCase');
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
return features;
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
/**
|
|
316
|
-
* Extract sub-decision features
|
|
317
|
-
*/
|
|
318
|
-
function extractSubDecisionFeatures(nodes: any[], edges: any[]): string[] {
|
|
319
|
-
const features: string[] = [];
|
|
320
|
-
|
|
321
|
-
const decisionCount = nodes.filter(
|
|
322
|
-
(n: any) => n.type === 'decisionNode' || n.type === 'expressionNode',
|
|
323
|
-
).length;
|
|
324
|
-
|
|
325
|
-
if (decisionCount > 1) {
|
|
326
|
-
features.push('nesting');
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
// Check for cyclic references (recursion)
|
|
330
|
-
for (const edge of edges) {
|
|
331
|
-
// If there's a back edge from later to earlier in flow, it might be recursion
|
|
332
|
-
const sourceIndex = nodes.findIndex((n: any) => n.id === edge.sourceId);
|
|
333
|
-
const targetIndex = nodes.findIndex((n: any) => n.id === edge.targetId);
|
|
334
|
-
if (sourceIndex > targetIndex && sourceIndex - targetIndex === 1) {
|
|
335
|
-
features.push('recursion');
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
// Check for cross-references
|
|
340
|
-
for (const edge of edges) {
|
|
341
|
-
const source = nodes.find((n: any) => n.id === edge.sourceId);
|
|
342
|
-
const target = nodes.find((n: any) => n.id === edge.targetId);
|
|
343
|
-
if (source && target && source.type === 'decisionNode' && target.type === 'decisionNode') {
|
|
344
|
-
features.push('crossReferences');
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
return features;
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
/**
|
|
352
|
-
* Analyze a single test file
|
|
353
|
-
*/
|
|
354
|
-
function analyzeTestFile(filePath: string, coverage: CoverageReport): void {
|
|
355
|
-
try {
|
|
356
|
-
const content = fs.readFileSync(filePath, 'utf-8');
|
|
357
|
-
const jdm = JSON.parse(content);
|
|
358
|
-
|
|
359
|
-
// Track test file
|
|
360
|
-
coverage.testFiles.push(filePath);
|
|
361
|
-
|
|
362
|
-
// Analyze nodes
|
|
363
|
-
for (const node of jdm.nodes || []) {
|
|
364
|
-
const nodeContent = JSON.stringify(node.content || node);
|
|
365
|
-
|
|
366
|
-
// Expression language features
|
|
367
|
-
if (node.type === 'expressionNode' || node.type === 'decisionTableNode') {
|
|
368
|
-
if (hasArithmetic(nodeContent)) {
|
|
369
|
-
coverage.arithmetic.tested = true;
|
|
370
|
-
coverage.arithmetic.testCount++;
|
|
371
|
-
if (!coverage.arithmetic.testFiles.includes(filePath)) {
|
|
372
|
-
coverage.arithmetic.testFiles.push(filePath);
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
if (hasComparisons(nodeContent)) {
|
|
377
|
-
coverage.comparisons.tested = true;
|
|
378
|
-
coverage.comparisons.testCount++;
|
|
379
|
-
if (!coverage.comparisons.testFiles.includes(filePath)) {
|
|
380
|
-
coverage.comparisons.testFiles.push(filePath);
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
if (hasLogicalOps(nodeContent)) {
|
|
385
|
-
coverage.logicalOps.tested = true;
|
|
386
|
-
coverage.logicalOps.testCount++;
|
|
387
|
-
if (!coverage.logicalOps.testFiles.includes(filePath)) {
|
|
388
|
-
coverage.logicalOps.testFiles.push(filePath);
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
if (hasStringOps(nodeContent)) {
|
|
393
|
-
coverage.stringOps.tested = true;
|
|
394
|
-
coverage.stringOps.testCount++;
|
|
395
|
-
if (!coverage.stringOps.testFiles.includes(filePath)) {
|
|
396
|
-
coverage.stringOps.testFiles.push(filePath);
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
if (hasArrayAccess(nodeContent)) {
|
|
401
|
-
coverage.arrayAccess.tested = true;
|
|
402
|
-
coverage.arrayAccess.testCount++;
|
|
403
|
-
if (!coverage.arrayAccess.testFiles.includes(filePath)) {
|
|
404
|
-
coverage.arrayAccess.testFiles.push(filePath);
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
if (hasObjectAccess(nodeContent)) {
|
|
409
|
-
coverage.objectAccess.tested = true;
|
|
410
|
-
coverage.objectAccess.testCount++;
|
|
411
|
-
if (!coverage.objectAccess.testFiles.includes(filePath)) {
|
|
412
|
-
coverage.objectAccess.testFiles.push(filePath);
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
// Built-in functions
|
|
417
|
-
const functions = extractBuiltInFunctions(nodeContent);
|
|
418
|
-
for (const fn of functions) {
|
|
419
|
-
if (coverage.builtInFuncs[fn as keyof BuiltInFunctionCoverage]) {
|
|
420
|
-
const cov = coverage.builtInFuncs[fn as keyof BuiltInFunctionCoverage];
|
|
421
|
-
cov.tested = true;
|
|
422
|
-
cov.testCount++;
|
|
423
|
-
if (!cov.testFiles.includes(filePath)) {
|
|
424
|
-
cov.testFiles.push(filePath);
|
|
425
|
-
}
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
// Decision table features
|
|
431
|
-
if (node.type === 'decisionTableNode') {
|
|
432
|
-
const dtFeatures = extractDecisionTableFeatures(node);
|
|
433
|
-
for (const feature of dtFeatures) {
|
|
434
|
-
if (coverage.decisionTable[feature as keyof DecisionTableCoverage]) {
|
|
435
|
-
const cov = coverage.decisionTable[feature as keyof DecisionTableCoverage];
|
|
436
|
-
cov.tested = true;
|
|
437
|
-
cov.testCount++;
|
|
438
|
-
if (!cov.testFiles.includes(filePath)) {
|
|
439
|
-
cov.testFiles.push(filePath);
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
// Switch node features
|
|
446
|
-
if (node.type === 'switchNode') {
|
|
447
|
-
const swFeatures = extractSwitchFeatures(node);
|
|
448
|
-
for (const feature of swFeatures) {
|
|
449
|
-
if (coverage.switchNode[feature as keyof SwitchNodeCoverage]) {
|
|
450
|
-
const cov = coverage.switchNode[feature as keyof SwitchNodeCoverage];
|
|
451
|
-
cov.tested = true;
|
|
452
|
-
cov.testCount++;
|
|
453
|
-
if (!cov.testFiles.includes(filePath)) {
|
|
454
|
-
cov.testFiles.push(filePath);
|
|
455
|
-
}
|
|
456
|
-
}
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
|
-
|
|
461
|
-
// Sub-decision features
|
|
462
|
-
const subDecisionFeatures = extractSubDecisionFeatures(jdm.nodes || [], jdm.edges || []);
|
|
463
|
-
for (const feature of subDecisionFeatures) {
|
|
464
|
-
if (coverage.subDecisions[feature as keyof SubDecisionsCoverage]) {
|
|
465
|
-
const cov = coverage.subDecisions[feature as keyof SubDecisionsCoverage];
|
|
466
|
-
cov.tested = true;
|
|
467
|
-
cov.testCount++;
|
|
468
|
-
if (!cov.testFiles.includes(filePath)) {
|
|
469
|
-
cov.testFiles.push(filePath);
|
|
470
|
-
}
|
|
471
|
-
}
|
|
472
|
-
}
|
|
473
|
-
} catch {
|
|
474
|
-
// Silently skip invalid files
|
|
475
|
-
}
|
|
476
|
-
}
|
|
477
|
-
|
|
478
|
-
/**
|
|
479
|
-
* Identify coverage gaps
|
|
480
|
-
*/
|
|
481
|
-
function identifyGaps(coverage: CoverageReport): void {
|
|
482
|
-
const gaps: string[] = [];
|
|
483
|
-
|
|
484
|
-
// Expression language features
|
|
485
|
-
if (!coverage.arithmetic.tested) {
|
|
486
|
-
gaps.push('Arithmetic operations (+, -, *, /)');
|
|
487
|
-
}
|
|
488
|
-
if (!coverage.comparisons.tested) {
|
|
489
|
-
gaps.push('Comparison operators (==, !=, <, >, <=, >=)');
|
|
490
|
-
}
|
|
491
|
-
if (!coverage.logicalOps.tested) {
|
|
492
|
-
gaps.push('Logical operations (and, or, not)');
|
|
493
|
-
}
|
|
494
|
-
if (!coverage.stringOps.tested) {
|
|
495
|
-
gaps.push('String operations');
|
|
496
|
-
}
|
|
497
|
-
if (!coverage.arrayAccess.tested) {
|
|
498
|
-
gaps.push('Array access (e.g., items[0])');
|
|
499
|
-
}
|
|
500
|
-
if (!coverage.objectAccess.tested) {
|
|
501
|
-
gaps.push('Object access (e.g., customer.name)');
|
|
502
|
-
}
|
|
503
|
-
|
|
504
|
-
// Built-in functions
|
|
505
|
-
for (const [func, cov] of Object.entries(coverage.builtInFuncs)) {
|
|
506
|
-
if (!cov.tested) {
|
|
507
|
-
gaps.push(`${func}() function`);
|
|
508
|
-
}
|
|
509
|
-
}
|
|
510
|
-
|
|
511
|
-
// Decision table features
|
|
512
|
-
if (!coverage.decisionTable.unary.tested) {
|
|
513
|
-
gaps.push('Decision table unary mode');
|
|
514
|
-
}
|
|
515
|
-
if (!coverage.decisionTable.expression.tested) {
|
|
516
|
-
gaps.push('Decision table expression mode');
|
|
517
|
-
}
|
|
518
|
-
if (!coverage.decisionTable.hitPolicyFirst.tested) {
|
|
519
|
-
gaps.push('Decision table hit policy: FIRST');
|
|
520
|
-
}
|
|
521
|
-
if (!coverage.decisionTable.hitPolicyCollect.tested) {
|
|
522
|
-
gaps.push('Decision table hit policy: COLLECT');
|
|
523
|
-
}
|
|
524
|
-
if (!coverage.decisionTable.hitPolicyUnique.tested) {
|
|
525
|
-
gaps.push('Decision table hit policy: UNIQUE');
|
|
526
|
-
}
|
|
527
|
-
if (!coverage.decisionTable.hitPolicyPriority.tested) {
|
|
528
|
-
gaps.push('Decision table hit policy: PRIORITY');
|
|
529
|
-
}
|
|
530
|
-
if (!coverage.decisionTable.hitPolicyAny.tested) {
|
|
531
|
-
gaps.push('Decision table hit policy: ANY');
|
|
532
|
-
}
|
|
533
|
-
if (!coverage.decisionTable.hitPolicyRuleOrder.tested) {
|
|
534
|
-
gaps.push('Decision table hit policy: RULE ORDER');
|
|
535
|
-
}
|
|
536
|
-
if (!coverage.decisionTable.hitPolicyOutputOrder.tested) {
|
|
537
|
-
gaps.push('Decision table hit policy: OUTPUT ORDER');
|
|
538
|
-
}
|
|
539
|
-
if (!coverage.decisionTable.emptyCells.tested) {
|
|
540
|
-
gaps.push('Decision table empty cells');
|
|
541
|
-
}
|
|
542
|
-
if (!coverage.decisionTable.loop.tested) {
|
|
543
|
-
gaps.push('Decision table loop execution mode');
|
|
544
|
-
}
|
|
545
|
-
if (!coverage.decisionTable.passThrough.tested) {
|
|
546
|
-
gaps.push('Decision table pass through');
|
|
547
|
-
}
|
|
548
|
-
|
|
549
|
-
// Switch node features
|
|
550
|
-
if (!coverage.switchNode.basic.tested) {
|
|
551
|
-
gaps.push('Switch node basic mode');
|
|
552
|
-
}
|
|
553
|
-
if (!coverage.switchNode.collect.tested) {
|
|
554
|
-
gaps.push('Switch node collect mode');
|
|
555
|
-
}
|
|
556
|
-
if (!coverage.switchNode.multipleCases.tested) {
|
|
557
|
-
gaps.push('Switch node multiple cases');
|
|
558
|
-
}
|
|
559
|
-
if (!coverage.switchNode.defaultCase.tested) {
|
|
560
|
-
gaps.push('Switch node default case');
|
|
561
|
-
}
|
|
562
|
-
|
|
563
|
-
// Sub-decision features
|
|
564
|
-
if (!coverage.subDecisions.nesting.tested) {
|
|
565
|
-
gaps.push('Sub-decision nesting');
|
|
566
|
-
}
|
|
567
|
-
if (!coverage.subDecisions.recursion.tested) {
|
|
568
|
-
gaps.push('Sub-decision recursion');
|
|
569
|
-
}
|
|
570
|
-
if (!coverage.subDecisions.crossReferences.tested) {
|
|
571
|
-
gaps.push('Sub-decision cross-references');
|
|
572
|
-
}
|
|
573
|
-
|
|
574
|
-
coverage.gaps = gaps;
|
|
575
|
-
}
|
|
576
|
-
|
|
577
|
-
/**
|
|
578
|
-
* Calculate overall coverage percentage
|
|
579
|
-
*/
|
|
580
|
-
function calculateCoverage(coverage: CoverageReport): void {
|
|
581
|
-
let totalFeatures = 0;
|
|
582
|
-
let testedFeatures = 0;
|
|
583
|
-
|
|
584
|
-
// Expression language features
|
|
585
|
-
const expressionFeatures = [
|
|
586
|
-
coverage.arithmetic,
|
|
587
|
-
coverage.comparisons,
|
|
588
|
-
coverage.logicalOps,
|
|
589
|
-
coverage.stringOps,
|
|
590
|
-
coverage.arrayAccess,
|
|
591
|
-
coverage.objectAccess,
|
|
592
|
-
];
|
|
593
|
-
for (const f of expressionFeatures) {
|
|
594
|
-
totalFeatures++;
|
|
595
|
-
if (f.tested) {
|
|
596
|
-
testedFeatures++;
|
|
597
|
-
}
|
|
598
|
-
}
|
|
599
|
-
|
|
600
|
-
// Built-in functions
|
|
601
|
-
for (const cov of Object.values(coverage.builtInFuncs)) {
|
|
602
|
-
totalFeatures++;
|
|
603
|
-
if (cov.tested) {
|
|
604
|
-
testedFeatures++;
|
|
605
|
-
}
|
|
606
|
-
}
|
|
607
|
-
|
|
608
|
-
// Decision table features
|
|
609
|
-
for (const cov of Object.values(coverage.decisionTable)) {
|
|
610
|
-
totalFeatures++;
|
|
611
|
-
if (cov.tested) {
|
|
612
|
-
testedFeatures++;
|
|
613
|
-
}
|
|
614
|
-
}
|
|
615
|
-
|
|
616
|
-
// Switch node features
|
|
617
|
-
for (const cov of Object.values(coverage.switchNode)) {
|
|
618
|
-
totalFeatures++;
|
|
619
|
-
if (cov.tested) {
|
|
620
|
-
testedFeatures++;
|
|
621
|
-
}
|
|
622
|
-
}
|
|
623
|
-
|
|
624
|
-
// Sub-decision features
|
|
625
|
-
for (const cov of Object.values(coverage.subDecisions)) {
|
|
626
|
-
totalFeatures++;
|
|
627
|
-
if (cov.tested) {
|
|
628
|
-
testedFeatures++;
|
|
629
|
-
}
|
|
630
|
-
}
|
|
631
|
-
|
|
632
|
-
coverage.coverage = totalFeatures > 0 ? testedFeatures / totalFeatures : 0;
|
|
633
|
-
}
|
|
634
|
-
|
|
635
|
-
/**
|
|
636
|
-
* Find all test JSON files recursively
|
|
637
|
-
*/
|
|
638
|
-
function findTestFiles(dir: string): string[] {
|
|
639
|
-
const files: string[] = [];
|
|
640
|
-
|
|
641
|
-
function traverse(currentDir: string) {
|
|
642
|
-
const entries = fs.readdirSync(currentDir, { withFileTypes: true });
|
|
643
|
-
for (const entry of entries) {
|
|
644
|
-
if (
|
|
645
|
-
entry.isDirectory() &&
|
|
646
|
-
!entry.name.startsWith('node_modules') &&
|
|
647
|
-
!entry.name.startsWith('.')
|
|
648
|
-
) {
|
|
649
|
-
traverse(path.join(currentDir, entry.name));
|
|
650
|
-
} else if (entry.isFile() && entry.name.endsWith('.json')) {
|
|
651
|
-
files.push(path.join(currentDir, entry.name));
|
|
652
|
-
}
|
|
653
|
-
}
|
|
654
|
-
}
|
|
655
|
-
|
|
656
|
-
traverse(dir);
|
|
657
|
-
return files;
|
|
658
|
-
}
|
|
659
|
-
|
|
660
|
-
/**
|
|
661
|
-
* Analyze zen-engine test coverage and identify gaps
|
|
662
|
-
*/
|
|
663
|
-
export function analyzeCoverage(
|
|
664
|
-
testDataDir: string = path.join(process.cwd(), 'test-data'),
|
|
665
|
-
): CoverageReport {
|
|
666
|
-
const coverage: CoverageReport = {
|
|
667
|
-
arithmetic: initFeatureCoverage(),
|
|
668
|
-
comparisons: initFeatureCoverage(),
|
|
669
|
-
logicalOps: initFeatureCoverage(),
|
|
670
|
-
stringOps: initFeatureCoverage(),
|
|
671
|
-
arrayAccess: initFeatureCoverage(),
|
|
672
|
-
objectAccess: initFeatureCoverage(),
|
|
673
|
-
builtInFuncs: initBuiltInFunctionCoverage(),
|
|
674
|
-
decisionTable: initDecisionTableCoverage(),
|
|
675
|
-
switchNode: initSwitchNodeCoverage(),
|
|
676
|
-
subDecisions: initSubDecisionsCoverage(),
|
|
677
|
-
existingTests: 0,
|
|
678
|
-
gaps: [],
|
|
679
|
-
coverage: 0,
|
|
680
|
-
testFiles: [],
|
|
681
|
-
};
|
|
682
|
-
|
|
683
|
-
// Find all test JSON files
|
|
684
|
-
const testFiles = findTestFiles(testDataDir);
|
|
685
|
-
coverage.existingTests = testFiles.length;
|
|
686
|
-
|
|
687
|
-
// Analyze each test file
|
|
688
|
-
for (const testFile of testFiles) {
|
|
689
|
-
// Skip node_modules and hidden directories
|
|
690
|
-
if (testFile.includes('node_modules') || testFile.includes('/.')) {
|
|
691
|
-
continue;
|
|
692
|
-
}
|
|
693
|
-
analyzeTestFile(testFile, coverage);
|
|
694
|
-
}
|
|
695
|
-
|
|
696
|
-
// Identify gaps
|
|
697
|
-
identifyGaps(coverage);
|
|
698
|
-
|
|
699
|
-
// Calculate coverage
|
|
700
|
-
calculateCoverage(coverage);
|
|
701
|
-
|
|
702
|
-
return coverage;
|
|
703
|
-
}
|
|
704
|
-
|
|
705
|
-
/**
|
|
706
|
-
* Pretty print coverage report
|
|
707
|
-
*/
|
|
708
|
-
export function printCoverageReport(coverage: CoverageReport): void {
|
|
709
|
-
console.log('\n' + '='.repeat(70));
|
|
710
|
-
console.log('COVERAGE GAP ANALYSIS REPORT');
|
|
711
|
-
console.log('='.repeat(70));
|
|
712
|
-
console.log(`\n## Summary`);
|
|
713
|
-
console.log(`- Total test files: ${coverage.existingTests}`);
|
|
714
|
-
console.log(`- Coverage: ${(coverage.coverage * 100).toFixed(1)}%`);
|
|
715
|
-
console.log(`- Gaps found: ${coverage.gaps.length}`);
|
|
716
|
-
|
|
717
|
-
console.log(`\n## Expression Language Features`);
|
|
718
|
-
console.log(
|
|
719
|
-
`- Arithmetic: ${coverage.arithmetic.tested ? '✅' : '❌'} (${coverage.arithmetic.testCount} tests)`,
|
|
720
|
-
);
|
|
721
|
-
console.log(
|
|
722
|
-
`- Comparisons: ${coverage.comparisons.tested ? '✅' : '❌'} (${coverage.comparisons.testCount} tests)`,
|
|
723
|
-
);
|
|
724
|
-
console.log(
|
|
725
|
-
`- Logical ops: ${coverage.logicalOps.tested ? '✅' : '❌'} (${coverage.logicalOps.testCount} tests)`,
|
|
726
|
-
);
|
|
727
|
-
console.log(
|
|
728
|
-
`- String ops: ${coverage.stringOps.tested ? '✅' : '❌'} (${coverage.stringOps.testCount} tests)`,
|
|
729
|
-
);
|
|
730
|
-
console.log(
|
|
731
|
-
`- Array access: ${coverage.arrayAccess.tested ? '✅' : '❌'} (${coverage.arrayAccess.testCount} tests)`,
|
|
732
|
-
);
|
|
733
|
-
console.log(
|
|
734
|
-
`- Object access: ${coverage.objectAccess.tested ? '✅' : '❌'} (${coverage.objectAccess.testCount} tests)`,
|
|
735
|
-
);
|
|
736
|
-
|
|
737
|
-
console.log(`\n## Built-in Functions`);
|
|
738
|
-
for (const [func, cov] of Object.entries(coverage.builtInFuncs)) {
|
|
739
|
-
console.log(`- ${func}(): ${cov.tested ? '✅' : '❌'} (${cov.testCount} tests)`);
|
|
740
|
-
}
|
|
741
|
-
|
|
742
|
-
console.log(`\n## Decision Table Features`);
|
|
743
|
-
console.log(
|
|
744
|
-
`- Unary mode: ${coverage.decisionTable.unary.tested ? '✅' : '❌'} (${coverage.decisionTable.unary.testCount} tests)`,
|
|
745
|
-
);
|
|
746
|
-
console.log(
|
|
747
|
-
`- Expression mode: ${coverage.decisionTable.expression.tested ? '✅' : '❌'} (${coverage.decisionTable.expression.testCount} tests)`,
|
|
748
|
-
);
|
|
749
|
-
console.log(
|
|
750
|
-
`- Hit policy FIRST: ${coverage.decisionTable.hitPolicyFirst.tested ? '✅' : '❌'} (${coverage.decisionTable.hitPolicyFirst.testCount} tests)`,
|
|
751
|
-
);
|
|
752
|
-
console.log(
|
|
753
|
-
`- Hit policy COLLECT: ${coverage.decisionTable.hitPolicyCollect.tested ? '✅' : '❌'} (${coverage.decisionTable.hitPolicyCollect.testCount} tests)`,
|
|
754
|
-
);
|
|
755
|
-
console.log(
|
|
756
|
-
`- Hit policy UNIQUE: ${coverage.decisionTable.hitPolicyUnique.tested ? '✅' : '❌'} (${coverage.decisionTable.hitPolicyUnique.testCount} tests)`,
|
|
757
|
-
);
|
|
758
|
-
console.log(
|
|
759
|
-
`- Hit policy PRIORITY: ${coverage.decisionTable.hitPolicyPriority.tested ? '✅' : '❌'} (${coverage.decisionTable.hitPolicyPriority.testCount} tests)`,
|
|
760
|
-
);
|
|
761
|
-
console.log(
|
|
762
|
-
`- Hit policy ANY: ${coverage.decisionTable.hitPolicyAny.tested ? '✅' : '❌'} (${coverage.decisionTable.hitPolicyAny.testCount} tests)`,
|
|
763
|
-
);
|
|
764
|
-
console.log(
|
|
765
|
-
`- Hit policy RULE ORDER: ${coverage.decisionTable.hitPolicyRuleOrder.tested ? '✅' : '❌'} (${coverage.decisionTable.hitPolicyRuleOrder.testCount} tests)`,
|
|
766
|
-
);
|
|
767
|
-
console.log(
|
|
768
|
-
`- Hit policy OUTPUT ORDER: ${coverage.decisionTable.hitPolicyOutputOrder.tested ? '✅' : '❌'} (${coverage.decisionTable.hitPolicyOutputOrder.testCount} tests)`,
|
|
769
|
-
);
|
|
770
|
-
console.log(
|
|
771
|
-
`- Empty cells: ${coverage.decisionTable.emptyCells.tested ? '✅' : '❌'} (${coverage.decisionTable.emptyCells.testCount} tests)`,
|
|
772
|
-
);
|
|
773
|
-
console.log(
|
|
774
|
-
`- Loop execution: ${coverage.decisionTable.loop.tested ? '✅' : '❌'} (${coverage.decisionTable.loop.testCount} tests)`,
|
|
775
|
-
);
|
|
776
|
-
console.log(
|
|
777
|
-
`- Pass through: ${coverage.decisionTable.passThrough.tested ? '✅' : '❌'} (${coverage.decisionTable.passThrough.testCount} tests)`,
|
|
778
|
-
);
|
|
779
|
-
|
|
780
|
-
console.log(`\n## Switch Node Features`);
|
|
781
|
-
console.log(
|
|
782
|
-
`- Basic mode: ${coverage.switchNode.basic.tested ? '✅' : '❌'} (${coverage.switchNode.basic.testCount} tests)`,
|
|
783
|
-
);
|
|
784
|
-
console.log(
|
|
785
|
-
`- Collect mode: ${coverage.switchNode.collect.tested ? '✅' : '❌'} (${coverage.switchNode.collect.testCount} tests)`,
|
|
786
|
-
);
|
|
787
|
-
console.log(
|
|
788
|
-
`- Multiple cases: ${coverage.switchNode.multipleCases.tested ? '✅' : '❌'} (${coverage.switchNode.multipleCases.testCount} tests)`,
|
|
789
|
-
);
|
|
790
|
-
console.log(
|
|
791
|
-
`- Default case: ${coverage.switchNode.defaultCase.tested ? '✅' : '❌'} (${coverage.switchNode.defaultCase.testCount} tests)`,
|
|
792
|
-
);
|
|
793
|
-
|
|
794
|
-
console.log(`\n## Sub-Decision Features`);
|
|
795
|
-
console.log(
|
|
796
|
-
`- Nesting: ${coverage.subDecisions.nesting.tested ? '✅' : '❌'} (${coverage.subDecisions.nesting.testCount} tests)`,
|
|
797
|
-
);
|
|
798
|
-
console.log(
|
|
799
|
-
`- Recursion: ${coverage.subDecisions.recursion.tested ? '✅' : '❌'} (${coverage.subDecisions.recursion.testCount} tests)`,
|
|
800
|
-
);
|
|
801
|
-
console.log(
|
|
802
|
-
`- Cross references: ${coverage.subDecisions.crossReferences.tested ? '✅' : '❌'} (${coverage.subDecisions.crossReferences.testCount} tests)`,
|
|
803
|
-
);
|
|
804
|
-
|
|
805
|
-
if (coverage.gaps.length > 0) {
|
|
806
|
-
console.log(`\n## Coverage Gaps (${coverage.gaps.length})`);
|
|
807
|
-
for (const gap of coverage.gaps) {
|
|
808
|
-
console.log(`- ${gap}`);
|
|
809
|
-
}
|
|
810
|
-
} else {
|
|
811
|
-
console.log(`\n## Coverage Gaps`);
|
|
812
|
-
console.log('✅ All features covered!');
|
|
813
|
-
}
|
|
814
|
-
|
|
815
|
-
console.log('='.repeat(70));
|
|
816
|
-
}
|
|
817
|
-
|
|
818
|
-
/**
|
|
819
|
-
* CLI entry point - run as: node -e "import('./dist/tests/coverage-analysis.js')
|
|
820
|
-
* .then(async (m) => { const report = m.analyzeCoverage(); m.printCoverageReport(report); })"
|
|
821
|
-
*/
|
|
822
|
-
export async function runCLI(testDataPath?: string): Promise<void> {
|
|
823
|
-
const testDataDir = testDataPath || path.join(process.cwd(), 'test-data');
|
|
824
|
-
const report = analyzeCoverage(testDataDir);
|
|
825
|
-
printCoverageReport(report);
|
|
826
|
-
}
|
|
827
|
-
|
|
828
|
-
// For direct execution via Node.js
|
|
829
|
-
if (
|
|
830
|
-
globalThis.__filename?.endsWith('coverage-analysis.ts') &&
|
|
831
|
-
process.argv[1]?.endsWith('coverage-analysis.ts')
|
|
832
|
-
) {
|
|
833
|
-
const testDataPath = process.argv[2] || path.join(process.cwd(), 'test-data');
|
|
834
|
-
const report = analyzeCoverage(testDataPath);
|
|
835
|
-
printCoverageReport(report);
|
|
836
|
-
}
|