@voxgig/sdkgen 4.22.0 → 4.23.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 (195) hide show
  1. package/bin/voxgig-sdkgen +1 -1
  2. package/dist/cmp/ReadmeTop.js +1 -1
  3. package/dist/cmp/ReadmeTop.js.map +1 -1
  4. package/dist/cmp/ReadmeUnions.js +1 -1
  5. package/dist/cmp/ReadmeUnions.js.map +1 -1
  6. package/dist/cmp/Test.js +1 -1
  7. package/dist/cmp/Test.js.map +1 -1
  8. package/dist/helpers/buildIdNames.d.ts +3 -1
  9. package/dist/helpers/buildIdNames.js +15 -7
  10. package/dist/helpers/buildIdNames.js.map +1 -1
  11. package/dist/helpers/canonSpec.js +2 -2
  12. package/dist/helpers/canonSpec.js.map +1 -1
  13. package/dist/helpers/getMatchEntries.js +2 -2
  14. package/dist/helpers/getMatchEntries.js.map +1 -1
  15. package/dist/helpers/modelNames.js +5 -1
  16. package/dist/helpers/modelNames.js.map +1 -1
  17. package/dist/helpers/opShape.js +33 -33
  18. package/dist/helpers/opShape.js.map +1 -1
  19. package/dist/helpers/pointPath.js +5 -10
  20. package/dist/helpers/pointPath.js.map +1 -1
  21. package/dist/helpers/resolved.js +2 -29
  22. package/dist/helpers/resolved.js.map +1 -1
  23. package/dist/sdkgen.d.ts +2 -2
  24. package/dist/sdkgen.js +5 -3
  25. package/dist/sdkgen.js.map +1 -1
  26. package/dist/tsconfig.tsbuildinfo +1 -1
  27. package/dist/utility.js +15 -7
  28. package/dist/utility.js.map +1 -1
  29. package/package.json +3 -3
  30. package/project/.sdk/src/cmp/c/EntityTypes_c.ts +4 -4
  31. package/project/.sdk/src/cmp/c/ReadmeEntity_c.ts +3 -3
  32. package/project/.sdk/src/cmp/c/ReadmeModel_c.ts +3 -3
  33. package/project/.sdk/src/cmp/c/ReadmeRef_c.ts +5 -5
  34. package/project/.sdk/src/cmp/c/Schema_c.ts +1 -1
  35. package/project/.sdk/src/cmp/c/TestDirect_c.ts +12 -12
  36. package/project/.sdk/src/cmp/clojure/ReadmeEntity_clojure.ts +3 -3
  37. package/project/.sdk/src/cmp/clojure/ReadmeModel_clojure.ts +3 -3
  38. package/project/.sdk/src/cmp/clojure/ReadmeRef_clojure.ts +5 -5
  39. package/project/.sdk/src/cmp/clojure/Schema_clojure.ts +1 -1
  40. package/project/.sdk/src/cmp/cpp/EntityTypes_cpp.ts +3 -3
  41. package/project/.sdk/src/cmp/cpp/ReadmeEntity_cpp.ts +3 -3
  42. package/project/.sdk/src/cmp/cpp/ReadmeModel_cpp.ts +3 -3
  43. package/project/.sdk/src/cmp/cpp/ReadmeRef_cpp.ts +5 -5
  44. package/project/.sdk/src/cmp/cpp/Schema_cpp.ts +1 -1
  45. package/project/.sdk/src/cmp/cpp/TestDirect_cpp.ts +14 -14
  46. package/project/.sdk/src/cmp/cpp/TestEntity_cpp.ts +51 -50
  47. package/project/.sdk/src/cmp/csharp/EntityTypes_csharp.ts +4 -4
  48. package/project/.sdk/src/cmp/csharp/ReadmeEntity_csharp.ts +3 -3
  49. package/project/.sdk/src/cmp/csharp/ReadmeModel_csharp.ts +3 -3
  50. package/project/.sdk/src/cmp/csharp/ReadmeRef_csharp.ts +5 -5
  51. package/project/.sdk/src/cmp/csharp/Schema_csharp.ts +1 -1
  52. package/project/.sdk/src/cmp/csharp/TestDirect_csharp.ts +30 -30
  53. package/project/.sdk/src/cmp/csharp/TestEntity_csharp.ts +66 -65
  54. package/project/.sdk/src/cmp/elixir/EntityTypes_elixir.ts +4 -4
  55. package/project/.sdk/src/cmp/elixir/ReadmeEntity_elixir.ts +3 -3
  56. package/project/.sdk/src/cmp/elixir/ReadmeModel_elixir.ts +3 -3
  57. package/project/.sdk/src/cmp/elixir/ReadmeRef_elixir.ts +4 -4
  58. package/project/.sdk/src/cmp/elixir/Schema_elixir.ts +1 -1
  59. package/project/.sdk/src/cmp/go/EntityTypes_go.ts +4 -4
  60. package/project/.sdk/src/cmp/go/ReadmeEntity_go.ts +3 -3
  61. package/project/.sdk/src/cmp/go/ReadmeModel_go.ts +3 -3
  62. package/project/.sdk/src/cmp/go/ReadmeRef_go.ts +5 -5
  63. package/project/.sdk/src/cmp/go/Schema_go.ts +1 -1
  64. package/project/.sdk/src/cmp/go/TestDirect_go.ts +38 -38
  65. package/project/.sdk/src/cmp/go/TestEntity_go.ts +75 -74
  66. package/project/.sdk/src/cmp/go/utility_go.ts +5 -5
  67. package/project/.sdk/src/cmp/java/EntityTypes_java.ts +4 -4
  68. package/project/.sdk/src/cmp/java/ReadmeEntity_java.ts +3 -3
  69. package/project/.sdk/src/cmp/java/ReadmeModel_java.ts +3 -3
  70. package/project/.sdk/src/cmp/java/ReadmeRef_java.ts +5 -5
  71. package/project/.sdk/src/cmp/java/Schema_java.ts +1 -1
  72. package/project/.sdk/src/cmp/java/TestDirect_java.ts +30 -30
  73. package/project/.sdk/src/cmp/java/TestEntity_java.ts +69 -68
  74. package/project/.sdk/src/cmp/js/EntityTypes_js.ts +5 -5
  75. package/project/.sdk/src/cmp/js/ReadmeEntity_js.ts +3 -3
  76. package/project/.sdk/src/cmp/js/ReadmeModel_js.ts +3 -3
  77. package/project/.sdk/src/cmp/js/ReadmeRef_js.ts +5 -5
  78. package/project/.sdk/src/cmp/js/Schema_js.ts +1 -1
  79. package/project/.sdk/src/cmp/js/TestDirect_js.ts +27 -27
  80. package/project/.sdk/src/cmp/js/TestEntity_js.ts +66 -69
  81. package/project/.sdk/src/cmp/js/TestLive_js.ts +3 -3
  82. package/project/.sdk/src/cmp/js/utility_js.ts +5 -5
  83. package/project/.sdk/src/cmp/kotlin/EntityTypes_kotlin.ts +4 -4
  84. package/project/.sdk/src/cmp/kotlin/ReadmeEntity_kotlin.ts +3 -3
  85. package/project/.sdk/src/cmp/kotlin/ReadmeModel_kotlin.ts +3 -3
  86. package/project/.sdk/src/cmp/kotlin/ReadmeRef_kotlin.ts +5 -5
  87. package/project/.sdk/src/cmp/kotlin/Schema_kotlin.ts +1 -1
  88. package/project/.sdk/src/cmp/kotlin/TestDirect_kotlin.ts +30 -30
  89. package/project/.sdk/src/cmp/kotlin/TestEntity_kotlin.ts +67 -66
  90. package/project/.sdk/src/cmp/lua/EntityTypes_lua.ts +5 -5
  91. package/project/.sdk/src/cmp/lua/ReadmeEntity_lua.ts +3 -3
  92. package/project/.sdk/src/cmp/lua/ReadmeModel_lua.ts +3 -3
  93. package/project/.sdk/src/cmp/lua/ReadmeQuick_lua.ts +4 -4
  94. package/project/.sdk/src/cmp/lua/ReadmeRef_lua.ts +5 -5
  95. package/project/.sdk/src/cmp/lua/Schema_lua.ts +1 -1
  96. package/project/.sdk/src/cmp/lua/TestDirect_lua.ts +25 -25
  97. package/project/.sdk/src/cmp/lua/TestEntity_lua.ts +66 -65
  98. package/project/.sdk/src/cmp/ocaml/ReadmeEntity_ocaml.ts +3 -3
  99. package/project/.sdk/src/cmp/ocaml/ReadmeModel_ocaml.ts +3 -3
  100. package/project/.sdk/src/cmp/ocaml/ReadmeRef_ocaml.ts +5 -5
  101. package/project/.sdk/src/cmp/ocaml/Schema_ocaml.ts +1 -1
  102. package/project/.sdk/src/cmp/perl/ReadmeEntity_perl.ts +3 -3
  103. package/project/.sdk/src/cmp/perl/ReadmeModel_perl.ts +3 -3
  104. package/project/.sdk/src/cmp/perl/ReadmeRef_perl.ts +5 -5
  105. package/project/.sdk/src/cmp/perl/Schema_perl.ts +1 -1
  106. package/project/.sdk/src/cmp/perl/TestDirect_perl.ts +25 -25
  107. package/project/.sdk/src/cmp/perl/TestEntity_perl.ts +60 -59
  108. package/project/.sdk/src/cmp/php/EntityTypes_php.ts +4 -4
  109. package/project/.sdk/src/cmp/php/ReadmeEntity_php.ts +3 -3
  110. package/project/.sdk/src/cmp/php/ReadmeModel_php.ts +3 -3
  111. package/project/.sdk/src/cmp/php/ReadmeQuick_php.ts +4 -4
  112. package/project/.sdk/src/cmp/php/ReadmeRef_php.ts +5 -5
  113. package/project/.sdk/src/cmp/php/Schema_php.ts +1 -1
  114. package/project/.sdk/src/cmp/php/TestDirect_php.ts +25 -25
  115. package/project/.sdk/src/cmp/php/TestEntity_php.ts +66 -65
  116. package/project/.sdk/src/cmp/py/EntityTypes_py.ts +4 -4
  117. package/project/.sdk/src/cmp/py/ReadmeEntity_py.ts +3 -3
  118. package/project/.sdk/src/cmp/py/ReadmeModel_py.ts +3 -3
  119. package/project/.sdk/src/cmp/py/ReadmeRef_py.ts +5 -5
  120. package/project/.sdk/src/cmp/py/Schema_py.ts +1 -1
  121. package/project/.sdk/src/cmp/py/TestDirect_py.ts +25 -25
  122. package/project/.sdk/src/cmp/py/TestEntity_py.ts +66 -65
  123. package/project/.sdk/src/cmp/py-data/Main_py-data.ts +4 -4
  124. package/project/.sdk/src/cmp/rb/EntityTypes_rb.ts +4 -4
  125. package/project/.sdk/src/cmp/rb/ReadmeEntity_rb.ts +3 -3
  126. package/project/.sdk/src/cmp/rb/ReadmeModel_rb.ts +3 -3
  127. package/project/.sdk/src/cmp/rb/ReadmeQuick_rb.ts +4 -4
  128. package/project/.sdk/src/cmp/rb/ReadmeRef_rb.ts +5 -5
  129. package/project/.sdk/src/cmp/rb/Schema_rb.ts +1 -1
  130. package/project/.sdk/src/cmp/rb/TestDirect_rb.ts +25 -25
  131. package/project/.sdk/src/cmp/rb/TestEntity_rb.ts +66 -65
  132. package/project/.sdk/src/cmp/rust/EntityTypes_rust.ts +4 -4
  133. package/project/.sdk/src/cmp/rust/ReadmeEntity_rust.ts +3 -3
  134. package/project/.sdk/src/cmp/rust/ReadmeModel_rust.ts +3 -3
  135. package/project/.sdk/src/cmp/rust/ReadmeRef_rust.ts +5 -5
  136. package/project/.sdk/src/cmp/rust/Schema_rust.ts +1 -1
  137. package/project/.sdk/src/cmp/rust/TestDirect_rust.ts +18 -18
  138. package/project/.sdk/src/cmp/rust/TestEntity_rust.ts +63 -62
  139. package/project/.sdk/src/cmp/scala/EntityTypes_scala.ts +4 -4
  140. package/project/.sdk/src/cmp/scala/ReadmeEntity_scala.ts +3 -3
  141. package/project/.sdk/src/cmp/scala/ReadmeModel_scala.ts +3 -3
  142. package/project/.sdk/src/cmp/scala/ReadmeRef_scala.ts +5 -5
  143. package/project/.sdk/src/cmp/scala/Schema_scala.ts +1 -1
  144. package/project/.sdk/src/cmp/scala/TestDirect_scala.ts +14 -14
  145. package/project/.sdk/src/cmp/scala/TestEntity_scala.ts +60 -59
  146. package/project/.sdk/src/cmp/swift/EntityTypes_swift.ts +4 -4
  147. package/project/.sdk/src/cmp/swift/ReadmeEntity_swift.ts +3 -3
  148. package/project/.sdk/src/cmp/swift/ReadmeModel_swift.ts +3 -3
  149. package/project/.sdk/src/cmp/swift/ReadmeRef_swift.ts +5 -5
  150. package/project/.sdk/src/cmp/swift/Schema_swift.ts +1 -1
  151. package/project/.sdk/src/cmp/ts/EntityTypes_ts.ts +5 -5
  152. package/project/.sdk/src/cmp/ts/ReadmeEntity_ts.ts +3 -3
  153. package/project/.sdk/src/cmp/ts/ReadmeModel_ts.ts +3 -3
  154. package/project/.sdk/src/cmp/ts/ReadmeQuick_ts.ts +1 -1
  155. package/project/.sdk/src/cmp/ts/ReadmeRef_ts.ts +5 -5
  156. package/project/.sdk/src/cmp/ts/Schema_ts.ts +1 -1
  157. package/project/.sdk/src/cmp/ts/TestDirect_ts.ts +40 -40
  158. package/project/.sdk/src/cmp/ts/TestEntity_ts.ts +72 -75
  159. package/project/.sdk/src/cmp/ts/TestLive_ts.ts +3 -3
  160. package/project/.sdk/src/cmp/ts/utility_ts.ts +5 -5
  161. package/project/.sdk/src/cmp/zig/ReadmeEntity_zig.ts +3 -3
  162. package/project/.sdk/src/cmp/zig/ReadmeModel_zig.ts +3 -3
  163. package/project/.sdk/src/cmp/zig/ReadmeRef_zig.ts +5 -5
  164. package/project/.sdk/src/cmp/zig/Schema_zig.ts +1 -1
  165. package/project/.sdk/tm/c/feature/test.c +20 -4
  166. package/project/.sdk/tm/clojure/src/sdk/features.clj +6 -4
  167. package/project/.sdk/tm/cpp/feature/test.hpp +17 -6
  168. package/project/.sdk/tm/csharp/feature/TestFeature.cs +10 -4
  169. package/project/.sdk/tm/elixir/lib/projectname/feature/test.ex +11 -5
  170. package/project/.sdk/tm/java/feature/TestFeature.java +11 -6
  171. package/project/.sdk/tm/js/test/live-entity.js +29 -29
  172. package/project/.sdk/tm/js/test/live-scenarios.js +4 -4
  173. package/project/.sdk/tm/kotlin/feature/TestFeature.kt +8 -4
  174. package/project/.sdk/tm/ocaml/sdk_features.ml +6 -4
  175. package/project/.sdk/tm/perl/feature/test_feature.pm +6 -4
  176. package/project/.sdk/tm/rb/feature/test_feature.rb +6 -4
  177. package/project/.sdk/tm/rust/feature/test.rs +8 -4
  178. package/project/.sdk/tm/scala/feature/TestFeature.scala +10 -6
  179. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/feature/TestFeature.swift +10 -6
  180. package/project/.sdk/tm/ts/test/live-entity.ts +26 -26
  181. package/project/.sdk/tm/ts/test/live-scenarios.ts +3 -3
  182. package/project/.sdk/tm/zig/feature/test.zig +11 -4
  183. package/project/sdkgen-package.json +1 -1
  184. package/src/cmp/ReadmeTop.ts +1 -1
  185. package/src/cmp/ReadmeUnions.ts +1 -1
  186. package/src/cmp/Test.ts +1 -1
  187. package/src/helpers/buildIdNames.ts +17 -7
  188. package/src/helpers/canonSpec.ts +2 -2
  189. package/src/helpers/getMatchEntries.ts +2 -2
  190. package/src/helpers/modelNames.ts +6 -1
  191. package/src/helpers/opShape.ts +33 -33
  192. package/src/helpers/pointPath.ts +5 -10
  193. package/src/helpers/resolved.ts +3 -14
  194. package/src/sdkgen.ts +3 -1
  195. package/src/utility.ts +16 -7
