@voxgig/sdkgen 4.34.2 → 4.34.4
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 +6 -3
- package/dist/cmp/ReadmeTop.js.map +1 -1
- package/dist/helpers/opShape.js +6 -0
- package/dist/helpers/opShape.js.map +1 -1
- package/dist/helpers/packageMeta.js +7 -6
- package/dist/helpers/packageMeta.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/project/.sdk/src/cmp/cpp/TestEntity_cpp.ts +18 -3
- package/project/.sdk/src/cmp/csharp/TestEntity_csharp.ts +14 -3
- package/project/.sdk/src/cmp/go/TestEntity_go.ts +28 -4
- package/project/.sdk/src/cmp/java/TestEntity_java.ts +15 -3
- package/project/.sdk/src/cmp/js/ReadmeTopQuick_js.ts +11 -1
- package/project/.sdk/src/cmp/js/TestEntity_js.ts +22 -3
- package/project/.sdk/src/cmp/kotlin/TestEntity_kotlin.ts +14 -3
- package/project/.sdk/src/cmp/lua/TestEntity_lua.ts +14 -3
- package/project/.sdk/src/cmp/perl/TestEntity_perl.ts +14 -3
- package/project/.sdk/src/cmp/php/TestEntity_php.ts +14 -3
- package/project/.sdk/src/cmp/py/TestEntity_py.ts +14 -3
- package/project/.sdk/src/cmp/rb/TestEntity_rb.ts +14 -3
- package/project/.sdk/src/cmp/rust/TestEntity_rust.ts +17 -3
- package/project/.sdk/src/cmp/scala/TestEntity_scala.ts +13 -3
- package/project/.sdk/src/cmp/ts/ReadmeTopQuick_ts.ts +11 -1
- package/project/.sdk/src/cmp/ts/TestEntity_ts.ts +27 -7
- package/project/sdkgen-package.json +1 -1
- package/src/cmp/ReadmeTop.ts +6 -3
- package/src/helpers/opShape.ts +6 -0
- package/src/helpers/packageMeta.ts +7 -6
|
@@ -419,9 +419,11 @@ const generateUpdate: OpGen = (ctx, step, index) => {
|
|
|
419
419
|
`)
|
|
420
420
|
}
|
|
421
421
|
|
|
422
|
+
// A parent id is keyed in idmap by its fixture name (step.d's value); a
|
|
423
|
+
// live ENTID may key it by the field name instead.
|
|
422
424
|
each(step.d, (mi: any) => {
|
|
423
425
|
if ('id' !== mi.key$) {
|
|
424
|
-
Content(` ${datavar}
|
|
426
|
+
Content(` ${datavar}['${mi.key$}'] = setup.idmap['${mi.key$}'] ?? setup.idmap['${mi.val$}']
|
|
425
427
|
`)
|
|
426
428
|
}
|
|
427
429
|
})
|
|
@@ -517,16 +519,20 @@ const generateLoad: OpGen = (ctx, step, index) => {
|
|
|
517
519
|
Content(` const ${srcdatavar} = Object.values(setup.data.existing.${entity.name})[0] as any
|
|
518
520
|
`)
|
|
519
521
|
}
|
|
522
|
+
Content(` const ${matchvar}: any = {}
|
|
523
|
+
`)
|
|
520
524
|
if (hasEntId) {
|
|
521
|
-
Content(`
|
|
522
|
-
|
|
523
|
-
|
|
525
|
+
Content(` ${matchvar}.id = ${srcdatavar}.id
|
|
526
|
+
`)
|
|
527
|
+
}
|
|
528
|
+
parentMatch(step, matchvar)
|
|
529
|
+
if (hasEntId) {
|
|
530
|
+
Content(` const ${datavar} = (await ${entvar}.load(${matchvar})).data()
|
|
524
531
|
assert(${datavar}.id === ${srcdatavar}.id)
|
|
525
532
|
`)
|
|
526
533
|
}
|
|
527
534
|
else {
|
|
528
|
-
Content(` const ${
|
|
529
|
-
const ${datavar} = (await ${entvar}.load(${matchvar})).data()
|
|
535
|
+
Content(` const ${datavar} = (await ${entvar}.load(${matchvar})).data()
|
|
530
536
|
assert(null != ${datavar})
|
|
531
537
|
`)
|
|
532
538
|
}
|
|
@@ -563,11 +569,25 @@ const generateRemove: OpGen = (ctx, step, index) => {
|
|
|
563
569
|
// removes the first match in entmap, so without a specific id the
|
|
564
570
|
// result depends on hash-sort order and flakes (see cheapshark).
|
|
565
571
|
Content(` const ${matchvar}: any = { id: ${srcdatavar}.id }
|
|
566
|
-
|
|
572
|
+
`)
|
|
573
|
+
parentMatch(step, matchvar)
|
|
574
|
+
Content(` await ${entvar}.remove(${matchvar})
|
|
567
575
|
`)
|
|
568
576
|
}
|
|
569
577
|
|
|
570
578
|
|
|
579
|
+
// A child's route names its parents, and an entity no earlier step has
|
|
580
|
+
// filled knows none of them, so the call itself gives each parent id.
|
|
581
|
+
function parentMatch(step: any, matchvar: string) {
|
|
582
|
+
each(step.m, (mi: any) => {
|
|
583
|
+
if ('id' !== mi.key$ && !mi.key$.endsWith('$')) {
|
|
584
|
+
Content(` ${matchvar}['${mi.key$}'] = setup.idmap['${mi.key$}'] ?? setup.idmap['${mi.val$}']
|
|
585
|
+
`)
|
|
586
|
+
}
|
|
587
|
+
})
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
|
|
571
591
|
const GENERATE_OP: Record<string, OpGen> = {
|
|
572
592
|
create: generateCreate,
|
|
573
593
|
list: generateList,
|
package/src/cmp/ReadmeTop.ts
CHANGED
|
@@ -370,8 +370,8 @@ network, and no credentials:
|
|
|
370
370
|
// 3. Packages — real published package name + install command per
|
|
371
371
|
// ecosystem. A package that is NOT yet live on its registry (the fleet
|
|
372
372
|
// default: 'pending') must NOT advertise a `npm install ...` that 404s —
|
|
373
|
-
// its Install cell links to the target README's install section instead
|
|
374
|
-
//
|
|
373
|
+
// its Install cell links to the target README's install section instead,
|
|
374
|
+
// as do go-cli and go-mcp, which the Go proxy cannot install.
|
|
375
375
|
if (pkgTargets.length > 0) {
|
|
376
376
|
Content(`## Packages
|
|
377
377
|
|
|
@@ -386,7 +386,10 @@ network, and no credentials:
|
|
|
386
386
|
if (!cmd) return
|
|
387
387
|
cell = '`' + cmd + '`'
|
|
388
388
|
} else if ('tag' === state) {
|
|
389
|
-
|
|
389
|
+
const cmd = vendorCommand(model, tgt.name)
|
|
390
|
+
cell = cmd
|
|
391
|
+
? '`' + cmd + '`'
|
|
392
|
+
: `build from source — [${tgt.name}/README.md](${tgt.name}/README.md)`
|
|
390
393
|
} else {
|
|
391
394
|
// The target README always gives a route that works without a
|
|
392
395
|
// tag, which a repository may not have.
|
package/src/helpers/opShape.ts
CHANGED
|
@@ -324,6 +324,12 @@ function entityIdField(ent: any): string | null {
|
|
|
324
324
|
if (loadItems.some((it: OpShapeItem) => it.name === 'id')) {
|
|
325
325
|
return 'id'
|
|
326
326
|
}
|
|
327
|
+
// An entity with no load at all is still matched by its id where its
|
|
328
|
+
// remove route names it, as Umbrella's permission is.
|
|
329
|
+
if (null == (ent.op && ent.op.load) &&
|
|
330
|
+
opRequestShape(ent, 'remove').items.some((it: OpShapeItem) => it.name === idName)) {
|
|
331
|
+
return idName
|
|
332
|
+
}
|
|
327
333
|
// NO fallback to entity.fields: this is the load-MATCH key. An entity whose
|
|
328
334
|
// DATA type has an `id` field but whose load match does NOT (a query-param
|
|
329
335
|
// load, e.g. playstation-store's StoreLoadMatch { age, country, ... }) must
|
|
@@ -196,8 +196,8 @@ function registryName(model: any, target: string): string {
|
|
|
196
196
|
}
|
|
197
197
|
|
|
198
198
|
// The vendor / git-tag install pointer for a NOT-yet-published target. For
|
|
199
|
-
//
|
|
200
|
-
//
|
|
199
|
+
// go this is the canonical install (`go get <module>@latest`, which the Go
|
|
200
|
+
// proxy resolves from the `go/vX.Y.Z` tag); go-cli and go-mcp get ''. For registry
|
|
201
201
|
// ports it is a short "not yet on <registry> — install from the git tag"
|
|
202
202
|
// pointer carrying the tags URL.
|
|
203
203
|
function vendorCommand(model: any, target: string): string {
|
|
@@ -208,10 +208,13 @@ function vendorCommand(model: any, target: string): string {
|
|
|
208
208
|
// the switch above exists to fix, one level down, which is exactly what
|
|
209
209
|
// the first cut of this change did.
|
|
210
210
|
case 'go':
|
|
211
|
-
case 'go-mcp':
|
|
212
211
|
return `go get ${packageName(model, target)}@latest`
|
|
212
|
+
// go-cli and go-mcp reach the SDK through `replace => ../go`, and the Go
|
|
213
|
+
// proxy cannot install a module that needs one. There is no command to
|
|
214
|
+
// give, so the caller links to the target README's build steps.
|
|
213
215
|
case 'go-cli':
|
|
214
|
-
|
|
216
|
+
case 'go-mcp':
|
|
217
|
+
return ''
|
|
215
218
|
default: {
|
|
216
219
|
const reg = registryName(model, target)
|
|
217
220
|
return `not yet on ${reg || 'the registry'} — install from the git tag: ${tagsUrl}`
|
|
@@ -300,8 +303,6 @@ function installCommand(model: any, target: string): string {
|
|
|
300
303
|
return `luarocks install ${packageName(model, target)}`
|
|
301
304
|
case 'go':
|
|
302
305
|
return `go get ${packageName(model, target)}`
|
|
303
|
-
case 'go-cli':
|
|
304
|
-
return `go install ${packageName(model, target)}/cmd/${model.name}@latest`
|
|
305
306
|
default:
|
|
306
307
|
return ''
|
|
307
308
|
}
|