kumi 0.0.30 → 0.0.33
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +21 -1
- data/README.md +31 -99
- data/data/kernels/ruby/core/arithmetic.yaml +2 -2
- data/docs/COMPOSED_SCHEMAS.md +137 -0
- data/docs/SCHEMA_IMPORTS.md +275 -0
- data/docs/SYNTAX.md +48 -0
- data/golden/array_element/expected/schema_ruby.rb +2 -27
- data/golden/array_index/expected/nast.txt +6 -6
- data/golden/array_index/expected/schema_ruby.rb +4 -31
- data/golden/array_operations/expected/lir_06_const_prop.txt +4 -8
- data/golden/array_operations/expected/schema_javascript.mjs +4 -8
- data/golden/array_operations/expected/schema_ruby.rb +10 -43
- data/golden/cascade_logic/expected/lir_06_const_prop.txt +7 -14
- data/golden/cascade_logic/expected/schema_javascript.mjs +7 -14
- data/golden/cascade_logic/expected/schema_ruby.rb +11 -45
- data/golden/chained_fusion/expected/lir_06_const_prop.txt +8 -18
- data/golden/chained_fusion/expected/schema_javascript.mjs +8 -18
- data/golden/chained_fusion/expected/schema_ruby.rb +14 -53
- data/golden/decimal_explicit/expected/schema_ruby.rb +4 -31
- data/golden/element_arrays/expected/lir_06_const_prop.txt +5 -11
- data/golden/element_arrays/expected/schema_javascript.mjs +5 -11
- data/golden/element_arrays/expected/schema_ruby.rb +13 -50
- data/golden/empty_and_null_inputs/expected/schema_ruby.rb +4 -31
- data/golden/example_xpto/expected/ast.txt +23 -0
- data/golden/example_xpto/expected/input_plan.txt +1 -0
- data/golden/example_xpto/expected/lir_00_unoptimized.txt +16 -0
- data/golden/example_xpto/expected/lir_01_hoist_scalar_references.txt +16 -0
- data/golden/example_xpto/expected/lir_02_inlined.txt +16 -0
- data/golden/example_xpto/expected/lir_03_cse.txt +16 -0
- data/golden/example_xpto/expected/lir_04_1_loop_fusion.txt +16 -0
- data/golden/example_xpto/expected/lir_04_loop_invcm.txt +16 -0
- data/golden/example_xpto/expected/lir_06_const_prop.txt +13 -0
- data/golden/example_xpto/expected/nast.txt +17 -0
- data/golden/example_xpto/expected/schema_javascript.mjs +13 -0
- data/golden/example_xpto/expected/schema_ruby.rb +13 -0
- data/golden/example_xpto/expected/snast.txt +17 -0
- data/golden/example_xpto/expected.json +4 -0
- data/golden/example_xpto/input.json +3 -0
- data/golden/example_xpto/schema.kumi +8 -0
- data/golden/function_overload/expected/schema_ruby.rb +2 -27
- data/golden/game_of_life/expected/lir_06_const_prop.txt +236 -287
- data/golden/game_of_life/expected/schema_javascript.mjs +32 -39
- data/golden/game_of_life/expected/schema_ruby.rb +34 -66
- data/golden/hash_keys/expected/lir_06_const_prop.txt +4 -10
- data/golden/hash_keys/expected/schema_javascript.mjs +6 -12
- data/golden/hash_keys/expected/schema_ruby.rb +8 -39
- data/golden/hash_value/expected/lir_06_const_prop.txt +3 -6
- data/golden/hash_value/expected/schema_javascript.mjs +3 -6
- data/golden/hash_value/expected/schema_ruby.rb +7 -37
- data/golden/hierarchical_complex/expected/lir_06_const_prop.txt +9 -18
- data/golden/hierarchical_complex/expected/schema_javascript.mjs +9 -18
- data/golden/hierarchical_complex/expected/schema_ruby.rb +14 -51
- data/golden/inline_rename_scope_leak/expected/lir_06_const_prop.txt +2 -6
- data/golden/inline_rename_scope_leak/expected/schema_javascript.mjs +2 -6
- data/golden/inline_rename_scope_leak/expected/schema_ruby.rb +7 -39
- data/golden/input_reference/expected/schema_ruby.rb +6 -35
- data/golden/interleaved_fusion/expected/lir_06_const_prop.txt +6 -14
- data/golden/interleaved_fusion/expected/schema_javascript.mjs +6 -14
- data/golden/interleaved_fusion/expected/schema_ruby.rb +11 -47
- data/golden/let_inline/expected/lir_06_const_prop.txt +1 -2
- data/golden/let_inline/expected/schema_javascript.mjs +1 -2
- data/golden/let_inline/expected/schema_ruby.rb +3 -29
- data/golden/loop_fusion/expected/lir_06_const_prop.txt +4 -10
- data/golden/loop_fusion/expected/schema_javascript.mjs +4 -10
- data/golden/loop_fusion/expected/schema_ruby.rb +8 -41
- data/golden/min_reduce_scope/expected/lir_06_const_prop.txt +3 -6
- data/golden/min_reduce_scope/expected/schema_javascript.mjs +3 -6
- data/golden/min_reduce_scope/expected/schema_ruby.rb +8 -39
- data/golden/mixed_dimensions/expected/lir_06_const_prop.txt +1 -2
- data/golden/mixed_dimensions/expected/schema_javascript.mjs +1 -2
- data/golden/mixed_dimensions/expected/schema_ruby.rb +5 -33
- data/golden/multirank_hoisting/expected/lir_06_const_prop.txt +9 -18
- data/golden/multirank_hoisting/expected/schema_javascript.mjs +9 -18
- data/golden/multirank_hoisting/expected/schema_ruby.rb +16 -55
- data/golden/nested_hash/expected/lir_06_const_prop.txt +1 -2
- data/golden/nested_hash/expected/schema_javascript.mjs +1 -2
- data/golden/nested_hash/expected/schema_ruby.rb +3 -29
- data/golden/reduction_broadcast/expected/schema_ruby.rb +5 -33
- data/golden/roll/expected/lir_06_const_prop.txt +8 -15
- data/golden/roll/expected/schema_javascript.mjs +8 -15
- data/golden/roll/expected/schema_ruby.rb +13 -48
- data/golden/schema_imports_broadcasting_with_imports/expected/ast.txt +26 -0
- data/golden/schema_imports_broadcasting_with_imports/expected/input_plan.txt +5 -0
- data/golden/schema_imports_broadcasting_with_imports/expected/lir_00_unoptimized.txt +20 -0
- data/golden/schema_imports_broadcasting_with_imports/expected/lir_01_hoist_scalar_references.txt +20 -0
- data/golden/schema_imports_broadcasting_with_imports/expected/lir_02_inlined.txt +22 -0
- data/golden/schema_imports_broadcasting_with_imports/expected/lir_03_cse.txt +21 -0
- data/golden/schema_imports_broadcasting_with_imports/expected/lir_04_1_loop_fusion.txt +21 -0
- data/golden/schema_imports_broadcasting_with_imports/expected/lir_04_loop_invcm.txt +21 -0
- data/golden/schema_imports_broadcasting_with_imports/expected/lir_06_const_prop.txt +21 -0
- data/golden/schema_imports_broadcasting_with_imports/expected/nast.txt +12 -0
- data/golden/schema_imports_broadcasting_with_imports/expected/schema_javascript.mjs +22 -0
- data/golden/schema_imports_broadcasting_with_imports/expected/schema_ruby.rb +24 -0
- data/golden/schema_imports_broadcasting_with_imports/expected/snast.txt +12 -0
- data/golden/schema_imports_broadcasting_with_imports/expected.json +4 -0
- data/golden/schema_imports_broadcasting_with_imports/input.json +7 -0
- data/golden/schema_imports_broadcasting_with_imports/schema.kumi +14 -0
- data/golden/schema_imports_complex_order_calc/expected/ast.txt +82 -0
- data/golden/schema_imports_complex_order_calc/expected/input_plan.txt +16 -0
- data/golden/schema_imports_complex_order_calc/expected/lir_00_unoptimized.txt +94 -0
- data/golden/schema_imports_complex_order_calc/expected/lir_01_hoist_scalar_references.txt +94 -0
- data/golden/schema_imports_complex_order_calc/expected/lir_02_inlined.txt +187 -0
- data/golden/schema_imports_complex_order_calc/expected/lir_03_cse.txt +131 -0
- data/golden/schema_imports_complex_order_calc/expected/lir_04_1_loop_fusion.txt +131 -0
- data/golden/schema_imports_complex_order_calc/expected/lir_04_loop_invcm.txt +131 -0
- data/golden/schema_imports_complex_order_calc/expected/lir_06_const_prop.txt +131 -0
- data/golden/schema_imports_complex_order_calc/expected/nast.txt +56 -0
- data/golden/schema_imports_complex_order_calc/expected/schema_javascript.mjs +147 -0
- data/golden/schema_imports_complex_order_calc/expected/schema_ruby.rb +149 -0
- data/golden/schema_imports_complex_order_calc/expected/snast.txt +56 -0
- data/golden/schema_imports_complex_order_calc/expected.json +12 -0
- data/golden/schema_imports_complex_order_calc/input.json +20 -0
- data/golden/schema_imports_complex_order_calc/schema.kumi +33 -0
- data/golden/schema_imports_composed_order/expected/ast.txt +33 -0
- data/golden/schema_imports_composed_order/expected/input_plan.txt +3 -0
- data/golden/schema_imports_composed_order/expected/lir_00_unoptimized.txt +25 -0
- data/golden/schema_imports_composed_order/expected/lir_01_hoist_scalar_references.txt +25 -0
- data/golden/schema_imports_composed_order/expected/lir_02_inlined.txt +33 -0
- data/golden/schema_imports_composed_order/expected/lir_03_cse.txt +33 -0
- data/golden/schema_imports_composed_order/expected/lir_04_1_loop_fusion.txt +33 -0
- data/golden/schema_imports_composed_order/expected/lir_04_loop_invcm.txt +33 -0
- data/golden/schema_imports_composed_order/expected/lir_06_const_prop.txt +33 -0
- data/golden/schema_imports_composed_order/expected/nast.txt +25 -0
- data/golden/schema_imports_composed_order/expected/schema_javascript.mjs +35 -0
- data/golden/schema_imports_composed_order/expected/schema_ruby.rb +33 -0
- data/golden/schema_imports_composed_order/expected/snast.txt +25 -0
- data/golden/schema_imports_composed_order/expected.json +6 -0
- data/golden/schema_imports_composed_order/input.json +5 -0
- data/golden/schema_imports_composed_order/schema.kumi +15 -0
- data/golden/schema_imports_discount_with_tax/expected/ast.txt +37 -0
- data/golden/schema_imports_discount_with_tax/expected/input_plan.txt +2 -0
- data/golden/schema_imports_discount_with_tax/expected/lir_00_unoptimized.txt +30 -0
- data/golden/schema_imports_discount_with_tax/expected/lir_01_hoist_scalar_references.txt +30 -0
- data/golden/schema_imports_discount_with_tax/expected/lir_02_inlined.txt +37 -0
- data/golden/schema_imports_discount_with_tax/expected/lir_03_cse.txt +34 -0
- data/golden/schema_imports_discount_with_tax/expected/lir_04_1_loop_fusion.txt +34 -0
- data/golden/schema_imports_discount_with_tax/expected/lir_04_loop_invcm.txt +34 -0
- data/golden/schema_imports_discount_with_tax/expected/lir_06_const_prop.txt +34 -0
- data/golden/schema_imports_discount_with_tax/expected/nast.txt +30 -0
- data/golden/schema_imports_discount_with_tax/expected/schema_javascript.mjs +37 -0
- data/golden/schema_imports_discount_with_tax/expected/schema_ruby.rb +34 -0
- data/golden/schema_imports_discount_with_tax/expected/snast.txt +30 -0
- data/golden/schema_imports_discount_with_tax/expected.json +7 -0
- data/golden/schema_imports_discount_with_tax/input.json +4 -0
- data/golden/schema_imports_discount_with_tax/schema.kumi +15 -0
- data/golden/schema_imports_line_items/expected/ast.txt +35 -0
- data/golden/schema_imports_line_items/expected/input_plan.txt +8 -0
- data/golden/schema_imports_line_items/expected/lir_00_unoptimized.txt +19 -0
- data/golden/schema_imports_line_items/expected/lir_01_hoist_scalar_references.txt +19 -0
- data/golden/schema_imports_line_items/expected/lir_02_inlined.txt +24 -0
- data/golden/schema_imports_line_items/expected/lir_03_cse.txt +22 -0
- data/golden/schema_imports_line_items/expected/lir_04_1_loop_fusion.txt +22 -0
- data/golden/schema_imports_line_items/expected/lir_04_loop_invcm.txt +22 -0
- data/golden/schema_imports_line_items/expected/lir_06_const_prop.txt +22 -0
- data/golden/schema_imports_line_items/expected/nast.txt +19 -0
- data/golden/schema_imports_line_items/expected/schema_javascript.mjs +23 -0
- data/golden/schema_imports_line_items/expected/schema_ruby.rb +22 -0
- data/golden/schema_imports_line_items/expected/snast.txt +19 -0
- data/golden/schema_imports_line_items/expected.json +5 -0
- data/golden/schema_imports_line_items/input.json +13 -0
- data/golden/schema_imports_line_items/schema.kumi +17 -0
- data/golden/schema_imports_multiple/expected/ast.txt +35 -0
- data/golden/schema_imports_multiple/expected/input_plan.txt +2 -0
- data/golden/schema_imports_multiple/expected/lir_00_unoptimized.txt +29 -0
- data/golden/schema_imports_multiple/expected/lir_01_hoist_scalar_references.txt +29 -0
- data/golden/schema_imports_multiple/expected/lir_02_inlined.txt +41 -0
- data/golden/schema_imports_multiple/expected/lir_03_cse.txt +37 -0
- data/golden/schema_imports_multiple/expected/lir_04_1_loop_fusion.txt +37 -0
- data/golden/schema_imports_multiple/expected/lir_04_loop_invcm.txt +37 -0
- data/golden/schema_imports_multiple/expected/lir_06_const_prop.txt +37 -0
- data/golden/schema_imports_multiple/expected/nast.txt +28 -0
- data/golden/schema_imports_multiple/expected/schema_javascript.mjs +40 -0
- data/golden/schema_imports_multiple/expected/schema_ruby.rb +37 -0
- data/golden/schema_imports_multiple/expected/snast.txt +28 -0
- data/golden/schema_imports_multiple/expected.json +7 -0
- data/golden/schema_imports_multiple/input.json +4 -0
- data/golden/schema_imports_multiple/schema.kumi +15 -0
- data/golden/schema_imports_nested_expressions/expected/ast.txt +31 -0
- data/golden/schema_imports_nested_expressions/expected/input_plan.txt +3 -0
- data/golden/schema_imports_nested_expressions/expected/lir_00_unoptimized.txt +22 -0
- data/golden/schema_imports_nested_expressions/expected/lir_01_hoist_scalar_references.txt +22 -0
- data/golden/schema_imports_nested_expressions/expected/lir_02_inlined.txt +32 -0
- data/golden/schema_imports_nested_expressions/expected/lir_03_cse.txt +32 -0
- data/golden/schema_imports_nested_expressions/expected/lir_04_1_loop_fusion.txt +32 -0
- data/golden/schema_imports_nested_expressions/expected/lir_04_loop_invcm.txt +32 -0
- data/golden/schema_imports_nested_expressions/expected/lir_06_const_prop.txt +28 -0
- data/golden/schema_imports_nested_expressions/expected/nast.txt +23 -0
- data/golden/schema_imports_nested_expressions/expected/schema_javascript.mjs +29 -0
- data/golden/schema_imports_nested_expressions/expected/schema_ruby.rb +28 -0
- data/golden/schema_imports_nested_expressions/expected/snast.txt +23 -0
- data/golden/schema_imports_nested_expressions/expected.json +5 -0
- data/golden/schema_imports_nested_expressions/input.json +5 -0
- data/golden/schema_imports_nested_expressions/schema.kumi +13 -0
- data/golden/schema_imports_nested_with_reductions/expected/ast.txt +47 -0
- data/golden/schema_imports_nested_with_reductions/expected/input_plan.txt +12 -0
- data/golden/schema_imports_nested_with_reductions/expected/lir_00_unoptimized.txt +31 -0
- data/golden/schema_imports_nested_with_reductions/expected/lir_01_hoist_scalar_references.txt +31 -0
- data/golden/schema_imports_nested_with_reductions/expected/lir_02_inlined.txt +58 -0
- data/golden/schema_imports_nested_with_reductions/expected/lir_03_cse.txt +49 -0
- data/golden/schema_imports_nested_with_reductions/expected/lir_04_1_loop_fusion.txt +51 -0
- data/golden/schema_imports_nested_with_reductions/expected/lir_04_loop_invcm.txt +49 -0
- data/golden/schema_imports_nested_with_reductions/expected/lir_06_const_prop.txt +49 -0
- data/golden/schema_imports_nested_with_reductions/expected/nast.txt +23 -0
- data/golden/schema_imports_nested_with_reductions/expected/schema_javascript.mjs +49 -0
- data/golden/schema_imports_nested_with_reductions/expected/schema_ruby.rb +52 -0
- data/golden/schema_imports_nested_with_reductions/expected/snast.txt +23 -0
- data/golden/schema_imports_nested_with_reductions/expected.json +6 -0
- data/golden/schema_imports_nested_with_reductions/input.json +16 -0
- data/golden/schema_imports_nested_with_reductions/schema.kumi +23 -0
- data/golden/schema_imports_with_imports/expected/ast.txt +19 -0
- data/golden/schema_imports_with_imports/expected/input_plan.txt +1 -0
- data/golden/schema_imports_with_imports/expected/lir_00_unoptimized.txt +13 -0
- data/golden/schema_imports_with_imports/expected/lir_01_hoist_scalar_references.txt +13 -0
- data/golden/schema_imports_with_imports/expected/lir_02_inlined.txt +14 -0
- data/golden/schema_imports_with_imports/expected/lir_03_cse.txt +13 -0
- data/golden/schema_imports_with_imports/expected/lir_04_1_loop_fusion.txt +13 -0
- data/golden/schema_imports_with_imports/expected/lir_04_loop_invcm.txt +13 -0
- data/golden/schema_imports_with_imports/expected/lir_06_const_prop.txt +13 -0
- data/golden/schema_imports_with_imports/expected/nast.txt +13 -0
- data/golden/schema_imports_with_imports/expected/schema_javascript.mjs +13 -0
- data/golden/schema_imports_with_imports/expected/schema_ruby.rb +13 -0
- data/golden/schema_imports_with_imports/expected/snast.txt +13 -0
- data/golden/schema_imports_with_imports/expected.json +4 -0
- data/golden/schema_imports_with_imports/input.json +3 -0
- data/golden/schema_imports_with_imports/schema.kumi +10 -0
- data/golden/shift/expected/lir_06_const_prop.txt +18 -30
- data/golden/shift/expected/schema_javascript.mjs +18 -30
- data/golden/shift/expected/schema_ruby.rb +25 -67
- data/golden/shift_2d/expected/lir_06_const_prop.txt +36 -60
- data/golden/shift_2d/expected/schema_javascript.mjs +36 -60
- data/golden/shift_2d/expected/schema_ruby.rb +49 -109
- data/golden/simple_math/expected/lir_06_const_prop.txt +3 -6
- data/golden/simple_math/expected/schema_javascript.mjs +3 -6
- data/golden/simple_math/expected/schema_ruby.rb +8 -39
- data/golden/streaming_basics/expected/lir_06_const_prop.txt +6 -12
- data/golden/streaming_basics/expected/schema_javascript.mjs +6 -12
- data/golden/streaming_basics/expected/schema_ruby.rb +14 -51
- data/golden/tuples/expected/lir_06_const_prop.txt +5 -22
- data/golden/tuples/expected/schema_javascript.mjs +5 -22
- data/golden/tuples/expected/schema_ruby.rb +11 -57
- data/golden/tuples_and_arrays/expected/lir_06_const_prop.txt +4 -8
- data/golden/tuples_and_arrays/expected/schema_javascript.mjs +4 -8
- data/golden/tuples_and_arrays/expected/schema_ruby.rb +9 -41
- data/golden/us_tax_2024/expected/lir_06_const_prop.txt +94 -171
- data/golden/us_tax_2024/expected/schema_javascript.mjs +13 -21
- data/golden/us_tax_2024/expected/schema_ruby.rb +15 -48
- data/golden/with_constants/expected/lir_06_const_prop.txt +3 -8
- data/golden/with_constants/expected/schema_javascript.mjs +3 -8
- data/golden/with_constants/expected/schema_ruby.rb +5 -35
- data/lib/kumi/analyzer.rb +8 -7
- data/lib/kumi/configuration.rb +7 -6
- data/lib/kumi/core/analyzer/passes/attach_anchors_pass.rb +1 -1
- data/lib/kumi/core/analyzer/passes/attach_terminal_info_pass.rb +1 -1
- data/lib/kumi/core/analyzer/passes/codegen/js/declaration_emitter.rb +20 -0
- data/lib/kumi/core/analyzer/passes/codegen/ruby/declaration_emitter.rb +16 -7
- data/lib/kumi/core/analyzer/passes/codegen/ruby/output_buffer.rb +3 -35
- data/lib/kumi/core/analyzer/passes/dependency_resolver.rb +6 -0
- data/lib/kumi/core/analyzer/passes/import_analysis_pass.rb +90 -0
- data/lib/kumi/core/analyzer/passes/lir/constant_propagation_pass.rb +77 -36
- data/lib/kumi/core/analyzer/passes/lir/lower_pass.rb +26 -11
- data/lib/kumi/core/analyzer/passes/name_indexer.rb +20 -2
- data/lib/kumi/core/analyzer/passes/nast_dimensional_analyzer_pass.rb +44 -0
- data/lib/kumi/core/analyzer/passes/normalize_to_nast_pass.rb +30 -0
- data/lib/kumi/core/analyzer/passes/semantic_constraint_validator.rb +5 -1
- data/lib/kumi/core/analyzer/passes/snast_pass.rb +15 -0
- data/lib/kumi/core/lir/build.rb +27 -0
- data/lib/kumi/core/lir/peephole.rb +164 -0
- data/lib/kumi/core/nast.rb +16 -0
- data/lib/kumi/core/ruby_parser/build_context.rb +3 -1
- data/lib/kumi/core/ruby_parser/parser.rb +1 -1
- data/lib/kumi/core/ruby_parser/schema_builder.rb +33 -3
- data/lib/kumi/dev/golden/result.rb +9 -3
- data/lib/kumi/dev/golden/runtime_test.rb +16 -1
- data/lib/kumi/dev/golden.rb +18 -20
- data/lib/kumi/dev/golden_schema_modules.rb +8 -0
- data/lib/kumi/dev/golden_schema_wrapper.rb +116 -0
- data/lib/kumi/dev/support/kumi_runner.mjs +18 -0
- data/lib/kumi/schema.rb +44 -2
- data/lib/kumi/support/lir_printer.rb +21 -5
- data/lib/kumi/support/nast_printer.rb +11 -0
- data/lib/kumi/support/s_expression_printer.rb +9 -0
- data/lib/kumi/support/snast_printer.rb +6 -0
- data/lib/kumi/syntax/import_call.rb +11 -0
- data/lib/kumi/syntax/import_declaration.rb +11 -0
- data/lib/kumi/syntax/root.rb +2 -2
- data/lib/kumi/test_shared_schemas/compound.rb +21 -0
- data/lib/kumi/test_shared_schemas/discount.rb +19 -0
- data/lib/kumi/test_shared_schemas/price.rb +19 -0
- data/lib/kumi/test_shared_schemas/subtotal.rb +22 -0
- data/lib/kumi/test_shared_schemas/tax.rb +18 -0
- data/lib/kumi/version.rb +1 -1
- data/lib/kumi.rb +19 -4
- metadata +176 -3
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
export function _order_subtotals(input) {
|
|
2
|
+
let out = [];
|
|
3
|
+
let t1 = input["orders"];
|
|
4
|
+
t1.forEach((orders_el_2, orders_i_3) => {
|
|
5
|
+
let t4 = orders_el_2["items"];
|
|
6
|
+
let t5 = Kumi.TestSharedSchemas.Subtotal.from({'items': t4})._subtotal;
|
|
7
|
+
out.push(t5);
|
|
8
|
+
});
|
|
9
|
+
return out;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function _order_with_shipping(input) {
|
|
13
|
+
let out = [];
|
|
14
|
+
let t6 = input["orders"];
|
|
15
|
+
t6.forEach((orders_el_7, orders_i_8) => {
|
|
16
|
+
let t60 = orders_el_7["items"];
|
|
17
|
+
let t10 = orders_el_7["shipping_cost"];
|
|
18
|
+
let t61 = Kumi.TestSharedSchemas.Subtotal.from({'items': t60})._subtotal;
|
|
19
|
+
let t11 = t61 + t10;
|
|
20
|
+
out.push(t11);
|
|
21
|
+
});
|
|
22
|
+
return out;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function _order_discounted(input) {
|
|
26
|
+
let out = [];
|
|
27
|
+
let t12 = input["orders"];
|
|
28
|
+
let t16 = input["global_discount_rate"];
|
|
29
|
+
t12.forEach((orders_el_13, orders_i_14) => {
|
|
30
|
+
let t67 = orders_el_13["items"];
|
|
31
|
+
let t64 = orders_el_13["shipping_cost"];
|
|
32
|
+
let t68 = Kumi.TestSharedSchemas.Subtotal.from({'items': t67})._subtotal;
|
|
33
|
+
let t65 = t68 + t64;
|
|
34
|
+
let t17 = Kumi.TestSharedSchemas.Discount.from({'price': t65, 'rate': t16})._discounted;
|
|
35
|
+
out.push(t17);
|
|
36
|
+
});
|
|
37
|
+
return out;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function _order_tax(input) {
|
|
41
|
+
let out = [];
|
|
42
|
+
let t18 = input["orders"];
|
|
43
|
+
let t71 = input["global_discount_rate"];
|
|
44
|
+
t18.forEach((orders_el_19, orders_i_20) => {
|
|
45
|
+
let t78 = orders_el_19["items"];
|
|
46
|
+
let t75 = orders_el_19["shipping_cost"];
|
|
47
|
+
let t79 = Kumi.TestSharedSchemas.Subtotal.from({'items': t78})._subtotal;
|
|
48
|
+
let t76 = t79 + t75;
|
|
49
|
+
let t72 = Kumi.TestSharedSchemas.Discount.from({'price': t76, 'rate': t71})._discounted;
|
|
50
|
+
let t22 = Kumi.TestSharedSchemas.Tax.from({'amount': t72})._tax;
|
|
51
|
+
out.push(t22);
|
|
52
|
+
});
|
|
53
|
+
return out;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export function _order_totals(input) {
|
|
57
|
+
let out = [];
|
|
58
|
+
let t23 = input["orders"];
|
|
59
|
+
let t82 = input["global_discount_rate"];
|
|
60
|
+
t23.forEach((orders_el_24, orders_i_25) => {
|
|
61
|
+
let t89 = orders_el_24["items"];
|
|
62
|
+
let t86 = orders_el_24["shipping_cost"];
|
|
63
|
+
let t90 = Kumi.TestSharedSchemas.Subtotal.from({'items': t89})._subtotal;
|
|
64
|
+
let t87 = t90 + t86;
|
|
65
|
+
let t83 = Kumi.TestSharedSchemas.Discount.from({'price': t87, 'rate': t82})._discounted;
|
|
66
|
+
let t93 = Kumi.TestSharedSchemas.Tax.from({'amount': t83})._tax;
|
|
67
|
+
let t28 = t83 + t93;
|
|
68
|
+
out.push(t28);
|
|
69
|
+
});
|
|
70
|
+
return out;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export function _discount_per_order(input) {
|
|
74
|
+
let out = [];
|
|
75
|
+
let t29 = input["orders"];
|
|
76
|
+
let t114 = input["global_discount_rate"];
|
|
77
|
+
t29.forEach((orders_el_30, orders_i_31) => {
|
|
78
|
+
let t110 = orders_el_30["items"];
|
|
79
|
+
let t107 = orders_el_30["shipping_cost"];
|
|
80
|
+
let t111 = Kumi.TestSharedSchemas.Subtotal.from({'items': t110})._subtotal;
|
|
81
|
+
let t108 = t111 + t107;
|
|
82
|
+
let t115 = Kumi.TestSharedSchemas.Discount.from({'price': t108, 'rate': t114})._discounted;
|
|
83
|
+
let t34 = t108 - t115;
|
|
84
|
+
out.push(t34);
|
|
85
|
+
});
|
|
86
|
+
return out;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export function _total_orders(input) {
|
|
90
|
+
let acc_35 = 0;
|
|
91
|
+
let t36 = input["orders"];
|
|
92
|
+
t36.forEach((orders_el_37, orders_i_38) => {
|
|
93
|
+
let t39 = orders_el_37["id"];
|
|
94
|
+
acc_35 += 1;
|
|
95
|
+
});
|
|
96
|
+
return acc_35;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export function _total_revenue(input) {
|
|
100
|
+
let acc_41 = 0.0;
|
|
101
|
+
let t42 = input["orders"];
|
|
102
|
+
let t129 = input["global_discount_rate"];
|
|
103
|
+
t42.forEach((orders_el_43, orders_i_44) => {
|
|
104
|
+
let t136 = orders_el_43["items"];
|
|
105
|
+
let t133 = orders_el_43["shipping_cost"];
|
|
106
|
+
let t137 = Kumi.TestSharedSchemas.Subtotal.from({'items': t136})._subtotal;
|
|
107
|
+
let t134 = t137 + t133;
|
|
108
|
+
let t130 = Kumi.TestSharedSchemas.Discount.from({'price': t134, 'rate': t129})._discounted;
|
|
109
|
+
let t140 = Kumi.TestSharedSchemas.Tax.from({'amount': t130})._tax;
|
|
110
|
+
let t126 = t130 + t140;
|
|
111
|
+
acc_41 += t126;
|
|
112
|
+
});
|
|
113
|
+
return acc_41;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export function _total_tax_collected(input) {
|
|
117
|
+
let acc_47 = 0.0;
|
|
118
|
+
let t48 = input["orders"];
|
|
119
|
+
let t157 = input["global_discount_rate"];
|
|
120
|
+
t48.forEach((orders_el_49, orders_i_50) => {
|
|
121
|
+
let t164 = orders_el_49["items"];
|
|
122
|
+
let t161 = orders_el_49["shipping_cost"];
|
|
123
|
+
let t165 = Kumi.TestSharedSchemas.Subtotal.from({'items': t164})._subtotal;
|
|
124
|
+
let t162 = t165 + t161;
|
|
125
|
+
let t158 = Kumi.TestSharedSchemas.Discount.from({'price': t162, 'rate': t157})._discounted;
|
|
126
|
+
let t154 = Kumi.TestSharedSchemas.Tax.from({'amount': t158})._tax;
|
|
127
|
+
acc_47 += t154;
|
|
128
|
+
});
|
|
129
|
+
return acc_47;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export function _total_discount_given(input) {
|
|
133
|
+
let acc_53 = 0.0;
|
|
134
|
+
let t54 = input["orders"];
|
|
135
|
+
let t179 = input["global_discount_rate"];
|
|
136
|
+
t54.forEach((orders_el_55, orders_i_56) => {
|
|
137
|
+
let t175 = orders_el_55["items"];
|
|
138
|
+
let t172 = orders_el_55["shipping_cost"];
|
|
139
|
+
let t176 = Kumi.TestSharedSchemas.Subtotal.from({'items': t175})._subtotal;
|
|
140
|
+
let t173 = t176 + t172;
|
|
141
|
+
let t180 = Kumi.TestSharedSchemas.Discount.from({'price': t173, 'rate': t179})._discounted;
|
|
142
|
+
let t169 = t173 - t180;
|
|
143
|
+
acc_53 += t169;
|
|
144
|
+
});
|
|
145
|
+
return acc_53;
|
|
146
|
+
}
|
|
147
|
+
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
# Autogenerated by Kumi Codegen
|
|
2
|
+
module Kumi::Compiled::KUMI_1099ce45f52614652b4c8220780498c88cd3640a1c41a254fbde037369b646e4
|
|
3
|
+
def self._order_subtotals(input)
|
|
4
|
+
out = []
|
|
5
|
+
t1 = input["orders"] || input[:orders]
|
|
6
|
+
t1.each_with_index do |orders_el_2, orders_i_3|
|
|
7
|
+
t4 = orders_el_2["items"] || orders_el_2[:items]
|
|
8
|
+
t5 = Kumi::TestSharedSchemas::Subtotal._subtotal({"items" => t4})
|
|
9
|
+
out << t5
|
|
10
|
+
end
|
|
11
|
+
out
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def self._order_with_shipping(input)
|
|
15
|
+
out = []
|
|
16
|
+
t6 = input["orders"] || input[:orders]
|
|
17
|
+
t6.each_with_index do |orders_el_7, orders_i_8|
|
|
18
|
+
t60 = orders_el_7["items"] || orders_el_7[:items]
|
|
19
|
+
t10 = orders_el_7["shipping_cost"] || orders_el_7[:shipping_cost]
|
|
20
|
+
t61 = Kumi::TestSharedSchemas::Subtotal._subtotal({"items" => t60})
|
|
21
|
+
t11 = t61 + t10
|
|
22
|
+
out << t11
|
|
23
|
+
end
|
|
24
|
+
out
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def self._order_discounted(input)
|
|
28
|
+
out = []
|
|
29
|
+
t12 = input["orders"] || input[:orders]
|
|
30
|
+
t16 = input["global_discount_rate"] || input[:global_discount_rate]
|
|
31
|
+
t12.each_with_index do |orders_el_13, orders_i_14|
|
|
32
|
+
t67 = orders_el_13["items"] || orders_el_13[:items]
|
|
33
|
+
t64 = orders_el_13["shipping_cost"] || orders_el_13[:shipping_cost]
|
|
34
|
+
t68 = Kumi::TestSharedSchemas::Subtotal._subtotal({"items" => t67})
|
|
35
|
+
t65 = t68 + t64
|
|
36
|
+
t17 = Kumi::TestSharedSchemas::Discount._discounted({"price" => t65, "rate" => t16})
|
|
37
|
+
out << t17
|
|
38
|
+
end
|
|
39
|
+
out
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def self._order_tax(input)
|
|
43
|
+
out = []
|
|
44
|
+
t18 = input["orders"] || input[:orders]
|
|
45
|
+
t71 = input["global_discount_rate"] || input[:global_discount_rate]
|
|
46
|
+
t18.each_with_index do |orders_el_19, orders_i_20|
|
|
47
|
+
t78 = orders_el_19["items"] || orders_el_19[:items]
|
|
48
|
+
t75 = orders_el_19["shipping_cost"] || orders_el_19[:shipping_cost]
|
|
49
|
+
t79 = Kumi::TestSharedSchemas::Subtotal._subtotal({"items" => t78})
|
|
50
|
+
t76 = t79 + t75
|
|
51
|
+
t72 = Kumi::TestSharedSchemas::Discount._discounted({"price" => t76, "rate" => t71})
|
|
52
|
+
t22 = Kumi::TestSharedSchemas::Tax._tax({"amount" => t72})
|
|
53
|
+
out << t22
|
|
54
|
+
end
|
|
55
|
+
out
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def self._order_totals(input)
|
|
59
|
+
out = []
|
|
60
|
+
t23 = input["orders"] || input[:orders]
|
|
61
|
+
t82 = input["global_discount_rate"] || input[:global_discount_rate]
|
|
62
|
+
t23.each_with_index do |orders_el_24, orders_i_25|
|
|
63
|
+
t89 = orders_el_24["items"] || orders_el_24[:items]
|
|
64
|
+
t86 = orders_el_24["shipping_cost"] || orders_el_24[:shipping_cost]
|
|
65
|
+
t90 = Kumi::TestSharedSchemas::Subtotal._subtotal({"items" => t89})
|
|
66
|
+
t87 = t90 + t86
|
|
67
|
+
t83 = Kumi::TestSharedSchemas::Discount._discounted({"price" => t87, "rate" => t82})
|
|
68
|
+
t93 = Kumi::TestSharedSchemas::Tax._tax({"amount" => t83})
|
|
69
|
+
t28 = t83 + t93
|
|
70
|
+
out << t28
|
|
71
|
+
end
|
|
72
|
+
out
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
def self._discount_per_order(input)
|
|
76
|
+
out = []
|
|
77
|
+
t29 = input["orders"] || input[:orders]
|
|
78
|
+
t114 = input["global_discount_rate"] || input[:global_discount_rate]
|
|
79
|
+
t29.each_with_index do |orders_el_30, orders_i_31|
|
|
80
|
+
t110 = orders_el_30["items"] || orders_el_30[:items]
|
|
81
|
+
t107 = orders_el_30["shipping_cost"] || orders_el_30[:shipping_cost]
|
|
82
|
+
t111 = Kumi::TestSharedSchemas::Subtotal._subtotal({"items" => t110})
|
|
83
|
+
t108 = t111 + t107
|
|
84
|
+
t115 = Kumi::TestSharedSchemas::Discount._discounted({"price" => t108, "rate" => t114})
|
|
85
|
+
t34 = t108 - t115
|
|
86
|
+
out << t34
|
|
87
|
+
end
|
|
88
|
+
out
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
def self._total_orders(input)
|
|
92
|
+
acc_35 = 0
|
|
93
|
+
t36 = input["orders"] || input[:orders]
|
|
94
|
+
t36.each_with_index do |orders_el_37, orders_i_38|
|
|
95
|
+
t39 = orders_el_37["id"] || orders_el_37[:id]
|
|
96
|
+
acc_35 += 1
|
|
97
|
+
end
|
|
98
|
+
acc_35
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
def self._total_revenue(input)
|
|
102
|
+
acc_41 = 0.0
|
|
103
|
+
t42 = input["orders"] || input[:orders]
|
|
104
|
+
t129 = input["global_discount_rate"] || input[:global_discount_rate]
|
|
105
|
+
t42.each_with_index do |orders_el_43, orders_i_44|
|
|
106
|
+
t136 = orders_el_43["items"] || orders_el_43[:items]
|
|
107
|
+
t133 = orders_el_43["shipping_cost"] || orders_el_43[:shipping_cost]
|
|
108
|
+
t137 = Kumi::TestSharedSchemas::Subtotal._subtotal({"items" => t136})
|
|
109
|
+
t134 = t137 + t133
|
|
110
|
+
t130 = Kumi::TestSharedSchemas::Discount._discounted({"price" => t134, "rate" => t129})
|
|
111
|
+
t140 = Kumi::TestSharedSchemas::Tax._tax({"amount" => t130})
|
|
112
|
+
t126 = t130 + t140
|
|
113
|
+
acc_41 += t126
|
|
114
|
+
end
|
|
115
|
+
acc_41
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
def self._total_tax_collected(input)
|
|
119
|
+
acc_47 = 0.0
|
|
120
|
+
t48 = input["orders"] || input[:orders]
|
|
121
|
+
t157 = input["global_discount_rate"] || input[:global_discount_rate]
|
|
122
|
+
t48.each_with_index do |orders_el_49, orders_i_50|
|
|
123
|
+
t164 = orders_el_49["items"] || orders_el_49[:items]
|
|
124
|
+
t161 = orders_el_49["shipping_cost"] || orders_el_49[:shipping_cost]
|
|
125
|
+
t165 = Kumi::TestSharedSchemas::Subtotal._subtotal({"items" => t164})
|
|
126
|
+
t162 = t165 + t161
|
|
127
|
+
t158 = Kumi::TestSharedSchemas::Discount._discounted({"price" => t162, "rate" => t157})
|
|
128
|
+
t154 = Kumi::TestSharedSchemas::Tax._tax({"amount" => t158})
|
|
129
|
+
acc_47 += t154
|
|
130
|
+
end
|
|
131
|
+
acc_47
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
def self._total_discount_given(input)
|
|
135
|
+
acc_53 = 0.0
|
|
136
|
+
t54 = input["orders"] || input[:orders]
|
|
137
|
+
t179 = input["global_discount_rate"] || input[:global_discount_rate]
|
|
138
|
+
t54.each_with_index do |orders_el_55, orders_i_56|
|
|
139
|
+
t175 = orders_el_55["items"] || orders_el_55[:items]
|
|
140
|
+
t172 = orders_el_55["shipping_cost"] || orders_el_55[:shipping_cost]
|
|
141
|
+
t176 = Kumi::TestSharedSchemas::Subtotal._subtotal({"items" => t175})
|
|
142
|
+
t173 = t176 + t172
|
|
143
|
+
t180 = Kumi::TestSharedSchemas::Discount._discounted({"price" => t173, "rate" => t179})
|
|
144
|
+
t169 = t173 - t180
|
|
145
|
+
acc_53 += t169
|
|
146
|
+
end
|
|
147
|
+
acc_53
|
|
148
|
+
end
|
|
149
|
+
end
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
(SNAST
|
|
2
|
+
(VALUE order_subtotals
|
|
3
|
+
(ImportCall :subtotal
|
|
4
|
+
(items (InputRef orders.order.items key_chain=[]) :: [orders] -> array)
|
|
5
|
+
) :: [orders] -> integer
|
|
6
|
+
) :: [orders] -> integer
|
|
7
|
+
(VALUE order_with_shipping
|
|
8
|
+
(Call :core.add
|
|
9
|
+
(Ref order_subtotals) :: [orders] -> integer
|
|
10
|
+
(InputRef orders.order.shipping_cost key_chain=[]) :: [orders] -> decimal
|
|
11
|
+
) :: [orders] -> integer
|
|
12
|
+
) :: [orders] -> integer
|
|
13
|
+
(VALUE order_discounted
|
|
14
|
+
(ImportCall :discounted
|
|
15
|
+
(price (Ref order_with_shipping) :: [orders] -> integer)
|
|
16
|
+
(rate (InputRef global_discount_rate key_chain=[]) :: [] -> decimal)
|
|
17
|
+
) :: [orders] -> float
|
|
18
|
+
) :: [orders] -> float
|
|
19
|
+
(VALUE order_tax
|
|
20
|
+
(ImportCall :tax
|
|
21
|
+
(amount (Ref order_discounted) :: [orders] -> float)
|
|
22
|
+
) :: [orders] -> float
|
|
23
|
+
) :: [orders] -> float
|
|
24
|
+
(VALUE order_totals
|
|
25
|
+
(Call :core.add
|
|
26
|
+
(Ref order_discounted) :: [orders] -> float
|
|
27
|
+
(Ref order_tax) :: [orders] -> float
|
|
28
|
+
) :: [orders] -> float
|
|
29
|
+
) :: [orders] -> float
|
|
30
|
+
(VALUE discount_per_order
|
|
31
|
+
(Call :core.sub
|
|
32
|
+
(Ref order_with_shipping) :: [orders] -> integer
|
|
33
|
+
(Ref order_discounted) :: [orders] -> float
|
|
34
|
+
) :: [orders] -> float
|
|
35
|
+
) :: [orders] -> float
|
|
36
|
+
(VALUE total_orders
|
|
37
|
+
(Reduce :agg.count over [orders]
|
|
38
|
+
(InputRef orders.order.id key_chain=[]) :: [orders] -> string
|
|
39
|
+
) :: [] -> integer
|
|
40
|
+
) :: [] -> integer
|
|
41
|
+
(VALUE total_revenue
|
|
42
|
+
(Reduce :agg.sum over [orders]
|
|
43
|
+
(Ref order_totals) :: [orders] -> float
|
|
44
|
+
) :: [] -> float
|
|
45
|
+
) :: [] -> float
|
|
46
|
+
(VALUE total_tax_collected
|
|
47
|
+
(Reduce :agg.sum over [orders]
|
|
48
|
+
(Ref order_tax) :: [orders] -> float
|
|
49
|
+
) :: [] -> float
|
|
50
|
+
) :: [] -> float
|
|
51
|
+
(VALUE total_discount_given
|
|
52
|
+
(Reduce :agg.sum over [orders]
|
|
53
|
+
(Ref discount_per_order) :: [orders] -> float
|
|
54
|
+
) :: [] -> float
|
|
55
|
+
) :: [] -> float
|
|
56
|
+
)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"order_subtotals": [200, 120],
|
|
3
|
+
"order_with_shipping": [210.0, 130.0],
|
|
4
|
+
"order_discounted": [189.0, 117.0],
|
|
5
|
+
"order_tax": [28.349999999999998, 17.55],
|
|
6
|
+
"order_totals": [217.35, 134.55],
|
|
7
|
+
"discount_per_order": [21.0, 13.0],
|
|
8
|
+
"total_orders": 2,
|
|
9
|
+
"total_revenue": 351.9,
|
|
10
|
+
"total_tax_collected": 45.9,
|
|
11
|
+
"total_discount_given": 34.0
|
|
12
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"global_discount_rate": 0.1,
|
|
3
|
+
"orders": [
|
|
4
|
+
{
|
|
5
|
+
"id": "ORD-001",
|
|
6
|
+
"items": [
|
|
7
|
+
{"quantity": 2, "unit_price": 60},
|
|
8
|
+
{"quantity": 2, "unit_price": 40}
|
|
9
|
+
],
|
|
10
|
+
"shipping_cost": 10.0
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"id": "ORD-002",
|
|
14
|
+
"items": [
|
|
15
|
+
{"quantity": 2, "unit_price": 60}
|
|
16
|
+
],
|
|
17
|
+
"shipping_cost": 10.0
|
|
18
|
+
}
|
|
19
|
+
]
|
|
20
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import :tax, from: Kumi::TestSharedSchemas::Tax
|
|
2
|
+
import :discounted, from: Kumi::TestSharedSchemas::Discount
|
|
3
|
+
import :subtotal, from: Kumi::TestSharedSchemas::Subtotal
|
|
4
|
+
|
|
5
|
+
schema do
|
|
6
|
+
input do
|
|
7
|
+
decimal :global_discount_rate
|
|
8
|
+
array :orders do
|
|
9
|
+
hash :order do
|
|
10
|
+
string :id
|
|
11
|
+
array :items do
|
|
12
|
+
hash :item do
|
|
13
|
+
integer :quantity
|
|
14
|
+
integer :unit_price
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
decimal :shipping_cost
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
value :order_subtotals, subtotal(items: input.orders.order.items)
|
|
23
|
+
value :order_with_shipping, order_subtotals + input.orders.order.shipping_cost
|
|
24
|
+
value :order_discounted, discounted(price: order_with_shipping, rate: input.global_discount_rate)
|
|
25
|
+
value :order_tax, tax(amount: order_discounted)
|
|
26
|
+
value :order_totals, order_discounted + order_tax
|
|
27
|
+
|
|
28
|
+
value :discount_per_order, order_with_shipping - order_discounted
|
|
29
|
+
value :total_orders, fn(:count, input.orders.order.id)
|
|
30
|
+
value :total_revenue, fn(:sum, order_totals)
|
|
31
|
+
value :total_tax_collected, fn(:sum, order_tax)
|
|
32
|
+
value :total_discount_given, fn(:sum, discount_per_order)
|
|
33
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
(Root
|
|
2
|
+
inputs: [
|
|
3
|
+
(InputDeclaration :item_price :decimal)
|
|
4
|
+
(InputDeclaration :quantity :decimal)
|
|
5
|
+
(InputDeclaration :discount_rate :decimal)
|
|
6
|
+
]
|
|
7
|
+
values: [
|
|
8
|
+
(ValueDeclaration :subtotal
|
|
9
|
+
(CallExpression :multiply
|
|
10
|
+
(InputReference :item_price)
|
|
11
|
+
(InputReference :quantity)
|
|
12
|
+
)
|
|
13
|
+
)
|
|
14
|
+
(ValueDeclaration :price_after_discount
|
|
15
|
+
(ImportCall :discounted
|
|
16
|
+
(base_price (DeclarationReference :subtotal))
|
|
17
|
+
(discount_rate (InputReference :discount_rate))
|
|
18
|
+
)
|
|
19
|
+
)
|
|
20
|
+
(ValueDeclaration :discount_amt
|
|
21
|
+
(ImportCall :discount_amount
|
|
22
|
+
(base_price (DeclarationReference :subtotal))
|
|
23
|
+
(discount_rate (InputReference :discount_rate))
|
|
24
|
+
)
|
|
25
|
+
)
|
|
26
|
+
(ValueDeclaration :final_total
|
|
27
|
+
(ImportCall :total
|
|
28
|
+
(amount (DeclarationReference :price_after_discount))
|
|
29
|
+
)
|
|
30
|
+
)
|
|
31
|
+
]
|
|
32
|
+
traits: []
|
|
33
|
+
)
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
(LIR
|
|
2
|
+
(Declaration subtotal
|
|
3
|
+
%t1 = load_input "item_price" :: decimal
|
|
4
|
+
%t2 = load_input "quantity" :: decimal
|
|
5
|
+
%t3 = call core.mul:numeric(%t1, %t2) :: decimal
|
|
6
|
+
yield %t3
|
|
7
|
+
)
|
|
8
|
+
(Declaration price_after_discount
|
|
9
|
+
%t4 = load_decl subtotal :: decimal
|
|
10
|
+
%t5 = load_input "discount_rate" :: decimal
|
|
11
|
+
%t6 = importschemacall %t4, %t5 fn_name="discounted" source_module="Kumi::TestSharedSchemas::Price" input_mapping_keys=["base_price", "discount_rate"] :: float
|
|
12
|
+
yield %t6
|
|
13
|
+
)
|
|
14
|
+
(Declaration discount_amt
|
|
15
|
+
%t7 = load_decl subtotal :: decimal
|
|
16
|
+
%t8 = load_input "discount_rate" :: decimal
|
|
17
|
+
%t9 = importschemacall %t7, %t8 fn_name="discount_amount" source_module="Kumi::TestSharedSchemas::Price" input_mapping_keys=["base_price", "discount_rate"] :: decimal
|
|
18
|
+
yield %t9
|
|
19
|
+
)
|
|
20
|
+
(Declaration final_total
|
|
21
|
+
%t10 = load_decl price_after_discount :: float
|
|
22
|
+
%t11 = importschemacall %t10 fn_name="total" source_module="Kumi::TestSharedSchemas::Tax" input_mapping_keys=["amount"] :: float
|
|
23
|
+
yield %t11
|
|
24
|
+
)
|
|
25
|
+
)
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
(LIR
|
|
2
|
+
(Declaration subtotal
|
|
3
|
+
%t1 = load_input "item_price" :: decimal
|
|
4
|
+
%t2 = load_input "quantity" :: decimal
|
|
5
|
+
%t3 = call core.mul:numeric(%t1, %t2) :: decimal
|
|
6
|
+
yield %t3
|
|
7
|
+
)
|
|
8
|
+
(Declaration price_after_discount
|
|
9
|
+
%t4 = load_decl subtotal :: decimal
|
|
10
|
+
%t5 = load_input "discount_rate" :: decimal
|
|
11
|
+
%t6 = importschemacall %t4, %t5 fn_name="discounted" source_module="Kumi::TestSharedSchemas::Price" input_mapping_keys=["base_price", "discount_rate"] :: float
|
|
12
|
+
yield %t6
|
|
13
|
+
)
|
|
14
|
+
(Declaration discount_amt
|
|
15
|
+
%t7 = load_decl subtotal :: decimal
|
|
16
|
+
%t8 = load_input "discount_rate" :: decimal
|
|
17
|
+
%t9 = importschemacall %t7, %t8 fn_name="discount_amount" source_module="Kumi::TestSharedSchemas::Price" input_mapping_keys=["base_price", "discount_rate"] :: decimal
|
|
18
|
+
yield %t9
|
|
19
|
+
)
|
|
20
|
+
(Declaration final_total
|
|
21
|
+
%t10 = load_decl price_after_discount :: float
|
|
22
|
+
%t11 = importschemacall %t10 fn_name="total" source_module="Kumi::TestSharedSchemas::Tax" input_mapping_keys=["amount"] :: float
|
|
23
|
+
yield %t11
|
|
24
|
+
)
|
|
25
|
+
)
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
(LIR
|
|
2
|
+
(Declaration subtotal
|
|
3
|
+
%t1 = load_input "item_price" :: decimal
|
|
4
|
+
%t2 = load_input "quantity" :: decimal
|
|
5
|
+
%t3 = call core.mul:numeric(%t1, %t2) :: decimal
|
|
6
|
+
yield %t3
|
|
7
|
+
)
|
|
8
|
+
(Declaration price_after_discount
|
|
9
|
+
%t12 = load_input "item_price" :: decimal
|
|
10
|
+
%t13 = load_input "quantity" :: decimal
|
|
11
|
+
%t14 = call core.mul:numeric(%t12, %t13) :: decimal
|
|
12
|
+
%t5 = load_input "discount_rate" :: decimal
|
|
13
|
+
%t6 = importschemacall %t14, %t5 fn_name="discounted" source_module="Kumi::TestSharedSchemas::Price" input_mapping_keys=["base_price", "discount_rate"] :: float
|
|
14
|
+
yield %t6
|
|
15
|
+
)
|
|
16
|
+
(Declaration discount_amt
|
|
17
|
+
%t15 = load_input "item_price" :: decimal
|
|
18
|
+
%t16 = load_input "quantity" :: decimal
|
|
19
|
+
%t17 = call core.mul:numeric(%t15, %t16) :: decimal
|
|
20
|
+
%t8 = load_input "discount_rate" :: decimal
|
|
21
|
+
%t9 = importschemacall %t17, %t8 fn_name="discount_amount" source_module="Kumi::TestSharedSchemas::Price" input_mapping_keys=["base_price", "discount_rate"] :: decimal
|
|
22
|
+
yield %t9
|
|
23
|
+
)
|
|
24
|
+
(Declaration final_total
|
|
25
|
+
%t21 = load_input "item_price" :: decimal
|
|
26
|
+
%t22 = load_input "quantity" :: decimal
|
|
27
|
+
%t23 = call core.mul:numeric(%t21, %t22) :: decimal
|
|
28
|
+
%t19 = load_input "discount_rate" :: decimal
|
|
29
|
+
%t20 = importschemacall %t23, %t19 fn_name="discounted" source_module="Kumi::TestSharedSchemas::Price" input_mapping_keys=["base_price", "discount_rate"] :: float
|
|
30
|
+
%t11 = importschemacall %t20 fn_name="total" source_module="Kumi::TestSharedSchemas::Tax" input_mapping_keys=["amount"] :: float
|
|
31
|
+
yield %t11
|
|
32
|
+
)
|
|
33
|
+
)
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
(LIR
|
|
2
|
+
(Declaration subtotal
|
|
3
|
+
%t1 = load_input "item_price" :: decimal
|
|
4
|
+
%t2 = load_input "quantity" :: decimal
|
|
5
|
+
%t3 = call core.mul:numeric(%t1, %t2) :: decimal
|
|
6
|
+
yield %t3
|
|
7
|
+
)
|
|
8
|
+
(Declaration price_after_discount
|
|
9
|
+
%t12 = load_input "item_price" :: decimal
|
|
10
|
+
%t13 = load_input "quantity" :: decimal
|
|
11
|
+
%t14 = call core.mul:numeric(%t12, %t13) :: decimal
|
|
12
|
+
%t5 = load_input "discount_rate" :: decimal
|
|
13
|
+
%t6 = importschemacall %t14, %t5 fn_name="discounted" source_module="Kumi::TestSharedSchemas::Price" input_mapping_keys=["base_price", "discount_rate"] :: float
|
|
14
|
+
yield %t6
|
|
15
|
+
)
|
|
16
|
+
(Declaration discount_amt
|
|
17
|
+
%t15 = load_input "item_price" :: decimal
|
|
18
|
+
%t16 = load_input "quantity" :: decimal
|
|
19
|
+
%t17 = call core.mul:numeric(%t15, %t16) :: decimal
|
|
20
|
+
%t8 = load_input "discount_rate" :: decimal
|
|
21
|
+
%t9 = importschemacall %t17, %t8 fn_name="discount_amount" source_module="Kumi::TestSharedSchemas::Price" input_mapping_keys=["base_price", "discount_rate"] :: decimal
|
|
22
|
+
yield %t9
|
|
23
|
+
)
|
|
24
|
+
(Declaration final_total
|
|
25
|
+
%t21 = load_input "item_price" :: decimal
|
|
26
|
+
%t22 = load_input "quantity" :: decimal
|
|
27
|
+
%t23 = call core.mul:numeric(%t21, %t22) :: decimal
|
|
28
|
+
%t19 = load_input "discount_rate" :: decimal
|
|
29
|
+
%t20 = importschemacall %t23, %t19 fn_name="discounted" source_module="Kumi::TestSharedSchemas::Price" input_mapping_keys=["base_price", "discount_rate"] :: float
|
|
30
|
+
%t11 = importschemacall %t20 fn_name="total" source_module="Kumi::TestSharedSchemas::Tax" input_mapping_keys=["amount"] :: float
|
|
31
|
+
yield %t11
|
|
32
|
+
)
|
|
33
|
+
)
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
(LIR
|
|
2
|
+
(Declaration subtotal
|
|
3
|
+
%t1 = load_input "item_price" :: decimal
|
|
4
|
+
%t2 = load_input "quantity" :: decimal
|
|
5
|
+
%t3 = call core.mul:numeric(%t1, %t2) :: decimal
|
|
6
|
+
yield %t3
|
|
7
|
+
)
|
|
8
|
+
(Declaration price_after_discount
|
|
9
|
+
%t12 = load_input "item_price" :: decimal
|
|
10
|
+
%t13 = load_input "quantity" :: decimal
|
|
11
|
+
%t14 = call core.mul:numeric(%t12, %t13) :: decimal
|
|
12
|
+
%t5 = load_input "discount_rate" :: decimal
|
|
13
|
+
%t6 = importschemacall %t14, %t5 fn_name="discounted" source_module="Kumi::TestSharedSchemas::Price" input_mapping_keys=["base_price", "discount_rate"] :: float
|
|
14
|
+
yield %t6
|
|
15
|
+
)
|
|
16
|
+
(Declaration discount_amt
|
|
17
|
+
%t15 = load_input "item_price" :: decimal
|
|
18
|
+
%t16 = load_input "quantity" :: decimal
|
|
19
|
+
%t17 = call core.mul:numeric(%t15, %t16) :: decimal
|
|
20
|
+
%t8 = load_input "discount_rate" :: decimal
|
|
21
|
+
%t9 = importschemacall %t17, %t8 fn_name="discount_amount" source_module="Kumi::TestSharedSchemas::Price" input_mapping_keys=["base_price", "discount_rate"] :: decimal
|
|
22
|
+
yield %t9
|
|
23
|
+
)
|
|
24
|
+
(Declaration final_total
|
|
25
|
+
%t21 = load_input "item_price" :: decimal
|
|
26
|
+
%t22 = load_input "quantity" :: decimal
|
|
27
|
+
%t23 = call core.mul:numeric(%t21, %t22) :: decimal
|
|
28
|
+
%t19 = load_input "discount_rate" :: decimal
|
|
29
|
+
%t20 = importschemacall %t23, %t19 fn_name="discounted" source_module="Kumi::TestSharedSchemas::Price" input_mapping_keys=["base_price", "discount_rate"] :: float
|
|
30
|
+
%t11 = importschemacall %t20 fn_name="total" source_module="Kumi::TestSharedSchemas::Tax" input_mapping_keys=["amount"] :: float
|
|
31
|
+
yield %t11
|
|
32
|
+
)
|
|
33
|
+
)
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
(LIR
|
|
2
|
+
(Declaration subtotal
|
|
3
|
+
%t1 = load_input "item_price" :: decimal
|
|
4
|
+
%t2 = load_input "quantity" :: decimal
|
|
5
|
+
%t3 = call core.mul:numeric(%t1, %t2) :: decimal
|
|
6
|
+
yield %t3
|
|
7
|
+
)
|
|
8
|
+
(Declaration price_after_discount
|
|
9
|
+
%t12 = load_input "item_price" :: decimal
|
|
10
|
+
%t13 = load_input "quantity" :: decimal
|
|
11
|
+
%t14 = call core.mul:numeric(%t12, %t13) :: decimal
|
|
12
|
+
%t5 = load_input "discount_rate" :: decimal
|
|
13
|
+
%t6 = importschemacall %t14, %t5 fn_name="discounted" source_module="Kumi::TestSharedSchemas::Price" input_mapping_keys=["base_price", "discount_rate"] :: float
|
|
14
|
+
yield %t6
|
|
15
|
+
)
|
|
16
|
+
(Declaration discount_amt
|
|
17
|
+
%t15 = load_input "item_price" :: decimal
|
|
18
|
+
%t16 = load_input "quantity" :: decimal
|
|
19
|
+
%t17 = call core.mul:numeric(%t15, %t16) :: decimal
|
|
20
|
+
%t8 = load_input "discount_rate" :: decimal
|
|
21
|
+
%t9 = importschemacall %t17, %t8 fn_name="discount_amount" source_module="Kumi::TestSharedSchemas::Price" input_mapping_keys=["base_price", "discount_rate"] :: decimal
|
|
22
|
+
yield %t9
|
|
23
|
+
)
|
|
24
|
+
(Declaration final_total
|
|
25
|
+
%t21 = load_input "item_price" :: decimal
|
|
26
|
+
%t22 = load_input "quantity" :: decimal
|
|
27
|
+
%t23 = call core.mul:numeric(%t21, %t22) :: decimal
|
|
28
|
+
%t19 = load_input "discount_rate" :: decimal
|
|
29
|
+
%t20 = importschemacall %t23, %t19 fn_name="discounted" source_module="Kumi::TestSharedSchemas::Price" input_mapping_keys=["base_price", "discount_rate"] :: float
|
|
30
|
+
%t11 = importschemacall %t20 fn_name="total" source_module="Kumi::TestSharedSchemas::Tax" input_mapping_keys=["amount"] :: float
|
|
31
|
+
yield %t11
|
|
32
|
+
)
|
|
33
|
+
)
|