@almadar/std 17.0.2 → 17.1.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/behaviors/lolo/auth/atoms/std-dev-personas.lolo +27 -2
- package/behaviors/lolo/cli/atoms/std-orb-goldens.lolo +6 -3
- package/behaviors/lolo/cli/atoms/std-orb-lint-mem-handles.lolo +54 -34
- package/behaviors/lolo/cli/atoms/std-orb-lint-os-grants.lolo +4 -4
- package/behaviors/lolo/cli/atoms/std-orb-mcp.lolo +16 -21
- package/behaviors/lolo/cli/atoms/std-orb-packages.lolo +26 -16
- package/behaviors/lolo/cli/atoms/std-orb-serve.lolo +24 -4
- package/behaviors/lolo/codec/atoms/std-lolo-kotlin.lolo +26 -3
- package/behaviors/lolo/codec/atoms/std-lolo-python.lolo +15 -2
- package/behaviors/lolo/codec/atoms/std-lolo-rust.lolo +27 -2
- package/behaviors/lolo/codec/atoms/std-lolo-source.lolo +251 -60
- package/behaviors/lolo/codec/atoms/std-lolo-swift.lolo +24 -1
- package/behaviors/lolo/codec/atoms/std-lolo-typescript.lolo +24 -3
- package/behaviors/lolo/connect/atoms/std-meta-ads.lolo +4 -4
- package/behaviors/lolo/connect/atoms/std-stdio-lines.lolo +7 -4
- package/behaviors/lolo/connect/atoms/std-youtube.lolo +9 -9
- package/behaviors/lolo/dev/atoms/std-guest-session.lolo +122 -10
- package/behaviors/lolo/dev/atoms/std-mock-seed-marks.lolo +66 -0
- package/behaviors/lolo/dev/organisms/std-behavior-playground.lolo +5 -2
- package/behaviors/lolo/dev/organisms/std-launchpad.lolo +4 -3
- package/behaviors/lolo/gpu/atoms/std-gpu-compute.lolo +329 -0
- package/behaviors/lolo/net/atoms/std-http-client.lolo +4 -4
- package/behaviors/lolo/net/atoms/std-http-fetch.lolo +6 -6
- package/behaviors/lolo/net/atoms/std-npm-lookup.lolo +1 -1
- package/behaviors/lolo/net/atoms/std-npm-registry.lolo +2 -2
- package/behaviors/lolo/spec/auth/dev-personas.replay.goldens.json +263 -2
- package/behaviors/lolo/spec/cli/lint-all.lolo +1 -0
- package/behaviors/lolo/spec/cli/lint-item-action-event.replay.goldens.json +9 -9
- package/behaviors/lolo/spec/cli/lint-mem-handles.replay.goldens.json +3021 -1
- package/behaviors/lolo/spec/cli/lint-os-grants.replay.goldens.json +284 -12
- package/behaviors/lolo/spec/cli/mcp-server.replay.goldens.json +51 -55
- package/behaviors/lolo/spec/cli/orb-compile.replay.goldens.json +10 -4
- package/behaviors/lolo/spec/cli/orb-packages.lolo +1 -1
- package/behaviors/lolo/spec/codec/lolo-kotlin.replay.goldens.json +7496 -7497
- package/behaviors/lolo/spec/codec/lolo-python.replay.goldens.json +341 -3
- package/behaviors/lolo/spec/codec/lolo-rust.replay.goldens.json +18931 -6142
- package/behaviors/lolo/spec/codec/lolo-source.fixtures/compose-pair.lolo +44 -0
- package/behaviors/lolo/spec/codec/lolo-source.fixtures/config-read.lolo +2 -1
- package/behaviors/lolo/spec/codec/lolo-source.fixtures/divide-default.lolo +2 -1
- package/behaviors/lolo/spec/codec/lolo-source.fixtures/divide-plain.lolo +2 -1
- package/behaviors/lolo/spec/codec/lolo-source.fixtures/get-past-end.lolo +2 -1
- package/behaviors/lolo/spec/codec/lolo-source.fixtures/list-call.lolo +2 -1
- package/behaviors/lolo/spec/codec/lolo-source.fixtures/list-plain.lolo +2 -1
- package/behaviors/lolo/spec/codec/lolo-source.fixtures/minus-binary.lolo +2 -1
- package/behaviors/lolo/spec/codec/lolo-source.fixtures/minus-unary.lolo +2 -1
- package/behaviors/lolo/spec/codec/lolo-source.fixtures/nested-let.lolo +2 -1
- package/behaviors/lolo/spec/codec/lolo-source.fixtures/no-machine.lolo +2 -1
- package/behaviors/lolo/spec/codec/lolo-source.fixtures/no-template.lolo +2 -1
- package/behaviors/lolo/spec/codec/lolo-source.fixtures/nth-past-end.lolo +2 -1
- package/behaviors/lolo/spec/codec/lolo-source.fixtures/nth-raw.lolo +2 -1
- package/behaviors/lolo/spec/codec/lolo-source.fixtures/ports-call.lolo +2 -1
- package/behaviors/lolo/spec/codec/lolo-source.fixtures/range-one.lolo +2 -1
- package/behaviors/lolo/spec/codec/lolo-source.fixtures/range-two.lolo +2 -1
- package/behaviors/lolo/spec/codec/lolo-source.fixtures/router-trio.lolo +88 -0
- package/behaviors/lolo/spec/codec/lolo-source.fixtures/store-pair.lolo +62 -0
- package/behaviors/lolo/spec/codec/lolo-source.fixtures/string-literal.lolo +2 -1
- package/behaviors/lolo/spec/codec/lolo-source.gen/knobs.py +27 -1
- package/behaviors/lolo/spec/codec/lolo-source.gen/src_assemble.in +54 -2
- package/behaviors/lolo/spec/codec/lolo-source.gen/src_finish.in +1 -1
- package/behaviors/lolo/spec/codec/lolo-source.gen/src_fold.in +24 -4
- package/behaviors/lolo/spec/codec/lolo-source.gen/src_head.in +8 -3
- package/behaviors/lolo/spec/codec/lolo-source.gen/src_prepare.in +6 -2
- package/behaviors/lolo/spec/codec/lolo-source.gen/src_trait.in +12 -2
- package/behaviors/lolo/spec/codec/lolo-source.parity/agent-step.lolo +2 -1
- package/behaviors/lolo/spec/codec/lolo-source.parity/agent-step.server.lolo +1 -0
- package/behaviors/lolo/spec/codec/lolo-source.parity/chunk.lolo +2 -1
- package/behaviors/lolo/spec/codec/lolo-source.parity/chunk.server.lolo +1 -0
- package/behaviors/lolo/spec/codec/lolo-source.parity/compose-pair.events.json +36 -0
- package/behaviors/lolo/spec/codec/lolo-source.parity/compose-pair.replay.goldens.json +91 -0
- package/behaviors/lolo/spec/codec/lolo-source.parity/cosine.lolo +2 -1
- package/behaviors/lolo/spec/codec/lolo-source.parity/cosine.server.lolo +1 -0
- package/behaviors/lolo/spec/codec/lolo-source.parity/drivers/kotlin/compose-pair.kt +31 -0
- package/behaviors/lolo/spec/codec/lolo-source.parity/drivers/kotlin/router-trio.kt +31 -0
- package/behaviors/lolo/spec/codec/lolo-source.parity/drivers/kotlin/store-pair.kt +31 -0
- package/behaviors/lolo/spec/codec/lolo-source.parity/drivers/python/compose-pair.py +18 -0
- package/behaviors/lolo/spec/codec/lolo-source.parity/drivers/python/router-trio.py +18 -0
- package/behaviors/lolo/spec/codec/lolo-source.parity/drivers/python/store-pair.py +17 -0
- package/behaviors/lolo/spec/codec/lolo-source.parity/drivers/rust/compose-pair.rs +37 -0
- package/behaviors/lolo/spec/codec/lolo-source.parity/drivers/rust/router-trio.rs +37 -0
- package/behaviors/lolo/spec/codec/lolo-source.parity/drivers/rust/store-pair.rs +36 -0
- package/behaviors/lolo/spec/codec/lolo-source.parity/drivers/swift/compose-pair.swift +24 -0
- package/behaviors/lolo/spec/codec/lolo-source.parity/drivers/swift/router-trio.swift +24 -0
- package/behaviors/lolo/spec/codec/lolo-source.parity/drivers/swift/store-pair.swift +23 -0
- package/behaviors/lolo/spec/codec/lolo-source.parity/drivers/typescript/compose-pair.mts +24 -0
- package/behaviors/lolo/spec/codec/lolo-source.parity/drivers/typescript/router-trio.mts +24 -0
- package/behaviors/lolo/spec/codec/lolo-source.parity/drivers/typescript/store-pair.mts +22 -0
- package/behaviors/lolo/spec/codec/lolo-source.parity/recall-at-k.lolo +2 -1
- package/behaviors/lolo/spec/codec/lolo-source.parity/recall-at-k.server.lolo +1 -0
- package/behaviors/lolo/spec/codec/lolo-source.parity/router-trio.events.json +18 -0
- package/behaviors/lolo/spec/codec/lolo-source.parity/router-trio.replay.goldens.json +87 -0
- package/behaviors/lolo/spec/codec/lolo-source.parity/store-pair.events.json +58 -0
- package/behaviors/lolo/spec/codec/lolo-source.parity/store-pair.replay.goldens.json +238 -0
- package/behaviors/lolo/spec/codec/lolo-swift.replay.goldens.json +15599 -2204
- package/behaviors/lolo/spec/codec/lolo-typescript.replay.goldens.json +28930 -28929
- package/behaviors/lolo/spec/connect/bearer-api.replay.goldens.json +1 -1
- package/behaviors/lolo/spec/connect/esign.replay.goldens.json +3 -3
- package/behaviors/lolo/spec/connect/github.replay.goldens.json +13 -13
- package/behaviors/lolo/spec/connect/google-calendar.replay.goldens.json +2 -2
- package/behaviors/lolo/spec/connect/image.replay.goldens.json +1 -1
- package/behaviors/lolo/spec/connect/meta-ads.replay.goldens.json +2 -2
- package/behaviors/lolo/spec/connect/stdio-lines.replay.goldens.json +90 -0
- package/behaviors/lolo/spec/connect/twilio.replay.goldens.json +2 -2
- package/behaviors/lolo/spec/connect/youtube.replay.goldens.json +1 -1
- package/behaviors/lolo/spec/dev/guest-session.replay.goldens.json +824 -0
- package/behaviors/lolo/spec/dev/mock-seed-marks.replay.goldens.json +365 -0
- package/behaviors/lolo/spec/dev/verify-walk.replay.goldens.json +2 -1
- package/behaviors/lolo/spec/gpu/gpu-compute.replay.goldens.json +784 -0
- package/behaviors/lolo/spec/mem/mem-buffer.replay.goldens.json +97 -1
- package/behaviors/lolo/spec/ml/vector-write.goldens.json +1 -1
- package/behaviors/lolo/spec/ml/vector-write.replay.goldens.json +2 -2
- package/behaviors/lolo/spec/net/http-client-call-host.replay.goldens.json +3 -3
- package/behaviors/lolo/spec/net/http-client-env-host.replay.goldens.json +3 -3
- package/behaviors/lolo/spec/net/http-client.replay.goldens.json +56 -56
- package/behaviors/lolo/spec/net/http-fetch.replay.goldens.json +2 -2
- package/behaviors/lolo/spec/net/npm-lookup.replay.goldens.json +1 -1
- package/behaviors/lolo/spec/net/npm-registry.replay.goldens.json +2 -2
- package/behaviors/lolo/spec/net/server-declared-traits.replay.goldens.json +6 -3
- package/behaviors/lolo/spec/net/server-external-inputs.replay.goldens.json +16 -8
- package/behaviors/lolo/spec/net/server-retargeted-leg.replay.goldens.json +4 -2
- package/behaviors/lolo/spec/net/server-untargeted-discovery.replay.goldens.json +50 -45
- package/behaviors/lolo/spec/ops/llm-spend-board.replay.goldens.json +112 -16
- package/behaviors/lolo/spec/store/firestore-twin.replay.goldens.json +1 -1
- package/behaviors/lolo/spec/store/row-store-postgres.gen/record_real_sql.py +1 -1
- package/behaviors/lolo/spec/ui/game/fx-particles.replay.goldens.json +37 -0
- package/behaviors/lolo/ui/avl/atoms/std-avl-cosmic-zoom.lolo +2 -2
- package/behaviors/lolo/ui/game/atoms/std-fx-particles.lolo +10 -1
- package/behaviors/lolo/ui/game/atoms/ui-draw-fx-layer.lolo +4 -4
- package/behaviors/lolo/ui/game/organisms/std-arcade-board-3d.lolo +9 -9
- package/behaviors/lolo/ui/game/organisms/std-crew-board-2d.lolo +4 -4
- package/behaviors/lolo/ui/game/organisms/std-dungeon-board-2d.lolo +5 -5
- package/behaviors/lolo/ui/game/organisms/std-market-board-3d.lolo +9 -9
- package/behaviors/lolo/ui/game/organisms/std-objective-board-3d.lolo +9 -9
- package/behaviors/lolo/ui/game/organisms/std-platformer-board-2d.lolo +5 -5
- package/behaviors/lolo/ui/game/organisms/std-platformer-puzzle.lolo +4 -4
- package/behaviors/lolo/ui/game/organisms/std-survival-board-3d.lolo +9 -9
- package/behaviors/lolo/ui/game/organisms/std-tactics-board-2d.lolo +5 -5
- package/behaviors/lolo/ui/game/organisms/std-tactics-board-3d.lolo +9 -9
- package/behaviors/registry/auth/atoms/std-dev-personas.orb +1 -1
- package/behaviors/registry/cli/atoms/std-orb-goldens.orb +1 -1
- package/behaviors/registry/cli/atoms/std-orb-lint-mem-handles.orb +1 -1
- package/behaviors/registry/cli/atoms/std-orb-lint-os-grants.orb +1 -1
- package/behaviors/registry/cli/atoms/std-orb-mcp.orb +1 -1
- package/behaviors/registry/cli/atoms/std-orb-packages.orb +1 -1
- package/behaviors/registry/cli/atoms/std-orb-serve.orb +1 -1
- package/behaviors/registry/codec/atoms/std-lolo-kotlin.orb +1 -1
- package/behaviors/registry/codec/atoms/std-lolo-python.orb +1 -1
- package/behaviors/registry/codec/atoms/std-lolo-rust.orb +1 -1
- package/behaviors/registry/codec/atoms/std-lolo-source.orb +1 -1
- package/behaviors/registry/codec/atoms/std-lolo-swift.orb +1 -1
- package/behaviors/registry/codec/atoms/std-lolo-typescript.orb +1 -1
- package/behaviors/registry/connect/atoms/std-meta-ads.orb +1 -1
- package/behaviors/registry/connect/atoms/std-stdio-lines.orb +1 -1
- package/behaviors/registry/connect/atoms/std-youtube.orb +1 -1
- package/behaviors/registry/dev/atoms/std-guest-session.orb +1 -1
- package/behaviors/registry/dev/atoms/std-mock-seed-marks.orb +1 -0
- package/behaviors/registry/dev/organisms/std-behavior-playground.orb +37 -0
- package/behaviors/registry/dev/organisms/std-launchpad.orb +25 -0
- package/behaviors/registry/gpu/atoms/std-gpu-compute.orb +1 -0
- package/behaviors/registry/net/atoms/std-http-client.orb +1 -1
- package/behaviors/registry/net/atoms/std-http-fetch.orb +1 -1
- package/behaviors/registry/net/atoms/std-npm-lookup.orb +1 -1
- package/behaviors/registry/net/atoms/std-npm-registry.orb +1 -1
- package/behaviors/registry/spec/cli/lint-all.orb +1 -1
- package/behaviors/registry/spec/cli/orb-packages.orb +1 -1
- package/behaviors/registry/spec/codec/lolo-source.fixtures/compose-pair.orb +1 -0
- package/behaviors/registry/spec/codec/lolo-source.fixtures/config-read.orb +1 -1
- package/behaviors/registry/spec/codec/lolo-source.fixtures/divide-default.orb +1 -1
- package/behaviors/registry/spec/codec/lolo-source.fixtures/divide-plain.orb +1 -1
- package/behaviors/registry/spec/codec/lolo-source.fixtures/get-past-end.orb +1 -1
- package/behaviors/registry/spec/codec/lolo-source.fixtures/list-call.orb +1 -1
- package/behaviors/registry/spec/codec/lolo-source.fixtures/list-plain.orb +1 -1
- package/behaviors/registry/spec/codec/lolo-source.fixtures/minus-binary.orb +1 -1
- package/behaviors/registry/spec/codec/lolo-source.fixtures/minus-unary.orb +1 -1
- package/behaviors/registry/spec/codec/lolo-source.fixtures/nested-let.orb +1 -1
- package/behaviors/registry/spec/codec/lolo-source.fixtures/no-machine.orb +1 -1
- package/behaviors/registry/spec/codec/lolo-source.fixtures/no-template.orb +1 -1
- package/behaviors/registry/spec/codec/lolo-source.fixtures/nth-past-end.orb +1 -1
- package/behaviors/registry/spec/codec/lolo-source.fixtures/nth-raw.orb +1 -1
- package/behaviors/registry/spec/codec/lolo-source.fixtures/ports-call.orb +1 -1
- package/behaviors/registry/spec/codec/lolo-source.fixtures/range-one.orb +1 -1
- package/behaviors/registry/spec/codec/lolo-source.fixtures/range-two.orb +1 -1
- package/behaviors/registry/spec/codec/lolo-source.fixtures/router-trio.orb +1 -0
- package/behaviors/registry/spec/codec/lolo-source.fixtures/store-pair.orb +1 -0
- package/behaviors/registry/spec/codec/lolo-source.fixtures/string-literal.orb +1 -1
- package/behaviors/registry/spec/codec/lolo-source.parity/agent-step.orb +1 -1
- package/behaviors/registry/spec/codec/lolo-source.parity/agent-step.server.orb +1 -1
- package/behaviors/registry/spec/codec/lolo-source.parity/chunk.orb +1 -1
- package/behaviors/registry/spec/codec/lolo-source.parity/chunk.server.orb +1 -1
- package/behaviors/registry/spec/codec/lolo-source.parity/cosine.orb +1 -1
- package/behaviors/registry/spec/codec/lolo-source.parity/cosine.server.orb +1 -1
- package/behaviors/registry/spec/codec/lolo-source.parity/recall-at-k.orb +1 -1
- package/behaviors/registry/spec/codec/lolo-source.parity/recall-at-k.server.orb +1 -1
- package/behaviors/registry/ui/avl/atoms/std-avl-cosmic-zoom.orb +1 -1
- package/behaviors/registry/ui/game/atoms/std-fx-particles.orb +1 -1
- package/behaviors/registry/ui/game/atoms/ui-draw-fx-layer.orb +1 -1
- package/behaviors/registry/ui/game/organisms/std-arcade-board-3d.orb +20 -13
- package/behaviors/registry/ui/game/organisms/std-crew-board-2d.orb +9 -5
- package/behaviors/registry/ui/game/organisms/std-dungeon-board-2d.orb +17 -7
- package/behaviors/registry/ui/game/organisms/std-market-board-3d.orb +19 -15
- package/behaviors/registry/ui/game/organisms/std-objective-board-3d.orb +15 -12
- package/behaviors/registry/ui/game/organisms/std-platformer-board-2d.orb +17 -7
- package/behaviors/registry/ui/game/organisms/std-platformer-puzzle.orb +4 -0
- package/behaviors/registry/ui/game/organisms/std-survival-board-3d.orb +15 -12
- package/behaviors/registry/ui/game/organisms/std-tactics-board-2d.orb +13 -6
- package/behaviors/registry/ui/game/organisms/std-tactics-board-3d.orb +14 -12
- package/canonical-operators.json +1426 -103
- package/dist/{chunk-EK22WRB6.js → chunk-2UGHBVU2.js} +2 -2
- package/dist/{chunk-GDMH5T4J.js → chunk-3DK7GI2C.js} +2 -2
- package/dist/chunk-3MDASC5C.js +26 -0
- package/dist/{chunk-K5ZI27PB.js → chunk-3PHO4RRF.js} +1 -1
- package/dist/{chunk-7IEMMYM6.js → chunk-4MJCLAZW.js} +1 -1
- package/dist/{chunk-W4IEV4BY.js → chunk-55JPIL7A.js} +2 -2
- package/dist/{chunk-RUGBZTV3.js → chunk-66BLZLFI.js} +1 -1
- package/dist/{chunk-YWFISV7L.js → chunk-66RAJFOD.js} +1 -1
- package/dist/{chunk-JWOWWGNZ.js → chunk-6ED4SUC6.js} +1 -1
- package/dist/{chunk-LL7P6EII.js → chunk-6KFCHNE2.js} +2 -2
- package/dist/{chunk-GFBL2TW6.js → chunk-A4QB3Y6L.js} +1 -1
- package/dist/chunk-BVWMLS32.js +123 -0
- package/dist/{chunk-5KQCGSNC.js → chunk-CRKVDCY7.js} +1 -1
- package/dist/{chunk-WHQDLLC3.js → chunk-EKWEY4OJ.js} +1 -1
- package/dist/{chunk-Y3BRVNYK.js → chunk-EU22GCGV.js} +2 -2
- package/dist/{chunk-XQPYTDZ4.js → chunk-FB6PKNRS.js} +1 -1
- package/dist/{chunk-UX3MDFX6.js → chunk-FSVOJQLP.js} +1 -1
- package/dist/{chunk-LDBD2FBQ.js → chunk-GAKLBWBR.js} +1 -1
- package/dist/{chunk-C3IEMPRZ.js → chunk-GO3FKBV2.js} +2 -2
- package/dist/{chunk-LZSPEHSM.js → chunk-GPDTJHYY.js} +1 -1
- package/dist/{chunk-W5ABMOXU.js → chunk-JQBWLH5V.js} +1 -1
- package/dist/{chunk-63X6RNY6.js → chunk-KKW3JHTC.js} +1 -1
- package/dist/{chunk-5PLJE42Q.js → chunk-LF2EZVAM.js} +1 -1
- package/dist/{chunk-RXWBYWQB.js → chunk-LGCKOZP3.js} +2 -2
- package/dist/{chunk-JJEADYP7.js → chunk-LMZ6XJFB.js} +2 -2
- package/dist/{chunk-CWYSQZJU.js → chunk-M2YQNSAZ.js} +2 -2
- package/dist/{chunk-GNCKJV3P.js → chunk-MKWHYBIS.js} +1 -1
- package/dist/{chunk-ZB2CLGEG.js → chunk-MXBGYTYF.js} +1 -1
- package/dist/{chunk-UN76TRSK.js → chunk-NH6MXHZR.js} +41 -41
- package/dist/{chunk-II2VW7T6.js → chunk-ODBIX4DB.js} +1 -1
- package/dist/{chunk-3F3CNWOG.js → chunk-OYDQR6DT.js} +2 -2
- package/dist/{chunk-FVL6BT6L.js → chunk-PD6POR44.js} +1 -1
- package/dist/{chunk-U6USXZ5M.js → chunk-PHFT3QNS.js} +2 -2
- package/dist/{chunk-RJYKIZMS.js → chunk-PQZ6PVKG.js} +2 -2
- package/dist/{chunk-TQPQXCSZ.js → chunk-Q6NHXIOZ.js} +2 -2
- package/dist/{chunk-KYGWVCTM.js → chunk-QMDVYTB7.js} +1 -1
- package/dist/{chunk-XKTATY45.js → chunk-RW2KMSG5.js} +4 -4
- package/dist/{chunk-UHNSPTFT.js → chunk-SA2ZS24W.js} +1 -1
- package/dist/{chunk-6YPUQK36.js → chunk-SFWP4UMK.js} +2 -2
- package/dist/{chunk-ZZYLFHBU.js → chunk-TLNEQA4D.js} +1 -1
- package/dist/{chunk-RGTBRWWA.js → chunk-TOODE5AD.js} +2 -2
- package/dist/{chunk-QGWAHOFR.js → chunk-U57GY7SM.js} +2 -2
- package/dist/{chunk-FDJZKB7J.js → chunk-UIDQQJSX.js} +1 -1
- package/dist/{chunk-LLH3WXM3.js → chunk-UVFP2B7I.js} +1 -1
- package/dist/{chunk-4OF7727E.js → chunk-VEGZPCTZ.js} +2 -2
- package/dist/{chunk-73YUPNIT.js → chunk-VXN4V7LC.js} +1 -1
- package/dist/{chunk-4D3W6AAE.js → chunk-YHQVZWPG.js} +1 -1
- package/dist/{chunk-XXYBHYLM.js → chunk-YQO3TO66.js} +2 -2
- package/dist/{chunk-YZAYFR5A.js → chunk-ZSJ3GEOJ.js} +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +50 -50
- package/dist/modules/anim.js +2 -2
- package/dist/modules/array.js +2 -2
- package/dist/modules/auth.js +3 -3
- package/dist/modules/behavior.js +2 -2
- package/dist/modules/bit.js +2 -2
- package/dist/modules/browser.js +2 -2
- package/dist/modules/bytes.js +2 -2
- package/dist/modules/codec.js +3 -3
- package/dist/modules/composition.js +2 -2
- package/dist/modules/core.js +2 -2
- package/dist/modules/csv.js +2 -2
- package/dist/modules/ffi.js +3 -3
- package/dist/modules/format.js +2 -2
- package/dist/modules/geo.js +2 -2
- package/dist/modules/gpu.d.ts +12 -0
- package/dist/modules/gpu.js +3 -0
- package/dist/modules/grid.js +2 -2
- package/dist/modules/i18n.js +2 -2
- package/dist/modules/index.d.ts +1 -2
- package/dist/modules/index.js +45 -46
- package/dist/modules/json.js +2 -2
- package/dist/modules/kernel.js +3 -3
- package/dist/modules/kv.js +3 -3
- package/dist/modules/llm.js +2 -2
- package/dist/modules/math.js +2 -2
- package/dist/modules/mem.js +3 -3
- package/dist/modules/object.js +2 -2
- package/dist/modules/os-common.d.ts +1 -1
- package/dist/modules/os-common.js +2 -2
- package/dist/modules/os-desktop.js +3 -3
- package/dist/modules/os-dev.js +3 -3
- package/dist/modules/os-dir.js +3 -3
- package/dist/modules/os-env-stdio.js +3 -3
- package/dist/modules/os-fs.js +3 -3
- package/dist/modules/os-net.js +3 -3
- package/dist/modules/os-path.js +3 -3
- package/dist/modules/os-process.js +3 -3
- package/dist/modules/os-sys.js +3 -3
- package/dist/modules/os-time-users.js +3 -3
- package/dist/modules/os.js +13 -13
- package/dist/modules/path.js +2 -2
- package/dist/modules/prob.js +2 -2
- package/dist/modules/program.js +2 -2
- package/dist/modules/session.js +2 -2
- package/dist/modules/str.js +2 -2
- package/dist/modules/time.js +2 -2
- package/dist/modules/validate.js +2 -2
- package/dist/modules/vector.js +2 -2
- package/dist/modules/workspace.js +2 -2
- package/dist/modules/xml.js +2 -2
- package/dist/modules/yaml.js +2 -2
- package/dist/registry.d.ts +2 -2
- package/dist/registry.js +49 -49
- package/dist/{types-BA4LkhNJ.d.ts → types-CgiGhK6t.d.ts} +17 -3
- package/package.json +5 -5
- package/dist/chunk-F5TP25JA.js +0 -26
- package/dist/chunk-NE4WSTN7.js +0 -26
- package/dist/modules/trace.d.ts +0 -15
- package/dist/modules/trace.js +0 -2
- /package/dist/{chunk-SHSBTDDX.js → chunk-QUQ33UXH.js} +0 -0
|
@@ -29,7 +29,7 @@ orbital LoloRustOrbital {
|
|
|
29
29
|
indexedVars: "({{index}}, {{item}})"
|
|
30
30
|
unsupportedForm: "_unsupported(&{{op}})"
|
|
31
31
|
unsupportedWarn: "no {{language}} template for operator {{op}}"
|
|
32
|
-
helpers: { "/": ["fn _div(a: f64, b: f64) -> Option<f64> { if b == 0.0 { None } else { Some(a / b) } }"], "%": ["fn _mod(a: f64, b: f64) -> Option<f64> { if b == 0.0 { None } else { Some(a % b) } }"], "math/mod": ["fn _mod(a: f64, b: f64) -> Option<f64> { if b == 0.0 { None } else { Some(a % b) } }"], "default": ["trait _OrDefault<T> { fn _or_default(self, d: T) -> T; }\nimpl<T> _OrDefault<T> for Option<T> { fn _or_default(self, d: T) -> T { self.unwrap_or(d) } }\nimpl<T> _OrDefault<T> for T { fn _or_default(self, _d: T) -> T { self } }\nfn _default<T, V: _OrDefault<T>>(v: V, d: T) -> T { v._or_default(d) }"], "str/concat": ["fn _num_text(x: f64) -> String {\n if x.is_nan() { return \"NaN\".to_string(); }\n if x.is_infinite() { return (if x > 0.0 { \"Infinity\" } else { \"-Infinity\" }).to_string(); }\n if x == 0.0 { return \"0\".to_string(); }\n let a = x.abs();\n if a >= 1e21 || a < 1e-6 {\n let s = format!(\"{:e}\", x);\n return match s.split_once('e') {\n Some((m, e)) => if e.starts_with('-') { format!(\"{}e{}\", m, e) } else { format!(\"{}e+{}\", m, e) },\n None => s,\n };\n }\n format!(\"{}\", x)\n}", "trait _Text { fn _text(&self) -> String; }\nimpl _Text for String { fn _text(&self) -> String { self.clone() } }\nimpl _Text for bool { fn _text(&self) -> String { (if *self { \"true\" } else { \"false\" }).to_string() } }\nimpl _Text for f64 { fn _text(&self) -> String { _num_text(*self) } }", "macro_rules! _concat {\n ($($x:expr),+ $(,)?) => {{\n let mut s_ = String::new();\n $( s_.push_str(&_Text::_text(&$x)); )+\n s_\n }};\n}"], "str/join": ["fn _num_text(x: f64) -> String {\n if x.is_nan() { return \"NaN\".to_string(); }\n if x.is_infinite() { return (if x > 0.0 { \"Infinity\" } else { \"-Infinity\" }).to_string(); }\n if x == 0.0 { return \"0\".to_string(); }\n let a = x.abs();\n if a >= 1e21 || a < 1e-6 {\n let s = format!(\"{:e}\", x);\n return match s.split_once('e') {\n Some((m, e)) => if e.starts_with('-') { format!(\"{}e{}\", m, e) } else { format!(\"{}e+{}\", m, e) },\n None => s,\n };\n }\n format!(\"{}\", x)\n}", "trait _Text { fn _text(&self) -> String; }\nimpl _Text for String { fn _text(&self) -> String { self.clone() } }\nimpl _Text for bool { fn _text(&self) -> String { (if *self { \"true\" } else { \"false\" }).to_string() } }\nimpl _Text for f64 { fn _text(&self) -> String { _num_text(*self) } }", "fn _join<T: _Text>(a: &[T], d: &str) -> String { a.iter().map(|x| x._text()).collect::<Vec<_>>().join(d) }"], "str/split": ["fn _split(s: &str, d: &str) -> Vec<String> {\n if d.is_empty() { s.chars().map(|c| c.to_string()).collect() } else { s.split(d).map(|p| p.to_string()).collect() }\n}"], "str/slice": ["fn _whole(x: f64) -> i64 {\n if !x.is_finite() || x != x.trunc() { panic!(\"expected a whole number, got {}\", x); }\n x as i64\n}", "fn _str_slice(s: &str, a: f64, b: Option<f64>) -> String {\n let c: Vec<char> = s.chars().collect();\n let n = c.len() as i64;\n let norm = |i: i64| -> i64 { if i < 0 { (n + i).max(0) } else { i.min(n) } };\n let st = norm(_whole(a));\n let en = match b { Some(v) => norm(_whole(v)), None => n };\n if en <= st { String::new() } else { c[st as usize..en as usize].iter().collect() }\n}"], "str/padStart": ["fn _whole(x: f64) -> i64 {\n if !x.is_finite() || x != x.trunc() { panic!(\"expected a whole number, got {}\", x); }\n x as i64\n}", "fn _pad_start(s: &str, n: f64, p: &str) -> String {\n if p.chars().count() != 1 { panic!(\"expected a single padding character, got {:?}\", p); }\n let w = _whole(n);\n let len = s.chars().count() as i64;\n if w <= len { return s.to_string(); }\n let pad: String = std::iter::repeat(p).take((w - len) as usize).collect();\n format!(\"{}{}\", pad, s)\n}"], "str/padEnd": ["fn _whole(x: f64) -> i64 {\n if !x.is_finite() || x != x.trunc() { panic!(\"expected a whole number, got {}\", x); }\n x as i64\n}", "fn _pad_end(s: &str, n: f64, p: &str) -> String {\n if p.chars().count() != 1 { panic!(\"expected a single padding character, got {:?}\", p); }\n let w = _whole(n);\n let len = s.chars().count() as i64;\n if w <= len { return s.to_string(); }\n let pad: String = std::iter::repeat(p).take((w - len) as usize).collect();\n format!(\"{}{}\", s, pad)\n}"], "str/truncate": ["fn _whole(x: f64) -> i64 {\n if !x.is_finite() || x != x.trunc() { panic!(\"expected a whole number, got {}\", x); }\n x as i64\n}", "fn _truncate(s: &str, n: f64, suffix: &str) -> String {\n let w = _whole(n);\n if (s.chars().count() as i64) <= w { return s.to_string(); }\n let head: String = s.chars().take(w.max(0) as usize).collect();\n format!(\"{}{}\", head, suffix)\n}"], "str/repeat": ["fn _count(x: f64) -> usize {\n if !x.is_finite() || x != x.trunc() || x < 0.0 { panic!(\"count is not a whole number from 0\"); }\n x as usize\n}", "fn _repeat(s: &str, n: f64) -> String { s.repeat(_count(n)) }"], "str/capitalize": ["fn _capitalize(s: &str) -> String {\n let mut c = s.chars();\n match c.next() {\n Some(f) => f.to_uppercase().collect::<String>() + &c.as_str().to_lowercase(),\n None => String::new(),\n }\n}"], "str/to-int": ["fn _to_int(s: &str) -> Option<f64> { s.parse::<i64>().ok().map(|v| v as f64) }"], "array/sum": ["fn _sum(a: &[f64]) -> f64 { a.iter().fold(0.0_f64, |s, x| s + x) }"], "array/avg": ["fn _avg(a: &[f64]) -> Option<f64> { if a.is_empty() { None } else { Some(a.iter().fold(0.0_f64, |s, x| s + x) / a.len() as f64) } }"], "array/max": ["fn _amax(a: &[f64]) -> Option<f64> { a.iter().cloned().fold(None, |m, x| Some(match m { Some(y) => if x > y { x } else { y }, None => x })) }"], "array/min": ["fn _amin(a: &[f64]) -> Option<f64> { a.iter().cloned().fold(None, |m, x| Some(match m { Some(y) => if x < y { x } else { y }, None => x })) }"], "array/first": ["fn _first<T: Clone>(a: &[T]) -> Option<T> { a.first().cloned() }"], "array/last": ["fn _last<T: Clone>(a: &[T]) -> Option<T> { a.last().cloned() }"], "array/nth": ["fn _nth<T: Clone>(a: &[T], i: f64) -> Option<T> {\n if !i.is_finite() || i != i.trunc() || i < 0.0 { panic!(\"nth: index {} is not a whole number from 0\", i); }\n a.get(i as usize).cloned()\n}"], "array/range": ["fn _range(a: f64, b: f64, step: f64) -> Vec<f64> {\n if step == 0.0 || !step.is_finite() { panic!(\"range: step 0 must be a non-zero finite number\"); }\n let mut out = Vec::new();\n let mut x = a;\n while if step > 0.0 { x < b } else { x > b } { out.push(x); x += step; }\n out\n}"], "array/slice": ["fn _whole(x: f64) -> i64 {\n if !x.is_finite() || x != x.trunc() { panic!(\"expected a whole number, got {}\", x); }\n x as i64\n}", "fn _slice<T: Clone>(a: &[T], s: f64, e: Option<f64>) -> Vec<T> {\n let st = _whole(s);\n let en = e.map(_whole);\n if st < 0 || en.map_or(false, |v| v < 0) { panic!(\"slice: not a whole number from 0\"); }\n let st = (st as usize).min(a.len());\n let en = en.map_or(a.len(), |v| (v as usize).min(a.len()));\n if en <= st { Vec::new() } else { a[st..en].to_vec() }\n}"], "array/take": ["fn _count(x: f64) -> usize {\n if !x.is_finite() || x != x.trunc() || x < 0.0 { panic!(\"count is not a whole number from 0\"); }\n x as usize\n}", "fn _take<T: Clone>(a: &[T], n: f64) -> Vec<T> { a.iter().take(_count(n)).cloned().collect() }"], "array/drop": ["fn _count(x: f64) -> usize {\n if !x.is_finite() || x != x.trunc() || x < 0.0 { panic!(\"count is not a whole number from 0\"); }\n x as usize\n}", "fn _drop<T: Clone>(a: &[T], n: f64) -> Vec<T> { a.iter().skip(_count(n)).cloned().collect() }"], "array/takeLast": ["fn _count(x: f64) -> usize {\n if !x.is_finite() || x != x.trunc() || x < 0.0 { panic!(\"count is not a whole number from 0\"); }\n x as usize\n}", "fn _take_last<T: Clone>(a: &[T], n: f64) -> Vec<T> { let k = _count(n).min(a.len()); a[a.len() - k..].to_vec() }"], "array/dropLast": ["fn _count(x: f64) -> usize {\n if !x.is_finite() || x != x.trunc() || x < 0.0 { panic!(\"count is not a whole number from 0\"); }\n x as usize\n}", "fn _drop_last<T: Clone>(a: &[T], n: f64) -> Vec<T> { let k = _count(n).min(a.len()); a[..a.len() - k].to_vec() }"], "array/append": ["fn _append<T: Clone>(a: &[T], x: T) -> Vec<T> { let mut v = a.to_vec(); v.push(x); v }"], "array/prepend": ["fn _prepend<T: Clone>(a: &[T], x: T) -> Vec<T> { let mut v = vec![x]; v.extend(a.iter().cloned()); v }"], "array/indexOf": ["fn _index_of<T: PartialEq>(a: &[T], x: &T) -> f64 { a.iter().position(|y| y == x).map_or(-1.0, |i| i as f64) }"], "array/unique": ["fn _unique<T: Clone + PartialEq>(a: &[T]) -> Vec<T> {\n let mut out: Vec<T> = Vec::new();\n for x in a { if !out.contains(x) { out.push(x.clone()); } }\n out\n}"], "array/flatten": ["fn _flatten<T: Clone>(a: &[Vec<T>]) -> Vec<T> { a.iter().flat_map(|v| v.iter().cloned()).collect() }"], "array/zip": ["fn _zip<T: Clone>(a: &[T], b: &[T]) -> Vec<Vec<T>> { a.iter().cloned().zip(b.iter().cloned()).map(|(x, y)| vec![x, y]).collect() }"], "array/concat": ["macro_rules! _vconcat {\n ($($x:expr),+ $(,)?) => {{\n let mut v_ = Vec::new();\n $( v_.extend($x.iter().cloned()); )+\n v_\n }};\n}"], "array/sort": ["fn _sort<T: Clone + PartialOrd>(a: &[T]) -> Vec<T> {\n let mut v = a.to_vec();\n v.sort_by(|x, y| x.partial_cmp(y).unwrap_or(std::cmp::Ordering::Equal));\n v\n}"], "array/reduce": ["fn _reduce<T: Clone, A>(a: &[T], init: A, f: impl Fn(A, T) -> A) -> A { a.iter().cloned().fold(init, f) }"], "math/round": ["fn _round(x: f64, d: f64) -> f64 {\n let m = 10.0_f64.powf(d);\n let r = (x.abs() * m + 0.5).floor() / m;\n if x < 0.0 { -r } else { r }\n}"], "math/acos": ["fn _acos(x: f64) -> Option<f64> { if (-1.0..=1.0).contains(&x) { Some(x.acos()) } else { None } }"], "math/asin": ["fn _asin(x: f64) -> Option<f64> { if (-1.0..=1.0).contains(&x) { Some(x.asin()) } else { None } }"], "math/approach": ["fn _approach(c: f64, t: f64, d: f64) -> f64 { if (t - c).abs() <= d { t } else { c + (t - c).signum() * d } }"], "math/map": ["fn _map(v: f64, a: f64, b: f64, c: f64, d: f64) -> f64 { if b == a { c } else { c + (v - a) / (b - a) * (d - c) } }"], "math/wrap": ["fn _wrap(v: f64, lo: f64, hi: f64) -> f64 {\n let r = hi - lo;\n if r <= 0.0 { lo } else { ((v - lo) % r + r) % r + lo }\n}"], "array/insert": ["fn _whole(x: f64) -> i64 {\n if !x.is_finite() || x != x.trunc() { panic!(\"expected a whole number, got {}\", x); }\n x as i64\n}", "fn _insert<T: Clone>(a: &[T], i: f64, x: T) -> Vec<T> {\n let k = _whole(i);\n if k < 0 || k as usize > a.len() { panic!(\"insert: index {} is not within a {}-item array\", k, a.len()); }\n let mut v = a.to_vec();\n v.insert(k as usize, x);\n v\n}"], "array/remove": ["fn _whole(x: f64) -> i64 {\n if !x.is_finite() || x != x.trunc() { panic!(\"expected a whole number, got {}\", x); }\n x as i64\n}", "fn _remove<T: Clone>(a: &[T], i: f64) -> Vec<T> {\n let k = _whole(i);\n if k < 0 || k as usize >= a.len() { panic!(\"remove: index {} is outside a {}-item array\", k, a.len()); }\n let mut v = a.to_vec();\n v.remove(k as usize);\n v\n}"], "array/removeItem": ["fn _remove_item<T: Clone + PartialEq>(a: &[T], x: &T) -> Vec<T> {\n let mut v = a.to_vec();\n if let Some(p) = v.iter().position(|y| y == x) { v.remove(p); }\n v\n}"], "math/sqrt": ["fn _sqrt(x: f64) -> Option<f64> { if x < 0.0 { None } else { Some(x.sqrt()) } }"], "math/ln": ["fn _ln(x: f64) -> Option<f64> { if x <= 0.0 { None } else { Some(x.ln()) } }"], "math/log10": ["fn _log10(x: f64) -> Option<f64> { if x <= 0.0 { None } else { Some(x.log10()) } }"], "math/pow": ["fn _pow(a: f64, b: f64) -> Option<f64> { let r = a.powf(b); if r.is_finite() { Some(r) } else { None } }"], "math/sign": ["fn _sign(x: f64) -> f64 { if x > 0.0 { 1.0 } else if x < 0.0 { -1.0 } else { 0.0 } }"], "object/get": ["fn _get<V: Clone>(m: &std::collections::BTreeMap<String, V>, k: &str) -> Option<V> { m.get(k).cloned() }"], "object/merge": ["fn _merge<V: Clone>(a: &std::collections::BTreeMap<String, V>, b: &std::collections::BTreeMap<String, V>) -> std::collections::BTreeMap<String, V> {\n let mut m = a.clone();\n for (k, v) in b { m.insert(k.clone(), v.clone()); }\n m\n}"], "object/pick": ["fn _pick<V: Clone>(m: &std::collections::BTreeMap<String, V>, ks: &[String]) -> std::collections::BTreeMap<String, V> {\n m.iter().filter(|(k, _)| ks.contains(k)).map(|(k, v)| (k.clone(), v.clone())).collect()\n}"], "object/omit": ["fn _omit<V: Clone>(m: &std::collections::BTreeMap<String, V>, ks: &[String]) -> std::collections::BTreeMap<String, V> {\n m.iter().filter(|(k, _)| !ks.contains(k)).map(|(k, v)| (k.clone(), v.clone())).collect()\n}"], "unsupported": ["#[derive(Clone)]\nstruct _U;\nfn _unsupported(op: &str) -> _U { panic!(\"no native template for operator {}\", op) }\nimpl From<_U> for f64 { fn from(_: _U) -> Self { panic!(\"unsupported\") } }\nimpl From<_U> for String { fn from(_: _U) -> Self { panic!(\"unsupported\") } }\nimpl From<_U> for bool { fn from(_: _U) -> Self { panic!(\"unsupported\") } }\nimpl From<_U> for Option<f64> { fn from(_: _U) -> Self { panic!(\"unsupported\") } }\nimpl From<_U> for Option<String> { fn from(_: _U) -> Self { panic!(\"unsupported\") } }\nimpl From<_U> for Option<bool> { fn from(_: _U) -> Self { panic!(\"unsupported\") } }\nimpl<T> From<_U> for Vec<T> { fn from(_: _U) -> Self { panic!(\"unsupported\") } }\nimpl<T> From<_U> for Option<Vec<T>> { fn from(_: _U) -> Self { panic!(\"unsupported\") } }\nimpl<K: Ord, V> From<_U> for std::collections::BTreeMap<K, V> { fn from(_: _U) -> Self { panic!(\"unsupported\") } }\nimpl<K: Ord, V> From<_U> for Option<std::collections::BTreeMap<K, V>> { fn from(_: _U) -> Self { panic!(\"unsupported\") } }"] }
|
|
32
|
+
helpers: { "store": ["pub trait Store {\n fn persist(&mut self, op: &str, entity: &str, data: serde_json::Value) -> (bool, serde_json::Value);\n fn fetch(&mut self, entity: &str, keep: Option<&dyn Fn(&serde_json::Map<String, serde_json::Value>) -> bool>) -> (bool, serde_json::Value);\n}\n\nfn _order(a: &serde_json::Map<String, serde_json::Value>, b: &serde_json::Map<String, serde_json::Value>) -> std::cmp::Ordering {\n let (sa, sb) = (a.get(\"createdAt\").filter(|v| !v.is_null()), b.get(\"createdAt\").filter(|v| !v.is_null()));\n let by_stamp = match (sa, sb) {\n (Some(_), None) => std::cmp::Ordering::Less,\n (None, Some(_)) => std::cmp::Ordering::Greater,\n (Some(x), Some(y)) => match (x.as_f64(), y.as_f64(), x.as_str(), y.as_str()) {\n (Some(p), Some(q), _, _) => p.partial_cmp(&q).unwrap_or(std::cmp::Ordering::Equal),\n (_, _, Some(p), Some(q)) => p.cmp(q),\n _ => std::cmp::Ordering::Equal,\n },\n (None, None) => std::cmp::Ordering::Equal,\n };\n let id = |m: &serde_json::Map<String, serde_json::Value>| m.get(\"id\").and_then(|v| v.as_str()).unwrap_or(\"\").to_string();\n by_stamp.then_with(|| id(a).cmp(&id(b)))\n}\n\n#[derive(Default)]\npub struct MemoryStore {\n tables: std::collections::BTreeMap<String, Vec<(String, serde_json::Map<String, serde_json::Value>)>>,\n minted: u64,\n}\n\nimpl Store for MemoryStore {\n fn persist(&mut self, op: &str, entity: &str, data: serde_json::Value) -> (bool, serde_json::Value) {\n let rows = self.tables.entry(entity.to_string()).or_default();\n if op == \"create\" {\n let mut row = data.as_object().cloned().unwrap_or_default();\n let id = match row.get(\"id\").and_then(|v| v.as_str()).filter(|v| !v.is_empty()) {\n Some(v) => v.to_string(),\n None => {\n self.minted += 1;\n format!(\"{}-{}\", entity, self.minted)\n }\n };\n row.insert(\"id\".to_string(), serde_json::Value::String(id.clone()));\n rows.push((id, row.clone()));\n return (true, serde_json::Value::Object(row));\n }\n let key = match &data {\n serde_json::Value::String(v) => v.clone(),\n v => v.get(\"id\").and_then(|x| x.as_str()).unwrap_or(\"\").to_string(),\n };\n let Some(pos) = rows.iter().position(|(k, _)| *k == key) else {\n return (false, serde_json::json!({ \"error\": format!(\"{} {} not found\", entity, key), \"code\": \"not-found\" }));\n };\n if op == \"delete\" {\n rows.remove(pos);\n return (true, serde_json::json!({ \"id\": key, \"deleted\": true }));\n }\n if let Some(obj) = data.as_object() {\n for (k, v) in obj {\n rows[pos].1.insert(k.clone(), v.clone());\n }\n }\n (true, serde_json::Value::Object(rows[pos].1.clone()))\n }\n\n fn fetch(&mut self, entity: &str, keep: Option<&dyn Fn(&serde_json::Map<String, serde_json::Value>) -> bool>) -> (bool, serde_json::Value) {\n let mut rows: Vec<serde_json::Map<String, serde_json::Value>> = self.tables.get(entity).map_or_else(Vec::new, |t| t.iter().map(|(_, r)| r.clone()).collect());\n rows.retain(|r| keep.map_or(true, |k| k(r)));\n rows.sort_by(_order);\n let n = rows.len();\n (true, serde_json::json!({ \"data\": rows, \"totalCount\": n }))\n }\n}\n\nmacro_rules! _routed_store {\n ($t:ty) => {\n impl _Routed for $t {\n fn state(&self) -> String { self.state.clone() }\n fn entity_json(&self) -> serde_json::Value { serde_json::to_value(&self.entity).unwrap_or(serde_json::Value::Null) }\n fn emitted_len(&self) -> usize { self.emitted.len() }\n fn emitted_from(&self, n: usize) -> Vec<(String, serde_json::Value, bool)> {\n self.emitted[n..].iter().enumerate().map(|(j, (e, p))| (e.clone(), p.clone().unwrap_or_else(|| serde_json::json!({})), self.completed.contains(&(n + j)))).collect()\n }\n fn as_any(&mut self) -> &mut dyn std::any::Any { self }\n }\n };\n}"], "router": ["trait _Routed {\n fn state(&self) -> String;\n fn entity_json(&self) -> serde_json::Value;\n fn emitted_len(&self) -> usize;\n fn emitted_from(&self, n: usize) -> Vec<(String, serde_json::Value, bool)>;\n fn as_any(&mut self) -> &mut dyn std::any::Any;\n}\n\nmacro_rules! _routed {\n ($t:ty) => {\n impl _Routed for $t {\n fn state(&self) -> String { self.state.clone() }\n fn entity_json(&self) -> serde_json::Value { serde_json::to_value(&self.entity).unwrap_or(serde_json::Value::Null) }\n fn emitted_len(&self) -> usize { self.emitted.len() }\n fn emitted_from(&self, n: usize) -> Vec<(String, serde_json::Value, bool)> {\n self.emitted[n..].iter().map(|(e, p)| (e.clone(), p.clone().unwrap_or_else(|| serde_json::json!({})), false)).collect()\n }\n fn as_any(&mut self) -> &mut dyn std::any::Any { self }\n }\n };\n}\n\nfn _decode<T: serde::de::DeserializeOwned>(payload: &serde_json::Value) -> T {\n serde_json::from_value(payload.clone()).expect(\"a payload of the declared shape\")\n}\n\ntype _Guard = fn(&serde_json::Value) -> bool;\ntype _Map = fn(&serde_json::Value) -> serde_json::Value;\n\nstruct _Item {\n target: String,\n event: String,\n payload: serde_json::Value,\n source: serde_json::Value,\n guard: Option<_Guard>,\n fans: bool,\n completion: bool,\n}\n\n#[derive(Default)]\npub struct _Router {\n traits: Vec<(String, Box<dyn _Routed>)>,\n pub handles: std::collections::HashMap<String, std::collections::BTreeMap<String, Vec<String>>>,\n rows: Vec<(String, String, String, String, Option<_Guard>, Option<_Map>)>,\n pub log: Vec<(String, String, serde_json::Value)>,\n}\n\nimpl _Router {\n fn add(&mut self, key: String, trait_: Box<dyn _Routed>) {\n self.traits.push((key, trait_));\n }\n\n fn row(&mut self, source: String, event: String, target: String, trigger: String, guard: Option<_Guard>, mapping: Option<_Map>) {\n self.rows.push((source, event, target, trigger, guard, mapping));\n }\n\n fn find(&mut self, key: &str) -> Option<&mut Box<dyn _Routed>> {\n self.traits.iter_mut().find(|(k, _)| k == key).map(|(_, t)| t)\n }\n\n pub fn entity_of(&mut self, key: &str) -> serde_json::Value {\n self.find(key).map_or(serde_json::Value::Null, |t| t.entity_json())\n }\n\n fn get<T: 'static>(&mut self, key: &str) -> Option<&mut T> {\n self.find(key).and_then(|t| t.as_any().downcast_mut::<T>())\n }\n\n fn targets(&self, source: &str, event: &str, payload: &serde_json::Value, completion: bool) -> Vec<_Item> {\n self.rows\n .iter()\n .filter(|(s, e, ..)| s == source && e == event)\n .map(|(_, _, target, trigger, guard, mapping)| _Item {\n target: target.clone(),\n event: trigger.clone(),\n payload: mapping.map_or_else(|| payload.clone(), |m| m(payload)),\n source: payload.clone(),\n guard: *guard,\n fans: false,\n completion,\n })\n .collect()\n }\n}\n\ntrait _Program {\n fn router(&mut self) -> &mut _Router;\n fn deliver(&mut self, target: &str, event: &str, payload: &serde_json::Value);\n}\n\nfn _dispatch<P: _Program>(program: &mut P, trait_: &str, event: &str, payload: serde_json::Value) {\n let mut queue = std::collections::VecDeque::from(vec![_Item {\n target: trait_.to_string(),\n event: event.to_string(),\n payload: payload.clone(),\n source: payload,\n guard: None,\n fans: true,\n completion: false,\n }]);\n let mut seen = std::collections::HashSet::new();\n let mut steps = 0;\n while let Some(item) = queue.pop_front() {\n let Some((state, entity)) = program.router().find(&item.target).map(|t| (t.state(), t.entity_json())) else { continue };\n let key = serde_json::json!([item.target, item.event, state, item.payload, entity]).to_string();\n if !item.completion && seen.contains(&key) {\n continue;\n }\n if let Some(guard) = item.guard {\n if !guard(&item.source) {\n continue;\n }\n }\n if steps >= 2000 {\n break;\n }\n steps += 1;\n seen.insert(key);\n let n = program.router().find(&item.target).map_or(0, |t| t.emitted_len());\n program.deliver(&item.target, &item.event, &item.payload);\n let router = program.router();\n let mut fanned = if item.fans { router.targets(&item.target, &item.event, &item.payload, false) } else { Vec::new() };\n let (new_state, emits) = router.find(&item.target).map_or((String::new(), Vec::new()), |t| (t.state(), t.emitted_from(n)));\n let mut own = Vec::new();\n for (ev, out, completion) in emits {\n router.log.push((item.target.clone(), ev.clone(), out.clone()));\n if router.handles.get(&item.target).and_then(|h| h.get(&new_state)).is_some_and(|evs| evs.contains(&ev)) {\n own.push(_Item { target: item.target.clone(), event: ev.clone(), payload: out.clone(), source: out.clone(), guard: None, fans: false, completion });\n }\n fanned.extend(router.targets(&item.target, &ev, &out, completion));\n }\n for x in own.into_iter().rev() {\n queue.push_front(x);\n }\n queue.extend(fanned);\n }\n}"], "/": ["fn _div(a: f64, b: f64) -> Option<f64> { if b == 0.0 { None } else { Some(a / b) } }"], "%": ["fn _mod(a: f64, b: f64) -> Option<f64> { if b == 0.0 { None } else { Some(a % b) } }"], "math/mod": ["fn _mod(a: f64, b: f64) -> Option<f64> { if b == 0.0 { None } else { Some(a % b) } }"], "default": ["trait _OrDefault<T> { fn _or_default(self, d: T) -> T; }\nimpl<T> _OrDefault<T> for Option<T> { fn _or_default(self, d: T) -> T { self.unwrap_or(d) } }\nimpl<T> _OrDefault<T> for T { fn _or_default(self, _d: T) -> T { self } }\nfn _default<T, V: _OrDefault<T>>(v: V, d: T) -> T { v._or_default(d) }"], "str/concat": ["fn _num_text(x: f64) -> String {\n if x.is_nan() { return \"NaN\".to_string(); }\n if x.is_infinite() { return (if x > 0.0 { \"Infinity\" } else { \"-Infinity\" }).to_string(); }\n if x == 0.0 { return \"0\".to_string(); }\n let a = x.abs();\n if a >= 1e21 || a < 1e-6 {\n let s = format!(\"{:e}\", x);\n return match s.split_once('e') {\n Some((m, e)) => if e.starts_with('-') { format!(\"{}e{}\", m, e) } else { format!(\"{}e+{}\", m, e) },\n None => s,\n };\n }\n format!(\"{}\", x)\n}", "trait _Text { fn _text(&self) -> String; }\nimpl _Text for String { fn _text(&self) -> String { self.clone() } }\nimpl _Text for bool { fn _text(&self) -> String { (if *self { \"true\" } else { \"false\" }).to_string() } }\nimpl _Text for f64 { fn _text(&self) -> String { _num_text(*self) } }", "macro_rules! _concat {\n ($($x:expr),+ $(,)?) => {{\n let mut s_ = String::new();\n $( s_.push_str(&_Text::_text(&$x)); )+\n s_\n }};\n}"], "str/join": ["fn _num_text(x: f64) -> String {\n if x.is_nan() { return \"NaN\".to_string(); }\n if x.is_infinite() { return (if x > 0.0 { \"Infinity\" } else { \"-Infinity\" }).to_string(); }\n if x == 0.0 { return \"0\".to_string(); }\n let a = x.abs();\n if a >= 1e21 || a < 1e-6 {\n let s = format!(\"{:e}\", x);\n return match s.split_once('e') {\n Some((m, e)) => if e.starts_with('-') { format!(\"{}e{}\", m, e) } else { format!(\"{}e+{}\", m, e) },\n None => s,\n };\n }\n format!(\"{}\", x)\n}", "trait _Text { fn _text(&self) -> String; }\nimpl _Text for String { fn _text(&self) -> String { self.clone() } }\nimpl _Text for bool { fn _text(&self) -> String { (if *self { \"true\" } else { \"false\" }).to_string() } }\nimpl _Text for f64 { fn _text(&self) -> String { _num_text(*self) } }", "fn _join<T: _Text>(a: &[T], d: &str) -> String { a.iter().map(|x| x._text()).collect::<Vec<_>>().join(d) }"], "str/split": ["fn _split(s: &str, d: &str) -> Vec<String> {\n if d.is_empty() { s.chars().map(|c| c.to_string()).collect() } else { s.split(d).map(|p| p.to_string()).collect() }\n}"], "str/slice": ["fn _whole(x: f64) -> i64 {\n if !x.is_finite() || x != x.trunc() { panic!(\"expected a whole number, got {}\", x); }\n x as i64\n}", "fn _str_slice(s: &str, a: f64, b: Option<f64>) -> String {\n let c: Vec<char> = s.chars().collect();\n let n = c.len() as i64;\n let norm = |i: i64| -> i64 { if i < 0 { (n + i).max(0) } else { i.min(n) } };\n let st = norm(_whole(a));\n let en = match b { Some(v) => norm(_whole(v)), None => n };\n if en <= st { String::new() } else { c[st as usize..en as usize].iter().collect() }\n}"], "str/padStart": ["fn _whole(x: f64) -> i64 {\n if !x.is_finite() || x != x.trunc() { panic!(\"expected a whole number, got {}\", x); }\n x as i64\n}", "fn _pad_start(s: &str, n: f64, p: &str) -> String {\n if p.chars().count() != 1 { panic!(\"expected a single padding character, got {:?}\", p); }\n let w = _whole(n);\n let len = s.chars().count() as i64;\n if w <= len { return s.to_string(); }\n let pad: String = std::iter::repeat(p).take((w - len) as usize).collect();\n format!(\"{}{}\", pad, s)\n}"], "str/padEnd": ["fn _whole(x: f64) -> i64 {\n if !x.is_finite() || x != x.trunc() { panic!(\"expected a whole number, got {}\", x); }\n x as i64\n}", "fn _pad_end(s: &str, n: f64, p: &str) -> String {\n if p.chars().count() != 1 { panic!(\"expected a single padding character, got {:?}\", p); }\n let w = _whole(n);\n let len = s.chars().count() as i64;\n if w <= len { return s.to_string(); }\n let pad: String = std::iter::repeat(p).take((w - len) as usize).collect();\n format!(\"{}{}\", s, pad)\n}"], "str/truncate": ["fn _whole(x: f64) -> i64 {\n if !x.is_finite() || x != x.trunc() { panic!(\"expected a whole number, got {}\", x); }\n x as i64\n}", "fn _truncate(s: &str, n: f64, suffix: &str) -> String {\n let w = _whole(n);\n if (s.chars().count() as i64) <= w { return s.to_string(); }\n let head: String = s.chars().take(w.max(0) as usize).collect();\n format!(\"{}{}\", head, suffix)\n}"], "str/repeat": ["fn _count(x: f64) -> usize {\n if !x.is_finite() || x != x.trunc() || x < 0.0 { panic!(\"count is not a whole number from 0\"); }\n x as usize\n}", "fn _repeat(s: &str, n: f64) -> String { s.repeat(_count(n)) }"], "str/capitalize": ["fn _capitalize(s: &str) -> String {\n let mut c = s.chars();\n match c.next() {\n Some(f) => f.to_uppercase().collect::<String>() + &c.as_str().to_lowercase(),\n None => String::new(),\n }\n}"], "str/to-int": ["fn _to_int(s: &str) -> Option<f64> { s.parse::<i64>().ok().map(|v| v as f64) }"], "array/sum": ["fn _sum(a: &[f64]) -> f64 { a.iter().fold(0.0_f64, |s, x| s + x) }"], "array/avg": ["fn _avg(a: &[f64]) -> Option<f64> { if a.is_empty() { None } else { Some(a.iter().fold(0.0_f64, |s, x| s + x) / a.len() as f64) } }"], "array/max": ["fn _amax(a: &[f64]) -> Option<f64> { a.iter().cloned().fold(None, |m, x| Some(match m { Some(y) => if x > y { x } else { y }, None => x })) }"], "array/min": ["fn _amin(a: &[f64]) -> Option<f64> { a.iter().cloned().fold(None, |m, x| Some(match m { Some(y) => if x < y { x } else { y }, None => x })) }"], "array/first": ["fn _first<T: Clone>(a: &[T]) -> Option<T> { a.first().cloned() }"], "array/last": ["fn _last<T: Clone>(a: &[T]) -> Option<T> { a.last().cloned() }"], "array/nth": ["fn _nth<T: Clone>(a: &[T], i: f64) -> Option<T> {\n if !i.is_finite() || i != i.trunc() || i < 0.0 { panic!(\"nth: index {} is not a whole number from 0\", i); }\n a.get(i as usize).cloned()\n}"], "array/range": ["fn _range(a: f64, b: f64, step: f64) -> Vec<f64> {\n if step == 0.0 || !step.is_finite() { panic!(\"range: step 0 must be a non-zero finite number\"); }\n let mut out = Vec::new();\n let mut x = a;\n while if step > 0.0 { x < b } else { x > b } { out.push(x); x += step; }\n out\n}"], "array/slice": ["fn _whole(x: f64) -> i64 {\n if !x.is_finite() || x != x.trunc() { panic!(\"expected a whole number, got {}\", x); }\n x as i64\n}", "fn _slice<T: Clone>(a: &[T], s: f64, e: Option<f64>) -> Vec<T> {\n let st = _whole(s);\n let en = e.map(_whole);\n if st < 0 || en.map_or(false, |v| v < 0) { panic!(\"slice: not a whole number from 0\"); }\n let st = (st as usize).min(a.len());\n let en = en.map_or(a.len(), |v| (v as usize).min(a.len()));\n if en <= st { Vec::new() } else { a[st..en].to_vec() }\n}"], "array/take": ["fn _count(x: f64) -> usize {\n if !x.is_finite() || x != x.trunc() || x < 0.0 { panic!(\"count is not a whole number from 0\"); }\n x as usize\n}", "fn _take<T: Clone>(a: &[T], n: f64) -> Vec<T> { a.iter().take(_count(n)).cloned().collect() }"], "array/drop": ["fn _count(x: f64) -> usize {\n if !x.is_finite() || x != x.trunc() || x < 0.0 { panic!(\"count is not a whole number from 0\"); }\n x as usize\n}", "fn _drop<T: Clone>(a: &[T], n: f64) -> Vec<T> { a.iter().skip(_count(n)).cloned().collect() }"], "array/takeLast": ["fn _count(x: f64) -> usize {\n if !x.is_finite() || x != x.trunc() || x < 0.0 { panic!(\"count is not a whole number from 0\"); }\n x as usize\n}", "fn _take_last<T: Clone>(a: &[T], n: f64) -> Vec<T> { let k = _count(n).min(a.len()); a[a.len() - k..].to_vec() }"], "array/dropLast": ["fn _count(x: f64) -> usize {\n if !x.is_finite() || x != x.trunc() || x < 0.0 { panic!(\"count is not a whole number from 0\"); }\n x as usize\n}", "fn _drop_last<T: Clone>(a: &[T], n: f64) -> Vec<T> { let k = _count(n).min(a.len()); a[..a.len() - k].to_vec() }"], "array/append": ["fn _append<T: Clone>(a: &[T], x: T) -> Vec<T> { let mut v = a.to_vec(); v.push(x); v }"], "array/prepend": ["fn _prepend<T: Clone>(a: &[T], x: T) -> Vec<T> { let mut v = vec![x]; v.extend(a.iter().cloned()); v }"], "array/indexOf": ["fn _index_of<T: PartialEq>(a: &[T], x: &T) -> f64 { a.iter().position(|y| y == x).map_or(-1.0, |i| i as f64) }"], "array/unique": ["fn _unique<T: Clone + PartialEq>(a: &[T]) -> Vec<T> {\n let mut out: Vec<T> = Vec::new();\n for x in a { if !out.contains(x) { out.push(x.clone()); } }\n out\n}"], "array/flatten": ["fn _flatten<T: Clone>(a: &[Vec<T>]) -> Vec<T> { a.iter().flat_map(|v| v.iter().cloned()).collect() }"], "array/zip": ["fn _zip<T: Clone>(a: &[T], b: &[T]) -> Vec<Vec<T>> { a.iter().cloned().zip(b.iter().cloned()).map(|(x, y)| vec![x, y]).collect() }"], "array/concat": ["macro_rules! _vconcat {\n ($($x:expr),+ $(,)?) => {{\n let mut v_ = Vec::new();\n $( v_.extend($x.iter().cloned()); )+\n v_\n }};\n}"], "array/sort": ["fn _sort<T: Clone + PartialOrd>(a: &[T]) -> Vec<T> {\n let mut v = a.to_vec();\n v.sort_by(|x, y| x.partial_cmp(y).unwrap_or(std::cmp::Ordering::Equal));\n v\n}"], "array/reduce": ["fn _reduce<T: Clone, A>(a: &[T], init: A, f: impl Fn(A, T) -> A) -> A { a.iter().cloned().fold(init, f) }"], "math/round": ["fn _round(x: f64, d: f64) -> f64 {\n let m = 10.0_f64.powf(d);\n let r = (x.abs() * m + 0.5).floor() / m;\n if x < 0.0 { -r } else { r }\n}"], "math/acos": ["fn _acos(x: f64) -> Option<f64> { if (-1.0..=1.0).contains(&x) { Some(x.acos()) } else { None } }"], "math/asin": ["fn _asin(x: f64) -> Option<f64> { if (-1.0..=1.0).contains(&x) { Some(x.asin()) } else { None } }"], "math/approach": ["fn _approach(c: f64, t: f64, d: f64) -> f64 { if (t - c).abs() <= d { t } else { c + (t - c).signum() * d } }"], "math/map": ["fn _map(v: f64, a: f64, b: f64, c: f64, d: f64) -> f64 { if b == a { c } else { c + (v - a) / (b - a) * (d - c) } }"], "math/wrap": ["fn _wrap(v: f64, lo: f64, hi: f64) -> f64 {\n let r = hi - lo;\n if r <= 0.0 { lo } else { ((v - lo) % r + r) % r + lo }\n}"], "array/insert": ["fn _whole(x: f64) -> i64 {\n if !x.is_finite() || x != x.trunc() { panic!(\"expected a whole number, got {}\", x); }\n x as i64\n}", "fn _insert<T: Clone>(a: &[T], i: f64, x: T) -> Vec<T> {\n let k = _whole(i);\n if k < 0 || k as usize > a.len() { panic!(\"insert: index {} is not within a {}-item array\", k, a.len()); }\n let mut v = a.to_vec();\n v.insert(k as usize, x);\n v\n}"], "array/remove": ["fn _whole(x: f64) -> i64 {\n if !x.is_finite() || x != x.trunc() { panic!(\"expected a whole number, got {}\", x); }\n x as i64\n}", "fn _remove<T: Clone>(a: &[T], i: f64) -> Vec<T> {\n let k = _whole(i);\n if k < 0 || k as usize >= a.len() { panic!(\"remove: index {} is outside a {}-item array\", k, a.len()); }\n let mut v = a.to_vec();\n v.remove(k as usize);\n v\n}"], "array/removeItem": ["fn _remove_item<T: Clone + PartialEq>(a: &[T], x: &T) -> Vec<T> {\n let mut v = a.to_vec();\n if let Some(p) = v.iter().position(|y| y == x) { v.remove(p); }\n v\n}"], "math/sqrt": ["fn _sqrt(x: f64) -> Option<f64> { if x < 0.0 { None } else { Some(x.sqrt()) } }"], "math/ln": ["fn _ln(x: f64) -> Option<f64> { if x <= 0.0 { None } else { Some(x.ln()) } }"], "math/log10": ["fn _log10(x: f64) -> Option<f64> { if x <= 0.0 { None } else { Some(x.log10()) } }"], "math/pow": ["fn _pow(a: f64, b: f64) -> Option<f64> { let r = a.powf(b); if r.is_finite() { Some(r) } else { None } }"], "math/sign": ["fn _sign(x: f64) -> f64 { if x > 0.0 { 1.0 } else if x < 0.0 { -1.0 } else { 0.0 } }"], "object/get": ["trait _Lookup {\n type Out;\n fn lookup(&self, k: &str) -> Self::Out;\n}\nimpl<V: Clone> _Lookup for std::collections::BTreeMap<String, V> {\n type Out = Option<V>;\n fn lookup(&self, k: &str) -> Option<V> { self.get(k).cloned() }\n}\nimpl _Lookup for serde_json::Map<String, serde_json::Value> {\n type Out = _Json;\n fn lookup(&self, k: &str) -> _Json { _Json(self.get(k).cloned().filter(|v| !v.is_null())) }\n}\nimpl<T: _Lookup + ?Sized> _Lookup for &T {\n type Out = T::Out;\n fn lookup(&self, k: &str) -> T::Out { (**self).lookup(k) }\n}\n#[derive(Clone, Debug)]\nstruct _Json(Option<serde_json::Value>);\nimpl PartialEq<String> for _Json {\n fn eq(&self, o: &String) -> bool { self.0.as_ref().and_then(|v| v.as_str()) == Some(o.as_str()) }\n}\nimpl PartialEq<f64> for _Json {\n fn eq(&self, o: &f64) -> bool { self.0.as_ref().and_then(|v| v.as_f64()) == Some(*o) }\n}\nimpl PartialEq<bool> for _Json {\n fn eq(&self, o: &bool) -> bool { self.0.as_ref().and_then(|v| v.as_bool()) == Some(*o) }\n}\nfn _get<M: _Lookup>(m: &M, k: &str) -> M::Out { m.lookup(k) }"], "object/merge": ["fn _merge<V: Clone>(a: &std::collections::BTreeMap<String, V>, b: &std::collections::BTreeMap<String, V>) -> std::collections::BTreeMap<String, V> {\n let mut m = a.clone();\n for (k, v) in b { m.insert(k.clone(), v.clone()); }\n m\n}"], "object/pick": ["fn _pick<V: Clone>(m: &std::collections::BTreeMap<String, V>, ks: &[String]) -> std::collections::BTreeMap<String, V> {\n m.iter().filter(|(k, _)| ks.contains(k)).map(|(k, v)| (k.clone(), v.clone())).collect()\n}"], "object/omit": ["fn _omit<V: Clone>(m: &std::collections::BTreeMap<String, V>, ks: &[String]) -> std::collections::BTreeMap<String, V> {\n m.iter().filter(|(k, _)| !ks.contains(k)).map(|(k, v)| (k.clone(), v.clone())).collect()\n}"], "unsupported": ["#[derive(Clone)]\nstruct _U;\nfn _unsupported(op: &str) -> _U { panic!(\"no native template for operator {}\", op) }\nimpl From<_U> for f64 { fn from(_: _U) -> Self { panic!(\"unsupported\") } }\nimpl From<_U> for String { fn from(_: _U) -> Self { panic!(\"unsupported\") } }\nimpl From<_U> for bool { fn from(_: _U) -> Self { panic!(\"unsupported\") } }\nimpl From<_U> for Option<f64> { fn from(_: _U) -> Self { panic!(\"unsupported\") } }\nimpl From<_U> for Option<String> { fn from(_: _U) -> Self { panic!(\"unsupported\") } }\nimpl From<_U> for Option<bool> { fn from(_: _U) -> Self { panic!(\"unsupported\") } }\nimpl<T> From<_U> for Vec<T> { fn from(_: _U) -> Self { panic!(\"unsupported\") } }\nimpl<T> From<_U> for Option<Vec<T>> { fn from(_: _U) -> Self { panic!(\"unsupported\") } }\nimpl<K: Ord, V> From<_U> for std::collections::BTreeMap<K, V> { fn from(_: _U) -> Self { panic!(\"unsupported\") } }\nimpl<K: Ord, V> From<_U> for Option<std::collections::BTreeMap<K, V>> { fn from(_: _U) -> Self { panic!(\"unsupported\") } }"] }
|
|
33
33
|
helperGap: "\n"
|
|
34
34
|
portEffects: ["persist", "fetch", "fetch-stream", "notify", "navigate", "navigate-back", "call-service", "cancel-call", "send-server", "spawn", "despawn", "log"]
|
|
35
35
|
portCall: "(self.ports)(\"{{name}}\", serde_json::json!([{{*}}]))"
|
|
@@ -82,14 +82,39 @@ orbital LoloRustOrbital {
|
|
|
82
82
|
enumForm: "{{enum}}::{{member}}"
|
|
83
83
|
enumMemberCase: "split-pascal"
|
|
84
84
|
fieldNames: { "type": "type_" }
|
|
85
|
+
programOpen: ["pub struct Program {", "{{i}}pub router: _Router,", "}", "", "impl Program {", "{{i}}pub fn new(entities: ({{entities}},){{store}}) -> Self {", "{{i}}{{i}}let mut router = _Router::default();"]
|
|
86
|
+
programEntity: "{{entity}}"
|
|
87
|
+
programEntitySep: ", "
|
|
88
|
+
programTrait: "{{i}}{{i}}_routed!({{class}}); router.add({{key}}, Box::new({{class}}::new(entities.{{n}})));"
|
|
89
|
+
programHandles: "{{i}}{{i}}router.handles.insert({{key}}, {{table}});"
|
|
90
|
+
programRow: "{{i}}{{i}}router.row({{source}}, {{event}}, {{target}}, {{trigger}}, {{guard}}, {{map}});"
|
|
91
|
+
deliverOpen: ["{{i}}{{i}}Program { router }", "{{i}}}", "", "{{i}}pub fn dispatch(&mut self, trait_: &str, event: &str, payload: serde_json::Value) {", "{{i}}{{i}}_dispatch(self, trait_, event, payload)", "{{i}}}", "}", "", "impl _Program for Program {", "{{i}}fn router(&mut self) -> &mut _Router {", "{{i}}{{i}}&mut self.router", "{{i}}}", "", "{{i}}fn deliver(&mut self, target: &str, event: &str, payload: &serde_json::Value) {"]
|
|
92
|
+
deliverCase: "{{i}}{{i}}if target == {{target}} && event == {{event}} { if let Some(t) = self.router.get::<{{class}}>(target) { t.{{method}}({{arg}}); } return; }"
|
|
93
|
+
deliverCasePlain: "{{i}}{{i}}if target == {{target}} && event == {{event}} { if let Some(t) = self.router.get::<{{class}}>(target) { t.{{method}}(); } return; }"
|
|
94
|
+
deliverClose: ["{{i}}}", "}"]
|
|
95
|
+
programClose: []
|
|
96
|
+
payloadDecode: "&_decode::<{{type}}>({{value}})"
|
|
97
|
+
guardForm: ["", "fn {{name}}(payload_json: &serde_json::Value) -> bool {", "{{i}}let payload = {{decode}};", "{{i}}{{expr}}", "}"]
|
|
98
|
+
mapForm: ["", "fn {{name}}(payload_json: &serde_json::Value) -> serde_json::Value {", "{{i}}let payload = {{decode}};", "{{i}}serde_json::to_value({{expr}}).expect(\"a mapped payload\")", "}"]
|
|
99
|
+
guardName: "_guard_{{n}}"
|
|
100
|
+
mapName: "_map_{{n}}"
|
|
101
|
+
guardRef: "Some({{name}})"
|
|
102
|
+
mapRef: "Some({{name}})"
|
|
85
103
|
modelImportEach: true
|
|
86
104
|
fileHeader: "#![allow(dead_code, unused_macros, unused_parens, unused_variables)]"
|
|
87
105
|
sectionGap: "\n\n"
|
|
88
106
|
classOpen: "macro_rules! _list {\n ($($x:expr),* $(,)?) => { vec![$(($x).clone()),*] };\n}\n\npub struct {{class}} {"
|
|
89
107
|
classClose: "}"
|
|
90
108
|
classEmpty: ""
|
|
91
|
-
constructor: ["{{i}}pub state: String,", "{{i}}pub entity: {{entity}},", "{{i}}pub config: {{configType}},", "{{i}}pub ports: Box<dyn FnMut(&str, serde_json::Value)>,", "{{i}}pub emitted: Vec<(String, Option<serde_json::Value>)>,", "}", "", "impl {{class}} {", "{{i}}pub fn new(entity: {{entity}}) -> Self {", "{{i}}{{i}}Self { state: {{initial}}, entity, config: {{configType}}::default(), ports: Box::new(|_, _| {}), emitted: Vec::new() }", "{{noConfig}}{{i}}{{i}}Self { state: {{initial}}, entity, ports: Box::new(|_, _| {}), emitted: Vec::new() }", "{{i}}}", "", "{{i}}pub fn with_config(mut self, config: {{configType}}) -> Self {", "{{withConfig}}{{i}}{{i}}self.config = config;", "{{withConfig}}{{i}}{{i}}self", "{{withConfig}}{{i}}}", "{{withConfig}}", "{{i}}pub fn with_ports(mut self, ports: impl FnMut(&str, serde_json::Value) + 'static) -> Self {", "{{i}}{{i}}self.ports = Box::new(ports);", "{{i}}{{i}}self", "{{i}}}"]
|
|
109
|
+
constructor: ["{{i}}pub state: String,", "{{i}}pub entity: {{entity}},", "{{i}}pub config: {{configType}},", "{{i}}pub ports: Box<dyn FnMut(&str, serde_json::Value)>,", "{{i}}pub emitted: Vec<(String, Option<serde_json::Value>)>,", "{{withStore}}{{i}}pub store: Option<std::rc::Rc<std::cell::RefCell<dyn Store>>>,", "{{withStore}}{{i}}pub completed: Vec<usize>,", "}", "", "impl {{class}} {", "{{i}}pub fn new(entity: {{entity}}) -> Self {", "{{noStore}}{{i}}{{i}}Self { state: {{initial}}, entity, config: {{configType}}::default(), ports: Box::new(|_, _| {}), emitted: Vec::new() }", "{{noStore}}{{noConfig}}{{i}}{{i}}Self { state: {{initial}}, entity, ports: Box::new(|_, _| {}), emitted: Vec::new() }", "{{withStore}}{{i}}{{i}}Self { state: {{initial}}, entity, config: {{configType}}::default(), ports: Box::new(|_, _| {}), emitted: Vec::new(), store: None, completed: Vec::new() }", "{{withStore}}{{noConfig}}{{i}}{{i}}Self { state: {{initial}}, entity, ports: Box::new(|_, _| {}), emitted: Vec::new(), store: None, completed: Vec::new() }", "{{i}}}", "", "{{i}}pub fn with_config(mut self, config: {{configType}}) -> Self {", "{{withConfig}}{{i}}{{i}}self.config = config;", "{{withConfig}}{{i}}{{i}}self", "{{withConfig}}{{i}}}", "{{withConfig}}", "{{i}}pub fn with_ports(mut self, ports: impl FnMut(&str, serde_json::Value) + 'static) -> Self {", "{{i}}{{i}}self.ports = Box::new(ports);", "{{i}}{{i}}self", "{{i}}}"]
|
|
92
110
|
emitMethod: ["{{i}}fn emit(&mut self, event: String, payload: Option<serde_json::Value>) {", "{{i}}{{i}}self.emitted.push((event, payload));", "{{i}}}"]
|
|
111
|
+
completeMethod: ["", "{{i}}fn complete(&mut self, answer: (bool, serde_json::Value), success: Option<String>, failure: Option<String>) {", "{{i}}{{i}}let (ok, payload) = answer;", "{{i}}{{i}}if let Some(route) = if ok { success } else { failure } {", "{{i}}{{i}}{{i}}self.completed.push(self.emitted.len());", "{{i}}{{i}}{{i}}self.emitted.push((route, Some(payload)));", "{{i}}{{i}}}", "{{i}}}", "", "{{i}}fn use_store(&self) -> std::rc::Rc<std::cell::RefCell<dyn Store>> {", "{{i}}{{i}}self.store.clone().expect(\"no store\")", "{{i}}}"]
|
|
112
|
+
routedEffects: {"persist": "self.complete(self.use_store().borrow_mut().persist(&{{0}}, &{{1}}, serde_json::to_value(&{{2}}).expect(\"a row\")), {{success}}, {{failure}})", "fetch": "self.complete(self.use_store().borrow_mut().fetch(&{{entity}}, {{filter}}), {{success}}, {{failure}})"}
|
|
113
|
+
fetchAll: "None"
|
|
114
|
+
routeForm: "Some({{route}})"
|
|
115
|
+
filterForm: "Some(&({{lambda}}))"
|
|
116
|
+
programStoreParam: ", store: std::rc::Rc<std::cell::RefCell<dyn Store>>"
|
|
117
|
+
programTraitStore: "{{i}}{{i}}_routed_store!({{class}}); let mut t{{n}} = {{class}}::new(entities.{{n}}); t{{n}}.store = Some(store.clone()); router.add({{key}}, Box::new(t{{n}}));"
|
|
93
118
|
methodOpen: "{{i}}pub fn {{method}}(&mut self, payload: &{{payloadType}}) {"
|
|
94
119
|
methodOpenPlain: "{{i}}pub fn {{method}}(&mut self) {"
|
|
95
120
|
methodClose: "{{i}}}"
|