@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
|
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
|
|
|
@@ -52,7 +55,9 @@ function liveFlowGate(entity: any, needs: any, entidEnv: string): string {
|
|
|
52
55
|
out += ' client = setup["client"]\n'
|
|
53
56
|
if (null != needs.discover) {
|
|
54
57
|
const match = Object.entries(needs.discover)
|
|
55
|
-
.map(([k, v]: any) => `${JSON.stringify(k)}: setup["idmap"].get(${JSON.stringify(v)})`)
|
|
58
|
+
.map(([k, v]: any) => `${JSON.stringify(k)}: setup["idmap"].get(${JSON.stringify(v)})`)
|
|
59
|
+
.concat(liveRouteExamples(entity, 'list', Object.keys(needs.discover))
|
|
60
|
+
.map(([k, ex]) => `${JSON.stringify(k)}: ${pyLit(ex)}`)).join(', ')
|
|
56
61
|
out += ` if setup["live"]:
|
|
57
62
|
runner.live_existing(setup, LIVE_STRICT, ${JSON.stringify(entity.name)},
|
|
58
63
|
lambda: client.${entity.Name}(None).list({${match}}, None))
|
|
@@ -78,7 +83,7 @@ const TestEntity = cmp(function TestEntity(props: any) {
|
|
|
78
83
|
const model: Model = ctx$.model
|
|
79
84
|
|
|
80
85
|
const target = props.target
|
|
81
|
-
const entity: ModelEntity = props.entity
|
|
86
|
+
const entity: ModelEntity = liveEntity(ctx$, props.entity)
|
|
82
87
|
|
|
83
88
|
const basicflow: ModelEntityFlow | undefined =
|
|
84
89
|
getModelPath(model, `main.${KIT}.flow.Basic${nom(entity, 'Name')}Flow`)
|
|
@@ -127,7 +132,6 @@ const TestEntity = cmp(function TestEntity(props: any) {
|
|
|
127
132
|
const genCtx: GenCtx = { model, entity, flow: basicflow, PROJUPPER }
|
|
128
133
|
|
|
129
134
|
const strict = liveStrict(model, target.name)
|
|
130
|
-
const needs = liveFlowNeeds(entity, basicflow)
|
|
131
135
|
const entidEnv = PROJUPPER + '_TEST_' + envToken(entity.name) + '_ENTID'
|
|
132
136
|
|
|
133
137
|
// The stream test streams the "list" op with no match and asserts a 3-item
|
|
@@ -213,13 +217,16 @@ ${strict ? '' : ` @runner.live_observe("${PROJUPPER}_TEST_LIVE", LIVE_STRICT)
|
|
|
213
217
|
if _skip:
|
|
214
218
|
pytest.skip(_reason or "skipped via sdk-test-control.json")
|
|
215
219
|
return
|
|
216
|
-
${liveFlowGate(entity, needs, entidEnv)}
|
|
217
220
|
`)
|
|
218
221
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
222
|
+
const flowBody = (flow: any) => {
|
|
223
|
+
const steps = flowSteps(flow) as any[]
|
|
224
|
+
Content(liveFlowGate(entity, liveFlowNeeds(entity, flow), entidEnv) + '\n')
|
|
225
|
+
|
|
226
|
+
// Check if the flow has a create step
|
|
227
|
+
const flowHasCreate = steps.some((s: any) => s.o === 'create')
|
|
228
|
+
if (!flowHasCreate) {
|
|
229
|
+
Content(` # Bootstrap entity data from existing test data.
|
|
223
230
|
${entity.name}_ref01_data_raw = vs.items(helpers.to_map(
|
|
224
231
|
vs.getpath(setup["data"], "existing.${entity.name}")))
|
|
225
232
|
${entity.name}_ref01_data = None
|
|
@@ -227,24 +234,46 @@ ${liveFlowGate(entity, needs, entidEnv)}
|
|
|
227
234
|
${entity.name}_ref01_data = helpers.to_map(${entity.name}_ref01_data_raw[0][1])
|
|
228
235
|
|
|
229
236
|
`)
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
// Model-driven step iteration
|
|
240
|
+
each(steps, (step: any, index: any) => {
|
|
241
|
+
// Never emit a REMOVE (or its removed-item verify LIST) without a
|
|
242
|
+
// preceding CREATE: a coherent CRUD flow only removes what it created,
|
|
243
|
+
// so a create-less remove would mutate pre-existing (live) data.
|
|
244
|
+
if (!flowHasCreate) {
|
|
245
|
+
if ('remove' === step.o) { return }
|
|
246
|
+
if ('list' === step.o &&
|
|
247
|
+
(step.v || []).some((v: any) => 'ItemNotExists' === v.apply)) { return }
|
|
248
|
+
}
|
|
249
|
+
const opgen: OpGen = GENERATE_OP[step.o]
|
|
250
|
+
if (opgen) {
|
|
251
|
+
opgen({ ...genCtx, flow }, step, index)
|
|
252
|
+
Content('\n')
|
|
253
|
+
}
|
|
254
|
+
})
|
|
230
255
|
}
|
|
231
256
|
|
|
232
|
-
//
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
if (
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
257
|
+
// A python block cannot hold steps emitted at the method's own indent,
|
|
258
|
+
// so the steps a GET-only run keeps go in a method of their own.
|
|
259
|
+
const getOnly = liveGetOnly(entity, basicflow)
|
|
260
|
+
const getOnlyRuns = null != getOnly && 0 < flowSteps(getOnly.flow).length
|
|
261
|
+
if (null != getOnly) {
|
|
262
|
+
Content(` if setup["live"] and os.environ.get(${JSON.stringify(LIVE_GETONLY_ENV)}) == "TRUE":
|
|
263
|
+
${liveExcludedLines(getOnly).map((line) => ' print(' + pyLit(line) + ')\n').join('')}${getOnlyRuns ?
|
|
264
|
+
' return self._run_get_only_flow(setup)\n' :
|
|
265
|
+
' pytest.skip(' + pyLit(liveExcludedSummary(getOnly)) + ')\n'}
|
|
266
|
+
`)
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
flowBody(basicflow)
|
|
270
|
+
|
|
271
|
+
if (null != getOnly && getOnlyRuns) {
|
|
272
|
+
Content(`
|
|
273
|
+
def _run_get_only_flow(self, setup):
|
|
274
|
+
`)
|
|
275
|
+
flowBody(getOnly.flow)
|
|
276
|
+
}
|
|
248
277
|
|
|
249
278
|
Content(`
|
|
250
279
|
|
|
@@ -420,6 +449,7 @@ const generateList: OpGen = (ctx, step, index) => {
|
|
|
420
449
|
Content(` }
|
|
421
450
|
`)
|
|
422
451
|
}
|
|
452
|
+
Content(liveFill(entity, step, matchvar))
|
|
423
453
|
|
|
424
454
|
Content(`
|
|
425
455
|
${listvar}_result = ${entvar}.list(${matchvar}, None)
|
|
@@ -561,7 +591,7 @@ const generateLoad: OpGen = (ctx, step, index) => {
|
|
|
561
591
|
Content(` ${entvar} = client.${entity.Name}(None)
|
|
562
592
|
`)
|
|
563
593
|
}
|
|
564
|
-
if (!hasSrcData && hasEntId) {
|
|
594
|
+
if (!hasSrcData && (hasEntId || flowLoadReadsRecord(entity, step))) {
|
|
565
595
|
Content(` ${srcdatavar}_raw = vs.items(helpers.to_map(
|
|
566
596
|
vs.getpath(setup["data"], "existing.${entity.name}")))
|
|
567
597
|
${srcdatavar} = None
|
|
@@ -573,7 +603,7 @@ const generateLoad: OpGen = (ctx, step, index) => {
|
|
|
573
603
|
Content(` ${matchvar} = {
|
|
574
604
|
"id": ${srcdatavar}["id"],
|
|
575
605
|
}
|
|
576
|
-
${
|
|
606
|
+
${loadMatch(entity, step, matchvar, srcdatavar)}${liveFill(entity, step, matchvar)} ${datavar}_loaded = ${entvar}.load(${matchvar}, None)
|
|
577
607
|
${datavar}_load_result = helpers.to_map(runner.entity_data(${datavar}_loaded))
|
|
578
608
|
assert ${datavar}_load_result is not None
|
|
579
609
|
assert ${datavar}_load_result["id"] == ${srcdatavar}["id"]
|
|
@@ -581,7 +611,7 @@ ${parentMatch(step, matchvar)} ${datavar}_loaded = ${entvar}.load(${match
|
|
|
581
611
|
}
|
|
582
612
|
else {
|
|
583
613
|
Content(` ${matchvar} = {}
|
|
584
|
-
${
|
|
614
|
+
${loadMatch(entity, step, matchvar, srcdatavar)}${liveFill(entity, step, matchvar)} ${datavar}_loaded = ${entvar}.load(${matchvar}, None)
|
|
585
615
|
assert ${datavar}_loaded is not None
|
|
586
616
|
`)
|
|
587
617
|
}
|
|
@@ -621,6 +651,14 @@ ${parentMatch(step, matchvar)} ${entvar}.remove(${matchvar}, None)
|
|
|
621
651
|
// A child's route names its parents, and an entity no earlier step has
|
|
622
652
|
// filled knows none of them, so the call itself gives each parent id. A live
|
|
623
653
|
// ENTID may key a parent by its field name, the fixture by its own name.
|
|
654
|
+
// A live step sends each example its route requires and the step leaves unbound.
|
|
655
|
+
function liveFill(entity: any, step: any, matchvar: string): string {
|
|
656
|
+
const fills = liveStepExamples(entity, step)
|
|
657
|
+
return 0 === fills.length ? '' : ` if setup["live"]:
|
|
658
|
+
${fills.map(([k, ex]) => ` ${matchvar}[${JSON.stringify(k)}] = ${pyLit(ex)}\n`).join('')}`
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
|
|
624
662
|
function parentMatch(step: any, matchvar: string): string {
|
|
625
663
|
return Object.entries(step.m || {})
|
|
626
664
|
.filter(([k]: any) => k !== 'id' && !k.endsWith('$'))
|
|
@@ -628,6 +666,31 @@ function parentMatch(step: any, matchvar: string): string {
|
|
|
628
666
|
`).join('')
|
|
629
667
|
}
|
|
630
668
|
|
|
669
|
+
// A load of a known record fills its route from that record, and from the
|
|
670
|
+
// step's binding where the record holds no scalar for it. A record only the
|
|
671
|
+
// fixture holds replaces the step's binding offline.
|
|
672
|
+
function loadMatch(entity: any, step: any, matchvar: string, srcdatavar: string): string {
|
|
673
|
+
const route = flowLoadRoute(entity, step)
|
|
674
|
+
if (null == route) {
|
|
675
|
+
return parentMatch(step, matchvar)
|
|
676
|
+
}
|
|
677
|
+
if (route.offline) {
|
|
678
|
+
const own = route.args.filter((arg) => null != arg.field)
|
|
679
|
+
return parentMatch(step, matchvar) + (0 === own.length ? '' : ` if not setup["live"]:
|
|
680
|
+
${own.map((arg) => ` if isinstance(${srcdatavar}.get("${arg.field}"), (str, int, float)):
|
|
681
|
+
${matchvar}["${arg.name}"] = ${srcdatavar}["${arg.field}"]
|
|
682
|
+
`).join('')}`)
|
|
683
|
+
}
|
|
684
|
+
return route.args.map((arg) => {
|
|
685
|
+
const bound = arg.idmap.map((key) => `setup["idmap"].get("${key}")`).join(' or ')
|
|
686
|
+
const own = `${srcdatavar}.get("${arg.field}")`
|
|
687
|
+
return ` ${matchvar}["${arg.name}"] = ${null == arg.field ? bound :
|
|
688
|
+
`${own} if isinstance(${own}, (str, int, float)) else ${bound}`}
|
|
689
|
+
`
|
|
690
|
+
}).join('')
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
|
|
631
694
|
const GENERATE_OP: Record<string, OpGen> = {
|
|
632
695
|
create: generateCreate,
|
|
633
696
|
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, safeVarName, exampleVarName, opNeedsAction, matchExampleItems, litString, requestExampleItems } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -149,7 +149,7 @@ ${eVar}s.each { |item| puts item.data_get }
|
|
|
149
149
|
// required id and parent keys like page_id — with a real, executable
|
|
150
150
|
// literal (the doc test RUNS this block, so a comment placeholder
|
|
151
151
|
// would break it).
|
|
152
|
-
const createItems =
|
|
152
|
+
const createItems = requestExampleItems(entity, 'create')
|
|
153
153
|
.filter((it: any) => !it.optional)
|
|
154
154
|
Content(`#### Example: Create
|
|
155
155
|
|
|
@@ -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, safeVarName, exampleVarName, seededList, litPair, 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
|
? `{ ${items.map((it: any) => litPair('rb', it.name, it.name === idF ? '"test01"' : rbLit(it.type))).join(', ')} }`
|
|
51
51
|
: ''
|
|
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, each, Content, isAuthActive, envName, canonKey, canonScalarKey, opRequestShape, entityIdField, entityDataIdField, entityOps, safeVarName, exampleVarName, matchExampleItems, requiredItems, litString } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, each, Content, isAuthActive, envName, canonKey, canonScalarKey, opRequestShape, entityIdField, entityDataIdField, entityOps, safeVarName, exampleVarName, matchExampleItems, requiredItems, litString, requestExampleItems, sendsId } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -158,7 +158,7 @@ end
|
|
|
158
158
|
}
|
|
159
159
|
|
|
160
160
|
const examplePairs = (opname: string): string[] => {
|
|
161
|
-
const items =
|
|
161
|
+
const items = requestExampleItems(exampleEntity, opname)
|
|
162
162
|
.filter((it: any) => (it.name !== idF && it.name !== 'id') ||
|
|
163
163
|
('create' === opname && !it.optional))
|
|
164
164
|
const required = items.filter((it: any) => !it.optional)
|
|
@@ -190,7 +190,7 @@ created = client.${eName}.create({ ${examplePairs('create').join(', ')} })
|
|
|
190
190
|
`)
|
|
191
191
|
}
|
|
192
192
|
if (opnames.includes('update')) {
|
|
193
|
-
const updatePairs = (idF ? [`${litString('rb', idF)} => ${idValueFor('update')}`] : []).concat(examplePairs('update'))
|
|
193
|
+
const updatePairs = (sendsId(exampleEntity, 'update', idF) ? [`${litString('rb', idF)} => ${idValueFor('update')}`] : []).concat(examplePairs('update'))
|
|
194
194
|
const fromCreated = null != dataIdF && opnames.includes('create')
|
|
195
195
|
Content(`# Update${fromCreated ? ` — index the record via data_get (created.data_get[${litString('rb', dataIdF)}]).` : ''}
|
|
196
196
|
client.${eName}.update({ ${updatePairs.join(', ')} })
|
|
@@ -198,7 +198,7 @@ client.${eName}.update({ ${updatePairs.join(', ')} })
|
|
|
198
198
|
`)
|
|
199
199
|
}
|
|
200
200
|
if (opnames.includes('patch')) {
|
|
201
|
-
const patchPairs = (idF ? [`${litString('rb', idF)} => ${idValueFor('patch')}`] : []).concat(examplePairs('patch'))
|
|
201
|
+
const patchPairs = (sendsId(exampleEntity, 'patch', idF) ? [`${litString('rb', idF)} => ${idValueFor('patch')}`] : []).concat(examplePairs('patch'))
|
|
202
202
|
Content(`# Patch — sends only the fields given
|
|
203
203
|
client.${eName}.patch({ ${patchPairs.join(', ')} })
|
|
204
204
|
|
|
@@ -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, safeVarName, exampleVarName , targetFeatures, opNeedsAction, bodyNote, matchExampleItems, litString, requestExampleItems } from '@voxgig/sdkgen'
|
|
3
3
|
import { ReadmeRefFeatures } from '@voxgig/sdkgen'
|
|
4
4
|
|
|
5
5
|
import {
|
|
@@ -302,7 +302,7 @@ results.each { |item| puts item.data_get }
|
|
|
302
302
|
// a required id and parent keys like page_id — with a real,
|
|
303
303
|
// executable literal (the doc test RUNS this block, so a comment
|
|
304
304
|
// placeholder would break it).
|
|
305
|
-
const createItems =
|
|
305
|
+
const createItems = requestExampleItems(ent, 'create')
|
|
306
306
|
.filter((it: any) => !it.optional)
|
|
307
307
|
Content(`\`\`\`ruby
|
|
308
308
|
result = client.${ent.Name}.create({
|
|
@@ -319,7 +319,7 @@ result = client.${ent.Name}.create({
|
|
|
319
319
|
else if ('update' === opname || 'patch' === opname) {
|
|
320
320
|
// The id key plus every REQUIRED data member — the same shape the
|
|
321
321
|
// runtime validates — then the patch-fields note.
|
|
322
|
-
const updateItems =
|
|
322
|
+
const updateItems = requestExampleItems(ent, opname)
|
|
323
323
|
.filter((it: any) => !it.optional || it.name === idF)
|
|
324
324
|
.sort((a: any, b: any) =>
|
|
325
325
|
(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, safeVarName, exampleVarName, matchExampleItems, litString } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, Content, isAuthActive, envName, canonKey, canonScalarKey, entityIdField, opRequestShape, safeVarName, exampleVarName, matchExampleItems, litString, entityOps } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -49,7 +49,7 @@ client = ${ctor}
|
|
|
49
49
|
// Sanitise the local variable name — an entity whose lowercased name is a
|
|
50
50
|
// Ruby keyword (e.g. `self`) would otherwise emit uncompilable code.
|
|
51
51
|
const eVar = exampleVarName(eName.toLowerCase(), 'rb')
|
|
52
|
-
const opnames =
|
|
52
|
+
const opnames = entityOps(exampleEntity)
|
|
53
53
|
const idF = entityIdField(exampleEntity)
|
|
54
54
|
|
|
55
55
|
let hasCall = false
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, Content, canonKey, canonScalarKey, entityIdField, pickExampleEntity,
|
|
2
|
+
import { cmp, Content, canonKey, canonScalarKey, entityIdField, pickExampleEntity, safeVarName, exampleVarName, seededList, litPair, matchExampleItems, requestExampleItems } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -49,7 +49,7 @@ const ReadmeTopTest = cmp(function ReadmeTopTest(props: any) {
|
|
|
49
49
|
litPair('rb', it.name, it.name === idF ? '"test01"' : rbLit(it.type))).join(', ')} }`
|
|
50
50
|
: ''
|
|
51
51
|
} else if ('create' === primaryOp || 'update' === primaryOp || 'patch' === primaryOp) {
|
|
52
|
-
const items =
|
|
52
|
+
const items = requestExampleItems(exampleEntity, primaryOp)
|
|
53
53
|
.filter((it: any) => it.name !== idF && it.name !== 'id')
|
|
54
54
|
const required = items.filter((it: any) => !it.optional)
|
|
55
55
|
const chosen = required.length ? required : items.slice(0, 3)
|
|
@@ -227,7 +227,7 @@ class ${Name}CleanTest < Minitest::Test
|
|
|
227
227
|
[nil, RuntimeError.new("socket hang up (URL was: \\"#{url}\\")")]
|
|
228
228
|
}],
|
|
229
229
|
# The SDK's own error, its code quoting a registered value.
|
|
230
|
-
["coded", ->(_url, _fd) { [nil, ${Name}Error.new("denied_#{CANARY['apikey']}"
|
|
230
|
+
["coded", ->(_url, _fd) { [nil, ${Name}Error.new("coded failure", code: "denied_#{CANARY['apikey']}")] }],
|
|
231
231
|
["notjson", ->(_url, _fd) {
|
|
232
232
|
[{
|
|
233
233
|
"status" => 200, "statusText" => "OK", "headers" => {},
|
|
@@ -15,16 +15,32 @@ 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
|
import { formatRubyValue } from './utility_rb'
|
|
25
30
|
|
|
26
31
|
|
|
27
32
|
// Blocked without the ids its request needs, rather than sent with nil.
|
|
33
|
+
// A GET-only live run excludes a test needing an id that only a write gives.
|
|
34
|
+
function getOnlyKeysBlock(model: any, entity: any, test: string, keys: string[]): string {
|
|
35
|
+
return liveDirectGetOnly(model, entity, test, keys).map((miss) =>
|
|
36
|
+
` if setup[:live] && ENV[${formatRubyValue(LIVE_GETONLY_ENV)}] == "TRUE" && setup[:idmap][${formatRubyValue(miss.key)}].nil?
|
|
37
|
+
puts ${formatRubyValue(liveExcludedLines({ excluded: [miss] })[0])}
|
|
38
|
+
skip(${formatRubyValue(liveExcludedSummary({ excluded: [miss] }))})
|
|
39
|
+
end
|
|
40
|
+
`).join('')
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
|
|
28
44
|
function liveKeysBlock(keys: string[], entidEnvVar: string): string {
|
|
29
45
|
return 0 === keys.length ? '' : ` if setup[:live]
|
|
30
46
|
[${keys.map((k) => JSON.stringify(k)).join(', ')}].each do |_live_key|
|
|
@@ -80,7 +96,7 @@ const TestDirect = cmp(function TestDirect(props: any) {
|
|
|
80
96
|
const model: Model = ctx$.model
|
|
81
97
|
|
|
82
98
|
const target = props.target
|
|
83
|
-
const entity: ModelEntity = props.entity
|
|
99
|
+
const entity: ModelEntity = liveEntity(ctx$, props.entity)
|
|
84
100
|
|
|
85
101
|
const PROJECTNAME = envName(model)
|
|
86
102
|
|
|
@@ -124,12 +140,7 @@ const TestDirect = cmp(function TestDirect(props: any) {
|
|
|
124
140
|
// actually appear in the URL template should drive direct-test path-param
|
|
125
141
|
// setup and URL-substitution asserts; otherwise the SDK silently drops
|
|
126
142
|
// them and the URL-includes assert fails.
|
|
127
|
-
const _pathPlaceholders = new Set<string>()
|
|
128
|
-
for (const part of pointParts(loadPoint)) {
|
|
129
|
-
if (typeof part === 'string' && part.startsWith('{') && part.endsWith('}')) {
|
|
130
|
-
_pathPlaceholders.add(part.slice(1, -1))
|
|
131
|
-
}
|
|
132
|
-
}
|
|
143
|
+
const _pathPlaceholders = new Set<string>(pointPlaceholders(loadPoint))
|
|
133
144
|
const _renameMap = (loadPoint?.r?.param || {}) as Record<string, string>
|
|
134
145
|
const _renamedPlaceholders = new Set<string>()
|
|
135
146
|
for (const ph of _pathPlaceholders) {
|
|
@@ -146,11 +157,8 @@ const TestDirect = cmp(function TestDirect(props: any) {
|
|
|
146
157
|
const listParams = listPoint?.g?.params || []
|
|
147
158
|
|
|
148
159
|
// Required query params with spec-provided examples — needed in live mode.
|
|
149
|
-
const
|
|
150
|
-
|
|
151
|
-
.filter((q: any) => q.r && undefined !== q.ex && null !== q.ex)
|
|
152
|
-
const loadLiveQueryLines = loadLiveQueryEntries
|
|
153
|
-
.map((q: any) => ` query["${q.n}"] = ${JSON.stringify(q.ex)}`)
|
|
160
|
+
const loadLiveQueryLines = liveQueryExamples(loadPoint)
|
|
161
|
+
.map(([name, ex]) => ` query["${name}"] = ${formatRubyValue(ex)}`)
|
|
154
162
|
.join('\n')
|
|
155
163
|
|
|
156
164
|
const loadAllHaveExamples =
|
|
@@ -162,6 +170,10 @@ const TestDirect = cmp(function TestDirect(props: any) {
|
|
|
162
170
|
|
|
163
171
|
const entidEnvVar = `${PROJECTNAME}_TEST_${envToken(entity.name)}_ENTID`
|
|
164
172
|
|
|
173
|
+
const exampleIds = liveExampleIds(entity)
|
|
174
|
+
const listLiveQueryLines = liveQueryExamples(listPoint)
|
|
175
|
+
.map(([name, ex]) => ` query["${name}"] = ${formatRubyValue(ex)}\n`).join('')
|
|
176
|
+
|
|
165
177
|
// The *_ENTID key a live test reads a parameter's value from.
|
|
166
178
|
const liveKey = (param: any): string =>
|
|
167
179
|
('id' === param.n ? entity.name : param.n.replace(/_id$/, '')) + '01'
|
|
@@ -204,10 +216,11 @@ ${liveStrictNote(liveStrict(model, target.name), '#', ' ')}
|
|
|
204
216
|
skip(_reason || "skipped via sdk-test-control.json")
|
|
205
217
|
return
|
|
206
218
|
end
|
|
207
|
-
${liveKeysBlock(listParams.map(liveKey), entidEnvVar)} client = setup[:client]
|
|
219
|
+
${getOnlyKeysBlock(model, entity, 'direct-list-' + entity.name, listParams.map(liveKey))}${liveKeysBlock(listParams.map(liveKey), entidEnvVar)} client = setup[:client]
|
|
208
220
|
|
|
209
221
|
params = {}
|
|
210
|
-
|
|
222
|
+
query = {}
|
|
223
|
+
${listLiveQueryLines ? ' if setup[:live]\n' + listLiveQueryLines + ' end\n' : ''}`)
|
|
211
224
|
listParams.forEach((lp: any, i: number) => {
|
|
212
225
|
Content(` params["${lp.n}"] = setup[:live] ? setup[:idmap]["${liveKey(lp)}"] : "direct0${i + 1}"
|
|
213
226
|
`)
|
|
@@ -217,6 +230,7 @@ ${liveKeysBlock(listParams.map(liveKey), entidEnvVar)} client = setup[:client
|
|
|
217
230
|
"path" => "${listPath}",
|
|
218
231
|
"method" => "GET",
|
|
219
232
|
"params" => params,
|
|
233
|
+
"query" => query,
|
|
220
234
|
})
|
|
221
235
|
if setup[:live]
|
|
222
236
|
unless live_ok(result)
|
|
@@ -259,7 +273,7 @@ ${liveKeysBlock(listParams.map(liveKey), entidEnvVar)} client = setup[:client
|
|
|
259
273
|
skip(_reason || "skipped via sdk-test-control.json")
|
|
260
274
|
return
|
|
261
275
|
end
|
|
262
|
-
${liveKeysBlock([...new Set(loadLiveIdKeys)], entidEnvVar)} client = setup[:client]
|
|
276
|
+
${getOnlyKeysBlock(model, entity, 'direct-load-' + entity.name, [...new Set(loadLiveIdKeys)])}${liveKeysBlock([...new Set(loadLiveIdKeys)], entidEnvVar)} client = setup[:client]
|
|
263
277
|
|
|
264
278
|
params = {}
|
|
265
279
|
query = {}
|
|
@@ -361,7 +375,10 @@ def ${entity.name}_direct_setup(mockres)
|
|
|
361
375
|
})
|
|
362
376
|
client = ${model.const.Name}SDK.new(merged_opts)
|
|
363
377
|
idmap = env["${entidEnvVar}"]
|
|
364
|
-
|
|
378
|
+
${0 === exampleIds.length ? '' : ` # A path parameter's example stands in for an id *_ENTID does not give.
|
|
379
|
+
idmap = { ${exampleIds.map(([key, ex]) => `"${key}" => ${formatRubyValue(ex)}`).join(', ')} }
|
|
380
|
+
.merge(idmap.is_a?(Hash) ? idmap : {})
|
|
381
|
+
`} return {
|
|
365
382
|
client: client,
|
|
366
383
|
calls: calls,
|
|
367
384
|
live: true,
|