@divmain/jdm-asm 0.2.0
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/.github/workflows/ci.yml +53 -0
- package/.oxfmtrc.json +16 -0
- package/.oxlintrc.json +183 -0
- package/AGENTS.md +81 -0
- package/README.md +769 -0
- package/asconfig.json +23 -0
- package/benchmarks/fixtures.ts +111 -0
- package/benchmarks/input-fixtures.ts +80 -0
- package/benchmarks/run.ts +913 -0
- package/benchmarks/worker-pool.ts +223 -0
- package/benchmarks/worker.ts +374 -0
- package/dist/index.d.ts +996 -0
- package/dist/index.js +12239 -0
- package/dist/index.js.map +1 -0
- package/package.json +49 -0
- package/scripts/run-all-tests.ts +220 -0
- package/src/compiler/EXPRESSION_SUBSETS.md +228 -0
- package/src/compiler/asc-compiler.ts +315 -0
- package/src/compiler/ast-types.ts +215 -0
- package/src/compiler/build.ts +56 -0
- package/src/compiler/cache.ts +414 -0
- package/src/compiler/code-generators.ts +211 -0
- package/src/compiler/codegen/index.ts +15 -0
- package/src/compiler/codegen/js-marshal.ts +999 -0
- package/src/compiler/codegen/js-validation.ts +243 -0
- package/src/compiler/codegen.ts +19 -0
- package/src/compiler/compile-time-validation.ts +507 -0
- package/src/compiler/cst-visitor.ts +434 -0
- package/src/compiler/errors.ts +227 -0
- package/src/compiler/expression-parser.ts +536 -0
- package/src/compiler/graph.ts +197 -0
- package/src/compiler/index.ts +199 -0
- package/src/compiler/input-validation.ts +33 -0
- package/src/compiler/marshal-gen.ts +21 -0
- package/src/compiler/nodes/context-resolvers.ts +197 -0
- package/src/compiler/nodes/decision-table.ts +507 -0
- package/src/compiler/nodes/decision.ts +292 -0
- package/src/compiler/nodes/expression-compiler.ts +526 -0
- package/src/compiler/nodes/expression.ts +425 -0
- package/src/compiler/nodes/function.ts +316 -0
- package/src/compiler/nodes/input.ts +60 -0
- package/src/compiler/nodes/switch.ts +547 -0
- package/src/compiler/optimizer.ts +948 -0
- package/src/compiler/orchestrator.ts +352 -0
- package/src/compiler/parser.ts +115 -0
- package/src/compiler/result-selection.ts +161 -0
- package/src/compiler/runtime/index.ts +26 -0
- package/src/compiler/runtime-codegen.ts +211 -0
- package/src/compiler/runtime-validation-codegen.ts +294 -0
- package/src/compiler/runtime.ts +452 -0
- package/src/compiler/schema.ts +245 -0
- package/src/compiler/switch-branch-detection.ts +92 -0
- package/src/compiler/types.ts +136 -0
- package/src/compiler/unary-ast-transforms.ts +148 -0
- package/src/compiler/unary-parser.ts +301 -0
- package/src/compiler/unary-transform.ts +161 -0
- package/src/compiler/utils.ts +27 -0
- package/src/compiler/virtual-fs.ts +90 -0
- package/src/compiler/wasm-instantiate.ts +127 -0
- package/src/index.ts +1 -0
- package/src/runtime/arrays.ts +579 -0
- package/src/runtime/context.ts +189 -0
- package/src/runtime/expressions.ts +1811 -0
- package/src/runtime/index.ts +8 -0
- package/src/runtime/memory.ts +607 -0
- package/src/runtime/strings.ts +260 -0
- package/src/runtime/tables.ts +96 -0
- package/src/runtime/tsconfig.json +4 -0
- package/src/runtime/values.ts +209 -0
- package/test-data/README.md +83 -0
- package/test-data/decision-tables/basic/8k.json +87992 -0
- package/test-data/decision-tables/basic/affiliate-commission-calculator.json +228 -0
- package/test-data/decision-tables/basic/airline-loyalty-points-calculations.json +285 -0
- package/test-data/decision-tables/basic/airline-upgrade-eligibility.json +466 -0
- package/test-data/decision-tables/basic/auto-insurance-premium-calculator.json +412 -0
- package/test-data/decision-tables/basic/booking-personalization-system.json +553 -0
- package/test-data/decision-tables/basic/care-team-assignment-system.json +585 -0
- package/test-data/decision-tables/basic/claim-validation-system.json +307 -0
- package/test-data/decision-tables/basic/clinical-lab-result-interpreter.json +433 -0
- package/test-data/decision-tables/basic/clinical-treatment-protocol.json +474 -0
- package/test-data/decision-tables/basic/credit-limit-adjustment.json +479 -0
- package/test-data/decision-tables/basic/customer-eligibility-engine.json +551 -0
- package/test-data/decision-tables/basic/customer-lifetime-value.json +200 -0
- package/test-data/decision-tables/basic/customer-onboarding-kyc-verification.json +611 -0
- package/test-data/decision-tables/basic/customer-service-escalation.json +191 -0
- package/test-data/decision-tables/basic/decision-table-discounts.json +168 -0
- package/test-data/decision-tables/basic/decision-table-shipping.json +398 -0
- package/test-data/decision-tables/basic/delivery-route-optimizer.json +271 -0
- package/test-data/decision-tables/basic/device-compatibility-checker.json +303 -0
- package/test-data/decision-tables/basic/disaster-relief-fund-allocation.json +296 -0
- package/test-data/decision-tables/basic/dynamic-fx-rate-pricing-system.json +237 -0
- package/test-data/decision-tables/basic/dynamic-marketplace-comission-calculator.json +242 -0
- package/test-data/decision-tables/basic/dynamic-shipping-cost-calculator.json +378 -0
- package/test-data/decision-tables/basic/dynamic-tarrif-engine.json +289 -0
- package/test-data/decision-tables/basic/dynamic-ticket-pricing.json +325 -0
- package/test-data/decision-tables/basic/empty-column-with-space.json +100 -0
- package/test-data/decision-tables/basic/empty-column-without-space.json +100 -0
- package/test-data/decision-tables/basic/environment-compliance-assessment.json +386 -0
- package/test-data/decision-tables/basic/expression-table-map.json +313 -0
- package/test-data/decision-tables/basic/flash-sale-eligibility.json +366 -0
- package/test-data/decision-tables/basic/flight-dispatch-decision-system.json +455 -0
- package/test-data/decision-tables/basic/flight-rebooking-fee-calculator.json +406 -0
- package/test-data/decision-tables/basic/government-assistance.json +299 -0
- package/test-data/decision-tables/basic/grant-funding-distribution.json +307 -0
- package/test-data/decision-tables/basic/hazardous-materials-management-system.json +414 -0
- package/test-data/decision-tables/basic/immigration-eligibility-evaluator.json +765 -0
- package/test-data/decision-tables/basic/import-duties-calculator.json +318 -0
- package/test-data/decision-tables/basic/insurance-agent-commission.json +228 -0
- package/test-data/decision-tables/basic/insurance-coverage-calculator.json +362 -0
- package/test-data/decision-tables/basic/insurance-underwriting-risk.json +321 -0
- package/test-data/decision-tables/basic/international-roaming-policy-manager.json +199 -0
- package/test-data/decision-tables/basic/legacy-plan-management.json +434 -0
- package/test-data/decision-tables/basic/marketplace-listing-verification-system.json +334 -0
- package/test-data/decision-tables/basic/medication-dosage-calculator.json +318 -0
- package/test-data/decision-tables/basic/merch-bags.json +171 -0
- package/test-data/decision-tables/basic/municipal-permit-evaluation-system.json +364 -0
- package/test-data/decision-tables/basic/mvno-partner-enablement.json +313 -0
- package/test-data/decision-tables/basic/partner-revenue-sharing.json +244 -0
- package/test-data/decision-tables/basic/payment-routing-and-fee-calculator.json +475 -0
- package/test-data/decision-tables/basic/policy-discount-calculator.json +307 -0
- package/test-data/decision-tables/basic/policy-eligibility-analyzer.json +299 -0
- package/test-data/decision-tables/basic/product-listing-scoring.json +358 -0
- package/test-data/decision-tables/basic/realtime-fraud-detection.json +235 -0
- package/test-data/decision-tables/basic/regional-compliance-manager.json +278 -0
- package/test-data/decision-tables/basic/returns-and-refund-policy.json +366 -0
- package/test-data/decision-tables/basic/returns-processing-system.json +448 -0
- package/test-data/decision-tables/basic/school-district-resource-allocation.json +282 -0
- package/test-data/decision-tables/basic/seat-map-optimization.json +325 -0
- package/test-data/decision-tables/basic/seller-fee-calculator.json +307 -0
- package/test-data/decision-tables/basic/service-level-agreement-enforcement.json +575 -0
- package/test-data/decision-tables/basic/smart-financial-product-matcher.json +249 -0
- package/test-data/decision-tables/basic/supply-chain-risk.json +316 -0
- package/test-data/decision-tables/basic/table-loop.json +93 -0
- package/test-data/decision-tables/basic/table.json +76 -0
- package/test-data/decision-tables/basic/traffic-violation-penalty-calculator.json +436 -0
- package/test-data/decision-tables/basic/transaction-compliance-classifier.json +525 -0
- package/test-data/decision-tables/basic/vehicle-claims-resolution.json +310 -0
- package/test-data/decision-tables/basic/warehouse-storage-location.json +345 -0
- package/test-data/decision-tables/hit-policy-collect/collect-multiple-matches.json +127 -0
- package/test-data/decision-tables/hit-policy-collect/collect-no-match.json +95 -0
- package/test-data/decision-tables/hit-policy-first/first-match.json +103 -0
- package/test-data/decision-tables/hit-policy-first/no-match.json +95 -0
- package/test-data/decision-tables/hit-policy-output-order/output-order-respected.json +94 -0
- package/test-data/decision-tables/hit-policy-output-order/string-output-order.json +94 -0
- package/test-data/decision-tables/hit-policy-priority/priority-respected.json +86 -0
- package/test-data/decision-tables/hit-policy-rule-order/rule-order-respected.json +94 -0
- package/test-data/decision-tables/hit-policy-unique/all-match-error.json +89 -0
- package/test-data/decision-tables/hit-policy-unique/multiple-match-error.json +89 -0
- package/test-data/decision-tables/hit-policy-unique/no-match.json +88 -0
- package/test-data/decision-tables/hit-policy-unique/unique-match.json +99 -0
- package/test-data/expressions/arithmetic/error-cyclic.json +114 -0
- package/test-data/expressions/arithmetic/error-missing-input.json +54 -0
- package/test-data/expressions/arithmetic/error-missing-output.json +54 -0
- package/test-data/expressions/arithmetic/expression-default.json +93 -0
- package/test-data/expressions/arithmetic/expression-fields.json +94 -0
- package/test-data/expressions/arithmetic/expression-loop.json +94 -0
- package/test-data/expressions/arithmetic/expression-passthrough.json +108 -0
- package/test-data/expressions/arithmetic/expression.json +69 -0
- package/test-data/expressions/arithmetic/nested-request.json +125 -0
- package/test-data/expressions/arithmetic/number-function.json +58 -0
- package/test-data/expressions/arithmetic/test-number-functions.json +68 -0
- package/test-data/expressions/functions/all.json +149 -0
- package/test-data/expressions/functions/avg.json +89 -0
- package/test-data/expressions/functions/filter.json +109 -0
- package/test-data/expressions/functions/flat.json +167 -0
- package/test-data/expressions/functions/map-strings.json +65 -0
- package/test-data/expressions/functions/map.json +73 -0
- package/test-data/expressions/functions/reduce.json +49 -0
- package/test-data/expressions/functions/some.json +175 -0
- package/test-data/expressions/functions/sort-strings.json +97 -0
- package/test-data/expressions/functions/sort.json +97 -0
- package/test-data/expressions/logical/logical-and.json +116 -0
- package/test-data/expressions/logical/logical-complex.json +260 -0
- package/test-data/expressions/logical/logical-not.json +111 -0
- package/test-data/expressions/logical/logical-or.json +123 -0
- package/test-data/expressions/string/string-comparison.json +128 -0
- package/test-data/expressions/string/string-concat.json +106 -0
- package/test-data/expressions/string/string-contains.json +125 -0
- package/test-data/expressions/string/string-endsWith.json +113 -0
- package/test-data/expressions/string/string-indexOf.json +131 -0
- package/test-data/expressions/string/string-join.json +92 -0
- package/test-data/expressions/string/string-lower.json +94 -0
- package/test-data/expressions/string/string-replace.json +130 -0
- package/test-data/expressions/string/string-split.json +101 -0
- package/test-data/expressions/string/string-startsWith.json +113 -0
- package/test-data/expressions/string/string-substring.json +138 -0
- package/test-data/expressions/string/string-trim.json +100 -0
- package/test-data/expressions/string/string-upper.json +94 -0
- package/test-data/other/custom.json +51 -0
- package/test-data/other/customer-input-schema.json +34 -0
- package/test-data/other/customer-output-schema.json +34 -0
- package/test-data/other/passthrough.json +31 -0
- package/test-data/sub-decisions/basic/$nodes-child.json +31 -0
- package/test-data/sub-decisions/basic/$nodes-parent.json +49 -0
- package/test-data/sub-decisions/basic/recursive-table1.json +49 -0
- package/test-data/sub-decisions/basic/recursive-table2.json +49 -0
- package/test-data/sub-decisions/complex-multi/approval-decision.json +31 -0
- package/test-data/sub-decisions/complex-multi/complex-dag.json +175 -0
- package/test-data/sub-decisions/complex-multi/credit-check.json +31 -0
- package/test-data/sub-decisions/complex-multi/customer-segmentation.json +31 -0
- package/test-data/sub-decisions/complex-multi/discount-eligibility.json +31 -0
- package/test-data/sub-decisions/complex-multi/eligibility-check.json +31 -0
- package/test-data/sub-decisions/complex-multi/final-offer.json +31 -0
- package/test-data/sub-decisions/complex-multi/income-verification.json +31 -0
- package/test-data/sub-decisions/complex-multi/linear-chain.json +121 -0
- package/test-data/sub-decisions/complex-multi/pricing-calculation.json +31 -0
- package/test-data/sub-decisions/complex-multi/product-eligibility.json +31 -0
- package/test-data/sub-decisions/complex-multi/risk-assessment.json +31 -0
- package/test-data/sub-decisions/complex-multi/shared-validation.json +31 -0
- package/test-data/sub-decisions/complex-multi/validation.json +31 -0
- package/test-data/sub-decisions/diamond/decision-a.json +31 -0
- package/test-data/sub-decisions/diamond/decision-b.json +31 -0
- package/test-data/sub-decisions/diamond/decision-c.json +31 -0
- package/test-data/sub-decisions/diamond/decision-shared.json +31 -0
- package/test-data/sub-decisions/diamond/diamond-pattern.json +109 -0
- package/test-data/sub-decisions/error-propagation/parent-calls-error.json +44 -0
- package/test-data/sub-decisions/error-propagation/sub-decision-with-error.json +60 -0
- package/test-data/switch-nodes/basic/account-dormancy-management.json +245 -0
- package/test-data/switch-nodes/basic/application-risk-assessment.json +474 -0
- package/test-data/switch-nodes/basic/cellular-data-rollover-system.json +281 -0
- package/test-data/switch-nodes/basic/clinical-pathway-selection.json +454 -0
- package/test-data/switch-nodes/basic/insurance-prior-authorization.json +467 -0
- package/test-data/switch-nodes/basic/last-mile-delivery-assignment.json +373 -0
- package/test-data/switch-nodes/basic/loan-approval.json +469 -0
- package/test-data/switch-nodes/basic/multi-switch.json +498 -0
- package/test-data/switch-nodes/basic/online-checkin-eligibility.json +285 -0
- package/test-data/switch-nodes/basic/order-consolidation-system.json +493 -0
- package/test-data/switch-nodes/basic/seller-approval-workflow.json +383 -0
- package/test-data/switch-nodes/basic/set-fee.json +243 -0
- package/test-data/switch-nodes/basic/shipping-carrier-selector.json +379 -0
- package/test-data/switch-nodes/basic/switch-node.json +167 -0
- package/test-data/switch-nodes/basic/switch-performance-2.json +1307 -0
- package/test-data/switch-nodes/basic/switch-performance.json +691 -0
- package/test-data/switch-nodes/basic/tax-exemption.json +295 -0
- package/test-data/switch-nodes/basic/warehouse-cross-docking.json +313 -0
- package/test-data/switch-nodes/default-cases/switch-with-default.json +134 -0
- package/test-data/zen-reference/$nodes-child.json +69 -0
- package/test-data/zen-reference/$nodes-parent.json +34 -0
- package/test-data/zen-reference/8k.json +87992 -0
- package/test-data/zen-reference/credit-analysis.json +324 -0
- package/test-data/zen-reference/custom.json +51 -0
- package/test-data/zen-reference/customer-input-schema.json +34 -0
- package/test-data/zen-reference/customer-output-schema.json +34 -0
- package/test-data/zen-reference/error-cyclic.json +114 -0
- package/test-data/zen-reference/error-missing-input.json +54 -0
- package/test-data/zen-reference/error-missing-output.json +54 -0
- package/test-data/zen-reference/expression.json +69 -0
- package/test-data/zen-reference/function-v2.json +48 -0
- package/test-data/zen-reference/function.json +46 -0
- package/test-data/zen-reference/graphs/account-dormancy-management.json +245 -0
- package/test-data/zen-reference/graphs/affiliate-commission-calculator.json +228 -0
- package/test-data/zen-reference/graphs/airline-loyalty-points-calculations.json +285 -0
- package/test-data/zen-reference/graphs/airline-upgrade-eligibility.json +466 -0
- package/test-data/zen-reference/graphs/aml.json +537 -0
- package/test-data/zen-reference/graphs/application-risk-assessment.json +474 -0
- package/test-data/zen-reference/graphs/auto-insurance-premium-calculator.json +412 -0
- package/test-data/zen-reference/graphs/booking-personalization-system.json +553 -0
- package/test-data/zen-reference/graphs/care-team-assignment-system.json +585 -0
- package/test-data/zen-reference/graphs/cellular-data-rollover-system.json +281 -0
- package/test-data/zen-reference/graphs/claim-validation-system.json +307 -0
- package/test-data/zen-reference/graphs/clinical-lab-result-interpreter.json +433 -0
- package/test-data/zen-reference/graphs/clinical-pathway-selection.json +454 -0
- package/test-data/zen-reference/graphs/clinical-treatment-protocol.json +474 -0
- package/test-data/zen-reference/graphs/company-analysis.json +390 -0
- package/test-data/zen-reference/graphs/credit-limit-adjustment.json +479 -0
- package/test-data/zen-reference/graphs/customer-eligibility-engine.json +551 -0
- package/test-data/zen-reference/graphs/customer-lifetime-value.json +200 -0
- package/test-data/zen-reference/graphs/customer-onboarding-kyc-verification.json +611 -0
- package/test-data/zen-reference/graphs/customer-service-escalation.json +191 -0
- package/test-data/zen-reference/graphs/decision-table-discounts.json +168 -0
- package/test-data/zen-reference/graphs/decision-table-shipping.json +398 -0
- package/test-data/zen-reference/graphs/delivery-route-optimizer.json +271 -0
- package/test-data/zen-reference/graphs/device-compatibility-checker.json +303 -0
- package/test-data/zen-reference/graphs/disaster-relief-fund-allocation.json +296 -0
- package/test-data/zen-reference/graphs/dynamic-fx-rate-pricing-system.json +237 -0
- package/test-data/zen-reference/graphs/dynamic-marketplace-comission-calculator.json +242 -0
- package/test-data/zen-reference/graphs/dynamic-shipping-cost-calculator.json +378 -0
- package/test-data/zen-reference/graphs/dynamic-tarrif-engine.json +289 -0
- package/test-data/zen-reference/graphs/dynamic-ticket-pricing.json +325 -0
- package/test-data/zen-reference/graphs/empty-column-with-space.json +100 -0
- package/test-data/zen-reference/graphs/empty-column-without-space.json +100 -0
- package/test-data/zen-reference/graphs/environment-compliance-assessment.json +386 -0
- package/test-data/zen-reference/graphs/expression-default.json +93 -0
- package/test-data/zen-reference/graphs/expression-fields.json +94 -0
- package/test-data/zen-reference/graphs/expression-loop.json +94 -0
- package/test-data/zen-reference/graphs/expression-passthrough.json +108 -0
- package/test-data/zen-reference/graphs/expression-table-map.json +313 -0
- package/test-data/zen-reference/graphs/flash-sale-eligibility.json +366 -0
- package/test-data/zen-reference/graphs/flight-dispatch-decision-system.json +455 -0
- package/test-data/zen-reference/graphs/flight-rebooking-fee-calculator.json +406 -0
- package/test-data/zen-reference/graphs/government-assistance.json +299 -0
- package/test-data/zen-reference/graphs/grant-funding-distribution.json +307 -0
- package/test-data/zen-reference/graphs/hazardous-materials-management-system.json +414 -0
- package/test-data/zen-reference/graphs/immigration-eligibility-evaluator.json +765 -0
- package/test-data/zen-reference/graphs/import-duties-calculator.json +318 -0
- package/test-data/zen-reference/graphs/insurance-agent-commission.json +228 -0
- package/test-data/zen-reference/graphs/insurance-breakdown.json +421 -0
- package/test-data/zen-reference/graphs/insurance-coverage-calculator.json +362 -0
- package/test-data/zen-reference/graphs/insurance-prior-authorization.json +467 -0
- package/test-data/zen-reference/graphs/insurance-underwriting-risk.json +321 -0
- package/test-data/zen-reference/graphs/international-roaming-policy-manager.json +199 -0
- package/test-data/zen-reference/graphs/last-mile-delivery-assignment.json +373 -0
- package/test-data/zen-reference/graphs/legacy-plan-management.json +434 -0
- package/test-data/zen-reference/graphs/loan-approval.json +469 -0
- package/test-data/zen-reference/graphs/marketplace-listing-verification-system.json +334 -0
- package/test-data/zen-reference/graphs/medication-dosage-calculator.json +318 -0
- package/test-data/zen-reference/graphs/merch-bags.json +171 -0
- package/test-data/zen-reference/graphs/multi-switch.json +498 -0
- package/test-data/zen-reference/graphs/municipal-permit-evaluation-system.json +364 -0
- package/test-data/zen-reference/graphs/mvno-partner-enablement.json +313 -0
- package/test-data/zen-reference/graphs/nested-request.json +125 -0
- package/test-data/zen-reference/graphs/online-checkin-eligibility.json +285 -0
- package/test-data/zen-reference/graphs/order-consolidation-system.json +493 -0
- package/test-data/zen-reference/graphs/partner-revenue-sharing.json +244 -0
- package/test-data/zen-reference/graphs/payment-routing-and-fee-calculator.json +475 -0
- package/test-data/zen-reference/graphs/policy-discount-calculator.json +307 -0
- package/test-data/zen-reference/graphs/policy-eligibility-analyzer.json +299 -0
- package/test-data/zen-reference/graphs/product-listing-scoring.json +358 -0
- package/test-data/zen-reference/graphs/realtime-fraud-detection.json +235 -0
- package/test-data/zen-reference/graphs/regional-compliance-manager.json +278 -0
- package/test-data/zen-reference/graphs/returns-and-refund-policy.json +366 -0
- package/test-data/zen-reference/graphs/returns-processing-system.json +448 -0
- package/test-data/zen-reference/graphs/school-district-resource-allocation.json +282 -0
- package/test-data/zen-reference/graphs/seat-map-optimization.json +325 -0
- package/test-data/zen-reference/graphs/seller-approval-workflow.json +383 -0
- package/test-data/zen-reference/graphs/seller-fee-calculator.json +307 -0
- package/test-data/zen-reference/graphs/service-level-agreement-enforcement.json +575 -0
- package/test-data/zen-reference/graphs/set-fee.json +243 -0
- package/test-data/zen-reference/graphs/shipping-carrier-selector.json +379 -0
- package/test-data/zen-reference/graphs/smart-financial-product-matcher.json +249 -0
- package/test-data/zen-reference/graphs/supply-chain-risk.json +316 -0
- package/test-data/zen-reference/graphs/table-loop.json +93 -0
- package/test-data/zen-reference/graphs/tax-exemption.json +295 -0
- package/test-data/zen-reference/graphs/traffic-violation-penalty-calculator.json +436 -0
- package/test-data/zen-reference/graphs/transaction-compliance-classifier.json +525 -0
- package/test-data/zen-reference/graphs/vehicle-claims-resolution.json +310 -0
- package/test-data/zen-reference/graphs/warehouse-cross-docking.json +313 -0
- package/test-data/zen-reference/graphs/warehouse-storage-location.json +345 -0
- package/test-data/zen-reference/http-function.json +34 -0
- package/test-data/zen-reference/infinite-function.json +46 -0
- package/test-data/zen-reference/js/imports.js +25 -0
- package/test-data/zen-reference/passthrough.json +31 -0
- package/test-data/zen-reference/recursive-table1.json +49 -0
- package/test-data/zen-reference/recursive-table2.json +49 -0
- package/test-data/zen-reference/sleep-function.json +34 -0
- package/test-data/zen-reference/switch-node.json +167 -0
- package/test-data/zen-reference/switch-performance-2.json +1307 -0
- package/test-data/zen-reference/switch-performance.json +691 -0
- package/test-data/zen-reference/table.json +76 -0
- package/tests/helpers/index.ts +73 -0
- package/tests/helpers/mock-context.ts +231 -0
- package/tests/helpers/round-trip.ts +398 -0
- package/tests/helpers/test-harness-comparison.ts +325 -0
- package/tests/helpers/test-harness-wasm.ts +710 -0
- package/tests/helpers/test-harness.ts +28 -0
- package/tests/helpers/wasm-test.ts +659 -0
- package/tests/integration/compilation-errors.test.ts +864 -0
- package/tests/integration/decision-tables.test.ts +531 -0
- package/tests/integration/edge-cases.test.ts +787 -0
- package/tests/integration/expressions.test.ts +513 -0
- package/tests/integration/function-node-integration.test.ts +182 -0
- package/tests/integration/sub-decisions.test.ts +108 -0
- package/tests/integration/switch-nodes.test.ts +399 -0
- package/tests/integration/unary-or-matching.test.ts +53 -0
- package/tests/integration/wasm-data-types.test.ts +398 -0
- package/tests/integration/wasm-errors.test.ts +199 -0
- package/tests/integration/wasm-execution.test.ts +348 -0
- package/tests/integration/wasm-memory.test.ts +228 -0
- package/tests/scripts/analyze-coverage.ts +166 -0
- package/tests/scripts/categorize-tests.ts +396 -0
- package/tests/scripts/coverage-analysis.ts +836 -0
- package/tests/unit/compiler/cache.test.ts +238 -0
- package/tests/unit/compiler/errors.test.ts +316 -0
- package/tests/unit/compiler/graph-scalability.test.ts +510 -0
- package/tests/unit/compiler/graph.test.ts +878 -0
- package/tests/unit/compiler/input-validation.test.ts +447 -0
- package/tests/unit/compiler/logical-and-parser.test.ts +143 -0
- package/tests/unit/compiler/logical-not-parser.test.ts +107 -0
- package/tests/unit/compiler/logical-or-parser.test.ts +236 -0
- package/tests/unit/compiler/marshal-gen/marshal-gen.test.ts +97 -0
- package/tests/unit/compiler/nodes/decision-table.test.ts +103 -0
- package/tests/unit/compiler/nodes/decision.test.ts +182 -0
- package/tests/unit/compiler/nodes/function-compile.test.ts +204 -0
- package/tests/unit/compiler/nodes/function.test.ts +176 -0
- package/tests/unit/compiler/nodes/input.test.ts +30 -0
- package/tests/unit/compiler/nodes/switch.test.ts +127 -0
- package/tests/unit/compiler/optimizer-cache.test.ts +327 -0
- package/tests/unit/compiler/optimizer-implementation.test.ts +625 -0
- package/tests/unit/compiler/parser.test.ts +508 -0
- package/tests/unit/compiler/runtime-error-cleanup.test.ts +426 -0
- package/tests/unit/compiler/runtime-validation.test.ts +303 -0
- package/tests/unit/compiler/runtime.test.ts +221 -0
- package/tests/unit/compiler/schema/schema.test.ts +248 -0
- package/tests/unit/compiler/unary-ast-transforms.test.ts +245 -0
- package/tsconfig.json +27 -0
- package/tsup.config.ts +11 -0
- package/vitest.config.ts +12 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
pull_request:
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
lint-and-build:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
|
|
13
|
+
steps:
|
|
14
|
+
- name: Checkout code
|
|
15
|
+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8
|
|
16
|
+
|
|
17
|
+
- name: Setup Node.js
|
|
18
|
+
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238
|
|
19
|
+
with:
|
|
20
|
+
node-version: '20'
|
|
21
|
+
cache: 'npm'
|
|
22
|
+
|
|
23
|
+
- name: Install dependencies
|
|
24
|
+
run: npm ci
|
|
25
|
+
|
|
26
|
+
- name: Format check
|
|
27
|
+
run: npm run format:check
|
|
28
|
+
|
|
29
|
+
- name: Lint
|
|
30
|
+
run: npm run lint
|
|
31
|
+
|
|
32
|
+
- name: Build
|
|
33
|
+
run: npm run build
|
|
34
|
+
|
|
35
|
+
test:
|
|
36
|
+
runs-on: depot-ubuntu-24.04-4
|
|
37
|
+
needs: lint-and-build
|
|
38
|
+
|
|
39
|
+
steps:
|
|
40
|
+
- name: Checkout code
|
|
41
|
+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8
|
|
42
|
+
|
|
43
|
+
- name: Setup Node.js
|
|
44
|
+
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238
|
|
45
|
+
with:
|
|
46
|
+
node-version: '20'
|
|
47
|
+
cache: 'npm'
|
|
48
|
+
|
|
49
|
+
- name: Install dependencies
|
|
50
|
+
run: npm ci
|
|
51
|
+
|
|
52
|
+
- name: Test
|
|
53
|
+
run: npm run test
|
package/.oxfmtrc.json
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "./node_modules/oxfmt/configuration_schema.json",
|
|
3
|
+
"singleQuote": true,
|
|
4
|
+
"jsxSingleQuote": true,
|
|
5
|
+
"quoteProps": "as-needed",
|
|
6
|
+
"semi": true,
|
|
7
|
+
"trailingComma": "all",
|
|
8
|
+
"arrowParens": "always",
|
|
9
|
+
"bracketSpacing": true,
|
|
10
|
+
"bracketSameLine": false,
|
|
11
|
+
"ignorePatterns": [
|
|
12
|
+
"node_modules/**",
|
|
13
|
+
"dist/**",
|
|
14
|
+
"build/**"
|
|
15
|
+
]
|
|
16
|
+
}
|
package/.oxlintrc.json
ADDED
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "./node_modules/oxlint/configuration_schema.json",
|
|
3
|
+
"plugins": [
|
|
4
|
+
"unicorn",
|
|
5
|
+
"typescript",
|
|
6
|
+
"oxc",
|
|
7
|
+
"import",
|
|
8
|
+
"vitest"
|
|
9
|
+
],
|
|
10
|
+
"categories": {},
|
|
11
|
+
"rules": {
|
|
12
|
+
"constructor-super": "error",
|
|
13
|
+
"for-direction": "error",
|
|
14
|
+
"no-async-promise-executor": "error",
|
|
15
|
+
"no-caller": "error",
|
|
16
|
+
"no-class-assign": "error",
|
|
17
|
+
"no-compare-neg-zero": "error",
|
|
18
|
+
"no-cond-assign": "error",
|
|
19
|
+
"no-const-assign": "error",
|
|
20
|
+
"no-constant-binary-expression": "error",
|
|
21
|
+
"no-constant-condition": "error",
|
|
22
|
+
"no-control-regex": "error",
|
|
23
|
+
"no-debugger": "error",
|
|
24
|
+
"no-delete-var": "error",
|
|
25
|
+
"no-dupe-class-members": "error",
|
|
26
|
+
"no-dupe-else-if": "error",
|
|
27
|
+
"no-dupe-keys": "error",
|
|
28
|
+
"no-duplicate-case": "error",
|
|
29
|
+
"no-empty-character-class": "error",
|
|
30
|
+
"no-empty-pattern": "error",
|
|
31
|
+
"no-empty-static-block": "error",
|
|
32
|
+
"no-eval": "error",
|
|
33
|
+
"no-ex-assign": "error",
|
|
34
|
+
"no-extra-boolean-cast": "error",
|
|
35
|
+
"no-func-assign": "error",
|
|
36
|
+
"no-global-assign": "error",
|
|
37
|
+
"no-import-assign": "error",
|
|
38
|
+
"no-invalid-regexp": "error",
|
|
39
|
+
"no-irregular-whitespace": "error",
|
|
40
|
+
"no-loss-of-precision": "error",
|
|
41
|
+
"no-new-native-nonconstructor": "error",
|
|
42
|
+
"no-nonoctal-decimal-escape": "error",
|
|
43
|
+
"no-obj-calls": "error",
|
|
44
|
+
"no-self-assign": "error",
|
|
45
|
+
"no-setter-return": "error",
|
|
46
|
+
"no-shadow-restricted-names": "error",
|
|
47
|
+
"no-sparse-arrays": "warn",
|
|
48
|
+
"no-this-before-super": "error",
|
|
49
|
+
"no-unassigned-vars": "error",
|
|
50
|
+
"no-unsafe-finally": "error",
|
|
51
|
+
"no-unsafe-negation": "error",
|
|
52
|
+
"no-unsafe-optional-chaining": "error",
|
|
53
|
+
"no-unused-expressions": "error",
|
|
54
|
+
"no-unused-labels": "error",
|
|
55
|
+
"no-unused-private-class-members": "warn",
|
|
56
|
+
"no-unused-vars": "warn",
|
|
57
|
+
"no-useless-backreference": "error",
|
|
58
|
+
"no-useless-catch": "error",
|
|
59
|
+
"no-useless-escape": "error",
|
|
60
|
+
"no-useless-rename": "error",
|
|
61
|
+
"no-with": "error",
|
|
62
|
+
"require-yield": "error",
|
|
63
|
+
"use-isnan": "error",
|
|
64
|
+
"valid-typeof": "error",
|
|
65
|
+
"array-callback-return": "error",
|
|
66
|
+
"curly": "error",
|
|
67
|
+
"eqeqeq": "error",
|
|
68
|
+
"no-fallthrough": "error",
|
|
69
|
+
"no-promise-executor-return": "error",
|
|
70
|
+
"no-self-compare": "error",
|
|
71
|
+
"no-useless-constructor": "error",
|
|
72
|
+
"import/no-self-import": "error",
|
|
73
|
+
"oxc/bad-array-method-on-arguments": "error",
|
|
74
|
+
"oxc/bad-char-at-comparison": "error",
|
|
75
|
+
"oxc/bad-comparison-sequence": "error",
|
|
76
|
+
"oxc/bad-min-max-func": "error",
|
|
77
|
+
"oxc/bad-object-literal-comparison": "error",
|
|
78
|
+
"oxc/bad-replace-all-arg": "error",
|
|
79
|
+
"oxc/const-comparisons": "error",
|
|
80
|
+
"oxc/double-comparisons": "error",
|
|
81
|
+
"oxc/erasing-op": "error",
|
|
82
|
+
"oxc/missing-throw": "error",
|
|
83
|
+
"oxc/number-arg-out-of-range": "error",
|
|
84
|
+
"oxc/only-used-in-recursion": "warn",
|
|
85
|
+
"oxc/uninvoked-array-callback": "error",
|
|
86
|
+
"typescript/await-thenable": "error",
|
|
87
|
+
"typescript/consistent-type-imports": "error",
|
|
88
|
+
"typescript/no-array-delete": "error",
|
|
89
|
+
"typescript/no-base-to-string": "error",
|
|
90
|
+
"typescript/no-duplicate-enum-values": "error",
|
|
91
|
+
"typescript/no-duplicate-type-constituents": "error",
|
|
92
|
+
"typescript/no-extra-non-null-assertion": "error",
|
|
93
|
+
"typescript/no-floating-promises": "error",
|
|
94
|
+
"typescript/no-for-in-array": "error",
|
|
95
|
+
"typescript/no-implied-eval": "error",
|
|
96
|
+
"typescript/no-meaningless-void-operator": "error",
|
|
97
|
+
"typescript/no-misused-new": "error",
|
|
98
|
+
"typescript/no-misused-spread": "error",
|
|
99
|
+
"typescript/no-non-null-asserted-optional-chain": "error",
|
|
100
|
+
"typescript/no-redundant-type-constituents": "error",
|
|
101
|
+
"typescript/no-this-alias": "error",
|
|
102
|
+
"typescript/no-unnecessary-parameter-property-assignment": "error",
|
|
103
|
+
"typescript/no-unsafe-declaration-merging": "error",
|
|
104
|
+
"typescript/no-unsafe-unary-minus": "error",
|
|
105
|
+
"typescript/no-useless-empty-export": "error",
|
|
106
|
+
"typescript/no-wrapper-object-types": "error",
|
|
107
|
+
"typescript/prefer-as-const": "error",
|
|
108
|
+
"typescript/require-array-sort-compare": "error",
|
|
109
|
+
"typescript/restrict-template-expressions": "error",
|
|
110
|
+
"typescript/triple-slash-reference": "error",
|
|
111
|
+
"typescript/unbound-method": "error",
|
|
112
|
+
"typescript/no-confusing-non-null-assertion": "error",
|
|
113
|
+
"typescript/no-misused-promises": "error",
|
|
114
|
+
"typescript/no-unnecessary-type-assertion": "error",
|
|
115
|
+
"typescript/no-unnecessary-type-constraint": "error",
|
|
116
|
+
"typescript/only-throw-error": "error",
|
|
117
|
+
"typescript/prefer-nullish-coalescing": "warn",
|
|
118
|
+
"typescript/switch-exhaustiveness-check": "error",
|
|
119
|
+
"unicorn/no-await-in-promise-methods": "error",
|
|
120
|
+
"unicorn/no-empty-file": "error",
|
|
121
|
+
"unicorn/no-invalid-fetch-options": "error",
|
|
122
|
+
"unicorn/no-invalid-remove-event-listener": "error",
|
|
123
|
+
"unicorn/no-new-array": "error",
|
|
124
|
+
"unicorn/no-single-promise-in-promise-methods": "error",
|
|
125
|
+
"unicorn/no-thenable": "error",
|
|
126
|
+
"unicorn/no-unnecessary-await": "error",
|
|
127
|
+
"unicorn/no-useless-fallback-in-spread": "error",
|
|
128
|
+
"unicorn/no-useless-length-check": "warn",
|
|
129
|
+
"unicorn/no-useless-spread": "warn",
|
|
130
|
+
"unicorn/prefer-set-size": "error",
|
|
131
|
+
"unicorn/prefer-string-starts-ends-with": "error",
|
|
132
|
+
"unicorn/no-instanceof-array": "error",
|
|
133
|
+
"unicorn/prefer-array-some": "error",
|
|
134
|
+
"vitest/no-conditional-tests": "error",
|
|
135
|
+
"vitest/no-import-node-test": "error",
|
|
136
|
+
"jest/expect-expect": "off",
|
|
137
|
+
"jest/no-conditional-expect": "off",
|
|
138
|
+
"jest/require-to-throw-message": "off",
|
|
139
|
+
"jest/no-disabled-tests": "warn",
|
|
140
|
+
"vitest/warn-todo": "off"
|
|
141
|
+
},
|
|
142
|
+
"settings": {
|
|
143
|
+
"jsx-a11y": {
|
|
144
|
+
"polymorphicPropName": null,
|
|
145
|
+
"components": {},
|
|
146
|
+
"attributes": {}
|
|
147
|
+
},
|
|
148
|
+
"next": {
|
|
149
|
+
"rootDir": []
|
|
150
|
+
},
|
|
151
|
+
"react": {
|
|
152
|
+
"formComponents": [],
|
|
153
|
+
"linkComponents": [],
|
|
154
|
+
"version": null
|
|
155
|
+
},
|
|
156
|
+
"jsdoc": {
|
|
157
|
+
"ignorePrivate": false,
|
|
158
|
+
"ignoreInternal": false,
|
|
159
|
+
"ignoreReplacesDocs": true,
|
|
160
|
+
"overrideReplacesDocs": true,
|
|
161
|
+
"augmentsExtendsReplacesDocs": false,
|
|
162
|
+
"implementsReplacesDocs": false,
|
|
163
|
+
"exemptDestructuredRootsFromChecks": false,
|
|
164
|
+
"tagNamePreference": {}
|
|
165
|
+
},
|
|
166
|
+
"vitest": {
|
|
167
|
+
"typecheck": false
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
"env": {
|
|
171
|
+
"builtin": true
|
|
172
|
+
},
|
|
173
|
+
"globals": {},
|
|
174
|
+
"ignorePatterns": [
|
|
175
|
+
"src/runtime/**",
|
|
176
|
+
"node_modules/**",
|
|
177
|
+
"dist/**",
|
|
178
|
+
"build/**",
|
|
179
|
+
"coverage/**",
|
|
180
|
+
"*.config.ts",
|
|
181
|
+
"*.config.js"
|
|
182
|
+
]
|
|
183
|
+
}
|
package/AGENTS.md
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# JDM to AssemblyScript WASM Compiler - Development Commands
|
|
2
|
+
|
|
3
|
+
This file documents the project commands for use by agents.
|
|
4
|
+
|
|
5
|
+
## Commands
|
|
6
|
+
|
|
7
|
+
### Build
|
|
8
|
+
```bash
|
|
9
|
+
npm run build
|
|
10
|
+
```
|
|
11
|
+
Builds the project using tsup. Output is placed in the `dist/` directory.
|
|
12
|
+
|
|
13
|
+
### Test
|
|
14
|
+
```bash
|
|
15
|
+
npm run test # Run tests once
|
|
16
|
+
npm run test:watch # Run tests in watch mode
|
|
17
|
+
```
|
|
18
|
+
Runs tests using vitest.
|
|
19
|
+
|
|
20
|
+
## Verification
|
|
21
|
+
|
|
22
|
+
Before committing changes, run the following commands to ensure the codebase is in a good state:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npm run build # Build TypeScript
|
|
26
|
+
npm run asbuild # Build AssemblyScript (should produce no warnings)
|
|
27
|
+
npm run test # Run all tests
|
|
28
|
+
npm run lint # Run oxlint linter
|
|
29
|
+
npx tsc --noEmit # Type check (should produce no errors)
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Lint
|
|
33
|
+
```bash
|
|
34
|
+
npm run lint
|
|
35
|
+
```
|
|
36
|
+
Runs oxlint on the src/ and tests/ directories. Oxlint is configured via `.oxlintrc.json` with TypeScript, unicorn, and oxc plugins. Warnings are **not allowed**.
|
|
37
|
+
|
|
38
|
+
### Format
|
|
39
|
+
```bash
|
|
40
|
+
npm run format
|
|
41
|
+
```
|
|
42
|
+
Formatting is not yet configured (to be implemented in future phase).
|
|
43
|
+
|
|
44
|
+
### AssemblyScript Build
|
|
45
|
+
```bash
|
|
46
|
+
npm run asbuild
|
|
47
|
+
```
|
|
48
|
+
Builds AssemblyScript code to WebAssembly. Output is placed in the `build/` directory.
|
|
49
|
+
|
|
50
|
+
### Benchmark
|
|
51
|
+
```bash
|
|
52
|
+
npm run bench
|
|
53
|
+
```
|
|
54
|
+
Runs performance benchmarks using Mitata.
|
|
55
|
+
|
|
56
|
+
**Note:** Benchmark scripts use `--stack-size=65536` to handle compilation of large decision tables (8000+ rules). The AssemblyScript compiler's parser creates deeply nested AST nodes for if/else chains, which can exceed the default JavaScript call stack limit. See `CHUNKED_FUNCTION_GENERATION.md` for the long-term solution.
|
|
57
|
+
|
|
58
|
+
## Project Structure
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
jdm-asm/
|
|
62
|
+
├── src/
|
|
63
|
+
│ ├── compiler/ # Compiler source code
|
|
64
|
+
│ └── runtime/ # AssemblyScript runtime code
|
|
65
|
+
├── tests/
|
|
66
|
+
│ ├── integration/ # Integration tests (WASM execution, end-to-end)
|
|
67
|
+
│ ├── unit/ # Unit tests (organized by compiler module)
|
|
68
|
+
│ │ └── compiler/
|
|
69
|
+
│ │ ├── nodes/ # Node-specific tests
|
|
70
|
+
│ │ ├── schema/ # Schema tests
|
|
71
|
+
│ │ └── marshal-gen/ # Marshaling tests
|
|
72
|
+
│ ├── helpers/ # Test utilities (test-harness, wasm-test, etc.)
|
|
73
|
+
│ ├── scripts/ # Test analysis scripts
|
|
74
|
+
│ └── fixtures/ # Test fixture data
|
|
75
|
+
├── test-data/ # Ported zen-engine test fixtures (JDM JSON files)
|
|
76
|
+
├── build/ # Compiled WASM modules
|
|
77
|
+
├── benchmarks/ # Performance benchmarks
|
|
78
|
+
├── scripts/ # Project runner scripts
|
|
79
|
+
├── dist/ # Built JavaScript modules
|
|
80
|
+
└── package.json
|
|
81
|
+
```
|