@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
|
@@ -1,22 +1,18 @@
|
|
|
1
1
|
package sdktest
|
|
2
2
|
|
|
3
|
-
//
|
|
4
|
-
//
|
|
3
|
+
// Behavioural tests for the enterprise features shipped with this SDK
|
|
4
|
+
// (retry, cache, rbac, telemetry, ...). Each block runs only when its
|
|
5
|
+
// feature is present (see fhSkipWithout in feature_harness_test.go, which
|
|
6
|
+
// also holds the fh* pipeline harness these tests drive).
|
|
5
7
|
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
// generated Entity*Op code, but with no live server and no API-specific
|
|
10
|
-
// fixtures. Each block runs only when its feature is present in this SDK
|
|
11
|
-
// (see fhSkipWithout).
|
|
8
|
+
// This file constructs every shipped feature type by name, so it only
|
|
9
|
+
// compiles with the COMPLETE feature set — it is listed in the go target's
|
|
10
|
+
// `feature.fullset` and dropped when a project trims its features.
|
|
12
11
|
|
|
13
12
|
import (
|
|
14
|
-
"fmt"
|
|
15
|
-
neturl "net/url"
|
|
16
13
|
"os"
|
|
17
14
|
"reflect"
|
|
18
15
|
"regexp"
|
|
19
|
-
"sort"
|
|
20
16
|
"strings"
|
|
21
17
|
"testing"
|
|
22
18
|
"time"
|
|
@@ -25,345 +21,6 @@ import (
|
|
|
25
21
|
feat "GOMODULE/feature"
|
|
26
22
|
)
|
|
27
23
|
|
|
28
|
-
// --- harness ----------------------------------------------------------------
|
|
29
|
-
|
|
30
|
-
// fhHasFeature is true when this SDK was generated with the named feature.
|
|
31
|
-
func fhHasFeature(name string) bool {
|
|
32
|
-
config := sdk.MakeConfig()
|
|
33
|
-
fm, _ := config["feature"].(map[string]any)
|
|
34
|
-
return fm != nil && fm[name] != nil
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
func fhSkipWithout(t *testing.T, names ...string) {
|
|
38
|
-
t.Helper()
|
|
39
|
-
for _, name := range names {
|
|
40
|
-
if !fhHasFeature(name) {
|
|
41
|
-
t.Skip("feature not present in this SDK: " + name)
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// fhClock is a deterministic virtual clock: now() advances only when
|
|
47
|
-
// sleep(ms) is called, so timing-based features can be asserted without
|
|
48
|
-
// real delays.
|
|
49
|
-
type fhClock struct {
|
|
50
|
-
t int64
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
func (c *fhClock) now() int64 { return c.t }
|
|
54
|
-
func (c *fhClock) sleep(ms int) { c.t += int64(ms) }
|
|
55
|
-
func (c *fhClock) advance(ms int) { c.t += int64(ms) }
|
|
56
|
-
|
|
57
|
-
// fhResponse builds a transport-shaped response the pipeline understands.
|
|
58
|
-
func fhResponse(status int, data any, headers map[string]any) map[string]any {
|
|
59
|
-
h := map[string]any{}
|
|
60
|
-
for k, v := range headers {
|
|
61
|
-
h[strings.ToLower(k)] = v
|
|
62
|
-
}
|
|
63
|
-
statusText := "OK"
|
|
64
|
-
if status >= 400 {
|
|
65
|
-
statusText = "ERR"
|
|
66
|
-
}
|
|
67
|
-
return map[string]any{
|
|
68
|
-
"status": status,
|
|
69
|
-
"statusText": statusText,
|
|
70
|
-
"body": "not-used",
|
|
71
|
-
"json": (func() any)(func() any { return data }),
|
|
72
|
-
"headers": h,
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// fhRecorder is a mock transport recording every call, replying via an
|
|
77
|
-
// optional reply func (default: 200 with a call counter).
|
|
78
|
-
type fhRecorder struct {
|
|
79
|
-
calls []map[string]any
|
|
80
|
-
reply func(n int, fetchdef map[string]any) (any, error)
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
func (r *fhRecorder) fetch(ctx *sdk.Context, url string, fetchdef map[string]any) (any, error) {
|
|
84
|
-
r.calls = append(r.calls, map[string]any{"url": url, "fetchdef": fetchdef})
|
|
85
|
-
if r.reply != nil {
|
|
86
|
-
return r.reply(len(r.calls), fetchdef)
|
|
87
|
-
}
|
|
88
|
-
return fhResponse(200, map[string]any{"ok": true, "n": len(r.calls)}, nil), nil
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
func (r *fhRecorder) headers(i int) map[string]any {
|
|
92
|
-
fetchdef, _ := r.calls[i]["fetchdef"].(map[string]any)
|
|
93
|
-
headers, _ := fetchdef["headers"].(map[string]any)
|
|
94
|
-
return headers
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
func (r *fhRecorder) fetchdef(i int) map[string]any {
|
|
98
|
-
fetchdef, _ := r.calls[i]["fetchdef"].(map[string]any)
|
|
99
|
-
return fetchdef
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
func (r *fhRecorder) url(i int) string {
|
|
103
|
-
url, _ := r.calls[i]["url"].(string)
|
|
104
|
-
return url
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
// fhFeature pairs a feature instance with its init options.
|
|
108
|
-
type fhFeature struct {
|
|
109
|
-
f sdk.Feature
|
|
110
|
-
options map[string]any
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
func fhF(f sdk.Feature, options map[string]any) fhFeature {
|
|
114
|
-
return fhFeature{f: f, options: options}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
// fhHarness wires features (in init order) to a mock transport and a mini
|
|
118
|
-
// operation pipeline.
|
|
119
|
-
type fhHarness struct {
|
|
120
|
-
client *sdk.ProjectNameSDK
|
|
121
|
-
utility *sdk.Utility
|
|
122
|
-
rootctx *sdk.Context
|
|
123
|
-
base string
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
// fhMake constructs the harness: a real (test-mode) client, an isolated
|
|
127
|
-
// utility whose fetcher is the mock server, and the requested features
|
|
128
|
-
// initialised against it. Fires PostConstruct once wiring is complete.
|
|
129
|
-
func fhMake(server sdk.FetcherFunc, features ...fhFeature) *fhHarness {
|
|
130
|
-
client := sdk.TestSDK(nil, nil)
|
|
131
|
-
client.Features = []sdk.Feature{}
|
|
132
|
-
|
|
133
|
-
utility := client.GetUtility()
|
|
134
|
-
if server == nil {
|
|
135
|
-
rec := &fhRecorder{}
|
|
136
|
-
server = rec.fetch
|
|
137
|
-
}
|
|
138
|
-
utility.Fetcher = server
|
|
139
|
-
|
|
140
|
-
rootctx := utility.MakeContext(map[string]any{
|
|
141
|
-
"client": client,
|
|
142
|
-
"utility": utility,
|
|
143
|
-
}, client.GetRootCtx())
|
|
144
|
-
|
|
145
|
-
for _, fs := range features {
|
|
146
|
-
fopts := map[string]any{"active": true}
|
|
147
|
-
for k, v := range fs.options {
|
|
148
|
-
fopts[k] = v
|
|
149
|
-
}
|
|
150
|
-
fs.f.Init(rootctx, fopts)
|
|
151
|
-
client.Features = append(client.Features, fs.f)
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
utility.FeatureHook(rootctx, "PostConstruct")
|
|
155
|
-
|
|
156
|
-
return &fhHarness{
|
|
157
|
-
client: client,
|
|
158
|
-
utility: utility,
|
|
159
|
-
rootctx: rootctx,
|
|
160
|
-
base: "http://api.test",
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
type fhOpSpec struct {
|
|
165
|
-
entity string
|
|
166
|
-
op string
|
|
167
|
-
method string
|
|
168
|
-
path string
|
|
169
|
-
query map[string]any
|
|
170
|
-
headers map[string]any
|
|
171
|
-
body any
|
|
172
|
-
ctrl map[string]any
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
type fhOpResult struct {
|
|
176
|
-
ok bool
|
|
177
|
-
data any
|
|
178
|
-
err error
|
|
179
|
-
result *sdk.Result
|
|
180
|
-
ctx *sdk.Context
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
func fhDefaultMethod(op string) string {
|
|
184
|
-
switch op {
|
|
185
|
-
case "create":
|
|
186
|
-
return "POST"
|
|
187
|
-
case "update":
|
|
188
|
-
return "PATCH"
|
|
189
|
-
case "remove":
|
|
190
|
-
return "DELETE"
|
|
191
|
-
}
|
|
192
|
-
return "GET"
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
func fhBuildUrl(spec *sdk.Spec) string {
|
|
196
|
-
var keys []string
|
|
197
|
-
for k, v := range spec.Query {
|
|
198
|
-
if v != nil {
|
|
199
|
-
keys = append(keys, k)
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
sort.Strings(keys)
|
|
203
|
-
qs := ""
|
|
204
|
-
for _, k := range keys {
|
|
205
|
-
if qs != "" {
|
|
206
|
-
qs += "&"
|
|
207
|
-
}
|
|
208
|
-
qs += neturl.QueryEscape(k) + "=" + neturl.QueryEscape(fmt.Sprintf("%v", spec.Query[k]))
|
|
209
|
-
}
|
|
210
|
-
url := spec.Base + spec.Path
|
|
211
|
-
if qs != "" {
|
|
212
|
-
url += "?" + qs
|
|
213
|
-
}
|
|
214
|
-
return url
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
// op runs one operation through the mini pipeline (mirrors the generated
|
|
218
|
-
// Entity*Op fragment: hook, short-circuit, make*, hook, ...).
|
|
219
|
-
func (h *fhHarness) op(o fhOpSpec) fhOpResult {
|
|
220
|
-
entity := o.entity
|
|
221
|
-
if entity == "" {
|
|
222
|
-
entity = "widget"
|
|
223
|
-
}
|
|
224
|
-
opname := o.op
|
|
225
|
-
if opname == "" {
|
|
226
|
-
opname = "load"
|
|
227
|
-
}
|
|
228
|
-
method := o.method
|
|
229
|
-
if method == "" {
|
|
230
|
-
method = fhDefaultMethod(opname)
|
|
231
|
-
}
|
|
232
|
-
ctrl := o.ctrl
|
|
233
|
-
if ctrl == nil {
|
|
234
|
-
ctrl = map[string]any{}
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
ctx := h.utility.MakeContext(map[string]any{
|
|
238
|
-
"opname": opname,
|
|
239
|
-
"ctrl": ctrl,
|
|
240
|
-
}, h.rootctx)
|
|
241
|
-
ctx.Op = sdk.NewOperation(map[string]any{"entity": entity, "name": opname})
|
|
242
|
-
|
|
243
|
-
h.utility.FeatureHook(ctx, "PostConstructEntity")
|
|
244
|
-
|
|
245
|
-
h.utility.FeatureHook(ctx, "PrePoint")
|
|
246
|
-
if err, ok := ctx.Out["point"].(error); ok {
|
|
247
|
-
return h.fail(ctx, err)
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
h.utility.FeatureHook(ctx, "PreSpec")
|
|
251
|
-
path := o.path
|
|
252
|
-
if path == "" {
|
|
253
|
-
path = "/" + entity
|
|
254
|
-
}
|
|
255
|
-
headers := map[string]any{}
|
|
256
|
-
for k, v := range o.headers {
|
|
257
|
-
headers[k] = v
|
|
258
|
-
}
|
|
259
|
-
query := map[string]any{}
|
|
260
|
-
for k, v := range o.query {
|
|
261
|
-
query[k] = v
|
|
262
|
-
}
|
|
263
|
-
ctx.Spec = sdk.NewSpec(map[string]any{
|
|
264
|
-
"method": method,
|
|
265
|
-
"base": h.base,
|
|
266
|
-
"path": path,
|
|
267
|
-
"headers": headers,
|
|
268
|
-
"query": query,
|
|
269
|
-
"step": "start",
|
|
270
|
-
})
|
|
271
|
-
if o.body != nil {
|
|
272
|
-
ctx.Spec.Body = o.body
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
h.utility.FeatureHook(ctx, "PreRequest")
|
|
276
|
-
ctx.Spec.Url = fhBuildUrl(ctx.Spec)
|
|
277
|
-
|
|
278
|
-
fetchdef := map[string]any{
|
|
279
|
-
"url": ctx.Spec.Url,
|
|
280
|
-
"method": ctx.Spec.Method,
|
|
281
|
-
"headers": ctx.Spec.Headers,
|
|
282
|
-
}
|
|
283
|
-
if ctx.Spec.Body != nil {
|
|
284
|
-
fetchdef["body"] = ctx.Spec.Body
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
var response any
|
|
288
|
-
var fetchErr error
|
|
289
|
-
if ctx.Out["request"] != nil {
|
|
290
|
-
response = ctx.Out["request"]
|
|
291
|
-
} else {
|
|
292
|
-
response, fetchErr = h.utility.Fetcher(ctx, ctx.Spec.Url, fetchdef)
|
|
293
|
-
}
|
|
294
|
-
if rm, ok := response.(map[string]any); ok {
|
|
295
|
-
ctx.Response = sdk.NewResponse(rm)
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
h.utility.FeatureHook(ctx, "PreResponse")
|
|
299
|
-
fhPopulateResult(ctx, response, fetchErr)
|
|
300
|
-
h.utility.FeatureHook(ctx, "PreResult")
|
|
301
|
-
h.utility.FeatureHook(ctx, "PreDone")
|
|
302
|
-
|
|
303
|
-
if ctx.Result != nil && ctx.Result.Ok {
|
|
304
|
-
return fhOpResult{ok: true, data: ctx.Result.Resdata, result: ctx.Result, ctx: ctx}
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
var err error
|
|
308
|
-
if ctx.Result != nil && ctx.Result.Err != nil {
|
|
309
|
-
err = ctx.Result.Err
|
|
310
|
-
} else {
|
|
311
|
-
err = ctx.MakeError("op_failed", "operation failed")
|
|
312
|
-
}
|
|
313
|
-
return h.fail(ctx, err)
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
func (h *fhHarness) fail(ctx *sdk.Context, err error) fhOpResult {
|
|
317
|
-
ctx.Ctrl.Err = err
|
|
318
|
-
h.utility.FeatureHook(ctx, "PreUnexpected")
|
|
319
|
-
return fhOpResult{ok: false, err: err, result: ctx.Result, ctx: ctx}
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
func fhPopulateResult(ctx *sdk.Context, response any, fetchErr error) {
|
|
323
|
-
result := sdk.NewResult(map[string]any{})
|
|
324
|
-
ctx.Result = result
|
|
325
|
-
|
|
326
|
-
if fetchErr != nil {
|
|
327
|
-
result.Err = fetchErr
|
|
328
|
-
return
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
rm, ok := response.(map[string]any)
|
|
332
|
-
if !ok || rm == nil {
|
|
333
|
-
result.Err = ctx.MakeError("request_no_response", "response: undefined")
|
|
334
|
-
return
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
resp := sdk.NewResponse(rm)
|
|
338
|
-
result.Status = resp.Status
|
|
339
|
-
result.StatusText = resp.StatusText
|
|
340
|
-
if hm, ok := resp.Headers.(map[string]any); ok {
|
|
341
|
-
result.Headers = hm
|
|
342
|
-
}
|
|
343
|
-
if resp.JsonFunc != nil {
|
|
344
|
-
result.Body = resp.JsonFunc()
|
|
345
|
-
}
|
|
346
|
-
result.Resdata = result.Body
|
|
347
|
-
|
|
348
|
-
if result.Status >= 400 {
|
|
349
|
-
result.Err = ctx.MakeError("request_status",
|
|
350
|
-
fmt.Sprintf("request: %d: %s", result.Status, result.StatusText))
|
|
351
|
-
} else if resp.Err != nil {
|
|
352
|
-
result.Err = resp.Err
|
|
353
|
-
}
|
|
354
|
-
if result.Err == nil {
|
|
355
|
-
result.Ok = true
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
// fhErrCode extracts the SDK error code, "" otherwise.
|
|
360
|
-
func fhErrCode(err error) string {
|
|
361
|
-
if se, ok := err.(*sdk.ProjectNameError); ok {
|
|
362
|
-
return se.Code
|
|
363
|
-
}
|
|
364
|
-
return ""
|
|
365
|
-
}
|
|
366
|
-
|
|
367
24
|
// --- netsim -----------------------------------------------------------------
|
|
368
25
|
|
|
369
26
|
func TestFeatureNetsim(t *testing.T) {
|
|
@@ -37,6 +37,7 @@ func plCtx(client *sdk.ProjectNameSDK, utility *sdk.Utility, ctrl map[string]any
|
|
|
37
37
|
|
|
38
38
|
// plEntity is a minimal fake entity for the list-wrap test.
|
|
39
39
|
type plEntity struct {
|
|
40
|
+
deleted bool
|
|
40
41
|
name string
|
|
41
42
|
made *[]any
|
|
42
43
|
}
|
|
@@ -51,6 +52,11 @@ func (e *plEntity) Data(args ...any) any {
|
|
|
51
52
|
}
|
|
52
53
|
func (e *plEntity) Match(args ...any) any { return nil }
|
|
53
54
|
|
|
55
|
+
// Every operation resolves to the entity; `remove` marks it. The fake has
|
|
56
|
+
// to satisfy the same interface the real entities do.
|
|
57
|
+
func (e *plEntity) MarkDeleted() { e.deleted = true }
|
|
58
|
+
func (e *plEntity) Deleted() bool { return e.deleted }
|
|
59
|
+
|
|
54
60
|
func TestPipelineMakeResponse(t *testing.T) {
|
|
55
61
|
client, utility := plClient(t, nil)
|
|
56
62
|
|
|
@@ -45,8 +45,8 @@ func loadEnvLocal() {
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
func envOverride(m map[string]any) map[string]any {
|
|
48
|
-
if os.Getenv("
|
|
49
|
-
os.Getenv("
|
|
48
|
+
if os.Getenv("PROJECTENV_TEST_LIVE") == "TRUE" ||
|
|
49
|
+
os.Getenv("PROJECTENV_TEST_OVERRIDE") == "TRUE" {
|
|
50
50
|
for key := range m {
|
|
51
51
|
envval := os.Getenv(key)
|
|
52
52
|
if envval != "" {
|
|
@@ -63,8 +63,8 @@ func envOverride(m map[string]any) map[string]any {
|
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
if explain := os.Getenv("
|
|
67
|
-
m["
|
|
66
|
+
if explain := os.Getenv("PROJECTENV_TEST_EXPLAIN"); explain != "" {
|
|
67
|
+
m["PROJECTENV_TEST_EXPLAIN"] = explain
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
return m
|
|
@@ -551,6 +551,18 @@ func ctxToMatchMap(ctx *sdk.Context) map[string]any {
|
|
|
551
551
|
return m
|
|
552
552
|
}
|
|
553
553
|
|
|
554
|
+
// entityData extracts the data map from an op result.
|
|
555
|
+
//
|
|
556
|
+
// Every entity operation resolves to the ENTITY (see AGENTS.md), so a flow
|
|
557
|
+
// test that wants the record takes this hop. A plain map passes through
|
|
558
|
+
// unchanged, so this is safe for the direct/prepare results too.
|
|
559
|
+
func entityData(v any) any {
|
|
560
|
+
if ent, ok := v.(sdk.Entity); ok {
|
|
561
|
+
return ent.Data()
|
|
562
|
+
}
|
|
563
|
+
return v
|
|
564
|
+
}
|
|
565
|
+
|
|
554
566
|
// entityListToData extracts data maps from a list of Entity objects.
|
|
555
567
|
func entityListToData(list []any) []any {
|
|
556
568
|
var out []any
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
PROJECTVERSION
|
|
@@ -1313,6 +1313,7 @@ makeEntity client name entopts = do
|
|
|
1313
1313
|
utility <- copyUtility (clUtility client)
|
|
1314
1314
|
dataR <- newIORef =<< emptyMap
|
|
1315
1315
|
matchR <- newIORef =<< emptyMap
|
|
1316
|
+
deletedR <- newIORef False
|
|
1316
1317
|
entctxR <- newIORef Nothing
|
|
1317
1318
|
let entCtx = do m <- readIORef entctxR; case m of Just c -> pure c; Nothing -> error "entity context not initialised"
|
|
1318
1319
|
setDataFrom rv = do
|
|
@@ -1339,11 +1340,33 @@ makeEntity client name entopts = do
|
|
|
1339
1340
|
, eMake = do o <- clone entopts'; makeEntity client name o
|
|
1340
1341
|
, eDataSet = \d -> writeIORef dataR d
|
|
1341
1342
|
, eDataGet = readIORef dataR
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1343
|
+
-- Ops resolve to the ENTITY (see SdkTypes). mkOp still runs the whole
|
|
1344
|
+
-- pipeline and throws SdkException on failure; with throwing disabled
|
|
1345
|
+
-- it returns the error payload, which an IO Entity cannot carry, so
|
|
1346
|
+
-- that path resolves to the entity too and the caller reads ctrl.err
|
|
1347
|
+
-- — the mechanism the no-throw mode documents anyway.
|
|
1348
|
+
, eLoad = \rm ctrl -> mkOp "load" "match" rm ctrl postLoad >> pure ent
|
|
1349
|
+
, eList = \rm ctrl -> do
|
|
1350
|
+
out <- mkOp "list" "match" rm ctrl postList
|
|
1351
|
+
-- `list` resolves to one ENTITY per record. makeResult cannot
|
|
1352
|
+
-- build them — it works in Value — so this does.
|
|
1353
|
+
case out of
|
|
1354
|
+
VList _ -> do
|
|
1355
|
+
items <- listItems out
|
|
1356
|
+
mapM (\entry -> do
|
|
1357
|
+
e <- eMake ent
|
|
1358
|
+
case entry of VMap _ -> eDataSet e entry; _ -> pure ()
|
|
1359
|
+
pure e) items
|
|
1360
|
+
_ -> pure []
|
|
1361
|
+
, eCreate = \rd ctrl -> mkOp "create" "data" rd ctrl postCreate >> pure ent
|
|
1362
|
+
, eUpdate = \rd ctrl -> mkOp "update" "data" rd ctrl postUpdate >> pure ent
|
|
1363
|
+
, eRemove = \rm ctrl -> do
|
|
1364
|
+
_ <- mkOp "remove" "match" rm ctrl postRemove
|
|
1365
|
+
-- A removed entity keeps its data but is no longer a live record.
|
|
1366
|
+
writeIORef deletedR True
|
|
1367
|
+
pure ent
|
|
1368
|
+
, eDeleted = deletedR
|
|
1369
|
+
, eMarkDeleted = writeIORef deletedR True
|
|
1347
1370
|
-- Streaming operation. Runs `action` through the full pipeline and
|
|
1348
1371
|
-- returns a lazy list of result items, so the streaming feature's
|
|
1349
1372
|
-- incremental output is reachable (a normal op call materialises the
|
|
@@ -111,11 +111,20 @@ data Entity = Entity
|
|
|
111
111
|
, eMake :: IO Entity
|
|
112
112
|
, eDataSet :: Value -> IO ()
|
|
113
113
|
, eDataGet :: IO Value
|
|
114
|
-
,
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
,
|
|
114
|
+
-- | Every operation resolves to the ENTITY, not the raw data — 'eList' to
|
|
115
|
+
-- one per record. The record is reached through 'eDataGet'. 'Value' cannot
|
|
116
|
+
-- carry an entity (it is a closed data union), so the CONTRACT lives in
|
|
117
|
+
-- these signatures. See AGENTS.md "Entity operations return ENTITIES".
|
|
118
|
+
, eLoad :: Value -> Value -> IO Entity
|
|
119
|
+
, eList :: Value -> Value -> IO [Entity]
|
|
120
|
+
, eCreate :: Value -> Value -> IO Entity
|
|
121
|
+
, eUpdate :: Value -> Value -> IO Entity
|
|
122
|
+
, eRemove :: Value -> Value -> IO Entity
|
|
123
|
+
-- | 'eRemove' resolves to the entity, marked. The instance KEEPS the data
|
|
124
|
+
-- it held — a caller can still read what was deleted — but it is no longer
|
|
125
|
+
-- a live record.
|
|
126
|
+
, eDeleted :: IORef Bool
|
|
127
|
+
, eMarkDeleted :: IO ()
|
|
119
128
|
-- | stream action args callopts -> a lazy list of result items.
|
|
120
129
|
, eStream :: String -> Value -> Value -> IO [Value]
|
|
121
130
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
PROJECTVERSION
|
|
@@ -72,8 +72,8 @@ public final class RunnerSupport {
|
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
public static Map<String, Object> envOverride(Map<String, Object> m) {
|
|
75
|
-
if ("TRUE".equals(getenv("
|
|
76
|
-
|| "TRUE".equals(getenv("
|
|
75
|
+
if ("TRUE".equals(getenv("PROJECTENV_TEST_LIVE"))
|
|
76
|
+
|| "TRUE".equals(getenv("PROJECTENV_TEST_OVERRIDE"))) {
|
|
77
77
|
for (String key : new ArrayList<>(m.keySet())) {
|
|
78
78
|
String envval = getenv(key);
|
|
79
79
|
if (envval != null && !envval.isEmpty()) {
|
|
@@ -90,9 +90,9 @@ public final class RunnerSupport {
|
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
-
String explain = getenv("
|
|
93
|
+
String explain = getenv("PROJECTENV_TEST_EXPLAIN");
|
|
94
94
|
if (explain != null && !explain.isEmpty()) {
|
|
95
|
-
m.put("
|
|
95
|
+
m.put("PROJECTENV_TEST_EXPLAIN", explain);
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
return m;
|
|
@@ -62,6 +62,10 @@ final class MakeError {
|
|
|
62
62
|
sdkErr.result = Clean.clean(ctx, result);
|
|
63
63
|
sdkErr.spec = Clean.clean(ctx, spec);
|
|
64
64
|
|
|
65
|
+
// Promote the HTTP status to the top level, so a consumer can branch on
|
|
66
|
+
// `err.status` / `err.notFound()` instead of reaching into `err.result`.
|
|
67
|
+
sdkErr.status = result.status;
|
|
68
|
+
|
|
65
69
|
ctx.ctrl.err = sdkErr;
|
|
66
70
|
|
|
67
71
|
// Fire PreUnexpected so observability features (metrics, telemetry, audit,
|
|
@@ -39,6 +39,10 @@ function makeError(ctx, err) {
|
|
|
39
39
|
err.result = clean(ctx, result)
|
|
40
40
|
err.spec = clean(ctx, spec)
|
|
41
41
|
|
|
42
|
+
// Promote the HTTP status to the top level, so a consumer can branch on
|
|
43
|
+
// `err.status` / `err.notFound` instead of reaching into `err.result`.
|
|
44
|
+
err.status = null == result.status ? -1 : result.status
|
|
45
|
+
|
|
42
46
|
ctx.ctrl.err = err
|
|
43
47
|
|
|
44
48
|
// Fire PreUnexpected so observability features (metrics, telemetry, audit,
|
|
@@ -44,8 +44,8 @@ function makeCtrl(explain) {
|
|
|
44
44
|
// Overrides configuration values with environment variables if available
|
|
45
45
|
function envOverride(m) {
|
|
46
46
|
if (
|
|
47
|
-
'TRUE' === process.env.
|
|
48
|
-
'TRUE' === process.env.
|
|
47
|
+
'TRUE' === process.env.PROJECTENV_TEST_LIVE ||
|
|
48
|
+
'TRUE' === process.env.PROJECTENV_TEST_OVERRIDE
|
|
49
49
|
) {
|
|
50
50
|
Object.entries(m).map(n => {
|
|
51
51
|
let envval = process.env[n[0]]
|
|
@@ -56,7 +56,7 @@ function envOverride(m) {
|
|
|
56
56
|
})
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
m.
|
|
59
|
+
m.PROJECTENV_TEST_EXPLAIN = process.env.PROJECTENV_TEST_EXPLAIN || m.PROJECTENV_TEST_EXPLAIN
|
|
60
60
|
|
|
61
61
|
return m
|
|
62
62
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
PROJECTVERSION
|
|
@@ -63,7 +63,7 @@ object RunnerSupport {
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
fun envOverride(m: MutableMap<String, Any?>): MutableMap<String, Any?> {
|
|
66
|
-
if ("TRUE" == getenv("
|
|
66
|
+
if ("TRUE" == getenv("PROJECTENV_TEST_LIVE") || "TRUE" == getenv("PROJECTENV_TEST_OVERRIDE")) {
|
|
67
67
|
for (key in ArrayList(m.keys)) {
|
|
68
68
|
var envval = getenv(key)
|
|
69
69
|
if (envval != null && envval.isNotEmpty()) {
|
|
@@ -80,9 +80,9 @@ object RunnerSupport {
|
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
val explain = getenv("
|
|
83
|
+
val explain = getenv("PROJECTENV_TEST_EXPLAIN")
|
|
84
84
|
if (explain != null && explain.isNotEmpty()) {
|
|
85
|
-
m["
|
|
85
|
+
m["PROJECTENV_TEST_EXPLAIN"] = explain
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
return m
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
PROJECTVERSION
|