@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
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
File,
|
|
5
5
|
cmp,
|
|
6
6
|
collectDeps,
|
|
7
|
+
packageVersion,
|
|
7
8
|
} from '@voxgig/sdkgen'
|
|
8
9
|
|
|
9
10
|
|
|
@@ -30,7 +31,7 @@ const Package = cmp(async function Package(props: any) {
|
|
|
30
31
|
File({ name: 'Cargo.toml' }, () => {
|
|
31
32
|
Content(`[package]
|
|
32
33
|
name = "${crateName(model)}"
|
|
33
|
-
version = "
|
|
34
|
+
version = "${packageVersion(model, target.name)}"
|
|
34
35
|
edition = "2021"
|
|
35
36
|
description = "${model.const.Name} SDK for Rust (generated by @voxgig/sdkgen)"
|
|
36
37
|
license = "MIT"
|
|
@@ -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
|
|
|
@@ -63,7 +63,7 @@ const TestDirect = cmp(function TestDirect(props: any) {
|
|
|
63
63
|
const entity: ModelEntity = props.entity
|
|
64
64
|
const rustcrate: string = props.rustcrate
|
|
65
65
|
|
|
66
|
-
const PROJECTNAME =
|
|
66
|
+
const PROJECTNAME = envName(model)
|
|
67
67
|
|
|
68
68
|
const authActive = isAuthActive(model)
|
|
69
69
|
const apikeyEnvEntry = authActive
|
|
@@ -112,7 +112,7 @@ const TestDirect = cmp(function TestDirect(props: any) {
|
|
|
112
112
|
const listPath = listPoint ? normalizePathParams(listPoint.parts || [], listPoint?.args?.params || [], listPoint?.rename?.param) : ''
|
|
113
113
|
const listParams = listPoint?.args?.params || []
|
|
114
114
|
|
|
115
|
-
const entidEnvVar = `${PROJECTNAME}_TEST_${
|
|
115
|
+
const entidEnvVar = `${PROJECTNAME}_TEST_${envToken(entity.name)}_ENTID`
|
|
116
116
|
|
|
117
117
|
const evar = rustVarName(entity.name)
|
|
118
118
|
|
|
@@ -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
|
|
|
@@ -51,8 +51,8 @@ const TestEntity = cmp(function TestEntity(props: any) {
|
|
|
51
51
|
return
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
const PROJUPPER =
|
|
55
|
-
const ENTUPPER = entity.name
|
|
54
|
+
const PROJUPPER = envName(model)
|
|
55
|
+
const ENTUPPER = envToken(entity.name)
|
|
56
56
|
|
|
57
57
|
const authActive = isAuthActive(model)
|
|
58
58
|
const apikeyEnvEntry = authActive
|
|
@@ -351,7 +351,7 @@ const generateCreate: OpGen = (ctx, step, index) => {
|
|
|
351
351
|
let ${datavar}_result = ${entvar}
|
|
352
352
|
.create(${datavar}.clone(), Value::Noval)
|
|
353
353
|
.expect("create failed");
|
|
354
|
-
let ${datavar} = to_map(&${datavar}_result);
|
|
354
|
+
let ${datavar} = to_map(&${datavar}_result.data(None));
|
|
355
355
|
assert!(
|
|
356
356
|
matches!(${datavar}, Value::Map(_)),
|
|
357
357
|
"expected create result to be a map"
|
|
@@ -403,10 +403,9 @@ const generateList: OpGen = (ctx, step, index) => {
|
|
|
403
403
|
let ${listvar} = ${entvar}
|
|
404
404
|
.list(${matchvar}.clone(), Value::Noval)
|
|
405
405
|
.expect("list failed");
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
);
|
|
406
|
+
// list resolves to one ENTITY per record; the flow asserts on the
|
|
407
|
+
// records, so map each through data().
|
|
408
|
+
let ${listvar} = ja(${listvar}.iter().map(|e| e.data(None)).collect::<Vec<Value>>());
|
|
410
409
|
`)
|
|
411
410
|
|
|
412
411
|
// Validators from step.valid.
|
|
@@ -507,7 +506,7 @@ const generateUpdate: OpGen = (ctx, step, index) => {
|
|
|
507
506
|
let ${resdatavar}_result = ${entvar}
|
|
508
507
|
.update(${datavar}_up.clone(), Value::Noval)
|
|
509
508
|
.expect("update failed");
|
|
510
|
-
let ${resdatavar} = to_map(&${resdatavar}_result);
|
|
509
|
+
let ${resdatavar} = to_map(&${resdatavar}_result.data(None));
|
|
511
510
|
assert!(
|
|
512
511
|
matches!(${resdatavar}, Value::Map(_)),
|
|
513
512
|
"expected update result to be a map"
|
|
@@ -586,7 +585,7 @@ const generateLoad: OpGen = (ctx, step, index) => {
|
|
|
586
585
|
let ${datavar}_loaded = ${entvar}
|
|
587
586
|
.load(${matchvar}.clone(), Value::Noval)
|
|
588
587
|
.expect("load failed");
|
|
589
|
-
let ${datavar}_load_result = to_map(&${datavar}_loaded);
|
|
588
|
+
let ${datavar}_load_result = to_map(&${datavar}_loaded.data(None));
|
|
590
589
|
assert!(
|
|
591
590
|
matches!(${datavar}_load_result, Value::Map(_)),
|
|
592
591
|
"expected load result to be a map"
|
|
@@ -603,9 +602,10 @@ const generateLoad: OpGen = (ctx, step, index) => {
|
|
|
603
602
|
let ${datavar}_loaded = ${entvar}
|
|
604
603
|
.load(${matchvar}.clone(), Value::Noval)
|
|
605
604
|
.expect("load failed");
|
|
605
|
+
// load resolves to the ENTITY; the record is reached through data().
|
|
606
606
|
assert!(
|
|
607
|
-
!${datavar}_loaded.is_noval(),
|
|
608
|
-
"expected load result to
|
|
607
|
+
!${datavar}_loaded.data(None).is_noval(),
|
|
608
|
+
"expected load result to carry data"
|
|
609
609
|
);
|
|
610
610
|
`)
|
|
611
611
|
}
|
|
@@ -24,6 +24,8 @@ pub struct EntyClass {
|
|
|
24
24
|
data: RefCell<Value>,
|
|
25
25
|
mtch: RefCell<Value>,
|
|
26
26
|
entctx: RefCell<Option<Rc<Context>>>,
|
|
27
|
+
// Set once a successful `remove` resolves on this instance.
|
|
28
|
+
deleted: RefCell<bool>,
|
|
27
29
|
}
|
|
28
30
|
|
|
29
31
|
impl EntyClass {
|
|
@@ -46,6 +48,7 @@ impl EntyClass {
|
|
|
46
48
|
data: RefCell::new(Value::empty_map()),
|
|
47
49
|
mtch: RefCell::new(Value::empty_map()),
|
|
48
50
|
entctx: RefCell::new(None),
|
|
51
|
+
deleted: RefCell::new(false),
|
|
49
52
|
});
|
|
50
53
|
|
|
51
54
|
let entctx = e.utility.make_context(
|
|
@@ -71,6 +74,10 @@ impl EntyClass {
|
|
|
71
74
|
.expect("entity context not initialised")
|
|
72
75
|
}
|
|
73
76
|
|
|
77
|
+
// Runs the pipeline and returns the terminal result VALUE. The entity
|
|
78
|
+
// contract lives one level up, in the op methods below: they call this,
|
|
79
|
+
// then hand back the entity (see AGENTS.md). It is split that way because
|
|
80
|
+
// `Value` is a closed data union that cannot carry an entity.
|
|
74
81
|
fn run_op(
|
|
75
82
|
&self,
|
|
76
83
|
ctx: &Rc<Context>,
|
|
@@ -232,6 +239,17 @@ impl Entity for EntyClass {
|
|
|
232
239
|
self.name.clone()
|
|
233
240
|
}
|
|
234
241
|
|
|
242
|
+
// `remove` resolves to the entity, marked. The instance KEEPS the data
|
|
243
|
+
// it held — a caller can still read what was deleted — but it is no
|
|
244
|
+
// longer a live record.
|
|
245
|
+
fn mark_deleted(&self) {
|
|
246
|
+
*self.deleted.borrow_mut() = true;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
fn deleted(&self) -> bool {
|
|
250
|
+
*self.deleted.borrow()
|
|
251
|
+
}
|
|
252
|
+
|
|
235
253
|
fn make(&self) -> Rc<dyn Entity> {
|
|
236
254
|
let opts = Value::empty_map();
|
|
237
255
|
if let Value::Map(m) = &self.entopts {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// EJECT-START
|
|
2
2
|
|
|
3
|
-
fn create(
|
|
3
|
+
fn create(self: &Rc<Self>, reqdata: Value, ctrl: Value) -> Result<Rc<Self>, ProjectNameError> {
|
|
4
4
|
let ctx = self.utility.make_context(
|
|
5
5
|
CtxSpec {
|
|
6
6
|
opname: Some("create".to_string()),
|
|
@@ -23,7 +23,13 @@ fn create(&self, reqdata: Value, ctrl: Value) -> Result<Value, ProjectNameError>
|
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
})
|
|
26
|
+
})?;
|
|
27
|
+
|
|
28
|
+
// The operation resolves to THIS entity: `run_op` has just absorbed the
|
|
29
|
+
// result into it, and the caller reaches the record through `.data(None)`.
|
|
30
|
+
// See AGENTS.md "Entity operations return ENTITIES".
|
|
31
|
+
|
|
32
|
+
Ok(self.clone())
|
|
27
33
|
}
|
|
28
34
|
|
|
29
35
|
// EJECT-END
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// EJECT-START
|
|
2
2
|
|
|
3
|
-
fn list(
|
|
3
|
+
fn list(self: &Rc<Self>, reqmatch: Value, ctrl: Value) -> Result<Vec<Rc<Self>>, ProjectNameError> {
|
|
4
4
|
let ctx = self.utility.make_context(
|
|
5
5
|
CtxSpec {
|
|
6
6
|
opname: Some("list".to_string()),
|
|
@@ -13,14 +13,31 @@ fn list(&self, reqmatch: Value, ctrl: Value) -> Result<Value, ProjectNameError>
|
|
|
13
13
|
Some(&self.ent_ctx()),
|
|
14
14
|
);
|
|
15
15
|
|
|
16
|
-
self.run_op(&ctx, &|ctx| {
|
|
16
|
+
let out = self.run_op(&ctx, &|ctx| {
|
|
17
17
|
if let Some(result) = ctx.result.borrow().clone() {
|
|
18
18
|
let resmatch = result.borrow().resmatch.clone();
|
|
19
19
|
if let Value::Map(_) = resmatch {
|
|
20
20
|
*self.mtch.borrow_mut() = resmatch;
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
-
})
|
|
23
|
+
})?;
|
|
24
|
+
|
|
25
|
+
// `list` resolves to one ENTITY per record. makeResult cannot build them
|
|
26
|
+
// here — it works in `Value`, which is a closed data union with no slot
|
|
27
|
+
// for an entity — so the op does, mirroring what the dynamic targets get
|
|
28
|
+
// from makeResult. See AGENTS.md "Entity operations return ENTITIES".
|
|
29
|
+
let mut items: Vec<Rc<Self>> = Vec::new();
|
|
30
|
+
if let Value::List(list) = &out {
|
|
31
|
+
for entry in list.borrow().iter() {
|
|
32
|
+
let ent = EntyClass::new(&self.client, vs::clone(&self.entopts));
|
|
33
|
+
if let Value::Map(_) = entry {
|
|
34
|
+
ent.data(Some(entry));
|
|
35
|
+
}
|
|
36
|
+
items.push(ent);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
Ok(items)
|
|
24
41
|
}
|
|
25
42
|
|
|
26
43
|
// EJECT-END
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// EJECT-START
|
|
2
2
|
|
|
3
|
-
fn load(
|
|
3
|
+
fn load(self: &Rc<Self>, reqmatch: Value, ctrl: Value) -> Result<Rc<Self>, ProjectNameError> {
|
|
4
4
|
let ctx = self.utility.make_context(
|
|
5
5
|
CtxSpec {
|
|
6
6
|
opname: Some("load".to_string()),
|
|
@@ -29,7 +29,13 @@ fn load(&self, reqmatch: Value, ctrl: Value) -> Result<Value, ProjectNameError>
|
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
})
|
|
32
|
+
})?;
|
|
33
|
+
|
|
34
|
+
// The operation resolves to THIS entity: `run_op` has just absorbed the
|
|
35
|
+
// result into it, and the caller reaches the record through `.data(None)`.
|
|
36
|
+
// See AGENTS.md "Entity operations return ENTITIES".
|
|
37
|
+
|
|
38
|
+
Ok(self.clone())
|
|
33
39
|
}
|
|
34
40
|
|
|
35
41
|
// EJECT-END
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// EJECT-START
|
|
2
2
|
|
|
3
|
-
fn remove(
|
|
3
|
+
fn remove(self: &Rc<Self>, reqmatch: Value, ctrl: Value) -> Result<Rc<Self>, ProjectNameError> {
|
|
4
4
|
let ctx = self.utility.make_context(
|
|
5
5
|
CtxSpec {
|
|
6
6
|
opname: Some("remove".to_string()),
|
|
@@ -29,7 +29,15 @@ fn remove(&self, reqmatch: Value, ctrl: Value) -> Result<Value, ProjectNameError
|
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
})
|
|
32
|
+
})?;
|
|
33
|
+
|
|
34
|
+
// The operation resolves to THIS entity: `run_op` has just absorbed the
|
|
35
|
+
// result into it, and the caller reaches the record through `.data(None)`.
|
|
36
|
+
// See AGENTS.md "Entity operations return ENTITIES". A removed entity
|
|
37
|
+
// keeps its data but is no longer a live record.
|
|
38
|
+
self.mark_deleted();
|
|
39
|
+
|
|
40
|
+
Ok(self.clone())
|
|
33
41
|
}
|
|
34
42
|
|
|
35
43
|
// EJECT-END
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// EJECT-START
|
|
2
2
|
|
|
3
|
-
fn update(
|
|
3
|
+
fn update(self: &Rc<Self>, reqdata: Value, ctrl: Value) -> Result<Rc<Self>, ProjectNameError> {
|
|
4
4
|
let ctx = self.utility.make_context(
|
|
5
5
|
CtxSpec {
|
|
6
6
|
opname: Some("update".to_string()),
|
|
@@ -29,7 +29,13 @@ fn update(&self, reqdata: Value, ctrl: Value) -> Result<Value, ProjectNameError>
|
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
})
|
|
32
|
+
})?;
|
|
33
|
+
|
|
34
|
+
// The operation resolves to THIS entity: `run_op` has just absorbed the
|
|
35
|
+
// result into it, and the caller reaches the record through `.data(None)`.
|
|
36
|
+
// See AGENTS.md "Entity operations return ENTITIES".
|
|
37
|
+
|
|
38
|
+
Ok(self.clone())
|
|
33
39
|
}
|
|
34
40
|
|
|
35
41
|
// EJECT-END
|
|
@@ -11,6 +11,11 @@ pub struct ProjectNameError {
|
|
|
11
11
|
// Cleaned snapshots attached by makeError (Noval until then).
|
|
12
12
|
pub result: Value,
|
|
13
13
|
pub spec: Value,
|
|
14
|
+
// HTTP status of the response that caused this error, or -1 when the
|
|
15
|
+
// request never got one. PROMOTED to the top level: it used to be
|
|
16
|
+
// reachable only inside `result`, so every consumer coupled itself to
|
|
17
|
+
// the internal shape of that snapshot.
|
|
18
|
+
pub status: i64,
|
|
14
19
|
}
|
|
15
20
|
|
|
16
21
|
impl ProjectNameError {
|
|
@@ -21,8 +26,13 @@ impl ProjectNameError {
|
|
|
21
26
|
msg: msg.to_string(),
|
|
22
27
|
result: Value::Noval,
|
|
23
28
|
spec: Value::Noval,
|
|
29
|
+
status: -1,
|
|
24
30
|
}
|
|
25
31
|
}
|
|
32
|
+
|
|
33
|
+
pub fn not_found(&self) -> bool {
|
|
34
|
+
404 == self.status
|
|
35
|
+
}
|
|
26
36
|
}
|
|
27
37
|
|
|
28
38
|
impl std::fmt::Display for ProjectNameError {
|
|
@@ -51,7 +51,8 @@ const ReadmeHowto = cmp(function ReadmeHowto(props: any) {
|
|
|
51
51
|
// The op-driven test-mode line, shown only when the SDK has an entity op.
|
|
52
52
|
// A direct()-only SDK (no ops anywhere) shows a direct() call instead.
|
|
53
53
|
const testModeExample = primaryOp
|
|
54
|
-
? `// Entity ops return the
|
|
54
|
+
? `// Entity ops return the ENTITY and raises on error;
|
|
55
|
+
// call data() for the record.
|
|
55
56
|
val ${eVar} = client.${accessor}(null).${primaryOp}(${testArg}, null)
|
|
56
57
|
// ${eVar} holds the mock response record
|
|
57
58
|
println(${eVar})`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, Content, isPublished, repoInfo } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, Content, isPublished, repoInfo, packageVersion } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import { mavenGroupId } from './utility_scala'
|
|
5
5
|
|
|
@@ -15,13 +15,13 @@ const ReadmeInstall = cmp(function ReadmeInstall(props: any) {
|
|
|
15
15
|
Content(`Add the dependency with scala-cli:
|
|
16
16
|
|
|
17
17
|
\`\`\`scala
|
|
18
|
-
//> using dep "${groupId}:${artifactId}_3
|
|
18
|
+
//> using dep "${groupId}:${artifactId}_3:${packageVersion(model, target.name)}"
|
|
19
19
|
\`\`\`
|
|
20
20
|
|
|
21
21
|
Or, with sbt:
|
|
22
22
|
|
|
23
23
|
\`\`\`scala
|
|
24
|
-
libraryDependencies += "${groupId}" %% "${artifactId}" % "
|
|
24
|
+
libraryDependencies += "${groupId}" %% "${artifactId}" % "${packageVersion(model, target.name)}"
|
|
25
25
|
\`\`\`
|
|
26
26
|
|
|
27
27
|
Or build from a source checkout — the SDK is a plain scala-cli project:
|
|
@@ -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() for the record) (a \`Map\` for single-entity
|
|
97
97
|
ops, an aggregate \`List\` for \`list\`) as \`Object\` and raise on error. Wrap
|
|
98
98
|
calls in \`try\`/\`catch\` to handle failures.
|
|
99
99
|
|
|
@@ -123,7 +123,7 @@ catch {
|
|
|
123
123
|
Content(`### 3. Load ${neArticle} ${neName.toLowerCase()}
|
|
124
124
|
|
|
125
125
|
${neName} is nested under ${parentName}, so provide the \`${parentParam}\`.
|
|
126
|
-
\`load()\` returns the
|
|
126
|
+
\`load()\` returns the ENTITY — call data() for the record — and raises on error.
|
|
127
127
|
|
|
128
128
|
\`\`\`scala
|
|
129
129
|
try {
|
|
@@ -151,7 +151,7 @@ catch {
|
|
|
151
151
|
|
|
152
152
|
Content(`### 3. Load ${article} ${eName.toLowerCase()}
|
|
153
153
|
|
|
154
|
-
\`load()\` returns the
|
|
154
|
+
\`load()\` returns the ENTITY — call data() for the record — and raises on error.
|
|
155
155
|
|
|
156
156
|
\`\`\`scala
|
|
157
157
|
try {
|
|
@@ -191,7 +191,7 @@ catch {
|
|
|
191
191
|
\`\`\`scala
|
|
192
192
|
`)
|
|
193
193
|
if (opnames.includes('create')) {
|
|
194
|
-
Content(`// Create — returns the
|
|
194
|
+
Content(`// Create — returns the ENTITY (call data() for the record)
|
|
195
195
|
val created = client.${accessor}(null).create(java.util.Map.of(${examplePairs('create').join(', ')}), null)
|
|
196
196
|
|
|
197
197
|
`)
|
|
@@ -181,7 +181,7 @@ const generateCreate: OpGen = (ctx, step, index) => {
|
|
|
181
181
|
}
|
|
182
182
|
|
|
183
183
|
Content(` val ${datavar}Result = ${entvar}.create(${datavar}, null)
|
|
184
|
-
${datavar} = Helpers.toMapAny(${datavar}Result)
|
|
184
|
+
${datavar} = Helpers.toMapAny(${datavar}Result match { case e: SdkEntity => e.data(); case o => o })
|
|
185
185
|
rep.check("${ENTLOWER}.create.map", ${datavar} != null, "expected create result to be a map")
|
|
186
186
|
`)
|
|
187
187
|
if (null != entityDataIdField(entity)) {
|
|
@@ -312,7 +312,7 @@ const generateUpdate: OpGen = (ctx, step, index) => {
|
|
|
312
312
|
}
|
|
313
313
|
|
|
314
314
|
Content(` val ${resdatavar}Result = ${entvar}.update(${datavar}Up, null)
|
|
315
|
-
val ${resdatavar} = Helpers.toMapAny(${resdatavar}Result)
|
|
315
|
+
val ${resdatavar} = Helpers.toMapAny(${resdatavar}Result match { case e: SdkEntity => e.data(); case o => o })
|
|
316
316
|
rep.check("${ENTLOWER}.update.map", ${resdatavar} != null, "expected update result to be a map")
|
|
317
317
|
`)
|
|
318
318
|
if (hasDataId) {
|
|
@@ -369,7 +369,7 @@ const generateLoad: OpGen = (ctx, step, index) => {
|
|
|
369
369
|
if (hasDataId) {
|
|
370
370
|
Content(` ${matchvar}.put("id", ${srcdatavar}.get("id"))
|
|
371
371
|
val ${datavar}Loaded = ${entvar}.load(${matchvar}, null)
|
|
372
|
-
val ${datavar}LoadResult = Helpers.toMapAny(${datavar}Loaded)
|
|
372
|
+
val ${datavar}LoadResult = Helpers.toMapAny(${datavar}Loaded match { case e: SdkEntity => e.data(); case o => o })
|
|
373
373
|
rep.check("${ENTLOWER}.load.map", ${datavar}LoadResult != null, "expected load result to be a map")
|
|
374
374
|
rep.eq("${ENTLOWER}.load.id", ${srcdatavar}.get("id"), ${datavar}LoadResult.get("id"))
|
|
375
375
|
`)
|
|
@@ -60,6 +60,16 @@ abstract class EntityBase(name0: String, client0: SdkClient, entopts0: JMap[Stri
|
|
|
60
60
|
// runOp drives one operation through the pipeline: for each stage the
|
|
61
61
|
// feature hook fires, then the stage runs; a failing stage routes through
|
|
62
62
|
// makeError (which throws, or returns fallback data when ctrl.throw false).
|
|
63
|
+
// Every operation resolves to the entity; `remove` additionally marks
|
|
64
|
+
// it. The instance KEEPS the data it held — a caller can still read
|
|
65
|
+
// what was deleted — but it is no longer a live record. See AGENTS.md.
|
|
66
|
+
private var deletedFlag: Boolean = false
|
|
67
|
+
|
|
68
|
+
def markDeleted(): Unit = { deletedFlag = true }
|
|
69
|
+
|
|
70
|
+
def deleted(): Boolean = deletedFlag
|
|
71
|
+
|
|
72
|
+
|
|
63
73
|
protected def runOp(ctx: Context, postDone: () => Unit): Object = {
|
|
64
74
|
val utility = this.utility
|
|
65
75
|
|
|
@@ -93,7 +103,23 @@ abstract class EntityBase(name0: String, client0: SdkClient, entopts0: JMap[Stri
|
|
|
93
103
|
|
|
94
104
|
postDone()
|
|
95
105
|
|
|
96
|
-
utility.done(ctx)
|
|
106
|
+
val out = utility.done(ctx)
|
|
107
|
+
|
|
108
|
+
// An operation resolves to the ENTITY, not the raw data. Entities are
|
|
109
|
+
// stateful: postDone has just absorbed resdata/resmatch into this
|
|
110
|
+
// instance, and the caller reaches the record through data(). Two
|
|
111
|
+
// structural exceptions: `list` resolves to the ARRAY of entity
|
|
112
|
+
// instances makeResult built, and a failed op with throwing disabled
|
|
113
|
+
// hands back the error payload unchanged. `remove` additionally marks
|
|
114
|
+
// the entity deleted; it KEEPS its data, so a caller can still read
|
|
115
|
+
// what was removed. See AGENTS.md "Entity operations return ENTITIES".
|
|
116
|
+
val opname = if (ctx.op == null) null else ctx.op.name
|
|
117
|
+
|
|
118
|
+
if (ctx.result != null && ctx.result.ok && "list" != opname) {
|
|
119
|
+
if ("remove" == opname) markDeleted()
|
|
120
|
+
this
|
|
121
|
+
}
|
|
122
|
+
else out
|
|
97
123
|
} catch {
|
|
98
124
|
case err: RuntimeException =>
|
|
99
125
|
// An error already finalised by makeError must not be wrapped twice.
|
|
@@ -51,7 +51,8 @@ const ReadmeHowto = cmp(function ReadmeHowto(props: any) {
|
|
|
51
51
|
// The op-driven test-mode line, shown only when the SDK has an entity op.
|
|
52
52
|
// A direct()-only SDK (no ops anywhere) shows a direct() call instead.
|
|
53
53
|
const testModeExample = primaryOp
|
|
54
|
-
? `// Entity ops return the
|
|
54
|
+
? `// Entity ops return the ENTITY and throws on error;
|
|
55
|
+
// call data() for the record.
|
|
55
56
|
let ${eVar} = try client.${eName}().${primaryOp}(${testArg}, nil)
|
|
56
57
|
// ${eVar} holds the mock response record
|
|
57
58
|
print(${eVar})`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, Content, isPublished, repoInfo } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, Content, isPublished, repoInfo, packageVersion } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
const ReadmeInstall = cmp(function ReadmeInstall(props: any) {
|
|
@@ -11,7 +11,7 @@ const ReadmeInstall = cmp(function ReadmeInstall(props: any) {
|
|
|
11
11
|
|
|
12
12
|
\`\`\`swift
|
|
13
13
|
dependencies: [
|
|
14
|
-
.package(url: "<repo-url>", from: "
|
|
14
|
+
.package(url: "<repo-url>", from: "${packageVersion(model, target.name)}"),
|
|
15
15
|
],
|
|
16
16
|
\`\`\`
|
|
17
17
|
|
|
@@ -39,7 +39,7 @@ your \`Package.swift\`:
|
|
|
39
39
|
\`\`\`swift
|
|
40
40
|
dependencies: [
|
|
41
41
|
// From the git release tag:
|
|
42
|
-
.package(url: "<repo-url>", exact: "
|
|
42
|
+
.package(url: "<repo-url>", exact: "${packageVersion(model, target.name)}"),
|
|
43
43
|
],
|
|
44
44
|
\`\`\`
|
|
45
45
|
|
|
@@ -92,7 +92,7 @@ ${opRows}
|
|
|
92
92
|
|
|
93
93
|
### Result shape
|
|
94
94
|
|
|
95
|
-
Entity operations return the
|
|
95
|
+
Entity operations return the ENTITY (call data() for the record) (a \`Value\` map for
|
|
96
96
|
single-entity ops, a \`Value\` list for \`list\`) and throw on error. Wrap
|
|
97
97
|
calls in \`do\`/\`catch\` to handle failures.
|
|
98
98
|
|
|
@@ -125,7 +125,7 @@ catch {
|
|
|
125
125
|
Content(`### 3. Load ${neArticle} ${neName.toLowerCase()}
|
|
126
126
|
|
|
127
127
|
${neName} is nested under ${parentName}, so provide the \`${parentParam}\`.
|
|
128
|
-
\`load()\` returns the
|
|
128
|
+
\`load()\` returns the ENTITY — call data() for the record — and throws on error.
|
|
129
129
|
|
|
130
130
|
\`\`\`swift
|
|
131
131
|
do {
|
|
@@ -153,7 +153,7 @@ catch {
|
|
|
153
153
|
|
|
154
154
|
Content(`### 3. Load ${article} ${eName.toLowerCase()}
|
|
155
155
|
|
|
156
|
-
\`load()\` returns the
|
|
156
|
+
\`load()\` returns the ENTITY — call data() for the record — and throws on error.
|
|
157
157
|
|
|
158
158
|
\`\`\`swift
|
|
159
159
|
do {
|
|
@@ -193,7 +193,7 @@ catch {
|
|
|
193
193
|
\`\`\`swift
|
|
194
194
|
`)
|
|
195
195
|
if (opnames.includes('create')) {
|
|
196
|
-
Content(`// Create — returns the
|
|
196
|
+
Content(`// Create — returns the ENTITY (call data() for the record)
|
|
197
197
|
let created = try client.${accessor}().create(VMap([${examplePairs('create').join(', ')}]), nil)
|
|
198
198
|
|
|
199
199
|
`)
|
|
@@ -84,6 +84,20 @@ open class ProjectNameEntityBase: Entity {
|
|
|
84
84
|
throw unsupportedOp("remove", name)
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
+
// Every operation resolves to the entity; `remove` additionally marks
|
|
88
|
+
// it. The instance KEEPS the data it held — a caller can still read
|
|
89
|
+
// what was deleted — but it is no longer a live record. See AGENTS.md.
|
|
90
|
+
private var deletedFlag: Bool = false
|
|
91
|
+
|
|
92
|
+
public func markDeleted() {
|
|
93
|
+
self.deletedFlag = true
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
public func deleted() -> Bool {
|
|
97
|
+
return self.deletedFlag
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
|
|
87
101
|
func runOp(_ ctx: Context, _ postDone: () -> Void) throws -> Value {
|
|
88
102
|
// #PrePoint-Hook
|
|
89
103
|
|
|
@@ -134,7 +148,26 @@ open class ProjectNameEntityBase: Entity {
|
|
|
134
148
|
|
|
135
149
|
postDone()
|
|
136
150
|
|
|
137
|
-
|
|
151
|
+
let out = try utility.done(ctx)
|
|
152
|
+
|
|
153
|
+
// An operation resolves to the ENTITY, not the raw data. Entities are
|
|
154
|
+
// stateful: postDone has just absorbed resdata/resmatch into this
|
|
155
|
+
// instance, and the caller reaches the record through data(). Two
|
|
156
|
+
// structural exceptions: `list` resolves to the ARRAY of entity
|
|
157
|
+
// instances makeResult built, and a failed op with throwing disabled
|
|
158
|
+
// hands back the error payload unchanged. `remove` additionally marks
|
|
159
|
+
// the entity deleted; it KEEPS its data, so a caller can still read
|
|
160
|
+
// what was removed. See AGENTS.md "Entity operations return ENTITIES".
|
|
161
|
+
let opname = ctx.op?.name
|
|
162
|
+
|
|
163
|
+
if let result = ctx.result, result.ok, "list" != opname {
|
|
164
|
+
if "remove" == opname {
|
|
165
|
+
self.markDeleted()
|
|
166
|
+
}
|
|
167
|
+
return .native(NativeRef(self))
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
return out
|
|
138
171
|
}
|
|
139
172
|
|
|
140
173
|
// Streaming operations. Runs `action` through the full pipeline and returns
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
|
|
2
2
|
import {
|
|
3
3
|
cmp, camelify,
|
|
4
|
-
Content, Fragment
|
|
4
|
+
Content, Fragment,
|
|
5
|
+
entityClassName, entityCollection,
|
|
5
6
|
} from '@voxgig/sdkgen'
|
|
6
7
|
|
|
7
8
|
|
|
@@ -32,6 +33,13 @@ const EntityOperation = cmp(function Operation(props: any) {
|
|
|
32
33
|
SdkName: model.const.Name,
|
|
33
34
|
EntityName: entity.Name,
|
|
34
35
|
entityname: entity.name,
|
|
36
|
+
|
|
37
|
+
// The CLASS token. Operations resolve to the entity instance, so their
|
|
38
|
+
// declared return type must name the class — `Promise<PlanetEntity>`,
|
|
39
|
+
// not `Promise<Planet>` (the data interface). A signature that says
|
|
40
|
+
// the data type while the call resolves to an entity is a lie the
|
|
41
|
+
// compiler cannot catch; see AGENTS.md.
|
|
42
|
+
EntyClass: entityClassName(entity, entityCollection(model)),
|
|
35
43
|
"['POINTS']": formatJson(entop.points, { margin: 6 }).trim(),
|
|
36
44
|
'#Feature-Hook': ({ name, indent }: any) =>
|
|
37
45
|
Content({ indent }, `
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
File, Content,
|
|
22
22
|
} from '@voxgig/sdkgen'
|
|
23
23
|
|
|
24
|
-
import { canonToType, opTypeName, opRequestShape, warnEntityTypeCollisions , deriveEntityNames } from '@voxgig/sdkgen'
|
|
24
|
+
import { canonToType, opTypeName, opRequestShape, warnEntityTypeCollisions , deriveEntityNames, opActions } from '@voxgig/sdkgen'
|
|
25
25
|
|
|
26
26
|
import {
|
|
27
27
|
KIT,
|
|
@@ -108,6 +108,23 @@ const EntityTypes = cmp(function EntityTypes(props: any) {
|
|
|
108
108
|
Content(` ${propKey(it.name)}${opt}: ${canonToType(it.type, LANG)}
|
|
109
109
|
`)
|
|
110
110
|
})
|
|
111
|
+
|
|
112
|
+
// Custom actions are selected with `$action` in the call's argument
|
|
113
|
+
// (see the Actions section of REFERENCE.md). Without it in the type,
|
|
114
|
+
// the ONLY documented way to reach those endpoints does not compile,
|
|
115
|
+
// and a TypeScript caller has to cast — which is how two of one API's
|
|
116
|
+
// six endpoints came to be unreachable from the typed interface.
|
|
117
|
+
const actions = opActions(ops[opname])
|
|
118
|
+
if (0 < actions.length) {
|
|
119
|
+
Content(`
|
|
120
|
+
// Selects a custom action instead of the plain ${opname}:
|
|
121
|
+
// ${actions.map((a: any) => `'` + a.action + `'`).join(' | ')}
|
|
122
|
+
// The remaining keys are that action's own payload.
|
|
123
|
+
$action?: string
|
|
124
|
+
[action: string]: any
|
|
125
|
+
`)
|
|
126
|
+
}
|
|
127
|
+
|
|
111
128
|
Content(`}
|
|
112
129
|
|
|
113
130
|
`)
|