@voxgig/sdkgen 4.34.1 → 4.34.2
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 +1 -1
- package/dist/cmp/ReadmeErrors.js +3 -3
- package/dist/cmp/ReadmeErrors.js.map +1 -1
- package/dist/cmp/ReadmeExplanation.js +3 -3
- package/dist/cmp/ReadmeExplanation.js.map +1 -1
- package/dist/cmp/ReadmeQuick.js +3 -1
- package/dist/cmp/ReadmeQuick.js.map +1 -1
- package/dist/cmp/ReadmeTop.js +9 -8
- package/dist/cmp/ReadmeTop.js.map +1 -1
- package/dist/helpers/definitionPlan.js +8 -4
- package/dist/helpers/definitionPlan.js.map +1 -1
- package/dist/helpers/naming.d.ts +2 -1
- package/dist/helpers/naming.js +11 -4
- package/dist/helpers/naming.js.map +1 -1
- package/dist/helpers/opExample.d.ts +16 -2
- package/dist/helpers/opExample.js +80 -21
- package/dist/helpers/opExample.js.map +1 -1
- package/dist/helpers/opShape.d.ts +3 -1
- package/dist/helpers/opShape.js +21 -8
- package/dist/helpers/opShape.js.map +1 -1
- package/dist/sdkgen.d.ts +4 -4
- package/dist/sdkgen.js +12 -4
- package/dist/sdkgen.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utility.d.ts +2 -1
- package/dist/utility.js +29 -3
- package/dist/utility.js.map +1 -1
- package/package.json +2 -2
- package/project/.sdk/src/cmp/c/ReadmeEntity_c.ts +3 -2
- package/project/.sdk/src/cmp/c/ReadmeHowto_c.ts +7 -3
- package/project/.sdk/src/cmp/c/ReadmeQuick_c.ts +3 -2
- package/project/.sdk/src/cmp/c/ReadmeRef_c.ts +5 -4
- package/project/.sdk/src/cmp/c/ReadmeTopQuick_c.ts +3 -2
- package/project/.sdk/src/cmp/c/ReadmeTopTest_c.ts +8 -7
- package/project/.sdk/src/cmp/c/utility_c.ts +21 -2
- package/project/.sdk/src/cmp/clojure/ReadmeEntity_clojure.ts +4 -1
- package/project/.sdk/src/cmp/clojure/ReadmeHowto_clojure.ts +17 -6
- package/project/.sdk/src/cmp/clojure/ReadmeModel_clojure.ts +6 -6
- package/project/.sdk/src/cmp/clojure/ReadmeQuick_clojure.ts +13 -8
- package/project/.sdk/src/cmp/clojure/ReadmeRef_clojure.ts +21 -18
- package/project/.sdk/src/cmp/clojure/ReadmeTopQuick_clojure.ts +6 -3
- package/project/.sdk/src/cmp/clojure/ReadmeTopTest_clojure.ts +16 -9
- package/project/.sdk/src/cmp/clojure/TestClean_clojure.ts +4 -4
- package/project/.sdk/src/cmp/clojure/fragment/Entity.fragment.clj +2 -1
- package/project/.sdk/src/cmp/clojure/utility_clojure.ts +14 -0
- package/project/.sdk/src/cmp/cpp/ReadmeEntity_cpp.ts +3 -2
- package/project/.sdk/src/cmp/cpp/ReadmeHowto_cpp.ts +7 -3
- package/project/.sdk/src/cmp/cpp/ReadmeQuick_cpp.ts +3 -2
- package/project/.sdk/src/cmp/cpp/ReadmeRef_cpp.ts +6 -5
- package/project/.sdk/src/cmp/cpp/ReadmeTopQuick_cpp.ts +3 -2
- package/project/.sdk/src/cmp/cpp/ReadmeTopTest_cpp.ts +8 -7
- package/project/.sdk/src/cmp/cpp/utility_cpp.ts +13 -0
- package/project/.sdk/src/cmp/csharp/ReadmeEntity_csharp.ts +3 -2
- package/project/.sdk/src/cmp/csharp/ReadmeHowto_csharp.ts +20 -8
- package/project/.sdk/src/cmp/csharp/ReadmeQuick_csharp.ts +13 -8
- package/project/.sdk/src/cmp/csharp/ReadmeRef_csharp.ts +10 -5
- package/project/.sdk/src/cmp/csharp/ReadmeTopQuick_csharp.ts +14 -7
- package/project/.sdk/src/cmp/csharp/ReadmeTopTest_csharp.ts +18 -10
- package/project/.sdk/src/cmp/csharp/utility_csharp.ts +13 -0
- package/project/.sdk/src/cmp/elixir/ReadmeEntity_elixir.ts +4 -4
- package/project/.sdk/src/cmp/elixir/ReadmeExplanation_elixir.ts +2 -1
- package/project/.sdk/src/cmp/elixir/ReadmeHowto_elixir.ts +13 -6
- package/project/.sdk/src/cmp/elixir/ReadmeModel_elixir.ts +5 -5
- package/project/.sdk/src/cmp/elixir/ReadmeQuick_elixir.ts +13 -10
- package/project/.sdk/src/cmp/elixir/ReadmeRef_elixir.ts +11 -11
- package/project/.sdk/src/cmp/elixir/ReadmeTopQuick_elixir.ts +8 -6
- package/project/.sdk/src/cmp/elixir/ReadmeTopTest_elixir.ts +14 -10
- package/project/.sdk/src/cmp/elixir/fragment/EntityCreateOp.fragment.ex +4 -3
- package/project/.sdk/src/cmp/elixir/fragment/EntityListOp.fragment.ex +4 -3
- package/project/.sdk/src/cmp/elixir/fragment/EntityLoadOp.fragment.ex +4 -3
- package/project/.sdk/src/cmp/elixir/fragment/EntityPatchOp.fragment.ex +4 -3
- package/project/.sdk/src/cmp/elixir/fragment/EntityRemoveOp.fragment.ex +4 -3
- package/project/.sdk/src/cmp/elixir/fragment/EntityUpdateOp.fragment.ex +4 -3
- package/project/.sdk/src/cmp/elixir/utility_elixir.ts +12 -0
- package/project/.sdk/src/cmp/go/ReadmeEntity_go.ts +8 -5
- package/project/.sdk/src/cmp/go/ReadmeExplanation_go.ts +3 -1
- package/project/.sdk/src/cmp/go/ReadmeHowto_go.ts +20 -8
- package/project/.sdk/src/cmp/go/ReadmeModel_go.ts +16 -13
- package/project/.sdk/src/cmp/go/ReadmeQuick_go.ts +14 -13
- package/project/.sdk/src/cmp/go/ReadmeRef_go.ts +14 -13
- package/project/.sdk/src/cmp/go/ReadmeTopQuick_go.ts +10 -8
- package/project/.sdk/src/cmp/go/ReadmeTopTest_go.ts +6 -2
- package/project/.sdk/src/cmp/go/utility_go.ts +1 -1
- package/project/.sdk/src/cmp/java/ReadmeEntity_java.ts +8 -19
- package/project/.sdk/src/cmp/java/ReadmeHowto_java.ts +19 -22
- package/project/.sdk/src/cmp/java/ReadmeModel_java.ts +10 -9
- package/project/.sdk/src/cmp/java/ReadmeQuick_java.ts +24 -28
- package/project/.sdk/src/cmp/java/ReadmeRef_java.ts +27 -35
- package/project/.sdk/src/cmp/java/ReadmeTopQuick_java.ts +22 -25
- package/project/.sdk/src/cmp/java/ReadmeTopTest_java.ts +18 -24
- package/project/.sdk/src/cmp/java/utility_java.ts +25 -0
- package/project/.sdk/src/cmp/js/EntityOperation_js.ts +3 -1
- package/project/.sdk/src/cmp/js/ReadmeEntity_js.ts +2 -8
- package/project/.sdk/src/cmp/js/ReadmeHowto_js.ts +11 -9
- package/project/.sdk/src/cmp/js/ReadmeModel_js.ts +9 -9
- package/project/.sdk/src/cmp/js/ReadmeQuick_js.ts +7 -13
- package/project/.sdk/src/cmp/js/ReadmeRef_js.ts +14 -15
- package/project/.sdk/src/cmp/js/ReadmeTopQuick_js.ts +16 -11
- package/project/.sdk/src/cmp/js/ReadmeTopTest_js.ts +11 -7
- package/project/.sdk/src/cmp/js/fragment/EntityCreateOp.fragment.js +1 -1
- package/project/.sdk/src/cmp/js/fragment/EntityListOp.fragment.js +1 -1
- package/project/.sdk/src/cmp/js/fragment/EntityLoadOp.fragment.js +1 -1
- package/project/.sdk/src/cmp/js/fragment/EntityPatchOp.fragment.js +1 -1
- package/project/.sdk/src/cmp/js/fragment/EntityRemoveOp.fragment.js +1 -1
- package/project/.sdk/src/cmp/js/fragment/EntityUpdateOp.fragment.js +1 -1
- package/project/.sdk/src/cmp/js/utility_js.ts +2 -1
- package/project/.sdk/src/cmp/kotlin/ReadmeEntity_kotlin.ts +3 -2
- package/project/.sdk/src/cmp/kotlin/ReadmeHowto_kotlin.ts +19 -9
- package/project/.sdk/src/cmp/kotlin/ReadmeModel_kotlin.ts +10 -9
- package/project/.sdk/src/cmp/kotlin/ReadmeQuick_kotlin.ts +14 -9
- package/project/.sdk/src/cmp/kotlin/ReadmeRef_kotlin.ts +18 -15
- package/project/.sdk/src/cmp/kotlin/ReadmeTopQuick_kotlin.ts +14 -8
- package/project/.sdk/src/cmp/kotlin/ReadmeTopTest_kotlin.ts +17 -10
- package/project/.sdk/src/cmp/kotlin/utility_kotlin.ts +21 -1
- package/project/.sdk/src/cmp/lua/ReadmeEntity_lua.ts +3 -2
- package/project/.sdk/src/cmp/lua/ReadmeExamplesTest_lua.ts +7 -4
- package/project/.sdk/src/cmp/lua/ReadmeHowto_lua.ts +9 -7
- package/project/.sdk/src/cmp/lua/ReadmeModel_lua.ts +13 -13
- package/project/.sdk/src/cmp/lua/ReadmeQuick_lua.ts +20 -9
- package/project/.sdk/src/cmp/lua/ReadmeRef_lua.ts +9 -8
- package/project/.sdk/src/cmp/lua/ReadmeTopQuick_lua.ts +15 -7
- package/project/.sdk/src/cmp/lua/ReadmeTopTest_lua.ts +6 -5
- package/project/.sdk/src/cmp/lua/fragment/Entity.fragment.lua +1 -0
- package/project/.sdk/src/cmp/lua/fragment/EntityCreateOp.fragment.lua +1 -1
- package/project/.sdk/src/cmp/lua/fragment/EntityListOp.fragment.lua +1 -1
- package/project/.sdk/src/cmp/lua/fragment/EntityLoadOp.fragment.lua +1 -1
- package/project/.sdk/src/cmp/lua/fragment/EntityPatchOp.fragment.lua +1 -1
- package/project/.sdk/src/cmp/lua/fragment/EntityRemoveOp.fragment.lua +1 -1
- package/project/.sdk/src/cmp/lua/fragment/EntityUpdateOp.fragment.lua +1 -1
- package/project/.sdk/src/cmp/ocaml/ReadmeEntity_ocaml.ts +3 -2
- package/project/.sdk/src/cmp/ocaml/ReadmeHowto_ocaml.ts +3 -2
- package/project/.sdk/src/cmp/ocaml/ReadmeModel_ocaml.ts +1 -0
- package/project/.sdk/src/cmp/ocaml/ReadmeQuick_ocaml.ts +5 -3
- package/project/.sdk/src/cmp/ocaml/ReadmeRef_ocaml.ts +10 -8
- package/project/.sdk/src/cmp/ocaml/ReadmeTopQuick_ocaml.ts +4 -2
- package/project/.sdk/src/cmp/ocaml/ReadmeTopTest_ocaml.ts +3 -2
- package/project/.sdk/src/cmp/ocaml/utility_ocaml.ts +13 -1
- package/project/.sdk/src/cmp/perl/ReadmeEntity_perl.ts +4 -1
- package/project/.sdk/src/cmp/perl/ReadmeHowto_perl.ts +10 -5
- package/project/.sdk/src/cmp/perl/ReadmeModel_perl.ts +6 -6
- package/project/.sdk/src/cmp/perl/ReadmeQuick_perl.ts +8 -5
- package/project/.sdk/src/cmp/perl/ReadmeRef_perl.ts +21 -18
- package/project/.sdk/src/cmp/perl/ReadmeTopQuick_perl.ts +6 -3
- package/project/.sdk/src/cmp/perl/ReadmeTopTest_perl.ts +11 -8
- package/project/.sdk/src/cmp/perl/fragment/Entity.fragment.pm +1 -1
- package/project/.sdk/src/cmp/perl/fragment/EntityCreateOp.fragment.pm +2 -2
- package/project/.sdk/src/cmp/perl/fragment/EntityLoadOp.fragment.pm +2 -2
- package/project/.sdk/src/cmp/perl/fragment/EntityPatchOp.fragment.pm +2 -2
- package/project/.sdk/src/cmp/perl/fragment/EntityRemoveOp.fragment.pm +1 -1
- package/project/.sdk/src/cmp/perl/fragment/EntityUpdateOp.fragment.pm +2 -2
- package/project/.sdk/src/cmp/perl/utility_perl.ts +11 -1
- package/project/.sdk/src/cmp/php/EntityOperation_php.ts +3 -1
- package/project/.sdk/src/cmp/php/ReadmeEntity_php.ts +4 -3
- package/project/.sdk/src/cmp/php/ReadmeHowto_php.ts +12 -6
- package/project/.sdk/src/cmp/php/ReadmeModel_php.ts +9 -9
- package/project/.sdk/src/cmp/php/ReadmeQuick_php.ts +3 -2
- package/project/.sdk/src/cmp/php/ReadmeRef_php.ts +15 -14
- package/project/.sdk/src/cmp/php/ReadmeTopQuick_php.ts +5 -4
- package/project/.sdk/src/cmp/php/ReadmeTopTest_php.ts +13 -7
- package/project/.sdk/src/cmp/php/fragment/EntityCreateOp.fragment.php +2 -2
- package/project/.sdk/src/cmp/php/fragment/EntityListOp.fragment.php +2 -2
- package/project/.sdk/src/cmp/php/fragment/EntityLoadOp.fragment.php +2 -2
- package/project/.sdk/src/cmp/php/fragment/EntityPatchOp.fragment.php +2 -2
- package/project/.sdk/src/cmp/php/fragment/EntityRemoveOp.fragment.php +2 -2
- package/project/.sdk/src/cmp/php/fragment/EntityUpdateOp.fragment.php +2 -2
- package/project/.sdk/src/cmp/py/EntityOperation_py.ts +3 -1
- package/project/.sdk/src/cmp/py/ReadmeEntity_py.ts +3 -8
- package/project/.sdk/src/cmp/py/ReadmeHowto_py.ts +9 -9
- package/project/.sdk/src/cmp/py/ReadmeModel_py.ts +9 -9
- package/project/.sdk/src/cmp/py/ReadmeQuick_py.ts +9 -14
- package/project/.sdk/src/cmp/py/ReadmeRef_py.ts +23 -30
- package/project/.sdk/src/cmp/py/ReadmeTopQuick_py.ts +7 -12
- package/project/.sdk/src/cmp/py/ReadmeTopTest_py.ts +8 -7
- package/project/.sdk/src/cmp/py/fragment/EntityCreateOp.fragment.py +1 -1
- package/project/.sdk/src/cmp/py/fragment/EntityListOp.fragment.py +1 -1
- package/project/.sdk/src/cmp/py/fragment/EntityLoadOp.fragment.py +1 -1
- package/project/.sdk/src/cmp/py/fragment/EntityPatchOp.fragment.py +1 -1
- package/project/.sdk/src/cmp/py/fragment/EntityRemoveOp.fragment.py +1 -1
- package/project/.sdk/src/cmp/py/fragment/EntityUpdateOp.fragment.py +1 -1
- package/project/.sdk/src/cmp/rb/EntityOperation_rb.ts +3 -1
- package/project/.sdk/src/cmp/rb/EntityTypes_rb.ts +2 -1
- package/project/.sdk/src/cmp/rb/ReadmeEntity_rb.ts +4 -1
- package/project/.sdk/src/cmp/rb/ReadmeExamplesTest_rb.ts +3 -2
- package/project/.sdk/src/cmp/rb/ReadmeHowto_rb.ts +20 -10
- package/project/.sdk/src/cmp/rb/ReadmeModel_rb.ts +10 -9
- package/project/.sdk/src/cmp/rb/ReadmeQuick_rb.ts +6 -3
- package/project/.sdk/src/cmp/rb/ReadmeRef_rb.ts +14 -11
- package/project/.sdk/src/cmp/rb/ReadmeTopQuick_rb.ts +6 -3
- package/project/.sdk/src/cmp/rb/ReadmeTopTest_rb.ts +14 -10
- package/project/.sdk/src/cmp/rb/fragment/EntityCreateOp.fragment.rb +2 -1
- package/project/.sdk/src/cmp/rb/fragment/EntityListOp.fragment.rb +1 -1
- package/project/.sdk/src/cmp/rb/fragment/EntityLoadOp.fragment.rb +2 -1
- package/project/.sdk/src/cmp/rb/fragment/EntityPatchOp.fragment.rb +2 -1
- package/project/.sdk/src/cmp/rb/fragment/EntityRemoveOp.fragment.rb +2 -1
- package/project/.sdk/src/cmp/rb/fragment/EntityUpdateOp.fragment.rb +2 -1
- package/project/.sdk/src/cmp/rb/utility_rb.ts +10 -0
- package/project/.sdk/src/cmp/rust/ReadmeEntity_rust.ts +3 -2
- package/project/.sdk/src/cmp/rust/ReadmeHowto_rust.ts +6 -2
- package/project/.sdk/src/cmp/rust/ReadmeQuick_rust.ts +3 -2
- package/project/.sdk/src/cmp/rust/ReadmeRef_rust.ts +5 -4
- package/project/.sdk/src/cmp/rust/ReadmeTopQuick_rust.ts +3 -2
- package/project/.sdk/src/cmp/rust/ReadmeTopTest_rust.ts +7 -6
- package/project/.sdk/src/cmp/rust/utility_rust.ts +13 -1
- package/project/.sdk/src/cmp/scala/EntityTypes_scala.ts +5 -2
- package/project/.sdk/src/cmp/scala/ReadmeEntity_scala.ts +8 -19
- package/project/.sdk/src/cmp/scala/ReadmeHowto_scala.ts +17 -22
- package/project/.sdk/src/cmp/scala/ReadmeModel_scala.ts +10 -9
- package/project/.sdk/src/cmp/scala/ReadmeQuick_scala.ts +18 -28
- package/project/.sdk/src/cmp/scala/ReadmeRef_scala.ts +25 -35
- package/project/.sdk/src/cmp/scala/ReadmeTopQuick_scala.ts +14 -25
- package/project/.sdk/src/cmp/scala/ReadmeTopTest_scala.ts +16 -24
- package/project/.sdk/src/cmp/scala/utility_scala.ts +25 -0
- package/project/.sdk/src/cmp/swift/EntityTypes_swift.ts +1 -1
- package/project/.sdk/src/cmp/swift/ReadmeEntity_swift.ts +3 -2
- package/project/.sdk/src/cmp/swift/ReadmeHowto_swift.ts +22 -8
- package/project/.sdk/src/cmp/swift/ReadmeModel_swift.ts +10 -9
- package/project/.sdk/src/cmp/swift/ReadmeQuick_swift.ts +16 -8
- package/project/.sdk/src/cmp/swift/ReadmeRef_swift.ts +20 -15
- package/project/.sdk/src/cmp/swift/ReadmeTopQuick_swift.ts +12 -7
- package/project/.sdk/src/cmp/swift/ReadmeTopTest_swift.ts +21 -10
- package/project/.sdk/src/cmp/swift/utility_swift.ts +14 -1
- package/project/.sdk/src/cmp/ts/ReadmeEntity_ts.ts +2 -8
- package/project/.sdk/src/cmp/ts/ReadmeHowto_ts.ts +11 -9
- package/project/.sdk/src/cmp/ts/ReadmeModel_ts.ts +9 -9
- package/project/.sdk/src/cmp/ts/ReadmeQuick_ts.ts +7 -13
- package/project/.sdk/src/cmp/ts/ReadmeRef_ts.ts +14 -23
- package/project/.sdk/src/cmp/ts/ReadmeTopQuick_ts.ts +8 -14
- package/project/.sdk/src/cmp/ts/ReadmeTopTest_ts.ts +29 -14
- package/project/.sdk/src/cmp/ts/fragment/EntityCreateOp.fragment.ts +1 -1
- package/project/.sdk/src/cmp/ts/fragment/EntityListOp.fragment.ts +1 -1
- package/project/.sdk/src/cmp/ts/fragment/EntityLoadOp.fragment.ts +1 -1
- package/project/.sdk/src/cmp/ts/fragment/EntityPatchOp.fragment.ts +1 -1
- package/project/.sdk/src/cmp/ts/fragment/EntityUpdateOp.fragment.ts +1 -1
- package/project/.sdk/src/cmp/ts/utility_ts.ts +2 -1
- package/project/.sdk/src/cmp/zig/ReadmeEntity_zig.ts +3 -2
- package/project/.sdk/src/cmp/zig/ReadmeHowto_zig.ts +6 -2
- package/project/.sdk/src/cmp/zig/ReadmeQuick_zig.ts +4 -3
- package/project/.sdk/src/cmp/zig/ReadmeRef_zig.ts +5 -4
- package/project/.sdk/src/cmp/zig/ReadmeTopQuick_zig.ts +3 -2
- package/project/.sdk/src/cmp/zig/ReadmeTopTest_zig.ts +7 -6
- package/project/.sdk/src/cmp/zig/utility_zig.ts +13 -0
- package/project/.sdk/tm/c/utility/transform_request.c +1 -1
- package/project/.sdk/tm/clojure/src/sdk/core.clj +32 -26
- package/project/.sdk/tm/clojure/test/sdk/test/concurrency.clj +136 -0
- package/project/.sdk/tm/clojure/test/sdk/test_runner.clj +3 -1
- package/project/.sdk/tm/cpp/core/types.hpp +36 -6
- package/project/.sdk/tm/cpp/test/concurrency_test.cpp +348 -0
- package/project/.sdk/tm/cpp/utility/pipeline.hpp +42 -25
- package/project/.sdk/tm/csharp/core/Context.cs +8 -5
- package/project/.sdk/tm/csharp/test/ConcurrencyTest.cs +238 -0
- package/project/.sdk/tm/csharp/utility/Clean.cs +12 -10
- package/project/.sdk/tm/csharp/utility/TransformRequest.cs +1 -1
- package/project/.sdk/tm/elixir/lib/projectname/context.ex +3 -0
- package/project/.sdk/tm/elixir/lib/projectname/entity_base.ex +2 -1
- package/project/.sdk/tm/elixir/lib/projectname/utility.ex +31 -10
- package/project/.sdk/tm/elixir/test/concurrency_test.exs +176 -0
- package/project/.sdk/tm/go/core/context.go +5 -1
- package/project/.sdk/tm/go/test/concurrency_test.go +214 -0
- package/project/.sdk/tm/go/utility/transform_request.go +1 -1
- package/project/.sdk/tm/java/core/Context.java +6 -3
- package/project/.sdk/tm/java/test/ConcurrencyTest.java +221 -0
- package/project/.sdk/tm/java/utility/Clean.java +22 -17
- package/project/.sdk/tm/java/utility/TransformRequest.java +1 -1
- package/project/.sdk/tm/js/src/utility/TransformRequestUtility.js +1 -1
- package/project/.sdk/tm/kotlin/core/Context.kt +5 -3
- package/project/.sdk/tm/kotlin/test/ConcurrencyTest.kt +193 -0
- package/project/.sdk/tm/kotlin/utility/ResultTransform.kt +1 -1
- package/project/.sdk/tm/lua/utility/transform_request.lua +1 -1
- package/project/.sdk/tm/ocaml/Makefile +21 -8
- package/project/.sdk/tm/ocaml/sdk_runtime.ml +27 -12
- package/project/.sdk/tm/ocaml/sdk_types.ml +6 -2
- package/project/.sdk/tm/ocaml/test/concurrency_test.ml +148 -0
- package/project/.sdk/tm/perl/utility/transform_request.pm +1 -1
- package/project/.sdk/tm/php/feature/TestFeature.php +9 -9
- package/project/.sdk/tm/php/utility/TransformRequest.php +1 -1
- package/project/.sdk/tm/py/pkg/core/context.py +2 -2
- package/project/.sdk/tm/py/pkg/utility/clean.py +12 -8
- package/project/.sdk/tm/py/pkg/utility/transform_request.py +1 -1
- package/project/.sdk/tm/py/test/test_concurrency.py +177 -0
- package/project/.sdk/tm/rb/core/context.rb +8 -3
- package/project/.sdk/tm/rb/test/concurrency_test.rb +160 -0
- package/project/.sdk/tm/rb/utility/clean.rb +8 -7
- package/project/.sdk/tm/rb/utility/transform_request.rb +1 -1
- package/project/.sdk/tm/rust/utility/transform_request.rs +1 -1
- package/project/.sdk/tm/scala/Makefile +2 -0
- package/project/.sdk/tm/scala/core/Context.scala +6 -4
- package/project/.sdk/tm/scala/sdktest/ConcurrencyTest.scala +186 -0
- package/project/.sdk/tm/scala/utility/Transform.scala +1 -1
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/core/Context.swift +2 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/ResultUtil.swift +35 -12
- package/project/.sdk/tm/swift/Tests/ProjectNameSDKTests/ConcurrencyTest.swift +214 -0
- package/project/.sdk/tm/ts/src/utility/TransformRequestUtility.ts +1 -1
- package/project/.sdk/tm/zig/core/utility.zig +1 -1
- package/project/.sdk/tm/zig/feature/test.zig +10 -8
- package/project/sdkgen-package.json +1 -1
- package/src/cmp/ReadmeErrors.ts +5 -5
- package/src/cmp/ReadmeExplanation.ts +4 -5
- package/src/cmp/ReadmeQuick.ts +3 -1
- package/src/cmp/ReadmeTop.ts +10 -12
- package/src/helpers/definitionPlan.ts +8 -4
- package/src/helpers/naming.ts +12 -4
- package/src/helpers/opExample.ts +97 -25
- package/src/helpers/opShape.ts +25 -9
- package/src/sdkgen.ts +14 -3
- package/src/utility.ts +31 -4
|
@@ -67,7 +67,7 @@ private func stripAction(_ reqdata: Value) -> Value {
|
|
|
67
67
|
|
|
68
68
|
// A header, cookie or query argument travels where prepareHeadersUtil or
|
|
69
69
|
// prepareQueryUtil sends it, so the body is built from the request data
|
|
70
|
-
// without it, unless the
|
|
70
|
+
// without it, unless the point marks it as a field the body keeps.
|
|
71
71
|
private func routedArgNames(_ ctx: Context) -> [String] {
|
|
72
72
|
return (callArgs(ctx, "header") + callArgs(ctx, "cookie") + callArgs(ctx, "query")).map { $0.name }
|
|
73
73
|
.filter { !fieldArg(ctx, $0) }
|
|
@@ -143,11 +143,43 @@ extension Utility {
|
|
|
143
143
|
public final class CleanConfig {
|
|
144
144
|
public var active = true
|
|
145
145
|
public var keys: [String] = []
|
|
146
|
-
public var values: [String] = []
|
|
147
146
|
public var mask = "[redacted]"
|
|
148
147
|
public var hint = 0
|
|
149
148
|
public var min = 4
|
|
149
|
+
|
|
150
|
+
// Requests on other threads clean while one registers, so the registry
|
|
151
|
+
// is read and written under its own lock.
|
|
152
|
+
private let lock = NSLock()
|
|
153
|
+
private var registry: [String] = []
|
|
154
|
+
|
|
155
|
+
public var values: [String] {
|
|
156
|
+
get {
|
|
157
|
+
lock.lock()
|
|
158
|
+
defer { lock.unlock() }
|
|
159
|
+
return registry
|
|
160
|
+
}
|
|
161
|
+
set {
|
|
162
|
+
lock.lock()
|
|
163
|
+
defer { lock.unlock() }
|
|
164
|
+
registry = newValue
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
150
168
|
public init() {}
|
|
169
|
+
|
|
170
|
+
// The forms not yet registered are added, longest first, in one step.
|
|
171
|
+
func register(_ forms: [String]) {
|
|
172
|
+
lock.lock()
|
|
173
|
+
defer { lock.unlock() }
|
|
174
|
+
var changed = false
|
|
175
|
+
for form in forms where form.count >= min && !registry.contains(form) {
|
|
176
|
+
registry.append(form)
|
|
177
|
+
changed = true
|
|
178
|
+
}
|
|
179
|
+
if changed {
|
|
180
|
+
registry.sort { $0.count > $1.count }
|
|
181
|
+
}
|
|
182
|
+
}
|
|
151
183
|
}
|
|
152
184
|
}
|
|
153
185
|
|
|
@@ -228,16 +260,7 @@ private func cleanForms(_ value: String) -> [String] {
|
|
|
228
260
|
func cleanAddUtil(_ ctx: Context, _ value: Value) {
|
|
229
261
|
let cfg = cleanConfigOf(ctx)
|
|
230
262
|
guard let s = value.asString, s.count >= cfg.min else { return }
|
|
231
|
-
|
|
232
|
-
for form in cleanForms(s) {
|
|
233
|
-
if form.count >= cfg.min && !cfg.values.contains(form) {
|
|
234
|
-
cfg.values.append(form)
|
|
235
|
-
changed = true
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
if changed {
|
|
239
|
-
cfg.values.sort { $0.count > $1.count }
|
|
240
|
-
}
|
|
263
|
+
cfg.register(cleanForms(s))
|
|
241
264
|
}
|
|
242
265
|
|
|
243
266
|
// Every scalar under a sensitive name, at any depth and of any shape: a
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
// Requests in flight at once on one client. Each registers and cleans
|
|
2
|
+
// secrets through the one registry the client holds. A context keeps its own
|
|
3
|
+
// copy of the operation cache, so requests share no cache to race on.
|
|
4
|
+
|
|
5
|
+
import Foundation
|
|
6
|
+
import XCTest
|
|
7
|
+
|
|
8
|
+
@testable import ProjectNameSdk
|
|
9
|
+
|
|
10
|
+
final class ConcurrencyTest: XCTestCase {
|
|
11
|
+
private static let rounds = 200
|
|
12
|
+
private static let width = 8
|
|
13
|
+
private static let ops = 32
|
|
14
|
+
private static let masked = "a [redacted] b [redacted] c"
|
|
15
|
+
|
|
16
|
+
// What the racing threads report, under one lock.
|
|
17
|
+
private final class Outcome {
|
|
18
|
+
private let lock = NSLock()
|
|
19
|
+
private var notes: [String] = []
|
|
20
|
+
private var left: Int
|
|
21
|
+
|
|
22
|
+
init(registering: Int) {
|
|
23
|
+
left = registering
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
func note(_ what: String) {
|
|
27
|
+
lock.lock()
|
|
28
|
+
defer { lock.unlock() }
|
|
29
|
+
notes.append(what)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
var first: String? {
|
|
33
|
+
lock.lock()
|
|
34
|
+
defer { lock.unlock() }
|
|
35
|
+
return notes.first
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
func registered() {
|
|
39
|
+
lock.lock()
|
|
40
|
+
defer { lock.unlock() }
|
|
41
|
+
left -= 1
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
var registering: Bool {
|
|
45
|
+
lock.lock()
|
|
46
|
+
defer { lock.unlock() }
|
|
47
|
+
return 0 < left
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// A live client whose transport answers at once.
|
|
52
|
+
private static func liveClient() -> ProjectNameSDK {
|
|
53
|
+
let fetcher: FetcherFunc = { _, _, _ in
|
|
54
|
+
let res = VMap()
|
|
55
|
+
res.entries["status"] = .int(200)
|
|
56
|
+
res.entries["statusText"] = .string("OK")
|
|
57
|
+
res.entries["headers"] = .map(VMap())
|
|
58
|
+
res.entries["json"] = .nat({ () -> Value in .map(vm(("ok", .bool(true)))) } as NativeCall0)
|
|
59
|
+
return .map(res)
|
|
60
|
+
}
|
|
61
|
+
return ProjectNameSDK(vm(
|
|
62
|
+
("base", .string("http://concurrency.test/api")),
|
|
63
|
+
("allow", .map(vm(("op", .string("direct"))))),
|
|
64
|
+
("utility", .map(vm(("fetcher", .nat(fetcher)))))))
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Runs body on width threads, released once every one is waiting; a
|
|
68
|
+
// thread's error is noted.
|
|
69
|
+
private static func atOnce(_ outcome: Outcome, _ body: @escaping (Int) throws -> Void) {
|
|
70
|
+
let ready = DispatchSemaphore(value: 0)
|
|
71
|
+
let start = DispatchSemaphore(value: 0)
|
|
72
|
+
let done = DispatchGroup()
|
|
73
|
+
for n in 0..<width {
|
|
74
|
+
done.enter()
|
|
75
|
+
let thread = Thread {
|
|
76
|
+
ready.signal()
|
|
77
|
+
start.wait()
|
|
78
|
+
do {
|
|
79
|
+
try body(n)
|
|
80
|
+
} catch {
|
|
81
|
+
outcome.note("threw: \(error)")
|
|
82
|
+
}
|
|
83
|
+
done.leave()
|
|
84
|
+
}
|
|
85
|
+
thread.start()
|
|
86
|
+
}
|
|
87
|
+
for _ in 0..<width {
|
|
88
|
+
ready.wait()
|
|
89
|
+
}
|
|
90
|
+
for _ in 0..<width {
|
|
91
|
+
start.signal()
|
|
92
|
+
}
|
|
93
|
+
done.wait()
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
private static func addedSecret(_ round: Int, _ n: Int, _ k: Int) -> String {
|
|
97
|
+
return "ADDED-SECRET-\(round)-\(n)-\(k)"
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// Registers thread n's secrets, then counts the thread out.
|
|
101
|
+
private static func registerSecrets(
|
|
102
|
+
_ utility: Utility, _ root: Context, _ round: Int, _ n: Int, _ outcome: Outcome
|
|
103
|
+
) {
|
|
104
|
+
defer { outcome.registered() }
|
|
105
|
+
for k in 0..<ops {
|
|
106
|
+
utility.cleanAdd(root, .string(addedSecret(round, n, k)))
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// The first secret registered in the round that a clean leaves raw.
|
|
111
|
+
private static func unmaskedSecret(_ utility: Utility, _ root: Context, _ round: Int) -> String? {
|
|
112
|
+
for n in 0..<(width / 2) {
|
|
113
|
+
for k in 0..<ops {
|
|
114
|
+
let added = addedSecret(round, n, k)
|
|
115
|
+
if utility.clean(root, .string(added)).asString != "[redacted]" {
|
|
116
|
+
return added
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return nil
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
func testConcurrentFirstRequestsSucceed() {
|
|
124
|
+
for round in 0..<ConcurrencyTest.rounds {
|
|
125
|
+
// A fresh client each round, so every request in it is a first request.
|
|
126
|
+
let client = ConcurrencyTest.liveClient()
|
|
127
|
+
let outcome = Outcome(registering: 0)
|
|
128
|
+
ConcurrencyTest.atOnce(outcome) { n in
|
|
129
|
+
let res = client.direct(vm(("path", .string("p\(n)"))))
|
|
130
|
+
if gp(res, "ok") != .bool(true) {
|
|
131
|
+
outcome.note("request \(n) failed: \(stringify(.map(res)))")
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
if let first = outcome.first {
|
|
135
|
+
XCTFail("round \(round): \(first)")
|
|
136
|
+
return
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// Secrets registered on some threads while others clean: every clean masks
|
|
142
|
+
// what was registered before it, the longer secret whole, and no
|
|
143
|
+
// registration is lost.
|
|
144
|
+
func testConcurrentRegistrationKeepsEverySecretMasked() {
|
|
145
|
+
let half = ConcurrencyTest.width / 2
|
|
146
|
+
let masked = ConcurrencyTest.masked
|
|
147
|
+
for round in 0..<(ConcurrencyTest.rounds / 4) {
|
|
148
|
+
let client = ConcurrencyTest.liveClient()
|
|
149
|
+
let utility = client.getUtility()
|
|
150
|
+
let root = client.getRootCtx()
|
|
151
|
+
let inner = "INNER-SECRET-\(round)"
|
|
152
|
+
utility.cleanAdd(root, .string(inner))
|
|
153
|
+
utility.cleanAdd(root, .string("OUTER-\(inner)-TAIL"))
|
|
154
|
+
let text = "a \(inner) b OUTER-\(inner)-TAIL c"
|
|
155
|
+
XCTAssertEqual(utility.clean(root, .string(text)).asString, masked, "round \(round)")
|
|
156
|
+
|
|
157
|
+
let outcome = Outcome(registering: half)
|
|
158
|
+
ConcurrencyTest.atOnce(outcome) { n in
|
|
159
|
+
if n < half {
|
|
160
|
+
ConcurrencyTest.registerSecrets(utility, root, round, n, outcome)
|
|
161
|
+
return
|
|
162
|
+
}
|
|
163
|
+
while outcome.registering {
|
|
164
|
+
let got = utility.clean(root, .string(text)).asString ?? ""
|
|
165
|
+
if got != masked {
|
|
166
|
+
outcome.note("cleaned to: \(got)")
|
|
167
|
+
return
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
if let first = outcome.first {
|
|
172
|
+
XCTFail("round \(round) \(first)")
|
|
173
|
+
return
|
|
174
|
+
}
|
|
175
|
+
if let raw = ConcurrencyTest.unmaskedSecret(utility, root, round) {
|
|
176
|
+
XCTFail("round \(round): \(raw) was registered but not masked")
|
|
177
|
+
return
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
// Requests on one client while secrets register on it: each request copies
|
|
183
|
+
// the client's options, the registry among them.
|
|
184
|
+
func testConcurrentRequestsSurviveRegistration() {
|
|
185
|
+
let half = ConcurrencyTest.width / 2
|
|
186
|
+
for round in 0..<(ConcurrencyTest.rounds / 4) {
|
|
187
|
+
let client = ConcurrencyTest.liveClient()
|
|
188
|
+
let utility = client.getUtility()
|
|
189
|
+
let root = client.getRootCtx()
|
|
190
|
+
let outcome = Outcome(registering: half)
|
|
191
|
+
ConcurrencyTest.atOnce(outcome) { n in
|
|
192
|
+
if n < half {
|
|
193
|
+
ConcurrencyTest.registerSecrets(utility, root, round, n, outcome)
|
|
194
|
+
return
|
|
195
|
+
}
|
|
196
|
+
while outcome.registering {
|
|
197
|
+
let res = client.direct(vm(("path", .string("p\(n)"))))
|
|
198
|
+
if gp(res, "ok") != .bool(true) {
|
|
199
|
+
outcome.note("a request failed: \(stringify(.map(res)))")
|
|
200
|
+
return
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
if let first = outcome.first {
|
|
205
|
+
XCTFail("round \(round) \(first)")
|
|
206
|
+
return
|
|
207
|
+
}
|
|
208
|
+
if let raw = ConcurrencyTest.unmaskedSecret(utility, root, round) {
|
|
209
|
+
XCTFail("round \(round): \(raw) was registered but not masked")
|
|
210
|
+
return
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
@@ -37,7 +37,7 @@ function stripAction(reqdata: any) {
|
|
|
37
37
|
|
|
38
38
|
// A header, cookie or query argument travels where prepareHeaders or
|
|
39
39
|
// prepareQuery sends it, so the body is built from the request data without
|
|
40
|
-
// it, unless the
|
|
40
|
+
// it, unless the point marks it as a field the body keeps.
|
|
41
41
|
function routedArgNames(ctx: Context): string[] {
|
|
42
42
|
return [...callArgs(ctx, 'header'), ...callArgs(ctx, 'cookie'), ...callArgs(ctx, 'query')]
|
|
43
43
|
.map((arg) => arg.name)
|
|
@@ -2164,7 +2164,7 @@ fn strip_action(reqdata: Value) Value {
|
|
|
2164
2164
|
|
|
2165
2165
|
// A header, cookie or query argument travels where prepare_headers_util or
|
|
2166
2166
|
// prepare_query_util sends it, so the body is built from the request data
|
|
2167
|
-
// without it, unless the
|
|
2167
|
+
// without it, unless the point marks it as a field the body keeps.
|
|
2168
2168
|
fn routed_arg_names(ctx: *Context) [][]const u8 {
|
|
2169
2169
|
var names: std.ArrayList([]const u8) = .empty;
|
|
2170
2170
|
for ([_][]const u8{ "header", "cookie", "query" }) |kind| {
|
|
@@ -206,17 +206,19 @@ fn pick_point(points: Value) Value {
|
|
|
206
206
|
return point;
|
|
207
207
|
}
|
|
208
208
|
|
|
209
|
+
// Each name is read from its arg: this struct port's `$EACH` transform answers
|
|
210
|
+
// null for every `$KEY.name`, where the other ports answer the names.
|
|
209
211
|
fn reqd_names(point: Value, kind: []const u8) Value {
|
|
210
212
|
const args_path = h.getpath(&.{ "args", kind }, point);
|
|
211
213
|
const reqd_args = vs.select(h.A(), args_path, h.jo(&.{.{ "reqd", h.vbool(true) }})) catch return h.olist();
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
}
|
|
219
|
-
return
|
|
214
|
+
const names = h.olist();
|
|
215
|
+
if (reqd_args == .array) {
|
|
216
|
+
for (reqd_args.array.data.items) |arg| {
|
|
217
|
+
const name = h.getp(arg, "name");
|
|
218
|
+
if (name == .string) names.array.append(name) catch {};
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
return names;
|
|
220
222
|
}
|
|
221
223
|
|
|
222
224
|
fn build_args(ctx: *Context, args: Value) Value {
|
package/src/cmp/ReadmeErrors.ts
CHANGED
|
@@ -8,8 +8,8 @@ import {
|
|
|
8
8
|
} from '../types'
|
|
9
9
|
|
|
10
10
|
import { entityIdField, pickExampleEntity } from '../helpers/opShape'
|
|
11
|
-
import { primaryOpCall } from '../helpers/opExample'
|
|
12
|
-
import type {
|
|
11
|
+
import { helperLang, primaryOpCall } from '../helpers/opExample'
|
|
12
|
+
import type { PrimaryCall } from '../helpers/opExample'
|
|
13
13
|
import { safeVarName, exampleVarName } from '../helpers/naming'
|
|
14
14
|
|
|
15
15
|
|
|
@@ -28,7 +28,7 @@ const DEFAULT_LANG: LangErrors = {
|
|
|
28
28
|
\`\`\`ts
|
|
29
29
|
try {
|
|
30
30
|
const ${call.resultVar} = await ${call.expr}
|
|
31
|
-
console.log(${call.resultVar})
|
|
31
|
+
console.log(${'list' === op ? call.resultVar + '.map((item) => item.data())' : call.resultVar + '.data()'})
|
|
32
32
|
} catch (err) {
|
|
33
33
|
console.error('${op} failed:', err)
|
|
34
34
|
}
|
|
@@ -62,7 +62,7 @@ const LANGS: Record<string, LangErrors> = {
|
|
|
62
62
|
\`\`\`python
|
|
63
63
|
try:
|
|
64
64
|
${call.resultVar} = ${call.expr}
|
|
65
|
-
print(${call.resultVar})
|
|
65
|
+
print(${'list' === op ? '[item.data_get() for item in ' + call.resultVar + ']' : call.resultVar + '.data_get()'})
|
|
66
66
|
except Exception as err:
|
|
67
67
|
print(f"${op} failed: {err}")
|
|
68
68
|
\`\`\`
|
|
@@ -228,7 +228,7 @@ const ReadmeErrors = cmp(function ReadmeErrors(props: any) {
|
|
|
228
228
|
const eName = ex.Name || (ex.name[0].toUpperCase() + ex.name.slice(1))
|
|
229
229
|
const eLower = exampleVarName(eName.toLowerCase(), target.name)
|
|
230
230
|
const idF = entityIdField(ex)
|
|
231
|
-
const call = primaryOpCall(target.name
|
|
231
|
+
const call = primaryOpCall(helperLang(target.name), eName, eLower, primaryOp, idF, ex)
|
|
232
232
|
Content(lang.entity(call, primaryOp))
|
|
233
233
|
}
|
|
234
234
|
|
|
@@ -12,8 +12,7 @@ import {
|
|
|
12
12
|
import { optionalComponent } from '../helpers/optional'
|
|
13
13
|
|
|
14
14
|
import { entityIdField, pickExampleEntity } from '../helpers/opShape'
|
|
15
|
-
import { idLiteral, matchArg, dataArg } from '../helpers/opExample'
|
|
16
|
-
import type { ExampleLang } from '../helpers/opExample'
|
|
15
|
+
import { helperLang, idLiteral, matchArg, listMatchArg, dataArg } from '../helpers/opExample'
|
|
17
16
|
import { safeVarName, exampleVarName, phpEntityAccessor } from '../helpers/naming'
|
|
18
17
|
|
|
19
18
|
|
|
@@ -232,7 +231,7 @@ const ReadmeExplanation = cmp(function ReadmeExplanation(props: any) {
|
|
|
232
231
|
// skipped (a direct()-only SDK has no entity op to illustrate).
|
|
233
232
|
const entity = getModelPath(model, `main.${KIT}.entity`, { only_active: false, required: false })
|
|
234
233
|
const { entity: ex, primaryOp } = pickExampleEntity(entity || {})
|
|
235
|
-
const lname = target.name
|
|
234
|
+
const lname = helperLang(target.name)
|
|
236
235
|
const hasEntityExample = !!(ex && primaryOp)
|
|
237
236
|
|
|
238
237
|
let eName = 'Entity', eLower = 'entity', stateArg = '', matchIdF: string | null = null, idLit = ''
|
|
@@ -246,9 +245,9 @@ const ReadmeExplanation = cmp(function ReadmeExplanation(props: any) {
|
|
|
246
245
|
// match compiles.
|
|
247
246
|
idLit = idLiteral(ex, primaryOp as string, idF)
|
|
248
247
|
// Language-correct call argument for the primary op: a match for
|
|
249
|
-
// load/remove, a required-field body for create/update
|
|
248
|
+
// load/remove/list, a required-field body for create/update.
|
|
250
249
|
if ('list' === primaryOp) {
|
|
251
|
-
stateArg =
|
|
250
|
+
stateArg = listMatchArg(lname, ex)
|
|
252
251
|
} else if (isMatchOp) {
|
|
253
252
|
stateArg = matchArg(lname, ex, primaryOp as string, idF, idLit)
|
|
254
253
|
} else {
|
package/src/cmp/ReadmeQuick.ts
CHANGED
|
@@ -2,17 +2,19 @@
|
|
|
2
2
|
import { Content } from 'jostraca'
|
|
3
3
|
import { cmp } from '../helpers/component'
|
|
4
4
|
|
|
5
|
+
import { credentialPlacement } from '../utility'
|
|
5
6
|
import { optionalComponent } from '../helpers/optional'
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
const ReadmeQuick = cmp(function ReadmeQuick(props: any) {
|
|
9
10
|
const { target, ctx$ } = props
|
|
11
|
+
const placement = credentialPlacement(ctx$.model)
|
|
10
12
|
|
|
11
13
|
Content(`
|
|
12
14
|
## Tutorial: your first API call
|
|
13
15
|
|
|
14
16
|
This tutorial walks through creating a client, listing entities, and
|
|
15
|
-
loading a specific record
|
|
17
|
+
loading a specific record.${'' === placement ? '' : ' ' + placement}
|
|
16
18
|
|
|
17
19
|
`)
|
|
18
20
|
|
package/src/cmp/ReadmeTop.ts
CHANGED
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
getModelPath
|
|
8
8
|
} from '../types'
|
|
9
9
|
|
|
10
|
+
import { credentialPlacement } from '../utility'
|
|
10
11
|
import { optionalComponent } from '../helpers/optional'
|
|
11
12
|
import { featureDocs } from './FeatureDocs'
|
|
12
13
|
import type { FeatureDoc } from './FeatureDocs'
|
|
@@ -14,11 +15,11 @@ import type { FeatureDoc } from './FeatureDocs'
|
|
|
14
15
|
import {
|
|
15
16
|
entityPrimaryOp, entityIdField, opRequestShape, entityPath, entityActions,
|
|
16
17
|
} from '../helpers/opShape'
|
|
17
|
-
import { matchArg, idLiteral, primaryOpCall } from '../helpers/opExample'
|
|
18
|
+
import { EXAMPLE_LANGS, matchArg, listMatchArg, idLiteral, primaryOpCall } from '../helpers/opExample'
|
|
18
19
|
import { mcpTools, MCP_WRITE_OPS } from '../helpers/mcpTools'
|
|
19
20
|
import type { ExampleLang, PrimaryCall } from '../helpers/opExample'
|
|
20
|
-
import {
|
|
21
|
-
import { safeVarName, exampleVarName } from '../helpers/naming'
|
|
21
|
+
import { canonScalarKey } from '../helpers/canonType'
|
|
22
|
+
import { safeVarName, exampleVarName, jsKey } from '../helpers/naming'
|
|
22
23
|
import { modelText } from '../helpers/text'
|
|
23
24
|
|
|
24
25
|
import {
|
|
@@ -43,7 +44,8 @@ const VOXGIG_SDK = 'https://voxgig.com/sdk/'
|
|
|
43
44
|
// type sentinel — mirrors the per-language `exampleValue`, but inline because
|
|
44
45
|
// this neutral component renders the intro `ts` block directly.
|
|
45
46
|
function tsExampleLiteral(type: any): string {
|
|
46
|
-
const k =
|
|
47
|
+
const k = canonScalarKey(type)
|
|
48
|
+
if ('NULL' === k) return 'null'
|
|
47
49
|
if ('INTEGER' === k || 'NUMBER' === k) return '1'
|
|
48
50
|
if ('BOOLEAN' === k) return 'true'
|
|
49
51
|
if ('ARRAY' === k) return '[]'
|
|
@@ -70,10 +72,6 @@ function isConsumer(target: any): boolean {
|
|
|
70
72
|
}
|
|
71
73
|
|
|
72
74
|
|
|
73
|
-
// The languages the example helpers can write, in the order a reader is
|
|
74
|
-
// likeliest to want one.
|
|
75
|
-
const EXAMPLE_LANGS: ExampleLang[] = ['ts', 'js', 'py', 'go', 'php', 'rb', 'lua']
|
|
76
|
-
|
|
77
75
|
const EXAMPLE_FENCE: Record<string, string> = {
|
|
78
76
|
ts: 'ts', js: 'js', py: 'python', go: 'go', php: 'php', rb: 'ruby', lua: 'lua',
|
|
79
77
|
}
|
|
@@ -288,8 +286,7 @@ ${aboutMd.trim()}
|
|
|
288
286
|
const primaryOp = entityPrimaryOp(exEnt)
|
|
289
287
|
let exCall = ''
|
|
290
288
|
const exIdField = entityIdField(exEnt)
|
|
291
|
-
const exListArg =
|
|
292
|
-
idLiteral(exEnt, 'list', exIdField))
|
|
289
|
+
const exListArg = listMatchArg('ts', exEnt)
|
|
293
290
|
const exLoadArg = matchArg('ts', exEnt, 'load', exIdField,
|
|
294
291
|
idLiteral(exEnt, 'load', exIdField))
|
|
295
292
|
|
|
@@ -308,7 +305,7 @@ ${aboutMd.trim()}
|
|
|
308
305
|
(it.name !== exIdF && it.name !== 'id') || !it.optional)
|
|
309
306
|
const required = shapeItems.filter((it: any) => !it.optional)
|
|
310
307
|
const chosen = required.length ? required : shapeItems.slice(0, 3)
|
|
311
|
-
const bodyLines = chosen.map((it: any) => ` ${it.name}: ${tsExampleLiteral(it.type)},`)
|
|
308
|
+
const bodyLines = chosen.map((it: any) => ` ${jsKey(it.name)}: ${tsExampleLiteral(it.type)},`)
|
|
312
309
|
const body = bodyLines.length ? `\n${bodyLines.join('\n')}\n` : ''
|
|
313
310
|
exCall = `const ${exLower} = await client.${ex}().${primaryOp}({${body}})`
|
|
314
311
|
}
|
|
@@ -413,8 +410,9 @@ network, and no credentials:
|
|
|
413
410
|
if (LeadQuick) {
|
|
414
411
|
LeadQuick['ReadmeTopQuick']({ target: leadTarget })
|
|
415
412
|
}
|
|
413
|
+
const placement = credentialPlacement(model)
|
|
416
414
|
Content(`
|
|
417
|
-
See the [${leadTarget.title} README](${leadTarget.name}/README.md) for the full guide.
|
|
415
|
+
${'' === placement ? '' : placement + '\n\n'}See the [${leadTarget.title} README](${leadTarget.name}/README.md) for the full guide.
|
|
418
416
|
|
|
419
417
|
`)
|
|
420
418
|
}
|
|
@@ -156,7 +156,7 @@ function definitionPlan(ctx$: any): DefinitionPoint[] {
|
|
|
156
156
|
const rawBody = recorded && BODY_OPS.includes(op) ?
|
|
157
157
|
rawRequestBody(facts) : undefined
|
|
158
158
|
|
|
159
|
-
// An argument the request body declares
|
|
159
|
+
// An argument the request body declares writable goes out in both, from one value.
|
|
160
160
|
const declared = ('create' === op || 'update' === op) && null == rawBody ?
|
|
161
161
|
bodyProperties(facts) : []
|
|
162
162
|
const bodyArgs = [...new Set([...headers, ...cookies].map((a: any) => a.name)
|
|
@@ -281,14 +281,18 @@ function rawRequestBody(facts: any): { media: string[], text: boolean } | undefi
|
|
|
281
281
|
}
|
|
282
282
|
|
|
283
283
|
|
|
284
|
-
// The top-level properties a JSON request body declares, an allOf's parts
|
|
284
|
+
// The top-level properties a JSON request body declares, an allOf's parts
|
|
285
|
+
// included, less any that a declaration marks read-only.
|
|
285
286
|
function bodyProperties(facts: any): string[] {
|
|
286
287
|
const content = facts.requestBody?.content
|
|
287
288
|
const schema = null != content && 'object' === typeof content ?
|
|
288
289
|
content[Object.keys(content).find((t) => /json/i.test(t)) ?? '']?.schema :
|
|
289
290
|
(facts.parameters || []).find((p: any) => 'body' === p?.in)?.schema
|
|
290
|
-
|
|
291
|
-
.flatMap((part: any) => Object.
|
|
291
|
+
const props = [schema, ...(Array.isArray(schema?.allOf) ? schema.allOf : [])]
|
|
292
|
+
.flatMap((part: any) => Object.entries(part?.properties || {}))
|
|
293
|
+
const readOnly = new Set(props.filter(([, prop]: [string, any]) => true === prop?.readOnly)
|
|
294
|
+
.map(([name]) => name))
|
|
295
|
+
return props.map(([name]) => name).filter((name) => !readOnly.has(name))
|
|
292
296
|
}
|
|
293
297
|
|
|
294
298
|
|
package/src/helpers/naming.ts
CHANGED
|
@@ -88,7 +88,7 @@ const RB_SDK_CONSTANTS = new Set<string>([
|
|
|
88
88
|
// shipped only when that feature is selected, but declared at the top
|
|
89
89
|
// level when it is
|
|
90
90
|
'VoxgigSekreto', 'VoxgigPlugin',
|
|
91
|
-
'ExistsTest', 'FeatureCorpusTest', 'FeatureTest', 'NetsimTest',
|
|
91
|
+
'ConcurrencyTest', 'ExistsTest', 'FeatureCorpusTest', 'FeatureTest', 'NetsimTest',
|
|
92
92
|
'PipelineTest', 'PrimaryUtilityTest', 'ReadmeExamplesTest',
|
|
93
93
|
'SecretsFeatureTest',
|
|
94
94
|
'TestHookFeature', 'TestInitFeature',
|
|
@@ -459,9 +459,16 @@ function jsProp(obj: string, name: string): string {
|
|
|
459
459
|
|
|
460
460
|
// A safe JS/TS OBJECT-LITERAL key for a spec-derived field name: bare when
|
|
461
461
|
// the name is a valid identifier, single-quoted otherwise. `{ 3ds_session_id:
|
|
462
|
-
// 1 }` is a syntax error (TS1351) — doc examples must quote such keys.
|
|
462
|
+
// 1 }` is a syntax error (TS1351) — doc examples must quote such keys. A bare
|
|
463
|
+
// or quoted `__proto__` sets the prototype, so it is computed.
|
|
463
464
|
function jsKey(name: string): string {
|
|
464
|
-
|
|
465
|
+
if ('__proto__' === name) return `['__proto__']`
|
|
466
|
+
return JS_IDENT.test(name) ? name : jsQuote(name)
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
|
|
470
|
+
function jsQuote(s: string): string {
|
|
471
|
+
return "'" + JSON.stringify(s).slice(1, -1).replace(/\\"/g, '"').replace(/'/g, "\\'") + "'"
|
|
465
472
|
}
|
|
466
473
|
|
|
467
474
|
|
|
@@ -471,7 +478,7 @@ const LUA_IDENT = /^[A-Za-z_][A-Za-z0-9_]*$/
|
|
|
471
478
|
function luaKey(name: string): string {
|
|
472
479
|
return LUA_IDENT.test(name) && !isReservedName(name, 'lua')
|
|
473
480
|
? name
|
|
474
|
-
: `["${name}"]`
|
|
481
|
+
: `["${name.replace(/[\\"]/g, '\\$&').replace(/\n/g, '\\n').replace(/\r/g, '\\r')}"]`
|
|
475
482
|
}
|
|
476
483
|
|
|
477
484
|
|
|
@@ -511,6 +518,7 @@ export {
|
|
|
511
518
|
jsProp,
|
|
512
519
|
jsOptProp,
|
|
513
520
|
jsKey,
|
|
521
|
+
jsQuote,
|
|
514
522
|
luaKey,
|
|
515
523
|
prefixLeadingDigit,
|
|
516
524
|
}
|