@voxgig/sdkgen 4.35.3 → 4.37.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 +1 -1
- package/dist/cmp/ReadmeTop.js +1 -1
- package/dist/cmp/ReadmeTop.js.map +1 -1
- package/dist/helpers/opExample.d.ts +4 -1
- package/dist/helpers/opExample.js +11 -1
- package/dist/helpers/opExample.js.map +1 -1
- package/dist/helpers/opShape.d.ts +2 -1
- package/dist/helpers/opShape.js +53 -26
- package/dist/helpers/opShape.js.map +1 -1
- package/dist/helpers/pointPath.d.ts +2 -1
- package/dist/helpers/pointPath.js +17 -0
- package/dist/helpers/pointPath.js.map +1 -1
- package/dist/helpers/testPolicy.d.ts +48 -2
- package/dist/helpers/testPolicy.js +265 -0
- package/dist/helpers/testPolicy.js.map +1 -1
- package/dist/sdkgen.d.ts +7 -7
- package/dist/sdkgen.js +26 -4
- package/dist/sdkgen.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/project/.sdk/src/cmp/c/PrepareAuth_c.ts +10 -4
- package/project/.sdk/src/cmp/c/ReadmeEntity_c.ts +2 -2
- package/project/.sdk/src/cmp/c/ReadmeHowto_c.ts +2 -2
- package/project/.sdk/src/cmp/c/ReadmeQuick_c.ts +6 -5
- package/project/.sdk/src/cmp/c/ReadmeRef_c.ts +3 -3
- package/project/.sdk/src/cmp/c/ReadmeTopQuick_c.ts +2 -2
- package/project/.sdk/src/cmp/c/ReadmeTopTest_c.ts +2 -2
- package/project/.sdk/src/cmp/c/TestDirect_c.ts +2 -6
- package/project/.sdk/src/cmp/clojure/ReadmeEntity_clojure.ts +2 -2
- package/project/.sdk/src/cmp/clojure/ReadmeHowto_clojure.ts +2 -2
- package/project/.sdk/src/cmp/clojure/ReadmeQuick_clojure.ts +4 -4
- package/project/.sdk/src/cmp/clojure/ReadmeRef_clojure.ts +3 -3
- package/project/.sdk/src/cmp/clojure/ReadmeTopQuick_clojure.ts +2 -2
- package/project/.sdk/src/cmp/clojure/ReadmeTopTest_clojure.ts +2 -2
- package/project/.sdk/src/cmp/cpp/ReadmeEntity_cpp.ts +2 -2
- package/project/.sdk/src/cmp/cpp/ReadmeHowto_cpp.ts +2 -2
- package/project/.sdk/src/cmp/cpp/ReadmeQuick_cpp.ts +4 -4
- package/project/.sdk/src/cmp/cpp/ReadmeRef_cpp.ts +3 -3
- package/project/.sdk/src/cmp/cpp/ReadmeTopQuick_cpp.ts +2 -2
- package/project/.sdk/src/cmp/cpp/ReadmeTopTest_cpp.ts +2 -2
- package/project/.sdk/src/cmp/cpp/TestDirect_cpp.ts +2 -6
- package/project/.sdk/src/cmp/cpp/TestEntity_cpp.ts +51 -3
- package/project/.sdk/src/cmp/csharp/ReadmeEntity_csharp.ts +2 -2
- package/project/.sdk/src/cmp/csharp/ReadmeHowto_csharp.ts +2 -2
- package/project/.sdk/src/cmp/csharp/ReadmeQuick_csharp.ts +5 -5
- package/project/.sdk/src/cmp/csharp/ReadmeRef_csharp.ts +3 -3
- package/project/.sdk/src/cmp/csharp/ReadmeTopQuick_csharp.ts +3 -3
- package/project/.sdk/src/cmp/csharp/ReadmeTopTest_csharp.ts +2 -2
- package/project/.sdk/src/cmp/csharp/TestDirect_csharp.ts +41 -19
- package/project/.sdk/src/cmp/csharp/TestEntity_csharp.ts +105 -27
- package/project/.sdk/src/cmp/elixir/ReadmeEntity_elixir.ts +2 -2
- package/project/.sdk/src/cmp/elixir/ReadmeHowto_elixir.ts +2 -2
- package/project/.sdk/src/cmp/elixir/ReadmeQuick_elixir.ts +4 -4
- package/project/.sdk/src/cmp/elixir/ReadmeRef_elixir.ts +3 -3
- package/project/.sdk/src/cmp/elixir/ReadmeTopQuick_elixir.ts +2 -2
- package/project/.sdk/src/cmp/elixir/ReadmeTopTest_elixir.ts +2 -2
- package/project/.sdk/src/cmp/go/EntityOperation_go.ts +2 -2
- package/project/.sdk/src/cmp/go/Entity_go.ts +5 -4
- package/project/.sdk/src/cmp/go/MainEntity_go.ts +1 -1
- package/project/.sdk/src/cmp/go/Main_go.ts +9 -5
- package/project/.sdk/src/cmp/go/PrepareAuth_go.ts +24 -15
- package/project/.sdk/src/cmp/go/ReadmeEntity_go.ts +2 -2
- package/project/.sdk/src/cmp/go/ReadmeHowto_go.ts +2 -2
- package/project/.sdk/src/cmp/go/ReadmeModel_go.ts +3 -3
- package/project/.sdk/src/cmp/go/ReadmeQuick_go.ts +4 -4
- package/project/.sdk/src/cmp/go/ReadmeRef_go.ts +4 -4
- package/project/.sdk/src/cmp/go/ReadmeTopTest_go.ts +2 -2
- package/project/.sdk/src/cmp/go/TestDirect_go.ts +61 -26
- package/project/.sdk/src/cmp/go/TestEntity_go.ts +115 -32
- package/project/.sdk/src/cmp/go-cli/fragment/words.fragment.go +1 -1
- package/project/.sdk/src/cmp/go-mcp/fragment/tools.fragment.go +1 -1
- package/project/.sdk/src/cmp/java/ReadmeEntity_java.ts +2 -2
- package/project/.sdk/src/cmp/java/ReadmeHowto_java.ts +2 -2
- package/project/.sdk/src/cmp/java/ReadmeQuick_java.ts +5 -5
- package/project/.sdk/src/cmp/java/ReadmeRef_java.ts +3 -3
- package/project/.sdk/src/cmp/java/ReadmeTopQuick_java.ts +3 -3
- package/project/.sdk/src/cmp/java/ReadmeTopTest_java.ts +2 -2
- package/project/.sdk/src/cmp/java/TestDirect_java.ts +40 -20
- package/project/.sdk/src/cmp/java/TestEntity_java.ts +107 -26
- package/project/.sdk/src/cmp/js/ReadmeEntity_js.ts +2 -2
- package/project/.sdk/src/cmp/js/ReadmeHowto_js.ts +2 -2
- package/project/.sdk/src/cmp/js/ReadmeQuick_js.ts +4 -4
- package/project/.sdk/src/cmp/js/ReadmeRef_js.ts +3 -3
- package/project/.sdk/src/cmp/js/ReadmeTopTest_js.ts +2 -2
- package/project/.sdk/src/cmp/js/TestDirect_js.ts +68 -13
- package/project/.sdk/src/cmp/js/TestEntity_js.ts +46 -4
- package/project/.sdk/src/cmp/kotlin/ReadmeEntity_kotlin.ts +2 -2
- package/project/.sdk/src/cmp/kotlin/ReadmeHowto_kotlin.ts +2 -2
- package/project/.sdk/src/cmp/kotlin/ReadmeQuick_kotlin.ts +5 -5
- package/project/.sdk/src/cmp/kotlin/ReadmeRef_kotlin.ts +3 -3
- package/project/.sdk/src/cmp/kotlin/ReadmeTopQuick_kotlin.ts +3 -3
- package/project/.sdk/src/cmp/kotlin/ReadmeTopTest_kotlin.ts +2 -2
- package/project/.sdk/src/cmp/kotlin/TestDirect_kotlin.ts +41 -21
- package/project/.sdk/src/cmp/kotlin/TestEntity_kotlin.ts +99 -22
- package/project/.sdk/src/cmp/lua/ReadmeEntity_lua.ts +2 -2
- package/project/.sdk/src/cmp/lua/ReadmeHowto_lua.ts +2 -2
- package/project/.sdk/src/cmp/lua/ReadmeQuick_lua.ts +4 -4
- package/project/.sdk/src/cmp/lua/ReadmeRef_lua.ts +3 -3
- package/project/.sdk/src/cmp/lua/ReadmeTopQuick_lua.ts +3 -3
- package/project/.sdk/src/cmp/lua/ReadmeTopTest_lua.ts +2 -2
- package/project/.sdk/src/cmp/lua/TestDirect_lua.ts +40 -16
- package/project/.sdk/src/cmp/lua/TestEntity_lua.ts +108 -30
- package/project/.sdk/src/cmp/ocaml/ReadmeEntity_ocaml.ts +2 -2
- package/project/.sdk/src/cmp/ocaml/ReadmeHowto_ocaml.ts +2 -2
- package/project/.sdk/src/cmp/ocaml/ReadmeQuick_ocaml.ts +4 -4
- package/project/.sdk/src/cmp/ocaml/ReadmeRef_ocaml.ts +3 -3
- package/project/.sdk/src/cmp/ocaml/ReadmeTopQuick_ocaml.ts +2 -2
- package/project/.sdk/src/cmp/ocaml/ReadmeTopTest_ocaml.ts +2 -2
- package/project/.sdk/src/cmp/perl/ReadmeEntity_perl.ts +2 -2
- package/project/.sdk/src/cmp/perl/ReadmeHowto_perl.ts +2 -2
- package/project/.sdk/src/cmp/perl/ReadmeQuick_perl.ts +4 -4
- package/project/.sdk/src/cmp/perl/ReadmeRef_perl.ts +3 -3
- package/project/.sdk/src/cmp/perl/ReadmeTopQuick_perl.ts +2 -2
- package/project/.sdk/src/cmp/perl/ReadmeTopTest_perl.ts +2 -2
- package/project/.sdk/src/cmp/perl/TestDirect_perl.ts +35 -16
- package/project/.sdk/src/cmp/perl/TestEntity_perl.ts +98 -22
- package/project/.sdk/src/cmp/php/ReadmeEntity_php.ts +2 -2
- package/project/.sdk/src/cmp/php/ReadmeHowto_php.ts +2 -2
- package/project/.sdk/src/cmp/php/ReadmeQuick_php.ts +4 -4
- package/project/.sdk/src/cmp/php/ReadmeRef_php.ts +3 -3
- package/project/.sdk/src/cmp/php/ReadmeTopQuick_php.ts +2 -2
- package/project/.sdk/src/cmp/php/ReadmeTopTest_php.ts +2 -2
- package/project/.sdk/src/cmp/php/TestDirect_php.ts +33 -16
- package/project/.sdk/src/cmp/php/TestEntity_php.ts +98 -29
- package/project/.sdk/src/cmp/py/ReadmeEntity_py.ts +2 -2
- package/project/.sdk/src/cmp/py/ReadmeHowto_py.ts +2 -2
- package/project/.sdk/src/cmp/py/ReadmeQuick_py.ts +4 -4
- package/project/.sdk/src/cmp/py/ReadmeRef_py.ts +3 -3
- package/project/.sdk/src/cmp/py/ReadmeTopQuick_py.ts +2 -2
- package/project/.sdk/src/cmp/py/ReadmeTopTest_py.ts +2 -2
- package/project/.sdk/src/cmp/py/TestDirect_py.ts +39 -16
- package/project/.sdk/src/cmp/py/TestEntity_py.ts +90 -27
- package/project/.sdk/src/cmp/rb/ReadmeEntity_rb.ts +2 -2
- package/project/.sdk/src/cmp/rb/ReadmeHowto_rb.ts +2 -2
- package/project/.sdk/src/cmp/rb/ReadmeQuick_rb.ts +4 -4
- package/project/.sdk/src/cmp/rb/ReadmeRef_rb.ts +3 -3
- package/project/.sdk/src/cmp/rb/ReadmeTopQuick_rb.ts +2 -2
- package/project/.sdk/src/cmp/rb/ReadmeTopTest_rb.ts +2 -2
- package/project/.sdk/src/cmp/rb/TestClean_rb.ts +1 -1
- package/project/.sdk/src/cmp/rb/TestDirect_rb.ts +33 -16
- package/project/.sdk/src/cmp/rb/TestEntity_rb.ts +90 -25
- package/project/.sdk/src/cmp/rb/fragment/Main.fragment.rb +3 -3
- package/project/.sdk/src/cmp/rust/EntityOperation_rust.ts +1 -1
- package/project/.sdk/src/cmp/rust/Main_rust.ts +3 -1
- package/project/.sdk/src/cmp/rust/ReadmeEntity_rust.ts +2 -2
- package/project/.sdk/src/cmp/rust/ReadmeHowto_rust.ts +3 -3
- package/project/.sdk/src/cmp/rust/ReadmeModel_rust.ts +1 -1
- package/project/.sdk/src/cmp/rust/ReadmeQuick_rust.ts +5 -5
- package/project/.sdk/src/cmp/rust/ReadmeRef_rust.ts +4 -4
- package/project/.sdk/src/cmp/rust/ReadmeTopQuick_rust.ts +3 -3
- package/project/.sdk/src/cmp/rust/ReadmeTopTest_rust.ts +3 -3
- package/project/.sdk/src/cmp/rust/TestClean_rust.ts +1 -1
- package/project/.sdk/src/cmp/rust/TestDirect_rust.ts +40 -12
- package/project/.sdk/src/cmp/rust/TestEntity_rust.ts +109 -26
- package/project/.sdk/src/cmp/rust/fragment/Entity.fragment.rs +2 -2
- package/project/.sdk/src/cmp/scala/ReadmeEntity_scala.ts +2 -2
- package/project/.sdk/src/cmp/scala/ReadmeHowto_scala.ts +2 -2
- package/project/.sdk/src/cmp/scala/ReadmeQuick_scala.ts +5 -5
- package/project/.sdk/src/cmp/scala/ReadmeRef_scala.ts +3 -3
- package/project/.sdk/src/cmp/scala/ReadmeTopQuick_scala.ts +3 -3
- package/project/.sdk/src/cmp/scala/ReadmeTopTest_scala.ts +2 -2
- package/project/.sdk/src/cmp/scala/TestDirect_scala.ts +2 -6
- package/project/.sdk/src/cmp/scala/TestEntity_scala.ts +36 -7
- package/project/.sdk/src/cmp/swift/ReadmeEntity_swift.ts +2 -2
- package/project/.sdk/src/cmp/swift/ReadmeHowto_swift.ts +2 -2
- package/project/.sdk/src/cmp/swift/ReadmeQuick_swift.ts +5 -5
- package/project/.sdk/src/cmp/swift/ReadmeRef_swift.ts +3 -3
- package/project/.sdk/src/cmp/swift/ReadmeTopQuick_swift.ts +2 -2
- package/project/.sdk/src/cmp/swift/ReadmeTopTest_swift.ts +2 -2
- package/project/.sdk/src/cmp/ts/ReadmeEntity_ts.ts +2 -2
- package/project/.sdk/src/cmp/ts/ReadmeExamplesTest_ts.ts +49 -19
- package/project/.sdk/src/cmp/ts/ReadmeHowto_ts.ts +2 -2
- package/project/.sdk/src/cmp/ts/ReadmeQuick_ts.ts +4 -4
- package/project/.sdk/src/cmp/ts/ReadmeRef_ts.ts +3 -3
- package/project/.sdk/src/cmp/ts/ReadmeTopTest_ts.ts +3 -3
- package/project/.sdk/src/cmp/ts/TestDirect_ts.ts +54 -23
- package/project/.sdk/src/cmp/ts/TestEntity_ts.ts +49 -4
- package/project/.sdk/src/cmp/zig/ReadmeEntity_zig.ts +2 -2
- package/project/.sdk/src/cmp/zig/ReadmeHowto_zig.ts +2 -2
- package/project/.sdk/src/cmp/zig/ReadmeQuick_zig.ts +4 -4
- package/project/.sdk/src/cmp/zig/ReadmeRef_zig.ts +3 -3
- package/project/.sdk/src/cmp/zig/ReadmeTopQuick_zig.ts +2 -2
- package/project/.sdk/src/cmp/zig/ReadmeTopTest_zig.ts +2 -2
- package/project/.sdk/tm/c/core/sdk.h +2 -2
- package/project/.sdk/tm/c/tests/primary_utility_test.c +37 -0
- package/project/.sdk/tm/c/utility/fetcher.c +31 -1
- package/project/.sdk/tm/c/utility/make_url.c +6 -2
- package/project/.sdk/tm/clojure/src/sdk/core.clj +21 -3
- package/project/.sdk/tm/clojure/test/sdk/test/pipeline.clj +34 -0
- package/project/.sdk/tm/cpp/test/primary_utility_test.cpp +37 -0
- package/project/.sdk/tm/cpp/utility/pipeline.hpp +28 -2
- package/project/.sdk/tm/csharp/test/PrimaryUtilityTest.cs +40 -0
- package/project/.sdk/tm/csharp/utility/Fetcher.cs +27 -0
- package/project/.sdk/tm/csharp/utility/MakeUrl.cs +7 -2
- package/project/.sdk/tm/elixir/lib/projectname/utility.ex +30 -3
- package/project/.sdk/tm/elixir/test/pipeline_test.exs +23 -0
- package/project/.sdk/tm/go/core/helpers.go +1 -1
- package/project/.sdk/tm/go/core/types.go +9 -1
- package/project/.sdk/tm/go/test/feature_corpus_test.go +3 -4
- package/project/.sdk/tm/go/test/primary_utility_test.go +28 -0
- package/project/.sdk/tm/go/utility/fetcher.go +26 -0
- package/project/.sdk/tm/go/utility/make_url.go +5 -2
- package/project/.sdk/tm/java/test/FeatureCorpusTest.java +4 -5
- package/project/.sdk/tm/java/test/PrimaryUtilityTest.java +49 -0
- package/project/.sdk/tm/java/utility/Fetcher.java +24 -0
- package/project/.sdk/tm/java/utility/MakeUrl.java +6 -2
- package/project/.sdk/tm/js/src/utility/FetcherUtility.js +24 -0
- package/project/.sdk/tm/js/src/utility/MakeUrlUtility.js +6 -2
- package/project/.sdk/tm/js/test/feature/Corpus.test.js +7 -6
- package/project/.sdk/tm/js/test/live-entity.js +18 -6
- package/project/.sdk/tm/js/test/live-runner.js +15 -3
- package/project/.sdk/tm/js/test/utility/PrimaryUtility.test.js +25 -0
- package/project/.sdk/tm/kotlin/test/PrimaryUtilityTest.kt +48 -0
- package/project/.sdk/tm/kotlin/utility/Fetcher.kt +20 -0
- package/project/.sdk/tm/kotlin/utility/MakeSpecUrl.kt +6 -2
- package/project/.sdk/tm/lua/test/pipeline_test.lua +27 -0
- package/project/.sdk/tm/lua/test/primary_utility_test.lua +36 -0
- package/project/.sdk/tm/lua/utility/fetcher.lua +31 -0
- package/project/.sdk/tm/lua/utility/make_url.lua +6 -2
- package/project/.sdk/tm/ocaml/Makefile +5 -1
- package/project/.sdk/tm/ocaml/sdk_runtime.ml +36 -4
- package/project/.sdk/tm/ocaml/test/t_pipeline.ml +22 -0
- package/project/.sdk/tm/perl/t/primary_utility.t +22 -0
- package/project/.sdk/tm/perl/utility/fetcher.pm +18 -0
- package/project/.sdk/tm/perl/utility/make_url.pm +4 -2
- package/project/.sdk/tm/php/test/FeatureCorpusTest.php +6 -5
- package/project/.sdk/tm/php/test/PipelineTest.php +31 -7
- package/project/.sdk/tm/php/utility/Fetcher.php +34 -27
- package/project/.sdk/tm/php/utility/MakeOptions.php +2 -1
- package/project/.sdk/tm/php/utility/MakeUrl.php +6 -2
- package/project/.sdk/tm/py/pkg/utility/fetcher.py +23 -0
- package/project/.sdk/tm/py/pkg/utility/make_url.py +5 -2
- package/project/.sdk/tm/py/test/test_feature_corpus.py +5 -5
- package/project/.sdk/tm/py/test/test_primary_utility.py +21 -0
- package/project/.sdk/tm/rb/core/context.rb +1 -1
- package/project/.sdk/tm/rb/core/error.rb +20 -1
- package/project/.sdk/tm/rb/test/feature_corpus_test.rb +4 -5
- package/project/.sdk/tm/rb/test/feature_test.rb +2 -2
- package/project/.sdk/tm/rb/test/omni.rb +1 -1
- package/project/.sdk/tm/rb/test/pipeline_test.rb +19 -2
- package/project/.sdk/tm/rb/test/primary_utility_test.rb +28 -1
- package/project/.sdk/tm/rb/utility/fetcher.rb +20 -1
- package/project/.sdk/tm/rb/utility/make_error.rb +1 -1
- package/project/.sdk/tm/rb/utility/make_url.rb +4 -2
- package/project/.sdk/tm/rust/core/helpers.rs +1 -1
- package/project/.sdk/tm/rust/core/types.rs +2 -2
- package/project/.sdk/tm/rust/tests/primary_utility_test.rs +34 -0
- package/project/.sdk/tm/rust/utility/fetcher.rs +27 -0
- package/project/.sdk/tm/rust/utility/make_url.rs +7 -2
- package/project/.sdk/tm/scala/sdktest/SdkTestMain.scala +51 -1
- package/project/.sdk/tm/scala/utility/Fetcher.scala +16 -0
- package/project/.sdk/tm/scala/utility/Make.scala +6 -2
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/Fetcher.swift +24 -0
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/Make.swift +6 -2
- package/project/.sdk/tm/swift/Tests/ProjectNameSDKTests/PrimaryUtilityTest.swift +34 -0
- package/project/.sdk/tm/ts/src/utility/FetcherUtility.ts +24 -0
- package/project/.sdk/tm/ts/src/utility/MakeUrlUtility.ts +6 -2
- package/project/.sdk/tm/ts/test/feature/Corpus.test.ts +7 -6
- package/project/.sdk/tm/ts/test/live-entity.ts +20 -5
- package/project/.sdk/tm/ts/test/live-runner.ts +17 -3
- package/project/.sdk/tm/ts/test/utility/PrimaryUtility.test.ts +25 -0
- package/project/.sdk/tm/zig/core/utility.zig +30 -3
- package/project/.sdk/tm/zig/test/primary_utility_test.zig +28 -0
- package/project/sdkgen-package.json +1 -1
- package/src/cmp/ReadmeTop.ts +3 -3
- package/src/helpers/opExample.ts +16 -1
- package/src/helpers/opShape.ts +64 -30
- package/src/helpers/pointPath.ts +19 -0
- package/src/helpers/testPolicy.ts +316 -2
- package/src/sdkgen.ts +37 -5
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { flowSteps, opReachable, invalidRequest } from '@voxgig/sdkgen'
|
|
1
|
+
import { flowSteps, opReachable, invalidRequest, flowLoadRoute, flowLoadReadsRecord } from '@voxgig/sdkgen'
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
KIT,
|
|
@@ -22,6 +22,9 @@ import {
|
|
|
22
22
|
serverVarEnv,
|
|
23
23
|
serverVariables,
|
|
24
24
|
liveFlowNeeds, liveStrict, liveStrictNote,
|
|
25
|
+
liveGetOnly, liveExcludedLines, liveExcludedSummary, LIVE_GETONLY_ENV,
|
|
26
|
+
liveRouteExamples, liveStepExamples,
|
|
27
|
+
liveEntity,
|
|
25
28
|
} from '@voxgig/sdkgen'
|
|
26
29
|
|
|
27
30
|
|
|
@@ -69,7 +72,9 @@ function liveFlowGate(entity: any, needs: any, entidEnv: string, method: string,
|
|
|
69
72
|
out += ' let client = setup.client.clone();\n'
|
|
70
73
|
if (null != needs.discover) {
|
|
71
74
|
const match = Object.entries(needs.discover)
|
|
72
|
-
.map(([k, v]: any) => `(${JSON.stringify(k)}, getp(&setup.idmap, ${JSON.stringify(v)}))`)
|
|
75
|
+
.map(([k, v]: any) => `(${JSON.stringify(k)}, getp(&setup.idmap, ${JSON.stringify(v)}))`)
|
|
76
|
+
.concat(liveRouteExamples(entity, 'list', Object.keys(needs.discover))
|
|
77
|
+
.map(([k, ex]) => `(${JSON.stringify(k)}, ${rustLit(ex)})`)).join(', ')
|
|
73
78
|
out += ` if setup.live && !live_existing(&setup.data, LIVE_STRICT, ${JSON.stringify(entity.name)}, || {
|
|
74
79
|
client
|
|
75
80
|
.${method}(Value::Noval)
|
|
@@ -92,7 +97,7 @@ const TestEntity = cmp(function TestEntity(props: any) {
|
|
|
92
97
|
const model: Model = ctx$.model
|
|
93
98
|
|
|
94
99
|
const target = props.target
|
|
95
|
-
const entity: ModelEntity = props.entity
|
|
100
|
+
const entity: ModelEntity = liveEntity(ctx$, props.entity)
|
|
96
101
|
const rustcrate: string = props.rustcrate
|
|
97
102
|
|
|
98
103
|
const basicflow: ModelEntityFlow | undefined =
|
|
@@ -135,7 +140,6 @@ const TestEntity = cmp(function TestEntity(props: any) {
|
|
|
135
140
|
const genCtx: GenCtx = { model, entity, rustcrate, flow: basicflow, PROJUPPER }
|
|
136
141
|
|
|
137
142
|
const strict = liveStrict(model, target.name)
|
|
138
|
-
const needs = liveFlowNeeds(entity, basicflow)
|
|
139
143
|
|
|
140
144
|
const opNames = Array.from(new Set(allSteps.map((s: any) => s.o).filter(Boolean)))
|
|
141
145
|
const opsList = opNames.map(o => `"${o}"`).join(', ')
|
|
@@ -180,7 +184,7 @@ use common::*;
|
|
|
180
184
|
|
|
181
185
|
use ${rustcrate}::core::helpers::{getp, getpath, ja, jo, now_ms, setp, to_map};
|
|
182
186
|
use ${rustcrate}::utility::voxgigstruct as vs;
|
|
183
|
-
use ${rustcrate}::{test_sdk, Entity, ${model.const.Name}
|
|
187
|
+
use ${rustcrate}::{test_sdk, Entity, ${model.const.Name}EntityBase, ${model.const.Name}SDK, Value};
|
|
184
188
|
|
|
185
189
|
${liveStrictNote(strict, '//')}
|
|
186
190
|
const LIVE_STRICT: bool = ${strict};
|
|
@@ -247,14 +251,18 @@ fn ${evar}_entity_stream() {
|
|
|
247
251
|
#[test]
|
|
248
252
|
fn ${evar}_entity_basic() {
|
|
249
253
|
let setup = ${evar}_basic_setup(Value::Noval);
|
|
250
|
-
${skipBlock}
|
|
251
|
-
allSteps.length > 0)}`)
|
|
254
|
+
${skipBlock}`)
|
|
252
255
|
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
256
|
+
const flowBody = (flow: any) => {
|
|
257
|
+
const steps = flowSteps(flow) as any[]
|
|
258
|
+
Content(liveFlowGate(entity, liveFlowNeeds(entity, flow), PROJUPPER + '_TEST_' + ENTUPPER + '_ENTID',
|
|
259
|
+
method, strict, steps.length > 0))
|
|
260
|
+
|
|
261
|
+
// No create step: bootstrap entity data from existing fixture data.
|
|
262
|
+
const flowHasCreate = steps.some((s: any) => s.o === 'create')
|
|
263
|
+
if (!flowHasCreate) {
|
|
264
|
+
const preambleVar = rustVarName(entity.name + '_ref01')
|
|
265
|
+
Content(`
|
|
258
266
|
// Bootstrap entity data from existing test data (no create step in flow).
|
|
259
267
|
let ${preambleVar}_data_raw = vs::items(&to_map(&getpath(&["existing", "${entity.name}"], &setup.data)));
|
|
260
268
|
let ${preambleVar}_data = to_map(&vs::get_elem(
|
|
@@ -263,22 +271,47 @@ ${skipBlock}${liveFlowGate(entity, needs, PROJUPPER + '_TEST_' + ENTUPPER + '_EN
|
|
|
263
271
|
Value::Noval,
|
|
264
272
|
));
|
|
265
273
|
`)
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
// Model-driven step iteration.
|
|
269
|
-
each(flowSteps(basicflow), (step: any, index: any) => {
|
|
270
|
-
const opgen: OpGen = GENERATE_OP[step.o]
|
|
271
|
-
if (opgen) {
|
|
272
|
-
opgen(genCtx, step, index)
|
|
273
|
-
Content('\n')
|
|
274
274
|
}
|
|
275
|
-
})
|
|
276
275
|
|
|
277
|
-
|
|
276
|
+
// Model-driven step iteration.
|
|
277
|
+
each(steps, (step: any, index: any) => {
|
|
278
|
+
const opgen: OpGen = GENERATE_OP[step.o]
|
|
279
|
+
if (opgen) {
|
|
280
|
+
opgen({ ...genCtx, flow }, step, index)
|
|
281
|
+
Content('\n')
|
|
282
|
+
}
|
|
283
|
+
})
|
|
284
|
+
|
|
285
|
+
Content(strict || 0 === steps.length ? '' : ` }));
|
|
278
286
|
if let Err(err) = outcome {
|
|
279
287
|
live_observe(err, setup.live, LIVE_STRICT);
|
|
280
288
|
}
|
|
281
|
-
`
|
|
289
|
+
`)
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
const getOnly = liveGetOnly(entity, basicflow)
|
|
293
|
+
if (null != getOnly) {
|
|
294
|
+
Content(` if setup.live && std::env::var(${JSON.stringify(LIVE_GETONLY_ENV)}).map(|v| v == "TRUE").unwrap_or(false) {
|
|
295
|
+
${liveExcludedLines(getOnly).map((line) => ' println!("{}", ' + JSON.stringify(line) + ');\n').join('')}`)
|
|
296
|
+
if (0 === flowSteps(getOnly.flow).length) {
|
|
297
|
+
Content(` eprintln!("skip: {}", ${JSON.stringify(liveExcludedSummary(getOnly))});
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
`)
|
|
302
|
+
}
|
|
303
|
+
else {
|
|
304
|
+
flowBody(getOnly.flow)
|
|
305
|
+
Content(` return;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
`)
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
flowBody(basicflow)
|
|
313
|
+
|
|
314
|
+
Content(`}
|
|
282
315
|
|
|
283
316
|
`)
|
|
284
317
|
|
|
@@ -478,6 +511,7 @@ const generateList: OpGen = (ctx, step, index) => {
|
|
|
478
511
|
`)
|
|
479
512
|
}
|
|
480
513
|
}
|
|
514
|
+
Content(liveFill(entity, step, matchvar))
|
|
481
515
|
|
|
482
516
|
Content(`
|
|
483
517
|
let ${listvar} = ${entvar}
|
|
@@ -651,7 +685,7 @@ const generateLoad: OpGen = (ctx, step, index) => {
|
|
|
651
685
|
Content(` let ${entvar} = client.${rustMethodName(entity.name)}(Value::Noval);
|
|
652
686
|
`)
|
|
653
687
|
}
|
|
654
|
-
if (!hasSrcData && hasEntId) {
|
|
688
|
+
if (!hasSrcData && (hasEntId || flowLoadReadsRecord(entity, step))) {
|
|
655
689
|
Content(` let ${srcdatavar}_raw = vs::items(&to_map(&getpath(&["existing", "${entity.name}"], &setup.data)));
|
|
656
690
|
let ${srcdatavar} = to_map(&vs::get_elem(
|
|
657
691
|
&vs::get_elem(&${srcdatavar}_raw, &Value::Num(0.0), Value::Noval),
|
|
@@ -662,7 +696,7 @@ const generateLoad: OpGen = (ctx, step, index) => {
|
|
|
662
696
|
}
|
|
663
697
|
if (hasEntId) {
|
|
664
698
|
Content(` let ${matchvar} = jo(vec![("id", getp(&${srcdatavar}, "id"))]);
|
|
665
|
-
${
|
|
699
|
+
${loadMatch(entity, step, matchvar, srcdatavar)}${liveFill(entity, step, matchvar)} let ${datavar}_loaded = ${entvar}
|
|
666
700
|
.load(${matchvar}.clone(), Value::Noval)
|
|
667
701
|
.expect("load failed");
|
|
668
702
|
let ${datavar}_load_result = to_map(&${datavar}_loaded.data(None));
|
|
@@ -679,7 +713,7 @@ ${parentMatch(step, matchvar)} let ${datavar}_loaded = ${entvar}
|
|
|
679
713
|
}
|
|
680
714
|
else {
|
|
681
715
|
Content(` let ${matchvar} = Value::empty_map();
|
|
682
|
-
${
|
|
716
|
+
${loadMatch(entity, step, matchvar, srcdatavar)}${liveFill(entity, step, matchvar)} let ${datavar}_loaded = ${entvar}
|
|
683
717
|
.load(${matchvar}.clone(), Value::Noval)
|
|
684
718
|
.expect("load failed");
|
|
685
719
|
// load resolves to the ENTITY; the record is reached through data().
|
|
@@ -721,6 +755,22 @@ ${parentMatch(step, matchvar)} ${entvar}
|
|
|
721
755
|
// A child's route names its parents, and an entity no earlier step has
|
|
722
756
|
// filled knows none of them, so the call itself gives each parent id. A live
|
|
723
757
|
// ENTID may key a parent by its field name, the fixture by its own name.
|
|
758
|
+
function rustLit(value: any): string {
|
|
759
|
+
if ('string' === typeof value) return `Value::str(${JSON.stringify(value)})`
|
|
760
|
+
if ('boolean' === typeof value) return `Value::Bool(${value})`
|
|
761
|
+
return `Value::Num(${Number.isInteger(value) ? value + '.0' : value})`
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
|
|
765
|
+
// A live step sends each example its route requires and the step leaves unbound.
|
|
766
|
+
function liveFill(entity: any, step: any, matchvar: string): string {
|
|
767
|
+
const fills = liveStepExamples(entity, step)
|
|
768
|
+
return 0 === fills.length ? '' : ` if setup.live {
|
|
769
|
+
${fills.map(([k, ex]) => ` setp(&${matchvar}, ${JSON.stringify(k)}, ${rustLit(ex)});\n`).join('')} }
|
|
770
|
+
`
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
|
|
724
774
|
function parentMatch(step: any, matchvar: string): string {
|
|
725
775
|
return Object.entries(step.m || {})
|
|
726
776
|
.filter(([k]: any) => k !== 'id' && !k.endsWith('$'))
|
|
@@ -732,6 +782,39 @@ function parentMatch(step: any, matchvar: string): string {
|
|
|
732
782
|
}
|
|
733
783
|
|
|
734
784
|
|
|
785
|
+
// A load of a known record fills its route from that record, and from the
|
|
786
|
+
// step's binding where the record holds no scalar for it. A record only the
|
|
787
|
+
// fixture holds replaces the step's binding offline.
|
|
788
|
+
function loadMatch(entity: any, step: any, matchvar: string, srcdatavar: string): string {
|
|
789
|
+
const route = flowLoadRoute(entity, step)
|
|
790
|
+
if (null == route) {
|
|
791
|
+
return parentMatch(step, matchvar)
|
|
792
|
+
}
|
|
793
|
+
if (route.offline) {
|
|
794
|
+
const own = route.args.filter((arg) => null != arg.field)
|
|
795
|
+
return parentMatch(step, matchvar) + (0 === own.length ? '' : ` if !setup.live {
|
|
796
|
+
${own.map((arg) => ` if let v @ (Value::Str(_) | Value::Num(_) | Value::Bool(_)) = getp(&${srcdatavar}, "${arg.field}") {
|
|
797
|
+
setp(&${matchvar}, "${arg.name}", v);
|
|
798
|
+
}
|
|
799
|
+
`).join('')} }
|
|
800
|
+
`)
|
|
801
|
+
}
|
|
802
|
+
return route.args.map((arg) => {
|
|
803
|
+
const get = (key: string) => `getp(&setup.idmap, "${key}")`
|
|
804
|
+
const bound = 1 === arg.idmap.length ? get(arg.idmap[0]) : `match ${get(arg.idmap[0])} {
|
|
805
|
+
v if v.is_nullish() => ${get(arg.idmap[1])},
|
|
806
|
+
v => v,
|
|
807
|
+
}`
|
|
808
|
+
return ` setp(&${matchvar}, "${arg.name}", ${null == arg.field ? bound :
|
|
809
|
+
`match getp(&${srcdatavar}, "${arg.field}") {
|
|
810
|
+
v @ (Value::Str(_) | Value::Num(_) | Value::Bool(_)) => v,
|
|
811
|
+
_ => ${bound},
|
|
812
|
+
}`});
|
|
813
|
+
`
|
|
814
|
+
}).join('')
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
|
|
735
818
|
const GENERATE_OP: Record<string, OpGen> = {
|
|
736
819
|
create: generateCreate,
|
|
737
820
|
list: generateList,
|
|
@@ -10,7 +10,7 @@ use crate::core::context::{Context, CtxSpec};
|
|
|
10
10
|
use crate::core::error::ProjectNameError;
|
|
11
11
|
use crate::core::helpers::{get_bool, getp, setp, to_map};
|
|
12
12
|
use crate::core::sdk::ProjectNameSDK;
|
|
13
|
-
use crate::core::types::{Entity,
|
|
13
|
+
use crate::core::types::{Entity, ProjectNameEntityBase};
|
|
14
14
|
use crate::core::utility_type::Utility;
|
|
15
15
|
use crate::utility::voxgigstruct as vs;
|
|
16
16
|
use crate::utility::voxgigstruct::Value;
|
|
@@ -302,7 +302,7 @@ impl Entity for EntyClass {
|
|
|
302
302
|
}
|
|
303
303
|
}
|
|
304
304
|
|
|
305
|
-
impl
|
|
305
|
+
impl ProjectNameEntityBase for EntyClass {
|
|
306
306
|
// #LoadOp
|
|
307
307
|
|
|
308
308
|
// #ListOp
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, each, Content, canonToType, canonKey, entityIdField,
|
|
2
|
+
import { cmp, each, Content, canonToType, canonKey, entityIdField, opNeedsAction, javaMap, javaMapOf, matchExampleItems, javaMapItems, requestExampleItems } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -138,7 +138,7 @@ val ${eVar}List = client.${accessor}(null).list(${scalaListMatch(entity)}, null)
|
|
|
138
138
|
// Members come from the SAME shape the runtime validates
|
|
139
139
|
// (opRequestShape): every required member must appear — including a
|
|
140
140
|
// required id and parent keys like page_id — with a real literal.
|
|
141
|
-
const createItems = javaMapItems(
|
|
141
|
+
const createItems = javaMapItems(requestExampleItems(entity, 'create'))
|
|
142
142
|
.filter((it: any) => !it.optional)
|
|
143
143
|
const createMap = javaMap(createItems.length, 'java.util.')
|
|
144
144
|
Content(`#### Example: Create
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, Content, isAuthActive, envName, canonKey, entityIdField, pickExampleEntity,
|
|
2
|
+
import { cmp, Content, isAuthActive, envName, canonKey, entityIdField, pickExampleEntity, requiredItems, javaMapOf, matchExampleItems, javaMapItems, requestExampleItems } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -37,7 +37,7 @@ const ReadmeHowto = cmp(function ReadmeHowto(props: any) {
|
|
|
37
37
|
testArg = javaMapOf(chosen.map((it: any) =>
|
|
38
38
|
`${JSON.stringify(it.name)}, ${scalaLit(it.type)}`), 'java.util.')
|
|
39
39
|
} else if (exampleEntity && ('create' === primaryOp || 'update' === primaryOp || 'patch' === primaryOp)) {
|
|
40
|
-
const items = javaMapItems(
|
|
40
|
+
const items = javaMapItems(requestExampleItems(exampleEntity, primaryOp))
|
|
41
41
|
.filter((it: any) => it.name !== idF && it.name !== 'id')
|
|
42
42
|
const required = items.filter((it: any) => !it.optional)
|
|
43
43
|
const chosen = required.length ? required : items.slice(0, 3)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, Content, isAuthActive, envName, canonKey, opRequestShape, entityIdField, entityOps, javaMapOf, matchExampleItems, requiredItems, javaMapItems } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, Content, isAuthActive, envName, canonKey, opRequestShape, entityIdField, entityOps, javaMapOf, matchExampleItems, requiredItems, javaMapItems, requestExampleItems, sendsId } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -157,7 +157,7 @@ catch {
|
|
|
157
157
|
// Model-driven example fields: derive the create/update body from the op
|
|
158
158
|
// shape (opRequestShape) so the docs reference REAL writable fields.
|
|
159
159
|
const examplePairs = (opname: string): string[] => {
|
|
160
|
-
const items = javaMapItems(
|
|
160
|
+
const items = javaMapItems(requestExampleItems(exampleEntity, opname))
|
|
161
161
|
.filter((it: any) => (it.name !== idF && it.name !== 'id') ||
|
|
162
162
|
('create' === opname && !it.optional))
|
|
163
163
|
const required = items.filter((it: any) => !it.optional)
|
|
@@ -186,15 +186,15 @@ val created = client.${accessor}(null).create(${javaMapOf(examplePairs('create')
|
|
|
186
186
|
`)
|
|
187
187
|
}
|
|
188
188
|
if (opnames.includes('update')) {
|
|
189
|
-
const updatePairs = (idF ? [`${JSON.stringify(idF)}, ${scalaLit(idParamType('update'), 'example_id')}`] : [])
|
|
189
|
+
const updatePairs = (sendsId(exampleEntity, 'update', idF) ? [`${JSON.stringify(idF)}, ${scalaLit(idParamType('update'), 'example_id')}`] : [])
|
|
190
190
|
.concat(examplePairs('update'))
|
|
191
|
-
Content(`// Update — supply the id in the match/data
|
|
191
|
+
Content(`// Update${sendsId(exampleEntity, 'update', idF) ? ' — supply the id in the match/data' : ''}
|
|
192
192
|
client.${accessor}(null).update(${javaMapOf(updatePairs, 'java.util.')}, null)
|
|
193
193
|
|
|
194
194
|
`)
|
|
195
195
|
}
|
|
196
196
|
if (opnames.includes('patch')) {
|
|
197
|
-
const patchPairs = (idF ? [`${JSON.stringify(idF)}, ${scalaLit(idParamType('patch'), 'example_id')}`] : [])
|
|
197
|
+
const patchPairs = (sendsId(exampleEntity, 'patch', idF) ? [`${JSON.stringify(idF)}, ${scalaLit(idParamType('patch'), 'example_id')}`] : [])
|
|
198
198
|
.concat(examplePairs('patch'))
|
|
199
199
|
Content(`// Patch — sends only the fields given
|
|
200
200
|
client.${accessor}(null).patch(${javaMapOf(patchPairs, 'java.util.')}, null)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, each, Content, canonToType, canonKey, File, isAuthActive, entityIdField
|
|
2
|
+
import { cmp, each, Content, canonToType, canonKey, File, isAuthActive, entityIdField , targetFeatures, opNeedsAction, bodyNote, javaMap, javaMapOf, matchExampleItems, javaMapItems, requestExampleItems } from '@voxgig/sdkgen'
|
|
3
3
|
import { ReadmeRefFeatures } from '@voxgig/sdkgen'
|
|
4
4
|
|
|
5
5
|
import {
|
|
@@ -279,7 +279,7 @@ results.forEach(item => println(item.data()))
|
|
|
279
279
|
`)
|
|
280
280
|
}
|
|
281
281
|
else if ('create' === opname) {
|
|
282
|
-
const createItems = javaMapItems(
|
|
282
|
+
const createItems = javaMapItems(requestExampleItems(ent, 'create'))
|
|
283
283
|
.filter((it: any) => !it.optional)
|
|
284
284
|
const createMap = javaMap(createItems.length, 'java.util.')
|
|
285
285
|
Content(`\`\`\`scala
|
|
@@ -296,7 +296,7 @@ val result = client.${accessor}(null).create(${createMap.open}
|
|
|
296
296
|
`)
|
|
297
297
|
}
|
|
298
298
|
else if ('update' === opname || 'patch' === opname) {
|
|
299
|
-
const updateItems = javaMapItems(
|
|
299
|
+
const updateItems = javaMapItems(requestExampleItems(ent, opname))
|
|
300
300
|
.filter((it: any) => !it.optional || it.name === idF)
|
|
301
301
|
.sort((a: any, b: any) =>
|
|
302
302
|
(a.name === idF ? 0 : 1) - (b.name === idF ? 0 : 1))
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, Content, isAuthActive, envName, canonKey, entityIdField, opRequestShape, javaMapOf, matchExampleItems, javaMapItems } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, Content, isAuthActive, envName, canonKey, entityIdField, opRequestShape, javaMapOf, matchExampleItems, javaMapItems, entityOps } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -22,7 +22,7 @@ const ReadmeTopQuick = cmp(function ReadmeTopQuick(props: any) {
|
|
|
22
22
|
const authActive = isAuthActive(model)
|
|
23
23
|
|
|
24
24
|
const shown = null != exampleEntity &&
|
|
25
|
-
['list', 'load'].some((op: string) =>
|
|
25
|
+
['list', 'load'].some((op: string) => entityOps(exampleEntity).includes(op))
|
|
26
26
|
|
|
27
27
|
Content(`\`\`\`scala
|
|
28
28
|
import ${scalaPackage(model)}.core.${SDK}
|
|
@@ -46,7 +46,7 @@ val client = new ${SDK}(options)
|
|
|
46
46
|
const eVar = scalaVarName(exampleEntity.name)
|
|
47
47
|
const accessor = scalaVarName(exampleEntity.name)
|
|
48
48
|
const eNameLower = nom(exampleEntity, 'Name').toLowerCase()
|
|
49
|
-
const opnames =
|
|
49
|
+
const opnames = entityOps(exampleEntity)
|
|
50
50
|
const idF = entityIdField(exampleEntity)
|
|
51
51
|
|
|
52
52
|
if (opnames.includes('list')) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, Content, canonKey, entityIdField, pickExampleEntity,
|
|
2
|
+
import { cmp, Content, canonKey, entityIdField, pickExampleEntity, requiredItems, javaMapOf, matchExampleItems, javaMapItems, requestExampleItems } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -39,7 +39,7 @@ val client = ${SDK}.testSDK(null, null)
|
|
|
39
39
|
`${JSON.stringify(it.name)}, ${isMatchOp && it.name === idF ? '"test01"' : scalaLit(it.type)}`), 'java.util.')
|
|
40
40
|
: 'null'
|
|
41
41
|
} else if ('create' === primaryOp || 'update' === primaryOp || 'patch' === primaryOp) {
|
|
42
|
-
const items = javaMapItems(
|
|
42
|
+
const items = javaMapItems(requestExampleItems(exampleEntity, primaryOp))
|
|
43
43
|
.filter((it: any) => it.name !== idF && it.name !== 'id')
|
|
44
44
|
const required = items.filter((it: any) => !it.optional)
|
|
45
45
|
const chosen = required.length ? required : items.slice(0, 3)
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
cmp,
|
|
13
13
|
snakify,
|
|
14
14
|
pointParts,
|
|
15
|
+
pointPlaceholders,
|
|
15
16
|
pointIsGraphql,
|
|
16
17
|
graphqlDirectSkip,
|
|
17
18
|
} from '@voxgig/sdkgen'
|
|
@@ -87,12 +88,7 @@ const TestDirect = cmp(function TestDirect(props: any) {
|
|
|
87
88
|
const allLoadParams = loadPoint?.g?.params || []
|
|
88
89
|
// Only path params that actually appear in the URL template drive the
|
|
89
90
|
// direct-test path-param setup and URL-substitution asserts.
|
|
90
|
-
const _pathPlaceholders = new Set<string>()
|
|
91
|
-
for (const part of pointParts(loadPoint)) {
|
|
92
|
-
if (typeof part === 'string' && part.startsWith('{') && part.endsWith('}')) {
|
|
93
|
-
_pathPlaceholders.add(part.slice(1, -1))
|
|
94
|
-
}
|
|
95
|
-
}
|
|
91
|
+
const _pathPlaceholders = new Set<string>(pointPlaceholders(loadPoint))
|
|
96
92
|
const _renameMap = (loadPoint?.r?.param || {}) as Record<string, string>
|
|
97
93
|
const _renamedPlaceholders = new Set<string>()
|
|
98
94
|
for (const ph of _pathPlaceholders) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { flowSteps, opReachable, invalidRequest } from '@voxgig/sdkgen'
|
|
1
|
+
import { flowSteps, opReachable, invalidRequest, flowLoadRoute, flowLoadReadsRecord } from '@voxgig/sdkgen'
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
KIT,
|
|
@@ -125,9 +125,9 @@ ${failureScopes(SDK, entity, accessor)}
|
|
|
125
125
|
// shipped "existing" fixtures here, mirroring the ts generator. Guarded on a
|
|
126
126
|
// DATA id field — an entity that carries no id has no `.get("id")` to read.
|
|
127
127
|
const flowHasCreate = allSteps.some((s: any) => s.o === 'create')
|
|
128
|
-
const needsPreambleData = !flowHasCreate &&
|
|
129
|
-
|
|
130
|
-
allSteps.some((s: any) =>
|
|
128
|
+
const needsPreambleData = !flowHasCreate && (null != entityDataIdField(entity) ?
|
|
129
|
+
allSteps.some((s: any) => ['load', 'update', 'remove'].includes(s.o)) :
|
|
130
|
+
allSteps.some((s: any) => flowLoadReadsRecord(entity, s)))
|
|
131
131
|
if (needsPreambleData) {
|
|
132
132
|
const preambleData = scalaVarName(entity.name + '_ref01_data')
|
|
133
133
|
Content(` val ${preambleData}Raw = Struct.items(Helpers.toMapAny(
|
|
@@ -354,7 +354,7 @@ const generateLoad: OpGen = (ctx, step, index) => {
|
|
|
354
354
|
Content(` val ${entvar} = client.${accessor}(null)
|
|
355
355
|
`)
|
|
356
356
|
}
|
|
357
|
-
if (!hasSrcData && hasDataId) {
|
|
357
|
+
if (!hasSrcData && (hasDataId || flowLoadReadsRecord(entity, step))) {
|
|
358
358
|
Content(` val ${srcdatavar}Raw = Struct.items(Helpers.toMapAny(
|
|
359
359
|
Struct.getpath(entityData, "existing.${ENTLOWER}")))
|
|
360
360
|
val ${srcdatavar} = Helpers.toMapAny(${srcdatavar}Raw.get(0).get(1))
|
|
@@ -364,13 +364,13 @@ const generateLoad: OpGen = (ctx, step, index) => {
|
|
|
364
364
|
`)
|
|
365
365
|
if (hasDataId) {
|
|
366
366
|
Content(` ${matchvar}.put("id", ${srcdatavar}.get("id"))
|
|
367
|
-
${
|
|
367
|
+
${loadMatch(entity, step, matchvar, srcdatavar)} val ${datavar}Loaded = ${entvar}.load(${matchvar}, null)
|
|
368
368
|
val ${datavar}LoadResult = Helpers.toMapAny(${datavar}Loaded match { case e: SdkEntity => e.data(); case o => o })
|
|
369
369
|
rep.check("${ENTLOWER}.load.map", ${datavar}LoadResult != null, "expected load result to be a map")
|
|
370
370
|
rep.eq("${ENTLOWER}.load.id", ${srcdatavar}.get("id"), ${datavar}LoadResult.get("id"))
|
|
371
371
|
`)
|
|
372
372
|
} else {
|
|
373
|
-
Content(`${
|
|
373
|
+
Content(`${loadMatch(entity, step, matchvar, srcdatavar)} val ${datavar}Loaded = ${entvar}.load(${matchvar}, null)
|
|
374
374
|
rep.check("${ENTLOWER}.load.nonnull", ${datavar}Loaded != null, "expected load result to be non-null")
|
|
375
375
|
`)
|
|
376
376
|
}
|
|
@@ -417,6 +417,35 @@ function parentMatch(step: any, matchvar: string): string {
|
|
|
417
417
|
}
|
|
418
418
|
|
|
419
419
|
|
|
420
|
+
// A load of a known record fills its route from that record, and from the
|
|
421
|
+
// step's binding where the record holds no scalar for it. A record only the
|
|
422
|
+
// fixture holds replaces the step's binding; this suite runs offline only.
|
|
423
|
+
function loadMatch(entity: any, step: any, matchvar: string, srcdatavar: string): string {
|
|
424
|
+
const route = flowLoadRoute(entity, step)
|
|
425
|
+
if (null == route) {
|
|
426
|
+
return parentMatch(step, matchvar)
|
|
427
|
+
}
|
|
428
|
+
if (route.offline) {
|
|
429
|
+
return parentMatch(step, matchvar) + route.args.filter((arg) => null != arg.field)
|
|
430
|
+
.map((arg) => ` ${srcdatavar}.get("${arg.field}") match {
|
|
431
|
+
case v @ (_: String | _: java.lang.Number | _: java.lang.Boolean) => ${matchvar}.put("${arg.name}", v)
|
|
432
|
+
case _ =>
|
|
433
|
+
}
|
|
434
|
+
`).join('')
|
|
435
|
+
}
|
|
436
|
+
return route.args.map((arg) => {
|
|
437
|
+
const get = (key: string) => `idmap.get("${key}")`
|
|
438
|
+
const bound = 1 === arg.idmap.length ? get(arg.idmap[0]) :
|
|
439
|
+
`Option(${get(arg.idmap[0])}).getOrElse(${get(arg.idmap[1])})`
|
|
440
|
+
return ` ${matchvar}.put("${arg.name}", ${null == arg.field ? bound : `${srcdatavar}.get("${arg.field}") match {
|
|
441
|
+
case v @ (_: String | _: java.lang.Number | _: java.lang.Boolean) => v
|
|
442
|
+
case _ => ${bound}
|
|
443
|
+
}`})
|
|
444
|
+
`
|
|
445
|
+
}).join('')
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
|
|
420
449
|
const GENERATE_OP: Record<string, OpGen> = {
|
|
421
450
|
create: generateCreate,
|
|
422
451
|
list: generateList,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, each, Content, canonToType, canonKey, canonScalarKey, entityIdField,
|
|
2
|
+
import { cmp, each, Content, canonToType, canonKey, canonScalarKey, entityIdField, opNeedsAction, matchExampleItems, requestExampleItems } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -151,7 +151,7 @@ let ${eVar}List = try client.${accessor}().list(${swiftListMatch(entity)}, nil)
|
|
|
151
151
|
// Members come from the SAME shape the runtime validates
|
|
152
152
|
// (opRequestShape): every required member must appear — including a
|
|
153
153
|
// required id and parent keys like page_id — with a real literal.
|
|
154
|
-
const createItems =
|
|
154
|
+
const createItems = requestExampleItems(entity, 'create')
|
|
155
155
|
.filter((it: any) => !it.optional)
|
|
156
156
|
Content(`#### Example: Create
|
|
157
157
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, Content, isAuthActive, envName, canonKey, canonScalarKey, entityIdField, pickExampleEntity,
|
|
2
|
+
import { cmp, Content, isAuthActive, envName, canonKey, canonScalarKey, entityIdField, pickExampleEntity, requiredItems, matchExampleItems, requestExampleItems } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -50,7 +50,7 @@ const ReadmeHowto = cmp(function ReadmeHowto(props: any) {
|
|
|
50
50
|
testArg = `VMap([${chosen.map((it: any) =>
|
|
51
51
|
`(${swiftString(it.name)}, ${swiftLit(it.type)})`).join(', ')}])`
|
|
52
52
|
} else if (exampleEntity && ('create' === primaryOp || 'update' === primaryOp || 'patch' === primaryOp)) {
|
|
53
|
-
const items =
|
|
53
|
+
const items = requestExampleItems(exampleEntity, primaryOp)
|
|
54
54
|
.filter((it: any) => it.name !== idF && it.name !== 'id')
|
|
55
55
|
const required = items.filter((it: any) => !it.optional)
|
|
56
56
|
const chosen = required.length ? required : items.slice(0, 3)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, Content, isAuthActive, envName, canonKey, canonScalarKey, opRequestShape, entityIdField, entityOps, matchExampleItems, requiredItems } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, Content, isAuthActive, envName, canonKey, canonScalarKey, opRequestShape, entityIdField, entityOps, matchExampleItems, requiredItems, requestExampleItems, sendsId } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -177,7 +177,7 @@ catch {
|
|
|
177
177
|
// Model-driven example fields: derive the create/update body from the op
|
|
178
178
|
// shape (opRequestShape) so the docs reference REAL writable fields.
|
|
179
179
|
const examplePairs = (opname: string): string[] => {
|
|
180
|
-
const items =
|
|
180
|
+
const items = requestExampleItems(exampleEntity, opname)
|
|
181
181
|
.filter((it: any) => (it.name !== idF && it.name !== 'id') ||
|
|
182
182
|
('create' === opname && !it.optional))
|
|
183
183
|
const required = items.filter((it: any) => !it.optional)
|
|
@@ -206,15 +206,15 @@ let created = try client.${accessor}().create(VMap([${examplePairs('create').joi
|
|
|
206
206
|
`)
|
|
207
207
|
}
|
|
208
208
|
if (opnames.includes('update')) {
|
|
209
|
-
const updatePairs = (idF ? [`(${swiftString(idF)}, ${swiftLit(idParamType('update'), 'example_id')})`] : [])
|
|
209
|
+
const updatePairs = (sendsId(exampleEntity, 'update', idF) ? [`(${swiftString(idF)}, ${swiftLit(idParamType('update'), 'example_id')})`] : [])
|
|
210
210
|
.concat(examplePairs('update'))
|
|
211
|
-
Content(`// Update — supply the id in the match/data
|
|
211
|
+
Content(`// Update${sendsId(exampleEntity, 'update', idF) ? ' — supply the id in the match/data' : ''}
|
|
212
212
|
_ = try client.${accessor}().update(VMap([${updatePairs.join(', ')}]), nil)
|
|
213
213
|
|
|
214
214
|
`)
|
|
215
215
|
}
|
|
216
216
|
if (opnames.includes('patch')) {
|
|
217
|
-
const patchPairs = (idF ? [`(${swiftString(idF)}, ${swiftLit(idParamType('patch'), 'example_id')})`] : [])
|
|
217
|
+
const patchPairs = (sendsId(exampleEntity, 'patch', idF) ? [`(${swiftString(idF)}, ${swiftLit(idParamType('patch'), 'example_id')})`] : [])
|
|
218
218
|
.concat(examplePairs('patch'))
|
|
219
219
|
Content(`// Patch — sends only the fields given
|
|
220
220
|
_ = try client.${accessor}().patch(VMap([${patchPairs.join(', ')}]), nil)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, each, Content, canonToType, canonKey, canonScalarKey, File, isAuthActive, entityIdField
|
|
2
|
+
import { cmp, each, Content, canonToType, canonKey, canonScalarKey, File, isAuthActive, entityIdField , targetFeatures, opNeedsAction, bodyNote, matchExampleItems, requestExampleItems } from '@voxgig/sdkgen'
|
|
3
3
|
import { ReadmeRefFeatures } from '@voxgig/sdkgen'
|
|
4
4
|
|
|
5
5
|
import {
|
|
@@ -295,7 +295,7 @@ for item in results.asList?.items ?? [] {
|
|
|
295
295
|
`)
|
|
296
296
|
}
|
|
297
297
|
else if ('create' === opname) {
|
|
298
|
-
const createItems =
|
|
298
|
+
const createItems = requestExampleItems(ent, 'create')
|
|
299
299
|
.filter((it: any) => !it.optional)
|
|
300
300
|
Content(`\`\`\`swift
|
|
301
301
|
let result = try client.${accessor}().create(VMap([
|
|
@@ -311,7 +311,7 @@ let result = try client.${accessor}().create(VMap([
|
|
|
311
311
|
`)
|
|
312
312
|
}
|
|
313
313
|
else if ('update' === opname || 'patch' === opname) {
|
|
314
|
-
const updateItems =
|
|
314
|
+
const updateItems = requestExampleItems(ent, opname)
|
|
315
315
|
.filter((it: any) => !it.optional || it.name === idF)
|
|
316
316
|
.sort((a: any, b: any) =>
|
|
317
317
|
(a.name === idF ? 0 : 1) - (b.name === idF ? 0 : 1))
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, Content, isAuthActive, envName, canonKey, canonScalarKey, entityIdField, opRequestShape, matchExampleItems } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, Content, isAuthActive, envName, canonKey, canonScalarKey, entityIdField, opRequestShape, matchExampleItems, entityOps } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -60,7 +60,7 @@ let client = ${SDK}(options)
|
|
|
60
60
|
const eName = nom(exampleEntity, 'Name')
|
|
61
61
|
const eVar = swiftVarName(exampleEntity.name)
|
|
62
62
|
const eNameLower = eName.toLowerCase()
|
|
63
|
-
const opnames =
|
|
63
|
+
const opnames = entityOps(exampleEntity)
|
|
64
64
|
// Model-driven id key: null when the entity has no id-like field, in which
|
|
65
65
|
// case the load example takes an empty match.
|
|
66
66
|
const idF = entityIdField(exampleEntity)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, Content, canonKey, canonScalarKey, entityIdField, pickExampleEntity,
|
|
2
|
+
import { cmp, Content, canonKey, canonScalarKey, entityIdField, pickExampleEntity, requiredItems, matchExampleItems, requestExampleItems } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -53,7 +53,7 @@ let client = ${SDK}.testSDK(nil, nil)
|
|
|
53
53
|
`(${swiftString(it.name)}, ${isMatchOp && it.name === idF ? '.string("test01")' : swiftLit(it.type)})`).join(', ')}])`
|
|
54
54
|
: 'nil'
|
|
55
55
|
} else if ('create' === primaryOp || 'update' === primaryOp || 'patch' === primaryOp) {
|
|
56
|
-
const items =
|
|
56
|
+
const items = requestExampleItems(exampleEntity, primaryOp)
|
|
57
57
|
.filter((it: any) => it.name !== idF && it.name !== 'id')
|
|
58
58
|
const required = items.filter((it: any) => !it.optional)
|
|
59
59
|
const chosen = required.length ? required : items.slice(0, 3)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, each, Content, canonToType, entityIdField,
|
|
2
|
+
import { cmp, each, Content, canonToType, entityIdField, safeVarName, exampleVarName, jsKey, opNeedsAction, listMatchArg, matchExampleItems, requestExampleItems } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -133,7 +133,7 @@ const ${eVar}s = await client.${entity.Name}().list(${listMatchArg('ts', entity)
|
|
|
133
133
|
// (every required member appears), with a type-correct example VALUE
|
|
134
134
|
// via exampleValue — a `name: /* type */` comment is not a value and
|
|
135
135
|
// yields invalid TS (TS1109), so the example must carry a real literal.
|
|
136
|
-
const createItems =
|
|
136
|
+
const createItems = requestExampleItems(entity, 'create')
|
|
137
137
|
.filter((it: any) => !it.optional)
|
|
138
138
|
Content(`#### Example: Create
|
|
139
139
|
|