@voxgig/create-sdkgen 0.3.1 → 0.5.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 (95) hide show
  1. package/bin/create-sdkgen +36 -20
  2. package/dist/create-sdkgen.d.ts +2 -0
  3. package/dist/create-sdkgen.js +51 -5
  4. package/dist/create-sdkgen.js.map +1 -1
  5. package/dist/project/standard/CreateRoot.d.ts +2 -0
  6. package/dist/project/standard/CreateRoot.js +50 -0
  7. package/dist/project/standard/CreateRoot.js.map +1 -0
  8. package/dist/project/standard/ModelSdk.js +6 -1
  9. package/dist/project/standard/ModelSdk.js.map +1 -1
  10. package/dist/tsconfig.tsbuildinfo +1 -1
  11. package/package.json +10 -12
  12. package/project/standard/.sdk/model/api/api-info.jsonic +5 -0
  13. package/project/standard/.sdk/model/config.jsonic +3 -1
  14. package/project/standard/.sdk/model/{api/api-entity-index.jsonic → entity/entity-index.jsonic} +1 -0
  15. package/project/standard/.sdk/model/guide/guide.jsonic +8 -0
  16. package/project/standard/.sdk/model/sdk.fragment.jsonic +6 -10
  17. package/project/standard/.sdk/package.json +5 -7
  18. package/project/standard/.sdk/src/BuildSDK.ts +113 -0
  19. package/project/standard/.sdk/src/Root.ts +19 -7
  20. package/project/standard/.sdk/src/Top.ts +6 -2
  21. package/project/standard/.sdk/test/.model-config/model-config.json +5 -1
  22. package/project/standard/.sdk/test/primary/{outward.jsonic → clean.jsonic} +0 -1
  23. package/project/standard/.sdk/test/primary/done.jsonic +0 -1
  24. package/project/standard/.sdk/test/primary/{inward.jsonic → featureAdd.jsonic} +0 -1
  25. package/project/standard/.sdk/test/primary/featureHook.jsonic +2 -0
  26. package/project/standard/.sdk/test/primary/featureInit.jsonic +2 -0
  27. package/project/standard/.sdk/test/primary/fetcher.jsonic +2 -0
  28. package/project/standard/.sdk/test/primary/makeContext.jsonic +4 -0
  29. package/project/standard/.sdk/test/primary/makeError.jsonic +16 -0
  30. package/project/standard/.sdk/test/primary/makeFetchDef.jsonic +2 -0
  31. package/project/standard/.sdk/test/primary/{options.jsonic → makeOptions.jsonic} +5 -6
  32. package/project/standard/.sdk/test/primary/{request.jsonic → makeRequest.jsonic} +7 -13
  33. package/project/standard/.sdk/test/primary/makeResponse.jsonic +22 -0
  34. package/project/standard/.sdk/test/primary/makeResult.jsonic +2 -0
  35. package/project/standard/.sdk/test/primary/{spec.jsonic → makeSpec.jsonic} +9 -5
  36. package/project/standard/.sdk/test/primary/makeTarget.jsonic +2 -0
  37. package/project/standard/.sdk/test/primary/makeUrl.jsonic +21 -0
  38. package/project/standard/.sdk/test/primary/operator.jsonic +10 -53
  39. package/project/standard/.sdk/test/primary/{findparam.jsonic → param.jsonic} +6 -7
  40. package/project/standard/.sdk/test/primary/prepareAuth.jsonic +13 -0
  41. package/project/standard/.sdk/test/primary/prepareBody.jsonic +18 -0
  42. package/project/standard/.sdk/test/primary/prepareHeaders.jsonic +4 -0
  43. package/project/standard/.sdk/test/primary/prepareMethod.jsonic +10 -0
  44. package/project/standard/.sdk/test/primary/prepareParams.jsonic +9 -0
  45. package/project/standard/.sdk/test/primary/preparePath.jsonic +2 -0
  46. package/project/standard/.sdk/test/primary/prepareQuery.jsonic +8 -0
  47. package/project/standard/.sdk/test/primary/primary-test-index.jsonic +30 -0
  48. package/project/standard/.sdk/test/primary/resultBasic.jsonic +14 -0
  49. package/project/standard/.sdk/test/primary/resultBody.jsonic +4 -0
  50. package/project/standard/.sdk/test/primary/resultHeaders.jsonic +7 -0
  51. package/project/standard/.sdk/test/primary/transformRequest.jsonic +8 -0
  52. package/project/standard/.sdk/test/primary/transformResponse.jsonic +10 -0
  53. package/project/standard/.sdk/test/struct/merge.jsonic +102 -4
  54. package/project/standard/.sdk/test/struct/minor.jsonic +106 -38
  55. package/project/standard/.sdk/test/struct/select.jsonic +86 -5
  56. package/project/standard/.sdk/test/struct/test.json +16635 -0
  57. package/project/standard/.sdk/test/struct/test.jsonic +25 -0
  58. package/project/standard/.sdk/test/struct/transform.jsonic +100 -1
  59. package/project/standard/.sdk/test/struct/validate.jsonic +82 -45
  60. package/project/standard/.sdk/test/struct/walk.jsonic +57 -6
  61. package/project/standard/.sdk/test/test.json +5952 -3326
  62. package/project/standard/.sdk/test/test.jsonic +2 -43
  63. package/src/create-sdkgen.ts +74 -7
  64. package/src/project/standard/{Root.ts → CreateRoot.ts} +11 -6
  65. package/src/project/standard/ModelSdk.ts +6 -1
  66. package/dist/project/standard/Root.d.ts +0 -2
  67. package/dist/project/standard/Root.js +0 -79
  68. package/dist/project/standard/Root.js.map +0 -1
  69. package/dist/standard/ModelSdk.d.ts +0 -2
  70. package/dist/standard/ModelSdk.js +0 -19
  71. package/dist/standard/ModelSdk.js.map +0 -1
  72. package/dist/standard/Root.d.ts +0 -2
  73. package/dist/standard/Root.js +0 -77
  74. package/dist/standard/Root.js.map +0 -1
  75. package/dist/utility.d.ts +0 -2
  76. package/dist/utility.js +0 -5
  77. package/dist/utility.js.map +0 -1
  78. package/project/standard/.sdk/model/api/api-def.jsonic +0 -5
  79. package/project/standard/.sdk/model/guide.jsonic +0 -5
  80. package/project/standard/.sdk/model/target/target-index.jsonic~ +0 -4
  81. package/project/standard/.sdk/test/primary/auth.jsonic +0 -20
  82. package/project/standard/.sdk/test/primary/body.jsonic +0 -27
  83. package/project/standard/.sdk/test/primary/contextify.jsonic +0 -5
  84. package/project/standard/.sdk/test/primary/error.jsonic +0 -19
  85. package/project/standard/.sdk/test/primary/fullurl.jsonic +0 -50
  86. package/project/standard/.sdk/test/primary/headers.jsonic +0 -12
  87. package/project/standard/.sdk/test/primary/method.jsonic +0 -11
  88. package/project/standard/.sdk/test/primary/params.jsonic +0 -10
  89. package/project/standard/.sdk/test/primary/query.jsonic +0 -9
  90. package/project/standard/.sdk/test/primary/reqform.jsonic +0 -9
  91. package/project/standard/.sdk/test/primary/resbasic.jsonic +0 -15
  92. package/project/standard/.sdk/test/primary/resbody.jsonic +0 -5
  93. package/project/standard/.sdk/test/primary/resform.jsonic +0 -11
  94. package/project/standard/.sdk/test/primary/resheaders.jsonic +0 -9
  95. package/project/standard/.sdk/test/primary/response.jsonic +0 -20
