@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
@@ -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`
@@ -160,9 +160,9 @@ describe("${entity.Name}Direct", function()
160
160
 
161
161
  if (hasList && listPoint) {
162
162
  const listLiveIdKeys: string[] = listParams.map((lp: any) => {
163
- return lp.name === 'id'
163
+ return lp.n === 'id'
164
164
  ? entity.name + '01'
165
- : lp.name.replace(/_id$/, '') + '01'
165
+ : lp.n.replace(/_id$/, '') + '01'
166
166
  })
167
167
  const listSkipBlock = listLiveIdKeys.length > 0
168
168
  ? ` if setup.live then
@@ -193,13 +193,13 @@ ${listSkipBlock} local client = setup.client
193
193
  Content(` local params = {}
194
194
  `)
195
195
  for (const lp of listParams) {
196
- const key = lp.name === 'id'
196
+ const key = lp.n === 'id'
197
197
  ? entity.name + '01'
198
- : lp.name.replace(/_id$/, '') + '01'
198
+ : lp.n.replace(/_id$/, '') + '01'
199
199
  Content(` if setup.live then
200
- params["${lp.name}"] = setup.idmap["${key}"]
200
+ params["${lp.n}"] = setup.idmap["${key}"]
201
201
  else
202
- params["${lp.name}"] = "direct01"
202
+ params["${lp.n}"] = "direct01"
203
203
  end
204
204
  `)
205
205
  }
@@ -282,7 +282,7 @@ ${loadSkipBlock} local client = setup.client
282
282
  Content(` else
283
283
  `)
