@voxgig/sdkgen 4.22.0 → 4.24.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 +18 -2
- package/dist/action/doctor.d.ts +1 -1
- package/dist/action/doctor.js +12 -10
- package/dist/action/doctor.js.map +1 -1
- package/dist/action/edition.js +4 -0
- package/dist/action/edition.js.map +1 -1
- package/dist/action/feature.js +5 -1
- package/dist/action/feature.js.map +1 -1
- package/dist/action/remove.d.ts +16 -0
- package/dist/action/remove.js +345 -0
- package/dist/action/remove.js.map +1 -0
- package/dist/action/target.js +6 -1
- package/dist/action/target.js.map +1 -1
- package/dist/cmp/ReadmeTop.js +1 -1
- package/dist/cmp/ReadmeTop.js.map +1 -1
- package/dist/cmp/ReadmeUnions.js +1 -1
- package/dist/cmp/ReadmeUnions.js.map +1 -1
- package/dist/cmp/Test.js +1 -1
- package/dist/cmp/Test.js.map +1 -1
- package/dist/helpers/buildIdNames.d.ts +3 -1
- package/dist/helpers/buildIdNames.js +15 -7
- package/dist/helpers/buildIdNames.js.map +1 -1
- package/dist/helpers/canonSpec.js +2 -2
- package/dist/helpers/canonSpec.js.map +1 -1
- package/dist/helpers/getMatchEntries.js +2 -2
- package/dist/helpers/getMatchEntries.js.map +1 -1
- package/dist/helpers/modelNames.js +5 -1
- package/dist/helpers/modelNames.js.map +1 -1
- package/dist/helpers/opShape.js +33 -33
- package/dist/helpers/opShape.js.map +1 -1
- package/dist/helpers/pointPath.js +5 -10
- package/dist/helpers/pointPath.js.map +1 -1
- package/dist/helpers/resolved.js +2 -29
- package/dist/helpers/resolved.js.map +1 -1
- package/dist/sdkgen.d.ts +2 -2
- package/dist/sdkgen.js +5 -3
- package/dist/sdkgen.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utility.js +15 -7
- package/dist/utility.js.map +1 -1
- package/package.json +3 -3
- package/project/.sdk/src/cmp/c/EntityTypes_c.ts +4 -4
- package/project/.sdk/src/cmp/c/ReadmeEntity_c.ts +3 -3
- package/project/.sdk/src/cmp/c/ReadmeModel_c.ts +3 -3
- package/project/.sdk/src/cmp/c/ReadmeRef_c.ts +5 -5
- package/project/.sdk/src/cmp/c/Schema_c.ts +1 -1
- package/project/.sdk/src/cmp/c/TestDirect_c.ts +12 -12
- package/project/.sdk/src/cmp/clojure/ReadmeEntity_clojure.ts +3 -3
- package/project/.sdk/src/cmp/clojure/ReadmeModel_clojure.ts +3 -3
- package/project/.sdk/src/cmp/clojure/ReadmeRef_clojure.ts +5 -5
- package/project/.sdk/src/cmp/clojure/Schema_clojure.ts +1 -1
- package/project/.sdk/src/cmp/cpp/EntityTypes_cpp.ts +3 -3
- package/project/.sdk/src/cmp/cpp/ReadmeEntity_cpp.ts +3 -3
- package/project/.sdk/src/cmp/cpp/ReadmeModel_cpp.ts +3 -3
- package/project/.sdk/src/cmp/cpp/ReadmeRef_cpp.ts +5 -5
- package/project/.sdk/src/cmp/cpp/Schema_cpp.ts +1 -1
- package/project/.sdk/src/cmp/cpp/TestDirect_cpp.ts +14 -14
- package/project/.sdk/src/cmp/cpp/TestEntity_cpp.ts +51 -50
- package/project/.sdk/src/cmp/csharp/EntityTypes_csharp.ts +4 -4
- package/project/.sdk/src/cmp/csharp/ReadmeEntity_csharp.ts +3 -3
- package/project/.sdk/src/cmp/csharp/ReadmeModel_csharp.ts +3 -3
- package/project/.sdk/src/cmp/csharp/ReadmeRef_csharp.ts +5 -5
- package/project/.sdk/src/cmp/csharp/Schema_csharp.ts +1 -1
- package/project/.sdk/src/cmp/csharp/TestDirect_csharp.ts +30 -30
- package/project/.sdk/src/cmp/csharp/TestEntity_csharp.ts +66 -65
- package/project/.sdk/src/cmp/elixir/EntityTypes_elixir.ts +4 -4
- package/project/.sdk/src/cmp/elixir/ReadmeEntity_elixir.ts +3 -3
- package/project/.sdk/src/cmp/elixir/ReadmeModel_elixir.ts +3 -3
- package/project/.sdk/src/cmp/elixir/ReadmeRef_elixir.ts +4 -4
- package/project/.sdk/src/cmp/elixir/Schema_elixir.ts +1 -1
- package/project/.sdk/src/cmp/go/EntityTypes_go.ts +4 -4
- package/project/.sdk/src/cmp/go/ReadmeEntity_go.ts +3 -3
- package/project/.sdk/src/cmp/go/ReadmeModel_go.ts +3 -3
- package/project/.sdk/src/cmp/go/ReadmeRef_go.ts +5 -5
- package/project/.sdk/src/cmp/go/Schema_go.ts +1 -1
- package/project/.sdk/src/cmp/go/TestDirect_go.ts +38 -38
- package/project/.sdk/src/cmp/go/TestEntity_go.ts +75 -74
- package/project/.sdk/src/cmp/go/utility_go.ts +5 -5
- package/project/.sdk/src/cmp/java/EntityTypes_java.ts +4 -4
- package/project/.sdk/src/cmp/java/ReadmeEntity_java.ts +3 -3
- package/project/.sdk/src/cmp/java/ReadmeModel_java.ts +3 -3
- package/project/.sdk/src/cmp/java/ReadmeRef_java.ts +5 -5
- package/project/.sdk/src/cmp/java/Schema_java.ts +1 -1
- package/project/.sdk/src/cmp/java/TestDirect_java.ts +30 -30
- package/project/.sdk/src/cmp/java/TestEntity_java.ts +69 -68
- package/project/.sdk/src/cmp/js/EntityTypes_js.ts +5 -5
- package/project/.sdk/src/cmp/js/ReadmeEntity_js.ts +3 -3
- package/project/.sdk/src/cmp/js/ReadmeModel_js.ts +3 -3
- package/project/.sdk/src/cmp/js/ReadmeRef_js.ts +5 -5
- package/project/.sdk/src/cmp/js/Schema_js.ts +1 -1
- package/project/.sdk/src/cmp/js/TestDirect_js.ts +27 -27
- package/project/.sdk/src/cmp/js/TestEntity_js.ts +66 -69
- package/project/.sdk/src/cmp/js/TestLive_js.ts +3 -3
- package/project/.sdk/src/cmp/js/utility_js.ts +5 -5
- package/project/.sdk/src/cmp/kotlin/EntityTypes_kotlin.ts +4 -4
- package/project/.sdk/src/cmp/kotlin/ReadmeEntity_kotlin.ts +3 -3
- package/project/.sdk/src/cmp/kotlin/ReadmeModel_kotlin.ts +3 -3
- package/project/.sdk/src/cmp/kotlin/ReadmeRef_kotlin.ts +5 -5
- package/project/.sdk/src/cmp/kotlin/Schema_kotlin.ts +1 -1
- package/project/.sdk/src/cmp/kotlin/TestDirect_kotlin.ts +30 -30
- package/project/.sdk/src/cmp/kotlin/TestEntity_kotlin.ts +67 -66
- package/project/.sdk/src/cmp/lua/EntityTypes_lua.ts +5 -5
- package/project/.sdk/src/cmp/lua/ReadmeEntity_lua.ts +3 -3
- package/project/.sdk/src/cmp/lua/ReadmeModel_lua.ts +3 -3
- package/project/.sdk/src/cmp/lua/ReadmeQuick_lua.ts +4 -4
- package/project/.sdk/src/cmp/lua/ReadmeRef_lua.ts +5 -5
- package/project/.sdk/src/cmp/lua/Schema_lua.ts +1 -1
- package/project/.sdk/src/cmp/lua/TestDirect_lua.ts +25 -25
- package/project/.sdk/src/cmp/lua/TestEntity_lua.ts +66 -65
- package/project/.sdk/src/cmp/ocaml/ReadmeEntity_ocaml.ts +3 -3
- package/project/.sdk/src/cmp/ocaml/ReadmeModel_ocaml.ts +3 -3
- package/project/.sdk/src/cmp/ocaml/ReadmeRef_ocaml.ts +5 -5
- package/project/.sdk/src/cmp/ocaml/Schema_ocaml.ts +1 -1
- package/project/.sdk/src/cmp/perl/ReadmeEntity_perl.ts +3 -3
- package/project/.sdk/src/cmp/perl/ReadmeModel_perl.ts +3 -3
- package/project/.sdk/src/cmp/perl/ReadmeRef_perl.ts +5 -5
- package/project/.sdk/src/cmp/perl/Schema_perl.ts +1 -1
- package/project/.sdk/src/cmp/perl/TestDirect_perl.ts +25 -25
- package/project/.sdk/src/cmp/perl/TestEntity_perl.ts +60 -59
- package/project/.sdk/src/cmp/php/EntityTypes_php.ts +4 -4
- package/project/.sdk/src/cmp/php/ReadmeEntity_php.ts +3 -3
- package/project/.sdk/src/cmp/php/ReadmeModel_php.ts +3 -3
- package/project/.sdk/src/cmp/php/ReadmeQuick_php.ts +4 -4
- package/project/.sdk/src/cmp/php/ReadmeRef_php.ts +5 -5
- package/project/.sdk/src/cmp/php/Schema_php.ts +1 -1
- package/project/.sdk/src/cmp/php/TestDirect_php.ts +25 -25
- package/project/.sdk/src/cmp/php/TestEntity_php.ts +66 -65
- package/project/.sdk/src/cmp/py/EntityTypes_py.ts +4 -4
- package/project/.sdk/src/cmp/py/ReadmeEntity_py.ts +3 -3
- package/project/.sdk/src/cmp/py/ReadmeModel_py.ts +3 -3
- package/project/.sdk/src/cmp/py/ReadmeRef_py.ts +5 -5
- package/project/.sdk/src/cmp/py/Schema_py.ts +1 -1
- package/project/.sdk/src/cmp/py/TestDirect_py.ts +25 -25
- package/project/.sdk/src/cmp/py/TestEntity_py.ts +66 -65
- package/project/.sdk/src/cmp/py-data/Main_py-data.ts +4 -4
- package/project/.sdk/src/cmp/rb/EntityTypes_rb.ts +4 -4
- package/project/.sdk/src/cmp/rb/ReadmeEntity_rb.ts +3 -3
- package/project/.sdk/src/cmp/rb/ReadmeModel_rb.ts +3 -3
- package/project/.sdk/src/cmp/rb/ReadmeQuick_rb.ts +4 -4
- package/project/.sdk/src/cmp/rb/ReadmeRef_rb.ts +5 -5
- package/project/.sdk/src/cmp/rb/Schema_rb.ts +1 -1
- package/project/.sdk/src/cmp/rb/TestDirect_rb.ts +25 -25
- package/project/.sdk/src/cmp/rb/TestEntity_rb.ts +66 -65
- package/project/.sdk/src/cmp/rust/EntityTypes_rust.ts +4 -4
- package/project/.sdk/src/cmp/rust/ReadmeEntity_rust.ts +3 -3
- package/project/.sdk/src/cmp/rust/ReadmeModel_rust.ts +3 -3
- package/project/.sdk/src/cmp/rust/ReadmeRef_rust.ts +5 -5
- package/project/.sdk/src/cmp/rust/Schema_rust.ts +1 -1
- package/project/.sdk/src/cmp/rust/TestDirect_rust.ts +18 -18
- package/project/.sdk/src/cmp/rust/TestEntity_rust.ts +63 -62
- package/project/.sdk/src/cmp/scala/EntityTypes_scala.ts +4 -4
- package/project/.sdk/src/cmp/scala/ReadmeEntity_scala.ts +3 -3
- package/project/.sdk/src/cmp/scala/ReadmeModel_scala.ts +3 -3
- package/project/.sdk/src/cmp/scala/ReadmeRef_scala.ts +5 -5
- package/project/.sdk/src/cmp/scala/Schema_scala.ts +1 -1
- package/project/.sdk/src/cmp/scala/TestDirect_scala.ts +14 -14
- package/project/.sdk/src/cmp/scala/TestEntity_scala.ts +60 -59
- package/project/.sdk/src/cmp/swift/EntityTypes_swift.ts +4 -4
- package/project/.sdk/src/cmp/swift/ReadmeEntity_swift.ts +3 -3
- package/project/.sdk/src/cmp/swift/ReadmeModel_swift.ts +3 -3
- package/project/.sdk/src/cmp/swift/ReadmeRef_swift.ts +5 -5
- package/project/.sdk/src/cmp/swift/Schema_swift.ts +1 -1
- package/project/.sdk/src/cmp/ts/EntityTypes_ts.ts +5 -5
- package/project/.sdk/src/cmp/ts/ReadmeEntity_ts.ts +3 -3
- package/project/.sdk/src/cmp/ts/ReadmeModel_ts.ts +3 -3
- package/project/.sdk/src/cmp/ts/ReadmeQuick_ts.ts +1 -1
- package/project/.sdk/src/cmp/ts/ReadmeRef_ts.ts +5 -5
- package/project/.sdk/src/cmp/ts/Schema_ts.ts +1 -1
- package/project/.sdk/src/cmp/ts/TestDirect_ts.ts +40 -40
- package/project/.sdk/src/cmp/ts/TestEntity_ts.ts +72 -75
- package/project/.sdk/src/cmp/ts/TestLive_ts.ts +3 -3
- package/project/.sdk/src/cmp/ts/utility_ts.ts +5 -5
- package/project/.sdk/src/cmp/zig/ReadmeEntity_zig.ts +3 -3
- package/project/.sdk/src/cmp/zig/ReadmeModel_zig.ts +3 -3
- package/project/.sdk/src/cmp/zig/ReadmeRef_zig.ts +5 -5
- package/project/.sdk/src/cmp/zig/Schema_zig.ts +1 -1
- package/project/.sdk/tm/c/core/context.c +3 -1
- package/project/.sdk/tm/c/feature/paging.c +37 -3
- package/project/.sdk/tm/c/feature/test.c +71 -31
- package/project/.sdk/tm/c/utility/prepare_query.c +2 -1
- package/project/.sdk/tm/c/utility/transform_request.c +25 -3
- package/project/.sdk/tm/clojure/src/sdk/core.clj +21 -7
- package/project/.sdk/tm/clojure/src/sdk/features.clj +74 -22
- package/project/.sdk/tm/cpp/core/types.hpp +1 -1
- package/project/.sdk/tm/cpp/feature/paging.hpp +36 -3
- package/project/.sdk/tm/cpp/feature/test.hpp +58 -19
- package/project/.sdk/tm/cpp/utility/pipeline.hpp +16 -4
- package/project/.sdk/tm/csharp/core/Context.cs +1 -1
- package/project/.sdk/tm/csharp/feature/PagingFeature.cs +58 -4
- package/project/.sdk/tm/csharp/feature/TestFeature.cs +23 -25
- package/project/.sdk/tm/csharp/utility/Fetcher.cs +19 -12
- package/project/.sdk/tm/csharp/utility/PrepareQuery.cs +1 -1
- package/project/.sdk/tm/csharp/utility/TransformRequest.cs +23 -3
- package/project/.sdk/tm/elixir/lib/projectname/context.ex +1 -1
- package/project/.sdk/tm/elixir/lib/projectname/feature/paging.ex +52 -10
- package/project/.sdk/tm/elixir/lib/projectname/feature/test.ex +58 -22
- package/project/.sdk/tm/elixir/lib/projectname/utility.ex +30 -9
- package/project/.sdk/tm/go/core/context.go +13 -13
- package/project/.sdk/tm/go/feature/paging_feature.go +40 -2
- package/project/.sdk/tm/go/feature/test_feature.go +3 -15
- package/project/.sdk/tm/go/test/feature_corpus_test.go +1 -0
- package/project/.sdk/tm/go/test/feature_test.go +54 -0
- package/project/.sdk/tm/go/utility/fetcher.go +41 -20
- package/project/.sdk/tm/go/utility/prepare_query.go +1 -1
- package/project/.sdk/tm/go/utility/transform_request.go +22 -3
- package/project/.sdk/tm/java/core/Context.java +2 -1
- package/project/.sdk/tm/java/feature/PagingFeature.java +46 -4
- package/project/.sdk/tm/java/feature/TestFeature.java +21 -19
- package/project/.sdk/tm/java/test/FeatureCorpusTest.java +3 -0
- package/project/.sdk/tm/java/test/FeatureTest.java +42 -0
- package/project/.sdk/tm/java/utility/Fetcher.java +36 -28
- package/project/.sdk/tm/java/utility/PrepareQuery.java +1 -1
- package/project/.sdk/tm/java/utility/TransformRequest.java +18 -3
- package/project/.sdk/tm/js/src/Context.js +7 -2
- package/project/.sdk/tm/js/src/feature/paging/PagingFeature.js +24 -6
- package/project/.sdk/tm/js/src/feature/test/TestFeature.js +7 -5
- package/project/.sdk/tm/js/src/utility/PrepareQueryUtility.js +1 -1
- package/project/.sdk/tm/js/test/feature/Corpus.test.js +4 -0
- package/project/.sdk/tm/js/test/live-entity.js +29 -29
- package/project/.sdk/tm/js/test/live-scenarios.js +4 -4
- package/project/.sdk/tm/kotlin/core/Context.kt +1 -1
- package/project/.sdk/tm/kotlin/feature/PagingFeature.kt +36 -4
- package/project/.sdk/tm/kotlin/feature/TestFeature.kt +19 -18
- package/project/.sdk/tm/kotlin/utility/Fetcher.kt +33 -24
- package/project/.sdk/tm/kotlin/utility/Prepare.kt +1 -1
- package/project/.sdk/tm/kotlin/utility/ResultTransform.kt +18 -3
- package/project/.sdk/tm/lua/core/context.lua +8 -1
- package/project/.sdk/tm/lua/core/control.lua +3 -0
- package/project/.sdk/tm/lua/feature/paging_feature.lua +44 -5
- package/project/.sdk/tm/lua/feature/test_feature.lua +32 -14
- package/project/.sdk/tm/lua/utility/prepare_query.lua +2 -1
- package/project/.sdk/tm/lua/utility/transform_request.lua +19 -3
- package/project/.sdk/tm/ocaml/sdk_features.ml +78 -25
- package/project/.sdk/tm/ocaml/sdk_runtime.ml +23 -8
- package/project/.sdk/tm/perl/core/context.pm +2 -1
- package/project/.sdk/tm/perl/feature/paging_feature.pm +31 -5
- package/project/.sdk/tm/perl/feature/test_feature.pm +52 -20
- package/project/.sdk/tm/perl/feature/timeout_feature.pm +17 -13
- package/project/.sdk/tm/perl/t/feature_corpus.t +14 -1
- package/project/.sdk/tm/perl/utility/fetcher.pm +15 -1
- package/project/.sdk/tm/perl/utility/prepare_query.pm +1 -0
- package/project/.sdk/tm/perl/utility/transform_request.pm +13 -3
- package/project/.sdk/tm/php/core/Context.php +5 -1
- package/project/.sdk/tm/php/core/Control.php +5 -0
- package/project/.sdk/tm/php/feature/PagingFeature.php +26 -5
- package/project/.sdk/tm/php/feature/TestFeature.php +27 -42
- package/project/.sdk/tm/php/test/FeatureCorpusTest.php +17 -1
- package/project/.sdk/tm/php/test/FeatureTest.php +44 -0
- package/project/.sdk/tm/php/utility/Fetcher.php +17 -3
- package/project/.sdk/tm/php/utility/PrepareQuery.php +1 -1
- package/project/.sdk/tm/php/utility/TransformRequest.php +15 -3
- package/project/.sdk/tm/py/pkg/core/context.py +2 -1
- package/project/.sdk/tm/py/pkg/feature/paging_feature.py +29 -4
- package/project/.sdk/tm/py/pkg/feature/test_feature.py +29 -12
- package/project/.sdk/tm/py/pkg/utility/fetcher.py +63 -65
- package/project/.sdk/tm/py/pkg/utility/prepare_query.py +2 -1
- package/project/.sdk/tm/py/pkg/utility/transform_request.py +11 -3
- package/project/.sdk/tm/py/test/test_feature.py +27 -0
- package/project/.sdk/tm/py/test/test_feature_corpus.py +11 -1
- package/project/.sdk/tm/rb/core/context.rb +1 -1
- package/project/.sdk/tm/rb/feature/paging_feature.rb +27 -5
- package/project/.sdk/tm/rb/feature/test_feature.rb +39 -11
- package/project/.sdk/tm/rb/test/feature_corpus_test.rb +12 -1
- package/project/.sdk/tm/rb/test/feature_test.rb +38 -0
- package/project/.sdk/tm/rb/utility/fetcher.rb +49 -3
- package/project/.sdk/tm/rb/utility/prepare_query.rb +1 -1
- package/project/.sdk/tm/rb/utility/transform_request.rb +10 -3
- package/project/.sdk/tm/rust/core/context.rs +2 -6
- package/project/.sdk/tm/rust/feature/paging.rs +44 -3
- package/project/.sdk/tm/rust/feature/secrets.rs +1 -1
- package/project/.sdk/tm/rust/feature/test.rs +74 -37
- package/project/.sdk/tm/rust/utility/fetcher.rs +41 -14
- package/project/.sdk/tm/rust/utility/prepare_query.rs +1 -1
- package/project/.sdk/tm/rust/utility/transform_request.rs +31 -5
- package/project/.sdk/tm/scala/core/Context.scala +2 -1
- package/project/.sdk/tm/scala/feature/PagingFeature.scala +41 -4
- package/project/.sdk/tm/scala/feature/TestFeature.scala +21 -18
- package/project/.sdk/tm/scala/utility/Fetcher.scala +34 -13
- package/project/.sdk/tm/scala/utility/Prepare.scala +1 -1
- package/project/.sdk/tm/scala/utility/Transform.scala +19 -3
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/core/Context.swift +1 -1
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/PagingFeature.swift +31 -4
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/TestFeature.swift +22 -15
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/Fetcher.swift +22 -3
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/Prepare.swift +1 -1
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/ResultUtil.swift +14 -3
- package/project/.sdk/tm/ts/src/Context.ts +7 -2
- package/project/.sdk/tm/ts/src/feature/paging/PagingFeature.ts +19 -3
- package/project/.sdk/tm/ts/src/feature/test/TestFeature.ts +3 -0
- package/project/.sdk/tm/ts/src/utility/PrepareQueryUtility.ts +1 -1
- package/project/.sdk/tm/ts/test/feature/Corpus.test.ts +1 -0
- package/project/.sdk/tm/ts/test/live-entity.ts +26 -26
- package/project/.sdk/tm/ts/test/live-scenarios.ts +3 -3
- package/project/.sdk/tm/zig/core/context.zig +1 -1
- package/project/.sdk/tm/zig/core/utility.zig +19 -5
- package/project/.sdk/tm/zig/feature/paging.zig +34 -4
- package/project/.sdk/tm/zig/feature/test.zig +65 -30
- package/project/sdkgen-package.json +1 -1
- package/src/action/doctor.ts +12 -9
- package/src/action/edition.ts +8 -0
- package/src/action/feature.ts +7 -1
- package/src/action/remove.ts +492 -0
- package/src/action/target.ts +8 -1
- package/src/cmp/ReadmeTop.ts +1 -1
- package/src/cmp/ReadmeUnions.ts +1 -1
- package/src/cmp/Test.ts +1 -1
- package/src/helpers/buildIdNames.ts +17 -7
- package/src/helpers/canonSpec.ts +2 -2
- package/src/helpers/getMatchEntries.ts +2 -2
- package/src/helpers/modelNames.ts +6 -1
- package/src/helpers/opShape.ts +33 -33
- package/src/helpers/pointPath.ts +5 -10
- package/src/helpers/resolved.ts +3 -14
- package/src/sdkgen.ts +3 -1
- package/src/utility.ts +16 -7
|
@@ -35,10 +35,10 @@ function normalizePathParams(
|
|
|
35
35
|
// original name was renamed to another param's current name (e.g. badge
|
|
36
36
|
// load: param 'group_id' has orig 'id', and another param has name 'id').
|
|
37
37
|
const param = params.find((p: any) =>
|
|
38
|
-
p.
|
|
38
|
+
p.n === snaked || p.n === depluralized) ||
|
|
39
39
|
params.find((p: any) =>
|
|
40
|
-
p.
|
|
41
|
-
if (param) return '{' + param.
|
|
40
|
+
p.or === snaked || p.or === depluralized)
|
|
41
|
+
if (param) return '{' + param.n + '}'
|
|
42
42
|
|
|
43
43
|
if (rename) {
|
|
44
44
|
for (const [origCamel, renamedTo] of Object.entries(rename)) {
|
|
@@ -46,10 +46,10 @@ function normalizePathParams(
|
|
|
46
46
|
const origSnaked = snakify(origCamel)
|
|
47
47
|
const origDepluralized = depluralize(origSnaked)
|
|
48
48
|
const renamedParam = params.find(
|
|
49
|
-
(p: any) => p.
|
|
50
|
-
p.
|
|
49
|
+
(p: any) => p.or === origSnaked || p.n === origSnaked ||
|
|
50
|
+
p.or === origDepluralized || p.n === origDepluralized
|
|
51
51
|
)
|
|
52
|
-
if (renamedParam) return '{' + renamedParam.
|
|
52
|
+
if (renamedParam) return '{' + renamedParam.n + '}'
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
}
|
|
@@ -109,8 +109,8 @@ const TestDirect = cmp(function TestDirect(props: any) {
|
|
|
109
109
|
|
|
110
110
|
const loadPoint = loadOp?.points?.[0]
|
|
111
111
|
const loadIsGraphql = 'graphql' === (loadPoint as any)?.kind
|
|
112
|
-
const loadPath = loadPoint ? normalizePathParams(pointParts(loadPoint), loadPoint?.
|
|
113
|
-
const allLoadParams = loadPoint?.
|
|
112
|
+
const loadPath = loadPoint ? normalizePathParams(pointParts(loadPoint), loadPoint?.g?.params || [], loadPoint?.r?.param) : ''
|
|
113
|
+
const allLoadParams = loadPoint?.g?.params || []
|
|
114
114
|
// Some upstream OpenAPI specs declare a parameter as `in: path` even when
|
|
115
115
|
// that path has no `{name}` placeholder for it. Only path params that
|
|
116
116
|
// actually appear in the URL template should drive direct-test path-param
|
|
@@ -122,7 +122,7 @@ const TestDirect = cmp(function TestDirect(props: any) {
|
|
|
122
122
|
_pathPlaceholders.add(part.slice(1, -1))
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
|
-
const _renameMap = (loadPoint?.
|
|
125
|
+
const _renameMap = (loadPoint?.r?.param || {}) as Record<string, string>
|
|
126
126
|
const _renamedPlaceholders = new Set<string>()
|
|
127
127
|
for (const ph of _pathPlaceholders) {
|
|
128
128
|
_renamedPlaceholders.add(ph)
|
|
@@ -131,25 +131,25 @@ const TestDirect = cmp(function TestDirect(props: any) {
|
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
133
|
const loadParams = allLoadParams.filter((p: any) =>
|
|
134
|
-
_renamedPlaceholders.has(p.
|
|
134
|
+
_renamedPlaceholders.has(p.n) || _renamedPlaceholders.has(p.or))
|
|
135
135
|
|
|
136
136
|
const listPoint = listOp?.points?.[0]
|
|
137
137
|
const listIsGraphql = 'graphql' === (listPoint as any)?.kind
|
|
138
|
-
const listPath = listPoint ? normalizePathParams(pointParts(listPoint), listPoint?.
|
|
139
|
-
const listParams = listPoint?.
|
|
138
|
+
const listPath = listPoint ? normalizePathParams(pointParts(listPoint), listPoint?.g?.params || [], listPoint?.r?.param) : ''
|
|
139
|
+
const listParams = listPoint?.g?.params || []
|
|
140
140
|
|
|
141
|
-
const loadQuery = loadPoint?.
|
|
141
|
+
const loadQuery = loadPoint?.g?.query || []
|
|
142
142
|
const loadLiveQueryEntries = loadQuery
|
|
143
|
-
.filter((q: any) => q.
|
|
143
|
+
.filter((q: any) => q.r && undefined !== q.ex && null !== q.ex)
|
|
144
144
|
const loadLiveQueryLines = loadLiveQueryEntries
|
|
145
|
-
.map((q: any) => `\t\t\tquery["${q.
|
|
145
|
+
.map((q: any) => `\t\t\tquery["${q.n}"] = ${JSON.stringify(q.ex)}`)
|
|
146
146
|
.join('\n')
|
|
147
147
|
|
|
148
|
-
const listQuery = listPoint?.
|
|
148
|
+
const listQuery = listPoint?.g?.query || []
|
|
149
149
|
const listLiveQueryEntries = listQuery
|
|
150
|
-
.filter((q: any) => q.
|
|
150
|
+
.filter((q: any) => q.r && undefined !== q.ex && null !== q.ex)
|
|
151
151
|
const listLiveQueryLines = listLiveQueryEntries
|
|
152
|
-
.map((q: any) => `\t\t\tquery["${q.
|
|
152
|
+
.map((q: any) => `\t\t\tquery["${q.n}"] = ${JSON.stringify(q.ex)}`)
|
|
153
153
|
.join('\n')
|
|
154
154
|
|
|
155
155
|
// Path params with spec-provided examples — when ALL load params have
|
|
@@ -159,9 +159,9 @@ const TestDirect = cmp(function TestDirect(props: any) {
|
|
|
159
159
|
// semantic mismatch.
|
|
160
160
|
const loadAllHaveExamples =
|
|
161
161
|
loadParams.length > 0 &&
|
|
162
|
-
loadParams.every((p: any) => undefined !== p.
|
|
162
|
+
loadParams.every((p: any) => undefined !== p.ex && null !== p.ex)
|
|
163
163
|
const loadExampleLines = loadAllHaveExamples
|
|
164
|
-
? loadParams.map((p: any) => `\t\t\tparams["${p.
|
|
164
|
+
? loadParams.map((p: any) => `\t\t\tparams["${p.n}"] = ${JSON.stringify(p.ex)}`).join('\n')
|
|
165
165
|
: ''
|
|
166
166
|
|
|
167
167
|
const entidEnvVar = `${PROJECTNAME}_TEST_${envToken(entity.name)}_ENTID`
|
|
@@ -190,14 +190,14 @@ func Test${entity.Name}Direct(t *testing.T) {
|
|
|
190
190
|
if (hasList && listPoint && !listIsGraphql) {
|
|
191
191
|
const listParamStr = listParams.length > 0
|
|
192
192
|
? listParams.map((p: any, i: number) =>
|
|
193
|
-
`"${p.
|
|
193
|
+
`"${p.n}": "direct0${i + 1}"`).join(', ')
|
|
194
194
|
: ''
|
|
195
195
|
|
|
196
196
|
const listLiveParams = listParams.map((p: any) => {
|
|
197
|
-
const key = p.
|
|
197
|
+
const key = p.n === 'id'
|
|
198
198
|
? entity.name + '01'
|
|
199
|
-
: p.
|
|
200
|
-
return { name: p.
|
|
199
|
+
: p.n.replace(/_id$/, '') + '01'
|
|
200
|
+
return { name: p.n, key }
|
|
201
201
|
})
|
|
202
202
|
|
|
203
203
|
// Track idmap keys this test consumes in live mode. If any are
|
|
@@ -344,21 +344,21 @@ ${listSkipBlock} client := setup.client
|
|
|
344
344
|
if (hasLoad && loadPoint && !loadIsGraphql) {
|
|
345
345
|
const loadParamStr = loadParams.length > 0
|
|
346
346
|
? loadParams.map((p: any, i: number) =>
|
|
347
|
-
`"${p.
|
|
347
|
+
`"${p.n}": "direct0${i + 1}"`).join(', ')
|
|
348
348
|
: ''
|
|
349
349
|
|
|
350
|
-
const ancestorParams = loadParams.filter((p: any) => p.
|
|
350
|
+
const ancestorParams = loadParams.filter((p: any) => p.n !== 'id')
|
|
351
351
|
|
|
352
352
|
let loadLiveIdKeys: string[] = []
|
|
353
353
|
if (loadParams.length > 0 && !loadAllHaveExamples) {
|
|
354
354
|
if (hasList) {
|
|
355
355
|
loadLiveIdKeys = listParams.map((p: any) => {
|
|
356
|
-
return p.
|
|
356
|
+
return p.n === 'id'
|
|
357
357
|
? entity.name + '01'
|
|
358
|
-
: p.
|
|
358
|
+
: p.n.replace(/_id$/, '') + '01'
|
|
359
359
|
})
|
|
360
360
|
} else {
|
|
361
|
-
loadLiveIdKeys = loadParams.map((p: any) => p.
|
|
361
|
+
loadLiveIdKeys = loadParams.map((p: any) => p.n + '01')
|
|
362
362
|
}
|
|
363
363
|
}
|
|
364
364
|
const loadSkipBlock = loadLiveIdKeys.length > 0
|
|
@@ -411,10 +411,10 @@ ${loadSkipBlock} client := setup.client
|
|
|
411
411
|
Content(` listParams := map[string]any{}
|
|
412
412
|
`)
|
|
413
413
|
for (const p of listParams) {
|
|
414
|
-
const key = p.
|
|
414
|
+
const key = p.n === 'id'
|
|
415
415
|
? entity.name + '01'
|
|
416
|
-
: p.
|
|
417
|
-
Content(` listParams["${p.
|
|
416
|
+
: p.n.replace(/_id$/, '') + '01'
|
|
417
|
+
Content(` listParams["${p.n}"] = setup.idmap["${key}"]
|
|
418
418
|
`)
|
|
419
419
|
}
|
|
420
420
|
|
|
@@ -439,8 +439,8 @@ ${loadSkipBlock} client := setup.client
|
|
|
439
439
|
params["id"] = firstEnt["id"]
|
|
440
440
|
`)
|
|
441
441
|
for (const p of ancestorParams) {
|
|
442
|
-
const key = p.
|
|
443
|
-
Content(` params["${p.
|
|
442
|
+
const key = p.n.replace(/_id$/, '') + '01'
|
|
443
|
+
Content(` params["${p.n}"] = setup.idmap["${key}"]
|
|
444
444
|
`)
|
|
445
445
|
}
|
|
446
446
|
}
|
|
@@ -449,7 +449,7 @@ ${loadSkipBlock} client := setup.client
|
|
|
449
449
|
Content(` } else {
|
|
450
450
|
`)
|
|
451
451
|
for (let i = 0; i < loadParams.length; i++) {
|
|
452
|
-
Content(` params["${loadParams[i].
|
|
452
|
+
Content(` params["${loadParams[i].n}"] = "direct0${i + 1}"
|
|
453
453
|
`)
|
|
454
454
|
}
|
|
455
455
|
}
|
|
@@ -619,7 +619,7 @@ var _ = json.Unmarshal
|
|
|
619
619
|
|
|
620
620
|
|
|
621
621
|
// GraphQL-backed op needs POST+body, not a REST-shaped GET+params Direct()
|
|
622
|
-
// call — reuse apidef's own point.
|
|
622
|
+
// call — reuse apidef's own point.gq.doc via the SDK's Graphql() hatch.
|
|
623
623
|
// Mirrors TestDirect_ts.ts's generateDirectGraphql.
|
|
624
624
|
function generateDirectGraphqlGo(
|
|
625
625
|
opname: 'load' | 'list',
|
|
@@ -627,8 +627,8 @@ function generateDirectGraphqlGo(
|
|
|
627
627
|
point: any,
|
|
628
628
|
liveFail: string,
|
|
629
629
|
) {
|
|
630
|
-
const doc: string = point.
|
|
631
|
-
const vars: any[] = point.
|
|
630
|
+
const doc: string = point.gq.doc
|
|
631
|
+
const vars: any[] = point.gq.vars || []
|
|
632
632
|
|
|
633
633
|
const mockVarLines = vars.map((v: any, i: number) =>
|
|
634
634
|
`\t\tvariables["${v.name}"] = "direct0${i + 1}"`).join('\n')
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { flowSteps } from '@voxgig/sdkgen'
|
|
1
2
|
|
|
2
3
|
import {
|
|
3
4
|
flatten,
|
|
@@ -95,10 +96,10 @@ const TestEntity = cmp(function TestEntity(props: any) {
|
|
|
95
96
|
const idnamesStr = idnames.map(n => `"${n}"`).join(', ')
|
|
96
97
|
|
|
97
98
|
// Get all update data entries for alias generation
|
|
98
|
-
const allSteps = Object.values(basicflow
|
|
99
|
-
const updateStep = allSteps.find((s: any) => s.
|
|
100
|
-
const updateData = updateStep?.
|
|
101
|
-
? Object.entries(updateStep.
|
|
99
|
+
const allSteps = Object.values(flowSteps(basicflow)) as any[]
|
|
100
|
+
const updateStep = allSteps.find((s: any) => s.o === 'update')
|
|
101
|
+
const updateData = updateStep?.d
|
|
102
|
+
? Object.entries(updateStep.d).filter(([k]: any) => k !== 'id' && !k.endsWith('$'))
|
|
102
103
|
: []
|
|
103
104
|
const aliases = updateData.map(([k, v]: any) => [k, v])
|
|
104
105
|
|
|
@@ -107,10 +108,10 @@ const TestEntity = cmp(function TestEntity(props: any) {
|
|
|
107
108
|
// fmt is only used by the TextFieldMark Update branch — omit the import
|
|
108
109
|
// when no step needs it, otherwise Go's strict unused-import check fails.
|
|
109
110
|
const needsFmt = allSteps.some((s: any) =>
|
|
110
|
-
s.
|
|
111
|
-
s.
|
|
112
|
-
Array.isArray(s.
|
|
113
|
-
s.
|
|
111
|
+
s.o === 'update' &&
|
|
112
|
+
s.i.textfield &&
|
|
113
|
+
Array.isArray(s.s) &&
|
|
114
|
+
s.s.some((sp: any) => sp.apply === 'TextFieldMark'))
|
|
114
115
|
|
|
115
116
|
File({ name: entity.name + '_entity_test.' + target.ext }, () => {
|
|
116
117
|
|
|
@@ -196,7 +197,7 @@ ${hasList ? `
|
|
|
196
197
|
if setup.live {
|
|
197
198
|
_mode = "live"
|
|
198
199
|
}
|
|
199
|
-
for _, _op := range []string{${(Array.from(new Set((allSteps as any[]).map((s: any) => s.
|
|
200
|
+
for _, _op := range []string{${(Array.from(new Set((allSteps as any[]).map((s: any) => s.o).filter(Boolean)))).map(o => `"${o}"`).join(', ')}} {
|
|
200
201
|
if _shouldSkip, _reason := isControlSkipped("entityOp", "${entity.name}." + _op, _mode); _shouldSkip {
|
|
201
202
|
if _reason == "" {
|
|
202
203
|
_reason = "skipped via sdk-test-control.json"
|
|
@@ -214,7 +215,7 @@ ${hasList ? `
|
|
|
214
215
|
${allSteps.length > 0 ? '\t\tclient := setup.client\n\n' : ''}`)
|
|
215
216
|
|
|
216
217
|
// Check if the flow has a create step; if not, bootstrap entity data
|
|
217
|
-
const flowHasCreate = allSteps.some((s: any) => s.
|
|
218
|
+
const flowHasCreate = allSteps.some((s: any) => s.o === 'create')
|
|
218
219
|
if (!flowHasCreate) {
|
|
219
220
|
const preambleRef = entity.name + '_ref01'
|
|
220
221
|
const preambleVar = goVar(preambleRef)
|
|
@@ -232,16 +233,16 @@ ${allSteps.length > 0 ? '\t\tclient := setup.client\n\n' : ''}`)
|
|
|
232
233
|
}
|
|
233
234
|
|
|
234
235
|
// Model-driven step iteration
|
|
235
|
-
each(basicflow
|
|
236
|
+
each(flowSteps(basicflow), (step: any, index: any) => {
|
|
236
237
|
// Never emit a REMOVE (or its removed-item verify LIST) without a
|
|
237
238
|
// preceding CREATE: a coherent CRUD flow only removes what it created,
|
|
238
239
|
// so a create-less remove would mutate pre-existing (live) data.
|
|
239
240
|
if (!flowHasCreate) {
|
|
240
|
-
if ('remove' === step.
|
|
241
|
-
if ('list' === step.
|
|
242
|
-
(step.
|
|
241
|
+
if ('remove' === step.o) { return }
|
|
242
|
+
if ('list' === step.o &&
|
|
243
|
+
(step.v || []).some((v: any) => 'ItemNotExists' === v.apply)) { return }
|
|
243
244
|
}
|
|
244
|
-
const opgen: OpGen = GENERATE_OP[step.
|
|
245
|
+
const opgen: OpGen = GENERATE_OP[step.o]
|
|
245
246
|
if (opgen) {
|
|
246
247
|
opgen(genCtx, step, index)
|
|
247
248
|
Content('\n')
|
|
@@ -359,18 +360,18 @@ ${allSteps.length > 0 ? '\t\tclient := setup.client\n\n' : ''}`)
|
|
|
359
360
|
|
|
360
361
|
const generateCreate: OpGen = (ctx, step, index) => {
|
|
361
362
|
const { entity, flow } = ctx
|
|
362
|
-
const ref = step.
|
|
363
|
-
const entvar = goVar(step.
|
|
364
|
-
const datavar = goVar(step.
|
|
363
|
+
const ref = step.i.ref ?? entity.name + '_ref01'
|
|
364
|
+
const entvar = goVar(step.i.entvar ?? ref + '_ent')
|
|
365
|
+
const datavar = goVar(step.i.datavar ?? (ref + '_data' + (step.i.suffix ?? '')))
|
|
365
366
|
|
|
366
|
-
const priorSteps = Object.values(flow
|
|
367
|
+
const priorSteps = Object.values(flowSteps(flow)).slice(0, Number(index)) as any[]
|
|
367
368
|
const needsEnt = !priorSteps.some((s: any) =>
|
|
368
|
-
['create', 'list', 'load', 'update', 'remove'].includes(s.
|
|
369
|
+
['create', 'list', 'load', 'update', 'remove'].includes(s.o))
|
|
369
370
|
|
|
370
371
|
const hasDatvar = priorSteps.some((s: any) => {
|
|
371
|
-
if ('create' === s.
|
|
372
|
-
const priorRef = s.
|
|
373
|
-
const priorDatvar = goVar(s.
|
|
372
|
+
if ('create' === s.o) {
|
|
373
|
+
const priorRef = s.i.ref ?? entity.name + '_ref01'
|
|
374
|
+
const priorDatvar = goVar(s.i.datavar ?? (priorRef + '_data' + (s.i.suffix ?? '')))
|
|
374
375
|
return priorDatvar === datavar
|
|
375
376
|
}
|
|
376
377
|
return false
|
|
@@ -423,14 +424,14 @@ const generateCreate: OpGen = (ctx, step, index) => {
|
|
|
423
424
|
const generateList: OpGen = (ctx, step, index) => {
|
|
424
425
|
const { entity, flow } = ctx
|
|
425
426
|
const hasDataId = null != entityDataIdField(entity)
|
|
426
|
-
const ref = step.
|
|
427
|
-
const entvar = goVar(step.
|
|
428
|
-
const matchvar = goVar(step.
|
|
429
|
-
const listvar = goVar(step.
|
|
427
|
+
const ref = step.i.ref ?? entity.name + '_ref01'
|
|
428
|
+
const entvar = goVar(step.i.entvar ?? ref + '_ent')
|
|
429
|
+
const matchvar = goVar(step.i.matchvar ?? (ref + '_match' + (step.i.suffix ?? '')))
|
|
430
|
+
const listvar = goVar(step.i.listvar ?? (ref + '_list' + (step.i.suffix ?? '')))
|
|
430
431
|
|
|
431
|
-
const priorSteps = Object.values(flow
|
|
432
|
+
const priorSteps = Object.values(flowSteps(flow)).slice(0, Number(index)) as any[]
|
|
432
433
|
const needsEnt = !priorSteps.some((s: any) =>
|
|
433
|
-
['create', 'list', 'load', 'update', 'remove'].includes(s.
|
|
434
|
+
['create', 'list', 'load', 'update', 'remove'].includes(s.o))
|
|
434
435
|
|
|
435
436
|
Content(` // LIST
|
|
436
437
|
`)
|
|
@@ -457,14 +458,14 @@ const generateList: OpGen = (ctx, step, index) => {
|
|
|
457
458
|
|
|
458
459
|
// Only declare ${listvar} as a real var when a downstream validator
|
|
459
460
|
// actually uses it; otherwise `_` to satisfy Go's unused-var check.
|
|
460
|
-
const allSteps = Object.values(flow
|
|
461
|
+
const allSteps = Object.values(flowSteps(flow)) as any[]
|
|
461
462
|
// hasDataId: the ItemExists/ItemNotExists asserts (the only listvar users) are
|
|
462
463
|
// now gated on a real DATA id field, so without one the list result is unused.
|
|
463
|
-
const listvarUsed = hasDataId && !!step.
|
|
464
|
+
const listvarUsed = hasDataId && !!step.v?.some((v: any) => {
|
|
464
465
|
if ('ItemExists' !== v.apply && 'ItemNotExists' !== v.apply) return false
|
|
465
466
|
const validRef = v.def?.ref
|
|
466
|
-
return validRef && allSteps.some((s: any) => 'create' === s.
|
|
467
|
-
((s.
|
|
467
|
+
return validRef && allSteps.some((s: any) => 'create' === s.o &&
|
|
468
|
+
((s.i.ref ?? entity.name + '_ref01') === validRef))
|
|
468
469
|
})
|
|
469
470
|
const listvarBind = listvarUsed ? listvar : '_'
|
|
470
471
|
|
|
@@ -482,12 +483,12 @@ const generateList: OpGen = (ctx, step, index) => {
|
|
|
482
483
|
}
|
|
483
484
|
`)
|
|
484
485
|
|
|
485
|
-
// Handle validators from step.
|
|
486
|
-
if (step.
|
|
487
|
-
for (const validator of step.
|
|
486
|
+
// Handle validators from step.v
|
|
487
|
+
if (step.v) {
|
|
488
|
+
for (const validator of step.v) {
|
|
488
489
|
const validRef = validator.def?.ref
|
|
489
|
-
const hasRefData = validRef && allSteps.some((s: any) => 'create' === s.
|
|
490
|
-
((s.
|
|
490
|
+
const hasRefData = validRef && allSteps.some((s: any) => 'create' === s.o &&
|
|
491
|
+
((s.i.ref ?? entity.name + '_ref01') === validRef))
|
|
491
492
|
|
|
492
493
|
if ('ItemExists' === validator.apply && hasRefData && hasDataId) {
|
|
493
494
|
const refDataVar = goVar(validRef + '_data')
|
|
@@ -513,16 +514,16 @@ const generateList: OpGen = (ctx, step, index) => {
|
|
|
513
514
|
|
|
514
515
|
const generateUpdate: OpGen = (ctx, step, index) => {
|
|
515
516
|
const { entity, flow } = ctx
|
|
516
|
-
const ref = step.
|
|
517
|
-
const entvar = goVar(step.
|
|
518
|
-
const datavar = goVar(step.
|
|
519
|
-
const resdatavar = goVar(step.
|
|
520
|
-
const markdefvar = goVar(step.
|
|
521
|
-
const srcdatavar = goVar(step.
|
|
522
|
-
|
|
523
|
-
const priorSteps = Object.values(flow
|
|
517
|
+
const ref = step.i.ref ?? entity.name + '_ref01'
|
|
518
|
+
const entvar = goVar(step.i.entvar ?? ref + '_ent')
|
|
519
|
+
const datavar = goVar(step.i.datavar ?? (ref + '_data' + (step.i.suffix ?? '')))
|
|
520
|
+
const resdatavar = goVar(step.i.resdatavar ?? (ref + '_resdata' + (step.i.suffix ?? '')))
|
|
521
|
+
const markdefvar = goVar(step.i.markdefvar ?? (ref + '_markdef' + (step.i.suffix ?? '')))
|
|
522
|
+
const srcdatavar = goVar(step.i.srcdatavar ?? (ref + '_data' + (step.i.suffix ?? '')))
|
|
523
|
+
|
|
524
|
+
const priorSteps = Object.values(flowSteps(flow)).slice(0, Number(index)) as any[]
|
|
524
525
|
const needsEnt = !priorSteps.some((s: any) =>
|
|
525
|
-
['create', 'list', 'load', 'update', 'remove'].includes(s.
|
|
526
|
+
['create', 'list', 'load', 'update', 'remove'].includes(s.o))
|
|
526
527
|
|
|
527
528
|
const hasEntIdU = null != entity.id
|
|
528
529
|
|
|
@@ -539,9 +540,9 @@ const generateUpdate: OpGen = (ctx, step, index) => {
|
|
|
539
540
|
`)
|
|
540
541
|
}
|
|
541
542
|
|
|
542
|
-
// Add data entries from step.
|
|
543
|
-
if (step.
|
|
544
|
-
const dataEntries = Object.entries(step.
|
|
543
|
+
// Add data entries from step.d
|
|
544
|
+
if (step.d) {
|
|
545
|
+
const dataEntries = Object.entries(step.d).filter(([k]: any) => k !== 'id' && !k.endsWith('$'))
|
|
545
546
|
for (const [key] of dataEntries) {
|
|
546
547
|
Content(` "${key}": setup.idmap["${key}"],
|
|
547
548
|
`)
|
|
@@ -552,10 +553,10 @@ const generateUpdate: OpGen = (ctx, step, index) => {
|
|
|
552
553
|
`)
|
|
553
554
|
|
|
554
555
|
// Handle TextFieldMark spec
|
|
555
|
-
if (step.
|
|
556
|
-
for (const spec of step.
|
|
557
|
-
if ('TextFieldMark' === spec.apply && null != step.
|
|
558
|
-
const fieldname = step.
|
|
556
|
+
if (step.s) {
|
|
557
|
+
for (const spec of step.s) {
|
|
558
|
+
if ('TextFieldMark' === spec.apply && null != step.i.textfield) {
|
|
559
|
+
const fieldname = step.i.textfield
|
|
559
560
|
const fieldvalue = spec.def?.mark ?? `Mark01-${ref}`
|
|
560
561
|
Content(`
|
|
561
562
|
${markdefvar}Name := "${fieldname}"
|
|
@@ -584,9 +585,9 @@ const generateUpdate: OpGen = (ctx, step, index) => {
|
|
|
584
585
|
}
|
|
585
586
|
|
|
586
587
|
// Assert TextFieldMark
|
|
587
|
-
if (step.
|
|
588
|
-
for (const spec of step.
|
|
589
|
-
if ('TextFieldMark' === spec.apply && null != step.
|
|
588
|
+
if (step.s) {
|
|
589
|
+
for (const spec of step.s) {
|
|
590
|
+
if ('TextFieldMark' === spec.apply && null != step.i.textfield) {
|
|
590
591
|
Content(` if ${resdatavar}[${markdefvar}Name] != ${markdefvar}Value {
|
|
591
592
|
t.Fatalf("expected %s to be updated, got %v", ${markdefvar}Name, ${resdatavar}[${markdefvar}Name])
|
|
592
593
|
}
|
|
@@ -599,24 +600,24 @@ const generateUpdate: OpGen = (ctx, step, index) => {
|
|
|
599
600
|
|
|
600
601
|
const generateLoad: OpGen = (ctx, step, index) => {
|
|
601
602
|
const { entity, flow } = ctx
|
|
602
|
-
const ref = step.
|
|
603
|
-
const entvar = goVar(step.
|
|
604
|
-
const matchvar = goVar(step.
|
|
605
|
-
const datavar = goVar(step.
|
|
606
|
-
const srcdatavar = goVar(step.
|
|
603
|
+
const ref = step.i.ref ?? entity.name + '_ref01'
|
|
604
|
+
const entvar = goVar(step.i.entvar ?? ref + '_ent')
|
|
605
|
+
const matchvar = goVar(step.i.matchvar ?? (ref + '_match' + (step.i.suffix ?? '')))
|
|
606
|
+
const datavar = goVar(step.i.datavar ?? (ref + '_data' + (step.i.suffix ?? '')))
|
|
607
|
+
const srcdatavar = goVar(step.i.srcdatavar ?? (ref + '_data' + (step.i.suffix ?? '')))
|
|
607
608
|
|
|
608
|
-
const priorSteps = Object.values(flow
|
|
609
|
+
const priorSteps = Object.values(flowSteps(flow)).slice(0, Number(index)) as any[]
|
|
609
610
|
const hasEntVar = priorSteps.some((s: any) =>
|
|
610
|
-
['create', 'list', 'load', 'update', 'remove'].includes(s.
|
|
611
|
+
['create', 'list', 'load', 'update', 'remove'].includes(s.o))
|
|
611
612
|
|
|
612
613
|
// Check if srcdatavar was declared by a prior create step or preamble
|
|
613
|
-
const flowHasCreate = Object.values(flow
|
|
614
|
+
const flowHasCreate = Object.values(flowSteps(flow)).some((s: any) => (s as any).o === 'create')
|
|
614
615
|
const preambleRef = entity.name + '_ref01'
|
|
615
616
|
const hasSrcData = (!flowHasCreate && srcdatavar === goVar(preambleRef + '_data')) ||
|
|
616
617
|
priorSteps.some((s: any) => {
|
|
617
|
-
if ('create' === s.
|
|
618
|
-
const priorRef = s.
|
|
619
|
-
const priorDatvar = goVar(s.
|
|
618
|
+
if ('create' === s.o) {
|
|
619
|
+
const priorRef = s.i.ref ?? entity.name + '_ref01'
|
|
620
|
+
const priorDatvar = goVar(s.i.datavar ?? (priorRef + '_data' + (s.i.suffix ?? '')))
|
|
620
621
|
return priorDatvar === srcdatavar
|
|
621
622
|
}
|
|
622
623
|
return false
|
|
@@ -674,14 +675,14 @@ const generateRemove: OpGen = (ctx, step, index) => {
|
|
|
674
675
|
if (null == entityDataIdField(entity)) {
|
|
675
676
|
return
|
|
676
677
|
}
|
|
677
|
-
const ref = step.
|
|
678
|
-
const entvar = goVar(step.
|
|
679
|
-
const matchvar = goVar(step.
|
|
680
|
-
const srcdatavar = goVar(step.
|
|
678
|
+
const ref = step.i.ref ?? entity.name + '_ref01'
|
|
679
|
+
const entvar = goVar(step.i.entvar ?? ref + '_ent')
|
|
680
|
+
const matchvar = goVar(step.i.matchvar ?? (ref + '_match' + (step.i.suffix ?? '')))
|
|
681
|
+
const srcdatavar = goVar(step.i.srcdatavar ?? (ref + '_data'))
|
|
681
682
|
|
|
682
|
-
const priorSteps = Object.values(flow
|
|
683
|
+
const priorSteps = Object.values(flowSteps(flow)).slice(0, Number(index)) as any[]
|
|
683
684
|
const needsEnt = !priorSteps.some((s: any) =>
|
|
684
|
-
['create', 'list', 'load', 'update', 'remove'].includes(s.
|
|
685
|
+
['create', 'list', 'load', 'update', 'remove'].includes(s.o))
|
|
685
686
|
|
|
686
687
|
// Use `:=` when this is the first op step (so `err` gets declared);
|
|
687
688
|
// otherwise reuse the `err` from a prior op step.
|
|
@@ -25,19 +25,19 @@ function projectPath(suffix?: string): string {
|
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
// The declared canon-type sentinel of a named parameter of an op — looked up
|
|
28
|
-
// in the op's `points[].
|
|
28
|
+
// in the op's `points[].g.params[]` exactly as the typed-model generator
|
|
29
29
|
// does. Falls back to the entity field of the same name (used when the op
|
|
30
30
|
// has no params and the request shape mirrors the entity fields). Returns
|
|
31
31
|
// undefined when neither is present.
|
|
32
32
|
function paramCanonType(entity: any, op: any, paramName: string): unknown {
|
|
33
33
|
const params = op ? each(opParams(op)) : []
|
|
34
|
-
const found = (params as any[]).find((p: any) => p && p.
|
|
34
|
+
const found = (params as any[]).find((p: any) => p && p.n === paramName)
|
|
35
35
|
if (found) {
|
|
36
|
-
return found.
|
|
36
|
+
return found.t
|
|
37
37
|
}
|
|
38
38
|
const field = (entity && entity.fields ? each(entity.fields) : [])
|
|
39
|
-
.find((f: any) => f && f.
|
|
40
|
-
return field && field.
|
|
39
|
+
.find((f: any) => f && f.n === paramName) as any
|
|
40
|
+
return field && field.t
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
|
|
@@ -103,8 +103,8 @@ const EntityTypes = cmp(function EntityTypes(props: any) {
|
|
|
103
103
|
|
|
104
104
|
// Typed reference models for the ${model.const.Name} SDK.
|
|
105
105
|
//
|
|
106
|
-
// GENERATED from the API model: main.${KIT}.entity.<e>.fields
|
|
107
|
-
// params (op.<name>.points[].
|
|
106
|
+
// GENERATED from the API model: main.${KIT}.entity.<e>.fields{} and per-op
|
|
107
|
+
// params (op.<name>.points[].g.params[]). Field/param types come from the
|
|
108
108
|
// canonical type sentinels (source of truth: @voxgig/apidef VALID_CANON). Do
|
|
109
109
|
// not edit by hand.
|
|
110
110
|
//
|
|
@@ -126,10 +126,10 @@ public final class ${model.const.Name}Types {
|
|
|
126
126
|
entityList.forEach((ent: any) => {
|
|
127
127
|
const Name = ent.Name
|
|
128
128
|
const fields = (ent.fields ? each(ent.fields) : [])
|
|
129
|
-
.filter((f: any) => f.
|
|
129
|
+
.filter((f: any) => f.a !== false)
|
|
130
130
|
|
|
131
131
|
emitRecord(Name, fields.map((f: any) => ({
|
|
132
|
-
name: f.
|
|
132
|
+
name: f.n, type: f.t,
|
|
133
133
|
})), log)
|
|
134
134
|
|
|
135
135
|
const ops = ent.op || {}
|
|
@@ -55,7 +55,7 @@ const ReadmeEntity = cmp(function ReadmeEntity(props: any) {
|
|
|
55
55
|
|
|
56
56
|
publishedEntities.map((entity: any) => {
|
|
57
57
|
const opnames = Object.keys(entity.op || {})
|
|
58
|
-
const fields = entity.fields ||
|
|
58
|
+
const fields = Object.values(entity.fields || {})
|
|
59
59
|
const idF = entityIdField(entity)
|
|
60
60
|
// Sanitise the local variable name — a camelCased Java keyword gets a
|
|
61
61
|
// trailing underscore (javaVarName) so the snippet compiles.
|
|
@@ -103,8 +103,8 @@ const ReadmeEntity = cmp(function ReadmeEntity(props: any) {
|
|
|
103
103
|
`)
|
|
104
104
|
|
|
105
105
|
each(fields, (field: any) => {
|
|
106
|
-
const desc = field.
|
|
107
|
-
Content(`| \`${field.
|
|
106
|
+
const desc = field.sh || ''
|
|
107
|
+
Content(`| \`${field.n}\` | \`${canonToType(field.t, target.name)}\` | ${desc} |
|
|
108
108
|
`)
|
|
109
109
|
})
|
|
110
110
|
|
|
@@ -116,13 +116,13 @@ On error, \`ok\` is \`false\` and \`err\` contains the error value.
|
|
|
116
116
|
|
|
117
117
|
`)
|
|
118
118
|
each(entityList, (ent: any) => {
|
|
119
|
-
const fields = ent.fields ||
|
|
119
|
+
const fields = Object.values(ent.fields || {})
|
|
120
120
|
const opnames = Object.keys(ent.op || {})
|
|
121
121
|
const ops = ent.op || {}
|
|
122
122
|
const points = each(ops).map((op: any) =>
|
|
123
123
|
op.points ? each(op.points) : []
|
|
124
124
|
).flat()
|
|
125
|
-
const path = points.length > 0 ? (points[0] as any).
|
|
125
|
+
const path = points.length > 0 ? (points[0] as any).o || '' : ''
|
|
126
126
|
|
|
127
127
|
Content(`#### ${ent.Name}
|
|
128
128
|
|
|
@@ -130,7 +130,7 @@ On error, \`ok\` is \`false\` and \`err\` contains the error value.
|
|
|
130
130
|
| --- | --- |
|
|
131
131
|
`)
|
|
132
132
|
each(fields, (field: any) => {
|
|
133
|
-
Content(`| \`${field.
|
|
133
|
+
Content(`| \`${field.n}\` | ${field.sh || ''} |
|
|
134
134
|
`)
|
|
135
135
|
})
|
|
136
136
|
|
|
@@ -170,7 +170,7 @@ Prepare a fetch definition without sending. Returns the \`fetchdef\` and raises
|
|
|
170
170
|
// Entity reference sections
|
|
171
171
|
publishedEntities.map((ent: any) => {
|
|
172
172
|
const opnames = Object.keys(ent.op || {})
|
|
173
|
-
const fields = ent.fields ||
|
|
173
|
+
const fields = Object.values(ent.fields || {})
|
|
174
174
|
// Model-driven id key: null when this entity has no id-like field.
|
|
175
175
|
const idF = entityIdField(ent)
|
|
176
176
|
// Sanitise the local variable name — javaVarName guards Java keywords.
|
|
@@ -205,9 +205,9 @@ SdkEntity ${eVar} = client.${accessor}(null);
|
|
|
205
205
|
| --- | --- | --- | --- |
|
|
206
206
|
`)
|
|
207
207
|
each(fields, (field: any) => {
|
|
208
|
-
const req = field.
|
|
209
|
-
const desc = field.
|
|
210
|
-
Content(`| \`${field.
|
|
208
|
+
const req = field.r ? 'Yes' : 'No'
|
|
209
|
+
const desc = field.sh || ''
|
|
210
|
+
Content(`| \`${field.n}\` | \`${canonToType(field.t, target.name)}\` | ${req} | ${desc} |
|
|
211
211
|
`)
|
|
212
212
|
})
|
|
213
213
|
|
|
@@ -232,7 +232,7 @@ SdkEntity ${eVar} = client.${accessor}(null);
|
|
|
232
232
|
if (fop.active === false) return '-'
|
|
233
233
|
return 'Yes'
|
|
234
234
|
})
|
|
235
|
-
Content(`| \`${field.
|
|
235
|
+
Content(`| \`${field.n}\` | ${cols.join(' | ')} |
|
|
236
236
|
`)
|
|
237
237
|
})
|
|
238
238
|
|
|
@@ -42,7 +42,7 @@ import ${javapackage}.utility.Json;
|
|
|
42
42
|
* ${model.const.Name} ${target.Name} SDK: generated schemas. Do not edit.
|
|
43
43
|
*
|
|
44
44
|
* <p>Generated from the model: {@code main.kit.optspec} and each feature's
|
|
45
|
-
* {@code config.options} for OPTSPEC; entity {@code fields
|
|
45
|
+
* {@code config.options} for OPTSPEC; entity {@code fields{}.type} for
|
|
46
46
|
* ENTITYSPEC.
|
|
47
47
|
*/
|
|
48
48
|
@SuppressWarnings({"unchecked"})
|