@@ -3,11 +3,11 @@
3
3
 
4
4
  basic: {
5
5
  in: [
6
- {a:1,b:2},
7
- {b:3,d:4},
6
+ { a:1, b:2, k:[10,20], x:{y:5,z:6} }
7
+ { b:3, d:4, e:8, k:[11], x:{y:7} }
8
8
  ]
9
9
  out: {
10
- a: 1, b: 3, d: 4
10
+ a:1, b:3, d:4, e:8, k:[11,20], x:{y:7, z:6}
11
11
  }
12
12
  }
13
13
 
@@ -58,8 +58,13 @@ cases: {
58
58
  { in: [1,2,3], out: 3 }
59
59
  { in: [{},4], out: 4 }
60
60
  { in: [[],5], out: 5 }
61
+
62
+ { in: [{n0:[]},{n0:{}}], out: {n0:{}} }
61
63
  { in: [[],{}], out: {} }
64
+
65
+ { in: [{n1:{}},{n1:[]}], out: {n1:[]} }
62
66
  { in: [{},[]], out: [] }
67
+
63
68
  { in: [[6],{x:7}], out: {x:7} }
64
69
  { in: [{x:8},[9]], out: [9] }
65
70
 
@@ -96,6 +101,9 @@ cases: {
96
101
  { in: [{},{},{s2:''}], out: {s2:''} }
97
102
  { in: [{s3:''},{},{}], out: {s3:''} }
98
103
  { in: [{},{s4:''},{}], out: {s4:''} }
104
+
105
+ { in: [1,2.3], out: 2.3 }
106
+ { in: [4.5,6], out: 6 }
99
107
  ]
100
108
  }
