@voxgig/sdkgen 4.7.0 → 4.8.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.
Files changed (50) hide show
  1. package/bin/voxgig-sdkgen +1 -1
  2. package/dist/helpers/opShape.js +8 -11
  3. package/dist/helpers/opShape.js.map +1 -1
  4. package/dist/helpers/pointPath.d.ts +10 -0
  5. package/dist/helpers/pointPath.js +54 -0
  6. package/dist/helpers/pointPath.js.map +1 -0
  7. package/dist/sdkgen.d.ts +4 -2
  8. package/dist/sdkgen.js +8 -3
  9. package/dist/sdkgen.js.map +1 -1
  10. package/dist/tsconfig.tsbuildinfo +1 -1
  11. package/dist/utility.js +26 -1
  12. package/dist/utility.js.map +1 -1
  13. package/package.json +2 -2
  14. package/project/.sdk/src/cmp/c/Config_c.ts +7 -8
  15. package/project/.sdk/src/cmp/c/TestDirect_c.ts +4 -3
  16. package/project/.sdk/src/cmp/cpp/TestDirect_cpp.ts +4 -3
  17. package/project/.sdk/src/cmp/csharp/TestDirect_csharp.ts +5 -4
  18. package/project/.sdk/src/cmp/dart/Config_dart.ts +7 -8
  19. package/project/.sdk/src/cmp/dart/TestDirect_dart.ts +6 -5
  20. package/project/.sdk/src/cmp/elixir/Config_elixir.ts +9 -8
  21. package/project/.sdk/src/cmp/go/Config_go.ts +1 -7
  22. package/project/.sdk/src/cmp/go/TestDirect_go.ts +5 -4
  23. package/project/.sdk/src/cmp/java/Config_java.ts +7 -7
  24. package/project/.sdk/src/cmp/java/TestDirect_java.ts +5 -4
  25. package/project/.sdk/src/cmp/js/Config_js.ts +7 -8
  26. package/project/.sdk/src/cmp/js/TestDirect_js.ts +5 -4
  27. package/project/.sdk/src/cmp/kotlin/Config_kotlin.ts +7 -7
  28. package/project/.sdk/src/cmp/kotlin/TestDirect_kotlin.ts +5 -4
  29. package/project/.sdk/src/cmp/lean/Config_lean.ts +9 -8
  30. package/project/.sdk/src/cmp/lua/Config_lua.ts +1 -7
  31. package/project/.sdk/src/cmp/lua/TestDirect_lua.ts +5 -4
  32. package/project/.sdk/src/cmp/perl/TestDirect_perl.ts +5 -4
  33. package/project/.sdk/src/cmp/php/Config_php.ts +1 -7
  34. package/project/.sdk/src/cmp/php/TestDirect_php.ts +5 -4
  35. package/project/.sdk/src/cmp/py/Config_py.ts +1 -7
  36. package/project/.sdk/src/cmp/py/TestDirect_py.ts +5 -4
  37. package/project/.sdk/src/cmp/rb/Config_rb.ts +1 -7
  38. package/project/.sdk/src/cmp/rb/TestDirect_rb.ts +5 -4
  39. package/project/.sdk/src/cmp/rust/TestDirect_rust.ts +5 -4
  40. package/project/.sdk/src/cmp/scala/Config_scala.ts +9 -7
  41. package/project/.sdk/src/cmp/scala/TestDirect_scala.ts +4 -3
  42. package/project/.sdk/src/cmp/seneca-provider/Extras_seneca-provider.ts +3 -1
  43. package/project/.sdk/src/cmp/seneca-provider/Main_seneca-provider.ts +9 -5
  44. package/project/.sdk/src/cmp/ts/Config_ts.ts +7 -8
  45. package/project/.sdk/src/cmp/ts/TestDirect_ts.ts +6 -5
  46. package/project/sdkgen-package.json +1 -1
  47. package/src/helpers/opShape.ts +9 -14
  48. package/src/helpers/pointPath.ts +88 -0
  49. package/src/sdkgen.ts +11 -0
  50. package/src/utility.ts +31 -1
