@voxgig/sdkgen 2.0.2 → 3.0.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/bin/voxgig-sdkgen +22 -2
- package/dist/action/doctor.d.ts +14 -0
- package/dist/action/doctor.js +296 -0
- package/dist/action/doctor.js.map +1 -0
- package/dist/action/feature.js +48 -9
- package/dist/action/feature.js.map +1 -1
- package/dist/action/target.d.ts +6 -1
- package/dist/action/target.js +134 -22
- package/dist/action/target.js.map +1 -1
- package/dist/cmp/Entity.js +5 -0
- package/dist/cmp/Entity.js.map +1 -1
- package/dist/cmp/Feature.js +2 -1
- package/dist/cmp/Feature.js.map +1 -1
- package/dist/cmp/Main.js +5 -1
- package/dist/cmp/Main.js.map +1 -1
- package/dist/cmp/ReadmeExplanation.js +1 -1
- package/dist/cmp/ReadmeExplanation.js.map +1 -1
- package/dist/cmp/ReadmeTop.js +16 -6
- package/dist/cmp/ReadmeTop.js.map +1 -1
- package/dist/cmp/Registered.d.ts +7 -0
- package/dist/cmp/Registered.js +70 -0
- package/dist/cmp/Registered.js.map +1 -0
- package/dist/cmp/Test.js +3 -1
- package/dist/cmp/Test.js.map +1 -1
- package/dist/helpers/dryrun.d.ts +10 -0
- package/dist/helpers/dryrun.js +35 -0
- package/dist/helpers/dryrun.js.map +1 -0
- package/dist/helpers/featureSource.d.ts +13 -0
- package/dist/helpers/featureSource.js +156 -0
- package/dist/helpers/featureSource.js.map +1 -0
- package/dist/helpers/naming.d.ts +9 -1
- package/dist/helpers/naming.js +66 -2
- package/dist/helpers/naming.js.map +1 -1
- package/dist/helpers/opExample.js +23 -3
- package/dist/helpers/opExample.js.map +1 -1
- package/dist/helpers/opShape.d.ts +11 -1
- package/dist/helpers/opShape.js +51 -0
- package/dist/helpers/opShape.js.map +1 -1
- package/dist/helpers/packageMeta.d.ts +8 -1
- package/dist/helpers/packageMeta.js +141 -10
- package/dist/helpers/packageMeta.js.map +1 -1
- package/dist/helpers/stdrep.d.ts +3 -0
- package/dist/helpers/stdrep.js +47 -0
- package/dist/helpers/stdrep.js.map +1 -0
- package/dist/helpers/testPolicy.d.ts +2 -0
- package/dist/helpers/testPolicy.js +46 -0
- package/dist/helpers/testPolicy.js.map +1 -0
- package/dist/sdkgen.d.ts +15 -6
- package/dist/sdkgen.js +45 -4
- package/dist/sdkgen.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/model/sdkgen.aontu +125 -0
- package/package.json +5 -3
- package/project/.sdk/model/target/c.aontu +28 -3
- package/project/.sdk/model/target/clojure.aontu +24 -3
- package/project/.sdk/model/target/cpp.aontu +25 -3
- package/project/.sdk/model/target/csharp.aontu +25 -3
- package/project/.sdk/model/target/dart.aontu +15 -3
- package/project/.sdk/model/target/elixir.aontu +15 -3
- package/project/.sdk/model/target/go-cli.aontu +17 -1
- package/project/.sdk/model/target/go-mcp.aontu +17 -1
- package/project/.sdk/model/target/go.aontu +14 -4
- package/project/.sdk/model/target/haskell.aontu +24 -3
- package/project/.sdk/model/target/java.aontu +26 -3
- package/project/.sdk/model/target/js.aontu +15 -3
- package/project/.sdk/model/target/kotlin.aontu +26 -3
- package/project/.sdk/model/target/lean.aontu +25 -3
- package/project/.sdk/model/target/lua.aontu +15 -3
- package/project/.sdk/model/target/ocaml.aontu +24 -3
- package/project/.sdk/model/target/perl.aontu +15 -3
- package/project/.sdk/model/target/php.aontu +15 -3
- package/project/.sdk/model/target/py-data.aontu +16 -3
- package/project/.sdk/model/target/py.aontu +15 -3
- package/project/.sdk/model/target/rb.aontu +15 -3
- package/project/.sdk/model/target/rust.aontu +25 -3
- package/project/.sdk/model/target/scala.aontu +25 -3
- package/project/.sdk/model/target/swift.aontu +25 -3
- package/project/.sdk/model/target/ts.aontu +15 -3
- package/project/.sdk/model/target/zig.aontu +26 -3
- package/project/.sdk/src/cmp/c/Config_c.ts +10 -11
- package/project/.sdk/src/cmp/c/Entity_c.ts +5 -1
- package/project/.sdk/src/cmp/c/fragment/Entity.fragment.c +23 -5
- package/project/.sdk/src/cmp/c/fragment/EntityCreateOp.fragment.c +9 -2
- package/project/.sdk/src/cmp/c/fragment/EntityListOp.fragment.c +19 -2
- package/project/.sdk/src/cmp/c/fragment/EntityLoadOp.fragment.c +9 -2
- package/project/.sdk/src/cmp/c/fragment/EntityRemoveOp.fragment.c +12 -2
- package/project/.sdk/src/cmp/c/fragment/EntityUpdateOp.fragment.c +9 -2
- package/project/.sdk/src/cmp/c/fragment/Main.fragment.c +1 -0
- package/project/.sdk/src/cmp/clojure/TestEntity_clojure.ts +6 -3
- package/project/.sdk/src/cmp/clojure/fragment/Entity.fragment.clj +18 -1
- package/project/.sdk/src/cmp/clojure/fragment/EntityCreateOp.fragment.clj +2 -2
- package/project/.sdk/src/cmp/clojure/fragment/EntityLoadOp.fragment.clj +2 -2
- package/project/.sdk/src/cmp/clojure/fragment/EntityRemoveOp.fragment.clj +12 -8
- package/project/.sdk/src/cmp/clojure/fragment/EntityUpdateOp.fragment.clj +2 -2
- package/project/.sdk/src/cmp/cpp/Entity_cpp.ts +5 -1
- package/project/.sdk/src/cmp/cpp/TestEntity_cpp.ts +12 -9
- package/project/.sdk/src/cmp/cpp/fragment/EntityCreateOp.fragment.cpp +8 -2
- package/project/.sdk/src/cmp/cpp/fragment/EntityListOp.fragment.cpp +18 -2
- package/project/.sdk/src/cmp/cpp/fragment/EntityLoadOp.fragment.cpp +8 -2
- package/project/.sdk/src/cmp/cpp/fragment/EntityRemoveOp.fragment.cpp +11 -2
- package/project/.sdk/src/cmp/cpp/fragment/EntityUpdateOp.fragment.cpp +8 -2
- package/project/.sdk/src/cmp/csharp/Package_csharp.ts +2 -1
- package/project/.sdk/src/cmp/csharp/TestDirect_csharp.ts +3 -3
- package/project/.sdk/src/cmp/csharp/TestEntity_csharp.ts +6 -6
- package/project/.sdk/src/cmp/csharp/fragment/EntityBase.fragment.cs +38 -1
- package/project/.sdk/src/cmp/csharp/fragment/Main.fragment.cs +42 -33
- package/project/.sdk/src/cmp/dart/Package_dart.ts +2 -1
- package/project/.sdk/src/cmp/dart/ReadmeEntity_dart.ts +13 -2
- package/project/.sdk/src/cmp/dart/ReadmeHowto_dart.ts +2 -1
- package/project/.sdk/src/cmp/dart/ReadmeInstall_dart.ts +3 -3
- package/project/.sdk/src/cmp/dart/ReadmeModel_dart.ts +1 -1
- package/project/.sdk/src/cmp/dart/ReadmeQuick_dart.ts +17 -6
- package/project/.sdk/src/cmp/dart/ReadmeRef_dart.ts +13 -2
- package/project/.sdk/src/cmp/dart/ReadmeTopQuick_dart.ts +13 -2
- package/project/.sdk/src/cmp/dart/TestDirect_dart.ts +3 -3
- package/project/.sdk/src/cmp/dart/TestEntity_dart.ts +8 -8
- package/project/.sdk/src/cmp/dart/fragment/EntityBase.fragment.dart +18 -1
- package/project/.sdk/src/cmp/dart/fragment/EntityCreateOp.fragment.dart +9 -1
- package/project/.sdk/src/cmp/dart/fragment/EntityLoadOp.fragment.dart +9 -1
- package/project/.sdk/src/cmp/dart/fragment/EntityRemoveOp.fragment.dart +15 -1
- package/project/.sdk/src/cmp/dart/fragment/EntityUpdateOp.fragment.dart +9 -1
- package/project/.sdk/src/cmp/dart/fragment/SdkError.fragment.dart +8 -0
- package/project/.sdk/src/cmp/elixir/Package_elixir.ts +3 -1
- package/project/.sdk/src/cmp/elixir/ReadmeInstall_elixir.ts +2 -2
- package/project/.sdk/src/cmp/elixir/TestEntity_elixir.ts +11 -2
- package/project/.sdk/src/cmp/elixir/fragment/EntityCreateOp.fragment.ex +2 -1
- package/project/.sdk/src/cmp/elixir/fragment/EntityListOp.fragment.ex +1 -0
- package/project/.sdk/src/cmp/elixir/fragment/EntityLoadOp.fragment.ex +2 -1
- package/project/.sdk/src/cmp/elixir/fragment/EntityRemoveOp.fragment.ex +4 -1
- package/project/.sdk/src/cmp/elixir/fragment/EntityUpdateOp.fragment.ex +2 -1
- package/project/.sdk/src/cmp/go/EntityTypes_go.ts +38 -8
- package/project/.sdk/src/cmp/go/Entity_go.ts +2 -2
- package/project/.sdk/src/cmp/go/Main_go.ts +4 -5
- package/project/.sdk/src/cmp/go/Package_go.ts +8 -5
- package/project/.sdk/src/cmp/go/ReadmeExplanation_go.ts +2 -2
- package/project/.sdk/src/cmp/go/ReadmeHowto_go.ts +2 -2
- package/project/.sdk/src/cmp/go/ReadmeInstall_go.ts +4 -2
- package/project/.sdk/src/cmp/go/ReadmeModel_go.ts +2 -2
- package/project/.sdk/src/cmp/go/ReadmeQuick_go.ts +2 -2
- package/project/.sdk/src/cmp/go/ReadmeTopQuick_go.ts +2 -2
- package/project/.sdk/src/cmp/go/ReadmeTopTest_go.ts +2 -2
- package/project/.sdk/src/cmp/go/TestDirect_go.ts +21 -15
- package/project/.sdk/src/cmp/go/TestEntity_go.ts +9 -9
- package/project/.sdk/src/cmp/go/Test_go.ts +2 -2
- package/project/.sdk/src/cmp/go/fragment/Entity.fragment.go +42 -1
- package/project/.sdk/src/cmp/go-cli/Main_go-cli.ts +4 -4
- package/project/.sdk/src/cmp/go-mcp/Main_go-mcp.ts +4 -4
- package/project/.sdk/src/cmp/haskell/Package_haskell.ts +2 -1
- package/project/.sdk/src/cmp/haskell/ReadmeEntity_haskell.ts +10 -5
- package/project/.sdk/src/cmp/haskell/ReadmeModel_haskell.ts +10 -8
- package/project/.sdk/src/cmp/haskell/ReadmeQuick_haskell.ts +14 -10
- package/project/.sdk/src/cmp/haskell/ReadmeRef_haskell.ts +21 -18
- package/project/.sdk/src/cmp/haskell/ReadmeTopQuick_haskell.ts +4 -4
- package/project/.sdk/src/cmp/haskell/Test_haskell.ts +23 -11
- package/project/.sdk/src/cmp/java/Package_java.ts +2 -1
- package/project/.sdk/src/cmp/java/ReadmeHowto_java.ts +2 -1
- package/project/.sdk/src/cmp/java/ReadmeInstall_java.ts +2 -2
- package/project/.sdk/src/cmp/java/ReadmeModel_java.ts +1 -1
- package/project/.sdk/src/cmp/java/ReadmeQuick_java.ts +3 -3
- package/project/.sdk/src/cmp/java/TestDirect_java.ts +3 -3
- package/project/.sdk/src/cmp/java/TestEntity_java.ts +6 -6
- package/project/.sdk/src/cmp/java/fragment/EntityBase.fragment.java +34 -1
- package/project/.sdk/src/cmp/java/fragment/SdkError.fragment.java +12 -0
- package/project/.sdk/src/cmp/js/Main_js.ts +4 -1
- package/project/.sdk/src/cmp/js/Package_js.ts +7 -1
- package/project/.sdk/src/cmp/js/ReadmeEntity_js.ts +13 -2
- package/project/.sdk/src/cmp/js/ReadmeHowto_js.ts +2 -1
- package/project/.sdk/src/cmp/js/ReadmeQuick_js.ts +13 -2
- package/project/.sdk/src/cmp/js/ReadmeTopQuick_js.ts +13 -2
- package/project/.sdk/src/cmp/js/ReadmeTopTest_js.ts +2 -1
- package/project/.sdk/src/cmp/js/TestDirect_js.ts +3 -3
- package/project/.sdk/src/cmp/js/TestEntity_js.ts +8 -8
- package/project/.sdk/src/cmp/js/fragment/EntityBase.fragment.js +22 -1
- package/project/.sdk/src/cmp/js/fragment/EntityCreateOp.fragment.js +9 -1
- package/project/.sdk/src/cmp/js/fragment/EntityLoadOp.fragment.js +9 -1
- package/project/.sdk/src/cmp/js/fragment/EntityRemoveOp.fragment.js +15 -1
- package/project/.sdk/src/cmp/js/fragment/EntityUpdateOp.fragment.js +9 -1
- package/project/.sdk/src/cmp/js/fragment/SdkError.fragment.js +13 -0
- package/project/.sdk/src/cmp/kotlin/Package_kotlin.ts +2 -1
- package/project/.sdk/src/cmp/kotlin/ReadmeHowto_kotlin.ts +2 -1
- package/project/.sdk/src/cmp/kotlin/ReadmeInstall_kotlin.ts +2 -2
- package/project/.sdk/src/cmp/kotlin/ReadmeModel_kotlin.ts +1 -1
- package/project/.sdk/src/cmp/kotlin/ReadmeQuick_kotlin.ts +3 -3
- package/project/.sdk/src/cmp/kotlin/TestDirect_kotlin.ts +3 -3
- package/project/.sdk/src/cmp/kotlin/TestEntity_kotlin.ts +6 -6
- package/project/.sdk/src/cmp/kotlin/fragment/EntityBase.fragment.kt +32 -1
- package/project/.sdk/src/cmp/lean/Package_lean.ts +3 -1
- package/project/.sdk/src/cmp/lua/MainEntity_lua.ts +9 -4
- package/project/.sdk/src/cmp/lua/Package_lua.ts +4 -3
- package/project/.sdk/src/cmp/lua/ReadmeModel_lua.ts +11 -3
- package/project/.sdk/src/cmp/lua/ReadmeQuick_lua.ts +1 -1
- package/project/.sdk/src/cmp/lua/TestDirect_lua.ts +3 -3
- package/project/.sdk/src/cmp/lua/TestEntity_lua.ts +9 -9
- package/project/.sdk/src/cmp/lua/fragment/Entity.fragment.lua +37 -1
- package/project/.sdk/src/cmp/lua/fragment/SdkError.fragment.lua +12 -0
- package/project/.sdk/src/cmp/ocaml/EntityOperation_ocaml.ts +30 -3
- package/project/.sdk/src/cmp/ocaml/Entity_ocaml.ts +11 -5
- package/project/.sdk/src/cmp/ocaml/Package_ocaml.ts +3 -1
- package/project/.sdk/src/cmp/ocaml/ReadmeEntity_ocaml.ts +10 -5
- package/project/.sdk/src/cmp/ocaml/ReadmeHowto_ocaml.ts +6 -2
- package/project/.sdk/src/cmp/ocaml/ReadmeModel_ocaml.ts +10 -8
- package/project/.sdk/src/cmp/ocaml/ReadmeQuick_ocaml.ts +14 -13
- package/project/.sdk/src/cmp/ocaml/ReadmeRef_ocaml.ts +20 -18
- package/project/.sdk/src/cmp/ocaml/ReadmeTopQuick_ocaml.ts +4 -4
- package/project/.sdk/src/cmp/ocaml/ReadmeTopTest_ocaml.ts +8 -2
- package/project/.sdk/src/cmp/ocaml/TestEntity_ocaml.ts +8 -5
- package/project/.sdk/src/cmp/perl/ReadmeHowto_perl.ts +2 -1
- package/project/.sdk/src/cmp/perl/ReadmeModel_perl.ts +1 -1
- package/project/.sdk/src/cmp/perl/ReadmeQuick_perl.ts +3 -3
- package/project/.sdk/src/cmp/perl/ReadmeTopQuick_perl.ts +1 -1
- package/project/.sdk/src/cmp/perl/TestDirect_perl.ts +3 -3
- package/project/.sdk/src/cmp/perl/TestEntity_perl.ts +6 -6
- package/project/.sdk/src/cmp/perl/fragment/Entity.fragment.pm +36 -1
- package/project/.sdk/src/cmp/php/MainEntity_php.ts +21 -16
- package/project/.sdk/src/cmp/php/Package_php.ts +2 -2
- package/project/.sdk/src/cmp/php/ReadmeEntity_php.ts +6 -6
- package/project/.sdk/src/cmp/php/ReadmeHowto_php.ts +4 -3
- package/project/.sdk/src/cmp/php/ReadmeIntro_php.ts +2 -2
- package/project/.sdk/src/cmp/php/ReadmeModel_php.ts +1 -1
- package/project/.sdk/src/cmp/php/ReadmeQuick_php.ts +12 -12
- package/project/.sdk/src/cmp/php/ReadmeRef_php.ts +6 -6
- package/project/.sdk/src/cmp/php/ReadmeTopQuick_php.ts +4 -4
- package/project/.sdk/src/cmp/php/ReadmeTopTest_php.ts +2 -2
- package/project/.sdk/src/cmp/php/TestDirect_php.ts +3 -3
- package/project/.sdk/src/cmp/php/TestEntity_php.ts +17 -15
- package/project/.sdk/src/cmp/php/fragment/Entity.fragment.php +20 -1
- package/project/.sdk/src/cmp/php/fragment/SdkError.fragment.php +11 -0
- package/project/.sdk/src/cmp/py/Package_py.ts +4 -3
- package/project/.sdk/src/cmp/py/ReadmeEntity_py.ts +13 -2
- package/project/.sdk/src/cmp/py/ReadmeHowto_py.ts +2 -1
- package/project/.sdk/src/cmp/py/ReadmeModel_py.ts +1 -1
- package/project/.sdk/src/cmp/py/ReadmeQuick_py.ts +17 -6
- package/project/.sdk/src/cmp/py/ReadmeRef_py.ts +14 -3
- package/project/.sdk/src/cmp/py/ReadmeTopQuick_py.ts +13 -2
- package/project/.sdk/src/cmp/py/TestDirect_py.ts +3 -3
- package/project/.sdk/src/cmp/py/TestEntity_py.ts +9 -9
- package/project/.sdk/src/cmp/py/fragment/Entity.fragment.py +29 -1
- package/project/.sdk/src/cmp/py/fragment/SdkError.fragment.py +11 -0
- package/project/.sdk/src/cmp/py-data/Main_py-data.ts +2 -1
- package/project/.sdk/src/cmp/rb/Package_rb.ts +4 -3
- package/project/.sdk/src/cmp/rb/ReadmeEntity_rb.ts +1 -1
- package/project/.sdk/src/cmp/rb/ReadmeHowto_rb.ts +2 -1
- package/project/.sdk/src/cmp/rb/ReadmeQuick_rb.ts +5 -5
- package/project/.sdk/src/cmp/rb/ReadmeTopQuick_rb.ts +1 -1
- package/project/.sdk/src/cmp/rb/TestDirect_rb.ts +3 -3
- package/project/.sdk/src/cmp/rb/TestEntity_rb.ts +9 -9
- package/project/.sdk/src/cmp/rb/fragment/Entity.fragment.rb +31 -1
- package/project/.sdk/src/cmp/rb/fragment/SdkError.fragment.rb +10 -1
- package/project/.sdk/src/cmp/rust/Entity_rust.ts +5 -1
- package/project/.sdk/src/cmp/rust/Main_rust.ts +21 -0
- package/project/.sdk/src/cmp/rust/Package_rust.ts +2 -1
- package/project/.sdk/src/cmp/rust/TestDirect_rust.ts +3 -3
- package/project/.sdk/src/cmp/rust/TestEntity_rust.ts +12 -12
- package/project/.sdk/src/cmp/rust/fragment/Entity.fragment.rs +18 -0
- package/project/.sdk/src/cmp/rust/fragment/EntityCreateOp.fragment.rs +8 -2
- package/project/.sdk/src/cmp/rust/fragment/EntityListOp.fragment.rs +20 -3
- package/project/.sdk/src/cmp/rust/fragment/EntityLoadOp.fragment.rs +8 -2
- package/project/.sdk/src/cmp/rust/fragment/EntityRemoveOp.fragment.rs +10 -2
- package/project/.sdk/src/cmp/rust/fragment/EntityUpdateOp.fragment.rs +8 -2
- package/project/.sdk/src/cmp/rust/fragment/SdkError.fragment.rs +10 -0
- package/project/.sdk/src/cmp/scala/ReadmeHowto_scala.ts +2 -1
- package/project/.sdk/src/cmp/scala/ReadmeInstall_scala.ts +3 -3
- package/project/.sdk/src/cmp/scala/ReadmeModel_scala.ts +1 -1
- package/project/.sdk/src/cmp/scala/ReadmeQuick_scala.ts +3 -3
- package/project/.sdk/src/cmp/scala/TestEntity_scala.ts +3 -3
- package/project/.sdk/src/cmp/scala/fragment/EntityBase.fragment.scala +27 -1
- package/project/.sdk/src/cmp/swift/ReadmeHowto_swift.ts +2 -1
- package/project/.sdk/src/cmp/swift/ReadmeInstall_swift.ts +3 -3
- package/project/.sdk/src/cmp/swift/ReadmeModel_swift.ts +1 -1
- package/project/.sdk/src/cmp/swift/ReadmeQuick_swift.ts +3 -3
- package/project/.sdk/src/cmp/swift/fragment/EntityBase.fragment.swift +34 -1
- package/project/.sdk/src/cmp/ts/EntityOperation_ts.ts +9 -1
- package/project/.sdk/src/cmp/ts/EntityTypes_ts.ts +18 -1
- package/project/.sdk/src/cmp/ts/Gitignore_ts.ts +5 -2
- package/project/.sdk/src/cmp/ts/Main_ts.ts +4 -1
- package/project/.sdk/src/cmp/ts/Package_ts.ts +10 -1
- package/project/.sdk/src/cmp/ts/ReadmeEntity_ts.ts +13 -2
- package/project/.sdk/src/cmp/ts/ReadmeHowto_ts.ts +2 -1
- package/project/.sdk/src/cmp/ts/ReadmeQuick_ts.ts +21 -6
- package/project/.sdk/src/cmp/ts/ReadmeRef_ts.ts +52 -2
- package/project/.sdk/src/cmp/ts/ReadmeTopQuick_ts.ts +14 -3
- package/project/.sdk/src/cmp/ts/ReadmeTopTest_ts.ts +34 -2
- package/project/.sdk/src/cmp/ts/TestDirect_ts.ts +64 -43
- package/project/.sdk/src/cmp/ts/TestEntity_ts.ts +8 -8
- package/project/.sdk/src/cmp/ts/fragment/Direct.test.fragment.ts +2 -2
- package/project/.sdk/src/cmp/ts/fragment/Entity.test.fragment.ts +2 -2
- package/project/.sdk/src/cmp/ts/fragment/EntityBase.fragment.ts +25 -1
- package/project/.sdk/src/cmp/ts/fragment/EntityCreateOp.fragment.ts +10 -2
- package/project/.sdk/src/cmp/ts/fragment/EntityListOp.fragment.ts +1 -1
- package/project/.sdk/src/cmp/ts/fragment/EntityLoadOp.fragment.ts +10 -2
- package/project/.sdk/src/cmp/ts/fragment/EntityRemoveOp.fragment.ts +27 -3
- package/project/.sdk/src/cmp/ts/fragment/EntityUpdateOp.fragment.ts +10 -2
- package/project/.sdk/src/cmp/ts/fragment/SdkError.fragment.ts +15 -0
- package/project/.sdk/src/cmp/zig/Entity_zig.ts +5 -1
- package/project/.sdk/src/cmp/zig/Package_zig.ts +3 -1
- package/project/.sdk/src/cmp/zig/fragment/Entity.fragment.zig +39 -0
- package/project/.sdk/src/cmp/zig/fragment/EntityCreateOp.fragment.zig +2 -2
- package/project/.sdk/src/cmp/zig/fragment/EntityListOp.fragment.zig +21 -2
- package/project/.sdk/src/cmp/zig/fragment/EntityLoadOp.fragment.zig +2 -2
- package/project/.sdk/src/cmp/zig/fragment/EntityRemoveOp.fragment.zig +5 -2
- package/project/.sdk/src/cmp/zig/fragment/EntityUpdateOp.fragment.zig +2 -2
- package/project/.sdk/tm/c/VERSION +1 -1
- package/project/.sdk/tm/c/core/helpers.c +1 -0
- package/project/.sdk/tm/c/core/sdk.h +22 -6
- package/project/.sdk/tm/c/tests/feature_harness.h +1 -0
- package/project/.sdk/tm/c/tests/primary_utility_test.c +4 -1
- package/project/.sdk/tm/c/utility/make_url.c +1 -0
- package/project/.sdk/tm/c/utility/param.c +1 -0
- package/project/.sdk/tm/clojure/VERSION +1 -1
- package/project/.sdk/tm/cpp/VERSION +1 -1
- package/project/.sdk/tm/cpp/core/types.hpp +33 -8
- package/project/.sdk/tm/cpp/test/pipeline_test.cpp +5 -0
- package/project/.sdk/tm/cpp/test/runner_support.hpp +4 -4
- package/project/.sdk/tm/csharp/VERSION +1 -1
- package/project/.sdk/tm/csharp/core/Types.cs +6 -0
- package/project/.sdk/tm/csharp/test/FeatureHarness.cs +396 -0
- package/project/.sdk/tm/csharp/test/FeatureTest.cs +7 -385
- package/project/.sdk/tm/csharp/test/Runner.cs +4 -4
- package/project/.sdk/tm/dart/lib/utility/MakeErrorUtility.dart +4 -0
- package/project/.sdk/tm/dart/test/utility.dart +4 -4
- package/project/.sdk/tm/elixir/VERSION +1 -1
- package/project/.sdk/tm/elixir/lib/projectname/entity_base.ex +26 -0
- package/project/.sdk/tm/go/VERSION +1 -1
- package/project/.sdk/tm/go/core/types.go +6 -0
- package/project/.sdk/tm/go/test/feature_harness_test.go +361 -0
- package/project/.sdk/tm/go/test/feature_test.go +7 -350
- package/project/.sdk/tm/go/test/pipeline_test.go +6 -0
- package/project/.sdk/tm/go/test/runner_test.go +16 -4
- package/project/.sdk/tm/haskell/VERSION +1 -1
- package/project/.sdk/tm/haskell/src/SdkFeatures.hs +28 -5
- package/project/.sdk/tm/haskell/src/SdkTypes.hs +14 -5
- package/project/.sdk/tm/java/VERSION +1 -1
- package/project/.sdk/tm/java/test/RunnerSupport.java +4 -4
- package/project/.sdk/tm/java/utility/MakeError.java +4 -0
- package/project/.sdk/tm/js/src/utility/MakeErrorUtility.js +4 -0
- package/project/.sdk/tm/js/test/utility.js +3 -3
- package/project/.sdk/tm/kotlin/VERSION +1 -1
- package/project/.sdk/tm/kotlin/test/RunnerSupport.kt +3 -3
- package/project/.sdk/tm/lean/VERSION +1 -1
- package/project/.sdk/tm/lean/test/TFeature.lean +27 -14
- package/project/.sdk/tm/lua/test/runner.lua +4 -4
- package/project/.sdk/tm/lua/utility/make_error.lua +4 -0
- package/project/.sdk/tm/ocaml/VERSION +1 -1
- package/project/.sdk/tm/ocaml/sdk_types.ml +14 -5
- package/project/.sdk/tm/ocaml/test/t_pipeline.ml +5 -2
- package/project/.sdk/tm/perl/t/runner.pm +4 -4
- package/project/.sdk/tm/php/VERSION +1 -1
- package/project/.sdk/tm/php/test/Runner.php +4 -4
- package/project/.sdk/tm/php/utility/MakeError.php +5 -0
- package/project/.sdk/tm/py/pkg/utility/make_error.py +4 -0
- package/project/.sdk/tm/py/test/runner.py +19 -4
- package/project/.sdk/tm/rb/test/runner.rb +4 -4
- package/project/.sdk/tm/rb/utility/make_error.rb +4 -0
- package/project/.sdk/tm/rust/VERSION +1 -1
- package/project/.sdk/tm/rust/core/types.rs +22 -6
- package/project/.sdk/tm/rust/tests/common/mod.rs +6 -6
- package/project/.sdk/tm/rust/tests/pipeline_test.rs +6 -0
- package/project/.sdk/tm/rust/utility/make_error.rs +4 -0
- package/project/.sdk/tm/scala/VERSION +1 -1
- package/project/.sdk/tm/swift/VERSION +1 -1
- package/project/.sdk/tm/ts/src/tsconfig.json +1 -0
- package/project/.sdk/tm/ts/src/utility/MakeErrorUtility.ts +4 -0
- package/project/.sdk/tm/ts/test/tsconfig.json +1 -0
- package/project/.sdk/tm/ts/test/utility.ts +3 -3
- package/project/.sdk/tm/zig/VERSION +1 -1
- package/src/action/doctor.ts +410 -0
- package/src/action/feature.ts +54 -16
- package/src/action/target.ts +174 -25
- package/src/cmp/Entity.ts +7 -0
- package/src/cmp/Feature.ts +3 -1
- package/src/cmp/Main.ts +7 -1
- package/src/cmp/ReadmeExplanation.ts +2 -2
- package/src/cmp/ReadmeTop.ts +22 -9
- package/src/cmp/Registered.ts +100 -0
- package/src/cmp/Test.ts +4 -1
- package/src/helpers/dryrun.ts +57 -0
- package/src/helpers/featureSource.ts +208 -0
- package/src/helpers/naming.ts +73 -2
- package/src/helpers/opExample.ts +19 -2
- package/src/helpers/opShape.ts +65 -0
- package/src/helpers/packageMeta.ts +163 -10
- package/src/helpers/stdrep.ts +56 -0
- package/src/helpers/testPolicy.ts +52 -0
- package/src/sdkgen.ts +70 -4
- package/project/.sdk/tm/rust/feature/mod.rs +0 -24
|
@@ -41,6 +41,33 @@ function entityOp(opname: string, present: boolean, entityname: string): string
|
|
|
41
41
|
post = ` ()\n`
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
+
// The op resolves to the ENTITY (see Sdk_types). `list` builds one entity
|
|
45
|
+
// per record here, since make_result works in `value` and cannot; `remove`
|
|
46
|
+
// marks the instance. With throwing disabled run_op returns the error
|
|
47
|
+
// payload, which an entity_obj return cannot carry, so that path resolves to
|
|
48
|
+
// the entity too and the caller reads ctrl.err - the mechanism no-throw mode
|
|
49
|
+
// documents anyway.
|
|
50
|
+
const tail =
|
|
51
|
+
'list' === opname
|
|
52
|
+
? ` let out = run_op ctx post_done in
|
|
53
|
+
(match out with
|
|
54
|
+
| List items ->
|
|
55
|
+
List.map (fun entry ->
|
|
56
|
+
let e = ent.e_make () in
|
|
57
|
+
(match entry with Map _ -> e.e_data_set entry | _ -> ());
|
|
58
|
+
e)
|
|
59
|
+
!items
|
|
60
|
+
| _ -> []));
|
|
61
|
+
`
|
|
62
|
+
: 'remove' === opname
|
|
63
|
+
? ` ignore (run_op ctx post_done);
|
|
64
|
+
ent.e_mark_deleted ();
|
|
65
|
+
ent);
|
|
66
|
+
`
|
|
67
|
+
: ` ignore (run_op ctx post_done);
|
|
68
|
+
ent);
|
|
69
|
+
`
|
|
70
|
+
|
|
44
71
|
return ` ent.${field} <- (fun ${arg} ctrl ->
|
|
45
72
|
let ${arg} = if is_nullish ${arg} then empty_map () else ${arg} in
|
|
46
73
|
let ctx = utility.u_make_context
|
|
@@ -50,11 +77,11 @@ function entityOp(opname: string, present: boolean, entityname: string): string
|
|
|
50
77
|
cs_match = Some ent.e_match; cs_data = Some ent.e_data;
|
|
51
78
|
${inputField} = Some ${arg} }
|
|
52
79
|
(Some entctx) in
|
|
53
|
-
|
|
80
|
+
let post_done () =
|
|
54
81
|
match ctx.c_result with
|
|
55
82
|
| Some result ->
|
|
56
|
-
${post} | None -> ()
|
|
57
|
-
`
|
|
83
|
+
${post} | None -> () in
|
|
84
|
+
${tail}`
|
|
58
85
|
}
|
|
59
86
|
|
|
60
87
|
|
|
@@ -76,11 +76,16 @@ let rec make (client : sdk_client) (entopts_in : value) : entity_obj =
|
|
|
76
76
|
e_data_get = (fun () -> empty_map ());
|
|
77
77
|
e_match_set = (fun _ -> ());
|
|
78
78
|
e_match_get = (fun () -> empty_map ());
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
79
|
+
(* Placeholders: the real closures are installed below. They cannot name
|
|
80
|
+
* \`ent\` here, and the op signatures resolve to entity_obj, so failwith
|
|
81
|
+
* (which types as 'a) stands in. *)
|
|
82
|
+
e_load = (fun _ _ -> failwith "op not installed");
|
|
83
|
+
e_list = (fun _ _ -> failwith "op not installed");
|
|
84
|
+
e_create = (fun _ _ -> failwith "op not installed");
|
|
85
|
+
e_update = (fun _ _ -> failwith "op not installed");
|
|
86
|
+
e_remove = (fun _ _ -> failwith "op not installed");
|
|
87
|
+
e_deleted = false;
|
|
88
|
+
e_mark_deleted = (fun () -> ());
|
|
84
89
|
e_stream = (fun _ _ _ -> Seq.empty);
|
|
85
90
|
} in
|
|
86
91
|
let entctx = utility.u_make_context
|
|
@@ -99,6 +104,7 @@ let rec make (client : sdk_client) (entopts_in : value) : entity_obj =
|
|
|
99
104
|
utility.u_feature_hook entctx "SetMatch"
|
|
100
105
|
end);
|
|
101
106
|
ent.e_match_get <- (fun () -> utility.u_feature_hook entctx "GetMatch"; clone ent.e_match);
|
|
107
|
+
ent.e_mark_deleted <- (fun () -> ent.e_deleted <- true);
|
|
102
108
|
(* Streaming operation. Runs \`action\` (an op name, e.g. "list") through the
|
|
103
109
|
* full pipeline and returns a lazy Seq over result items, so the streaming
|
|
104
110
|
* feature's incremental output is reachable (a normal op call materialises
|
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
Content,
|
|
4
4
|
File,
|
|
5
5
|
cmp,
|
|
6
|
+
packageVersion,
|
|
6
7
|
} from '@voxgig/sdkgen'
|
|
7
8
|
|
|
8
9
|
|
|
@@ -15,6 +16,7 @@ import { packageName } from './utility_ocaml'
|
|
|
15
16
|
// there is no depends list beyond the OCaml compiler.
|
|
16
17
|
const Package = cmp(async function Package(props: any) {
|
|
17
18
|
const ctx$ = props.ctx$
|
|
19
|
+
const target = props.target
|
|
18
20
|
const model = ctx$.model
|
|
19
21
|
|
|
20
22
|
const pkg = packageName(model)
|
|
@@ -22,7 +24,7 @@ const Package = cmp(async function Package(props: any) {
|
|
|
22
24
|
File({ name: pkg + '.opam' }, () => {
|
|
23
25
|
Content(`opam-version: "2.0"
|
|
24
26
|
name: "${pkg}"
|
|
25
|
-
version: "
|
|
27
|
+
version: "${packageVersion(model, target.name)}"
|
|
26
28
|
synopsis: "${model.const.Name} SDK for OCaml (generated by @voxgig/sdkgen)"
|
|
27
29
|
maintainer: "voxgig"
|
|
28
30
|
authors: "voxgig"
|
|
@@ -39,11 +39,11 @@ function ocamlType(type: any): string {
|
|
|
39
39
|
// The op accessor spelling on the entity_obj record, plus a language-agnostic
|
|
40
40
|
// description.
|
|
41
41
|
const OP_DESC: Record<string, { method: string, desc: string }> = {
|
|
42
|
-
load: { method: 'e_load reqmatch ctrl', desc: 'Load a single entity by match criteria.' },
|
|
43
|
-
list: { method: 'e_list reqmatch ctrl', desc: 'List entities, optionally matching the given criteria.' },
|
|
44
|
-
create: { method: 'e_create reqdata ctrl', desc: 'Create a new entity with the given data.' },
|
|
45
|
-
update: { method: 'e_update reqdata ctrl', desc: 'Update an existing entity.' },
|
|
46
|
-
remove: { method: 'e_remove reqmatch ctrl', desc: 'Remove the matching entity.' },
|
|
42
|
+
load: { method: 'e_load reqmatch ctrl', desc: 'Load a single entity by match criteria. Resolves to the entity.' },
|
|
43
|
+
list: { method: 'e_list reqmatch ctrl', desc: 'List entities, optionally matching the given criteria. Resolves to one entity per record.' },
|
|
44
|
+
create: { method: 'e_create reqdata ctrl', desc: 'Create a new entity with the given data. Resolves to the entity.' },
|
|
45
|
+
update: { method: 'e_update reqdata ctrl', desc: 'Update an existing entity. Resolves to the entity.' },
|
|
46
|
+
remove: { method: 'e_remove reqmatch ctrl', desc: 'Remove the matching entity. Resolves to the entity, marked deleted.' },
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
|
|
@@ -138,7 +138,9 @@ const ReadmeEntity = cmp(function ReadmeEntity(props: any) {
|
|
|
138
138
|
Content(`#### Example: Load
|
|
139
139
|
|
|
140
140
|
\`\`\`ocaml
|
|
141
|
+
(* The op resolves to the ENTITY; the record is inside it. *)
|
|
141
142
|
let ${fn} = (Sdk_client.${fn} client Noval).e_load (${loadArg}) Noval
|
|
143
|
+
let ${fn}_data = ${fn}.e_data_get ()
|
|
142
144
|
\`\`\`
|
|
143
145
|
|
|
144
146
|
`)
|
|
@@ -148,7 +150,9 @@ let ${fn} = (Sdk_client.${fn} client Noval).e_load (${loadArg}) Noval
|
|
|
148
150
|
Content(`#### Example: List
|
|
149
151
|
|
|
150
152
|
\`\`\`ocaml
|
|
153
|
+
(* One ENTITY per record. *)
|
|
151
154
|
let ${fn}s = (Sdk_client.${fn} client Noval).e_list (empty_map ()) Noval
|
|
155
|
+
let ${fn}_datas = List.map (fun e -> e.e_data_get ()) ${fn}s
|
|
152
156
|
\`\`\`
|
|
153
157
|
|
|
154
158
|
`)
|
|
@@ -167,6 +171,7 @@ let ${fn} = (Sdk_client.${fn} client Noval).e_create (jo [
|
|
|
167
171
|
`)
|
|
168
172
|
})
|
|
169
173
|
Content(`]) Noval
|
|
174
|
+
let ${fn}_data = ${fn}.e_data_get ()
|
|
170
175
|
\`\`\`
|
|
171
176
|
|
|
172
177
|
`)
|
|
@@ -53,9 +53,13 @@ const ReadmeHowto = cmp(function ReadmeHowto(props: any) {
|
|
|
53
53
|
// The op-driven test-mode line, shown only when the SDK has an entity op.
|
|
54
54
|
// A direct()-only SDK (no ops anywhere) shows a direct() call instead.
|
|
55
55
|
const testModeExample = primaryOp
|
|
56
|
-
?
|
|
56
|
+
? ('list' === primaryOp
|
|
57
|
+
? `(* Entity ops resolve to the ENTITY (list: one per record) and raise on error. *)
|
|
58
|
+
let ${fn}s = (Sdk_client.${fn} client Noval).${field} ${testArg} Noval in
|
|
59
|
+
List.iter (fun e -> print_endline (stringify (e.e_data_get ()))) ${fn}s (* the mock records *)`
|
|
60
|
+
: `(* Entity ops resolve to the ENTITY and raise on error. *)
|
|
57
61
|
let ${fn} = (Sdk_client.${fn} client Noval).${field} ${testArg} Noval in
|
|
58
|
-
print_endline (stringify ${fn}) (* the mock response record *)`
|
|
62
|
+
print_endline (stringify (${fn}.e_data_get ())) (* the mock response record *)`)
|
|
59
63
|
: `let result = Sdk_client.direct client (jo [("path", Str "/api/resource"); ("method", Str "GET")]) in
|
|
60
64
|
print_endline (stringify result)`
|
|
61
65
|
|
|
@@ -21,11 +21,11 @@ const ReadmeModel = cmp(function ReadmeModel(props: any) {
|
|
|
21
21
|
entityList.forEach((e: any) => Object.keys(e.op || {})
|
|
22
22
|
.forEach((o: string) => { if (e.op[o] && e.op[o].active !== false) opUnion.add(o) }))
|
|
23
23
|
const opRowDefs: Record<string, string> = {
|
|
24
|
-
load: '| `e_load` | `value -> value ->
|
|
25
|
-
list: '| `e_list` | `value -> value ->
|
|
26
|
-
create: '| `e_create` | `value -> value ->
|
|
27
|
-
update: '| `e_update` | `value -> value ->
|
|
28
|
-
remove: '| `e_remove` | `value -> value ->
|
|
24
|
+
load: '| `e_load` | `value -> value -> entity_obj` | Load a single entity by match criteria. Resolves to the entity. Raises on error. |',
|
|
25
|
+
list: '| `e_list` | `value -> value -> entity_obj list` | List entities matching the criteria. Resolves to one entity per record. Raises on error. |',
|
|
26
|
+
create: '| `e_create` | `value -> value -> entity_obj` | Create a new entity. Resolves to the entity. Raises on error. |',
|
|
27
|
+
update: '| `e_update` | `value -> value -> entity_obj` | Update an existing entity. Resolves to the entity. Raises on error. |',
|
|
28
|
+
remove: '| `e_remove` | `value -> value -> entity_obj` | Remove an entity. Resolves to the entity, marked deleted. Raises on error. |',
|
|
29
29
|
}
|
|
30
30
|
const opRows = ['load', 'list', 'create', 'update', 'remove']
|
|
31
31
|
.filter((o) => opUnion.has(o)).map((o) => opRowDefs[o]).join('\n')
|
|
@@ -98,9 +98,11 @@ ${opRows}
|
|
|
98
98
|
|
|
99
99
|
### Result shape
|
|
100
100
|
|
|
101
|
-
Entity operations
|
|
102
|
-
|
|
103
|
-
|
|
101
|
+
Entity operations resolve to the ENTITY, not the raw record \u2014 \`e_list\` to
|
|
102
|
+
one entity per record \u2014 and raise \`Sdk_error.E\` on error. The record is
|
|
103
|
+
reached through \`e_data_get\`, which returns the entity's data container.
|
|
104
|
+
\`e_remove\` resolves to the entity marked deleted (\`e_deleted\`); it keeps the
|
|
105
|
+
data it held. Wrap calls in \`try\`/\`with\` to handle failures.
|
|
104
106
|
|
|
105
107
|
The \`direct\` escape hatch never raises — it returns a result \`value\` map
|
|
106
108
|
you branch on via \`getp result "ok"\`:
|
|
@@ -66,15 +66,13 @@ let client = ${ctor}
|
|
|
66
66
|
if (opnames.includes('list')) {
|
|
67
67
|
Content(`### 2. List ${fn} records
|
|
68
68
|
|
|
69
|
-
\`e_list\`
|
|
70
|
-
|
|
69
|
+
\`e_list\` resolves to one ENTITY per record and raises on error. Read a
|
|
70
|
+
record with \`e_data_get\`.
|
|
71
71
|
|
|
72
72
|
\`\`\`ocaml
|
|
73
73
|
(try
|
|
74
74
|
let ${fn}s = (Sdk_client.${fn} client Noval).e_list (empty_map ()) Noval in
|
|
75
|
-
(
|
|
76
|
-
| List items -> List.iter (fun r -> print_endline (stringify r)) !items
|
|
77
|
-
| _ -> ())
|
|
75
|
+
List.iter (fun e -> print_endline (stringify (e.e_data_get ()))) ${fn}s
|
|
78
76
|
with Sdk_error.E err -> Printf.eprintf "list failed: %s\\n" (Sdk_error.message err))
|
|
79
77
|
\`\`\`
|
|
80
78
|
|
|
@@ -103,12 +101,13 @@ error — iterate it directly.
|
|
|
103
101
|
Content(`### 3. Load ${neArticle} ${neFn}
|
|
104
102
|
|
|
105
103
|
${neName} is nested under ${parentName}, so provide the \`${parentParam}\`.
|
|
106
|
-
\`e_load\`
|
|
104
|
+
\`e_load\` resolves to the ENTITY and raises on error; \`e_data_get\` gives the
|
|
105
|
+
record.
|
|
107
106
|
|
|
108
107
|
\`\`\`ocaml
|
|
109
108
|
(try
|
|
110
109
|
let ${neFn} = (Sdk_client.${neFn} client Noval).e_load (jo [${neMatch.join('; ')}]) Noval in
|
|
111
|
-
print_endline (stringify ${neFn})
|
|
110
|
+
print_endline (stringify (${neFn}.e_data_get ()))
|
|
112
111
|
with Sdk_error.E err -> Printf.eprintf "load failed: %s\\n" (Sdk_error.message err))
|
|
113
112
|
\`\`\`
|
|
114
113
|
|
|
@@ -127,12 +126,13 @@ ${neName} is nested under ${parentName}, so provide the \`${parentParam}\`.
|
|
|
127
126
|
|
|
128
127
|
Content(`### 3. Load ${article} ${fn}
|
|
129
128
|
|
|
130
|
-
\`e_load\`
|
|
129
|
+
\`e_load\` resolves to the ENTITY and raises on error; \`e_data_get\` gives the
|
|
130
|
+
record.
|
|
131
131
|
|
|
132
132
|
\`\`\`ocaml
|
|
133
133
|
(try
|
|
134
134
|
let ${fn} = (Sdk_client.${fn} client Noval).e_load (${loadArg}) Noval in
|
|
135
|
-
print_endline (stringify ${fn})
|
|
135
|
+
print_endline (stringify (${fn}.e_data_get ()))
|
|
136
136
|
with Sdk_error.E err -> Printf.eprintf "load failed: %s\\n" (Sdk_error.message err))
|
|
137
137
|
\`\`\`
|
|
138
138
|
|
|
@@ -167,9 +167,9 @@ ${neName} is nested under ${parentName}, so provide the \`${parentParam}\`.
|
|
|
167
167
|
\`\`\`ocaml
|
|
168
168
|
`)
|
|
169
169
|
if (opnames.includes('create')) {
|
|
170
|
-
Content(`(* Create —
|
|
170
|
+
Content(`(* Create — resolves to the ENTITY; e_data_get gives the record *)
|
|
171
171
|
let created = (Sdk_client.${fn} client Noval).e_create (jo [${examplePairs('create').join('; ')}]) Noval in
|
|
172
|
-
|
|
172
|
+
print_endline (stringify (created.e_data_get ()));
|
|
173
173
|
|
|
174
174
|
`)
|
|
175
175
|
}
|
|
@@ -188,8 +188,9 @@ ignore ((Sdk_client.${fn} client Noval).e_update (jo [${updatePairs.join('; ')}]
|
|
|
188
188
|
.map((it: any) => it.name === idF
|
|
189
189
|
? `("${it.name}", ${idValueFor('remove')})`
|
|
190
190
|
: `("${it.name}", ${ocamlLit(it.type, 'example_' + it.name)})`)
|
|
191
|
-
Content(`(* Remove *)
|
|
192
|
-
|
|
191
|
+
Content(`(* Remove — resolves to the entity, marked deleted; it keeps its data *)
|
|
192
|
+
let removed = (Sdk_client.${fn} client Noval).e_remove (${removePairs.length ? `jo [${removePairs.join('; ')}]` : 'Noval'}) Noval in
|
|
193
|
+
Printf.printf "deleted: %b\\n" removed.e_deleted
|
|
193
194
|
`)
|
|
194
195
|
}
|
|
195
196
|
Content(`\`\`\`
|
|
@@ -36,29 +36,29 @@ function ocamlType(type: any): string {
|
|
|
36
36
|
|
|
37
37
|
const OP_SIGNATURES: Record<string, { sig: string, returns: string, desc: string }> = {
|
|
38
38
|
load: {
|
|
39
|
-
sig: 'e_load reqmatch ctrl :
|
|
40
|
-
returns: 'the entity
|
|
41
|
-
desc: 'Load a single entity matching the given criteria.
|
|
39
|
+
sig: 'e_load reqmatch ctrl : entity_obj',
|
|
40
|
+
returns: 'the entity',
|
|
41
|
+
desc: 'Load a single entity matching the given criteria. Resolves to the ENTITY (read the record with `e_data_get`) and raises on error.',
|
|
42
42
|
},
|
|
43
43
|
list: {
|
|
44
|
-
sig: 'e_list reqmatch ctrl :
|
|
45
|
-
returns: '
|
|
46
|
-
desc: 'List entities matching the given criteria. The match is optional
|
|
44
|
+
sig: 'e_list reqmatch ctrl : entity_obj list',
|
|
45
|
+
returns: 'one entity per record',
|
|
46
|
+
desc: 'List entities matching the given criteria. The match is optional \u2014 pass `(empty_map ())` to list all records. Resolves to one ENTITY per record and raises on error.',
|
|
47
47
|
},
|
|
48
48
|
create: {
|
|
49
|
-
sig: 'e_create reqdata ctrl :
|
|
50
|
-
returns: 'the created entity
|
|
51
|
-
desc: 'Create a new entity with the given data.
|
|
49
|
+
sig: 'e_create reqdata ctrl : entity_obj',
|
|
50
|
+
returns: 'the created entity',
|
|
51
|
+
desc: 'Create a new entity with the given data. Resolves to the ENTITY (read the record with `e_data_get`) and raises on error.',
|
|
52
52
|
},
|
|
53
53
|
update: {
|
|
54
|
-
sig: 'e_update reqdata ctrl :
|
|
55
|
-
returns: 'the updated entity
|
|
56
|
-
desc: 'Update an existing entity. The data must include the entity `id`.
|
|
54
|
+
sig: 'e_update reqdata ctrl : entity_obj',
|
|
55
|
+
returns: 'the updated entity',
|
|
56
|
+
desc: 'Update an existing entity. The data must include the entity `id`. Resolves to the ENTITY (read the record with `e_data_get`) and raises on error.',
|
|
57
57
|
},
|
|
58
58
|
remove: {
|
|
59
|
-
sig: 'e_remove reqmatch ctrl :
|
|
60
|
-
returns: 'the removed entity
|
|
61
|
-
desc: 'Remove the entity matching the given criteria. Raises on error.',
|
|
59
|
+
sig: 'e_remove reqmatch ctrl : entity_obj',
|
|
60
|
+
returns: 'the removed entity',
|
|
61
|
+
desc: 'Remove the entity matching the given criteria. Resolves to the ENTITY, marked deleted (`e_deleted`); it keeps the data it held. Raises on error.',
|
|
62
62
|
},
|
|
63
63
|
}
|
|
64
64
|
|
|
@@ -273,16 +273,16 @@ ${info.desc}
|
|
|
273
273
|
: 'Noval'
|
|
274
274
|
Content(`\`\`\`ocaml
|
|
275
275
|
let result = (Sdk_client.${fn} client Noval).${'load' === opname ? 'e_load' : 'e_remove'} (${arg}) Noval
|
|
276
|
+
let result_data = result.e_data_get ()
|
|
276
277
|
\`\`\`
|
|
277
278
|
|
|
278
279
|
`)
|
|
279
280
|
}
|
|
280
281
|
else if ('list' === opname) {
|
|
281
282
|
Content(`\`\`\`ocaml
|
|
283
|
+
(* One ENTITY per record; the record is reached with e_data_get. *)
|
|
282
284
|
let results = (Sdk_client.${fn} client Noval).e_list (empty_map ()) Noval in
|
|
283
|
-
(
|
|
284
|
-
| List items -> List.iter (fun r -> print_endline (stringify r)) !items
|
|
285
|
-
| _ -> ())
|
|
285
|
+
List.iter (fun e -> print_endline (stringify (e.e_data_get ()))) results
|
|
286
286
|
\`\`\`
|
|
287
287
|
|
|
288
288
|
`)
|
|
@@ -298,6 +298,7 @@ let result = (Sdk_client.${fn} client Noval).e_create (jo [
|
|
|
298
298
|
`)
|
|
299
299
|
})
|
|
300
300
|
Content(`]) Noval
|
|
301
|
+
let result_data = result.e_data_get ()
|
|
301
302
|
\`\`\`
|
|
302
303
|
|
|
303
304
|
`)
|
|
@@ -314,6 +315,7 @@ let result = (Sdk_client.${fn} client Noval).e_create (jo [
|
|
|
314
315
|
let result = (Sdk_client.${fn} client Noval).e_update (jo [
|
|
315
316
|
${updateLines} (* Fields to update *)
|
|
316
317
|
]) Noval
|
|
318
|
+
let result_data = result.e_data_get ()
|
|
317
319
|
\`\`\`
|
|
318
320
|
|
|
319
321
|
`)
|
|
@@ -49,9 +49,9 @@ let () =
|
|
|
49
49
|
const idF = entityIdField(exampleEntity)
|
|
50
50
|
|
|
51
51
|
if (opnames.includes('list')) {
|
|
52
|
-
Content(` (* List all ${fn} records (
|
|
52
|
+
Content(` (* List all ${fn} records (one ENTITY per record; raises on error) *)
|
|
53
53
|
let ${fn}s = (Sdk_client.${fn} client Noval).e_list (empty_map ()) Noval in
|
|
54
|
-
|
|
54
|
+
List.iter (fun e -> print_endline (stringify (e.e_data_get ()))) ${fn}s;
|
|
55
55
|
`)
|
|
56
56
|
}
|
|
57
57
|
|
|
@@ -68,9 +68,9 @@ let () =
|
|
|
68
68
|
`("${it.name}", ${ocamlLit(it.type,
|
|
69
69
|
it.name === idF ? 'example_id' : 'example_' + it.name)})`).join('; ')}]`
|
|
70
70
|
: 'Noval'
|
|
71
|
-
Content(` (* Load a specific ${fn} (returns the
|
|
71
|
+
Content(` (* Load a specific ${fn} (returns the ENTITY; raises on error) *)
|
|
72
72
|
let ${fn} = (Sdk_client.${fn} client Noval).e_load (${loadArg}) Noval in
|
|
73
|
-
print_endline (stringify ${fn})
|
|
73
|
+
print_endline (stringify (${fn}.e_data_get ()))
|
|
74
74
|
`)
|
|
75
75
|
}
|
|
76
76
|
}
|
|
@@ -63,8 +63,14 @@ let () =
|
|
|
63
63
|
const chosen = required.length ? required : items.slice(0, 3)
|
|
64
64
|
arg = `(jo [${chosen.map((it: any) => `("${it.name}", ${ocamlLit(it.type)})`).join('; ')}])`
|
|
65
65
|
}
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
// The op resolves to the ENTITY (list: one per record); the record is
|
|
67
|
+
// reached with e_data_get.
|
|
68
|
+
Content('list' === primaryOp
|
|
69
|
+
? ` let results = (Sdk_client.${fn} client Noval).${field} ${arg} Noval in
|
|
70
|
+
List.iter (fun e -> print_endline (stringify (e.e_data_get ()))) results
|
|
71
|
+
`
|
|
72
|
+
: ` let result = (Sdk_client.${fn} client Noval).${field} ${arg} Noval in
|
|
73
|
+
print_endline (stringify (result.e_data_get ()))
|
|
68
74
|
`)
|
|
69
75
|
}
|
|
70
76
|
|
|
@@ -53,17 +53,20 @@ let () =
|
|
|
53
53
|
ignore ent;
|
|
54
54
|
`)
|
|
55
55
|
if (hasList) {
|
|
56
|
-
Content(`
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
Content(` (* The op resolves to one ENTITY per record; the record is reached
|
|
57
|
+
with e_data_get. See AGENTS.md "Entity operations return ENTITIES". *)
|
|
58
|
+
let listed = ent.e_list (empty_map ()) Noval in
|
|
59
|
+
check_int "list size" (List.length listed) 1;
|
|
60
|
+
List.iter (fun en -> check "list entry data is a map" (ismap (en.e_data_get ()))) listed;
|
|
59
61
|
`)
|
|
60
62
|
}
|
|
61
63
|
if (hasLoad) {
|
|
62
64
|
Content(` let loaded = ent.e_load (jo [("id", Str "${ocamlString(id)}")]) Noval in
|
|
63
|
-
|
|
65
|
+
let loaded_data = loaded.e_data_get () in
|
|
66
|
+
check "load data is a map" (ismap loaded_data);
|
|
64
67
|
`)
|
|
65
68
|
if (hasId) {
|
|
66
|
-
Content(` check_vstr "load id" (getp
|
|
69
|
+
Content(` check_vstr "load id" (getp loaded_data "id") "${ocamlString(id)}";
|
|
67
70
|
`)
|
|
68
71
|
}
|
|
69
72
|
}
|
|
@@ -46,7 +46,8 @@ const ReadmeHowto = cmp(function ReadmeHowto(props: any) {
|
|
|
46
46
|
// The op-driven test-mode line, shown only when the SDK has an entity op.
|
|
47
47
|
// A direct()-only SDK (no ops anywhere) shows a direct() call instead.
|
|
48
48
|
const testModeExample = primaryOp
|
|
49
|
-
? `# Entity ops return the
|
|
49
|
+
? `# Entity ops return the ENTITY and dies on error;
|
|
50
|
+
// call data_get for the record.
|
|
50
51
|
my $${eVar} = $client->${eName}->${primaryOp}(${testArg});
|
|
51
52
|
# $${eVar} contains the mock response record`
|
|
52
53
|
: `my $result = $client->direct({ 'path' => '/api/resource', 'method' => 'GET' });
|
|
@@ -93,7 +93,7 @@ ${opRows}
|
|
|
93
93
|
|
|
94
94
|
### Result shape
|
|
95
95
|
|
|
96
|
-
Entity operations return the
|
|
96
|
+
Entity operations return the ENTITY (call data_get for the record) (a \`hashref\` for single-entity
|
|
97
97
|
ops, an \`arrayref\` for \`list\`) and die on error. Wrap calls in
|
|
98
98
|
\`eval { ... }\` and inspect \`$@\` to handle failures.
|
|
99
99
|
|
|
@@ -106,7 +106,7 @@ else {
|
|
|
106
106
|
Content(`### 3. Load ${neArticle} ${neName.toLowerCase()}
|
|
107
107
|
|
|
108
108
|
${neName} is nested under ${parentName}, so provide the \`${parentParam}\`.
|
|
109
|
-
\`load()\` returns the
|
|
109
|
+
\`load()\` returns the ENTITY — call data_get for the record — and dies on error.
|
|
110
110
|
|
|
111
111
|
\`\`\`perl
|
|
112
112
|
my $${neVar} = eval { $client->${neName}->load({ ${neMatch.join(', ')} }) };
|
|
@@ -133,7 +133,7 @@ else {
|
|
|
133
133
|
|
|
134
134
|
Content(`### 3. Load ${article} ${eName.toLowerCase()}
|
|
135
135
|
|
|
136
|
-
\`load()\` returns the
|
|
136
|
+
\`load()\` returns the ENTITY — call data_get for the record — and dies on error.
|
|
137
137
|
|
|
138
138
|
\`\`\`perl
|
|
139
139
|
my $${eVar} = eval { $client->${eName}->load(${loadArg}) };
|
|
@@ -178,7 +178,7 @@ else {
|
|
|
178
178
|
\`\`\`perl
|
|
179
179
|
`)
|
|
180
180
|
if (opnames.includes('create')) {
|
|
181
|
-
Content(`# Create — returns the
|
|
181
|
+
Content(`# Create — returns the ENTITY (call data_get for the record)
|
|
182
182
|
my $created = $client->${eName}->create({ ${examplePairs('create').join(', ')} });
|
|
183
183
|
|
|
184
184
|
`)
|
|
@@ -73,7 +73,7 @@ for my $${eVar} (@$${eVar}s) {
|
|
|
73
73
|
it.name === idF ? 'example_id' : 'example_' + it.name)}`).join(', ')} }`
|
|
74
74
|
: ''
|
|
75
75
|
Content(`
|
|
76
|
-
# Load a specific ${eName.toLowerCase()} (returns the
|
|
76
|
+
# Load a specific ${eName.toLowerCase()} (returns the ENTITY; call data_get for the record; dies on error)
|
|
77
77
|
my $${eVar} = $client->${eName}->load(${loadArg});
|
|
78
78
|
print "$${eVar}->{id}\\n";
|
|
79
79
|
`)
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
File,
|
|
12
12
|
cmp,
|
|
13
13
|
snakify,
|
|
14
|
-
isAuthActive,
|
|
14
|
+
isAuthActive, envName, envToken
|
|
15
15
|
} from '@voxgig/sdkgen'
|
|
16
16
|
|
|
17
17
|
|
|
@@ -70,7 +70,7 @@ const TestDirect = cmp(function TestDirect(props: any) {
|
|
|
70
70
|
const entity: ModelEntity = props.entity
|
|
71
71
|
|
|
72
72
|
const N = model.const.Name
|
|
73
|
-
const PROJECTNAME =
|
|
73
|
+
const PROJECTNAME = envName(model)
|
|
74
74
|
|
|
75
75
|
const authActive = isAuthActive(model)
|
|
76
76
|
const apikeyEnvEntry = authActive
|
|
@@ -132,7 +132,7 @@ const TestDirect = cmp(function TestDirect(props: any) {
|
|
|
132
132
|
? loadParams.map((p: any) => ` $params->{'${p.name}'} = ${perlScalar(p.example)};`).join('\n')
|
|
133
133
|
: ''
|
|
134
134
|
|
|
135
|
-
const entidEnvVar = `${PROJECTNAME}_TEST_${
|
|
135
|
+
const entidEnvVar = `${PROJECTNAME}_TEST_${envToken(entity.name)}_ENTID`
|
|
136
136
|
|
|
137
137
|
File({ name: entity.name + '_direct.t' }, () => {
|
|
138
138
|
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
each,
|
|
18
18
|
buildIdNames,
|
|
19
19
|
getMatchEntries,
|
|
20
|
-
isAuthActive,
|
|
20
|
+
isAuthActive, envName, envToken
|
|
21
21
|
} from '@voxgig/sdkgen'
|
|
22
22
|
|
|
23
23
|
|
|
@@ -48,8 +48,8 @@ const TestEntity = cmp(function TestEntity(props: any) {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
const N = model.const.Name
|
|
51
|
-
const PROJUPPER =
|
|
52
|
-
const ENTUPPER = entity.name
|
|
51
|
+
const PROJUPPER = envName(model)
|
|
52
|
+
const ENTUPPER = envToken(entity.name)
|
|
53
53
|
const ENTIDVAR = `${PROJUPPER}_TEST_${ENTUPPER}_ENTID`
|
|
54
54
|
|
|
55
55
|
const authActive = isAuthActive(model)
|
|
@@ -263,7 +263,7 @@ const generateCreate: OpGen = (ctx, step, index) => {
|
|
|
263
263
|
|
|
264
264
|
Content(`
|
|
265
265
|
$V{${datavar}_result} = $V{${entvar}}->create($V{${datavar}}, undef);
|
|
266
|
-
$V{${datavar}} = ${N}Helpers::to_map($V{${datavar}_result});
|
|
266
|
+
$V{${datavar}} = ${N}Helpers::to_map(ref($V{${datavar}_result}) && $V{${datavar}_result}->can('data_get') ? $V{${datavar}_result}->data_get : $V{${datavar}_result});
|
|
267
267
|
ok(defined $V{${datavar}}, '${entity.name} create: data');
|
|
268
268
|
`)
|
|
269
269
|
if (null != ctx.entity.id) {
|
|
@@ -395,7 +395,7 @@ const generateUpdate: OpGen = (ctx, step, index) => {
|
|
|
395
395
|
|
|
396
396
|
Content(`
|
|
397
397
|
$V{${resdatavar}_result} = $V{${entvar}}->update($V{${datavar}_up}, undef);
|
|
398
|
-
$V{${resdatavar}} = ${N}Helpers::to_map($V{${resdatavar}_result});
|
|
398
|
+
$V{${resdatavar}} = ${N}Helpers::to_map(ref($V{${resdatavar}_result}) && $V{${resdatavar}_result}->can('data_get') ? $V{${resdatavar}_result}->data_get : $V{${resdatavar}_result});
|
|
399
399
|
ok(defined $V{${resdatavar}}, '${entity.name} update: data');
|
|
400
400
|
`)
|
|
401
401
|
if (hasEntIdU) {
|
|
@@ -460,7 +460,7 @@ const generateLoad: OpGen = (ctx, step, index) => {
|
|
|
460
460
|
'id' => $V{${srcdatavar}}{id},
|
|
461
461
|
};
|
|
462
462
|
$V{${datavar}_loaded} = $V{${entvar}}->load($V{${matchvar}}, undef);
|
|
463
|
-
$V{${datavar}_load_result} = ${N}Helpers::to_map($V{${datavar}_loaded});
|
|
463
|
+
$V{${datavar}_load_result} = ${N}Helpers::to_map(ref($V{${datavar}_loaded}) && $V{${datavar}_loaded}->can('data_get') ? $V{${datavar}_loaded}->data_get : $V{${datavar}_loaded});
|
|
464
464
|
ok(defined $V{${datavar}_load_result}, '${entity.name} load: data');
|
|
465
465
|
is($V{${datavar}_load_result}{id}, $V{${srcdatavar}}{id}, '${entity.name} load: id');
|
|
466
466
|
`)
|
|
@@ -33,6 +33,7 @@ sub new {
|
|
|
33
33
|
_utility => $client->get_utility,
|
|
34
34
|
_entopts => $entopts,
|
|
35
35
|
_data => {},
|
|
36
|
+
_deleted => 0,
|
|
36
37
|
_match => {},
|
|
37
38
|
}, $class;
|
|
38
39
|
|
|
@@ -57,6 +58,22 @@ sub make {
|
|
|
57
58
|
return EntyClass->new($self->{_client}, $opts);
|
|
58
59
|
}
|
|
59
60
|
|
|
61
|
+
# Every operation resolves to the entity; `remove` additionally marks
|
|
62
|
+
# it. The instance KEEPS the data it held — a caller can still read what
|
|
63
|
+
# was deleted — but it is no longer a live record. See AGENTS.md.
|
|
64
|
+
sub mark_deleted {
|
|
65
|
+
my ($self) = @_;
|
|
66
|
+
$self->{_deleted} = 1;
|
|
67
|
+
return $self;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
sub deleted {
|
|
72
|
+
my ($self) = @_;
|
|
73
|
+
return $self->{_deleted} ? 1 : 0;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
|
|
60
77
|
sub data_set {
|
|
61
78
|
my ($self, $args) = @_;
|
|
62
79
|
if ($args) {
|
|
@@ -222,7 +239,25 @@ sub _run_op {
|
|
|
222
239
|
|
|
223
240
|
$post_done->();
|
|
224
241
|
|
|
225
|
-
$utility->{done}->($ctx);
|
|
242
|
+
my $out = $utility->{done}->($ctx);
|
|
243
|
+
|
|
244
|
+
# An operation resolves to the ENTITY, not the raw data. Entities are
|
|
245
|
+
# stateful: post_done has just absorbed resdata/resmatch into this
|
|
246
|
+
# instance, and the caller reaches the record through data(). Two
|
|
247
|
+
# structural exceptions: `list` resolves to the ARRAY of entity
|
|
248
|
+
# instances make_result built, and a failed op with throwing disabled
|
|
249
|
+
# hands back the error payload unchanged. `remove` additionally marks
|
|
250
|
+
# the entity deleted; it KEEPS its data, so a caller can still read
|
|
251
|
+
# what was removed. See AGENTS.md "Entity operations return ENTITIES".
|
|
252
|
+
my $opname = $ctx->{op} ? $ctx->{op}{name} : undef;
|
|
253
|
+
|
|
254
|
+
if ($ctx->{result} && $ctx->{result}{ok}
|
|
255
|
+
&& (!defined $opname || $opname ne 'list')) {
|
|
256
|
+
$self->mark_deleted if defined $opname && $opname eq 'remove';
|
|
257
|
+
return $self;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
$out;
|
|
226
261
|
};
|
|
227
262
|
if (my $operr = $@) {
|
|
228
263
|
# #PreUnexpected-Hook
|