101
109
 
@@ -147,6 +155,9 @@ array: {
147
155
 
148
156
  { in: [ {a:[1,2], b:{c:3,d:4}}, {a:[11], b:{c:33}} ],
149
157
  out: { a: [ 11, 2 ], b: { c: 33, d: 4 } } }
158
+
159
+ { in: [{a0:[1]},{a0:{x:1}}], out: {a0:{x:1}} }
160
+ { in: [{a1:{x:2}},{a1:[2]}], out: {a1:[2]} }
150
161
  ]
151
162
  }
152
163
 
@@ -155,7 +166,94 @@ integrity: {
155
166
  set: [
156
167
  { in: [{e:5},{a:1,d:4},{a:2,b:3}],
157
168
  out: {a:2,b:3,d:4,e:5},
158
- match:in:[{e:5},{a:1,d:4},{a:2,b:3}]
169
+ match:args:0:[{e:5},{a:1,d:4},{a:2,b:3}]
170
+ }
171
+
172
+ { in: [{a:{b:10}},{a:{}}],
173
+ out: {a:{b:10}},
174
+ match:args:0:[{a:{b:10}},{a:{}}]
175
+ }
176
+
177
+ { in: [{a:{b:11}},{a:{c:21}}],
178
+ out: {a:{b:11,c:21}},
179
+ match:args:0:[{a:{b:11}},{a:{c:21}}]
180
+ }
181
+
182
+ { in: [{a:{}},{a:{c:22}}],
183
+ out: {a:{c:22}},
184
+ match:args:0:[{a:{}},{a:{c:22}}]
185
+ }
186
+
187
+ { in: [{a:{b:{c:13}}},{a:{}}],
188
+ out: {a:{b:{c:13}}},
189
+ match:args:0:[{a:{b:{c:13}}},{a:{}}]
190
+ }
191
+
192
+ { in: [{a:{}},{a:{c:{e:24}}}],
193
+ out: {a:{c:{e:24}}},
194
+ match:args:0:[{a:{}},{a:{c:{e:24}}}]
159
195
  }
196
+
197
+ ]
198
+ }
199
+
200
+
201
+
202
+ depth: {
203
+ set: [
204
+ { in: { val:[] depth:-1 } }
205
+ { in: { val:[] depth:0 } }
206
+ { in: { val:[] depth:1 } }
207
+ { in: { val:[] depth:2 } }
208
+ { in: { val:[] depth:3 } }
209
+
210
+ { in: { val:[{}] depth:-1 } out: {} }
211
+ { in: { val:[{}] depth:0 } out: {} }
212
+ { in: { val:[{}] depth:1 } out: {} }
213
+ { in: { val:[{}] depth:2 } out: {} }
214
+ { in: { val:[{}] depth:3 } out: {} }
215
+
216
+ { in: { val:[{},10] depth:-1 } out: 10 }
217
+ { in: { val:[{},20] depth:0 } out: 20 }
218
+ { in: { val:[{},30] depth:1 } out: 30 }
219
+ { in: { val:[{},40] depth:2 } out: 40 }
220
+ { in: { val:[{},50] depth:3 } out: 50 }
221
+
222
+ { in: { val:[11,{}] depth:-1 } out: {} }
223
+ { in: { val:[21,{}] depth:0 } out: {} }
224
+ { in: { val:[31,{}] depth:1 } out: {} }
225
+ { in: { val:[41,{}] depth:2 } out: {} }
226
+ { in: { val:[51,{}] depth:3 } out: {} }
227
+
228
+ { in: { val:[[],12] depth:-1 } out: 12 }
229
+ { in: { val:[[],22] depth:0 } out: 22 }
230
+ { in: { val:[[],32] depth:1 } out: 32 }
231
+ { in: { val:[[],42] depth:2 } out: 42 }
232
+ { in: { val:[[],52] depth:3 } out: 52 }
233
+
234
+ { in: { val:[13,[]] depth:-1 } out: [] }
235
+ { in: { val:[23,[]] depth:0 } out: [] }
236
+ { in: { val:[33,[]] depth:1 } out: [] }
237
+ { in: { val:[43,[]] depth:2 } out: [] }
238
+ { in: { val:[53,[]] depth:3 } out: [] }
239
+
240
+ { in: { val:[{},[]] depth:-1 } out: [] }
241
+ { in: { val:[{},[]] depth:0 } out: [] }
242
+ { in: { val:[{},[]] depth:1 } out: [] }
243
+ { in: { val:[{},[]] depth:2 } out: [] }
244
+ { in: { val:[{},[]] depth:3 } out: [] }
245
+
246
+ { in: { val:[[],{}] depth:-1 } out: {} }
247
+ { in: { val:[[],{}] depth:0 } out: {} }
248
+ { in: { val:[[],{}] depth:1 } out: {} }
249
+ { in: { val:[[],{}] depth:2 } out: {} }
250
+ { in: { val:[[],{}] depth:3 } out: {} }
251
+
252
+
253
+ { in: { val:[{x0:{y0:0,y1:1}},{x0:{y0:2,y2:3}}] depth:-1 } out: {} }
254
+ { in: { val:[{x0:{y0:0,y1:1}},{x0:{y0:2,y2:3}}] depth:0 } out: {} }
255
+ { in: { val:[{x0:{y0:0,y1:1}},{x0:{y0:2,y2:3}}] depth:1 } out: {x0:{y0:2,y2:3}} }
256
+ { in: { val:[{x0:{y0:0,y1:1}},{x0:{y0:2,y2:3}}] depth:2 } out: {x0:{y0:2,y1:1,y2:3}} }
257
+ { in: { val:[{x0:{y0:0,y1:1}},{x0:{y0:2,y2:3}}] depth:3 } out: {x0:{y0:2,y1:1,y2:3}} }
160
258
  ]
161
259
  }
