@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
|
@@ -30,6 +30,9 @@ import {
|
|
|
30
30
|
entityDataIdField, envName, envToken,
|
|
31
31
|
invalidRequest,
|
|
32
32
|
liveFlowNeeds, liveStrict, liveStrictNote,
|
|
33
|
+
liveRouteExamples, liveStepExamples, flowLoadRoute, flowLoadReadsRecord,
|
|
34
|
+
liveGetOnly, liveExcludedLines, liveExcludedSummary, LIVE_GETONLY_ENV,
|
|
35
|
+
liveEntity,
|
|
33
36
|
} from '@voxgig/sdkgen'
|
|
34
37
|
|
|
35
38
|
|
|
@@ -55,7 +58,7 @@ const TestEntity = cmp(function TestEntity(props: any) {
|
|
|
55
58
|
const model: Model = ctx$.model
|
|
56
59
|
|
|
57
60
|
const target = props.target
|
|
58
|
-
const entity: ModelEntity = props.entity
|
|
61
|
+
const entity: ModelEntity = liveEntity(ctx$, props.entity)
|
|
59
62
|
const gomodule: string = props.gomodule
|
|
60
63
|
|
|
61
64
|
// The stream test streams the "list" op with no match and asserts a 3-item
|
|
@@ -222,15 +225,19 @@ ${failureTests(model, entity)}` : ''}${validateTest(model, entity)}
|
|
|
222
225
|
return
|
|
223
226
|
}
|
|
224
227
|
}
|
|
225
|
-
|
|
226
|
-
|
|
228
|
+
`)
|
|
229
|
+
|
|
230
|
+
const flowBody = (flow: any) => {
|
|
231
|
+
const steps = flowSteps(flow) as any[]
|
|
232
|
+
Content(liveFlowGate(entity, liveFlowNeeds(entity, flow), strict, strictConst,
|
|
233
|
+
PROJUPPER + '_TEST_' + envToken(entity.name) + '_ENTID', steps.length > 0))
|
|
227
234
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
235
|
+
// Check if the flow has a create step; if not, bootstrap entity data
|
|
236
|
+
const flowHasCreate = steps.some((s: any) => s.o === 'create')
|
|
237
|
+
if (!flowHasCreate) {
|
|
238
|
+
const preambleRef = entity.name + '_ref01'
|
|
239
|
+
const preambleVar = goVar(preambleRef)
|
|
240
|
+
Content(` // Bootstrap entity data from existing test data (no create step in flow).
|
|
234
241
|
${preambleVar}DataRaw := vs.Items(core.ToMapAny(vs.GetPath(setup.data, "existing.${entity.name}")))
|
|
235
242
|
var ${preambleVar}Data map[string]any
|
|
236
243
|
if len(${preambleVar}DataRaw) > 0 {
|
|
@@ -241,24 +248,47 @@ ${liveFlowGate(entity, liveFlowNeeds(entity, basicflow), strict, strictConst,
|
|
|
241
248
|
_ = ${preambleVar}Data
|
|
242
249
|
|
|
243
250
|
`)
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
// Model-driven step iteration
|
|
254
|
+
each(steps, (step: any, index: any) => {
|
|
255
|
+
// Never emit a REMOVE (or its removed-item verify LIST) without a
|
|
256
|
+
// preceding CREATE: a coherent CRUD flow only removes what it created,
|
|
257
|
+
// so a create-less remove would mutate pre-existing (live) data.
|
|
258
|
+
if (!flowHasCreate) {
|
|
259
|
+
if ('remove' === step.o) { return }
|
|
260
|
+
if ('list' === step.o &&
|
|
261
|
+
(step.v || []).some((v: any) => 'ItemNotExists' === v.apply)) { return }
|
|
262
|
+
}
|
|
263
|
+
const opgen: OpGen = GENERATE_OP[step.o]
|
|
264
|
+
if (opgen) {
|
|
265
|
+
opgen({ ...genCtx, flow }, step, index)
|
|
266
|
+
Content('\n')
|
|
267
|
+
}
|
|
268
|
+
})
|
|
244
269
|
}
|
|
245
270
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
271
|
+
const getOnly = liveGetOnly(entity, basicflow)
|
|
272
|
+
if (null != getOnly) {
|
|
273
|
+
Content(` if setup.live && os.Getenv(${JSON.stringify(LIVE_GETONLY_ENV)}) == "TRUE" {
|
|
274
|
+
${liveExcludedLines(getOnly).map((line) => '\t\t\tt.Log(' + JSON.stringify(line) + ')\n').join('')}`)
|
|
275
|
+
if (0 === flowSteps(getOnly.flow).length) {
|
|
276
|
+
Content(` t.Skip(${JSON.stringify(liveExcludedSummary(getOnly))})
|
|
277
|
+
return
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
`)
|
|
255
281
|
}
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
282
|
+
else {
|
|
283
|
+
flowBody(getOnly.flow)
|
|
284
|
+
Content(` return
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
`)
|
|
260
288
|
}
|
|
261
|
-
}
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
flowBody(basicflow)
|
|
262
292
|
|
|
263
293
|
Content(` })
|
|
264
294
|
}
|
|
@@ -396,7 +426,9 @@ function liveFlowGate(entity: any, needs: any, strict: boolean, strictConst: str
|
|
|
396
426
|
}
|
|
397
427
|
if (null != needs.discover) {
|
|
398
428
|
const match = Object.entries(needs.discover)
|
|
399
|
-
.map(([k, v]: any) => `${JSON.stringify(k)}: setup.idmap[${JSON.stringify(v)}]`)
|
|
429
|
+
.map(([k, v]: any) => `${JSON.stringify(k)}: setup.idmap[${JSON.stringify(v)}]`)
|
|
430
|
+
.concat(liveRouteExamples(entity, 'list', Object.keys(needs.discover))
|
|
431
|
+
.map(([k, ex]) => `${JSON.stringify(k)}: ${JSON.stringify(ex)}`)).join(', ')
|
|
400
432
|
out += ` if setup.live {
|
|
401
433
|
liveExisting(t, ${strictConst}, setup.data, ${JSON.stringify(entity.name)}, func() (any, error) {
|
|
402
434
|
return client.${entity.Name}(nil).List(map[string]any{${match}}, nil)
|
|
@@ -511,6 +543,7 @@ const generateList: OpGen = (ctx, step, index) => {
|
|
|
511
543
|
Content(` }
|
|
512
544
|
`)
|
|
513
545
|
}
|
|
546
|
+
liveFill(entity, step, matchvar)
|
|
514
547
|
|
|
515
548
|
// Only declare ${listvar} as a real var when a downstream validator
|
|
516
549
|
// actually uses it; otherwise `_` to satisfy Go's unused-var check.
|
|
@@ -687,7 +720,7 @@ const generateLoad: OpGen = (ctx, step, index) => {
|
|
|
687
720
|
Content(` ${entvar} := client.${entity.Name}(nil)
|
|
688
721
|
`)
|
|
689
722
|
}
|
|
690
|
-
if (!hasSrcData && hasEntId) {
|
|
723
|
+
if (!hasSrcData && (hasEntId || flowLoadReadsRecord(entity, step))) {
|
|
691
724
|
Content(` ${srcdatavar}Raw := vs.Items(core.ToMapAny(vs.GetPath(setup.data, "existing.${entity.name}")))
|
|
692
725
|
var ${srcdatavar} map[string]any
|
|
693
726
|
if len(${srcdatavar}Raw) > 0 {
|
|
@@ -700,7 +733,8 @@ const generateLoad: OpGen = (ctx, step, index) => {
|
|
|
700
733
|
"id": ${srcdatavar}["id"],
|
|
701
734
|
}
|
|
702
735
|
`)
|
|
703
|
-
|
|
736
|
+
loadMatch(entity, step, matchvar, srcdatavar)
|
|
737
|
+
liveFill(entity, step, matchvar)
|
|
704
738
|
Content(` ${datavar}Loaded, err := ${entvar}.Load(${matchvar}, nil)
|
|
705
739
|
if err != nil {
|
|
706
740
|
t.Fatalf("load failed: %v", err)
|
|
@@ -717,7 +751,8 @@ const generateLoad: OpGen = (ctx, step, index) => {
|
|
|
717
751
|
else {
|
|
718
752
|
Content(` ${matchvar} := map[string]any{}
|
|
719
753
|
`)
|
|
720
|
-
|
|
754
|
+
loadMatch(entity, step, matchvar, srcdatavar)
|
|
755
|
+
liveFill(entity, step, matchvar)
|
|
721
756
|
Content(` ${datavar}Loaded, err := ${entvar}.Load(${matchvar}, nil)
|
|
722
757
|
if err != nil {
|
|
723
758
|
t.Fatalf("load failed: %v", err)
|
|
@@ -771,15 +806,63 @@ const generateRemove: OpGen = (ctx, step, index) => {
|
|
|
771
806
|
// A child's route names its parents, and an entity no earlier step has
|
|
772
807
|
// filled knows none of them, so the call itself gives each parent id. A live
|
|
773
808
|
// ENTID may key a parent by its field name, the fixture by its own name.
|
|
809
|
+
// A live step sends each example its route requires and the step leaves unbound.
|
|
810
|
+
function liveFill(entity: any, step: any, matchvar: string) {
|
|
811
|
+
const fills = liveStepExamples(entity, step)
|
|
812
|
+
if (0 < fills.length) {
|
|
813
|
+
Content(` if setup.live {
|
|
814
|
+
${fills.map(([k, ex]) => ` ${matchvar}[${JSON.stringify(k)}] = ${JSON.stringify(ex)}\n`).join('')} }
|
|
815
|
+
`)
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
|
|
774
820
|
function parentMatch(step: any, matchvar: string) {
|
|
775
821
|
const parents = Object.entries(step.m || {})
|
|
776
822
|
.filter(([k]: any) => k !== 'id' && !k.endsWith('$'))
|
|
777
823
|
for (const [key, val] of parents) {
|
|
778
|
-
Content(
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
824
|
+
Content(boundMatch(matchvar, key, [key, val as string], '\t\t'))
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
|
|
829
|
+
function boundMatch(matchvar: string, name: string, keys: string[], indent: string): string {
|
|
830
|
+
return 1 === keys.length ? `${indent}${matchvar}["${name}"] = setup.idmap["${keys[0]}"]
|
|
831
|
+
` : `${indent}if v := setup.idmap["${keys[0]}"]; v != nil {
|
|
832
|
+
${indent} ${matchvar}["${name}"] = v
|
|
833
|
+
${indent}} else {
|
|
834
|
+
${indent} ${matchvar}["${name}"] = setup.idmap["${keys[1]}"]
|
|
835
|
+
${indent}}
|
|
836
|
+
`
|
|
837
|
+
}
|
|
838
|
+
|
|
839
|
+
|
|
840
|
+
// A load of a known record fills its route from that record, and from the
|
|
841
|
+
// step's binding where the record holds no scalar for it. A record only the
|
|
842
|
+
// fixture holds replaces the step's binding offline.
|
|
843
|
+
function loadMatch(entity: any, step: any, matchvar: string, srcdatavar: string) {
|
|
844
|
+
const route = flowLoadRoute(entity, step)
|
|
845
|
+
if (null == route) {
|
|
846
|
+
return parentMatch(step, matchvar)
|
|
847
|
+
}
|
|
848
|
+
if (route.offline) {
|
|
849
|
+
parentMatch(step, matchvar)
|
|
850
|
+
const own = route.args.filter((arg) => null != arg.field)
|
|
851
|
+
return 0 === own.length ? undefined : Content(` if !setup.live {
|
|
852
|
+
${own.map((arg) => ` switch v := ${srcdatavar}["${arg.field}"].(type) {
|
|
853
|
+
case string, bool, float64, int, int64:
|
|
854
|
+
${matchvar}["${arg.name}"] = v
|
|
855
|
+
}
|
|
856
|
+
`).join('')} }
|
|
857
|
+
`)
|
|
858
|
+
}
|
|
859
|
+
for (const arg of route.args) {
|
|
860
|
+
Content(null == arg.field ? boundMatch(matchvar, arg.name, arg.idmap, '\t\t') :
|
|
861
|
+
` switch v := ${srcdatavar}["${arg.field}"].(type) {
|
|
862
|
+
case string, bool, float64, int, int64:
|
|
863
|
+
${matchvar}["${arg.name}"] = v
|
|
864
|
+
default:
|
|
865
|
+
${boundMatch(matchvar, arg.name, arg.idmap, '\t\t\t')} }
|
|
783
866
|
`)
|
|
784
867
|
}
|
|
785
868
|
}
|
|
@@ -75,7 +75,7 @@ func runOp(client *sdk.ProjectNameSDK, op string, query *eng.Value, entityAtom e
|
|
|
75
75
|
|
|
76
76
|
// entityFor dispatches on the lowercase entity name. The generator
|
|
77
77
|
// emits one `case "<name>":` per entity defined in the SDK model.
|
|
78
|
-
func entityFor(client *sdk.ProjectNameSDK, name string) (sdk.
|
|
78
|
+
func entityFor(client *sdk.ProjectNameSDK, name string) (sdk.ProjectNameEntityBase, error) {
|
|
79
79
|
switch strings.ToLower(name) {
|
|
80
80
|
// <[SLOT:entityCases]>
|
|
81
81
|
}
|
|
@@ -76,7 +76,7 @@ func runOp(_ context.Context, client *sdk.ProjectNameSDK, op string, entity stri
|
|
|
76
76
|
|
|
77
77
|
// entityFor dispatches on the lowercase entity name. The generator
|
|
78
78
|
// emits one `case "<name>":` per entity defined in the SDK model.
|
|
79
|
-
func entityFor(client *sdk.ProjectNameSDK, name string) (sdk.
|
|
79
|
+
func entityFor(client *sdk.ProjectNameSDK, name string) (sdk.ProjectNameEntityBase, error) {
|
|
80
80
|
switch strings.ToLower(name) {
|
|
81
81
|
// <[SLOT:entityCases]>
|
|
82
82
|
}
|
|
@@ -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 @@ Object ${eVar}List = client.${accessor}(null).list(${javaListMatch(entity)}, nul
|
|
|
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)
|
|
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)}, ${javaLit(it.type)}`))
|
|
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 , serverVariables, javaMapOf, matchExampleItems, requiredItems, javaMapItems } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, Content, isAuthActive, envName, canonKey, opRequestShape, entityIdField, entityOps , serverVariables, javaMapOf, matchExampleItems, requiredItems, javaMapItems, requestExampleItems, sendsId } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -174,7 +174,7 @@ catch (RuntimeException err) {
|
|
|
174
174
|
// Model-driven example fields: derive the create/update body from the op
|
|
175
175
|
// shape (opRequestShape) so the docs reference REAL writable fields.
|
|
176
176
|
const examplePairs = (opname: string): string[] => {
|
|
177
|
-
const items = javaMapItems(
|
|
177
|
+
const items = javaMapItems(requestExampleItems(exampleEntity, opname))
|
|
178
178
|
.filter((it: any) => (it.name !== idF && it.name !== 'id') ||
|
|
179
179
|
('create' === opname && !it.optional))
|
|
180
180
|
const required = items.filter((it: any) => !it.optional)
|
|
@@ -203,15 +203,15 @@ Object created = client.${accessor}(null).create(${javaMapOf(examplePairs('creat
|
|
|
203
203
|
`)
|
|
204
204
|
}
|
|
205
205
|
if (opnames.includes('update')) {
|
|
206
|
-
const updatePairs = (idF ? [`${JSON.stringify(idF)}, ${javaLit(idParamType('update'), 'example_id')}`] : [])
|
|
206
|
+
const updatePairs = (sendsId(exampleEntity, 'update', idF) ? [`${JSON.stringify(idF)}, ${javaLit(idParamType('update'), 'example_id')}`] : [])
|
|
207
207
|
.concat(examplePairs('update'))
|
|
208
|
-
Content(`// Update — supply the id in the match/data
|
|
208
|
+
Content(`// Update${sendsId(exampleEntity, 'update', idF) ? ' — supply the id in the match/data' : ''}
|
|
209
209
|
client.${accessor}(null).update(${javaMapOf(updatePairs)}, null);
|
|
210
210
|
|
|
211
211
|
`)
|
|
212
212
|
}
|
|
213
213
|
if (opnames.includes('patch')) {
|
|
214
|
-
const patchPairs = (idF ? [`${JSON.stringify(idF)}, ${javaLit(idParamType('patch'), 'example_id')}`] : [])
|
|
214
|
+
const patchPairs = (sendsId(exampleEntity, 'patch', idF) ? [`${JSON.stringify(idF)}, ${javaLit(idParamType('patch'), 'example_id')}`] : [])
|
|
215
215
|
.concat(examplePairs('patch'))
|
|
216
216
|
Content(`// Patch — sends only the fields given
|
|
217
217
|
client.${accessor}(null).patch(${javaMapOf(patchPairs)}, 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 {
|
|
@@ -281,7 +281,7 @@ for (Object item : results) {
|
|
|
281
281
|
`)
|
|
282
282
|
}
|
|
283
283
|
else if ('create' === opname) {
|
|
284
|
-
const createItems = javaMapItems(
|
|
284
|
+
const createItems = javaMapItems(requestExampleItems(ent, 'create'))
|
|
285
285
|
.filter((it: any) => !it.optional)
|
|
286
286
|
const createMap = javaMap(createItems.length)
|
|
287
287
|
Content(`\`\`\`java
|
|
@@ -298,7 +298,7 @@ Object result = client.${accessor}(null).create(${createMap.open}
|
|
|
298
298
|
`)
|
|
299
299
|
}
|
|
300
300
|
else if ('update' === opname || 'patch' === opname) {
|
|
301
|
-
const updateItems = javaMapItems(
|
|
301
|
+
const updateItems = javaMapItems(requestExampleItems(ent, opname))
|
|
302
302
|
.filter((it: any) => !it.optional || it.name === idF)
|
|
303
303
|
.sort((a: any, b: any) =>
|
|
304
304
|
(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 , serverVariables, javaMapOf, matchExampleItems, javaMapItems } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, Content, isAuthActive, envName, canonKey, entityIdField, opRequestShape , serverVariables, javaMapOf, matchExampleItems, javaMapItems, entityOps } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -34,7 +34,7 @@ const ReadmeTopQuick = cmp(function ReadmeTopQuick(props: any) {
|
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
const shown = null == exampleEntity ? [] :
|
|
37
|
-
['list', 'load'].filter((op: string) =>
|
|
37
|
+
['list', 'load'].filter((op: string) => entityOps(exampleEntity).includes(op))
|
|
38
38
|
const imports = [
|
|
39
39
|
...(shown.includes('list') ? ['java.util.List'] : []),
|
|
40
40
|
...(authActive || '' !== javaServerLines || shown.includes('load') ? ['java.util.Map'] : []),
|
|
@@ -66,7 +66,7 @@ ${javaServerLines}${SDK} client = new ${SDK}(options);
|
|
|
66
66
|
const eVar = javaVarName(exampleEntity.name)
|
|
67
67
|
const accessor = javaVarName(exampleEntity.name)
|
|
68
68
|
const eNameLower = nom(exampleEntity, 'Name').toLowerCase()
|
|
69
|
-
const opnames =
|
|
69
|
+
const opnames = entityOps(exampleEntity)
|
|
70
70
|
const idF = entityIdField(exampleEntity)
|
|
71
71
|
|
|
72
72
|
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 @@ ${SDK} client = ${SDK}.testSDK(null, null);
|
|
|
39
39
|
`${JSON.stringify(it.name)}, ${isMatchOp && it.name === idF ? '"test01"' : javaLit(it.type)}`))
|
|
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)
|
|
@@ -15,10 +15,15 @@ import {
|
|
|
15
15
|
serverVarEnv,
|
|
16
16
|
serverVariables, envName, envToken,
|
|
17
17
|
pointParts,
|
|
18
|
+
pointPlaceholders,
|
|
18
19
|
liveStrict,
|
|
19
20
|
liveStrictNote,
|
|
20
21
|
pointIsGraphql,
|
|
21
22
|
graphqlDirectSkip,
|
|
23
|
+
liveExampleIds,
|
|
24
|
+
liveQueryExamples,
|
|
25
|
+
liveEntity,
|
|
26
|
+
liveDirectGetOnly, liveExcludedLines, liveExcludedSummary, LIVE_GETONLY_ENV,
|
|
22
27
|
} from '@voxgig/sdkgen'
|
|
23
28
|
|
|
24
29
|
|
|
@@ -74,12 +79,24 @@ function javaLiteral(v: any): string {
|
|
|
74
79
|
}
|
|
75
80
|
|
|
76
81
|
|
|
82
|
+
// A GET-only live run excludes a test needing an id that only a write gives.
|
|
83
|
+
function getOnlyKeysBlock(model: any, entity: any, test: string, keys: string[]): string {
|
|
84
|
+
return liveDirectGetOnly(model, entity, test, keys).map((miss) =>
|
|
85
|
+
` if (setup.live && "TRUE".equals(System.getenv(${javaLiteral(LIVE_GETONLY_ENV)}))
|
|
86
|
+
&& setup.idmap.get(${javaLiteral(miss.key)}) == null) {
|
|
87
|
+
System.out.println(${javaLiteral(liveExcludedLines({ excluded: [miss] })[0])});
|
|
88
|
+
Assumptions.abort(${javaLiteral(liveExcludedSummary({ excluded: [miss] }))});
|
|
89
|
+
}
|
|
90
|
+
`).join('')
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
|
|
77
94
|
const TestDirect = cmp(function TestDirect(props: any) {
|
|
78
95
|
const ctx$ = props.ctx$
|
|
79
96
|
const model: Model = ctx$.model
|
|
80
97
|
|
|
81
98
|
const target = props.target
|
|
82
|
-
const entity: ModelEntity = props.entity
|
|
99
|
+
const entity: ModelEntity = liveEntity(ctx$, props.entity)
|
|
83
100
|
const javapackage: string = props.javapackage
|
|
84
101
|
|
|
85
102
|
const PROJECTNAME = envName(model)
|
|
@@ -118,12 +135,7 @@ const TestDirect = cmp(function TestDirect(props: any) {
|
|
|
118
135
|
const allLoadParams = loadPoint?.g?.params || []
|
|
119
136
|
// Only path params that actually appear in the URL template drive
|
|
120
137
|
// direct-test path-param setup and URL-substitution asserts.
|
|
121
|
-
const _pathPlaceholders = new Set<string>()
|
|
122
|
-
for (const part of pointParts(loadPoint)) {
|
|
123
|
-
if (typeof part === 'string' && part.startsWith('{') && part.endsWith('}')) {
|
|
124
|
-
_pathPlaceholders.add(part.slice(1, -1))
|
|
125
|
-
}
|
|
126
|
-
}
|
|
138
|
+
const _pathPlaceholders = new Set<string>(pointPlaceholders(loadPoint))
|
|
127
139
|
const _renameMap = (loadPoint?.r?.param || {}) as Record<string, string>
|
|
128
140
|
const _renamedPlaceholders = new Set<string>()
|
|
129
141
|
for (const ph of _pathPlaceholders) {
|
|
@@ -141,11 +153,8 @@ const TestDirect = cmp(function TestDirect(props: any) {
|
|
|
141
153
|
const listParams = listPoint?.g?.params || []
|
|
142
154
|
|
|
143
155
|
// Required query params with spec-provided examples — needed in live mode.
|
|
144
|
-
const
|
|
145
|
-
|
|
146
|
-
.filter((q: any) => q.r && undefined !== q.ex && null !== q.ex)
|
|
147
|
-
const loadLiveQueryLines = loadLiveQueryEntries
|
|
148
|
-
.map((q: any) => ` query.put("${q.n}", ${javaLiteral(q.ex)});`)
|
|
156
|
+
const loadLiveQueryLines = liveQueryExamples(loadPoint)
|
|
157
|
+
.map(([name, ex]) => ` query.put("${name}", ${javaLiteral(ex)});`)
|
|
149
158
|
.join('\n')
|
|
150
159
|
|
|
151
160
|
// Path params with spec-provided examples — when ALL load params have
|
|
@@ -160,6 +169,10 @@ const TestDirect = cmp(function TestDirect(props: any) {
|
|
|
160
169
|
// Build the ENTID env var name for this entity
|
|
161
170
|
const entidEnvVar = `${PROJECTNAME}_TEST_${envToken(entity.name)}_ENTID`
|
|
162
171
|
|
|
172
|
+
const exampleIds = liveExampleIds(entity)
|
|
173
|
+
const listLiveQueryLines = liveQueryExamples(listPoint)
|
|
174
|
+
.map(([name, ex]) => ` query.put("${name}", ${javaLiteral(ex)});\n`).join('')
|
|
175
|
+
|
|
163
176
|
File({ name: entity.Name + 'DirectTest.' + target.ext }, () => {
|
|
164
177
|
|
|
165
178
|
Content(`package ${javapackage}.sdktest;
|
|
@@ -225,7 +238,8 @@ ${liveStrictNote(liveStrict(model, target.name), '//', ' ')}
|
|
|
225
238
|
const listLiveIdKeys = listParams.length > 0
|
|
226
239
|
? listLiveParams.map((lp: any) => lp.key)
|
|
227
240
|
: []
|
|
228
|
-
const listSkipBlock =
|
|
241
|
+
const listSkipBlock = getOnlyKeysBlock(model, entity, 'direct-list-' + entity.name, listLiveIdKeys) +
|
|
242
|
+
(listLiveIdKeys.length > 0
|
|
229
243
|
? ` if (setup.live) {
|
|
230
244
|
for (String liveKey : new String[] { ${listLiveIdKeys.map((k: string) => `"${k}"`).join(', ')} }) {
|
|
231
245
|
if (setup.idmap.get(liveKey) == null) {
|
|
@@ -234,7 +248,7 @@ ${liveStrictNote(liveStrict(model, target.name), '//', ' ')}
|
|
|
234
248
|
}
|
|
235
249
|
}
|
|
236
250
|
`
|
|
237
|
-
: ''
|
|
251
|
+
: '')
|
|
238
252
|
|
|
239
253
|
Content(` @Test
|
|
240
254
|
public void directList${entity.Name}() {
|
|
@@ -251,9 +265,10 @@ ${listSkipBlock} ${SDK} client = setup.client;
|
|
|
251
265
|
|
|
252
266
|
`)
|
|
253
267
|
|
|
254
|
-
if (listParams.length > 0) {
|
|
268
|
+
if (listParams.length > 0 || '' !== listLiveQueryLines) {
|
|
255
269
|
Content(` Map<String, Object> params = new LinkedHashMap<>();
|
|
256
|
-
|
|
270
|
+
Map<String, Object> query = new LinkedHashMap<>();
|
|
271
|
+
${listLiveQueryLines ? ' if (setup.live) {\n' + listLiveQueryLines + ' }\n' : ''}`)
|
|
257
272
|
listLiveParams.forEach((lp: any, i: number) => {
|
|
258
273
|
const placeholder = 'direct0' + (i + 1)
|
|
259
274
|
Content(` if (setup.live) {
|
|
@@ -268,7 +283,8 @@ ${listSkipBlock} ${SDK} client = setup.client;
|
|
|
268
283
|
Map<String, Object> result = client.direct(jm(
|
|
269
284
|
"path", "${listPath}",
|
|
270
285
|
"method", "GET",
|
|
271
|
-
"params", params
|
|
286
|
+
"params", params,
|
|
287
|
+
"query", query));
|
|
272
288
|
`)
|
|
273
289
|
} else {
|
|
274
290
|
Content(`
|
|
@@ -340,7 +356,8 @@ ${listSkipBlock} ${SDK} client = setup.client;
|
|
|
340
356
|
loadLiveIdKeys = [...new Set((hasList ?
|
|
341
357
|
[...listParams, ...loadParams.filter((p: any) => p.n !== 'id')] : loadParams).map(liveKey))]
|
|
342
358
|
}
|
|
343
|
-
const loadSkipBlock =
|
|
359
|
+
const loadSkipBlock = getOnlyKeysBlock(model, entity, 'direct-load-' + entity.name, loadLiveIdKeys) +
|
|
360
|
+
(loadLiveIdKeys.length > 0
|
|
344
361
|
? ` if (setup.live) {
|
|
345
362
|
for (String liveKey : new String[] { ${loadLiveIdKeys.map(k => `"${k}"`).join(', ')} }) {
|
|
346
363
|
if (setup.idmap.get(liveKey) == null) {
|
|
@@ -349,7 +366,7 @@ ${listSkipBlock} ${SDK} client = setup.client;
|
|
|
349
366
|
}
|
|
350
367
|
}
|
|
351
368
|
`
|
|
352
|
-
: ''
|
|
369
|
+
: '')
|
|
353
370
|
|
|
354
371
|
Content(` @Test
|
|
355
372
|
public void directLoad${entity.Name}() {
|
|
@@ -533,7 +550,10 @@ ${authActive ? ` mergedOpts.put("apikey", env.get("${PROJECTNAME}_APIKEY"))
|
|
|
533
550
|
else if (entidRaw instanceof Map) {
|
|
534
551
|
idmap = (Map<String, Object>) entidRaw;
|
|
535
552
|
}
|
|
536
|
-
|
|
553
|
+
${0 === exampleIds.length ? '' : ` // A path parameter's example stands in for an id *_ENTID does not give.
|
|
554
|
+
idmap = new LinkedHashMap<>(idmap);
|
|
555
|
+
${exampleIds.map(([key, ex]) => ` idmap.putIfAbsent("${key}", ${javaLiteral(ex)});
|
|
556
|
+
`).join('')}`} setup.idmap = idmap;
|
|
537
557
|
return setup;
|
|
538
558
|
}
|
|
539
559
|
|