@voxgig/sdkgen 4.35.2 → 4.36.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/flowGuard.js +12 -1
- package/dist/helpers/flowGuard.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 +4 -3
- package/project/.sdk/src/cmp/go/Main_go.ts +2 -2
- 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/ReadmeQuick_go.ts +4 -4
- package/project/.sdk/src/cmp/go/ReadmeRef_go.ts +3 -3
- 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/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/ReadmeEntity_rust.ts +2 -2
- package/project/.sdk/src/cmp/rust/ReadmeHowto_rust.ts +2 -2
- package/project/.sdk/src/cmp/rust/ReadmeQuick_rust.ts +4 -4
- package/project/.sdk/src/cmp/rust/ReadmeRef_rust.ts +3 -3
- package/project/.sdk/src/cmp/rust/ReadmeTopQuick_rust.ts +2 -2
- package/project/.sdk/src/cmp/rust/ReadmeTopTest_rust.ts +2 -2
- package/project/.sdk/src/cmp/rust/TestDirect_rust.ts +40 -12
- package/project/.sdk/src/cmp/rust/TestEntity_rust.ts +108 -25
- 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/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/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/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/flowGuard.ts +12 -1
- 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
|
serverVariables,
|
|
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
|
import { formatRubyValue } from './utility_rb'
|
|
@@ -58,7 +61,9 @@ function liveFlowGate(entity: any, needs: any, entidEnv: string): string {
|
|
|
58
61
|
out += ' client = setup[:client]\n'
|
|
59
62
|
if (null != needs.discover) {
|
|
60
63
|
const match = Object.entries(needs.discover)
|
|
61
|
-
.map(([k, v]: any) => `${JSON.stringify(k)} => setup[:idmap][${JSON.stringify(v)}]`)
|
|
64
|
+
.map(([k, v]: any) => `${JSON.stringify(k)} => setup[:idmap][${JSON.stringify(v)}]`)
|
|
65
|
+
.concat(liveRouteExamples(entity, 'list', Object.keys(needs.discover))
|
|
66
|
+
.map(([k, ex]) => `${JSON.stringify(k)} => ${formatRubyValue(ex)}`)).join(', ')
|
|
62
67
|
out += ` if setup[:live]
|
|
63
68
|
Runner.live_existing(setup, LIVE_STRICT, ${JSON.stringify(entity.name)}) do
|
|
64
69
|
client.${entity.Name}(nil).list({${match}}, nil)
|
|
@@ -86,7 +91,7 @@ const TestEntity = cmp(function TestEntity(props: any) {
|
|
|
86
91
|
const model: Model = ctx$.model
|
|
87
92
|
|
|
88
93
|
const target = props.target
|
|
89
|
-
const entity: ModelEntity = props.entity
|
|
94
|
+
const entity: ModelEntity = liveEntity(ctx$, props.entity)
|
|
90
95
|
|
|
91
96
|
// The stream test streams the "list" op with no match and asserts a 3-item
|
|
92
97
|
// collection, so it only applies to an entity whose list a bare call can
|
|
@@ -136,7 +141,6 @@ const TestEntity = cmp(function TestEntity(props: any) {
|
|
|
136
141
|
const genCtx: GenCtx = { model, entity, flow: basicflow, PROJUPPER }
|
|
137
142
|
|
|
138
143
|
const strict = liveStrict(model, target.name)
|
|
139
|
-
const needs = liveFlowNeeds(entity, basicflow)
|
|
140
144
|
const entidEnv = PROJUPPER + '_TEST_' + envToken(entity.name) + '_ENTID'
|
|
141
145
|
|
|
142
146
|
File({ name: entity.name + '_entity_test.' + target.ext }, () => {
|
|
@@ -223,13 +227,16 @@ ${failureTests(model, entity)}${validateListTest(model, entity)}` : ''}${validat
|
|
|
223
227
|
return
|
|
224
228
|
end
|
|
225
229
|
end
|
|
226
|
-
${liveFlowGate(entity, needs, entidEnv)}
|
|
227
230
|
`)
|
|
228
231
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
232
|
+
const flowBody = (flow: any) => {
|
|
233
|
+
const steps = flowSteps(flow) as any[]
|
|
234
|
+
Content(liveFlowGate(entity, liveFlowNeeds(entity, flow), entidEnv) + '\n')
|
|
235
|
+
|
|
236
|
+
// Check if the flow has a create step
|
|
237
|
+
const flowHasCreate = steps.some((s: any) => s.o === 'create')
|
|
238
|
+
if (!flowHasCreate) {
|
|
239
|
+
Content(` # Bootstrap entity data from existing test data.
|
|
233
240
|
${entity.name}_ref01_data_raw = Vs.items(Helpers.to_map(
|
|
234
241
|
Vs.getpath(setup[:data], "existing.${entity.name}")))
|
|
235
242
|
${entity.name}_ref01_data = nil
|
|
@@ -238,24 +245,46 @@ ${liveFlowGate(entity, needs, entidEnv)}
|
|
|
238
245
|
end
|
|
239
246
|
|
|
240
247
|
`)
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
// Model-driven step iteration
|
|
251
|
+
each(steps, (step: any, index: any) => {
|
|
252
|
+
// Never emit a REMOVE (or its removed-item verify LIST) without a
|
|
253
|
+
// preceding CREATE: a coherent CRUD flow only removes what it created,
|
|
254
|
+
// so a create-less remove would mutate pre-existing (live) data.
|
|
255
|
+
if (!flowHasCreate) {
|
|
256
|
+
if ('remove' === step.o) { return }
|
|
257
|
+
if ('list' === step.o &&
|
|
258
|
+
(step.v || []).some((v: any) => 'ItemNotExists' === v.apply)) { return }
|
|
259
|
+
}
|
|
260
|
+
const opgen: OpGen = GENERATE_OP[step.o]
|
|
261
|
+
if (opgen) {
|
|
262
|
+
opgen({ ...genCtx, flow }, step, index)
|
|
263
|
+
Content('\n')
|
|
264
|
+
}
|
|
265
|
+
})
|
|
241
266
|
}
|
|
242
267
|
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
268
|
+
const getOnly = liveGetOnly(entity, basicflow)
|
|
269
|
+
if (null != getOnly) {
|
|
270
|
+
Content(` if setup[:live] && ENV[${formatRubyValue(LIVE_GETONLY_ENV)}] == "TRUE"
|
|
271
|
+
${liveExcludedLines(getOnly).map((line) => ' puts ' + formatRubyValue(line) + '\n').join('')}`)
|
|
272
|
+
if (0 === flowSteps(getOnly.flow).length) {
|
|
273
|
+
Content(` skip(${formatRubyValue(liveExcludedSummary(getOnly))})
|
|
274
|
+
end
|
|
275
|
+
|
|
276
|
+
`)
|
|
252
277
|
}
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
278
|
+
else {
|
|
279
|
+
flowBody(getOnly.flow)
|
|
280
|
+
Content(` return
|
|
281
|
+
end
|
|
282
|
+
|
|
283
|
+
`)
|
|
257
284
|
}
|
|
258
|
-
}
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
flowBody(basicflow)
|
|
259
288
|
|
|
260
289
|
Content(`${strict ? '' : ` rescue Minitest::Skip
|
|
261
290
|
raise
|
|
@@ -438,6 +467,7 @@ const generateList: OpGen = (ctx, step, index) => {
|
|
|
438
467
|
Content(` }
|
|
439
468
|
`)
|
|
440
469
|
}
|
|
470
|
+
Content(liveFill(entity, step, matchvar))
|
|
441
471
|
|
|
442
472
|
Content(`
|
|
443
473
|
${listvar}_result = ${entvar}.list(${matchvar}, nil)
|
|
@@ -580,7 +610,7 @@ const generateLoad: OpGen = (ctx, step, index) => {
|
|
|
580
610
|
Content(` ${entvar} = client.${entity.Name}(nil)
|
|
581
611
|
`)
|
|
582
612
|
}
|
|
583
|
-
if (!hasSrcData && hasEntId) {
|
|
613
|
+
if (!hasSrcData && (hasEntId || flowLoadReadsRecord(entity, step))) {
|
|
584
614
|
Content(` ${srcdatavar}_raw = Vs.items(Helpers.to_map(
|
|
585
615
|
Vs.getpath(setup[:data], "existing.${entity.name}")))
|
|
586
616
|
${srcdatavar} = nil
|
|
@@ -593,7 +623,7 @@ const generateLoad: OpGen = (ctx, step, index) => {
|
|
|
593
623
|
Content(` ${matchvar} = {
|
|
594
624
|
"id" => ${srcdatavar}["id"],
|
|
595
625
|
}
|
|
596
|
-
${
|
|
626
|
+
${loadMatch(entity, step, matchvar, srcdatavar)}${liveFill(entity, step, matchvar)} ${datavar}_loaded = ${entvar}.load(${matchvar}, nil)
|
|
597
627
|
${datavar}_load_result = Helpers.to_map(${datavar}_loaded.respond_to?(:data_get) ? ${datavar}_loaded.data_get : ${datavar}_loaded)
|
|
598
628
|
assert !${datavar}_load_result.nil?
|
|
599
629
|
assert_equal ${datavar}_load_result["id"], ${srcdatavar}["id"]
|
|
@@ -601,7 +631,7 @@ ${parentMatch(step, matchvar)} ${datavar}_loaded = ${entvar}.load(${matchvar}
|
|
|
601
631
|
}
|
|
602
632
|
else {
|
|
603
633
|
Content(` ${matchvar} = {}
|
|
604
|
-
${
|
|
634
|
+
${loadMatch(entity, step, matchvar, srcdatavar)}${liveFill(entity, step, matchvar)} ${datavar}_loaded = ${entvar}.load(${matchvar}, nil)
|
|
605
635
|
assert !${datavar}_loaded.nil?
|
|
606
636
|
`)
|
|
607
637
|
}
|
|
@@ -641,6 +671,15 @@ ${parentMatch(step, matchvar)} ${entvar}.remove(${matchvar}, nil)
|
|
|
641
671
|
// A child's route names its parents, and an entity no earlier step has
|
|
642
672
|
// filled knows none of them, so the call itself gives each parent id. A live
|
|
643
673
|
// ENTID may key a parent by its field name, the fixture by its own name.
|
|
674
|
+
// A live step sends each example its route requires and the step leaves unbound.
|
|
675
|
+
function liveFill(entity: any, step: any, matchvar: string): string {
|
|
676
|
+
const fills = liveStepExamples(entity, step)
|
|
677
|
+
return 0 === fills.length ? '' : ` if setup[:live]
|
|
678
|
+
${fills.map(([k, ex]) => ` ${matchvar}[${JSON.stringify(k)}] = ${formatRubyValue(ex)}\n`).join('')} end
|
|
679
|
+
`
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
|
|
644
683
|
function parentMatch(step: any, matchvar: string): string {
|
|
645
684
|
return Object.entries(step.m || {})
|
|
646
685
|
.filter(([k]: any) => k !== 'id' && !k.endsWith('$'))
|
|
@@ -648,6 +687,32 @@ function parentMatch(step: any, matchvar: string): string {
|
|
|
648
687
|
`).join('')
|
|
649
688
|
}
|
|
650
689
|
|
|
690
|
+
// A load of a known record fills its route from that record, and from the
|
|
691
|
+
// step's binding where the record holds no scalar for it. A record only the
|
|
692
|
+
// fixture holds replaces the step's binding offline.
|
|
693
|
+
function loadMatch(entity: any, step: any, matchvar: string, srcdatavar: string): string {
|
|
694
|
+
const route = flowLoadRoute(entity, step)
|
|
695
|
+
if (null == route) {
|
|
696
|
+
return parentMatch(step, matchvar)
|
|
697
|
+
}
|
|
698
|
+
if (route.offline) {
|
|
699
|
+
const own = route.args.filter((arg) => null != arg.field)
|
|
700
|
+
return parentMatch(step, matchvar) + (0 === own.length ? '' : ` unless setup[:live]
|
|
701
|
+
${own.map((arg) => ` own = ${srcdatavar}["${arg.field}"]
|
|
702
|
+
${matchvar}["${arg.name}"] = own if [String, Numeric, TrueClass, FalseClass].any? { |c| own.is_a?(c) }
|
|
703
|
+
`).join('')} end
|
|
704
|
+
`)
|
|
705
|
+
}
|
|
706
|
+
return route.args.map((arg) => {
|
|
707
|
+
const bound = arg.idmap.map((key) => `setup[:idmap]["${key}"]`).join(' || ')
|
|
708
|
+
const own = `${srcdatavar}["${arg.field}"]`
|
|
709
|
+
return ` ${matchvar}["${arg.name}"] = ${null == arg.field ? bound :
|
|
710
|
+
`[String, Numeric, TrueClass, FalseClass].any? { |c| ${own}.is_a?(c) } ? ${own} : (${bound})`}
|
|
711
|
+
`
|
|
712
|
+
}).join('')
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
|
|
651
716
|
const GENERATE_OP: Record<string, OpGen> = {
|
|
652
717
|
create: generateCreate,
|
|
653
718
|
list: generateList,
|
|
@@ -185,9 +185,9 @@ class ProjectNameSDK
|
|
|
185
185
|
{
|
|
186
186
|
"ok" => false,
|
|
187
187
|
"err" => ProjectNameError.new(
|
|
188
|
-
"#{op}_allow",
|
|
189
188
|
"ProjectNameSDK: #{op}: operation not allowed by" \
|
|
190
|
-
" SDK option allow.op value: \"#{allow_op}\""
|
|
189
|
+
" SDK option allow.op value: \"#{allow_op}\"",
|
|
190
|
+
code: "#{op}_allow"),
|
|
191
191
|
}
|
|
192
192
|
end
|
|
193
193
|
|
|
@@ -306,7 +306,7 @@ class ProjectNameSDK
|
|
|
306
306
|
msg = "graphql error" if msg.nil? || msg.to_s.empty?
|
|
307
307
|
res["ok"] = false
|
|
308
308
|
res["err"] = ProjectNameError.new(
|
|
309
|
-
"
|
|
309
|
+
"ProjectNameSDK: graphql: #{msg}", code: "graphql_error")
|
|
310
310
|
res["graphql"] = errors
|
|
311
311
|
end
|
|
312
312
|
|
|
@@ -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,
|
|
@@ -145,7 +145,7 @@ for ${eVar} in &${eVar}s {
|
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
if (callable.includes('create')) {
|
|
148
|
-
const createItems =
|
|
148
|
+
const createItems = requestExampleItems(entity, 'create')
|
|
149
149
|
.filter((it: any) => !it.optional)
|
|
150
150
|
Content(`#### Example: Create
|
|
151
151
|
|
|
@@ -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,
|
|
@@ -46,7 +46,7 @@ const ReadmeHowto = cmp(function ReadmeHowto(props: any) {
|
|
|
46
46
|
const chosen = requiredItems(exampleEntity, 'list')
|
|
47
47
|
testArg = `jo(vec![${chosen.map((it: any) => `(${JSON.stringify(it.name)}, ${rustLit(it.type)})`).join(', ')}])`
|
|
48
48
|
} else if (exampleEntity && ('create' === primaryOp || 'update' === primaryOp || 'patch' === primaryOp)) {
|
|
49
|
-
const items =
|
|
49
|
+
const items = requestExampleItems(exampleEntity, primaryOp)
|
|
50
50
|
.filter((it: any) => it.name !== idF && it.name !== 'id')
|
|
51
51
|
const required = items.filter((it: any) => !it.optional)
|
|
52
52
|
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, entityDataIdField, entityOps, matchExampleItems, requiredItems } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, Content, isAuthActive, envName, canonKey, canonScalarKey, opRequestShape, entityIdField, entityDataIdField, entityOps, matchExampleItems, requiredItems, requestExampleItems, sendsId } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -146,7 +146,7 @@ match client.${method}(Value::Noval).load(${loadArg}, Value::Noval) {
|
|
|
146
146
|
// Model-driven example fields: derive the create/update body from the op
|
|
147
147
|
// shape so the docs reference REAL writable fields.
|
|
148
148
|
const examplePairs = (opname: string): string[] => {
|
|
149
|
-
const items =
|
|
149
|
+
const items = requestExampleItems(exampleEntity, opname)
|
|
150
150
|
.filter((it: any) => (it.name !== idF && it.name !== 'id') ||
|
|
151
151
|
('create' === opname && !it.optional))
|
|
152
152
|
const required = items.filter((it: any) => !it.optional)
|
|
@@ -181,14 +181,14 @@ let created = client.${method}(Value::Noval).create(jo(vec![${examplePairs('crea
|
|
|
181
181
|
`)
|
|
182
182
|
}
|
|
183
183
|
if (opnames.includes('update')) {
|
|
184
|
-
const updatePairs = (idF ? [`(${JSON.stringify(idF)}, ${idValueFor('update')})`] : []).concat(examplePairs('update'))
|
|
184
|
+
const updatePairs = (sendsId(exampleEntity, 'update', idF) ? [`(${JSON.stringify(idF)}, ${idValueFor('update')})`] : []).concat(examplePairs('update'))
|
|
185
185
|
Content(`// Update
|
|
186
186
|
client.${method}(Value::Noval).update(jo(vec![${updatePairs.join(', ')}]), Value::Noval).unwrap();
|
|
187
187
|
|
|
188
188
|
`)
|
|
189
189
|
}
|
|
190
190
|
if (opnames.includes('patch')) {
|
|
191
|
-
const patchPairs = (idF ? [`(${JSON.stringify(idF)}, ${idValueFor('patch')})`] : []).concat(examplePairs('patch'))
|
|
191
|
+
const patchPairs = (sendsId(exampleEntity, 'patch', idF) ? [`(${JSON.stringify(idF)}, ${idValueFor('patch')})`] : []).concat(examplePairs('patch'))
|
|
192
192
|
Content(`// Patch — sends only the fields given
|
|
193
193
|
client.${method}(Value::Noval).patch(jo(vec![${patchPairs.join(', ')}]), Value::Noval).unwrap();
|
|
194
194
|
|
|
@@ -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 {
|
|
@@ -288,7 +288,7 @@ for ${eVar} in &results {
|
|
|
288
288
|
`)
|
|
289
289
|
}
|
|
290
290
|
else if ('create' === opname) {
|
|
291
|
-
const createItems =
|
|
291
|
+
const createItems = requestExampleItems(ent, 'create')
|
|
292
292
|
.filter((it: any) => !it.optional)
|
|
293
293
|
Content(`\`\`\`rust
|
|
294
294
|
let result = client.${method}(Value::Noval).create(jo(vec![
|
|
@@ -303,7 +303,7 @@ let result = client.${method}(Value::Noval).create(jo(vec![
|
|
|
303
303
|
`)
|
|
304
304
|
}
|
|
305
305
|
else if ('update' === opname || 'patch' === opname) {
|
|
306
|
-
const updateItems =
|
|
306
|
+
const updateItems = requestExampleItems(ent, opname)
|
|
307
307
|
.filter((it: any) => !it.optional || it.name === idF)
|
|
308
308
|
.sort((a: any, b: any) =>
|
|
309
309
|
(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,
|
|
@@ -48,7 +48,7 @@ let client = ${ctor};
|
|
|
48
48
|
const eName = nom(exampleEntity, 'Name')
|
|
49
49
|
const eVar = rustVarName(exampleEntity.name)
|
|
50
50
|
const method = rustMethodName(exampleEntity.name)
|
|
51
|
-
const opnames =
|
|
51
|
+
const opnames = entityOps(exampleEntity)
|
|
52
52
|
// Model-driven id key: null when the entity has no id-like field, in which
|
|
53
53
|
// case the load example takes no match argument.
|
|
54
54
|
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,
|
|
@@ -56,7 +56,7 @@ let client = test_sdk(Value::Noval, Value::Noval);
|
|
|
56
56
|
`(${JSON.stringify(it.name)}, ${isMatchOp && it.name === idF ? 'Value::str("test01")' : rustLit(it.type)})`).join(', ')}])`
|
|
57
57
|
: 'Value::Noval'
|
|
58
58
|
} else if ('create' === primaryOp || 'update' === primaryOp || 'patch' === primaryOp) {
|
|
59
|
-
const items =
|
|
59
|
+
const items = requestExampleItems(exampleEntity, primaryOp)
|
|
60
60
|
.filter((it: any) => it.name !== idF && it.name !== 'id')
|
|
61
61
|
const required = items.filter((it: any) => !it.optional)
|
|
62
62
|
const chosen = required.length ? required : items.slice(0, 3)
|
|
@@ -15,10 +15,15 @@ import {
|
|
|
15
15
|
serverVarEnv,
|
|
16
16
|
serverVariables,
|
|
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
|
|
|
@@ -26,6 +31,19 @@ import { rustVarName } from './utility_rust'
|
|
|
26
31
|
|
|
27
32
|
|
|
28
33
|
// Blocked without the ids its request needs, rather than sent without them.
|
|
34
|
+
// A GET-only live run excludes a test needing an id that only a write gives.
|
|
35
|
+
function getOnlyKeysBlock(model: any, entity: any, test: string, keys: string[]): string {
|
|
36
|
+
return liveDirectGetOnly(model, entity, test, keys).map((miss) =>
|
|
37
|
+
` if setup.live && std::env::var(${JSON.stringify(LIVE_GETONLY_ENV)}).map(|v| v == "TRUE").unwrap_or(false)
|
|
38
|
+
&& getp(&setup.idmap, ${JSON.stringify(miss.key)}).is_noval() {
|
|
39
|
+
println!("{}", ${JSON.stringify(liveExcludedLines({ excluded: [miss] })[0])});
|
|
40
|
+
eprintln!("skip: {}", ${JSON.stringify(liveExcludedSummary({ excluded: [miss] }))});
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
`).join('')
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
|
|
29
47
|
function liveKeysBlock(keys: string[], entidEnvVar: string): string {
|
|
30
48
|
return 0 === keys.length ? '' : ` if setup.live {
|
|
31
49
|
for live_key in [${keys.map((k) => JSON.stringify(k)).join(', ')}] {
|
|
@@ -81,7 +99,7 @@ const TestDirect = cmp(function TestDirect(props: any) {
|
|
|
81
99
|
const model: Model = ctx$.model
|
|
82
100
|
|
|
83
101
|
const target = props.target
|
|
84
|
-
const entity: ModelEntity = props.entity
|
|
102
|
+
const entity: ModelEntity = liveEntity(ctx$, props.entity)
|
|
85
103
|
const rustcrate: string = props.rustcrate
|
|
86
104
|
|
|
87
105
|
const PROJECTNAME = envName(model)
|
|
@@ -120,12 +138,7 @@ const TestDirect = cmp(function TestDirect(props: any) {
|
|
|
120
138
|
const allLoadParams = loadPoint?.g?.params || []
|
|
121
139
|
// Only path params that actually appear in the URL template drive the
|
|
122
140
|
// direct-test path-param setup and URL-substitution asserts.
|
|
123
|
-
const _pathPlaceholders = new Set<string>()
|
|
124
|
-
for (const part of pointParts(loadPoint)) {
|
|
125
|
-
if (typeof part === 'string' && part.startsWith('{') && part.endsWith('}')) {
|
|
126
|
-
_pathPlaceholders.add(part.slice(1, -1))
|
|
127
|
-
}
|
|
128
|
-
}
|
|
141
|
+
const _pathPlaceholders = new Set<string>(pointPlaceholders(loadPoint))
|
|
129
142
|
const _renameMap = (loadPoint?.r?.param || {}) as Record<string, string>
|
|
130
143
|
const _renamedPlaceholders = new Set<string>()
|
|
131
144
|
for (const ph of _pathPlaceholders) {
|
|
@@ -144,6 +157,15 @@ const TestDirect = cmp(function TestDirect(props: any) {
|
|
|
144
157
|
|
|
145
158
|
const entidEnvVar = `${PROJECTNAME}_TEST_${envToken(entity.name)}_ENTID`
|
|
146
159
|
|
|
160
|
+
const exampleIds = liveExampleIds(entity)
|
|
161
|
+
const rustJson = (ex: any) => `json_parse(r##"${JSON.stringify(ex)}"##).unwrap_or(Value::Noval)`
|
|
162
|
+
const liveQueryBlock = (point: any) => {
|
|
163
|
+
const lines = liveQueryExamples(point)
|
|
164
|
+
.map(([name, ex]) => ` setp(&query, "${name}", ${rustJson(ex)});\n`).join('')
|
|
165
|
+
return ' let query = Value::empty_map();\n' +
|
|
166
|
+
(lines ? ' if setup.live {\n' + lines + ' }\n' : '')
|
|
167
|
+
}
|
|
168
|
+
|
|
147
169
|
// The *_ENTID key a live test reads a parameter's value from.
|
|
148
170
|
const liveKey = (param: any): string =>
|
|
149
171
|
('id' === param.n ? entity.name : param.n.replace(/_id$/, '')) + '01'
|
|
@@ -205,7 +227,11 @@ fn ${evar}_direct_setup(mockres: Value) -> ${entity.Name}DirectSetup {
|
|
|
205
227
|
Value::Map(m) => Value::Map(m),
|
|
206
228
|
_ => Value::empty_map(),
|
|
207
229
|
};
|
|
208
|
-
|
|
230
|
+
${0 === exampleIds.length ? '' : ` // A path parameter's example stands in for an id *_ENTID does not give.
|
|
231
|
+
${exampleIds.map(([key, ex]) => ` if getp(&idmap, "${key}").is_noval() {
|
|
232
|
+
setp(&idmap, "${key}", ${rustJson(ex)});
|
|
233
|
+
}
|
|
234
|
+
`).join('')}`} return ${entity.Name}DirectSetup {
|
|
209
235
|
client,
|
|
210
236
|
calls,
|
|
211
237
|
live: true,
|
|
@@ -276,10 +302,10 @@ fn ${evar}_direct_list() {
|
|
|
276
302
|
);
|
|
277
303
|
return;
|
|
278
304
|
}
|
|
279
|
-
${liveKeysBlock(listLiveParams.map((lp: any) => lp.key), entidEnvVar)} let client = setup.client.clone();
|
|
305
|
+
${getOnlyKeysBlock(model, entity, 'direct-list-' + entity.name, listLiveParams.map((lp: any) => lp.key))}${liveKeysBlock(listLiveParams.map((lp: any) => lp.key), entidEnvVar)} let client = setup.client.clone();
|
|
280
306
|
|
|
281
307
|
let params = Value::empty_map();
|
|
282
|
-
`)
|
|
308
|
+
${liveQueryBlock(listPoint)}`)
|
|
283
309
|
listLiveParams.forEach((lp: any, i: number) => {
|
|
284
310
|
Content(` if setup.live {
|
|
285
311
|
setp(¶ms, "${lp.name}", getp(&setup.idmap, "${lp.key}"));
|
|
@@ -294,6 +320,7 @@ ${liveKeysBlock(listLiveParams.map((lp: any) => lp.key), entidEnvVar)} let cl
|
|
|
294
320
|
("path", Value::str("${listPath}")),
|
|
295
321
|
("method", Value::str("GET")),
|
|
296
322
|
("params", params.clone()),
|
|
323
|
+
("query", query.clone()),
|
|
297
324
|
])) {
|
|
298
325
|
Ok(result) => result,
|
|
299
326
|
Err(err) if setup.live => {
|
|
@@ -388,10 +415,10 @@ fn ${evar}_direct_load() {
|
|
|
388
415
|
);
|
|
389
416
|
return;
|
|
390
417
|
}
|
|
391
|
-
${liveKeysBlock([...new Set(loadLiveIdKeys)], entidEnvVar)} let client = setup.client.clone();
|
|
418
|
+
${getOnlyKeysBlock(model, entity, 'direct-load-' + entity.name, [...new Set(loadLiveIdKeys)])}${liveKeysBlock([...new Set(loadLiveIdKeys)], entidEnvVar)} let client = setup.client.clone();
|
|
392
419
|
|
|
393
420
|
let params = Value::empty_map();
|
|
394
|
-
if setup.live {
|
|
421
|
+
${liveQueryBlock(loadPoint)} if setup.live {
|
|
395
422
|
`)
|
|
396
423
|
if (examples) {
|
|
397
424
|
for (const p of loadParams) {
|
|
@@ -460,6 +487,7 @@ ${liveKeysBlock([...new Set(loadLiveIdKeys)], entidEnvVar)} let client = setu
|
|
|
460
487
|
("path", Value::str("${loadPath}")),
|
|
461
488
|
("method", Value::str("GET")),
|
|
462
489
|
("params", params.clone()),
|
|
490
|
+
("query", query.clone()),
|
|
463
491
|
])) {
|
|
464
492
|
Ok(result) => result,
|
|
465
493
|
Err(err) if setup.live => {
|