@@ -165,6 +165,8 @@ getprop: {
165
165
  { in: { val: true } }
166
166
  { in: { val: null } }
167
167
  { in: { val: {}, key: null } }
168
+ { in: { val: {}, key: x, alt: y }, out: y }
169
+ { in: { val: {}, key: x, alt: null }, out: null }
168
170
  { in: { val: {}, key: null, alt: null }, out: null }
169
171
  { in: {} }
170
172
  ]
@@ -235,10 +237,10 @@ items: {
235
237
  { in: {a:{x:{y:1}},b:{x:{y:2}},c:{x:{y:3}},d:{x:{y:4}},e:{x:{y:5}}},
236
238
  out: [['a',{x:{y:1}}],['b',{x:{y:2}}],['c',{x:{y:3}}],['d',{x:{y:4}}],['e',{x:{y:5}}]] }
237
239
 
238
- { in: [11], out: [[0,11]] }
239
- { in: [11,22], out: [[0,11],[1,22]] }
240
- { in: [{z:1},{z:2},{z:3}], out: [[0,{z:1}],[1,{z:2}],[2,{z:3}]] }
241
- { in: [[111],[222],[333],[444]], out: [[0,[111]],[1,[222]],[2,[333]],[3,[444]]] }
240
+ { in: [11], out: [['0',11]] }
241
+ { in: [11,22], out: [['0',11],['1',22]] }
242
+ { in: [{z:1},{z:2},{z:3}], out: [['0',{z:1}],['1',{z:2}],['2',{z:3}]] }
243
+ { in: [[111],[222],[333],[444]], out: [['0',[111]],['1',[222]],['2',[333]],['3',[444]]] }
242
244
 
243
245
  { in: 1, out: [] }
244
246
  { in: 'a', out: [] }
@@ -381,19 +383,23 @@ stringify: {
381
383
 
382
384
  jsonify: {
383
385
  set: [
384
- { in: 1, out: '1' }
385
- { in: 'a', out: '"a"' }
386
- { in: true, out: 'true' }
387
- { in: false, out: 'false' }
388
- { in: null, out: 'null' }
389
- { out: 'null' }
390
- { in: [], out: '[]' }
391
- { in: {}, out: '{}' }
392
- { in: [1,2,3], out: '[\n 1,\n 2,\n 3\n]' }
393
- { in: {a:1}, out: '{\n "a": 1\n}' }
394
- { in: {a:1,b:2}, out: '{\n "a": 1,\n "b": 2\n}' }
395
- { in: {x:{y:1}}, out: '{\n "x": {\n "y": 1\n }\n}' }
396
- { in: [{a:1},{b:2}], out: '[\n {\n "a": 1\n },\n {\n "b": 2\n }\n]' }
386
+ { in: {val:1} out: '1' }
387
+ { in: {val:'a'} out: '"a"' }
388
+ { in: {val:true} out: 'true' }
389
+ { in: {val:false} out: 'false' }
390
+ { in: {val:null} out: 'null' }
391
+ { in: {} out: 'null' }
392
+ { in: {val:[]} out: '[]' }
393
+ { in: {val:{}} out: '{}' }
394
+ { in: {val:[1,2,3]} out: '[\n 1,\n 2,\n 3\n]' }
395
+ { in: {val:{a:1}} out: '{\n "a": 1\n}' }
396
+ { in: {val:{a:1,b:2}} out: '{\n "a": 1,\n "b": 2\n}' }
397
+ { in: {val:{x:{y:1}}} out: '{\n "x": {\n "y": 1\n }\n}' }
398
+ { in: {val:[{a:1},{b:2}]} out: '[\n {\n "a": 1\n },\n {\n "b": 2\n }\n]' }
399
+
400
+ { in: {val:{x:{y:2}}, flags:{indent:4}}, out: '{\n "x": {\n "y": 2\n }\n}' }
401
+ { in: {val:{x:{y:2}}, flags:{indent:1,offset:2}},
402
+ out: '{\n "x": {\n "y": 2\n }\n }' }
397
403
  ]
398
404
  }
399
405
 
@@ -460,34 +466,69 @@ escurl: {
460
466
  }
461
467
 
462
468
 
463
- joinurl: {
469
+ join: {
464
470
  set: [
465
- { out: 'a' in: ['a'] }
466
- { out: 'a/b' in: ['a','b'] }
467
- { out: 'a/b' in: ['a',null,'b'] }
468
- { out: 'a/b' in: ['a/','b'] }
469
- { out: 'a/b' in: ['a','/b'] }
470
- { out: 'a/b' in: ['a/','/b'] }
471
- { out: 'a/b' in: ['a/','//b'] }
472
- { out: 'a/b/c/d' in: ['a','b','c//d'] }
473
- { out: '//a/b' in: ['//a','/b'] }
474
- { in: ['https://www.example.com/','/a','/b/','/c','d'],
471
+ { out: 'a' in: { val: ['a'] } }
472
+ { out: 'cQdQe' in: { val: [c,d,e] sep:'Q'} }
473
+ { out: 'C|D|E' in: { val: [C,D,E] sep:'|'} }
474
+ { out: 'a,b' in: { val: ['a','b'] } }
475
+ { out: 'a,b' in: { val: ['a',null,'b'] } }
476
+ { out: 'a,b' in: { val: ['a,','b'] } }
477
+ { out: 'a,b' in: { val: ['a',',b'] } }
478
+ { out: 'a,b' in: { val: ['a,',',b'] } }
479
+ { out: 'a,b' in: { val: ['a,',',,b'] } }
480
+ { out: 'a/b/c/d' in: { val: ['a','b','c//d'], sep:'/' } }
481
+ { out: '//a/b' in: { val: ['//a','/b'], sep: '/' } }
482
+ { in: { val: ['https://www.example.com/','/a','/b/','/c','d'], sep:'/', url: true }
475
483
  out: 'https://www.example.com/a/b/c/d' }
484
+ { in: { val: ['https://www.example.com/','e/'], sep:'/', url: true }
485
+ out: 'https://www.example.com/e/' }
486
+ ]
487
+ }
488
+
489
+
490
+ flatten: {
491
+ set: [
492
+ { in: {val:[1,2,3]}, out: [1,2,3] }
493
+ { in: {val:[1,[2],3]}, out: [1,2,3] }
494
+ { in: {val:[1,[[2],3]]}, out: [1,[2],3] }
495
+ { in: {val:[1,[[2],3]], depth:2}, out: [1,2,3] }
496
+ ]
497
+ }
498
+
499
+
500
+ filter: {
501
+ set: [
502
+ { in: {val:[1,2,3,4,5],check:'gt3'}, out: [4,5] }
503
+ { in: {val:[1,2,3,4,5],check:'lt3'}, out: [1,2] }
476
504
  ]
477
505
  }
478
506
 
507
+
508
+ typename: {
509
+ set: [
510
+ { in: 8192, out: 'map' }
511
+ { in: 8192+64, out: 'map' }
512
+ { in: 16384, out: 'list' }
513
+ { in: 16384+64, out: 'list' }
514
+ { in: 201326720, out: 'integer' }
515
+ { in: 335544448, out: 'decimal' }
516
+ ]
517
+ }
518
+
519
+
479
520
  typify: {
480
521
  set: [
481
- { in: {a:1}, out: 'object' }
482
- { in: [1], out: 'array' }
483
- { in: 1, out: 'number' }
484
- { in: 3.14159, out: 'number' }
485
- { in: -0.5, out: 'number' }
486
- { in: 'a', out: 'string' }
487
- { in: true, out: 'boolean' }
488
- { in: false, out: 'boolean' }
489
- { in: null, out: 'null' }
490
- { out: 'null' }
522
+ { in: {a:1}, out: 8192+64 }
523
+ { in: [1], out: 16384+64 }
524
+ { in: 1, out: 201326720 }
525
+ { in: 3.14159, out: 335544448 }
526
+ { in: -0.5, out: 335544448 }
527
+ { in: 'a', out: 33554560 }
528
+ { in: true, out: 536871040 }
529
+ { in: false, out: 536871040 }
530
+ { in: null, out: 4194432 }
531
+ { out: 1073741824 }
491
532
  ]
492
533
  }
493
534
 
@@ -584,6 +625,7 @@ slice: {
584
625
  { in: {val:[226], start:-5}, out: [] }
585
626
 
586
627
  { in: {val:[33,34,35], start:2, end:1}, out: [] }
628
+ { in: {val:[43,44,45], end:2}, out: [43,44] }
587
629
 
588
630
  { in: {val:'abc'}, out: 'abc' }
589
631
  { in: {val:'ABC', start:1}, out: 'BC' }
@@ -691,3 +733,29 @@ pad: {
691
733
  }
692
734
 
693
735
 
736
+ setpath: {
737
+ set: [
738
+ { in: { store:{x:1} path:'x', val:2 }, out: {x:2},
739
+ match:args:0:store:x:2 }
740
+
741
+ { in: { store:{x:y:1} path:'x.y', val:2 }, out: {y:2},
742
+ match:args:0:store:x:y:2 }
743
+
744
+ { in: { store:{x:{}} path:'x.y', val:3 }, out: {y:3},
745
+ match:args:0:store:x:y:3 }
746
+
747
+ { in: { store:{} path:'x.y', val:4 }, out: {y:4},
748
+ match:args:0:store:x:y:4 }
749
+
750
+ { in: { store:{} path:'x.y.0', val:5 }, out: {'0':5},
751
+ match:args:0:store:x:y:0:5 }
752
+
753
+ { in: { store:{} path:['x','y',0], val:6 }, out: [6],
754
+ match:args:0:store:x:y:[6] }
755
+
756
+ { in: { store:{x:1} val:7 },
757
+ match:args:0:store:x:1 }
758
+ ]
759
+ }
760
+
761
+
@@ -13,7 +13,8 @@ basic: {
13
13
  out: [{age:30,city:'NYC','$KEY':'a'}] }
14
14
 
15
15
  # Array children
16
- { in: { query: {type:'user'}, obj: [{id:1,type:'user'}, {id:2,type:'admin'}, {id:3,type:'user'}] },
16
+ { in: { query: {type:'user'},
17
+ obj: [{id:1,type:'user'}, {id:2,type:'admin'}, {id:3,type:'user'}] },
17
18
  out: [{id:1,type:'user','$KEY':0}, {id:3,type:'user','$KEY':2}] }
18
19
 
19
20
  # No matches
@@ -53,6 +54,22 @@ operators: {
53
54
  out: [] }
54
55
 
55
56
  # `$OR` operator
57
+ { in: { query: {'`$OR`':['x', 'y']},
58
+ obj: {a:'x', b:'z', c:'y'} },
59
+ out: ['x', 'y'] }
60
+
61
+
62
+ # TODO: review
63
+
64
+ # { in: { query: {'$KEY':{'`$OR`':['b', 'c']}},
65
+ # obj: {a:'x', b:'z', c:'y'} },
66
+ # out: ['z', 'y'] }
67
+
68
+ # { in: { query: {'`$OR`':[{'$KEY':'b'}, {'$KEY':'c'}]},
69
+ # obj: {a:'x', b:'z', c:'y'} },
70
+ # out: ['z', 'y'] }
71
+
72
+
56
73
  { in: { query: {'`$OR`':[{age:25}, {age:35}]},
57
74
  obj: {a:{age:30}, b:{age:25}, c:{age:35}} },
58
75
  out: [{age:25,'$KEY':'b'}, {age:35,'$KEY':'c'}] }
@@ -87,9 +104,17 @@ operators: {
87
104
  { in: { query: {a:{'`$GT`':10}}, obj: [{a:9},{a:10},{a:11},{a:12}] },
88
105
  out: [{a:11,'$KEY':2},{a:12,'$KEY':3}] }
89
106
 
107
+ { in: { query: {a:{'`$GTE`':10}}, obj: [{a:9},{a:10},{a:11},{a:12}] },
108
+ out: [{a:10,'$KEY':1},{a:11,'$KEY':2},{a:12,'$KEY':3}] }
109
+
110
+
90
111
  { in: { query: {b:{'`$LT`':10}}, obj: [{b:9},{b:10},{b:11},{b:12}] },
91
112
  out: [{b:9,'$KEY':0}] }
92
113
 
114
+ { in: { query: {b:{'`$LTE`':10}}, obj: [{b:9},{b:10},{b:11},{b:12}] },
115
+ out: [{b:9,'$KEY':0},{b:10,'$KEY':1}] }
116
+
117
+
93
118
  { in: { query: {a:b:'`$LT`':10}, obj: [{a:b:9},{a:b:10},{a:b:11},{a:b:12}] },
94
119
  out: [{a:b:9,'$KEY':0}] }
95
120
 
@@ -157,10 +182,66 @@ edge: {
157
182
 
158
183
  { in: { query: {c0:{'`$AND`':[{x:1},{y:{'`$OR`':[2,3]}}]}},
159
184
  obj: [{c0:{x:1,y:3,z:0}}, {c0:{x:1,y:2,z:1}}, {c0:{x:1,y:1,z:2}}] },
160
- out: [{c0:{x:1,y:3,z:0},'$KEY':0}, {c0:{x:1,y:2,z:1},'$KEY':1}] }
185
+ out: [{c0:{x:1,y:3,z:0},'$KEY':0}, {c0:{x:1,y:2,z:1},'$KEY':1}] }
186
+ ]
187
+ }
188
+
189
+
190
+ # path alternates selection
191
+ # NOTES FOR SDK:
192
+ # build query by union of all select keys, getting values from operation spec, match
193
+ # need a deterministic sort of alts so multiple selects (should not happen) have at least
194
+ # a stable list of returned alts order. also $path as get out of jail
195
+ # normalize: /a/{x}/b/ -> path$:'/a/{}/b'
196
+ # if no alt found, use select to indicate missing select options
197
+ alts: {
198
+ data: obj0: [
199
+ { select:foo_id:true, x:1 }
200
+ { select:bar_id:true, x:2 }
201
+ ]
202
+ data: obj1: [
203
+ { select:{a:A,b:B}, x:11 }
204
+ { select:{a:A,b:B}, x:12 }
205
+ ]
206
+ data: obj2: [
207
+ { select:{query:q0:v0}, x:21 }
208
+ { select:{query:q0:v1}, x:22 }
209
+ ]
210
+ data: obj3: [
211
+ { select:{'$action':foo,zed_id:true}, x:31 }
212
+ { select:{'$action':bar,zed_id:true}, x:32 }
213
+ ]
214
+
215
+ set: [
216
+ { in: { query: select: {
217
+ foo_id:true # boolean true means value exists (incl. JSON null)
218
+ }
219
+ obj: $.struct.select.alts.data.obj0 }
220
+ out: [{'$KEY':0,select:foo_id:true,x:1}] }
221
+
222
+ { in: { query: select: { bar_id:true }
223
+ obj: $.struct.select.alts.data.obj0 }
224
+ out: [{'$KEY':1,select:bar_id:true,x:2}]
225
+ }
226
+
227
+ # literals always use the string representation
228
+ { in: { query: select: { a:A,b:B }
229
+ obj: $.struct.select.alts.data.obj1 }
230
+ out: [{ '$KEY': 0, select: { a: 'A', b: 'B' }, x: 11},
231
+ { '$KEY': 1, select: { a: 'A', b: 'B' }, x: 12} ]
232
+ }
233
+
234
+ # namespacing query, headers etc. same rules: boolean existence or string literal
235
+ { in: { query: select: { query:q0:v0 }
236
+ obj: $.struct.select.alts.data.obj2 }
237
+ out: [{ '$KEY': 0, select: { query:q0:v0 }, x: 21} ]
238
+ }
239
+
240
+ { in: { query: select: { '$action':bar, zed_id:true }
241
+ obj: $.struct.select.alts.data.obj3 }
242
+ out: [{ '$KEY': 1, select: {'$action':bar,zed_id:true}, x: 32} ]
243
+ }
244
+
161
245
 
162
-
163
-
164
-
165
246
  ]
166
247
  }