@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
|
@@ -15,16 +15,34 @@ 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 { perlStringLiteral } from './utility_perl'
|
|
25
30
|
|
|
26
31
|
|
|
27
32
|
// Blocked without the ids its request needs, rather than sent with undef.
|
|
33
|
+
// A GET-only live run excludes a test needing an id that only a write gives.
|
|
34
|
+
function getOnlyKeysBlock(model: any, entity: any, label: string, block: string, keys: string[]): string {
|
|
35
|
+
return liveDirectGetOnly(model, entity, label, keys).map((miss) =>
|
|
36
|
+
` if ($setup->{live} && ($ENV{${LIVE_GETONLY_ENV}} // '') eq 'TRUE' && !defined $setup->{idmap}{${perlStringLiteral(miss.key)}}) {
|
|
37
|
+
note(${perlStringLiteral(liveExcludedLines({ excluded: [miss] })[0])});
|
|
38
|
+
note(${perlStringLiteral(liveExcludedSummary({ excluded: [miss] }))});
|
|
39
|
+
pass('${label}: skipped, a GET-only live run excludes it');
|
|
40
|
+
last ${block};
|
|
41
|
+
}
|
|
42
|
+
`).join('')
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
|
|
28
46
|
function liveKeysBlock(N: string, label: string, block: string, keys: string[],
|
|
29
47
|
entidEnvVar: string): string {
|
|
30
48
|
return 0 === keys.length ? '' : ` if ($setup->{live}) {
|
|
@@ -90,7 +108,7 @@ const TestDirect = cmp(function TestDirect(props: any) {
|
|
|
90
108
|
const ctx$ = props.ctx$
|
|
91
109
|
const model: Model = ctx$.model
|
|
92
110
|
|
|
93
|
-
const entity: ModelEntity = props.entity
|
|
111
|
+
const entity: ModelEntity = liveEntity(ctx$, props.entity)
|
|
94
112
|
const target = props.target
|
|
95
113
|
|
|
96
114
|
const N = model.const.Name
|
|
@@ -133,12 +151,7 @@ const TestDirect = cmp(function TestDirect(props: any) {
|
|
|
133
151
|
const allLoadParams = loadPoint?.g?.params || []
|
|
134
152
|
// Only path params that actually appear in the URL template drive direct-
|
|
135
153
|
// test path-param setup and URL-substitution asserts (see TestDirect_rb).
|
|
136
|
-
const _pathPlaceholders = new Set<string>()
|
|
137
|
-
for (const part of pointParts(loadPoint)) {
|
|
138
|
-
if (typeof part === 'string' && part.startsWith('{') && part.endsWith('}')) {
|
|
139
|
-
_pathPlaceholders.add(part.slice(1, -1))
|
|
140
|
-
}
|
|
141
|
-
}
|
|
154
|
+
const _pathPlaceholders = new Set<string>(pointPlaceholders(loadPoint))
|
|
142
155
|
const _renameMap = (loadPoint?.r?.param || {}) as Record<string, string>
|
|
143
156
|
const _renamedPlaceholders = new Set<string>()
|
|
144
157
|
for (const ph of _pathPlaceholders) {
|
|
@@ -155,11 +168,8 @@ const TestDirect = cmp(function TestDirect(props: any) {
|
|
|
155
168
|
const listParams = listPoint?.g?.params || []
|
|
156
169
|
|
|
157
170
|
// Required query params with spec-provided examples - needed in live mode.
|
|
158
|
-
const
|
|
159
|
-
|
|
160
|
-
.filter((q: any) => q.r && undefined !== q.ex && null !== q.ex)
|
|
161
|
-
const loadLiveQueryLines = loadLiveQueryEntries
|
|
162
|
-
.map((q: any) => ` $query->{'${q.n}'} = ${perlScalar(q.ex)};`)
|
|
171
|
+
const loadLiveQueryLines = liveQueryExamples(loadPoint)
|
|
172
|
+
.map(([name, ex]) => ` $query->{'${name}'} = ${perlScalar(ex)};`)
|
|
163
173
|
.join('\n')
|
|
164
174
|
|
|
165
175
|
const loadAllHaveExamples =
|
|
@@ -171,6 +181,10 @@ const TestDirect = cmp(function TestDirect(props: any) {
|
|
|
171
181
|
|
|
172
182
|
const entidEnvVar = `${PROJECTNAME}_TEST_${envToken(entity.name)}_ENTID`
|
|
173
183
|
|
|
184
|
+
const exampleIds = liveExampleIds(entity)
|
|
185
|
+
const listLiveQueryLines = liveQueryExamples(listPoint)
|
|
186
|
+
.map(([name, ex]) => ` $query->{'${name}'} = ${perlScalar(ex)};\n`).join('')
|
|
187
|
+
|
|
174
188
|
// The *_ENTID key a live test reads a parameter's value from.
|
|
175
189
|
const liveKey = (param: any): string =>
|
|
176
190
|
('id' === param.n ? entity.name : param.n.replace(/_id$/, '')) + '01'
|
|
@@ -222,10 +236,11 @@ sub live_ok {
|
|
|
222
236
|
pass('${label}: skipped via sdk-test-control.json');
|
|
223
237
|
last DIRECT_LIST;
|
|
224
238
|
}
|
|
225
|
-
${liveKeysBlock(N, label, 'DIRECT_LIST', listParams.map(liveKey), entidEnvVar)} my $client = $setup->{client};
|
|
239
|
+
${getOnlyKeysBlock(model, entity, label, 'DIRECT_LIST', listParams.map(liveKey))}${liveKeysBlock(N, label, 'DIRECT_LIST', listParams.map(liveKey), entidEnvVar)} my $client = $setup->{client};
|
|
226
240
|
|
|
227
241
|
my $params = {};
|
|
228
|
-
|
|
242
|
+
my $query = {};
|
|
243
|
+
${listLiveQueryLines ? ' if ($setup->{live}) {\n' + listLiveQueryLines + ' }\n' : ''}`)
|
|
229
244
|
listParams.forEach((lp: any, i: number) => {
|
|
230
245
|
Content(` $params->{'${lp.n}'} = $setup->{live} ? $setup->{idmap}{'${liveKey(lp)}'} : 'direct0${i + 1}';
|
|
231
246
|
`)
|
|
@@ -235,6 +250,7 @@ ${liveKeysBlock(N, label, 'DIRECT_LIST', listParams.map(liveKey), entidEnvVar)}
|
|
|
235
250
|
'path' => '${listPath}',
|
|
236
251
|
'method' => 'GET',
|
|
237
252
|
'params' => $params,
|
|
253
|
+
'query' => $query,
|
|
238
254
|
});
|
|
239
255
|
if ($setup->{live}) {
|
|
240
256
|
if (!live_ok($result)) {
|
|
@@ -283,7 +299,7 @@ ${liveKeysBlock(N, label, 'DIRECT_LIST', listParams.map(liveKey), entidEnvVar)}
|
|
|
283
299
|
pass('${label}: skipped via sdk-test-control.json');
|
|
284
300
|
last DIRECT_LOAD;
|
|
285
301
|
}
|
|
286
|
-
${liveKeysBlock(N, label, 'DIRECT_LOAD', [...new Set(loadLiveIdKeys)], entidEnvVar)} my $client = $setup->{client};
|
|
302
|
+
${getOnlyKeysBlock(model, entity, label, 'DIRECT_LOAD', [...new Set(loadLiveIdKeys)])}${liveKeysBlock(N, label, 'DIRECT_LOAD', [...new Set(loadLiveIdKeys)], entidEnvVar)} my $client = $setup->{client};
|
|
287
303
|
|
|
288
304
|
my $params = {};
|
|
289
305
|
my $query = {};
|
|
@@ -393,7 +409,10 @@ sub ${entity.name}_direct_setup {
|
|
|
393
409
|
%{ ${N}TestRunner::live_client_options() },${apikeyLiveField}${serverLiveField}
|
|
394
410
|
});
|
|
395
411
|
my $idmap = $env->{'${entidEnvVar}'};
|
|
396
|
-
|
|
412
|
+
${0 === exampleIds.length ? '' : ` # A path parameter's example stands in for an id *_ENTID does not give.
|
|
413
|
+
$idmap = { ${exampleIds.map(([key, ex]) => `'${key}' => ${perlScalar(ex)}`).join(', ')},
|
|
414
|
+
%{ ref $idmap eq 'HASH' ? $idmap : {} } };
|
|
415
|
+
`} return {
|
|
397
416
|
'client' => $client,
|
|
398
417
|
'calls' => $calls,
|
|
399
418
|
'live' => 1,
|
|
@@ -22,6 +22,9 @@ import {
|
|
|
22
22
|
serverVarEnv,
|
|
23
23
|
serverVariables,
|
|
24
24
|
liveFlowNeeds, liveStrict, liveStrictNote,
|
|
25
|
+
liveGetOnly, liveExcludedLines, liveExcludedSummary, LIVE_GETONLY_ENV,
|
|
26
|
+
liveRouteExamples, liveStepExamples, flowLoadRoute, flowLoadReadsRecord,
|
|
27
|
+
liveEntity,
|
|
25
28
|
} from '@voxgig/sdkgen'
|
|
26
29
|
|
|
27
30
|
import { perlStringLiteral } from './utility_perl'
|
|
@@ -68,7 +71,9 @@ function liveFlowGate(N: string, entity: any, needs: any, entidEnv: string,
|
|
|
68
71
|
out += ' my $client = $setup->{client};\n'
|
|
69
72
|
if (null != needs.discover) {
|
|
70
73
|
const match = Object.entries(needs.discover)
|
|
71
|
-
.map(([k, v]: any) => `'${k}' => $setup->{idmap}{'${v}'}`)
|
|
74
|
+
.map(([k, v]: any) => `'${k}' => $setup->{idmap}{'${v}'}`)
|
|
75
|
+
.concat(liveRouteExamples(entity, 'list', Object.keys(needs.discover))
|
|
76
|
+
.map(([k, ex]) => `'${k}' => ${perlLit(ex)}`)).join(', ')
|
|
72
77
|
out += ` if ($setup->{live}) {
|
|
73
78
|
${N}TestRunner::live_existing($setup, LIVE_STRICT, '${label}', '${entity.name}',
|
|
74
79
|
sub { $client->${entity.Name}(undef)->list({${match}}, undef) }) or last BASIC_FLOW;
|
|
@@ -88,7 +93,7 @@ const TestEntity = cmp(function TestEntity(props: any) {
|
|
|
88
93
|
const ctx$ = props.ctx$
|
|
89
94
|
const model: Model = ctx$.model
|
|
90
95
|
|
|
91
|
-
const entity: ModelEntity = props.entity
|
|
96
|
+
const entity: ModelEntity = liveEntity(ctx$, props.entity)
|
|
92
97
|
const target = props.target
|
|
93
98
|
|
|
94
99
|
const basicflow: ModelEntityFlow | undefined =
|
|
@@ -145,7 +150,6 @@ const TestEntity = cmp(function TestEntity(props: any) {
|
|
|
145
150
|
const genCtx: GenCtx = { model, entity, flow: basicflow, N, PROJUPPER }
|
|
146
151
|
|
|
147
152
|
const strict = liveStrict(model, target.name)
|
|
148
|
-
const needs = liveFlowNeeds(entity, basicflow)
|
|
149
153
|
// The failure tests stream and list with no match, so they need a list a
|
|
150
154
|
// bare call can reach.
|
|
151
155
|
const hasList = opReachable((entity.op as any)?.list, [])
|
|
@@ -187,14 +191,16 @@ BASIC_FLOW: {
|
|
|
187
191
|
last BASIC_FLOW;
|
|
188
192
|
}
|
|
189
193
|
}
|
|
190
|
-
${liveFlowGate(N, entity, needs, ENTIDVAR, strict)} my %V;
|
|
191
|
-
|
|
192
194
|
`)
|
|
193
195
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
196
|
+
const flowBody = (flow: any) => {
|
|
197
|
+
const steps = flowSteps(flow) as any[]
|
|
198
|
+
Content(liveFlowGate(N, entity, liveFlowNeeds(entity, flow), ENTIDVAR, strict) + ' my %V;\n\n')
|
|
199
|
+
|
|
200
|
+
// Check if the flow has a create step
|
|
201
|
+
const flowHasCreate = steps.some((s: any) => s.o === 'create')
|
|
202
|
+
if (!flowHasCreate) {
|
|
203
|
+
Content(` # Bootstrap entity data from existing test data.
|
|
198
204
|
$V{${entity.name}_ref01_data_raw} = Voxgig::Struct::items(${N}Helpers::to_map(
|
|
199
205
|
${N}Helpers::gpath($setup->{data}, 'existing.${entity.name}')));
|
|
200
206
|
$V{${entity.name}_ref01_data} = undef;
|
|
@@ -202,21 +208,47 @@ ${liveFlowGate(N, entity, needs, ENTIDVAR, strict)} my %V;
|
|
|
202
208
|
$V{${entity.name}_ref01_data} = ${N}Helpers::to_map($V{${entity.name}_ref01_data_raw}[0][1]);
|
|
203
209
|
}
|
|
204
210
|
|
|
211
|
+
`)
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
// Model-driven step iteration
|
|
215
|
+
each(steps, (step: any, index: any) => {
|
|
216
|
+
const opgen: OpGen = GENERATE_OP[step.o]
|
|
217
|
+
if (opgen) {
|
|
218
|
+
opgen({ ...genCtx, flow }, step, index)
|
|
219
|
+
Content('\n')
|
|
220
|
+
}
|
|
221
|
+
})
|
|
222
|
+
|
|
223
|
+
Content(strict ? '' : ` 1;
|
|
224
|
+
} or ${N}TestRunner::live_observe($@, $setup, LIVE_STRICT, '${entity.name}: basic flow');
|
|
205
225
|
`)
|
|
206
226
|
}
|
|
207
227
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
Content(
|
|
228
|
+
const getOnly = liveGetOnly(entity, basicflow)
|
|
229
|
+
if (null != getOnly) {
|
|
230
|
+
Content(` if ($setup->{live} && ($ENV{${LIVE_GETONLY_ENV}} // '') eq 'TRUE') {
|
|
231
|
+
${liveExcludedLines(getOnly).map((line) => ' note(' + perlLit(line) + ');\n').join('')}`)
|
|
232
|
+
if (0 === flowSteps(getOnly.flow).length) {
|
|
233
|
+
Content(` note(${perlLit(liveExcludedSummary(getOnly))});
|
|
234
|
+
pass('${entity.name}: basic flow skipped, a GET-only live run excludes every step');
|
|
235
|
+
last BASIC_FLOW;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
`)
|
|
214
239
|
}
|
|
215
|
-
|
|
240
|
+
else {
|
|
241
|
+
flowBody(getOnly.flow)
|
|
242
|
+
Content(` last BASIC_FLOW;
|
|
243
|
+
}
|
|
216
244
|
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
245
|
+
`)
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
flowBody(basicflow)
|
|
250
|
+
|
|
251
|
+
Content(`}
|
|
220
252
|
|
|
221
253
|
`)
|
|
222
254
|
|
|
@@ -376,6 +408,7 @@ const generateList: OpGen = (ctx, step, index) => {
|
|
|
376
408
|
Content(` };
|
|
377
409
|
`)
|
|
378
410
|
}
|
|
411
|
+
Content(liveFill(entity, step, matchvar))
|
|
379
412
|
|
|
380
413
|
Content(`
|
|
381
414
|
$V{${listvar}_result} = $V{${entvar}}->list($V{${matchvar}}, undef);
|
|
@@ -518,7 +551,7 @@ const generateLoad: OpGen = (ctx, step, index) => {
|
|
|
518
551
|
Content(` $V{${entvar}} = $client->${entity.Name}(undef);
|
|
519
552
|
`)
|
|
520
553
|
}
|
|
521
|
-
if (!hasSrcData && hasEntId) {
|
|
554
|
+
if (!hasSrcData && (hasEntId || flowLoadReadsRecord(entity, step))) {
|
|
522
555
|
Content(` $V{${srcdatavar}_raw} = Voxgig::Struct::items(${N}Helpers::to_map(
|
|
523
556
|
${N}Helpers::gpath($setup->{data}, 'existing.${entity.name}')));
|
|
524
557
|
$V{${srcdatavar}} = undef;
|
|
@@ -531,7 +564,7 @@ const generateLoad: OpGen = (ctx, step, index) => {
|
|
|
531
564
|
Content(` $V{${matchvar}} = {
|
|
532
565
|
'id' => $V{${srcdatavar}}{id},
|
|
533
566
|
};
|
|
534
|
-
${
|
|
567
|
+
${loadMatch(entity, step, matchvar, srcdatavar)}${liveFill(entity, step, matchvar)} $V{${datavar}_loaded} = $V{${entvar}}->load($V{${matchvar}}, undef);
|
|
535
568
|
$V{${datavar}_load_result} = ${N}Helpers::to_map(ref($V{${datavar}_loaded}) && $V{${datavar}_loaded}->can('data_get') ? $V{${datavar}_loaded}->data_get : $V{${datavar}_loaded});
|
|
536
569
|
ok(defined $V{${datavar}_load_result}, '${entity.name} load: data');
|
|
537
570
|
is($V{${datavar}_load_result}{id}, $V{${srcdatavar}}{id}, '${entity.name} load: id');
|
|
@@ -539,7 +572,7 @@ ${parentMatch(step, matchvar)} $V{${datavar}_loaded} = $V{${entvar}}->load($V{$
|
|
|
539
572
|
}
|
|
540
573
|
else {
|
|
541
574
|
Content(` $V{${matchvar}} = {};
|
|
542
|
-
${
|
|
575
|
+
${loadMatch(entity, step, matchvar, srcdatavar)}${liveFill(entity, step, matchvar)} $V{${datavar}_loaded} = $V{${entvar}}->load($V{${matchvar}}, undef);
|
|
543
576
|
ok(defined $V{${datavar}_loaded}, '${entity.name} load: data');
|
|
544
577
|
`)
|
|
545
578
|
}
|
|
@@ -576,6 +609,21 @@ ${parentMatch(step, matchvar)} $V{${entvar}}->remove($V{${matchvar}}, undef);
|
|
|
576
609
|
// A child's route names its parents, and an entity no earlier step has
|
|
577
610
|
// filled knows none of them, so the call itself gives each parent id. A live
|
|
578
611
|
// ENTID may key a parent by its field name, the fixture by its own name.
|
|
612
|
+
function perlLit(value: any): string {
|
|
613
|
+
return 'string' === typeof value ? perlStringLiteral(value) : true === value ? '1' :
|
|
614
|
+
false === value ? '0' : String(value)
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
|
|
618
|
+
// A live step sends each example its route requires and the step leaves unbound.
|
|
619
|
+
function liveFill(entity: any, step: any, matchvar: string): string {
|
|
620
|
+
const fills = liveStepExamples(entity, step)
|
|
621
|
+
return 0 === fills.length ? '' : ` if ($setup->{live}) {
|
|
622
|
+
${fills.map(([k, ex]) => ` $V{${matchvar}}{'${k}'} = ${perlLit(ex)};\n`).join('')} }
|
|
623
|
+
`
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
|
|
579
627
|
function parentMatch(step: any, matchvar: string): string {
|
|
580
628
|
return Object.entries(step.m || {})
|
|
581
629
|
.filter(([k]: any) => k !== 'id' && !k.endsWith('$'))
|
|
@@ -584,6 +632,34 @@ function parentMatch(step: any, matchvar: string): string {
|
|
|
584
632
|
}
|
|
585
633
|
|
|
586
634
|
|
|
635
|
+
// A load of a known record fills its route from that record, and from the
|
|
636
|
+
// step's binding where the record holds no scalar for it. A record only the
|
|
637
|
+
// fixture holds replaces the step's binding offline.
|
|
638
|
+
function loadMatch(entity: any, step: any, matchvar: string, srcdatavar: string): string {
|
|
639
|
+
const route = flowLoadRoute(entity, step)
|
|
640
|
+
if (null == route) {
|
|
641
|
+
return parentMatch(step, matchvar)
|
|
642
|
+
}
|
|
643
|
+
if (route.offline) {
|
|
644
|
+
const own = route.args.filter((arg) => null != arg.field)
|
|
645
|
+
return parentMatch(step, matchvar) + (0 === own.length ? '' : ` if (!$setup->{live}) {
|
|
646
|
+
${own.map((arg) => ` {
|
|
647
|
+
my $own = $V{${srcdatavar}}{'${arg.field}'};
|
|
648
|
+
$V{${matchvar}}{'${arg.name}'} = $own if defined $own && !ref $own;
|
|
649
|
+
}
|
|
650
|
+
`).join('')} }
|
|
651
|
+
`)
|
|
652
|
+
}
|
|
653
|
+
return route.args.map((arg) => {
|
|
654
|
+
const bound = arg.idmap.map((key) => `$setup->{idmap}{'${key}'}`).join(' // ')
|
|
655
|
+
const own = `$V{${srcdatavar}}{'${arg.field}'}`
|
|
656
|
+
return ` $V{${matchvar}}{'${arg.name}'} = ${null == arg.field ? bound :
|
|
657
|
+
`(defined ${own} && !ref ${own}) ? ${own} : (${bound})`};
|
|
658
|
+
`
|
|
659
|
+
}).join('')
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
|
|
587
663
|
const GENERATE_OP: Record<string, OpGen> = {
|
|
588
664
|
create: generateCreate,
|
|
589
665
|
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, phpEntityAccessor, opNeedsAction, listMatchArg, matchExampleItems, litString, requestExampleItems } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -144,7 +144,7 @@ $${entity.name}s = $client->${phpEntityAccessor(entity.Name)}()->list(${listMatc
|
|
|
144
144
|
// Members come from the SAME shape the runtime validates
|
|
145
145
|
// (opRequestShape): every required member must appear — including a
|
|
146
146
|
// required id and parent keys like page_id.
|
|
147
|
-
const createItems =
|
|
147
|
+
const createItems = requestExampleItems(entity, 'create')
|
|
148
148
|
.filter((it: any) => !it.optional)
|
|
149
149
|
Content(`#### Example: Create
|
|
150
150
|
|
|
@@ -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, phpEntityAccessor, seededList, litPair, matchExampleItems, requestExampleItems } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import { KIT, getModelPath, nom } from '@voxgig/apidef'
|
|
5
5
|
|
|
@@ -50,7 +50,7 @@ const ReadmeHowto = cmp(function ReadmeHowto(props: any) {
|
|
|
50
50
|
? `[${items.map((it: any) => litPair('php', it.name, it.name === idF ? '"test01"' : phpLit(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, phpEntityAccessor, listMatchArg, matchExampleItems, requiredItems, litString } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, each, Content, isAuthActive, envName, canonKey, canonScalarKey, opRequestShape, entityIdField, entityDataIdField, entityOps, phpEntityAccessor, listMatchArg, matchExampleItems, requiredItems, litString, requestExampleItems, sendsId } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -154,7 +154,7 @@ try {
|
|
|
154
154
|
}
|
|
155
155
|
|
|
156
156
|
const examplePairs = (opname: string): string[] => {
|
|
157
|
-
const items =
|
|
157
|
+
const items = requestExampleItems(exampleEntity, opname)
|
|
158
158
|
.filter((it: any) => (it.name !== idF && it.name !== 'id') ||
|
|
159
159
|
('create' === opname && !it.optional))
|
|
160
160
|
const required = items.filter((it: any) => !it.optional)
|
|
@@ -186,7 +186,7 @@ $created = $client->${phpEntityAccessor(eName)}()->create([${examplePairs('creat
|
|
|
186
186
|
`)
|
|
187
187
|
}
|
|
188
188
|
if (opnames.includes('update')) {
|
|
189
|
-
const updatePairs = (idF ? [`${litString('php', idF)} => ${idValueFor('update')}`] : []).concat(examplePairs('update'))
|
|
189
|
+
const updatePairs = (sendsId(exampleEntity, 'update', idF) ? [`${litString('php', idF)} => ${idValueFor('update')}`] : []).concat(examplePairs('update'))
|
|
190
190
|
const fromCreated = null != dataIdF && opnames.includes('create')
|
|
191
191
|
Content(`// Update${fromCreated ? ` — index the record via data_get() ($created->data_get()[${litString('php', dataIdF)}]).` : ''}
|
|
192
192
|
$client->${phpEntityAccessor(eName)}()->update([${updatePairs.join(', ')}]);
|
|
@@ -194,7 +194,7 @@ $client->${phpEntityAccessor(eName)}()->update([${updatePairs.join(', ')}]);
|
|
|
194
194
|
`)
|
|
195
195
|
}
|
|
196
196
|
if (opnames.includes('patch')) {
|
|
197
|
-
const patchPairs = (idF ? [`${litString('php', idF)} => ${idValueFor('patch')}`] : []).concat(examplePairs('patch'))
|
|
197
|
+
const patchPairs = (sendsId(exampleEntity, 'patch', idF) ? [`${litString('php', idF)} => ${idValueFor('patch')}`] : []).concat(examplePairs('patch'))
|
|
198
198
|
Content(`// Patch — sends only the fields given
|
|
199
199
|
$client->${phpEntityAccessor(eName)}()->patch([${patchPairs.join(', ')}]);
|
|
200
200
|
|
|
@@ -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, phpEntityAccessor, targetFeatures, opNeedsAction, bodyNote, listMatchArg, matchExampleItems, litString, requestExampleItems } from '@voxgig/sdkgen'
|
|
3
3
|
import { ReadmeRefFeatures } from '@voxgig/sdkgen'
|
|
4
4
|
|
|
5
5
|
import {
|
|
@@ -294,7 +294,7 @@ $results = $client->${phpEntityAccessor(ent.Name)}()->list(${listMatchArg('php',
|
|
|
294
294
|
// Members come from the SAME shape the runtime validates
|
|
295
295
|
// (opRequestShape): every required member must appear — including
|
|
296
296
|
// a required id and parent keys like page_id.
|
|
297
|
-
const createItems =
|
|
297
|
+
const createItems = requestExampleItems(ent, 'create')
|
|
298
298
|
.filter((it: any) => !it.optional)
|
|
299
299
|
Content(`\`\`\`php
|
|
300
300
|
$result = $client->${phpEntityAccessor(ent.Name)}()->create([
|
|
@@ -311,7 +311,7 @@ $result = $client->${phpEntityAccessor(ent.Name)}()->create([
|
|
|
311
311
|
else if ('update' === opname || 'patch' === opname) {
|
|
312
312
|
// The id key plus every REQUIRED data member — the same shape the
|
|
313
313
|
// runtime validates — then the patch-fields note.
|
|
314
|
-
const updateItems =
|
|
314
|
+
const updateItems = requestExampleItems(ent, opname)
|
|
315
315
|
.filter((it: any) => !it.optional || it.name === idF)
|
|
316
316
|
.sort((a: any, b: any) =>
|
|
317
317
|
(a.name === idF ? 0 : 1) - (b.name === idF ? 0 : 1))
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, Content, isAuthActive, envName, canonKey, canonScalarKey, entityIdField, opRequestShape, phpEntityAccessor, listMatchArg, matchExampleItems, litString } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, Content, isAuthActive, envName, canonKey, canonScalarKey, entityIdField, opRequestShape, phpEntityAccessor, listMatchArg, matchExampleItems, litString, entityOps } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -43,7 +43,7 @@ $client = ${ctor};
|
|
|
43
43
|
|
|
44
44
|
if (exampleEntity) {
|
|
45
45
|
const eName = nom(exampleEntity, 'Name')
|
|
46
|
-
const opnames =
|
|
46
|
+
const opnames = entityOps(exampleEntity)
|
|
47
47
|
// Model-driven id key: null when the entity has no id-like field, in which
|
|
48
48
|
// case the load example takes no match argument.
|
|
49
49
|
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, phpEntityAccessor, seededList, litPair, matchExampleItems, requestExampleItems } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -51,7 +51,7 @@ const ReadmeTopTest = cmp(function ReadmeTopTest(props: any) {
|
|
|
51
51
|
litPair('php', it.name, it.name === idF ? '"test01"' : phpLit(it.type))).join(', ')}]`
|
|
52
52
|
: ''
|
|
53
53
|
} else if ('create' === primaryOp || 'update' === primaryOp || 'patch' === primaryOp) {
|
|
54
|
-
const items =
|
|
54
|
+
const items = requestExampleItems(exampleEntity, primaryOp)
|
|
55
55
|
.filter((it: any) => it.name !== idF && it.name !== 'id')
|
|
56
56
|
const required = items.filter((it: any) => !it.optional)
|
|
57
57
|
const chosen = required.length ? required : items.slice(0, 3)
|
|
@@ -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 { formatPhpValue } from './utility_php'
|
|
25
30
|
|
|
26
31
|
|
|
27
32
|
// Blocked without the ids its request needs, rather than sent with null.
|
|
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 (!empty($setup["live"]) && getenv(${formatPhpValue(LIVE_GETONLY_ENV)}) === "TRUE" && null === ($setup["idmap"][${formatPhpValue(miss.key)}] ?? null)) {
|
|
37
|
+
fwrite(STDOUT, ${formatPhpValue(liveExcludedLines({ excluded: [miss] })[0])} . "\\n");
|
|
38
|
+
$this->markTestSkipped(${formatPhpValue(liveExcludedSummary({ excluded: [miss] }))});
|
|
39
|
+
}
|
|
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
|
foreach ([${keys.map((k) => JSON.stringify(k)).join(', ')}] as $_liveKey) {
|
|
@@ -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}"] = ${formatPhpValue(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}"] = ${formatPhpValue(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'
|
|
@@ -211,10 +223,11 @@ ${liveStrictNote(liveStrict(model, target.name), '//', ' ')}
|
|
|
211
223
|
$this->markTestSkipped($_reason ?? "skipped via sdk-test-control.json");
|
|
212
224
|
return;
|
|
213
225
|
}
|
|
214
|
-
${liveKeysBlock(listParams.map(liveKey), entidEnvVar)} $client = $setup["client"];
|
|
226
|
+
${getOnlyKeysBlock(model, entity, 'direct-list-' + entity.name, listParams.map(liveKey))}${liveKeysBlock(listParams.map(liveKey), entidEnvVar)} $client = $setup["client"];
|
|
215
227
|
|
|
216
228
|
$params = [];
|
|
217
|
-
|
|
229
|
+
$query = [];
|
|
230
|
+
${listLiveQueryLines ? ' if ($setup["live"]) {\n' + listLiveQueryLines + ' }\n' : ''}`)
|
|
218
231
|
listParams.forEach((lp: any, i: number) => {
|
|
219
232
|
Content(` $params["${lp.n}"] = $setup["live"] ? ($setup["idmap"]["${liveKey(lp)}"] ?? null) : "direct0${i + 1}";
|
|
220
233
|
`)
|
|
@@ -224,6 +237,7 @@ ${liveKeysBlock(listParams.map(liveKey), entidEnvVar)} $client = $setup["
|
|
|
224
237
|
"path" => "${listPath}",
|
|
225
238
|
"method" => "GET",
|
|
226
239
|
"params" => $params,
|
|
240
|
+
"query" => $query,
|
|
227
241
|
]);
|
|
228
242
|
if ($setup["live"]) {
|
|
229
243
|
if (!self::liveOk($result)) {
|
|
@@ -268,7 +282,7 @@ ${liveKeysBlock(listParams.map(liveKey), entidEnvVar)} $client = $setup["
|
|
|
268
282
|
$this->markTestSkipped($_reason ?? "skipped via sdk-test-control.json");
|
|
269
283
|
return;
|
|
270
284
|
}
|
|
271
|
-
${liveKeysBlock([...new Set(loadLiveIdKeys)], entidEnvVar)} $client = $setup["client"];
|
|
285
|
+
${getOnlyKeysBlock(model, entity, 'direct-load-' + entity.name, [...new Set(loadLiveIdKeys)])}${liveKeysBlock([...new Set(loadLiveIdKeys)], entidEnvVar)} $client = $setup["client"];
|
|
272
286
|
|
|
273
287
|
$params = [];
|
|
274
288
|
$query = [];
|
|
@@ -371,7 +385,10 @@ function ${entity.name}_direct_setup($mockres)
|
|
|
371
385
|
]);
|
|
372
386
|
$client = new ${model.const.Name}SDK($merged_opts);
|
|
373
387
|
$idmap = $env["${entidEnvVar}"] ?? [];
|
|
374
|
-
|
|
388
|
+
${0 === exampleIds.length ? '' : ` // A path parameter's example stands in for an id *_ENTID does not give.
|
|
389
|
+
$idmap = array_merge([${exampleIds.map(([key, ex]) => `"${key}" => ${formatPhpValue(ex)}`).join(', ')}],
|
|
390
|
+
is_array($idmap) ? $idmap : []);
|
|
391
|
+
`} return [
|
|
375
392
|
"client" => $client,
|
|
376
393
|
"calls" => $calls,
|
|
377
394
|
"live" => true,
|