@voxgig/sdkgen 2.0.2 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/voxgig-sdkgen +22 -2
- package/dist/action/doctor.d.ts +14 -0
- package/dist/action/doctor.js +351 -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/ExternalTarget.d.ts +2 -0
- package/dist/cmp/ExternalTarget.js +104 -0
- package/dist/cmp/ExternalTarget.js.map +1 -0
- 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 +16 -1
- package/dist/helpers/packageMeta.js +181 -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 +273 -5
- package/dist/sdkgen.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types.d.ts +12 -0
- package/dist/utility.js +10 -1
- package/dist/utility.js.map +1 -1
- package/model/sdkgen.aontu +245 -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 +16 -1
- package/project/.sdk/model/target/go-mcp.aontu +16 -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 +25 -3
- package/project/.sdk/model/target/js.aontu +15 -3
- package/project/.sdk/model/target/kotlin.aontu +25 -3
- package/project/.sdk/model/target/lean.aontu +24 -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 +15 -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 +24 -3
- package/project/.sdk/model/target/seneca-provider.aontu +118 -0
- 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 +25 -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/seneca-provider/Extras_seneca-provider.ts +3915 -0
- package/project/.sdk/src/cmp/seneca-provider/Main_seneca-provider.ts +960 -0
- 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/seneca-provider/CODE_OF_CONDUCT.md +132 -0
- package/project/.sdk/tm/seneca-provider/LICENSE +21 -0
- package/project/.sdk/tm/seneca-provider/Makefile +15 -0
- package/project/.sdk/tm/seneca-provider/src/tsconfig.json +18 -0
- package/project/.sdk/tm/seneca-provider/test/tsconfig.json +16 -0
- package/project/.sdk/tm/seneca-provider/tsfmt.json +3 -0
- 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 +475 -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/ExternalTarget.ts +125 -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 +211 -10
- package/src/helpers/stdrep.ts +56 -0
- package/src/helpers/testPolicy.ts +52 -0
- package/src/sdkgen.ts +350 -5
- package/src/types.ts +24 -1
- package/src/utility.ts +10 -1
- package/project/.sdk/tm/rust/feature/mod.rs +0 -24
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
snakify,
|
|
19
19
|
isAuthActive,
|
|
20
20
|
jsProp,
|
|
21
|
-
jsOptProp,
|
|
21
|
+
jsOptProp, envName, envToken, liveStrict
|
|
22
22
|
} from '@voxgig/sdkgen'
|
|
23
23
|
|
|
24
24
|
|
|
@@ -37,8 +37,11 @@ const TestDirect = cmp(function TestDirect(props: any) {
|
|
|
37
37
|
|
|
38
38
|
const ff = projectPath('src/cmp/ts/fragment/')
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
const
|
|
40
|
+
// Does a live run ASSERT, or merely observe? See helpers/testPolicy.
|
|
41
|
+
const strict = liveStrict(model, target.name)
|
|
42
|
+
|
|
43
|
+
const PROJECTNAME = envName(model)
|
|
44
|
+
const entidEnvVar = `${PROJECTNAME}_TEST_${envToken(entity.name)}_ENTID`
|
|
42
45
|
|
|
43
46
|
const authActive = isAuthActive(model)
|
|
44
47
|
const apikeyEnvEntry = authActive
|
|
@@ -136,11 +139,11 @@ function unwrapListData(data: any): any[] | null {
|
|
|
136
139
|
Slot({ name: 'direct' }, () => {
|
|
137
140
|
|
|
138
141
|
if (hasLoad) {
|
|
139
|
-
generateDirectLoad(model, entity)
|
|
142
|
+
generateDirectLoad(model, entity, strict)
|
|
140
143
|
}
|
|
141
144
|
|
|
142
145
|
if (hasList) {
|
|
143
|
-
generateDirectList(model, entity)
|
|
146
|
+
generateDirectList(model, entity, strict)
|
|
144
147
|
}
|
|
145
148
|
})
|
|
146
149
|
|
|
@@ -150,7 +153,7 @@ function unwrapListData(data: any): any[] | null {
|
|
|
150
153
|
})
|
|
151
154
|
|
|
152
155
|
|
|
153
|
-
function generateDirectLoad(model: Model, entity: ModelEntity) {
|
|
156
|
+
function generateDirectLoad(model: Model, entity: ModelEntity, strict: boolean) {
|
|
154
157
|
const loadOp = entity.op?.load
|
|
155
158
|
const loadPoint: ModelPoint | undefined = loadOp?.points?.[0]
|
|
156
159
|
|
|
@@ -318,6 +321,31 @@ ${loadParams.map((p: any, i: number) => ` ${jsProp('params', p.name)} = 'di
|
|
|
318
321
|
? ` if (skipIfMissingIds(t, setup, ${JSON.stringify(liveIdKeys)})) return\n`
|
|
319
322
|
: ''
|
|
320
323
|
|
|
324
|
+
// Live-mode leniency is a MODEL decision (main.kit.test.live.strict).
|
|
325
|
+
// The default stays lenient: a fleet SDK generated against an arbitrary
|
|
326
|
+
// public API 4xxes on synthetic IDs, and asserting would mean permanent
|
|
327
|
+
// red. A project that owns its test server wants the opposite — without
|
|
328
|
+
// it, the suite passes with nothing listening on the port.
|
|
329
|
+
const offlineChecks = ` assert(result.ok === true)
|
|
330
|
+
assert(result.status === 200)
|
|
331
|
+
assert(null != result.data)
|
|
332
|
+
assert(result.data.id === 'direct01')
|
|
333
|
+
assert(calls.length === 1)
|
|
334
|
+
assert(calls[0].init.method === 'GET')
|
|
335
|
+
${paramAsserts}`
|
|
336
|
+
|
|
337
|
+
const loadChecks = strict ?
|
|
338
|
+
offlineChecks.replace(/^ {6}/gm, ' ').replace(/^ {4}$/gm, '') :
|
|
339
|
+
` if (setup.live) {
|
|
340
|
+
// Live mode is lenient: synthetic IDs frequently 4xx. Skip rather
|
|
341
|
+
// than fail when the load endpoint isn't reachable with the IDs we
|
|
342
|
+
// can construct from setup.idmap.
|
|
343
|
+
if (!result.ok || result.status < 200 || result.status >= 300) {
|
|
344
|
+
return
|
|
345
|
+
}
|
|
346
|
+
} else {
|
|
347
|
+
${offlineChecks} }`
|
|
348
|
+
|
|
321
349
|
Content(`
|
|
322
350
|
test('direct-load-${entity.name}', async (t: any) => {
|
|
323
351
|
const setup = directSetup({ id: 'direct01' })
|
|
@@ -335,27 +363,13 @@ ${liveParamsBlock}
|
|
|
335
363
|
query,
|
|
336
364
|
})
|
|
337
365
|
|
|
338
|
-
|
|
339
|
-
// Live mode is lenient: synthetic IDs frequently 4xx. Skip rather
|
|
340
|
-
// than fail when the load endpoint isn't reachable with the IDs we
|
|
341
|
-
// can construct from setup.idmap.
|
|
342
|
-
if (!result.ok || result.status < 200 || result.status >= 300) {
|
|
343
|
-
return
|
|
344
|
-
}
|
|
345
|
-
} else {
|
|
346
|
-
assert(result.ok === true)
|
|
347
|
-
assert(result.status === 200)
|
|
348
|
-
assert(null != result.data)
|
|
349
|
-
assert(result.data.id === 'direct01')
|
|
350
|
-
assert(calls.length === 1)
|
|
351
|
-
assert(calls[0].init.method === 'GET')
|
|
352
|
-
${paramAsserts} }
|
|
366
|
+
${loadChecks}
|
|
353
367
|
})
|
|
354
368
|
`)
|
|
355
369
|
}
|
|
356
370
|
|
|
357
371
|
|
|
358
|
-
function generateDirectList(model: Model, entity: ModelEntity) {
|
|
372
|
+
function generateDirectList(model: Model, entity: ModelEntity, strict: boolean) {
|
|
359
373
|
const listOp = entity.op?.list
|
|
360
374
|
const listPoint: ModelPoint | undefined = listOp?.points?.[0]
|
|
361
375
|
|
|
@@ -418,6 +432,33 @@ ${mockLines}
|
|
|
418
432
|
? ` if (skipIfMissingIds(t, setup, ${JSON.stringify(liveIdKeys)})) return\n`
|
|
419
433
|
: ''
|
|
420
434
|
|
|
435
|
+
// See generateDirectLoad: leniency is main.kit.test.live.strict.
|
|
436
|
+
const offlineChecks = ` assert(result.ok === true)
|
|
437
|
+
assert(result.status === 200)
|
|
438
|
+
assert(null != result.data)
|
|
439
|
+
const listArr = unwrapListData(result.data)
|
|
440
|
+
assert(Array.isArray(listArr))
|
|
441
|
+
assert(listArr!.length === 2)
|
|
442
|
+
assert(calls.length === 1)
|
|
443
|
+
assert(calls[0].init.method === 'GET')
|
|
444
|
+
${paramAsserts}`
|
|
445
|
+
|
|
446
|
+
const listChecks = strict ?
|
|
447
|
+
offlineChecks.replace(/^ {6}/gm, ' ').replace(/^ {4}$/gm, '') :
|
|
448
|
+
` if (setup.live) {
|
|
449
|
+
// Live mode is lenient: synthetic IDs frequently 4xx and the list-
|
|
450
|
+
// response shape varies wildly across public APIs. Skip rather than
|
|
451
|
+
// fail when the call doesn't return a usable list.
|
|
452
|
+
if (!result.ok || result.status < 200 || result.status >= 300) {
|
|
453
|
+
return
|
|
454
|
+
}
|
|
455
|
+
const listArr = unwrapListData(result.data)
|
|
456
|
+
if (!Array.isArray(listArr)) {
|
|
457
|
+
return
|
|
458
|
+
}
|
|
459
|
+
} else {
|
|
460
|
+
${offlineChecks} }`
|
|
461
|
+
|
|
421
462
|
Content(`
|
|
422
463
|
test('direct-list-${entity.name}', async (t: any) => {
|
|
423
464
|
const setup = directSetup([{ id: 'direct01' }, { id: 'direct02' }])
|
|
@@ -432,27 +473,7 @@ ${paramsBlock}
|
|
|
432
473
|
query,
|
|
433
474
|
})
|
|
434
475
|
|
|
435
|
-
|
|
436
|
-
// Live mode is lenient: synthetic IDs frequently 4xx and the list-
|
|
437
|
-
// response shape varies wildly across public APIs. Skip rather than
|
|
438
|
-
// fail when the call doesn't return a usable list.
|
|
439
|
-
if (!result.ok || result.status < 200 || result.status >= 300) {
|
|
440
|
-
return
|
|
441
|
-
}
|
|
442
|
-
const listArr = unwrapListData(result.data)
|
|
443
|
-
if (!Array.isArray(listArr)) {
|
|
444
|
-
return
|
|
445
|
-
}
|
|
446
|
-
} else {
|
|
447
|
-
assert(result.ok === true)
|
|
448
|
-
assert(result.status === 200)
|
|
449
|
-
assert(null != result.data)
|
|
450
|
-
const listArr = unwrapListData(result.data)
|
|
451
|
-
assert(Array.isArray(listArr))
|
|
452
|
-
assert(listArr!.length === 2)
|
|
453
|
-
assert(calls.length === 1)
|
|
454
|
-
assert(calls[0].init.method === 'GET')
|
|
455
|
-
${paramAsserts} }
|
|
476
|
+
${listChecks}
|
|
456
477
|
})
|
|
457
478
|
`)
|
|
458
479
|
}
|
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
cmp,
|
|
31
31
|
each,
|
|
32
32
|
isAuthActive,
|
|
33
|
-
entityDataIdField,
|
|
33
|
+
entityDataIdField, envName, envToken
|
|
34
34
|
} from '@voxgig/sdkgen'
|
|
35
35
|
|
|
36
36
|
|
|
@@ -61,8 +61,8 @@ const TestEntity = cmp(function TestEntity(props: any) {
|
|
|
61
61
|
const target = props.target
|
|
62
62
|
const entity: ModelEntity = props.entity
|
|
63
63
|
|
|
64
|
-
const PROJENVNAME =
|
|
65
|
-
const ENTENVNAME =
|
|
64
|
+
const PROJENVNAME = envName(model)
|
|
65
|
+
const ENTENVNAME = envToken(entity.name)
|
|
66
66
|
const authActive = isAuthActive(model)
|
|
67
67
|
const apikeyEnvEntry = authActive
|
|
68
68
|
? `\n '${PROJENVNAME}_APIKEY': 'NONE',`
|
|
@@ -300,7 +300,7 @@ const generateCreate: OpGen = (ctx, step, index) => {
|
|
|
300
300
|
const hasEntIdC = null != entity.id
|
|
301
301
|
|
|
302
302
|
Content(`
|
|
303
|
-
${datavar} = await ${entvar}.create(${datavar})
|
|
303
|
+
${datavar} = (await ${entvar}.create(${datavar})).data()
|
|
304
304
|
`)
|
|
305
305
|
if (hasEntIdC) {
|
|
306
306
|
Content(` assert(null != ${datavar}.id)
|
|
@@ -341,7 +341,7 @@ const generateList: OpGen = (ctx, step, index) => {
|
|
|
341
341
|
})
|
|
342
342
|
|
|
343
343
|
Content(`
|
|
344
|
-
const ${listvar} = await ${entvar}.list(${matchvar})
|
|
344
|
+
const ${listvar} = (await ${entvar}.list(${matchvar})).map((e: any) => e.data())
|
|
345
345
|
`)
|
|
346
346
|
const allSteps = flow.step
|
|
347
347
|
for (let vI = 0; vI < step.valid.length; vI++) {
|
|
@@ -420,7 +420,7 @@ const generateUpdate: OpGen = (ctx, step, index) => {
|
|
|
420
420
|
}
|
|
421
421
|
|
|
422
422
|
Content(`
|
|
423
|
-
const ${resdatavar} = await ${entvar}.update(${datavar})
|
|
423
|
+
const ${resdatavar} = (await ${entvar}.update(${datavar})).data()
|
|
424
424
|
`)
|
|
425
425
|
if (hasEntIdU) {
|
|
426
426
|
Content(` assert(${resdatavar}.id === ${datavar}.id)
|
|
@@ -508,13 +508,13 @@ const generateLoad: OpGen = (ctx, step, index) => {
|
|
|
508
508
|
if (hasEntId) {
|
|
509
509
|
Content(` const ${matchvar}: any = {}
|
|
510
510
|
${matchvar}.id = ${srcdatavar}.id
|
|
511
|
-
const ${datavar} = await ${entvar}.load(${matchvar})
|
|
511
|
+
const ${datavar} = (await ${entvar}.load(${matchvar})).data()
|
|
512
512
|
assert(${datavar}.id === ${srcdatavar}.id)
|
|
513
513
|
`)
|
|
514
514
|
}
|
|
515
515
|
else {
|
|
516
516
|
Content(` const ${matchvar}: any = {}
|
|
517
|
-
const ${datavar} = await ${entvar}.load(${matchvar})
|
|
517
|
+
const ${datavar} = (await ${entvar}.load(${matchvar})).data()
|
|
518
518
|
assert(null != ${datavar})
|
|
519
519
|
`)
|
|
520
520
|
}
|
|
@@ -19,8 +19,8 @@ import {
|
|
|
19
19
|
describe('EntityNameDirect', async () => {
|
|
20
20
|
|
|
21
21
|
// Per-test live pacing. Delay is read from sdk-test-control.json's
|
|
22
|
-
// `test.live.delayMs`; only sleeps when
|
|
23
|
-
afterEach(liveDelay('
|
|
22
|
+
// `test.live.delayMs`; only sleeps when PROJECTENV_TEST_LIVE=TRUE.
|
|
23
|
+
afterEach(liveDelay('PROJECTENV_TEST_LIVE'))
|
|
24
24
|
|
|
25
25
|
test('direct-exists', async () => {
|
|
26
26
|
const sdk = new ProjectNameSDK({
|
|
@@ -26,8 +26,8 @@ import {
|
|
|
26
26
|
describe('EntityNameEntity', async () => {
|
|
27
27
|
|
|
28
28
|
// Per-test live pacing. Delay is read from sdk-test-control.json's
|
|
29
|
-
// `test.live.delayMs`; only sleeps when
|
|
30
|
-
afterEach(liveDelay('
|
|
29
|
+
// `test.live.delayMs`; only sleeps when PROJECTENV_TEST_LIVE=TRUE.
|
|
30
|
+
afterEach(liveDelay('PROJECTENV_TEST_LIVE'))
|
|
31
31
|
|
|
32
32
|
test('instance', async () => {
|
|
33
33
|
const testsdk = ProjectNameSDK.test()
|
|
@@ -32,6 +32,11 @@ class ProjectNameEntityBase<D = any> {
|
|
|
32
32
|
_match: Partial<D>
|
|
33
33
|
_entctx: Context
|
|
34
34
|
|
|
35
|
+
// Set once a successful `remove` resolves on this instance. The entity
|
|
36
|
+
// KEEPS the data it held — a caller can still read what was deleted — but
|
|
37
|
+
// it is no longer a live record.
|
|
38
|
+
_deleted: boolean
|
|
39
|
+
|
|
35
40
|
|
|
36
41
|
constructor(client: ProjectNameSDK, entopts: any) {
|
|
37
42
|
entopts = entopts || {}
|
|
@@ -42,6 +47,7 @@ class ProjectNameEntityBase<D = any> {
|
|
|
42
47
|
this._utility = client.utility()
|
|
43
48
|
this._data = {}
|
|
44
49
|
this._match = {}
|
|
50
|
+
this._deleted = false
|
|
45
51
|
|
|
46
52
|
const makeContext = this._utility.makeContext
|
|
47
53
|
|
|
@@ -54,6 +60,19 @@ class ProjectNameEntityBase<D = any> {
|
|
|
54
60
|
featureHook(this._entctx, 'PostConstructEntity')
|
|
55
61
|
}
|
|
56
62
|
|
|
63
|
+
// True once `remove` has succeeded on this instance. `remove` resolves to
|
|
64
|
+
// the entity like every other operation, so this is how a caller tells a
|
|
65
|
+
// removed record from a live one.
|
|
66
|
+
markDeleted(this: any): void {
|
|
67
|
+
this._deleted = true
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
deleted(this: any): boolean {
|
|
72
|
+
return true === this._deleted
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
|
|
57
76
|
entopts() {
|
|
58
77
|
return this._utility.struct.merge([{}, this._entopts])
|
|
59
78
|
}
|
|
@@ -178,7 +197,12 @@ class ProjectNameEntityBase<D = any> {
|
|
|
178
197
|
|
|
179
198
|
toJSON() {
|
|
180
199
|
const struct = this._utility.struct
|
|
181
|
-
|
|
200
|
+
// The marker is NAMESPACED. It used to be `entity$` — a short, generic
|
|
201
|
+
// name, and the `$`-suffix convention is not unique to sdkgen. Seneca uses
|
|
202
|
+
// `entity$` on its own entities to hold the canon, so an SDK record fed
|
|
203
|
+
// into `entize` silently overwrote it and produced entities claiming a
|
|
204
|
+
// canon that does not exist: no error, just wrong entities.
|
|
205
|
+
return struct.merge([{}, struct.getdef(this._data, {}), { 'voxgig$entity': this.Name }])
|
|
182
206
|
}
|
|
183
207
|
|
|
184
208
|
|
|
@@ -10,7 +10,7 @@ class EntityOperation {
|
|
|
10
10
|
|
|
11
11
|
// EJECT-START
|
|
12
12
|
|
|
13
|
-
async create(this: any, reqdata?: EntityNameCreateData, ctrl?: Control): Promise<
|
|
13
|
+
async create(this: any, reqdata?: EntityNameCreateData, ctrl?: Control): Promise<EntyClass> {
|
|
14
14
|
|
|
15
15
|
const utility = this._utility
|
|
16
16
|
const {
|
|
@@ -84,7 +84,15 @@ class EntityOperation {
|
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
|
|
87
|
+
const out = done(ctx)
|
|
88
|
+
|
|
89
|
+
// An operation resolves to the ENTITY, not the raw data — the record
|
|
90
|
+
// has just been absorbed into this instance and is reached through
|
|
91
|
+
// data(). `done` still runs: it completes the pipeline and raises on
|
|
92
|
+
// failure, and when throwing is disabled it hands back the error
|
|
93
|
+
// payload, which passes through unchanged. See AGENTS.md "Entity
|
|
94
|
+
// operations return ENTITIES".
|
|
95
|
+
return (ctx.result && ctx.result.ok) ? this : out
|
|
88
96
|
}
|
|
89
97
|
catch (err: any) {
|
|
90
98
|
// #PreUnexpected-Hook
|
|
@@ -10,7 +10,7 @@ class EntityOperation {
|
|
|
10
10
|
|
|
11
11
|
// EJECT-START
|
|
12
12
|
|
|
13
|
-
async list(this: any, reqmatch?: EntityNameListMatch, ctrl?: Control): Promise<
|
|
13
|
+
async list(this: any, reqmatch?: EntityNameListMatch, ctrl?: Control): Promise<EntyClass[]> {
|
|
14
14
|
|
|
15
15
|
const utility = this._utility
|
|
16
16
|
|
|
@@ -10,7 +10,7 @@ class EntityOperation {
|
|
|
10
10
|
|
|
11
11
|
// EJECT-START
|
|
12
12
|
|
|
13
|
-
async load(this: any, reqmatch?: EntityNameLoadMatch, ctrl?: Control): Promise<
|
|
13
|
+
async load(this: any, reqmatch?: EntityNameLoadMatch, ctrl?: Control): Promise<EntyClass> {
|
|
14
14
|
|
|
15
15
|
const utility = this._utility
|
|
16
16
|
|
|
@@ -89,7 +89,15 @@ class EntityOperation {
|
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
|
|
92
|
+
const out = done(ctx)
|
|
93
|
+
|
|
94
|
+
// An operation resolves to the ENTITY, not the raw data — the record
|
|
95
|
+
// has just been absorbed into this instance and is reached through
|
|
96
|
+
// data(). `done` still runs: it completes the pipeline and raises on
|
|
97
|
+
// failure, and when throwing is disabled it hands back the error
|
|
98
|
+
// payload, which passes through unchanged. See AGENTS.md "Entity
|
|
99
|
+
// operations return ENTITIES".
|
|
100
|
+
return (ctx.result && ctx.result.ok) ? this : out
|
|
93
101
|
}
|
|
94
102
|
catch (err: any) {
|
|
95
103
|
// #PreUnexpected-Hook
|
|
@@ -10,7 +10,17 @@ class EntityOperation {
|
|
|
10
10
|
|
|
11
11
|
// EJECT-START
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
// Resolves to THIS entity, marked as deleted — like every other operation,
|
|
14
|
+
// which resolve to the entity too (see AGENTS.md). The instance keeps the
|
|
15
|
+
// data it held, so a caller can still read what was removed; `deleted()`
|
|
16
|
+
// reports that it is no longer a live record.
|
|
17
|
+
//
|
|
18
|
+
// A DELETE that answers 204 No Content therefore still resolves to
|
|
19
|
+
// something useful, where returning the raw body resolved to `undefined`
|
|
20
|
+
// against a signature that promised a record.
|
|
21
|
+
async remove(
|
|
22
|
+
this: any, reqmatch?: EntityNameRemoveMatch, ctrl?: Control,
|
|
23
|
+
): Promise<EntyClass> {
|
|
14
24
|
|
|
15
25
|
const utility = this._utility
|
|
16
26
|
|
|
@@ -90,7 +100,21 @@ class EntityOperation {
|
|
|
90
100
|
}
|
|
91
101
|
}
|
|
92
102
|
|
|
93
|
-
|
|
103
|
+
const out = done(ctx)
|
|
104
|
+
|
|
105
|
+
// An operation resolves to the ENTITY, not the raw data — the record
|
|
106
|
+
// has just been absorbed into this instance and is reached through
|
|
107
|
+
// data(). `done` still runs: it completes the pipeline and raises on
|
|
108
|
+
// failure, and when throwing is disabled it hands back the error
|
|
109
|
+
// payload, which passes through unchanged. See AGENTS.md "Entity
|
|
110
|
+
// operations return ENTITIES".
|
|
111
|
+
if (ctx.result && ctx.result.ok) {
|
|
112
|
+
// A removed entity keeps its data but is no longer a live record.
|
|
113
|
+
this.markDeleted()
|
|
114
|
+
return this
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
return out
|
|
94
118
|
}
|
|
95
119
|
catch (err: any) {
|
|
96
120
|
// #PreUnexpected-Hook
|
|
@@ -102,7 +126,7 @@ class EntityOperation {
|
|
|
102
126
|
}
|
|
103
127
|
else {
|
|
104
128
|
// Off-happy-path (throw disabled): typed as any so the method's
|
|
105
|
-
// Promise<
|
|
129
|
+
// Promise<EntyClass> return stays clean under strict null checks.
|
|
106
130
|
return undefined as any
|
|
107
131
|
}
|
|
108
132
|
}
|
|
@@ -10,7 +10,7 @@ class EntityOperation {
|
|
|
10
10
|
|
|
11
11
|
// EJECT-START
|
|
12
12
|
|
|
13
|
-
async update(this: any, reqdata?: EntityNameUpdateData, ctrl?: Control): Promise<
|
|
13
|
+
async update(this: any, reqdata?: EntityNameUpdateData, ctrl?: Control): Promise<EntyClass> {
|
|
14
14
|
|
|
15
15
|
const utility = this._utility
|
|
16
16
|
|
|
@@ -90,7 +90,15 @@ class EntityOperation {
|
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
-
|
|
93
|
+
const out = done(ctx)
|
|
94
|
+
|
|
95
|
+
// An operation resolves to the ENTITY, not the raw data — the record
|
|
96
|
+
// has just been absorbed into this instance and is reached through
|
|
97
|
+
// data(). `done` still runs: it completes the pipeline and raises on
|
|
98
|
+
// failure, and when throwing is disabled it hands back the error
|
|
99
|
+
// payload, which passes through unchanged. See AGENTS.md "Entity
|
|
100
|
+
// operations return ENTITIES".
|
|
101
|
+
return (ctx.result && ctx.result.ok) ? this : out
|
|
94
102
|
}
|
|
95
103
|
catch (err: any) {
|
|
96
104
|
// #PreUnexpected-Hook
|
|
@@ -11,6 +11,21 @@ class ProjectNameError extends Error {
|
|
|
11
11
|
code: string
|
|
12
12
|
ctx: Context
|
|
13
13
|
|
|
14
|
+
// HTTP status of the response that caused this error, or -1 when the
|
|
15
|
+
// request never got one (transport failure, client-side abort).
|
|
16
|
+
//
|
|
17
|
+
// PROMOTED to the top level on purpose. It used to be reachable only at
|
|
18
|
+
// `err.result.status` — two levels into an object that reads as internal —
|
|
19
|
+
// so every consumer of every generated SDK wrote the same
|
|
20
|
+
// `404 === e?.result?.status` branch and coupled itself to the internal
|
|
21
|
+
// shape of `result`. Mapping "not found" to a null result is table stakes
|
|
22
|
+
// for a client integration.
|
|
23
|
+
status: number = -1
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
// `err.notFound` rather than a magic number at every call site.
|
|
27
|
+
get notFound(): boolean { return 404 === this.status }
|
|
28
|
+
|
|
14
29
|
constructor(code: string, msg: string, ctx: Context) {
|
|
15
30
|
super(msg)
|
|
16
31
|
this.code = code
|
|
@@ -48,7 +48,11 @@ const Entity = cmp(function Entity(props: any) {
|
|
|
48
48
|
({ indent }: any) => {
|
|
49
49
|
const arg = ('create' === opname || 'update' === opname) ?
|
|
50
50
|
'reqdata' : 'reqmatch'
|
|
51
|
-
|
|
51
|
+
// The stub mirrors the real signature: ops resolve to the
|
|
52
|
+
// ENTITY (`list` to a slice of them), so an unsupported op
|
|
53
|
+
// declares the same per-entity result union.
|
|
54
|
+
const ret = 'list' === opname ? 'EntListResult' : 'EntResult'
|
|
55
|
+
Content({ indent }, `pub fn ${opname}(self: *${cls}, _${arg}: Value, _ctrl: Value) ${ret} {
|
|
52
56
|
_ = _${arg};
|
|
53
57
|
_ = _ctrl;
|
|
54
58
|
return .{ .err = h.unsupported_op("${opname}", self.name) };
|
|
@@ -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
|
|
|
@@ -35,6 +36,7 @@ import { zigModuleName } from './utility_zig'
|
|
|
35
36
|
// pin there.
|
|
36
37
|
const Package = cmp(async function Package(props: any) {
|
|
37
38
|
const ctx$ = props.ctx$
|
|
39
|
+
const target = props.target
|
|
38
40
|
const model: Model = ctx$.model
|
|
39
41
|
|
|
40
42
|
const name = zigModuleName(model)
|
|
@@ -42,7 +44,7 @@ const Package = cmp(async function Package(props: any) {
|
|
|
42
44
|
File({ name: 'build.zig.zon' }, () => {
|
|
43
45
|
Content(`.{
|
|
44
46
|
.name = "${name}",
|
|
45
|
-
.version = "
|
|
47
|
+
.version = "${packageVersion(model, target.name)}",
|
|
46
48
|
.dependencies = .{},
|
|
47
49
|
.paths = .{
|
|
48
50
|
"src",
|
|
@@ -17,6 +17,23 @@ const OpResult = types.OpResult;
|
|
|
17
17
|
const OutVal = types.OutVal;
|
|
18
18
|
const Entity = types.Entity;
|
|
19
19
|
|
|
20
|
+
// Every operation resolves to the ENTITY, not the raw data — `list` to a
|
|
21
|
+
// slice of them, one per record; the record is reached through `data()`.
|
|
22
|
+
// See AGENTS.md "Entity operations return ENTITIES".
|
|
23
|
+
//
|
|
24
|
+
// `Value` cannot carry an entity (it is a closed data union) and the shared
|
|
25
|
+
// `OpResult` cannot name a per-entity type, so each entity declares its own
|
|
26
|
+
// result unions and the CONTRACT lives in those signatures.
|
|
27
|
+
pub const EntResult = union(enum) {
|
|
28
|
+
ok: *EntyClass,
|
|
29
|
+
err: *errmod.ProjectNameError,
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
pub const EntListResult = union(enum) {
|
|
33
|
+
ok: []*EntyClass,
|
|
34
|
+
err: *errmod.ProjectNameError,
|
|
35
|
+
};
|
|
36
|
+
|
|
20
37
|
pub const EntyClass = struct {
|
|
21
38
|
name: []const u8 = "entityname",
|
|
22
39
|
client: *sdk.ProjectNameSDK,
|
|
@@ -25,6 +42,8 @@ pub const EntyClass = struct {
|
|
|
25
42
|
data: Value,
|
|
26
43
|
mtch: Value,
|
|
27
44
|
entctx: ?*Context = null,
|
|
45
|
+
// Set once a successful `remove` resolves on this instance.
|
|
46
|
+
deleted: bool = false,
|
|
28
47
|
|
|
29
48
|
pub fn new(client: *sdk.ProjectNameSDK, entopts_in: Value) *EntyClass {
|
|
30
49
|
const entopts: Value = switch (entopts_in) {
|
|
@@ -73,6 +92,26 @@ pub const EntyClass = struct {
|
|
|
73
92
|
return .{ .ok = v };
|
|
74
93
|
}
|
|
75
94
|
|
|
95
|
+
// Runs the pipeline and hands back THIS entity: run_op has just absorbed
|
|
96
|
+
// the result into it. See AGENTS.md "Entity operations return ENTITIES".
|
|
97
|
+
fn run_op_ent(self: *EntyClass, ctx: *Context, post_done: *const fn (*EntyClass, *Context) void) EntResult {
|
|
98
|
+
return switch (self.run_op(ctx, post_done)) {
|
|
99
|
+
.err => |e| EntResult{ .err = e },
|
|
100
|
+
.ok => EntResult{ .ok = self },
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// `remove` resolves to the entity, marked. The instance KEEPS the data it
|
|
105
|
+
// held — a caller can still read what was deleted — but it is no longer a
|
|
106
|
+
// live record.
|
|
107
|
+
pub fn mark_deleted(self: *EntyClass) void {
|
|
108
|
+
self.deleted = true;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
pub fn is_deleted(self: *EntyClass) bool {
|
|
112
|
+
return self.deleted;
|
|
113
|
+
}
|
|
114
|
+
|
|
76
115
|
fn run_op(self: *EntyClass, ctx: *Context, post_done: *const fn (*EntyClass, *Context) void) OpResult {
|
|
77
116
|
const utility = self.utility;
|
|
78
117
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// EJECT-START
|
|
2
2
|
|
|
3
|
-
pub fn create(self: *EntyClass, reqdata: Value, ctrl: Value)
|
|
3
|
+
pub fn create(self: *EntyClass, reqdata: Value, ctrl: Value) EntResult {
|
|
4
4
|
const ctx = self.utility.make_context(CtxSpec{
|
|
5
5
|
.opname = "create",
|
|
6
6
|
.ctrl = ctrl,
|
|
@@ -8,7 +8,7 @@ pub fn create(self: *EntyClass, reqdata: Value, ctrl: Value) OpResult {
|
|
|
8
8
|
.data = self.data,
|
|
9
9
|
.reqdata = reqdata,
|
|
10
10
|
}, self.ent_ctx());
|
|
11
|
-
return self.
|
|
11
|
+
return self.run_op_ent(ctx, create_post_done);
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
fn create_post_done(self: *EntyClass, ctx: *Context) void {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// EJECT-START
|
|
2
2
|
|
|
3
|
-
pub fn list(self: *EntyClass, reqmatch: Value, ctrl: Value)
|
|
3
|
+
pub fn list(self: *EntyClass, reqmatch: Value, ctrl: Value) EntListResult {
|
|
4
4
|
const ctx = self.utility.make_context(CtxSpec{
|
|
5
5
|
.opname = "list",
|
|
6
6
|
.ctrl = ctrl,
|
|
@@ -8,7 +8,26 @@ pub fn list(self: *EntyClass, reqmatch: Value, ctrl: Value) OpResult {
|
|
|
8
8
|
.data = self.data,
|
|
9
9
|
.reqmatch = reqmatch,
|
|
10
10
|
}, self.ent_ctx());
|
|
11
|
-
|
|
11
|
+
const out = switch (self.run_op(ctx, list_post_done)) {
|
|
12
|
+
.err => |e| return EntListResult{ .err = e },
|
|
13
|
+
.ok => |v| v,
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
// `list` resolves to one ENTITY per record. make_result cannot build them
|
|
17
|
+
// here — it works in Value, which has no slot for an entity — so the op
|
|
18
|
+
// does, mirroring what the dynamic targets get from make_result.
|
|
19
|
+
var items = std.ArrayList(*EntyClass).init(h.A());
|
|
20
|
+
if (out == .array) {
|
|
21
|
+
for (out.array.data.items) |entry| {
|
|
22
|
+
const ent = EntyClass.new(self.client, h.clone(self.entopts));
|
|
23
|
+
if (entry == .object) {
|
|
24
|
+
_ = ent.data_impl(entry);
|
|
25
|
+
}
|
|
26
|
+
items.append(ent) catch {};
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return EntListResult{ .ok = items.toOwnedSlice() catch &[_]*EntyClass{} };
|
|
12
31
|
}
|
|
13
32
|
|
|
14
33
|
fn list_post_done(self: *EntyClass, ctx: *Context) void {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// EJECT-START
|
|
2
2
|
|
|
3
|
-
pub fn load(self: *EntyClass, reqmatch: Value, ctrl: Value)
|
|
3
|
+
pub fn load(self: *EntyClass, reqmatch: Value, ctrl: Value) EntResult {
|
|
4
4
|
const ctx = self.utility.make_context(CtxSpec{
|
|
5
5
|
.opname = "load",
|
|
6
6
|
.ctrl = ctrl,
|
|
@@ -8,7 +8,7 @@ pub fn load(self: *EntyClass, reqmatch: Value, ctrl: Value) OpResult {
|
|
|
8
8
|
.data = self.data,
|
|
9
9
|
.reqmatch = reqmatch,
|
|
10
10
|
}, self.ent_ctx());
|
|
11
|
-
return self.
|
|
11
|
+
return self.run_op_ent(ctx, load_post_done);
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
fn load_post_done(self: *EntyClass, ctx: *Context) void {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// EJECT-START
|
|
2
2
|
|
|
3
|
-
pub fn remove(self: *EntyClass, reqmatch: Value, ctrl: Value)
|
|
3
|
+
pub fn remove(self: *EntyClass, reqmatch: Value, ctrl: Value) EntResult {
|
|
4
4
|
const ctx = self.utility.make_context(CtxSpec{
|
|
5
5
|
.opname = "remove",
|
|
6
6
|
.ctrl = ctrl,
|
|
@@ -8,7 +8,10 @@ pub fn remove(self: *EntyClass, reqmatch: Value, ctrl: Value) OpResult {
|
|
|
8
8
|
.data = self.data,
|
|
9
9
|
.reqmatch = reqmatch,
|
|
10
10
|
}, self.ent_ctx());
|
|
11
|
-
|
|
11
|
+
const res = self.run_op_ent(ctx, remove_post_done);
|
|
12
|
+
// A removed entity keeps its data but is no longer a live record.
|
|
13
|
+
if (res == .ok) self.mark_deleted();
|
|
14
|
+
return res;
|
|
12
15
|
}
|
|
13
16
|
|
|
14
17
|
fn remove_post_done(self: *EntyClass, ctx: *Context) void {
|