284
284
  for (let i = 0; i < loadParams.length; i++) {
285
- Content(` params["${loadParams[i].name}"] = "direct0${i + 1}"
285
+ Content(` params["${loadParams[i].n}"] = "direct0${i + 1}"
286
286
  `)
287
287
  }
288
288
  Content(` end
@@ -297,7 +297,7 @@ ${loadLiveQueryLines}
297
297
  Content(` if not setup.live then
298
298
  `)
299
299
  for (let i = 0; i < loadParams.length; i++) {
300
- Content(` params["${loadParams[i].name}"] = "direct0${i + 1}"
300
+ Content(` params["${loadParams[i].n}"] = "direct0${i + 1}"
301
301
  `)
302
302
  }
303
303
  Content(` end
@@ -1,3 +1,4 @@
1
+ import { flowSteps } from '@voxgig/sdkgen'
1
2
 
2
3
  import {
3
4
  flatten,
@@ -88,10 +89,10 @@ const TestEntity = cmp(function TestEntity(props: any) {
88
89
  const idnames = buildIdNames(entity, basicflow)
89
90
  const idnamesStr = idnames.map(n => `"${n}"`).join(', ')
90
91
 
91
- const allSteps = Object.values(basicflow.step) as any[]
92
- const updateStep = allSteps.find((s: any) => s.op === 'update')
93
- const updateData = updateStep?.data
94
- ? Object.entries(updateStep.data).filter(([k]: any) => k !== 'id' && !k.endsWith('$'))
92
+ const allSteps = Object.values(flowSteps(basicflow)) as any[]
93
+ const updateStep = allSteps.find((s: any) => s.o === 'update')
94
+ const updateData = updateStep?.d
95
+ ? Object.entries(updateStep.d).filter(([k]: any) => k !== 'id' && !k.endsWith('$'))
95
96
  : []
96
97
  const aliases = updateData.map(([k, v]: any) => [k, v])
97
98
 
@@ -161,7 +162,7 @@ ${hasList ? `
161
162
  local setup = ${entity.name}_basic_setup(nil)
162
163
  -- Per-op sdk-test-control.json skip.
163
164
  local _live = setup.live or false
164
- for _, _op in ipairs({${(Array.from(new Set((allSteps as any[]).map((s: any) => s.op).filter(Boolean)))).map(o => `"${o}"`).join(', ')}}) do
165
+ for _, _op in ipairs({${(Array.from(new Set((allSteps as any[]).map((s: any) => s.o).filter(Boolean)))).map(o => `"${o}"`).join(', ')}}) do
165
166
  local _should_skip, _reason = runner.is_control_skipped("entityOp", "${entity.name}." .. _op, _live and "live" or "unit")
166
167
  if _should_skip then
167
168
  pending(_reason or "skipped via sdk-test-control.json")
@@ -179,7 +180,7 @@ ${hasList ? `
179
180
  `)
180
181
 
181
182
  // Check if the flow has a create step
182
- const flowHasCreate = allSteps.some((s: any) => s.op === 'create')
183
+ const flowHasCreate = allSteps.some((s: any) => s.o === 'create')
183
184
  if (!flowHasCreate) {
184
185
  Content(` -- Bootstrap entity data from existing test data.
185
186
  local ${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')
@@ -308,18 +309,18 @@ end
308
309
 
309
310
  const generateCreate: OpGen = (ctx, step, index) => {
310
311
  const { entity, flow } = ctx
311
- const ref = step.input.ref ?? entity.name + '_ref01'
312
- const entvar = step.input.entvar ?? ref + '_ent'
313
- const datavar = step.input.datavar ?? (ref + '_data' + (step.input.suffix ?? ''))
312
+ const ref = step.i.ref ?? entity.name + '_ref01'
313
+ const entvar = step.i.entvar ?? ref + '_ent'
314
+ const datavar = step.i.datavar ?? (ref + '_data' + (step.i.suffix ?? ''))
314
315
 
315
- const priorSteps = Object.values(flow.step).slice(0, Number(index)) as any[]
316
+ const priorSteps = Object.values(flowSteps(flow)).slice(0, Number(index)) as any[]
316
317
  const needsEnt = !priorSteps.some((s: any) =>
317
- ['create', 'list', 'load', 'update', 'remove'].includes(s.op))
318
+ ['create', 'list', 'load', 'update', 'remove'].includes(s.o))
318
319
 
319
320
  const hasDatvar = priorSteps.some((s: any) => {
320
- if ('create' === s.op) {
321
- const priorRef = s.input.ref ?? entity.name + '_ref01'
322
- const priorDatvar = s.input.datavar ?? (priorRef + '_data' + (s.input.suffix ?? ''))
321
+ if ('create' === s.o) {
322
+ const priorRef = s.i.ref ?? entity.name + '_ref01'
323
+ const priorDatvar = s.i.datavar ?? (priorRef + '_data' + (s.i.suffix ?? ''))
323
324
  return priorDatvar === datavar
324
325
  }
325
326
  return false
@@ -364,14 +365,14 @@ const generateCreate: OpGen = (ctx, step, index) => {
364
365
  const generateList: OpGen = (ctx, step, index) => {
365
366
  const { entity, flow } = ctx
366
367
  const hasDataId = null != entityDataIdField(entity)
367
- const ref = step.input.ref ?? entity.name + '_ref01'
368
- const entvar = step.input.entvar ?? ref + '_ent'
369
- const matchvar = step.input.matchvar ?? (ref + '_match' + (step.input.suffix ?? ''))
370
- const listvar = step.input.listvar ?? (ref + '_list' + (step.input.suffix ?? ''))
368
+ const ref = step.i.ref ?? entity.name + '_ref01'
369
+ const entvar = step.i.entvar ?? ref + '_ent'
370
+ const matchvar = step.i.matchvar ?? (ref + '_match' + (step.i.suffix ?? ''))
371
+ const listvar = step.i.listvar ?? (ref + '_list' + (step.i.suffix ?? ''))
371
372
 
372
- const priorSteps = Object.values(flow.step).slice(0, Number(index)) as any[]
373
+ const priorSteps = Object.values(flowSteps(flow)).slice(0, Number(index)) as any[]
373
374
  const needsEnt = !priorSteps.some((s: any) =>
374
- ['create', 'list', 'load', 'update', 'remove'].includes(s.op))
375
+ ['create', 'list', 'load', 'update', 'remove'].includes(s.o))
375
376
 
376
377
  Content(` -- LIST
377
378
  `)
@@ -402,12 +403,12 @@ const generateList: OpGen = (ctx, step, index) => {
402
403
  `)
403
404
 
404
405
  // Handle validators
405
- const allSteps = Object.values(flow.step) as any[]
406
- if (step.valid) {
407
- for (const validator of step.valid) {
406
+ const allSteps = Object.values(flowSteps(flow)) as any[]
407
+ if (step.v) {
408
+ for (const validator of step.v) {
408
409
  const validRef = validator.def?.ref
409
- const hasRefData = validRef && allSteps.some((s: any) => 'create' === s.op &&
410
- ((s.input.ref ?? entity.name + '_ref01') === validRef))
410
+ const hasRefData = validRef && allSteps.some((s: any) => 'create' === s.o &&
411
+ ((s.i.ref ?? entity.name + '_ref01') === validRef))
411
412
 
412
413
  if ('ItemExists' === validator.apply && hasRefData && hasDataId) {
413
414
  const refDataVar = validRef + '_data'
@@ -433,16 +434,16 @@ const generateList: OpGen = (ctx, step, index) => {
433
434
 
434
435
  const generateUpdate: OpGen = (ctx, step, index) => {
435
436
  const { entity, flow } = ctx
436
- const ref = step.input.ref ?? entity.name + '_ref01'
437
- const entvar = step.input.entvar ?? ref + '_ent'
438
- const datavar = step.input.datavar ?? (ref + '_data' + (step.input.suffix ?? ''))
439
- const resdatavar = step.input.resdatavar ?? (ref + '_resdata' + (step.input.suffix ?? ''))
440
- const markdefvar = step.input.markdefvar ?? (ref + '_markdef' + (step.input.suffix ?? ''))
441
- const srcdatavar = step.input.srcdatavar ?? (ref + '_data' + (step.input.suffix ?? ''))
442
-
443
- const priorSteps = Object.values(flow.step).slice(0, Number(index)) as any[]
437
+ const ref = step.i.ref ?? entity.name + '_ref01'
438
+ const entvar = step.i.entvar ?? ref + '_ent'
439
+ const datavar = step.i.datavar ?? (ref + '_data' + (step.i.suffix ?? ''))
440
+ const resdatavar = step.i.resdatavar ?? (ref + '_resdata' + (step.i.suffix ?? ''))
441
+ const markdefvar = step.i.markdefvar ?? (ref + '_markdef' + (step.i.suffix ?? ''))
442
+ const srcdatavar = step.i.srcdatavar ?? (ref + '_data' + (step.i.suffix ?? ''))
443
+
444
+ const priorSteps = Object.values(flowSteps(flow)).slice(0, Number(index)) as any[]
444
445
  const needsEnt = !priorSteps.some((s: any) =>
445
- ['create', 'list', 'load', 'update', 'remove'].includes(s.op))
446
+ ['create', 'list', 'load', 'update', 'remove'].includes(s.o))
446
447
 
447
448
  const hasEntIdU = null != entity.id
448
449
 
@@ -459,8 +460,8 @@ const generateUpdate: OpGen = (ctx, step, index) => {
459
460
  `)
460
461
  }
461
462
 
462
- if (step.data) {
463
- const dataEntries = Object.entries(step.data).filter(([k]: any) => k !== 'id' && !k.endsWith('$'))
463
+ if (step.d) {
464
+ const dataEntries = Object.entries(step.d).filter(([k]: any) => k !== 'id' && !k.endsWith('$'))
464
465
  for (const [key] of dataEntries) {
465
466
  Content(` ["${key}"] = setup.idmap["${key}"],
466
467
  `)
@@ -470,10 +471,10 @@ const generateUpdate: OpGen = (ctx, step, index) => {
470
471
  Content(` }
471
472
  `)
472
473
 
473
- if (step.spec) {
474
- for (const spec of step.spec) {
475
- if ('TextFieldMark' === spec.apply && null != step.input.textfield) {
476
- const fieldname = step.input.textfield
474
+ if (step.s) {
475
+ for (const spec of step.s) {
476
+ if ('TextFieldMark' === spec.apply && null != step.i.textfield) {
477
+ const fieldname = step.i.textfield
477
478
  const fieldvalue = spec.def?.mark ?? `Mark01-${ref}`
478
479
  Content(`
479
480
  local ${markdefvar}_name = "${fieldname}"
@@ -495,9 +496,9 @@ const generateUpdate: OpGen = (ctx, step, index) => {
495
496
  `)
496
497
  }
497
498
 
498
- if (step.spec) {
499
- for (const spec of step.spec) {
500
- if ('TextFieldMark' === spec.apply && null != step.input.textfield) {
499
+ if (step.s) {
500
+ for (const spec of step.s) {
501
+ if ('TextFieldMark' === spec.apply && null != step.i.textfield) {
501
502
  Content(` assert.are.equal(${resdatavar}[${markdefvar}_name], ${markdefvar}_value)
502
503
  `)
503
504
  }
@@ -508,23 +509,23 @@ const generateUpdate: OpGen = (ctx, step, index) => {
508
509
 
509
510
  const generateLoad: OpGen = (ctx, step, index) => {
510
511
  const { entity, flow } = ctx
511
- const ref = step.input.ref ?? entity.name + '_ref01'
512
- const entvar = step.input.entvar ?? ref + '_ent'
513
- const matchvar = step.input.matchvar ?? (ref + '_match' + (step.input.suffix ?? ''))
514
- const datavar = step.input.datavar ?? (ref + '_data' + (step.input.suffix ?? ''))
515
- const srcdatavar = step.input.srcdatavar ?? (ref + '_data' + (step.input.suffix ?? ''))
512
+ const ref = step.i.ref ?? entity.name + '_ref01'
513
+ const entvar = step.i.entvar ?? ref + '_ent'
514
+ const matchvar = step.i.matchvar ?? (ref + '_match' + (step.i.suffix ?? ''))
515
+ const datavar = step.i.datavar ?? (ref + '_data' + (step.i.suffix ?? ''))
516
+ const srcdatavar = step.i.srcdatavar ?? (ref + '_data' + (step.i.suffix ?? ''))
516
517
 
517
- const priorSteps = Object.values(flow.step).slice(0, Number(index)) as any[]
518
+ const priorSteps = Object.values(flowSteps(flow)).slice(0, Number(index)) as any[]
518
519
  const hasEntVar = priorSteps.some((s: any) =>
519
- ['create', 'list', 'load', 'update', 'remove'].includes(s.op))
520
+ ['create', 'list', 'load', 'update', 'remove'].includes(s.o))
520
521
 
521
- const flowHasCreate = Object.values(flow.step).some((s: any) => (s as any).op === 'create')
522
+ const flowHasCreate = Object.values(flowSteps(flow)).some((s: any) => (s as any).o === 'create')
522
523
  const preambleRef = entity.name + '_ref01'
523
524
  const hasSrcData = (!flowHasCreate && srcdatavar === (preambleRef + '_data')) ||
524
525
  priorSteps.some((s: any) => {
525
- if ('create' === s.op) {
526
- const priorRef = s.input.ref ?? entity.name + '_ref01'
527
- const priorDatvar = s.input.datavar ?? (priorRef + '_data' + (s.input.suffix ?? ''))
526
+ if ('create' === s.o) {
527
+ const priorRef = s.i.ref ?? entity.name + '_ref01'
528
+ const priorDatvar = s.i.datavar ?? (priorRef + '_data' + (s.i.suffix ?? ''))
528
529
  return priorDatvar === srcdatavar
529
530
  }
530
531
  return false
@@ -573,14 +574,14 @@ const generateRemove: OpGen = (ctx, step, index) => {
573
574
  if (null == entityDataIdField(entity)) {
574
575
  return
575
576
  }
576
- const ref = step.input.ref ?? entity.name + '_ref01'
577
- const entvar = step.input.entvar ?? ref + '_ent'
578
- const matchvar = step.input.matchvar ?? (ref + '_match' + (step.input.suffix ?? ''))
579
- const srcdatavar = step.input.srcdatavar ?? (ref + '_data')
577
+ const ref = step.i.ref ?? entity.name + '_ref01'
578
+ const entvar = step.i.entvar ?? ref + '_ent'
579
+ const matchvar = step.i.matchvar ?? (ref + '_match' + (step.i.suffix ?? ''))
580
+ const srcdatavar = step.i.srcdatavar ?? (ref + '_data')
580
581
 
581
- const priorSteps = Object.values(flow.step).slice(0, Number(index)) as any[]
582
+ const priorSteps = Object.values(flowSteps(flow)).slice(0, Number(index)) as any[]
582
583
  const needsEnt = !priorSteps.some((s: any) =>
583
- ['create', 'list', 'load', 'update', 'remove'].includes(s.op))
584
+ ['create', 'list', 'load', 'update', 'remove'].includes(s.o))
584
585
 
585
586
  Content(` -- REMOVE
586
587
  `)
@@ -68,7 +68,7 @@ const ReadmeEntity = cmp(function ReadmeEntity(props: any) {
68
68
 
69
69
  publishedEntities.map((entity: any) => {
70
70
  const opnames = Object.keys(entity.op || {})
71
- const fields = entity.fields || []
71
+ const fields = Object.values(entity.fields || {})
72
72
  // Model-driven id key: null when this entity has no id-like field.
73
73
  const idF = entityIdField(entity)
74
74
  const fn = ocamlVarName(entity.name)
@@ -114,8 +114,8 @@ const ReadmeEntity = cmp(function ReadmeEntity(props: any) {
114
114
  `)
115
115
 
116
116
  each(fields, (field: any) => {
117
- const desc = field.short || ''
118
- Content(`| \`${field.name}\` | \`${ocamlType(field.type)}\` | ${desc} |
117
+ const desc = field.sh || ''
118
+ Content(`| \`${field.n}\` | \`${ocamlType(field.t)}\` | ${desc} |
119
119
  `)
120
120
  })
121
121
 
@@ -123,13 +123,13 @@ On error, \`ok\` is \`Bool false\` and \`err\` carries the error value.
123
123
 
124
124
  `)
125
125
  each(entityList, (ent: any) => {
126
- const fields = ent.fields || []
126
+ const fields = Object.values(ent.fields || {})
127
127
  const opnames = Object.keys(ent.op || {})
128
128
  const ops = ent.op || {}
129
129
  const points = each(ops).map((op: any) =>
130
130
  op.points ? each(op.points) : []
131
131
  ).flat()
132
- const path = points.length > 0 ? (points[0] as any).orig || '' : ''
132
+ const path = points.length > 0 ? (points[0] as any).o || '' : ''
133
133
 
134
134
  Content(`#### ${ent.Name}
135
135
 
@@ -137,7 +137,7 @@ On error, \`ok\` is \`Bool false\` and \`err\` carries the error value.
137
137
  | --- | --- |
138
138
  `)
139
139
  each(fields, (field: any) => {
140
- Content(`| \`${field.name}\` | ${field.short || ''} |
140
+ Content(`| \`${field.n}\` | ${field.sh || ''} |
141
141
  `)
142
142
  })
143
143
 
@@ -177,7 +177,7 @@ on error.
177
177
  // Entity reference sections
178
178
  publishedEntities.map((ent: any) => {
179
179
  const opnames = Object.keys(ent.op || {})
180
- const fields = ent.fields || []
180
+ const fields = Object.values(ent.fields || {})
181
181
  const idF = entityIdField(ent)
182
182
  const fn = ocamlVarName(ent.name)
183
183
 
@@ -209,9 +209,9 @@ let ${fn} = Sdk_client.${fn} client Noval
209
209
  | --- | --- | --- | --- |
210
210
  `)
211
211
  each(fields, (field: any) => {
212
- const req = field.req ? 'Yes' : 'No'
213
- const desc = field.short || ''
214
- Content(`| \`${field.name}\` | \`${ocamlType(field.type)}\` | ${req} | ${desc} |
212
+ const req = field.r ? 'Yes' : 'No'
213
+ const desc = field.sh || ''
214
+ Content(`| \`${field.n}\` | \`${ocamlType(field.t)}\` | ${req} | ${desc} |
215
215
  `)
216
216
  })
217
217
 
@@ -236,7 +236,7 @@ let ${fn} = Sdk_client.${fn} client Noval
236
236
  if (fop.active === false) return '-'
237
237
  return 'Yes'
238
238
  })
239
- Content(`| \`${field.name}\` | ${cols.join(' | ')} |
239
+ Content(`| \`${field.n}\` | ${cols.join(' | ')} |
240
240
  `)
241
241
  })
242
242
 
@@ -31,7 +31,7 @@ const Schema = cmp(async function Schema(props: any) {
31
31
  Content(`(* ${model.const.Name} SDK: generated schemas. Do not edit.
32
32
  *
33
33
  * Built from the model: main.kit.optspec and each feature's config.options
34
- * for the option spec; entity fields[].type for the entity specs.
34
+ * for the option spec; entity fields{}.type for the entity specs.
35
35
  *
36
36
  * opt_spec_value () - the option spec make_options validates client options
37
37
  * against. entity_spec_value () - per-entity data and request specs, keyed by
@@ -62,7 +62,7 @@ const ReadmeEntity = cmp(function ReadmeEntity(props: any) {
62
62
 
63
63
  publishedEntities.map((entity: any) => {
64
64
  const opnames = Object.keys(entity.op || {})
65
- const fields = entity.fields || []
65
+ const fields = Object.values(entity.fields || {})
66
66
  const idF = entityIdField(entity)
67
67
  const eVar = entity.name
68
68
 
@@ -107,8 +107,8 @@ const ReadmeEntity = cmp(function ReadmeEntity(props: any) {
107
107
  `)
108
108
 
109
109
  each(fields, (field: any) => {
110
- const desc = field.short || ''
111
- Content(`| \`${field.name}\` | \`${perlType(field.type)}\` | ${desc} |
110
+ const desc = field.sh || ''
111
+ Content(`| \`${field.n}\` | \`${perlType(field.t)}\` | ${desc} |
112
112
  `)
113
113
  })
114
114
 
@@ -116,13 +116,13 @@ On error, \`ok\` is false and \`err\` contains the error value.
116
116
 
117
117
  `)
118
118
  each(entityList, (ent: any) => {
119
- const fields = ent.fields || []
119
+ const fields = Object.values(ent.fields || {})
120
120
  const opnames = Object.keys(ent.op || {})
121
121
  const ops = ent.op || {}
122
122
  const points = each(ops).map((op: any) =>
123
123
  op.points ? each(op.points) : []
124
124
  ).flat()
125
- const path = points.length > 0 ? (points[0] as any).orig || '' : ''
125
+ const path = points.length > 0 ? (points[0] as any).o || '' : ''
126
126
 
127
127
  Content(`#### ${ent.Name}
128
128
 
@@ -130,7 +130,7 @@ On error, \`ok\` is false and \`err\` contains the error value.
130
130
  | --- | --- |
131
131
  `)
132
132
  each(fields, (field: any) => {
133
- Content(`| \`${field.name}\` | ${field.short || ''} |
133
+ Content(`| \`${field.n}\` | ${field.sh || ''} |
134
134
  `)
135
135
  })
136
136
 
@@ -173,7 +173,7 @@ Prepare a fetch definition without sending. Returns the \`fetchdef\` and dies on
173
173
  // Entity reference sections
174
174
  publishedEntities.map((ent: any) => {
175
175
  const opnames = Object.keys(ent.op || {})
176
- const fields = ent.fields || []
176
+ const fields = Object.values(ent.fields || {})
177
177
  // Model-driven id key: null when this entity has no id-like field.
178
178
  const idF = entityIdField(ent)
179
179
  const eVar = ent.name
@@ -206,9 +206,9 @@ my $${eVar} = $client->${ent.Name};
206
206
  | --- | --- | --- | --- |
207
207
  `)
208
208
  each(fields, (field: any) => {
209
- const req = field.req ? 'Yes' : 'No'
210
- const desc = field.short || ''
211
- Content(`| \`${field.name}\` | \`${perlType(field.type)}\` | ${req} | ${desc} |
209
+ const req = field.r ? 'Yes' : 'No'
210
+ const desc = field.sh || ''
211
+ Content(`| \`${field.n}\` | \`${perlType(field.t)}\` | ${req} | ${desc} |
212
212
  `)
213
213
  })
214
214
 
@@ -233,7 +233,7 @@ my $${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
 
@@ -28,7 +28,7 @@ const Schema = cmp(async function Schema(props: any) {
28
28
  Content(`# ${model.const.Name} SDK: generated schemas. Do not edit.
29
29
  #
30
30
  # Built from the model: \`main.kit.optspec\` and each feature's
31
- # \`config.options\` for the option spec; entity \`fields[].type\` for the
31
+ # \`config.options\` for the option spec; entity \`fields{}.type\` for the
32
32
  # entity specs.
33
33
 
34
34
  use strict;