@@ -1,3 +1,4 @@
1
+ import { flowSteps } from '@voxgig/sdkgen'
1
2
 
2
3
  import {
3
4
  flatten,
@@ -85,10 +86,10 @@ const TestEntity = cmp(function TestEntity(props: any) {
85
86
  const idnames = buildIdNames(entity, basicflow)
86
87
  const idnamesStr = idnames.map(n => `"${n}"`).join(', ')
87
88
 
88
- const allSteps = Object.values(basicflow.step) as any[]
89
- const updateStep = allSteps.find((s: any) => s.op === 'update')
90
- const updateData = updateStep?.data
91
- ? Object.entries(updateStep.data).filter(([k]: any) => k !== 'id' && !k.endsWith('$'))
89
+ const allSteps = Object.values(flowSteps(basicflow)) as any[]
90
+ const updateStep = allSteps.find((s: any) => s.o === 'update')
91
+ const updateData = updateStep?.d
92
+ ? Object.entries(updateStep.d).filter(([k]: any) => k !== 'id' && !k.endsWith('$'))
92
93
  : []
93
94
  const aliases = updateData.map(([k, v]: any) => [k, v])
94
95
 
@@ -165,7 +166,7 @@ ${hasList ? `
165
166
  # multiple ops; skipping any one skips the whole flow (steps depend
166
167
  # on each other).
167
168
  _live = setup.get("live", False)
168
- for _op in [${(Array.from(new Set((basicflow.step as any[]).map((s: any) => s.op).filter(Boolean)))).map(o => `"${o}"`).join(', ')}]:
169
+ for _op in [${(Array.from(new Set((flowSteps(basicflow) as any[]).map((s: any) => s.o).filter(Boolean)))).map(o => `"${o}"`).join(', ')}]:
169
170
  _skip, _reason = runner.is_control_skipped("entityOp", "${entity.name}." + _op, "live" if _live else "unit")
170
171
  if _skip:
171
172
  pytest.skip(_reason or "skipped via sdk-test-control.json")
@@ -180,7 +181,7 @@ ${hasList ? `
180
181
  `)
181
182
 
182
183
  // Check if the flow has a create step
183
- const flowHasCreate = allSteps.some((s: any) => s.op === 'create')
184
+ const flowHasCreate = allSteps.some((s: any) => s.o === 'create')
184
185
  if (!flowHasCreate) {
185
186
  Content(` # Bootstrap entity data from existing test data.
186
187
  ${entity.name}_ref01_data_raw = vs.items(helpers.to_map(
@@ -193,16 +194,16 @@ ${hasList ? `
193
194
  }
194
195
 
195
196
  // Model-driven step iteration
196
- each(basicflow.step, (step: any, index: any) => {
197
+ each(flowSteps(basicflow), (step: any, index: any) => {
197
198
  // Never emit a REMOVE (or its removed-item verify LIST) without a
198
199
  // preceding CREATE: a coherent CRUD flow only removes what it created,
199
200
  // so a create-less remove would mutate pre-existing (live) data.
200
201
  if (!flowHasCreate) {
201
- if ('remove' === step.op) { return }
202
- if ('list' === step.op &&
203
- (step.valid || []).some((v: any) => 'ItemNotExists' === v.apply)) { return }
202
+ if ('remove' === step.o) { return }
203
+ if ('list' === step.o &&
204
+ (step.v || []).some((v: any) => 'ItemNotExists' === v.apply)) { return }
204
205
  }
205
- const opgen: OpGen = GENERATE_OP[step.op]
206
+ const opgen: OpGen = GENERATE_OP[step.o]
206
207
  if (opgen) {
207
208
  opgen(genCtx, step, index)
208
209
  Content('\n')
@@ -298,18 +299,18 @@ def _${entity.name}_basic_setup(extra):
298
299
 
299
300
  const generateCreate: OpGen = (ctx, step, index) => {
300
301
  const { entity, flow } = ctx
301
- const ref = step.input.ref ?? entity.name + '_ref01'
302
- const entvar = step.input.entvar ?? ref + '_ent'
303
- const datavar = step.input.datavar ?? (ref + '_data' + (step.input.suffix ?? ''))
302
+ const ref = step.i.ref ?? entity.name + '_ref01'
303
+ const entvar = step.i.entvar ?? ref + '_ent'
304
+ const datavar = step.i.datavar ?? (ref + '_data' + (step.i.suffix ?? ''))
304
305
 
305
- const priorSteps = Object.values(flow.step).slice(0, Number(index)) as any[]
306
+ const priorSteps = Object.values(flowSteps(flow)).slice(0, Number(index)) as any[]
306
307
  const needsEnt = !priorSteps.some((s: any) =>
307
- ['create', 'list', 'load', 'update', 'remove'].includes(s.op))
308
+ ['create', 'list', 'load', 'update', 'remove'].includes(s.o))
308
309
 
309
310
  const hasDatvar = priorSteps.some((s: any) => {
310
- if ('create' === s.op) {
311
- const priorRef = s.input.ref ?? entity.name + '_ref01'
312
- const priorDatvar = s.input.datavar ?? (priorRef + '_data' + (s.input.suffix ?? ''))
311
+ if ('create' === s.o) {
312
+ const priorRef = s.i.ref ?? entity.name + '_ref01'
313
+ const priorDatvar = s.i.datavar ?? (priorRef + '_data' + (s.i.suffix ?? ''))
313
314
  return priorDatvar === datavar
314
315
  }
315
316
  return false
@@ -354,14 +355,14 @@ const generateCreate: OpGen = (ctx, step, index) => {
354
355
  const generateList: OpGen = (ctx, step, index) => {
355
356
  const { entity, flow } = ctx
356
357
  const hasDataId = null != entityDataIdField(entity)
357
- const ref = step.input.ref ?? entity.name + '_ref01'
358
- const entvar = step.input.entvar ?? ref + '_ent'
359
- const matchvar = step.input.matchvar ?? (ref + '_match' + (step.input.suffix ?? ''))
360
- const listvar = step.input.listvar ?? (ref + '_list' + (step.input.suffix ?? ''))
358
+ const ref = step.i.ref ?? entity.name + '_ref01'
359
+ const entvar = step.i.entvar ?? ref + '_ent'
360
+ const matchvar = step.i.matchvar ?? (ref + '_match' + (step.i.suffix ?? ''))
361
+ const listvar = step.i.listvar ?? (ref + '_list' + (step.i.suffix ?? ''))
361
362
 
362
- const priorSteps = Object.values(flow.step).slice(0, Number(index)) as any[]
363
+ const priorSteps = Object.values(flowSteps(flow)).slice(0, Number(index)) as any[]
363
364
  const needsEnt = !priorSteps.some((s: any) =>
364
- ['create', 'list', 'load', 'update', 'remove'].includes(s.op))
365
+ ['create', 'list', 'load', 'update', 'remove'].includes(s.o))
365
366
 
366
367
  Content(` # LIST
367
368
  `)
@@ -391,12 +392,12 @@ const generateList: OpGen = (ctx, step, index) => {
391
392
  `)
392
393
 
393
394
  // Handle validators
394
- const allSteps = Object.values(flow.step) as any[]
395
- if (step.valid) {
396
- for (const validator of step.valid) {
395
+ const allSteps = Object.values(flowSteps(flow)) as any[]
396
+ if (step.v) {
397
+ for (const validator of step.v) {
397
398
  const validRef = validator.def?.ref
398
- const hasRefData = validRef && allSteps.some((s: any) => 'create' === s.op &&
399
- ((s.input.ref ?? entity.name + '_ref01') === validRef))
399
+ const hasRefData = validRef && allSteps.some((s: any) => 'create' === s.o &&
400
+ ((s.i.ref ?? entity.name + '_ref01') === validRef))
400
401
 
401
402
  if ('ItemExists' === validator.apply && hasRefData && hasDataId) {
402
403
  const refDataVar = validRef + '_data'
@@ -422,16 +423,16 @@ const generateList: OpGen = (ctx, step, index) => {
422
423
 
423
424
  const generateUpdate: OpGen = (ctx, step, index) => {
424
425
  const { entity, flow } = ctx
425
- const ref = step.input.ref ?? entity.name + '_ref01'
426
- const entvar = step.input.entvar ?? ref + '_ent'
427
- const datavar = step.input.datavar ?? (ref + '_data' + (step.input.suffix ?? ''))
428
- const resdatavar = step.input.resdatavar ?? (ref + '_resdata' + (step.input.suffix ?? ''))
429
- const markdefvar = step.input.markdefvar ?? (ref + '_markdef' + (step.input.suffix ?? ''))
430
- const srcdatavar = step.input.srcdatavar ?? (ref + '_data' + (step.input.suffix ?? ''))
431
-
432
- const priorSteps = Object.values(flow.step).slice(0, Number(index)) as any[]
426
+ const ref = step.i.ref ?? entity.name + '_ref01'
427
+ const entvar = step.i.entvar ?? ref + '_ent'
428
+ const datavar = step.i.datavar ?? (ref + '_data' + (step.i.suffix ?? ''))
429
+ const resdatavar = step.i.resdatavar ?? (ref + '_resdata' + (step.i.suffix ?? ''))
430
+ const markdefvar = step.i.markdefvar ?? (ref + '_markdef' + (step.i.suffix ?? ''))
431
+ const srcdatavar = step.i.srcdatavar ?? (ref + '_data' + (step.i.suffix ?? ''))
432
+
433
+ const priorSteps = Object.values(flowSteps(flow)).slice(0, Number(index)) as any[]
433
434
  const needsEnt = !priorSteps.some((s: any) =>
434
- ['create', 'list', 'load', 'update', 'remove'].includes(s.op))
435
+ ['create', 'list', 'load', 'update', 'remove'].includes(s.o))
435
436
 
436
437
  const hasEntIdU = null != entity.id
437
438
 
@@ -448,8 +449,8 @@ const generateUpdate: OpGen = (ctx, step, index) => {
448
449
  `)
449
450
  }
450
451
 
451
- if (step.data) {
452
- const dataEntries = Object.entries(step.data).filter(([k]: any) => k !== 'id' && !k.endsWith('$'))
452
+ if (step.d) {
453
+ const dataEntries = Object.entries(step.d).filter(([k]: any) => k !== 'id' && !k.endsWith('$'))
453
454
  for (const [key] of dataEntries) {
454
455
  Content(` "${key}": setup["idmap"]["${key}"],
455
456
  `)
@@ -459,10 +460,10 @@ const generateUpdate: OpGen = (ctx, step, index) => {
459
460
  Content(` }
460
461
  `)
461
462
 
462
- if (step.spec) {
463
- for (const spec of step.spec) {
464
- if ('TextFieldMark' === spec.apply && null != step.input.textfield) {
465
- const fieldname = step.input.textfield
463
+ if (step.s) {
464
+ for (const spec of step.s) {
465
+ if ('TextFieldMark' === spec.apply && null != step.i.textfield) {
466
+ const fieldname = step.i.textfield
466
467
  const fieldvalue = spec.def?.mark ?? `Mark01-${ref}`
467
468
  Content(`
468
469
  ${markdefvar}_name = "${fieldname}"
@@ -482,9 +483,9 @@ const generateUpdate: OpGen = (ctx, step, index) => {
482
483
  `)
483
484
  }
484
485
 
485
- if (step.spec) {
486
- for (const spec of step.spec) {
487
- if ('TextFieldMark' === spec.apply && null != step.input.textfield) {
486
+ if (step.s) {
487
+ for (const spec of step.s) {
488
+ if ('TextFieldMark' === spec.apply && null != step.i.textfield) {
488
489
  Content(` assert ${resdatavar}[${markdefvar}_name] == ${markdefvar}_value
489
490
  `)
490
491
  }
@@ -495,23 +496,23 @@ const generateUpdate: OpGen = (ctx, step, index) => {
495
496
 
496
497
  const generateLoad: OpGen = (ctx, step, index) => {
497
498
  const { entity, flow } = ctx
498
- const ref = step.input.ref ?? entity.name + '_ref01'
499
- const entvar = step.input.entvar ?? ref + '_ent'
500
- const matchvar = step.input.matchvar ?? (ref + '_match' + (step.input.suffix ?? ''))
501
- const datavar = step.input.datavar ?? (ref + '_data' + (step.input.suffix ?? ''))
502
- const srcdatavar = step.input.srcdatavar ?? (ref + '_data' + (step.input.suffix ?? ''))
499
+ const ref = step.i.ref ?? entity.name + '_ref01'
500
+ const entvar = step.i.entvar ?? ref + '_ent'
501
+ const matchvar = step.i.matchvar ?? (ref + '_match' + (step.i.suffix ?? ''))
502
+ const datavar = step.i.datavar ?? (ref + '_data' + (step.i.suffix ?? ''))
503
+ const srcdatavar = step.i.srcdatavar ?? (ref + '_data' + (step.i.suffix ?? ''))
503
504
 
504
- const priorSteps = Object.values(flow.step).slice(0, Number(index)) as any[]
505
+ const priorSteps = Object.values(flowSteps(flow)).slice(0, Number(index)) as any[]
505
506
  const hasEntVar = priorSteps.some((s: any) =>
506
- ['create', 'list', 'load', 'update', 'remove'].includes(s.op))
507
+ ['create', 'list', 'load', 'update', 'remove'].includes(s.o))
507
508
 
508
- const flowHasCreate = Object.values(flow.step).some((s: any) => (s as any).op === 'create')
509
+ const flowHasCreate = Object.values(flowSteps(flow)).some((s: any) => (s as any).o === 'create')
509
510
  const preambleRef = entity.name + '_ref01'
510
511
  const hasSrcData = (!flowHasCreate && srcdatavar === (preambleRef + '_data')) ||
511
512
  priorSteps.some((s: any) => {
512
- if ('create' === s.op) {
513
- const priorRef = s.input.ref ?? entity.name + '_ref01'
514
- const priorDatvar = s.input.datavar ?? (priorRef + '_data' + (s.input.suffix ?? ''))
513
+ if ('create' === s.o) {
514
+ const priorRef = s.i.ref ?? entity.name + '_ref01'
515
+ const priorDatvar = s.i.datavar ?? (priorRef + '_data' + (s.i.suffix ?? ''))
515
516
  return priorDatvar === srcdatavar
516
517
  }
517
518
  return false
@@ -557,14 +558,14 @@ const generateRemove: OpGen = (ctx, step, index) => {
557
558
  if (null == entityDataIdField(entity)) {
558
559
  return
559
560
  }
560
- const ref = step.input.ref ?? entity.name + '_ref01'
561
- const entvar = step.input.entvar ?? ref + '_ent'
562
- const matchvar = step.input.matchvar ?? (ref + '_match' + (step.input.suffix ?? ''))
563
- const srcdatavar = step.input.srcdatavar ?? (ref + '_data')
561
+ const ref = step.i.ref ?? entity.name + '_ref01'
562
+ const entvar = step.i.entvar ?? ref + '_ent'
563
+ const matchvar = step.i.matchvar ?? (ref + '_match' + (step.i.suffix ?? ''))
564
+ const srcdatavar = step.i.srcdatavar ?? (ref + '_data')
564
565
 
565
- const priorSteps = Object.values(flow.step).slice(0, Number(index)) as any[]
566
+ const priorSteps = Object.values(flowSteps(flow)).slice(0, Number(index)) as any[]
566
567
  const needsEnt = !priorSteps.some((s: any) =>
567
- ['create', 'list', 'load', 'update', 'remove'].includes(s.op))
568
+ ['create', 'list', 'load', 'update', 'remove'].includes(s.o))
568
569
 
569
570
  Content(` # REMOVE
570
571
  `)
@@ -317,11 +317,11 @@ class EntityFrames:
317
317
  // and the doc table the docstring shows.
318
318
  function entFields(ent: any): { name: string, dtype: string, req: boolean }[] {
319
319
  return each(ent.fields)
320
- .filter((f: any) => f && null != f.name && false !== f.active)
320
+ .filter((f: any) => f && null != f.n && false !== f.a)
321
321
  .map((f: any) => ({
322
- name: String(f.name),
323
- dtype: canonToDtype(f.type),
324
- req: true === f.req,
322
+ name: String(f.n),
323
+ dtype: canonToDtype(f.t),
324
+ req: true === f.r,
325
325
  }))
326
326
  }
327
327
 
@@ -71,8 +71,8 @@ const EntityTypes = cmp(function EntityTypes(props: any) {
71
71
 
72
72
  # Typed models for the ${model.const.Name} SDK.
73
73
  #
74
- # GENERATED from the API model: main.${KIT}.entity.<e>.fields[] and per-op
75
- # params (op.<name>.points[].args.params[]). Member types come from the
74
+ # GENERATED from the API model: main.${KIT}.entity.<e>.fields{} and per-op
75
+ # params (op.<name>.points[].g.params[]). Member types come from the
76
76
  # canonical type sentinels via @voxgig/sdkgen canonToType (source of truth:
77
77
  # @voxgig/apidef VALID_CANON). Ruby types are unenforced; these YARD
78
78
  # annotations document the shapes. Do not edit by hand.
@@ -83,12 +83,12 @@ const EntityTypes = cmp(function EntityTypes(props: any) {
83
83
  const Name = ent.Name
84
84
  const TypeName = rbSafeTypeName(Name)
85
85
  const fields = (ent.fields ? each(ent.fields) : [])
86
- .filter((f: any) => f.active !== false)
86
+ .filter((f: any) => f.a !== false)
87
87
 
88
88
  emitStruct(
89
89
  TypeName,
90
90
  `${Name} entity data model.`,
91
- fields.map((f: any) => ({ name: f.name, type: f.type, optional: false === f.req })),
91
+ fields.map((f: any) => ({ name: f.n, type: f.t, optional: false === f.r })),
92
92
  )
93
93
 
94
94
  const ops = ent.op || {}
@@ -50,7 +50,7 @@ const ReadmeEntity = cmp(function ReadmeEntity(props: any) {
50
50
 
51
51
  publishedEntities.map((entity: any) => {
52
52
  const opnames = Object.keys(entity.op || {})
53
- const fields = entity.fields || []
53
+ const fields = Object.values(entity.fields || {})
54
54
  const idF = entityIdField(entity)
55
55
  // Sanitise the local variable name — an entity whose lowercased name is a
56
56
  // Ruby keyword (e.g. `self`) would otherwise emit uncompilable code.
@@ -97,8 +97,8 @@ const ReadmeEntity = cmp(function ReadmeEntity(props: any) {
97
97
  `)
98
98
 
99
99
  each(fields, (field: any) => {
100
- const desc = field.short || ''
101
- Content(`| \`${field.name}\` | \`${canonToType(field.type, target.name)}\` | ${desc} |
100
+ const desc = field.sh || ''
101
+ Content(`| \`${field.n}\` | \`${canonToType(field.t, target.name)}\` | ${desc} |
102
102
  `)
103
103
  })
104
104
 
@@ -115,13 +115,13 @@ returns a result \`Hash\` with these keys:
115
115
 
116
116
  `)
117
117
  each(entityList, (ent: any) => {
118
- const fields = ent.fields || []
118
+ const fields = Object.values(ent.fields || {})
119
119
  const opnames = Object.keys(ent.op || {})
120
120
  const ops = ent.op || {}
121
121
  const points = each(ops).map((op: any) =>
122
122
  op.points ? each(op.points) : []
123
123
  ).flat()
124
- const path = points.length > 0 ? (points[0] as any).orig || '' : ''
124
+ const path = points.length > 0 ? (points[0] as any).o || '' : ''
125
125
 
126
126
  Content(`#### ${ent.Name}
127
127
 
@@ -129,7 +129,7 @@ returns a result \`Hash\` with these keys:
129
129
  | --- | --- |
130
130
  `)
131
131
  each(fields, (field: any) => {
132
- Content(`| \`${field.name}\` | ${field.short || ''} |
132
+ Content(`| \`${field.n}\` | ${field.sh || ''} |
133
133
  `)
134
134
  })
135
135
 
@@ -66,13 +66,13 @@ client = ${ctor}
66
66
  // Model-driven display field: the entity's first non-id string field
67
67
  // (falling back to any non-id field), so the list example prints a real
68
68
  // column instead of a hardcoded "name" the entity may not have.
69
- const fields = exampleEntity.fields || []
69
+ const fields: any[] = Object.values(exampleEntity.fields || {})
70
70
  const displayField =
71
- fields.find((f: any) => f && f.name !== 'id' && f.type === '$STRING') ||
72
- fields.find((f: any) => f && f.name !== 'id') ||
71
+ fields.find((f: any) => f && f.n !== 'id' && f.t === '$STRING') ||
72
+ fields.find((f: any) => f && f.n !== 'id') ||
73
73
  null
74
74
  const idCol = dataIdF ? `#{item[${JSON.stringify(dataIdF)}]}` : null
75
- const dispCol = displayField ? `#{item[${JSON.stringify(displayField.name)}]}` : null
75
+ const dispCol = displayField ? `#{item[${JSON.stringify(displayField.n)}]}` : null
76
76
  const itemPrint = [idCol, dispCol].filter(Boolean).join(' ') || '#{item}'
77
77
 
78
78
  if (opnames.includes('list')) {
@@ -169,7 +169,7 @@ same parameters as \`direct()\`. Raises on error.
169
169
  // Entity reference sections
170
170
  publishedEntities.map((ent: any) => {
171
171
  const opnames = Object.keys(ent.op || {})
172
- const fields = ent.fields || []
172
+ const fields = Object.values(ent.fields || {})
173
173
  // Model-driven id key: null when this entity has no id-like field, in
174
174
  // which case load/remove match on no argument and update omits the id.
175
175
  const idF = entityIdField(ent)
@@ -204,9 +204,9 @@ ${eVar} = client.${ent.Name}
204
204
  | --- | --- | --- | --- |
205
205
  `)
206
206
  each(fields, (field: any) => {
207
- const req = field.req ? 'Yes' : 'No'
208
- const desc = field.short || ''
209
- Content(`| \`${field.name}\` | \`${canonToType(field.type, target.name)}\` | ${req} | ${desc} |
207
+ const req = field.r ? 'Yes' : 'No'
208
+ const desc = field.sh || ''
209
+ Content(`| \`${field.n}\` | \`${canonToType(field.t, target.name)}\` | ${req} | ${desc} |
210
210
  `)
211
211
  })
212
212
 
@@ -233,7 +233,7 @@ ${eVar} = client.${ent.Name}
233
233
  if (fop.active === false) return '-'
234
234
  return 'Yes'
235
235
  })
236
- Content(`| \`${field.name}\` | ${cols.join(' | ')} |
236
+ Content(`| \`${field.n}\` | ${cols.join(' | ')} |
237
237
  `)
238
238
  })
239
239
 
@@ -26,7 +26,7 @@ const Schema = cmp(async function Schema(props: any) {
26
26
  Content(`# ${model.const.Name} ${target.Name} SDK: generated schemas. Do not edit.
27
27
  #
28
28
  # Generated from the model: \`main.kit.optspec\` and each feature's
29
- # \`config.options\` for OPTSPEC; entity \`fields[].type\` for ENTITYSPEC.
29
+ # \`config.options\` for OPTSPEC; entity \`fields{}.type\` for ENTITYSPEC.
30
30
 
31
31
  require 'json'
32
32
 
@@ -33,10 +33,10 @@ function normalizePathParams(
33
33
  // original name was renamed to another param's current name (e.g. badge
34
34
  // load: param 'group_id' has orig 'id', and another param has name 'id').
35
35
  const param = params.find((p: any) =>
36
- p.name === snaked || p.name === depluralized) ||
36
+ p.n === snaked || p.n === depluralized) ||
37
37
  params.find((p: any) =>
38
- p.orig === snaked || p.orig === depluralized)
39
- if (param) return '{' + param.name + '}'
38
+ p.or === snaked || p.or === depluralized)
39
+ if (param) return '{' + param.n + '}'
40
40
 
41
41
  if (rename) {
42
42
  for (const [origCamel, renamedTo] of Object.entries(rename)) {
@@ -44,10 +44,10 @@ function normalizePathParams(
44
44
  const origSnaked = snakify(origCamel)
45
45
  const origDepluralized = depluralize(origSnaked)
46
46
  const renamedParam = params.find(
47
- (p: any) => p.orig === origSnaked || p.name === origSnaked ||
48
- p.orig === origDepluralized || p.name === origDepluralized
47
+ (p: any) => p.or === origSnaked || p.n === origSnaked ||
48
+ p.or === origDepluralized || p.n === origDepluralized
49
49
  )
50
- if (renamedParam) return '{' + renamedParam.name + '}'
50
+ if (renamedParam) return '{' + renamedParam.n + '}'
51
51
  }
52
52
  }
53
53
  }
@@ -100,8 +100,8 @@ const TestDirect = cmp(function TestDirect(props: any) {
100
100
  const listOp = entity.op?.list
101
101
 
102
102
  const loadPoint = loadOp?.points?.[0]
103
- const loadPath = loadPoint ? normalizePathParams(pointParts(loadPoint), loadPoint?.args?.params || [], loadPoint?.rename?.param) : ''
104
- const allLoadParams = loadPoint?.args?.params || []
103
+ const loadPath = loadPoint ? normalizePathParams(pointParts(loadPoint), loadPoint?.g?.params || [], loadPoint?.r?.param) : ''
104
+ const allLoadParams = loadPoint?.g?.params || []
105
105
  // Some upstream OpenAPI specs declare a parameter as `in: path` even when
106
106
  // that path has no `{name}` placeholder for it. Only path params that
107
107
  // actually appear in the URL template should drive direct-test path-param
@@ -113,7 +113,7 @@ const TestDirect = cmp(function TestDirect(props: any) {
113
113
  _pathPlaceholders.add(part.slice(1, -1))
114
114
  }
115
115
  }
116
- const _renameMap = (loadPoint?.rename?.param || {}) as Record<string, string>
116
+ const _renameMap = (loadPoint?.r?.param || {}) as Record<string, string>
117
117
  const _renamedPlaceholders = new Set<string>()
118
118
  for (const ph of _pathPlaceholders) {
119
119
  _renamedPlaceholders.add(ph)
@@ -122,25 +122,25 @@ const TestDirect = cmp(function TestDirect(props: any) {
122
122
  }
123
123
  }
124
124
  const loadParams = allLoadParams.filter((p: any) =>
125
- _renamedPlaceholders.has(p.name) || _renamedPlaceholders.has(p.orig))
125
+ _renamedPlaceholders.has(p.n) || _renamedPlaceholders.has(p.or))
126
126
 
127
127
  const listPoint = listOp?.points?.[0]
128
- const listPath = listPoint ? normalizePathParams(pointParts(listPoint), listPoint?.args?.params || [], listPoint?.rename?.param) : ''
129
- const listParams = listPoint?.args?.params || []
128
+ const listPath = listPoint ? normalizePathParams(pointParts(listPoint), listPoint?.g?.params || [], listPoint?.r?.param) : ''
129
+ const listParams = listPoint?.g?.params || []
130
130
 
131
131
  // Required query params with spec-provided examples — needed in live mode.
132
- const loadQuery = loadPoint?.args?.query || []
132
+ const loadQuery = loadPoint?.g?.query || []
133
133
  const loadLiveQueryEntries = loadQuery
134
- .filter((q: any) => q.reqd && undefined !== q.example && null !== q.example)
134
+ .filter((q: any) => q.r && undefined !== q.ex && null !== q.ex)
135
135
  const loadLiveQueryLines = loadLiveQueryEntries
136
- .map((q: any) => ` query["${q.name}"] = ${JSON.stringify(q.example)}`)
136
+ .map((q: any) => ` query["${q.n}"] = ${JSON.stringify(q.ex)}`)
137
137
  .join('\n')
138
138
 
139
139
  const loadAllHaveExamples =
140
140
  loadParams.length > 0 &&
141
- loadParams.every((p: any) => undefined !== p.example && null !== p.example)
141
+ loadParams.every((p: any) => undefined !== p.ex && null !== p.ex)
142
142
  const loadExampleLines = loadAllHaveExamples
143
- ? loadParams.map((p: any) => ` params["${p.name}"] = ${JSON.stringify(p.example)}`).join('\n')
143
+ ? loadParams.map((p: any) => ` params["${p.n}"] = ${JSON.stringify(p.ex)}`).join('\n')
144
144
  : ''
145
145
 
146
146
  const entidEnvVar = `${PROJECTNAME}_TEST_${envToken(entity.name)}_ENTID`
@@ -159,9 +159,9 @@ class ${entity.Name}DirectTest < Minitest::Test
159
159
 
160
160
  if (hasList && listPoint) {
161
161
  const listLiveIdKeys: string[] = listParams.map((lp: any) => {
162
- return lp.name === 'id'
162
+ return lp.n === 'id'
163
163
  ? entity.name + '01'
164
- : lp.name.replace(/_id$/, '') + '01'
164
+ : lp.n.replace(/_id$/, '') + '01'
165
165
  })
166
166
  const listSkipBlock = listLiveIdKeys.length > 0
167
167
  ? ` if setup[:live]
@@ -192,13 +192,13 @@ ${listSkipBlock} client = setup[:client]
192
192
  Content(` params = {}
193
193
  `)
194
194
  for (const lp of listParams) {
195
- const key = lp.name === 'id'
195
+ const key = lp.n === 'id'
196
196
  ? entity.name + '01'
197
- : lp.name.replace(/_id$/, '') + '01'
197
+ : lp.n.replace(/_id$/, '') + '01'
198
198
  Content(` if setup[:live]
199
- params["${lp.name}"] = setup[:idmap]["${key}"]
199
+ params["${lp.n}"] = setup[:idmap]["${key}"]
200
200
  else
201
- params["${lp.name}"] = "direct01"
201
+ params["${lp.n}"] = "direct01"
202
202
  end
203
203
  `)
204
204
  }
@@ -281,7 +281,7 @@ ${loadSkipBlock} client = setup[:client]
281
281
  Content(` else
282
282
  `)
283
283
  for (let i = 0; i < loadParams.length; i++) {
284
- Content(` params["${loadParams[i].name}"] = "direct0${i + 1}"
284
+ Content(` params["${loadParams[i].n}"] = "direct0${i + 1}"
285
285
  `)
286
286
  }
287
287
  Content(` end
@@ -296,7 +296,7 @@ ${loadLiveQueryLines}
296
296
  Content(` unless setup[:live]
297
297
  `)
298
298
  for (let i = 0; i < loadParams.length; i++) {
299
- Content(` params["${loadParams[i].name}"] = "direct0${i + 1}"
299
+ Content(` params["${loadParams[i].n}"] = "direct0${i + 1}"
300
300
  `)
301
301
  }
302
302
  Content(` end