package/src/sdkgen.ts CHANGED
@@ -67,6 +67,9 @@ import { serverVariables, hasServerVariables, serverVarEnv } from './helpers/ser
67
67
  import { primaryOpCall, idLiteral, matchArg, dataArg, litFor } from './helpers/opExample'
68
68
  import type { ExampleLang } from './helpers/opExample'
69
69
  import { liveStrict } from './helpers/testPolicy'
70
+ import { pointSegments, pointParts, pointTerminalParam, pointPathKey }
71
+ from './helpers/pointPath'
72
+ import type { PathSegment } from './helpers/pointPath'
70
73
  import {
71
74
  featureOf,
72
75
  availableFeatures,
@@ -1014,6 +1017,7 @@ export type {
1014
1017
  SdkGenOptions,
1015
1018
  ExampleLang,
1016
1019
  DepEntry,
1020
+ PathSegment,
1017
1021
  FeatureSource,
1018
1022
  DoctorReport,
1019
1023
  RegisterOptions,
@@ -1119,6 +1123,13 @@ export {
1119
1123
  buildIdNames,
1120
1124
  getMatchEntries,
1121
1125
  collectDeps,
1126
+
1127
+ // apidef ADR-003: the model carries typed path segments, not braced
1128
+ // strings. Scaffold components read the path through these.
1129
+ pointSegments,
1130
+ pointParts,
1131
+ pointTerminalParam,
1132
+ pointPathKey,
1122
1133
  canonToType,
1123
1134
  canonToDtype,
1124
1135
  canonKey,
package/src/utility.ts CHANGED
@@ -8,6 +8,7 @@ import { KIT, getModelPath } from '@voxgig/apidef'
8
8
  import { targetFeatures } from './helpers/applicability'
9
9
 
10
10
  import { serverVariables } from './helpers/serverVars'
11
+ import { pointParts } from './helpers/pointPath'
11
12
  import { packageVersion } from './helpers/packageMeta'
12
13
 
13
14
 
@@ -350,6 +351,35 @@ const SPEC_FACTS: Record<string, (model: any) => any> = {
350
351
  //
351
352
  // Key order is `each`'s order, which is sorted, so the JSON is byte-stable
352
353
  // across runs exactly like the literal it replaces.
354
+ // The embedded config still speaks the braced-string path form
355
+ // (`['element', '{id}']`) that every generated runtime reads. apidef now
356
+ // emits the resolved vector instead (its ADR-003), so the old shape is
357
+ // reconstructed HERE — the single point at which a point reaches generated
358
+ // output — via the single reconstruction in helpers/pointPath.
359
+ //
360
+ // Both are written: `parts` for the runtimes as they stand, `segments`
361
+ // alongside it so a runtime can be moved over one language at a time. That
362
+ // duplication is deliberate and temporary, and it lives in GENERATED output,
363
+ // not in the model — which is what ADR-003 forbids. It ends when the last
364
+ // runtime reads segments and `parts` is dropped from this function.
365
+ function withPointParts(op: any): any {
366
+ if (null == op) {
367
+ return op
368
+ }
369
+
370
+ const out: any = {}
371
+ each(op, (o: any, opname: string) => {
372
+ out[opname] = null == o || null == o.points ? o : {
373
+ ...o,
374
+ points: each(o.points).map((pt: any) =>
375
+ null == pt ? pt : { ...pt, parts: pointParts(pt) }),
376
+ }
377
+ })
378
+
379
+ return out
380
+ }
381
+
382
+
353
383
  function configDefinition(model: any, targetname?: string): { def: any, json: string } {
354
384
  const entity = getModelPath(model, `main.${KIT}.entity`)
355
385
 
@@ -377,7 +407,7 @@ function configDefinition(model: any, targetname?: string): { def: any, json: st
377
407
  entityDefs[e.name] = clean({
378
408
  fields: e.fields,
379
409
  name: e.name,
380
- op: e.op,
410
+ op: withPointParts(e.op),
381
411
  relations: e.relations,
382
412
  }, true)
383
413
  entityStubs[e.name] = {}