@voxgig/sdkgen 3.5.1 → 3.7.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/AgentGuideTop.js +17 -0
- package/dist/cmp/AgentGuideTop.js.map +1 -1
- package/dist/cmp/ExternalTarget.js +1 -1
- package/dist/cmp/ExternalTarget.js.map +1 -1
- package/dist/cmp/Readme.js +2 -0
- package/dist/cmp/Readme.js.map +1 -1
- package/dist/cmp/ReadmeStation.d.ts +2 -0
- package/dist/cmp/ReadmeStation.js +57 -0
- package/dist/cmp/ReadmeStation.js.map +1 -0
- package/dist/helpers/naming.d.ts +6 -1
- package/dist/helpers/naming.js +156 -5
- package/dist/helpers/naming.js.map +1 -1
- package/dist/helpers/opShape.js +72 -0
- package/dist/helpers/opShape.js.map +1 -1
- package/dist/helpers/packageMeta.d.ts +2 -1
- package/dist/helpers/packageMeta.js +57 -20
- package/dist/helpers/packageMeta.js.map +1 -1
- package/dist/sdkgen.d.ts +3 -3
- package/dist/sdkgen.js +63 -18
- package/dist/sdkgen.js.map +1 -1
- package/dist/testkit.d.ts +39 -0
- package/dist/testkit.js +663 -0
- package/dist/testkit.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utility.d.ts +1 -1
- package/dist/utility.js +16 -2
- package/dist/utility.js.map +1 -1
- package/package.json +32 -8
- package/project/.sdk/src/cmp/c/Config_c.ts +34 -13
- package/project/.sdk/src/cmp/c/Test_c.ts +5 -7
- package/project/.sdk/src/cmp/clojure/Test_clojure.ts +3 -7
- package/project/.sdk/src/cmp/cpp/Config_cpp.ts +9 -46
- package/project/.sdk/src/cmp/cpp/Test_cpp.ts +4 -7
- package/project/.sdk/src/cmp/csharp/Config_csharp.ts +7 -1
- package/project/.sdk/src/cmp/csharp/Package_csharp.ts +1 -1
- package/project/.sdk/src/cmp/csharp/Test_csharp.ts +5 -7
- package/project/.sdk/src/cmp/dart/Config_dart.ts +14 -2
- package/project/.sdk/src/cmp/dart/Test_dart.ts +3 -4
- package/project/.sdk/src/cmp/dart/fragment/Config.data.fragment.dart +5 -0
- package/project/.sdk/src/cmp/dart/fragment/Config.fragment.dart +6 -0
- package/project/.sdk/src/cmp/dart/fragment/Main.fragment.dart +13 -4
- package/project/.sdk/src/cmp/elixir/Config_elixir.ts +12 -2
- package/project/.sdk/src/cmp/elixir/Package_elixir.ts +42 -3
- package/project/.sdk/src/cmp/elixir/Test_elixir.ts +5 -6
- package/project/.sdk/src/cmp/go/Config_go.ts +8 -1
- package/project/.sdk/src/cmp/go/EntityTypes_go.ts +1 -1
- package/project/.sdk/src/cmp/go/Entity_go.ts +1 -1
- package/project/.sdk/src/cmp/go/Gitignore_go.ts +6 -0
- package/project/.sdk/src/cmp/go/Main_go.ts +2 -2
- package/project/.sdk/src/cmp/go/Package_go.ts +1 -1
- package/project/.sdk/src/cmp/go/ReadmeExamplesTest_go.ts +59 -6
- package/project/.sdk/src/cmp/go/ReadmeExplanation_go.ts +1 -1
- package/project/.sdk/src/cmp/go/ReadmeHowto_go.ts +1 -1
- package/project/.sdk/src/cmp/go/ReadmeInstall_go.ts +1 -1
- package/project/.sdk/src/cmp/go/ReadmeModel_go.ts +1 -1
- package/project/.sdk/src/cmp/go/ReadmeQuick_go.ts +1 -1
- package/project/.sdk/src/cmp/go/ReadmeTopQuick_go.ts +1 -1
- package/project/.sdk/src/cmp/go/ReadmeTopTest_go.ts +1 -1
- package/project/.sdk/src/cmp/go/Test_go.ts +6 -8
- package/project/.sdk/src/cmp/go-cli/Main_go-cli.ts +6 -2
- package/project/.sdk/src/cmp/go-mcp/Main_go-mcp.ts +6 -2
- package/project/.sdk/src/cmp/java/Config_java.ts +8 -1
- package/project/.sdk/src/cmp/java/Test_java.ts +4 -7
- package/project/.sdk/src/cmp/js/Config_js.ts +9 -1
- package/project/.sdk/src/cmp/js/Package_js.ts +1 -1
- package/project/.sdk/src/cmp/js/Test_js.ts +4 -7
- package/project/.sdk/src/cmp/js/fragment/Config.data.fragment.js +7 -0
- package/project/.sdk/src/cmp/js/fragment/Config.fragment.js +8 -0
- package/project/.sdk/src/cmp/js/fragment/Main.fragment.js +33 -5
- package/project/.sdk/src/cmp/kotlin/Config_kotlin.ts +8 -1
- package/project/.sdk/src/cmp/kotlin/Test_kotlin.ts +4 -7
- package/project/.sdk/src/cmp/lean/Test_lean.ts +3 -3
- package/project/.sdk/src/cmp/lua/Config_lua.ts +11 -2
- package/project/.sdk/src/cmp/lua/Package_lua.ts +26 -3
- package/project/.sdk/src/cmp/lua/Test_lua.ts +5 -7
- package/project/.sdk/src/cmp/ocaml/Test_ocaml.ts +3 -7
- package/project/.sdk/src/cmp/perl/Config_perl.ts +8 -60
- package/project/.sdk/src/cmp/perl/Package_perl.ts +1 -1
- package/project/.sdk/src/cmp/perl/Test_perl.ts +5 -7
- package/project/.sdk/src/cmp/php/Config_php.ts +11 -2
- package/project/.sdk/src/cmp/php/EntityTypes_php.ts +13 -2
- package/project/.sdk/src/cmp/php/Main_php.ts +25 -0
- package/project/.sdk/src/cmp/php/Package_php.ts +2 -2
- package/project/.sdk/src/cmp/php/Test_php.ts +5 -7
- package/project/.sdk/src/cmp/php/fragment/Main.fragment.php +23 -6
- package/project/.sdk/src/cmp/py/Config_py.ts +11 -2
- package/project/.sdk/src/cmp/py/Main_py.ts +17 -7
- package/project/.sdk/src/cmp/py/Package_py.ts +2 -2
- package/project/.sdk/src/cmp/py/Test_py.ts +5 -7
- package/project/.sdk/src/cmp/py/fragment/Main.fragment.py +23 -6
- package/project/.sdk/src/cmp/py-data/Main_py-data.ts +14 -19
- package/project/.sdk/src/cmp/rb/Config_rb.ts +7 -1
- package/project/.sdk/src/cmp/rb/Package_rb.ts +3 -3
- package/project/.sdk/src/cmp/rb/ReadmeInstall_rb.ts +1 -1
- package/project/.sdk/src/cmp/rb/Test_rb.ts +5 -7
- package/project/.sdk/src/cmp/rust/Config_rust.ts +5 -2
- package/project/.sdk/src/cmp/rust/Test_rust.ts +5 -7
- package/project/.sdk/src/cmp/scala/Test_scala.ts +5 -2
- package/project/.sdk/src/cmp/seneca-provider/Gitignore_seneca-provider.ts +161 -0
- package/project/.sdk/src/cmp/seneca-provider/Main_seneca-provider.ts +20 -11
- package/project/.sdk/src/cmp/swift/Config_swift.ts +8 -54
- package/project/.sdk/src/cmp/swift/Package_swift.ts +52 -10
- package/project/.sdk/src/cmp/swift/Test_swift.ts +5 -7
- package/project/.sdk/src/cmp/ts/Config_ts.ts +9 -1
- package/project/.sdk/src/cmp/ts/EntityTypes_ts.ts +5 -2
- package/project/.sdk/src/cmp/ts/Entity_ts.ts +8 -2
- package/project/.sdk/src/cmp/ts/Package_ts.ts +1 -1
- package/project/.sdk/src/cmp/ts/Test_ts.ts +8 -7
- package/project/.sdk/src/cmp/ts/fragment/Config.data.fragment.ts +7 -0
- package/project/.sdk/src/cmp/ts/fragment/Config.fragment.ts +8 -0
- package/project/.sdk/src/cmp/ts/fragment/Entity.fragment.ts +1 -1
- package/project/.sdk/src/cmp/ts/fragment/Main.fragment.ts +12 -4
- package/project/.sdk/src/cmp/zig/Test_zig.ts +3 -7
- package/project/.sdk/tm/c/Makefile +6 -1
- package/project/.sdk/tm/c/utility/make_options.c +12 -1
- package/project/.sdk/tm/c/utility/make_point.c +64 -3
- package/project/.sdk/tm/clojure/src/sdk/core.clj +49 -14
- package/project/.sdk/tm/cpp/utility/pipeline.hpp +64 -4
- package/project/.sdk/tm/csharp/feature/TestFeature.cs +36 -2
- package/project/.sdk/tm/csharp/utility/Fetcher.cs +23 -5
- package/project/.sdk/tm/csharp/utility/MakeOptions.cs +13 -0
- package/project/.sdk/tm/csharp/utility/MakePoint.cs +65 -2
- package/project/.sdk/tm/dart/lib/feature/test/TestFeature.dart +34 -4
- package/project/.sdk/tm/dart/lib/utility/FetcherUtility.dart +9 -0
- package/project/.sdk/tm/dart/lib/utility/MakeOptionsUtility.dart +17 -0
- package/project/.sdk/tm/dart/lib/utility/MakePointUtility.dart +48 -2
- package/project/.sdk/tm/elixir/lib/projectname/utility.ex +109 -13
- package/project/.sdk/tm/elixir/test/feature_test.exs +19 -0
- package/project/.sdk/tm/elixir/test/primary_utility_test.exs +72 -0
- package/project/.sdk/tm/go/feature/test_feature.go +34 -2
- package/project/.sdk/tm/go/test/primary_utility_test.go +42 -20
- package/project/.sdk/tm/go/test/runner_test.go +1 -1
- package/project/.sdk/tm/go/utility/fetcher.go +14 -0
- package/project/.sdk/tm/go/utility/make_options.go +31 -4
- package/project/.sdk/tm/go/utility/make_point.go +66 -2
- package/project/.sdk/tm/java/feature/TestFeature.java +42 -2
- package/project/.sdk/tm/java/utility/Fetcher.java +11 -1
- package/project/.sdk/tm/java/utility/MakeOptions.java +11 -0
- package/project/.sdk/tm/java/utility/MakePoint.java +61 -2
- package/project/.sdk/tm/js/src/feature/test/TestFeature.js +22 -3
- package/project/.sdk/tm/js/src/utility/MakeOptionsUtility.js +20 -2
- package/project/.sdk/tm/js/src/utility/MakePointUtility.js +72 -2
- package/project/.sdk/tm/kotlin/feature/TestFeature.kt +31 -2
- package/project/.sdk/tm/kotlin/utility/Fetcher.kt +10 -1
- package/project/.sdk/tm/kotlin/utility/MakeOptions.kt +11 -0
- package/project/.sdk/tm/kotlin/utility/MakePoint.kt +58 -2
- package/project/.sdk/tm/lean/src/SdkUtility.lean +28 -0
- package/project/.sdk/tm/lean/test/TPrimaryUtility.lean +13 -2
- package/project/.sdk/tm/lua/utility/make_options.lua +44 -0
- package/project/.sdk/tm/lua/utility/make_point.lua +65 -2
- package/project/.sdk/tm/ocaml/sdk_runtime.ml +40 -2
- package/project/.sdk/tm/perl/utility/fetcher.pm +10 -1
- package/project/.sdk/tm/perl/utility/make_options.pm +36 -0
- package/project/.sdk/tm/perl/utility/make_point.pm +55 -2
- package/project/.sdk/tm/php/feature/TestFeature.php +30 -1
- package/project/.sdk/tm/php/test/PipelineTest.php +20 -0
- package/project/.sdk/tm/php/utility/Fetcher.php +12 -1
- package/project/.sdk/tm/php/utility/MakeOptions.php +58 -0
- package/project/.sdk/tm/php/utility/MakePoint.php +49 -1
- package/project/.sdk/tm/py/pkg/utility/fetcher.py +13 -1
- package/project/.sdk/tm/py/pkg/utility/make_options.py +23 -0
- package/project/.sdk/tm/py/pkg/utility/make_point.py +56 -2
- package/project/.sdk/tm/rb/utility/make_options.rb +18 -0
- package/project/.sdk/tm/rb/utility/make_point.rb +42 -2
- package/project/.sdk/tm/rust/tests/common/mod.rs +1 -1
- package/project/.sdk/tm/rust/tests/feature_test.rs +27 -0
- package/project/.sdk/tm/rust/utility/fetcher.rs +8 -0
- package/project/.sdk/tm/rust/utility/make_options.rs +15 -0
- package/project/.sdk/tm/rust/utility/make_point.rs +69 -2
- package/project/.sdk/tm/scala/feature/TestFeature.scala +36 -1
- package/project/.sdk/tm/scala/utility/Make.scala +57 -3
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/TestFeature.swift +29 -1
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/Fetcher.swift +24 -1
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/Make.swift +51 -2
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/MakeOptions.swift +12 -0
- package/project/.sdk/tm/ts/src/feature/test/TestFeature.ts +22 -3
- package/project/.sdk/tm/ts/src/utility/MakeOptionsUtility.ts +20 -2
- package/project/.sdk/tm/ts/src/utility/MakePointUtility.ts +72 -2
- package/project/.sdk/tm/ts/test/utility/Corpus.test.ts +85 -0
- package/project/.sdk/tm/ts/test/utility/PrimaryUtility.test.ts +10 -17
- package/project/.sdk/tm/zig/core/utility.zig +66 -3
- package/project/sdkgen-package.json +1 -2
- package/src/cmp/AgentGuideTop.ts +18 -0
- package/src/cmp/ExternalTarget.ts +1 -1
- package/src/cmp/Readme.ts +2 -0
- package/src/cmp/ReadmeStation.ts +69 -0
- package/src/helpers/naming.ts +172 -5
- package/src/helpers/opShape.ts +85 -0
- package/src/helpers/packageMeta.ts +59 -20
- package/src/sdkgen.ts +70 -20
- package/src/testkit.ts +863 -0
- package/src/utility.ts +17 -2
- package/testkit.d.ts +3 -0
- package/testkit.js +12 -0
- package/project/.sdk/model/target/haskell.aontu +0 -72
- package/project/.sdk/src/cmp/haskell/Config_haskell.ts +0 -98
- package/project/.sdk/src/cmp/haskell/Entity_haskell.ts +0 -13
- package/project/.sdk/src/cmp/haskell/Gitignore_haskell.ts +0 -27
- package/project/.sdk/src/cmp/haskell/Main_haskell.ts +0 -123
- package/project/.sdk/src/cmp/haskell/Package_haskell.ts +0 -60
- package/project/.sdk/src/cmp/haskell/ReadmeEntity_haskell.ts +0 -186
- package/project/.sdk/src/cmp/haskell/ReadmeExamplesTest_haskell.ts +0 -135
- package/project/.sdk/src/cmp/haskell/ReadmeExplanation_haskell.ts +0 -48
- package/project/.sdk/src/cmp/haskell/ReadmeHowto_haskell.ts +0 -168
- package/project/.sdk/src/cmp/haskell/ReadmeInstall_haskell.ts +0 -51
- package/project/.sdk/src/cmp/haskell/ReadmeIntro_haskell.ts +0 -67
- package/project/.sdk/src/cmp/haskell/ReadmeModel_haskell.ts +0 -162
- package/project/.sdk/src/cmp/haskell/ReadmeOptions_haskell.ts +0 -74
- package/project/.sdk/src/cmp/haskell/ReadmeQuick_haskell.ts +0 -241
- package/project/.sdk/src/cmp/haskell/ReadmeRef_haskell.ts +0 -408
- package/project/.sdk/src/cmp/haskell/ReadmeTopHowto_haskell.ts +0 -31
- package/project/.sdk/src/cmp/haskell/ReadmeTopQuick_haskell.ts +0 -104
- package/project/.sdk/src/cmp/haskell/ReadmeTopTest_haskell.ts +0 -80
- package/project/.sdk/src/cmp/haskell/Test_haskell.ts +0 -300
- package/project/.sdk/src/cmp/haskell/tsconfig.json +0 -15
- package/project/.sdk/src/cmp/haskell/utility_haskell.ts +0 -166
- package/project/.sdk/tm/haskell/LICENSE +0 -21
- package/project/.sdk/tm/haskell/Makefile +0 -22
- package/project/.sdk/tm/haskell/VERSION +0 -1
- package/project/.sdk/tm/haskell/src/SdkFeatures.hs +0 -1440
- package/project/.sdk/tm/haskell/src/SdkHelpers.hs +0 -337
- package/project/.sdk/tm/haskell/src/SdkJson.hs +0 -111
- package/project/.sdk/tm/haskell/src/SdkRuntime.hs +0 -1219
- package/project/.sdk/tm/haskell/src/SdkTypes.hs +0 -195
- package/project/.sdk/tm/haskell/src/VoxgigStruct.hs +0 -2299
- package/project/.sdk/tm/haskell/src/Vregex.hs +0 -237
- package/project/.sdk/tm/haskell/src/feature/README.md +0 -5
- package/project/.sdk/tm/haskell/src/feature/audit/.gitkeep +0 -0
- package/project/.sdk/tm/haskell/src/feature/base/.gitkeep +0 -0
- package/project/.sdk/tm/haskell/src/feature/cache/.gitkeep +0 -0
- package/project/.sdk/tm/haskell/src/feature/clienttrack/.gitkeep +0 -0
- package/project/.sdk/tm/haskell/src/feature/debug/.gitkeep +0 -0
- package/project/.sdk/tm/haskell/src/feature/idempotency/.gitkeep +0 -0
- package/project/.sdk/tm/haskell/src/feature/log/.gitkeep +0 -0
- package/project/.sdk/tm/haskell/src/feature/metrics/.gitkeep +0 -0
- package/project/.sdk/tm/haskell/src/feature/netsim/.gitkeep +0 -0
- package/project/.sdk/tm/haskell/src/feature/paging/.gitkeep +0 -0
- package/project/.sdk/tm/haskell/src/feature/proxy/.gitkeep +0 -0
- package/project/.sdk/tm/haskell/src/feature/ratelimit/.gitkeep +0 -0
- package/project/.sdk/tm/haskell/src/feature/rbac/.gitkeep +0 -0
- package/project/.sdk/tm/haskell/src/feature/retry/.gitkeep +0 -0
- package/project/.sdk/tm/haskell/src/feature/streaming/.gitkeep +0 -0
- package/project/.sdk/tm/haskell/src/feature/telemetry/.gitkeep +0 -0
- package/project/.sdk/tm/haskell/src/feature/test/.gitkeep +0 -0
- package/project/.sdk/tm/haskell/src/feature/timeout/.gitkeep +0 -0
- package/project/.sdk/tm/haskell/test/Harness.hs +0 -281
- package/project/.sdk/tm/haskell/test/Runner.hs +0 -47
- package/project/.sdk/tm/haskell/test/StructCorpus.hs +0 -449
- package/project/.sdk/tm/haskell/test/TCustomUtility.hs +0 -38
- package/project/.sdk/tm/haskell/test/TFeature.hs +0 -794
- package/project/.sdk/tm/haskell/test/TNetsim.hs +0 -50
- package/project/.sdk/tm/haskell/test/TPipeline.hs +0 -334
- package/project/.sdk/tm/haskell/test/TPrimaryUtility.hs +0 -386
- package/project/.sdk/tm/haskell/test/Testutil.hs +0 -59
|
@@ -40,6 +40,27 @@ function langLabel(target: string): string {
|
|
|
40
40
|
return LANG_LABEL[target] || target
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
|
|
44
|
+
// THE NAME WHOSE LANGUAGE RULES APPLY.
|
|
45
|
+
//
|
|
46
|
+
// A target name does two unrelated jobs in this file, and conflating them is
|
|
47
|
+
// the defect this exists to end. `go~go2` installs a SECOND Go SDK: its
|
|
48
|
+
// CONFIG lives under `main.kit.target.go2` (its own module path, its own
|
|
49
|
+
// registry state), but it is still Go — the same go.mod shape, the same
|
|
50
|
+
// `go get` install line, the same "Go" label.
|
|
51
|
+
//
|
|
52
|
+
// So: look config up by the target's OWN name, and select behaviour by this.
|
|
53
|
+
// `origname` is stamped at add time precisely for aliased installs and is
|
|
54
|
+
// empty when a target was installed under its own name, which makes the
|
|
55
|
+
// unaliased case identical to what it was.
|
|
56
|
+
//
|
|
57
|
+
// Ecosystem keys ('npm', 'gem', 'composer') pass through untouched: there is
|
|
58
|
+
// no target node under those names, so they answer for themselves.
|
|
59
|
+
function originName(model: any, target: string): string {
|
|
60
|
+
const orig = model?.main?.[KIT]?.target?.[target]?.origname
|
|
61
|
+
return (null != orig && '' !== orig) ? String(orig) : target
|
|
62
|
+
}
|
|
63
|
+
|
|
43
64
|
// Git host, org/repo path, and the canonical repo URLs.
|
|
44
65
|
//
|
|
45
66
|
// `<origin>/<slug>-sdk` is a DERIVATION, not a law. A project whose repo is
|
|
@@ -185,7 +206,10 @@ function goPackageIdent(model: any, target: string): string {
|
|
|
185
206
|
// The legacy boolean `registry.active: true` is honoured as a back-compat
|
|
186
207
|
// alias for state === 'active'.
|
|
187
208
|
function registryState(model: any, target: string): 'tag' | 'pending' | 'active' | 'inactive' {
|
|
188
|
-
|
|
209
|
+
// Tag-only is a property of the Go toolchain, not of one target name, so
|
|
210
|
+
// an aliased `go~go2` must be tag-only too.
|
|
211
|
+
const eco = originName(model, target)
|
|
212
|
+
if ('go' === eco || 'go-cli' === eco || 'go-mcp' === eco) return 'tag'
|
|
189
213
|
const reg = model?.main?.[KIT]?.target?.[target]?.publish?.registry
|
|
190
214
|
if (null == reg || '' === (reg.name || '')) return 'tag'
|
|
191
215
|
if (true === reg.active) return 'active' // legacy alias
|
|
@@ -215,13 +239,16 @@ function registryName(model: any, target: string): string {
|
|
|
215
239
|
// pointer carrying the releases URL.
|
|
216
240
|
function vendorCommand(model: any, target: string): string {
|
|
217
241
|
const { releasesUrl } = repoInfo(model)
|
|
218
|
-
switch (target) {
|
|
242
|
+
switch (originName(model, target)) {
|
|
243
|
+
// `target`, not the literal — the case says WHICH command, the argument
|
|
244
|
+
// says whose module. Writing the literal here reintroduces the same bug
|
|
245
|
+
// the switch above exists to fix, one level down, which is exactly what
|
|
246
|
+
// the first cut of this change did.
|
|
219
247
|
case 'go':
|
|
220
|
-
return `go get ${packageName(model, 'go')}@latest`
|
|
221
248
|
case 'go-mcp':
|
|
222
|
-
return `go get ${packageName(model,
|
|
249
|
+
return `go get ${packageName(model, target)}@latest`
|
|
223
250
|
case 'go-cli':
|
|
224
|
-
return `go install ${packageName(model,
|
|
251
|
+
return `go install ${packageName(model, target)}/cmd/${model.name}@latest`
|
|
225
252
|
default: {
|
|
226
253
|
const reg = registryName(model, target)
|
|
227
254
|
return `not yet on ${reg || 'the registry'} — install from the git tag: ${releasesUrl}`
|
|
@@ -266,7 +293,12 @@ function packageName(model: any, eco: string): string {
|
|
|
266
293
|
return String(declared)
|
|
267
294
|
}
|
|
268
295
|
|
|
269
|
-
|
|
296
|
+
// The lookup above is keyed by the target's OWN name, so an alias reads its
|
|
297
|
+
// own declared package. The switch below is about FORM — npm scoping,
|
|
298
|
+
// slash-separated composer names — which belongs to the language, so it
|
|
299
|
+
// follows the origin. Passing `ts2` here without this would miss every case
|
|
300
|
+
// and fall to `default`, silently publishing under a non-npm name.
|
|
301
|
+
switch (originName(model, eco)) {
|
|
270
302
|
case 'npm':
|
|
271
303
|
case 'ts':
|
|
272
304
|
return npmScoped
|
|
@@ -282,12 +314,13 @@ function packageName(model: any, eco: string): string {
|
|
|
282
314
|
case 'composer':
|
|
283
315
|
case 'php':
|
|
284
316
|
return `${origin}/${base}`
|
|
317
|
+
// `eco`, not the literal: the case is chosen by the LANGUAGE but the
|
|
318
|
+
// module belongs to the target that asked. `packageName(model, 'go2')`
|
|
319
|
+
// returning go's module was the same conflation one level down.
|
|
285
320
|
case 'go':
|
|
286
|
-
return goModule(model, 'go')
|
|
287
321
|
case 'go-cli':
|
|
288
|
-
return goModule(model, 'go-cli')
|
|
289
322
|
case 'go-mcp':
|
|
290
|
-
return goModule(model,
|
|
323
|
+
return goModule(model, eco)
|
|
291
324
|
// The notebook/analyst package layered on `py`. Distinct PyPI name so it
|
|
292
325
|
// can version and publish independently of the SDK it wraps.
|
|
293
326
|
case 'py-data':
|
|
@@ -306,25 +339,29 @@ function installCommand(model: any, target: string): string {
|
|
|
306
339
|
if (!isPublished(model, target)) {
|
|
307
340
|
return vendorCommand(model, target)
|
|
308
341
|
}
|
|
309
|
-
switch
|
|
342
|
+
// WHICH package manager is the language's business, so the switch follows
|
|
343
|
+
// the origin; WHICH package name is this target's own, so every arm passes
|
|
344
|
+
// `target` rather than a hardcoded ecosystem key. Before, an aliased
|
|
345
|
+
// `ts~ts2` matched no case and returned '' — a README with an empty install
|
|
346
|
+
// line — and even had it matched, `packageName(model, 'npm')` would have
|
|
347
|
+
// printed the ORIGIN's package.
|
|
348
|
+
switch (originName(model, target)) {
|
|
310
349
|
case 'ts':
|
|
311
|
-
return `npm install ${packageName(model, 'npm')}`
|
|
312
350
|
case 'js':
|
|
313
|
-
return `npm install ${packageName(model,
|
|
351
|
+
return `npm install ${packageName(model, target)}`
|
|
314
352
|
case 'py':
|
|
315
|
-
return `pip install ${packageName(model, 'pypi')}`
|
|
316
353
|
case 'py-data':
|
|
317
|
-
return `pip install ${packageName(model,
|
|
354
|
+
return `pip install ${packageName(model, target)}`
|
|
318
355
|
case 'php':
|
|
319
|
-
return `composer require ${packageName(model,
|
|
356
|
+
return `composer require ${packageName(model, target)}`
|
|
320
357
|
case 'rb':
|
|
321
|
-
return `gem install ${packageName(model,
|
|
358
|
+
return `gem install ${packageName(model, target)}`
|
|
322
359
|
case 'lua':
|
|
323
|
-
return `luarocks install ${packageName(model,
|
|
360
|
+
return `luarocks install ${packageName(model, target)}`
|
|
324
361
|
case 'go':
|
|
325
|
-
return `go get ${packageName(model,
|
|
362
|
+
return `go get ${packageName(model, target)}`
|
|
326
363
|
case 'go-cli':
|
|
327
|
-
return `go install ${packageName(model,
|
|
364
|
+
return `go install ${packageName(model, target)}/cmd/${model.name}@latest`
|
|
328
365
|
default:
|
|
329
366
|
return ''
|
|
330
367
|
}
|
|
@@ -333,7 +370,8 @@ function installCommand(model: any, target: string): string {
|
|
|
333
370
|
// The standard one-line package description (with the generic non-affiliation
|
|
334
371
|
// statement inline) used in every manifest.
|
|
335
372
|
function pkgDescription(model: any, target: string): string {
|
|
336
|
-
return `Unofficial generated ${langLabel(target)} SDK
|
|
373
|
+
return `Unofficial generated ${langLabel(originName(model, target))} SDK` +
|
|
374
|
+
` for the ${apiName(model)} public API.` +
|
|
337
375
|
` Not affiliated with or endorsed by the upstream API provider.`
|
|
338
376
|
}
|
|
339
377
|
|
|
@@ -437,6 +475,7 @@ export {
|
|
|
437
475
|
GENERATOR_URL,
|
|
438
476
|
LANG_LABEL,
|
|
439
477
|
langLabel,
|
|
478
|
+
originName,
|
|
440
479
|
repoInfo,
|
|
441
480
|
apiName,
|
|
442
481
|
packageName,
|
package/src/sdkgen.ts
CHANGED
|
@@ -10,7 +10,6 @@ import { Aontu } from 'aontu'
|
|
|
10
10
|
|
|
11
11
|
import {
|
|
12
12
|
showChanges,
|
|
13
|
-
getdlog,
|
|
14
13
|
} from '@voxgig/util'
|
|
15
14
|
|
|
16
15
|
import type {
|
|
@@ -60,7 +59,7 @@ import { collectDeps } from './helpers/collectDeps'
|
|
|
60
59
|
import type { DepEntry } from './helpers/collectDeps'
|
|
61
60
|
import { canonToType, canonToDtype, canonKey } from './helpers/canonType'
|
|
62
61
|
import { OP_SUFFIX, opTypeName, opParams, opActions, entityActions, entityPath, opRequestShape, entityIdField, entityDataIdField, entityOps, entityPrimaryOp, pickExampleEntity, entityClassName, entityTypeCollisions, warnEntityTypeCollisions, deriveEntityNames, entityCollection } from './helpers/opShape'
|
|
63
|
-
import { isReservedName, safeVarName, exampleVarName, phpEntityAccessor, entityCacheField, isRbCoreConstant, rbSafeTypeName, isSwiftSdkType, swiftSafeTypeName, jsProp, jsOptProp, jsKey } from './helpers/naming'
|
|
62
|
+
import { isReservedName, safeVarName, exampleVarName, phpEntityAccessor, entityCacheField, isRbCoreConstant, isRbSdkConstant, rbSafeTypeName, isSwiftSdkType, swiftSafeTypeName, isPhpReservedType, phpSafeTypeName, isTsReservedType, tsSafeTypeName, jsProp, jsOptProp, jsKey } from './helpers/naming'
|
|
64
63
|
import { serverVariables, hasServerVariables } from './helpers/serverVars'
|
|
65
64
|
import { primaryOpCall, idLiteral, matchArg, dataArg, litFor } from './helpers/opExample'
|
|
66
65
|
import type { ExampleLang } from './helpers/opExample'
|
|
@@ -108,6 +107,7 @@ import {
|
|
|
108
107
|
repoInfo,
|
|
109
108
|
apiName,
|
|
110
109
|
langLabel,
|
|
110
|
+
originName,
|
|
111
111
|
PUBLISHER,
|
|
112
112
|
PUBLISHER_URL,
|
|
113
113
|
SECURITY_EMAIL,
|
|
@@ -176,7 +176,38 @@ type SdkGenOptions = {
|
|
|
176
176
|
const { Jostraca } = JostracaModule
|
|
177
177
|
|
|
178
178
|
|
|
179
|
-
|
|
179
|
+
// A BROKEN PROJECT MODEL IS THE USER'S FILE, NOT A CRASH.
|
|
180
|
+
//
|
|
181
|
+
// One constructor for both routes out of `resolveModel` — the throw aontu
|
|
182
|
+
// actually takes, and the `errs` array it documents but never fills — because
|
|
183
|
+
// two spellings of the same error is how this repo keeps reintroducing the
|
|
184
|
+
// same defect.
|
|
185
|
+
//
|
|
186
|
+
// aontu's own diagnostic is the valuable part and is passed through
|
|
187
|
+
// UNTOUCHED: it carries the source excerpt, a caret under the offending
|
|
188
|
+
// token, and an explanation. What it lacks is any statement of WHOSE file
|
|
189
|
+
// this is, so the path leads. Wrapping it in an SdkGenError is what makes the
|
|
190
|
+
// CLI print it as a message instead of dumping the error object and a stack
|
|
191
|
+
// trace through sdkgen's internals — `handleError` reserves clean output for
|
|
192
|
+
// that name.
|
|
193
|
+
function modelError(path: string, cause: any, rooterrs: any[]): any {
|
|
194
|
+
const detail = String(cause?.msg ?? cause?.message ?? cause ?? '').trim()
|
|
195
|
+
|
|
196
|
+
const err: any = new SdkGenError(
|
|
197
|
+
'Model Error: ' + path + '\n' + detail)
|
|
198
|
+
|
|
199
|
+
err.cause$ = [cause]
|
|
200
|
+
err.rooterrs$ = rooterrs
|
|
201
|
+
|
|
202
|
+
// A syntax error is the user's typo, and there is nothing for them to do
|
|
203
|
+
// with a stack. `why` lives on the structured entries rather than the
|
|
204
|
+
// thrown wrapper, so it is read from the first of them.
|
|
205
|
+
if ('syntax' === (cause?.why ?? rooterrs?.[0]?.why)) {
|
|
206
|
+
err.uxmsg$ = true
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
return err
|
|
210
|
+
}
|
|
180
211
|
|
|
181
212
|
|
|
182
213
|
function SdkGen(opts: SdkGenOptions) {
|
|
@@ -393,13 +424,6 @@ function SdkGen(opts: SdkGenOptions) {
|
|
|
393
424
|
showChanges(jopts.log, 'generate-result', eres, Path.dirname(process.cwd()))
|
|
394
425
|
}
|
|
395
426
|
|
|
396
|
-
const dlogs = dlog.log()
|
|
397
|
-
if (0 < dlogs.length) {
|
|
398
|
-
for (let dlogentry of dlogs) {
|
|
399
|
-
log.debug({ point: 'generate-warning', dlogentry, note: String(dlogentry) })
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
|
|
403
427
|
log.info({ point: 'generate-end' })
|
|
404
428
|
|
|
405
429
|
return { ok: true, name: 'sdkgen' }
|
|
@@ -482,19 +506,39 @@ function SdkGen(opts: SdkGenOptions) {
|
|
|
482
506
|
const aopts = { path, errs }
|
|
483
507
|
const src = fs.readFileSync(path, 'utf8')
|
|
484
508
|
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
509
|
+
// AONTU THROWS; IT DOES NOT FILL `errs`.
|
|
510
|
+
//
|
|
511
|
+
// The `errs` array is handed to `generate` and stays empty on every
|
|
512
|
+
// failure — syntax, unresolved path and unify conflict alike all raise an
|
|
513
|
+
// AontuError instead (verified against 0.52 by running each). So the
|
|
514
|
+
// `0 < errs.length` branch this used to have could never fire, and every
|
|
515
|
+
// broken project model reached the CLI as a bare AontuError: `handleError`
|
|
516
|
+
// prints the raw object for anything that is not an SdkGenError, so the
|
|
517
|
+
// user got aontu's diagnostic followed by a stack trace into sdkgen's
|
|
518
|
+
// `dist/` and a dump of the error's own fields. It read as an sdkgen
|
|
519
|
+
// crash rather than a problem in their own file.
|
|
520
|
+
//
|
|
521
|
+
// The array is still passed, and still checked below, because that is
|
|
522
|
+
// aontu's documented option and a later version may start using it. Both
|
|
523
|
+
// routes build the error the same way, so they cannot drift.
|
|
524
|
+
let model: any
|
|
491
525
|
|
|
492
|
-
|
|
493
|
-
|
|
526
|
+
try {
|
|
527
|
+
model = aontu.generate(src, aopts)
|
|
528
|
+
}
|
|
529
|
+
catch (aerr: any) {
|
|
530
|
+
if (true !== aerr?.aontu) {
|
|
531
|
+
throw aerr
|
|
494
532
|
}
|
|
495
533
|
|
|
496
|
-
|
|
497
|
-
|
|
534
|
+
// The structured errors are reachable after all — the thrown error
|
|
535
|
+
// carries the accessor the empty array was standing in for.
|
|
536
|
+
throw modelError(path, aerr,
|
|
537
|
+
'function' === typeof aerr.errs ? aerr.errs() : [])
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
if (0 < errs.length) {
|
|
541
|
+
throw modelError(path, errs[0], errs)
|
|
498
542
|
}
|
|
499
543
|
|
|
500
544
|
model.const = { name: model.name }
|
|
@@ -1039,9 +1083,14 @@ export {
|
|
|
1039
1083
|
phpEntityAccessor,
|
|
1040
1084
|
entityCacheField,
|
|
1041
1085
|
isRbCoreConstant,
|
|
1086
|
+
isRbSdkConstant,
|
|
1042
1087
|
rbSafeTypeName,
|
|
1043
1088
|
isSwiftSdkType,
|
|
1044
1089
|
swiftSafeTypeName,
|
|
1090
|
+
isPhpReservedType,
|
|
1091
|
+
phpSafeTypeName,
|
|
1092
|
+
isTsReservedType,
|
|
1093
|
+
tsSafeTypeName,
|
|
1045
1094
|
serverVariables,
|
|
1046
1095
|
hasServerVariables,
|
|
1047
1096
|
liveStrict,
|
|
@@ -1090,6 +1139,7 @@ export {
|
|
|
1090
1139
|
repoInfo,
|
|
1091
1140
|
apiName,
|
|
1092
1141
|
langLabel,
|
|
1142
|
+
originName,
|
|
1093
1143
|
PUBLISHER,
|
|
1094
1144
|
PUBLISHER_URL,
|
|
1095
1145
|
SECURITY_EMAIL,
|