@voxgig/sdkgen 1.3.9 → 1.3.10

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 CHANGED
@@ -8,7 +8,7 @@ const { Shape, One } = require('shape')
8
8
 
9
9
  const { SdkGen } = require('../dist/sdkgen.js')
10
10
 
11
- const VERSION = '1.3.9'
11
+ const VERSION = '1.3.10'
12
12
  const KONSOLE = console
13
13
 
14
14
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voxgig/sdkgen",
3
- "version": "1.3.9",
3
+ "version": "1.3.10",
4
4
  "main": "dist/sdkgen.js",
5
5
  "type": "commonjs",
6
6
  "types": "dist/sdkgen.d.ts",
@@ -218,6 +218,14 @@ ${allSteps.length > 0 ? '\t\tclient := setup.client\n\n' : ''}`)
218
218
 
219
219
  // Model-driven step iteration
220
220
  each(basicflow.step, (step: any, index: any) => {
221
+ // Never emit a REMOVE (or its removed-item verify LIST) without a
222
+ // preceding CREATE: a coherent CRUD flow only removes what it created,
223
+ // so a create-less remove would mutate pre-existing (live) data.
224
+ if (!flowHasCreate) {
225
+ if ('remove' === step.op) { return }
226
+ if ('list' === step.op &&
227
+ (step.valid || []).some((v: any) => 'ItemNotExists' === v.apply)) { return }
228
+ }
221
229
  const opgen: OpGen = GENERATE_OP[step.op]
222
230
  if (opgen) {
223
231
  opgen(genCtx, step, index)
@@ -176,6 +176,14 @@ ${hasList ? `
176
176
 
177
177
  // Model-driven step iteration
178
178
  each(basicflow.step, (step: any, index: any) => {
179
+ // Never emit a REMOVE (or its removed-item verify LIST) without a
180
+ // preceding CREATE: a coherent CRUD flow only removes what it created,
181
+ // so a create-less remove would mutate pre-existing (live) data.
182
+ if (!flowHasCreate) {
183
+ if ('remove' === step.op) { return }
184
+ if ('list' === step.op &&
185
+ (step.valid || []).some((v: any) => 'ItemNotExists' === v.apply)) { return }
186
+ }
179
187
  const opgen: OpGen = GENERATE_OP[step.op]
180
188
  if (opgen) {
181
189
  opgen(genCtx, step, index)
@@ -189,6 +189,14 @@ ${hasList ? `
189
189
 
190
190
  // Model-driven step iteration
191
191
  each(basicflow.step, (step: any, index: any) => {
192
+ // Never emit a REMOVE (or its removed-item verify LIST) without a
193
+ // preceding CREATE: a coherent CRUD flow only removes what it created,
194
+ // so a create-less remove would mutate pre-existing (live) data.
195
+ if (!flowHasCreate) {
196
+ if ('remove' === step.op) { return }
197
+ if ('list' === step.op &&
198
+ (step.valid || []).some((v: any) => 'ItemNotExists' === v.apply)) { return }
199
+ }
192
200
  const opgen: OpGen = GENERATE_OP[step.op]
193
201
  if (opgen) {
194
202
  opgen(genCtx, step, index)
@@ -177,6 +177,14 @@ ${hasList ? `
177
177
 
178
178
  // Model-driven step iteration
179
179
  each(basicflow.step, (step: any, index: any) => {
180
+ // Never emit a REMOVE (or its removed-item verify LIST) without a
181
+ // preceding CREATE: a coherent CRUD flow only removes what it created,
182
+ // so a create-less remove would mutate pre-existing (live) data.
183
+ if (!flowHasCreate) {
184
+ if ('remove' === step.op) { return }
185
+ if ('list' === step.op &&
186
+ (step.valid || []).some((v: any) => 'ItemNotExists' === v.apply)) { return }
187
+ }
180
188
  const opgen: OpGen = GENERATE_OP[step.op]
181
189
  if (opgen) {
182
190
  opgen(genCtx, step, index)
@@ -168,6 +168,14 @@ ${hasList ? `
168
168
 
169
169
  // Model-driven step iteration
170
170
  each(basicflow.step, (step: any, index: any) => {
171
+ // Never emit a REMOVE (or its removed-item verify LIST) without a
172
+ // preceding CREATE: a coherent CRUD flow only removes what it created,
173
+ // so a create-less remove would mutate pre-existing (live) data.
174
+ if (!flowHasCreate) {
175
+ if ('remove' === step.op) { return }
176
+ if ('list' === step.op &&
177
+ (step.valid || []).some((v: any) => 'ItemNotExists' === v.apply)) { return }
178
+ }
171
179
  const opgen: OpGen = GENERATE_OP[step.op]
172
180
  if (opgen) {
173
181
  opgen(genCtx, step, index)
@@ -236,6 +236,14 @@ function basicSetup(extra?: any) {
236
236
  model, entity, flow: basicflow, PROJUPPER: PROJENVNAME,
237
237
  }
238
238
  each(basicflow.step, (step: ModelEntityFlowStep, index: number) => {
239
+ // Never emit a REMOVE (or its removed-item verify LIST) without a
240
+ // preceding CREATE: a coherent CRUD flow only removes what it made,
241
+ // so a create-less remove would mutate pre-existing (live) data.
242
+ if (!flowHasCreate) {
243
+ if ('remove' === step.op) { return }
244
+ if ('list' === step.op &&
245
+ (step.valid || []).some((v: any) => 'ItemNotExists' === v.apply)) { return }
246
+ }
239
247
  const opgen = GENERATE_OP[step.op]
240
248
  if (null != opgen) {
241
249
  opgen(genCtx, step, index)