@voxgig/sdkgen 1.3.17 → 1.3.19
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/Deploy.js +16 -16
- package/dist/cmp/Deploy.js.map +1 -1
- package/dist/cmp/Entity.js +5 -1
- package/dist/cmp/Entity.js.map +1 -1
- package/dist/cmp/Feature.js +2 -1
- package/dist/cmp/Feature.js.map +1 -1
- package/dist/cmp/ReadmeTop.js +13 -11
- package/dist/cmp/ReadmeTop.js.map +1 -1
- package/dist/helpers/canonType.js +8 -3
- package/dist/helpers/canonType.js.map +1 -1
- package/dist/helpers/collectDeps.d.ts +1 -1
- package/dist/helpers/collectDeps.js +36 -13
- package/dist/helpers/collectDeps.js.map +1 -1
- package/dist/helpers/naming.d.ts +5 -1
- package/dist/helpers/naming.js +118 -0
- package/dist/helpers/naming.js.map +1 -1
- package/dist/helpers/opShape.d.ts +3 -1
- package/dist/helpers/opShape.js +87 -8
- package/dist/helpers/opShape.js.map +1 -1
- package/dist/helpers/serverVars.d.ts +10 -0
- package/dist/helpers/serverVars.js +87 -0
- package/dist/helpers/serverVars.js.map +1 -0
- package/dist/sdkgen.d.ts +4 -3
- package/dist/sdkgen.js +11 -2
- package/dist/sdkgen.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +15 -10
- package/project/.sdk/model/target/cpp.aontu +4 -4
- package/project/.sdk/model/target/go-cli.aontu +17 -17
- package/project/.sdk/model/target/go-mcp.aontu +11 -11
- package/project/.sdk/model/target/go.aontu +1 -1
- package/project/.sdk/model/target/java.aontu +4 -4
- package/project/.sdk/model/target/kotlin.aontu +4 -4
- package/project/.sdk/model/target/lean.aontu +51 -0
- package/project/.sdk/model/target/scala.aontu +4 -4
- package/project/.sdk/src/cmp/c/EntityTypes_c.ts +3 -4
- package/project/.sdk/src/cmp/c/Entity_c.ts +3 -3
- package/project/.sdk/src/cmp/c/ReadmeExamplesTest_c.ts +24 -7
- package/project/.sdk/src/cmp/c/TestDirect_c.ts +3 -3
- package/project/.sdk/src/cmp/c/TestEntity_c.ts +1 -1
- package/project/.sdk/src/cmp/clojure/Entity_clojure.ts +1 -1
- package/project/.sdk/src/cmp/clojure/ReadmeExamplesTest_clojure.ts +19 -8
- package/project/.sdk/src/cmp/cpp/EntityTypes_cpp.ts +2 -2
- package/project/.sdk/src/cmp/cpp/Entity_cpp.ts +3 -3
- package/project/.sdk/src/cmp/cpp/MainEntity_cpp.ts +2 -2
- package/project/.sdk/src/cmp/cpp/ReadmeExamplesTest_cpp.ts +136 -0
- package/project/.sdk/src/cmp/cpp/TestDirect_cpp.ts +3 -3
- package/project/.sdk/src/cmp/cpp/Test_cpp.ts +4 -0
- package/project/.sdk/src/cmp/csharp/EntityTypes_csharp.ts +2 -3
- package/project/.sdk/src/cmp/csharp/Entity_csharp.ts +3 -3
- package/project/.sdk/src/cmp/csharp/MainEntity_csharp.ts +2 -2
- package/project/.sdk/src/cmp/csharp/Package_csharp.ts +1 -1
- package/project/.sdk/src/cmp/csharp/ReadmeExamplesTest_csharp.ts +13 -1
- package/project/.sdk/src/cmp/csharp/TestDirect_csharp.ts +3 -3
- package/project/.sdk/src/cmp/csharp/TestEntity_csharp.ts +22 -15
- package/project/.sdk/src/cmp/dart/EntityTypes_dart.ts +2 -3
- package/project/.sdk/src/cmp/dart/Entity_dart.ts +3 -3
- package/project/.sdk/src/cmp/dart/MainEntity_dart.ts +2 -2
- package/project/.sdk/src/cmp/dart/Main_dart.ts +3 -3
- package/project/.sdk/src/cmp/dart/Package_dart.ts +1 -1
- package/project/.sdk/src/cmp/dart/TestDirect_dart.ts +4 -4
- package/project/.sdk/src/cmp/elixir/EntityTypes_elixir.ts +2 -3
- package/project/.sdk/src/cmp/elixir/Entity_elixir.ts +1 -1
- package/project/.sdk/src/cmp/elixir/ReadmeExamplesTest_elixir.ts +21 -3
- package/project/.sdk/src/cmp/go/Config_go.ts +14 -2
- package/project/.sdk/src/cmp/go/EntityTypes_go.ts +110 -18
- package/project/.sdk/src/cmp/go/Entity_go.ts +3 -3
- package/project/.sdk/src/cmp/go/Main_go.ts +7 -6
- package/project/.sdk/src/cmp/go/Package_go.ts +1 -1
- package/project/.sdk/src/cmp/go/TestDirect_go.ts +3 -3
- package/project/.sdk/src/cmp/go/TestEntity_go.ts +1 -1
- package/project/.sdk/src/cmp/go/utility_go.ts +25 -0
- package/project/.sdk/src/cmp/go-cli/Main_go-cli.ts +62 -35
- package/project/.sdk/src/cmp/go-cli/fragment/main.fragment.go +7 -7
- package/project/.sdk/src/cmp/go-cli/fragment/words.fragment.go +21 -18
- package/project/.sdk/src/cmp/go-mcp/Main_go-mcp.ts +9 -1
- package/project/.sdk/src/cmp/haskell/ReadmeExamplesTest_haskell.ts +28 -18
- package/project/.sdk/src/cmp/java/EntityTypes_java.ts +2 -3
- package/project/.sdk/src/cmp/java/Entity_java.ts +3 -3
- package/project/.sdk/src/cmp/java/MainEntity_java.ts +2 -2
- package/project/.sdk/src/cmp/java/Package_java.ts +1 -1
- package/project/.sdk/src/cmp/java/ReadmeExamplesTest_java.ts +23 -1
- package/project/.sdk/src/cmp/java/TestDirect_java.ts +3 -3
- package/project/.sdk/src/cmp/js/Config_js.ts +11 -0
- package/project/.sdk/src/cmp/js/EntityTypes_js.ts +2 -3
- package/project/.sdk/src/cmp/js/Entity_js.ts +3 -3
- package/project/.sdk/src/cmp/js/MainEntity_js.ts +2 -2
- package/project/.sdk/src/cmp/js/Main_js.ts +2 -2
- package/project/.sdk/src/cmp/js/TestDirect_js.ts +4 -4
- package/project/.sdk/src/cmp/js/fragment/Config.fragment.js +2 -2
- package/project/.sdk/src/cmp/js/fragment/Direct.test.fragment.js +4 -0
- package/project/.sdk/src/cmp/kotlin/EntityTypes_kotlin.ts +2 -3
- package/project/.sdk/src/cmp/kotlin/Entity_kotlin.ts +3 -3
- package/project/.sdk/src/cmp/kotlin/MainEntity_kotlin.ts +2 -2
- package/project/.sdk/src/cmp/kotlin/Package_kotlin.ts +1 -1
- package/project/.sdk/src/cmp/kotlin/ReadmeExamplesTest_kotlin.ts +27 -2
- package/project/.sdk/src/cmp/kotlin/TestDirect_kotlin.ts +3 -3
- package/project/.sdk/src/cmp/lean/Config_lean.ts +88 -0
- package/project/.sdk/src/cmp/lean/Entity_lean.ts +9 -0
- package/project/.sdk/src/cmp/lean/Gitignore_lean.ts +18 -0
- package/project/.sdk/src/cmp/lean/Main_lean.ts +120 -0
- package/project/.sdk/src/cmp/lean/Package_lean.ts +68 -0
- package/project/.sdk/src/cmp/lean/ReadmeEntity_lean.ts +29 -0
- package/project/.sdk/src/cmp/lean/ReadmeExplanation_lean.ts +19 -0
- package/project/.sdk/src/cmp/lean/ReadmeHowto_lean.ts +25 -0
- package/project/.sdk/src/cmp/lean/ReadmeInstall_lean.ts +38 -0
- package/project/.sdk/src/cmp/lean/ReadmeIntro_lean.ts +25 -0
- package/project/.sdk/src/cmp/lean/ReadmeModel_lean.ts +24 -0
- package/project/.sdk/src/cmp/lean/ReadmeOptions_lean.ts +22 -0
- package/project/.sdk/src/cmp/lean/ReadmeQuick_lean.ts +50 -0
- package/project/.sdk/src/cmp/lean/ReadmeRef_lean.ts +16 -0
- package/project/.sdk/src/cmp/lean/ReadmeTopHowto_lean.ts +16 -0
- package/project/.sdk/src/cmp/lean/ReadmeTopQuick_lean.ts +23 -0
- package/project/.sdk/src/cmp/lean/ReadmeTopTest_lean.ts +18 -0
- package/project/.sdk/src/cmp/lean/Test_lean.ts +207 -0
- package/project/.sdk/src/cmp/lean/utility_lean.ts +78 -0
- package/project/.sdk/src/cmp/lua/Config_lua.ts +10 -1
- package/project/.sdk/src/cmp/lua/EntityTypes_lua.ts +2 -3
- package/project/.sdk/src/cmp/lua/Entity_lua.ts +3 -3
- package/project/.sdk/src/cmp/lua/Package_lua.ts +1 -1
- package/project/.sdk/src/cmp/lua/TestDirect_lua.ts +3 -3
- package/project/.sdk/src/cmp/lua/TestEntity_lua.ts +1 -1
- package/project/.sdk/src/cmp/ocaml/ReadmeExamplesTest_ocaml.ts +29 -14
- package/project/.sdk/src/cmp/perl/Entity_perl.ts +3 -3
- package/project/.sdk/src/cmp/perl/MainEntity_perl.ts +2 -2
- package/project/.sdk/src/cmp/perl/Package_perl.ts +1 -1
- package/project/.sdk/src/cmp/perl/TestDirect_perl.ts +3 -3
- package/project/.sdk/src/cmp/php/Config_php.ts +13 -2
- package/project/.sdk/src/cmp/php/EntityTypes_php.ts +2 -3
- package/project/.sdk/src/cmp/php/Entity_php.ts +3 -3
- package/project/.sdk/src/cmp/php/MainEntity_php.ts +2 -2
- package/project/.sdk/src/cmp/php/Package_php.ts +1 -1
- package/project/.sdk/src/cmp/php/TestDirect_php.ts +3 -3
- package/project/.sdk/src/cmp/php/TestEntity_php.ts +1 -1
- package/project/.sdk/src/cmp/py/Config_py.ts +10 -1
- package/project/.sdk/src/cmp/py/EntityTypes_py.ts +2 -3
- package/project/.sdk/src/cmp/py/Entity_py.ts +3 -3
- package/project/.sdk/src/cmp/py/MainEntity_py.ts +2 -2
- package/project/.sdk/src/cmp/py/Main_py.ts +2 -2
- package/project/.sdk/src/cmp/py/Package_py.ts +1 -1
- package/project/.sdk/src/cmp/py/TestDirect_py.ts +3 -3
- package/project/.sdk/src/cmp/py/TestEntity_py.ts +1 -1
- package/project/.sdk/src/cmp/rb/Config_rb.ts +12 -1
- package/project/.sdk/src/cmp/rb/EntityTypes_rb.ts +15 -5
- package/project/.sdk/src/cmp/rb/Entity_rb.ts +3 -3
- package/project/.sdk/src/cmp/rb/MainEntity_rb.ts +2 -2
- package/project/.sdk/src/cmp/rb/Package_rb.ts +2 -2
- package/project/.sdk/src/cmp/rb/TestDirect_rb.ts +3 -3
- package/project/.sdk/src/cmp/rb/TestEntity_rb.ts +1 -1
- package/project/.sdk/src/cmp/rust/EntityBase_rust.ts +2 -2
- package/project/.sdk/src/cmp/rust/EntityTypes_rust.ts +3 -4
- package/project/.sdk/src/cmp/rust/Entity_rust.ts +3 -3
- package/project/.sdk/src/cmp/rust/MainEntity_rust.ts +2 -2
- package/project/.sdk/src/cmp/rust/Package_rust.ts +1 -1
- package/project/.sdk/src/cmp/rust/ReadmeExamplesTest_rust.ts +22 -10
- package/project/.sdk/src/cmp/rust/TestDirect_rust.ts +3 -3
- package/project/.sdk/src/cmp/rust/TestEntity_rust.ts +25 -18
- package/project/.sdk/src/cmp/scala/EntityTypes_scala.ts +2 -3
- package/project/.sdk/src/cmp/scala/Entity_scala.ts +3 -3
- package/project/.sdk/src/cmp/scala/MainEntity_scala.ts +2 -2
- package/project/.sdk/src/cmp/scala/ReadmeExamplesTest_scala.ts +22 -3
- package/project/.sdk/src/cmp/scala/TestDirect_scala.ts +3 -3
- package/project/.sdk/src/cmp/scala/Test_scala.ts +1 -1
- package/project/.sdk/src/cmp/swift/EntityTypes_swift.ts +12 -6
- package/project/.sdk/src/cmp/swift/Entity_swift.ts +3 -3
- package/project/.sdk/src/cmp/swift/MainEntity_swift.ts +2 -2
- package/project/.sdk/src/cmp/swift/Package_swift.ts +1 -1
- package/project/.sdk/src/cmp/swift/ReadmeExamplesTest_swift.ts +18 -1
- package/project/.sdk/src/cmp/swift/TestDirect_swift.ts +1 -1
- package/project/.sdk/src/cmp/ts/Config_ts.ts +11 -0
- package/project/.sdk/src/cmp/ts/EntityTypes_ts.ts +2 -3
- package/project/.sdk/src/cmp/ts/Entity_ts.ts +3 -3
- package/project/.sdk/src/cmp/ts/MainEntity_ts.ts +2 -2
- package/project/.sdk/src/cmp/ts/Main_ts.ts +2 -2
- package/project/.sdk/src/cmp/ts/TestDirect_ts.ts +4 -4
- package/project/.sdk/src/cmp/ts/fragment/Config.fragment.ts +2 -2
- package/project/.sdk/src/cmp/ts/fragment/Direct.test.fragment.ts +4 -0
- package/project/.sdk/src/cmp/zig/Entity_zig.ts +3 -3
- package/project/.sdk/src/cmp/zig/MainEntity_zig.ts +2 -2
- package/project/.sdk/src/cmp/zig/Package_zig.ts +10 -2
- package/project/.sdk/tm/cpp/test/primary_utility_test.cpp +8 -16
- package/project/.sdk/tm/csharp/Makefile +6 -6
- package/project/.sdk/tm/csharp/test/PrimaryUtilityTest.cs +10 -28
- package/project/.sdk/tm/dart/Makefile +3 -3
- package/project/.sdk/tm/dart/test/primary_test.dart +7 -0
- package/project/.sdk/tm/go/Makefile +6 -6
- package/project/.sdk/tm/go/feature/test_feature.go +33 -1
- package/project/.sdk/tm/go/test/primary_utility_test.go +46 -42
- package/project/.sdk/tm/go/test/runner_test.go +30 -1
- package/project/.sdk/tm/go/utility/make_options.go +48 -0
- package/project/.sdk/tm/java/Makefile +6 -6
- package/project/.sdk/tm/java/test/PrimaryUtilityTest.java +7 -24
- package/project/.sdk/tm/js/Makefile +6 -6
- package/project/.sdk/tm/js/src/feature/test/TestFeature.js +18 -1
- package/project/.sdk/tm/js/src/utility/MakeOptionsUtility.js +39 -1
- package/project/.sdk/tm/js/test/utility/PrimaryUtility.test.js +13 -0
- package/project/.sdk/tm/kotlin/Makefile +6 -6
- package/project/.sdk/tm/kotlin/test/PrimaryUtilityTest.kt +7 -20
- package/project/.sdk/tm/lean/LICENSE +21 -0
- package/project/.sdk/tm/lean/VERSION +1 -0
- package/project/.sdk/tm/lean/src/SdkFeature.lean +171 -0
- package/project/.sdk/tm/lean/src/SdkFeatures.lean +602 -0
- package/project/.sdk/tm/lean/src/SdkJson.lean +134 -0
- package/project/.sdk/tm/lean/src/SdkRuntime.lean +356 -0
- package/project/.sdk/tm/lean/src/SdkUtility.lean +617 -0
- package/project/.sdk/tm/lean/src/VoxgigStruct.lean +2880 -0
- package/project/.sdk/tm/lean/src/Vregex.lean +412 -0
- package/project/.sdk/tm/lean/src/feature/README.md +5 -0
- package/project/.sdk/tm/lean/src/feature/audit/.gitkeep +0 -0
- package/project/.sdk/tm/lean/src/feature/base/.gitkeep +0 -0
- package/project/.sdk/tm/lean/src/feature/cache/.gitkeep +0 -0
- package/project/.sdk/tm/lean/src/feature/clienttrack/.gitkeep +0 -0
- package/project/.sdk/tm/lean/src/feature/debug/.gitkeep +0 -0
- package/project/.sdk/tm/lean/src/feature/idempotency/.gitkeep +0 -0
- package/project/.sdk/tm/lean/src/feature/log/.gitkeep +0 -0
- package/project/.sdk/tm/lean/src/feature/metrics/.gitkeep +0 -0
- package/project/.sdk/tm/lean/src/feature/netsim/.gitkeep +0 -0
- package/project/.sdk/tm/lean/src/feature/paging/.gitkeep +0 -0
- package/project/.sdk/tm/lean/src/feature/proxy/.gitkeep +0 -0
- package/project/.sdk/tm/lean/src/feature/ratelimit/.gitkeep +0 -0
- package/project/.sdk/tm/lean/src/feature/rbac/.gitkeep +0 -0
- package/project/.sdk/tm/lean/src/feature/retry/.gitkeep +0 -0
- package/project/.sdk/tm/lean/src/feature/streaming/.gitkeep +0 -0
- package/project/.sdk/tm/lean/src/feature/telemetry/.gitkeep +0 -0
- package/project/.sdk/tm/lean/src/feature/test/.gitkeep +0 -0
- package/project/.sdk/tm/lean/src/feature/timeout/.gitkeep +0 -0
- package/project/.sdk/tm/lean/test/StructCorpus.lean +697 -0
- package/project/.sdk/tm/lean/test/TFeature.lean +268 -0
- package/project/.sdk/tm/lean/test/TPrimaryUtility.lean +349 -0
- package/project/.sdk/tm/lua/Makefile +7 -7
- package/project/.sdk/tm/lua/feature/test_feature.lua +29 -1
- package/project/.sdk/tm/lua/test/primary_utility_test.lua +14 -8
- package/project/.sdk/tm/lua/utility/make_options.lua +39 -0
- package/project/.sdk/tm/perl/Makefile +6 -6
- package/project/.sdk/tm/perl/t/primary_utility.t +8 -17
- package/project/.sdk/tm/php/Makefile +6 -6
- package/project/.sdk/tm/php/feature/TestFeature.php +30 -2
- package/project/.sdk/tm/php/test/PrimaryUtilityTest.php +14 -7
- package/project/.sdk/tm/php/utility/MakeOptions.php +44 -0
- package/project/.sdk/tm/py/Makefile +6 -6
- package/project/.sdk/tm/py/feature/test_feature.py +28 -1
- package/project/.sdk/tm/py/test/test_primary_utility.py +18 -18
- package/project/.sdk/tm/py/utility/make_options.py +42 -0
- package/project/.sdk/tm/rb/Makefile +6 -6
- package/project/.sdk/tm/rb/feature/test_feature.rb +24 -1
- package/project/.sdk/tm/rb/test/primary_utility_test.rb +11 -8
- package/project/.sdk/tm/rb/utility/make_options.rb +37 -0
- package/project/.sdk/tm/rust/Makefile +6 -6
- package/project/.sdk/tm/rust/tests/common/mod.rs +37 -1
- package/project/.sdk/tm/rust/tests/primary_utility_test.rs +12 -26
- package/project/.sdk/tm/swift/Makefile +6 -6
- package/project/.sdk/tm/swift/Tests/ProjectNameSDKTests/PrimaryUtilityTest.swift +7 -8
- package/project/.sdk/tm/ts/Makefile +6 -6
- package/project/.sdk/tm/ts/src/feature/test/TestFeature.ts +18 -1
- package/project/.sdk/tm/ts/src/utility/MakeOptionsUtility.ts +39 -1
- package/project/.sdk/tm/ts/test/utility/PrimaryUtility.test.ts +69 -21
- package/src/cmp/Deploy.ts +16 -16
- package/src/cmp/Entity.ts +5 -1
- package/src/cmp/Feature.ts +2 -1
- package/src/cmp/ReadmeTop.ts +13 -11
- package/src/helpers/canonType.ts +8 -3
- package/src/helpers/collectDeps.ts +39 -12
- package/src/helpers/naming.ts +130 -0
- package/src/helpers/opShape.ts +99 -12
- package/src/helpers/serverVars.ts +105 -0
- package/src/sdkgen.ts +12 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
import { cmp, Content, entityClassName } from '@voxgig/sdkgen'
|
|
3
|
+
import { cmp, Content, entityClassName, entityCollection } from '@voxgig/sdkgen'
|
|
4
4
|
|
|
5
5
|
import {
|
|
6
6
|
KIT,
|
|
@@ -14,7 +14,7 @@ const MainEntity = cmp(async function MainEntity(props: any) {
|
|
|
14
14
|
|
|
15
15
|
// Return the collision-free class TYPE (entityClassName); the accessor METHOD
|
|
16
16
|
// name (entity.Name) is unchanged so callers still write client.<Name>().
|
|
17
|
-
const cls = entityClassName(entity,
|
|
17
|
+
const cls = entityClassName(entity, entityCollection(model))
|
|
18
18
|
|
|
19
19
|
Content(`
|
|
20
20
|
// Entity access: \`client.${entity.Name}().list()\` / \`client.${entity.Name}().load({ id })\`.
|
|
@@ -4,7 +4,7 @@ import * as Path from 'node:path'
|
|
|
4
4
|
import {
|
|
5
5
|
cmp, each, names, cmap,
|
|
6
6
|
List, File, Content, Copy, Folder, Fragment, Line, FeatureHook,
|
|
7
|
-
entityClassName,
|
|
7
|
+
entityClassName, entityCollection,
|
|
8
8
|
} from '@voxgig/sdkgen'
|
|
9
9
|
|
|
10
10
|
|
|
@@ -57,7 +57,7 @@ const Main = cmp(async function Main(props: any) {
|
|
|
57
57
|
Line(`// ${model.const.Name} ${target.Name} SDK\n`)
|
|
58
58
|
|
|
59
59
|
List({ item: entity }, ({ item }: any) => {
|
|
60
|
-
const cls = entityClassName(item,
|
|
60
|
+
const cls = entityClassName(item, entityCollection(model))
|
|
61
61
|
return Line(`import { ${cls} } from './entity/${cls}'`)
|
|
62
62
|
})
|
|
63
63
|
|
|
@@ -49,7 +49,7 @@ const TestDirect = cmp(function TestDirect(props: any) {
|
|
|
49
49
|
apikey: env.${PROJECTNAME}_APIKEY,`
|
|
50
50
|
: ''
|
|
51
51
|
|
|
52
|
-
const opnames = Object.keys(entity.op)
|
|
52
|
+
const opnames = Object.keys(entity.op || {})
|
|
53
53
|
const hasLoad = opnames.includes('load')
|
|
54
54
|
const hasList = opnames.includes('list')
|
|
55
55
|
|
|
@@ -151,7 +151,7 @@ function unwrapListData(data: any): any[] | null {
|
|
|
151
151
|
|
|
152
152
|
|
|
153
153
|
function generateDirectLoad(model: Model, entity: ModelEntity) {
|
|
154
|
-
const loadOp = entity.op
|
|
154
|
+
const loadOp = entity.op?.load
|
|
155
155
|
const loadPoint: ModelPoint | undefined = loadOp?.points?.[0]
|
|
156
156
|
|
|
157
157
|
if (null == loadPoint) {
|
|
@@ -198,7 +198,7 @@ function generateDirectLoad(model: Model, entity: ModelEntity) {
|
|
|
198
198
|
.join('\n')
|
|
199
199
|
|
|
200
200
|
// Get list info for live mode bootstrapping
|
|
201
|
-
const listOp = entity.op
|
|
201
|
+
const listOp = entity.op?.list
|
|
202
202
|
const listPoint = listOp?.points?.[0]
|
|
203
203
|
const listParams = listPoint?.args?.params || []
|
|
204
204
|
const listPath = listPoint ? normalizePathParams(listPoint.parts || [], listParams, listPoint.rename?.param) : ''
|
|
@@ -356,7 +356,7 @@ ${paramAsserts} }
|
|
|
356
356
|
|
|
357
357
|
|
|
358
358
|
function generateDirectList(model: Model, entity: ModelEntity) {
|
|
359
|
-
const listOp = entity.op
|
|
359
|
+
const listOp = entity.op?.list
|
|
360
360
|
const listPoint: ModelPoint | undefined = listOp?.points?.[0]
|
|
361
361
|
|
|
362
362
|
if (null == listPoint) {
|
|
@@ -19,7 +19,7 @@ class Config {
|
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
main = {
|
|
22
|
-
name: '
|
|
22
|
+
name: '$$const.Name$$',
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
|
|
@@ -31,7 +31,7 @@ class Config {
|
|
|
31
31
|
options = {
|
|
32
32
|
base: '$$main.kit.info.servers.0.url$$',
|
|
33
33
|
|
|
34
|
-
'AUTHBLOCK'headers: 'HEADERS',
|
|
34
|
+
'SERVERBLOCK''AUTHBLOCK'headers: 'HEADERS',
|
|
35
35
|
|
|
36
36
|
entity: {
|
|
37
37
|
// #EntityConfigs
|
|
@@ -24,6 +24,10 @@ describe('EntityNameDirect', async () => {
|
|
|
24
24
|
|
|
25
25
|
test('direct-exists', async () => {
|
|
26
26
|
const sdk = new ProjectNameSDK({
|
|
27
|
+
// Concrete base: a live construction must satisfy any server
|
|
28
|
+
// variables a templated base URL declares; overriding base with a
|
|
29
|
+
// literal (as the direct flow tests do) sidesteps the requirement.
|
|
30
|
+
base: 'http://localhost:8080',
|
|
27
31
|
system: { fetch: async () => ({}) }
|
|
28
32
|
})
|
|
29
33
|
assert('function' === typeof sdk.direct)
|
|
@@ -4,7 +4,7 @@ import * as Path from 'node:path'
|
|
|
4
4
|
import {
|
|
5
5
|
cmp, camelify,
|
|
6
6
|
File, Content, Folder, Fragment,
|
|
7
|
-
entityClassName,
|
|
7
|
+
entityClassName, entityCollection,
|
|
8
8
|
} from '@voxgig/sdkgen'
|
|
9
9
|
|
|
10
10
|
import {
|
|
@@ -20,7 +20,7 @@ const Entity = cmp(function Entity(props: any) {
|
|
|
20
20
|
const { model, stdrep } = props.ctx$
|
|
21
21
|
const { target, entity } = props
|
|
22
22
|
|
|
23
|
-
const entityColl =
|
|
23
|
+
const entityColl = entityCollection(model)
|
|
24
24
|
const cls = entityClassName(entity, entityColl)
|
|
25
25
|
|
|
26
26
|
const entrep = {
|
|
@@ -34,7 +34,7 @@ const Entity = cmp(function Entity(props: any) {
|
|
|
34
34
|
|
|
35
35
|
File({ name: zigVarName(entity.name) + '.' + target.ext }, () => {
|
|
36
36
|
|
|
37
|
-
const opnames = Object.keys(entity.op)
|
|
37
|
+
const opnames = Object.keys(entity.op || {})
|
|
38
38
|
|
|
39
39
|
// For each CRUD op: if the spec defines it, splice in the real
|
|
40
40
|
// implementation. Otherwise emit a stub returning the unsupported_op
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, Content, entityClassName } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, Content, entityClassName, entityCollection } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -16,7 +16,7 @@ const MainEntity = cmp(async function MainEntity(props: any) {
|
|
|
16
16
|
const { entity } = props
|
|
17
17
|
const { model } = props.ctx$
|
|
18
18
|
|
|
19
|
-
const entityColl =
|
|
19
|
+
const entityColl = entityCollection(model)
|
|
20
20
|
const cls = entityClassName(entity, entityColl)
|
|
21
21
|
const method = zigVarName(entity.name)
|
|
22
22
|
const mod = zigVarName(entity.name)
|
|
@@ -23,8 +23,16 @@ import { zigModuleName } from './utility_zig'
|
|
|
23
23
|
//
|
|
24
24
|
// The `.paths` allow-list mirrors the (registry-less) template: it only
|
|
25
25
|
// matters when packaging for a registry, which zig does not do, so it is kept
|
|
26
|
-
// stable. `.name` is a plain string here
|
|
27
|
-
//
|
|
26
|
+
// stable. `.name` is a plain string here rather than the newer enum-literal +
|
|
27
|
+
// fingerprint form.
|
|
28
|
+
//
|
|
29
|
+
// TOOLCHAIN PIN: the string form REQUIRES zig <= 0.13. Zig 0.14 rejects it
|
|
30
|
+
// outright — `build.zig.zon:2:13: error: expected enum literal` — so the
|
|
31
|
+
// generated SDK will not build at all on a newer toolchain. The consumer CI
|
|
32
|
+
// job pins 0.13.0 to match (create-sdkgen
|
|
33
|
+
// project/standard/.github/workflows/ci.yml). Moving to a newer zig means
|
|
34
|
+
// changing BOTH: `.name = .${name}` plus a `.fingerprint` here, and the CI
|
|
35
|
+
// pin there.
|
|
28
36
|
const Package = cmp(async function Package(props: any) {
|
|
29
37
|
const ctx$ = props.ctx$
|
|
30
38
|
const model: Model = ctx$.model
|
|
@@ -669,23 +669,16 @@ static void prepareParamsBasic() {
|
|
|
669
669
|
// --- preparePath ------------------------------------------------------------
|
|
670
670
|
|
|
671
671
|
static void preparePathBasic() {
|
|
672
|
+
// Was hand-written cases that had drifted out of the shared corpus (the
|
|
673
|
+
// preparePath fixture shipped as an empty `set: []`).
|
|
672
674
|
auto c = client();
|
|
673
675
|
UtilityPtr utility = c->getUtility();
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
}
|
|
680
|
-
|
|
681
|
-
static void preparePathSingle() {
|
|
682
|
-
auto c = client();
|
|
683
|
-
UtilityPtr utility = c->getUtility();
|
|
684
|
-
CtxPtr ctx = makeTestFullCtx(c, utility);
|
|
685
|
-
ctx->point = fhMap({
|
|
686
|
-
{"parts", vlist({Value("items")})},
|
|
687
|
-
{"args", fhMap({{"params", vlist()}})}});
|
|
688
|
-
ASSERT_EQ(utility->preparePath(ctx), std::string("items"), "expected items");
|
|
676
|
+
rs::runset("preparePath-basic", rs::get_spec(primary(), {"preparePath", "basic"}),
|
|
677
|
+
[&](const Value& entry) -> Value {
|
|
678
|
+
Value ctxmap = Helpers::toMapAny(getp(entry, "ctx"));
|
|
679
|
+
CtxPtr ctx = rs::make_ctx_from_map(ctxmap, c, utility);
|
|
680
|
+
return Value(utility->preparePath(ctx));
|
|
681
|
+
});
|
|
689
682
|
}
|
|
690
683
|
|
|
691
684
|
// --- prepareQuery -----------------------------------------------------------
|
|
@@ -830,7 +823,6 @@ int main() {
|
|
|
830
823
|
T_RUN(prepareMethodBasic);
|
|
831
824
|
T_RUN(prepareParamsBasic);
|
|
832
825
|
T_RUN(preparePathBasic);
|
|
833
|
-
T_RUN(preparePathSingle);
|
|
834
826
|
T_RUN(prepareQueryBasic);
|
|
835
827
|
T_RUN(resultBasicBasic);
|
|
836
828
|
T_RUN(resultBodyBasic);
|
|
@@ -15,21 +15,21 @@ clean:
|
|
|
15
15
|
# publishing a version currently means pushing the tag csharp/vX.Y.Z. When the
|
|
16
16
|
# registry goes live, `dotnet pack` + `dotnet nuget push` slot in before the
|
|
17
17
|
# tag (mirroring the voxgig/struct csharp Makefile). Run headless under the
|
|
18
|
-
#
|
|
18
|
+
# boru key vault, which injects the GitHub token so nothing lands on disk or
|
|
19
19
|
# argv:
|
|
20
|
-
#
|
|
21
|
-
#
|
|
20
|
+
# boru vault exec --for=github=<alias> -- make publish
|
|
21
|
+
# boru `--dry-run` injects a filler token we detect to rehearse (no tag/push).
|
|
22
22
|
# set -e + tag-last: a failed push never leaves a tag behind.
|
|
23
23
|
VERSION := $(shell cat VERSION)
|
|
24
24
|
TAG := csharp/v$(VERSION)
|
|
25
|
-
|
|
25
|
+
BORU_DRY_RUN_FILLER := BORU-DRY-RUN-FILLER-NOT-A-REAL-SECRET
|
|
26
26
|
publish: test
|
|
27
27
|
@if git rev-parse -q --verify "refs/tags/$(TAG)" >/dev/null; then \
|
|
28
28
|
echo "tag $(TAG) already exists — bump VERSION first"; exit 1; fi
|
|
29
29
|
@set -e; \
|
|
30
30
|
token="$${GITHUB_TOKEN:-$$GH_TOKEN}"; \
|
|
31
|
-
if [ "$$token" = "$(
|
|
32
|
-
echo "[dry-run]
|
|
31
|
+
if [ "$$token" = "$(BORU_DRY_RUN_FILLER)" ]; then \
|
|
32
|
+
echo "[dry-run] boru filler token detected: would tag $(TAG); nothing pushed."; \
|
|
33
33
|
exit 0; \
|
|
34
34
|
fi; \
|
|
35
35
|
git tag -a "$(TAG)" -m "csharp v$(VERSION)"; \
|
|
@@ -789,38 +789,20 @@ public class PrimaryUtilityTest
|
|
|
789
789
|
});
|
|
790
790
|
}
|
|
791
791
|
|
|
792
|
+
// Was two hand-written cases that had drifted out of the shared corpus
|
|
793
|
+
// (the preparePath fixture shipped as an empty `set: []`). Now driven by
|
|
794
|
+
// the corpus like every other section, so all ports assert the same
|
|
795
|
+
// separator / blank-segment behaviour.
|
|
792
796
|
[Fact]
|
|
793
797
|
public void PreparePathBasic()
|
|
794
798
|
{
|
|
795
|
-
|
|
796
|
-
ctx.Point = new Dictionary<string, object?>
|
|
799
|
+
TestRunner.RunSet(TestRunner.GetSpec(_primary, "preparePath", "basic"), entry =>
|
|
797
800
|
{
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
};
|
|
804
|
-
|
|
805
|
-
var path = _utility.PreparePath(ctx);
|
|
806
|
-
Assert.Equal("api/planet/{id}", path);
|
|
807
|
-
}
|
|
808
|
-
|
|
809
|
-
[Fact]
|
|
810
|
-
public void PreparePathSingle()
|
|
811
|
-
{
|
|
812
|
-
var ctx = MakeTestFullCtx(_client, _utility);
|
|
813
|
-
ctx.Point = new Dictionary<string, object?>
|
|
814
|
-
{
|
|
815
|
-
["parts"] = new List<object?> { "items" },
|
|
816
|
-
["args"] = new Dictionary<string, object?>
|
|
817
|
-
{
|
|
818
|
-
["params"] = new List<object?>(),
|
|
819
|
-
},
|
|
820
|
-
};
|
|
821
|
-
|
|
822
|
-
var path = _utility.PreparePath(ctx);
|
|
823
|
-
Assert.Equal("items", path);
|
|
801
|
+
var ctxmap = entry.TryGetValue("ctx", out var c)
|
|
802
|
+
? c as Dictionary<string, object?> : null;
|
|
803
|
+
var ctx = TestRunner.MakeCtxFromMap(ctxmap, _client, _utility);
|
|
804
|
+
return _utility.PreparePath(ctx);
|
|
805
|
+
});
|
|
824
806
|
}
|
|
825
807
|
|
|
826
808
|
[Fact]
|
|
@@ -22,14 +22,14 @@ clean:
|
|
|
22
22
|
# the tag. set -e + tag-last: a failed upload never leaves a tag behind.
|
|
23
23
|
VERSION := $(shell sed -nE 's/^version: *([0-9][^ ]*).*/\1/p' pubspec.yaml | head -1)
|
|
24
24
|
TAG := dart/v$(VERSION)
|
|
25
|
-
|
|
25
|
+
BORU_DRY_RUN_FILLER := BORU-DRY-RUN-FILLER-NOT-A-REAL-SECRET
|
|
26
26
|
publish: test
|
|
27
27
|
@if git rev-parse -q --verify "refs/tags/$(TAG)" >/dev/null; then \
|
|
28
28
|
echo "tag $(TAG) already exists — bump pubspec.yaml version first"; exit 1; fi
|
|
29
29
|
@set -e; \
|
|
30
30
|
token="$${GITHUB_TOKEN:-$$GH_TOKEN}"; \
|
|
31
|
-
if [ "$$token" = "$(
|
|
32
|
-
echo "[dry-run]
|
|
31
|
+
if [ "$$token" = "$(BORU_DRY_RUN_FILLER)" ]; then \
|
|
32
|
+
echo "[dry-run] boru filler token detected: would publish to pub.dev and tag $(TAG); nothing pushed."; \
|
|
33
33
|
exit 0; \
|
|
34
34
|
fi; \
|
|
35
35
|
if [ -n "$$PUB_CREDENTIALS" ]; then \
|
|
@@ -94,6 +94,13 @@ void tests() {
|
|
|
94
94
|
await _runset(_g('prepareQuery.basic'), _utility.prepareQuery);
|
|
95
95
|
});
|
|
96
96
|
|
|
97
|
+
// preparePath shipped as an empty `set: []`, so no port drove it and
|
|
98
|
+
// several kept private hand-written cases instead.
|
|
99
|
+
test('path-basic', (t) async {
|
|
100
|
+
await _setup();
|
|
101
|
+
await _runset(_g('preparePath.basic'), _utility.preparePath);
|
|
102
|
+
});
|
|
103
|
+
|
|
97
104
|
test('body-basic', (t) async {
|
|
98
105
|
await _setup();
|
|
99
106
|
await _runset(_g('prepareBody.basic'), (dynamic ctx) {
|
|
@@ -13,10 +13,10 @@ clean:
|
|
|
13
13
|
# Go modules have no registry upload — publishing a version means pushing the
|
|
14
14
|
# tag go/vX.Y.Z (this module is the go/ subdir, and Go's submodule-tag
|
|
15
15
|
# convention is <subdir>/vX.Y.Z), which the module proxy + pkg.go.dev pick up on
|
|
16
|
-
# first fetch. Run headless under the
|
|
16
|
+
# first fetch. Run headless under the boru key vault, which injects the GitHub
|
|
17
17
|
# token so nothing lands on disk or argv:
|
|
18
|
-
#
|
|
19
|
-
#
|
|
18
|
+
# boru vault exec --for=github=<alias> -- make publish
|
|
19
|
+
# boru `--dry-run` injects a filler token we detect to rehearse (no tag/push).
|
|
20
20
|
# set -e + tag-last: a failed push never leaves a tag behind.
|
|
21
21
|
#
|
|
22
22
|
# NOTE: publishing the git tag is deliberately NOT gated on `go test` (every
|
|
@@ -24,14 +24,14 @@ clean:
|
|
|
24
24
|
# block the module tag). Run `make test` separately in CI to gate quality.
|
|
25
25
|
VERSION := $(shell cat VERSION)
|
|
26
26
|
TAG := go/v$(VERSION)
|
|
27
|
-
|
|
27
|
+
BORU_DRY_RUN_FILLER := BORU-DRY-RUN-FILLER-NOT-A-REAL-SECRET
|
|
28
28
|
publish:
|
|
29
29
|
@if git rev-parse -q --verify "refs/tags/$(TAG)" >/dev/null; then \
|
|
30
30
|
echo "tag $(TAG) already exists — bump VERSION first"; exit 1; fi
|
|
31
31
|
@set -e; \
|
|
32
32
|
token="$${GITHUB_TOKEN:-$$GH_TOKEN}"; \
|
|
33
|
-
if [ "$$token" = "$(
|
|
34
|
-
echo "[dry-run]
|
|
33
|
+
if [ "$$token" = "$(BORU_DRY_RUN_FILLER)" ]; then \
|
|
34
|
+
echo "[dry-run] boru filler token detected: would tag $(TAG) for pkg.go.dev; nothing pushed."; \
|
|
35
35
|
exit 0; \
|
|
36
36
|
fi; \
|
|
37
37
|
git tag -a "$(TAG)" -m "go v$(VERSION)"; \
|
|
@@ -3,12 +3,17 @@ package feature
|
|
|
3
3
|
import (
|
|
4
4
|
"fmt"
|
|
5
5
|
"math/rand"
|
|
6
|
+
"regexp"
|
|
6
7
|
|
|
7
8
|
vs "github.com/voxgig/struct"
|
|
8
9
|
|
|
9
10
|
"GOMODULE/core"
|
|
10
11
|
)
|
|
11
12
|
|
|
13
|
+
// The `body.<key>` form of an op's response transform: the mock wraps its
|
|
14
|
+
// payload in <key> so the transform can unwrap it again.
|
|
15
|
+
var envelopeResRe = regexp.MustCompile("^`body\\.([^`.]+)`$")
|
|
16
|
+
|
|
12
17
|
type TestFeature struct {
|
|
13
18
|
BaseFeature
|
|
14
19
|
client *core.ProjectNameSDK
|
|
@@ -49,11 +54,38 @@ func (f *TestFeature) Init(ctx *core.Context, options map[string]any) {
|
|
|
49
54
|
self := f
|
|
50
55
|
|
|
51
56
|
testFetcher := func(ctx *core.Context, _fullurl string, _fetchdef map[string]any) (any, error) {
|
|
57
|
+
// Shape the mock payload the way the real API would, so the op's
|
|
58
|
+
// response transform recovers the entity from it. A point carrying
|
|
59
|
+
// `transform.res: ` + "`body.item`" + ` describes an API that answers
|
|
60
|
+
// {"item": {...}}; handing back the bare entity means the transform
|
|
61
|
+
// unwraps a property that is not there and the caller gets nil. The
|
|
62
|
+
// mock has to agree with the model, or it only ever simulates APIs
|
|
63
|
+
// whose responses happen to be unwrapped. Mirrors the ts mock.
|
|
64
|
+
envelope := func(data any) any {
|
|
65
|
+
if data == nil || ctx.Point == nil {
|
|
66
|
+
return data
|
|
67
|
+
}
|
|
68
|
+
tm, ok := ctx.Point["transform"].(map[string]any)
|
|
69
|
+
if !ok {
|
|
70
|
+
return data
|
|
71
|
+
}
|
|
72
|
+
restf, ok := tm["res"].(string)
|
|
73
|
+
if !ok {
|
|
74
|
+
return data
|
|
75
|
+
}
|
|
76
|
+
m := envelopeResRe.FindStringSubmatch(restf)
|
|
77
|
+
if m == nil {
|
|
78
|
+
return data
|
|
79
|
+
}
|
|
80
|
+
return map[string]any{m[1]: data}
|
|
81
|
+
}
|
|
82
|
+
|
|
52
83
|
respond := func(status int, data any, extra map[string]any) map[string]any {
|
|
84
|
+
payload := envelope(data)
|
|
53
85
|
out := map[string]any{
|
|
54
86
|
"status": status,
|
|
55
87
|
"statusText": "OK",
|
|
56
|
-
"json": (func() any)(func() any { return
|
|
88
|
+
"json": (func() any)(func() any { return payload }),
|
|
57
89
|
"body": "not-used",
|
|
58
90
|
}
|
|
59
91
|
if extra != nil {
|