shinkansen-transmission 2.1.15 → 2.2.2

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 (82) hide show
  1. package/.husky/pre-commit +4 -0
  2. package/babel.config.js +1 -1
  3. package/index.js +6 -1
  4. package/lib/index.js +1 -1
  5. package/lib/transmission/common/index.js +1 -1
  6. package/lib/transmission/from-document-to-hash/index.js +1 -1
  7. package/lib/transmission/from-hash-to-document/index.js +1 -1
  8. package/lib/transmission/index.js +1 -1
  9. package/lib/transmission/to-zashiki/index.js +1 -1
  10. package/lib/transmission/to-zashiki/transform-root-schema.js +1 -1
  11. package/lib/transmission/to-zashiki/transform-schema.js +1 -1
  12. package/package.json +23 -30
  13. package/src/transmission/from-document-to-hash/index.js +75 -29
  14. package/src/transmission/from-hash-to-document/index.js +13 -10
  15. package/src/transmission/to-zashiki/transform-root-schema.js +143 -136
  16. package/src/transmission/to-zashiki/transform-schema.js +3256 -1952
  17. package/.github/dependabot.yml +0 -9
  18. package/test/transmission/common/index.spec.js +0 -1348
  19. package/test/transmission/from-document-to-hash/index.spec.js +0 -1866
  20. package/test/transmission/from-hash-to-document/index.spec.js +0 -1523
  21. package/test/transmission/to-zashiki/transform-root-schema/transforming-array-type-schemas.spec.js +0 -1784
  22. package/test/transmission/to-zashiki/transform-root-schema/transforming-boolean-type-schemas.spec.js +0 -334
  23. package/test/transmission/to-zashiki/transform-root-schema/transforming-null-type-schemas.spec.js +0 -253
  24. package/test/transmission/to-zashiki/transform-root-schema/transforming-number-type-schemas.spec.js +0 -565
  25. package/test/transmission/to-zashiki/transform-root-schema/transforming-object-type-schemas.spec.js +0 -1715
  26. package/test/transmission/to-zashiki/transform-root-schema/transforming-string-type-schemas.spec.js +0 -496
  27. package/test/transmission/to-zashiki/transform-root-schema/with-values/with-params/transforming-array-type-schemas.spec.js +0 -31633
  28. package/test/transmission/to-zashiki/transform-root-schema/with-values/with-params/transforming-boolean-type-schemas.spec.js +0 -359
  29. package/test/transmission/to-zashiki/transform-root-schema/with-values/with-params/transforming-null-type-schemas.spec.js +0 -359
  30. package/test/transmission/to-zashiki/transform-root-schema/with-values/with-params/transforming-number-type-schemas.spec.js +0 -446
  31. package/test/transmission/to-zashiki/transform-root-schema/with-values/with-params/transforming-object-type-schemas.spec.js +0 -8348
  32. package/test/transmission/to-zashiki/transform-root-schema/with-values/with-params/transforming-string-type-schemas.spec.js +0 -446
  33. package/test/transmission/to-zashiki/transform-root-schema/with-values/without-params/transforming-array-type-schemas.spec.js +0 -30373
  34. package/test/transmission/to-zashiki/transform-root-schema/with-values/without-params/transforming-boolean-type-schemas.spec.js +0 -334
  35. package/test/transmission/to-zashiki/transform-root-schema/with-values/without-params/transforming-null-type-schemas.spec.js +0 -253
  36. package/test/transmission/to-zashiki/transform-root-schema/with-values/without-params/transforming-number-type-schemas.spec.js +0 -421
  37. package/test/transmission/to-zashiki/transform-root-schema/with-values/without-params/transforming-object-type-schemas.spec.js +0 -7826
  38. package/test/transmission/to-zashiki/transform-root-schema/with-values/without-params/transforming-string-type-schemas.spec.js +0 -421
  39. package/test/transmission/to-zashiki/transform-root-schema/without-values/with-params/transforming-array-type-schemas.spec.js +0 -31111
  40. package/test/transmission/to-zashiki/transform-root-schema/without-values/with-params/transforming-boolean-type-schemas.spec.js +0 -347
  41. package/test/transmission/to-zashiki/transform-root-schema/without-values/with-params/transforming-null-type-schemas.spec.js +0 -344
  42. package/test/transmission/to-zashiki/transform-root-schema/without-values/with-params/transforming-number-type-schemas.spec.js +0 -434
  43. package/test/transmission/to-zashiki/transform-root-schema/without-values/with-params/transforming-object-type-schemas.spec.js +0 -8222
  44. package/test/transmission/to-zashiki/transform-root-schema/without-values/with-params/transforming-string-type-schemas.spec.js +0 -434
  45. package/test/transmission/to-zashiki/transform-root-schema/without-values/without-params/transforming-array-type-schemas.spec.js +0 -29494
  46. package/test/transmission/to-zashiki/transform-root-schema/without-values/without-params/transforming-boolean-type-schemas.spec.js +0 -312
  47. package/test/transmission/to-zashiki/transform-root-schema/without-values/without-params/transforming-null-type-schemas.spec.js +0 -309
  48. package/test/transmission/to-zashiki/transform-root-schema/without-values/without-params/transforming-number-type-schemas.spec.js +0 -399
  49. package/test/transmission/to-zashiki/transform-root-schema/without-values/without-params/transforming-object-type-schemas.spec.js +0 -7584
  50. package/test/transmission/to-zashiki/transform-root-schema/without-values/without-params/transforming-string-type-schemas.spec.js +0 -398
  51. package/test/transmission/to-zashiki/transform-root-schema.spec.js +0 -22
  52. package/test/transmission/to-zashiki/transform-schema/transforming-array-type-schemas.spec.js +0 -1806
  53. package/test/transmission/to-zashiki/transform-schema/transforming-boolean-type-schemas.spec.js +0 -340
  54. package/test/transmission/to-zashiki/transform-schema/transforming-null-type-schemas.spec.js +0 -259
  55. package/test/transmission/to-zashiki/transform-schema/transforming-number-type-schemas.spec.js +0 -571
  56. package/test/transmission/to-zashiki/transform-schema/transforming-object-type-schemas.spec.js +0 -1737
  57. package/test/transmission/to-zashiki/transform-schema/transforming-string-type-schemas.spec.js +0 -502
  58. package/test/transmission/to-zashiki/transform-schema/with-values/with-params/transforming-array-type-schemas.spec.js +0 -32173
  59. package/test/transmission/to-zashiki/transform-schema/with-values/with-params/transforming-boolean-type-schemas.spec.js +0 -377
  60. package/test/transmission/to-zashiki/transform-schema/with-values/with-params/transforming-null-type-schemas.spec.js +0 -377
  61. package/test/transmission/to-zashiki/transform-schema/with-values/with-params/transforming-number-type-schemas.spec.js +0 -464
  62. package/test/transmission/to-zashiki/transform-schema/with-values/with-params/transforming-object-type-schemas.spec.js +0 -8525
  63. package/test/transmission/to-zashiki/transform-schema/with-values/with-params/transforming-string-type-schemas.spec.js +0 -464
  64. package/test/transmission/to-zashiki/transform-schema/with-values/without-params/transforming-array-type-schemas.spec.js +0 -30910
  65. package/test/transmission/to-zashiki/transform-schema/with-values/without-params/transforming-boolean-type-schemas.spec.js +0 -352
  66. package/test/transmission/to-zashiki/transform-schema/with-values/without-params/transforming-null-type-schemas.spec.js +0 -271
  67. package/test/transmission/to-zashiki/transform-schema/with-values/without-params/transforming-number-type-schemas.spec.js +0 -439
  68. package/test/transmission/to-zashiki/transform-schema/with-values/without-params/transforming-object-type-schemas.spec.js +0 -8003
  69. package/test/transmission/to-zashiki/transform-schema/with-values/without-params/transforming-string-type-schemas.spec.js +0 -439
  70. package/test/transmission/to-zashiki/transform-schema/without-values/with-params/transforming-array-type-schemas.spec.js +0 -31654
  71. package/test/transmission/to-zashiki/transform-schema/without-values/with-params/transforming-boolean-type-schemas.spec.js +0 -365
  72. package/test/transmission/to-zashiki/transform-schema/without-values/with-params/transforming-null-type-schemas.spec.js +0 -362
  73. package/test/transmission/to-zashiki/transform-schema/without-values/with-params/transforming-number-type-schemas.spec.js +0 -452
  74. package/test/transmission/to-zashiki/transform-schema/without-values/with-params/transforming-object-type-schemas.spec.js +0 -8399
  75. package/test/transmission/to-zashiki/transform-schema/without-values/with-params/transforming-string-type-schemas.spec.js +0 -452
  76. package/test/transmission/to-zashiki/transform-schema/without-values/without-params/transforming-array-type-schemas.spec.js +0 -29671
  77. package/test/transmission/to-zashiki/transform-schema/without-values/without-params/transforming-boolean-type-schemas.spec.js +0 -320
  78. package/test/transmission/to-zashiki/transform-schema/without-values/without-params/transforming-null-type-schemas.spec.js +0 -317
  79. package/test/transmission/to-zashiki/transform-schema/without-values/without-params/transforming-number-type-schemas.spec.js +0 -407
  80. package/test/transmission/to-zashiki/transform-schema/without-values/without-params/transforming-object-type-schemas.spec.js +0 -7645
  81. package/test/transmission/to-zashiki/transform-schema/without-values/without-params/transforming-string-type-schemas.spec.js +0 -406
  82. package/test/transmission/to-zashiki/transform-schema.spec.js +0 -777
@@ -1,565 +0,0 @@
1
- import debug from 'debug'
2
-
3
- import { expect } from 'chai'
4
-
5
- import transform from 'shinkansen-transmission/transmission/to-zashiki/transform-root-schema'
6
-
7
- describe('shinkansen-transmission/transmission/to-zashiki/transform-root-schema', () => {
8
- before(() => {
9
- const {
10
- env: {
11
- DEBUG
12
- }
13
- } = process
14
-
15
- if (DEBUG) debug.enable(DEBUG)
16
- })
17
-
18
- /*
19
- * Number
20
- */
21
- describe('Transforming `number` type schemas', () => {
22
- it('transforms', () => {
23
- const schema = { type: 'number' }
24
-
25
- expect(transform(schema))
26
- .to.eql({
27
- meta: {
28
- type: 'number',
29
- uri: '#/',
30
- schema
31
- },
32
- elements: {
33
- field: {
34
- id: '#/'
35
- }
36
- }
37
- })
38
- })
39
-
40
- it('transforms with `enum`', () => {
41
- const schema = {
42
- type: 'number',
43
- enum: [
44
- 1,
45
- 2,
46
- 3
47
- ],
48
- minimum: 1,
49
- maximum: 9,
50
- exclusiveMinimum: true,
51
- exclusiveMaximum: true,
52
- multipleOf: 1
53
- }
54
-
55
- expect(transform(schema))
56
- .to.eql({
57
- meta: {
58
- type: 'number',
59
- uri: '#/',
60
- schema,
61
- min: 1,
62
- max: 9,
63
- isExclusiveMin: true,
64
- isExclusiveMax: true,
65
- step: 1,
66
- items: [
67
- 1,
68
- 2,
69
- 3
70
- ],
71
- selectedItems: []
72
- },
73
- elements: {
74
- enum: {
75
- id: '#/',
76
- min: 1,
77
- max: 9,
78
- step: 1,
79
- items: [
80
- 1,
81
- 2,
82
- 3
83
- ],
84
- selectedItems: []
85
- }
86
- }
87
- })
88
- })
89
-
90
- it('transforms with `anyOf`', () => {
91
- const schema = {
92
- type: 'number',
93
- anyOf: [
94
- { const: 1 },
95
- { const: 2 },
96
- { const: 3 }
97
- ]
98
- }
99
-
100
- expect(transform(schema))
101
- .to.eql({
102
- meta: {
103
- type: 'number',
104
- uri: '#/',
105
- schema,
106
- items: [
107
- {
108
- meta: {
109
- type: 'number',
110
- item: 0,
111
- parentUri: '#/',
112
- uri: '#/0',
113
- rootSchema: schema,
114
- schema: {
115
- const: 1
116
- },
117
- value: '1'
118
- },
119
- elements: {
120
- field: {
121
- id: '#/0',
122
- value: '1'
123
- }
124
- }
125
- },
126
- {
127
- meta: {
128
- type: 'number',
129
- item: 1,
130
- parentUri: '#/',
131
- uri: '#/1',
132
- rootSchema: schema,
133
- schema: {
134
- const: 2
135
- },
136
- value: '2'
137
- },
138
- elements: {
139
- field: {
140
- id: '#/1',
141
- value: '2'
142
- }
143
- }
144
- },
145
- {
146
- meta: {
147
- type: 'number',
148
- item: 2,
149
- parentUri: '#/',
150
- uri: '#/2',
151
- rootSchema: schema,
152
- schema: {
153
- const: 3
154
- },
155
- value: '3'
156
- },
157
- elements: {
158
- field: {
159
- id: '#/2',
160
- value: '3'
161
- }
162
- }
163
- }
164
- ],
165
- selectedItems: []
166
- },
167
- elements: {
168
- anyOf: {
169
- id: '#/',
170
- items: [
171
- {
172
- meta: {
173
- type: 'number',
174
- item: 0,
175
- parentUri: '#/',
176
- uri: '#/0',
177
- rootSchema: schema,
178
- schema: {
179
- const: 1
180
- },
181
- value: '1'
182
- },
183
- elements: {
184
- field: {
185
- id: '#/0',
186
- value: '1'
187
- }
188
- }
189
- },
190
- {
191
- meta: {
192
- type: 'number',
193
- item: 1,
194
- parentUri: '#/',
195
- uri: '#/1',
196
- rootSchema: schema,
197
- schema: {
198
- const: 2
199
- },
200
- value: '2'
201
- },
202
- elements: {
203
- field: {
204
- id: '#/1',
205
- value: '2'
206
- }
207
- }
208
- },
209
- {
210
- meta: {
211
- type: 'number',
212
- item: 2,
213
- parentUri: '#/',
214
- uri: '#/2',
215
- rootSchema: schema,
216
- schema: {
217
- const: 3
218
- },
219
- value: '3'
220
- },
221
- elements: {
222
- field: {
223
- id: '#/2',
224
- value: '3'
225
- }
226
- }
227
- }
228
- ],
229
- selectedItems: []
230
- }
231
- }
232
- })
233
- })
234
-
235
- it('transforms with `oneOf`', () => {
236
- const schema = {
237
- type: 'number',
238
- oneOf: [
239
- {
240
- const: 1,
241
- minimum: 1,
242
- maximum: 9,
243
- exclusiveMinimum: true,
244
- exclusiveMaximum: true,
245
- multipleOf: 1
246
- },
247
- {
248
- const: 2,
249
- minimum: 1,
250
- maximum: 9,
251
- exclusiveMinimum: true,
252
- exclusiveMaximum: true,
253
- multipleOf: 1
254
- },
255
- {
256
- const: 3,
257
- minimum: 1,
258
- maximum: 9,
259
- exclusiveMinimum: true,
260
- exclusiveMaximum: true,
261
- multipleOf: 1
262
- }
263
- ]
264
- }
265
-
266
- expect(transform(schema))
267
- .to.eql({
268
- meta: {
269
- type: 'number',
270
- uri: '#/',
271
- schema,
272
- items: [
273
- {
274
- meta: {
275
- type: 'number',
276
- item: 0,
277
- parentUri: '#/',
278
- uri: '#/0',
279
- rootSchema: schema,
280
- schema: {
281
- const: 1,
282
- minimum: 1,
283
- maximum: 9,
284
- exclusiveMinimum: true,
285
- exclusiveMaximum: true,
286
- multipleOf: 1
287
- },
288
- value: '1',
289
- min: 1,
290
- max: 9,
291
- isExclusiveMin: true,
292
- isExclusiveMax: true,
293
- step: 1
294
- },
295
- elements: {
296
- field: {
297
- id: '#/0',
298
- value: '1',
299
- min: 1,
300
- max: 9,
301
- step: 1
302
- }
303
- }
304
- },
305
- {
306
- meta: {
307
- type: 'number',
308
- item: 1,
309
- parentUri: '#/',
310
- uri: '#/1',
311
- rootSchema: schema,
312
- schema: {
313
- const: 2,
314
- minimum: 1,
315
- maximum: 9,
316
- exclusiveMinimum: true,
317
- exclusiveMaximum: true,
318
- multipleOf: 1
319
- },
320
- value: '2',
321
- min: 1,
322
- max: 9,
323
- isExclusiveMin: true,
324
- isExclusiveMax: true,
325
- step: 1
326
- },
327
- elements: {
328
- field: {
329
- id: '#/1',
330
- value: '2',
331
- min: 1,
332
- max: 9,
333
- step: 1
334
- }
335
- }
336
- },
337
- {
338
- meta: {
339
- type: 'number',
340
- item: 2,
341
- parentUri: '#/',
342
- uri: '#/2',
343
- rootSchema: schema,
344
- schema: {
345
- const: 3,
346
- minimum: 1,
347
- maximum: 9,
348
- exclusiveMinimum: true,
349
- exclusiveMaximum: true,
350
- multipleOf: 1
351
- },
352
- value: '3',
353
- min: 1,
354
- max: 9,
355
- isExclusiveMin: true,
356
- isExclusiveMax: true,
357
- step: 1
358
- },
359
- elements: {
360
- field: {
361
- id: '#/2',
362
- value: '3',
363
- min: 1,
364
- max: 9,
365
- step: 1
366
- }
367
- }
368
- }
369
- ],
370
- selectedItems: []
371
- },
372
- elements: {
373
- oneOf: {
374
- id: '#/',
375
- items: [
376
- {
377
- meta: {
378
- type: 'number',
379
- item: 0,
380
- parentUri: '#/',
381
- uri: '#/0',
382
- rootSchema: schema,
383
- schema: {
384
- const: 1,
385
- minimum: 1,
386
- maximum: 9,
387
- exclusiveMinimum: true,
388
- exclusiveMaximum: true,
389
- multipleOf: 1
390
- },
391
- value: '1',
392
- min: 1,
393
- max: 9,
394
- isExclusiveMin: true,
395
- isExclusiveMax: true,
396
- step: 1
397
- },
398
- elements: {
399
- field: {
400
- id: '#/0',
401
- value: '1',
402
- min: 1,
403
- max: 9,
404
- step: 1
405
- }
406
- }
407
- },
408
- {
409
- meta: {
410
- type: 'number',
411
- item: 1,
412
- parentUri: '#/',
413
- uri: '#/1',
414
- rootSchema: schema,
415
- schema: {
416
- const: 2,
417
- minimum: 1,
418
- maximum: 9,
419
- exclusiveMinimum: true,
420
- exclusiveMaximum: true,
421
- multipleOf: 1
422
- },
423
- value: '2',
424
- min: 1,
425
- max: 9,
426
- isExclusiveMin: true,
427
- isExclusiveMax: true,
428
- step: 1
429
- },
430
- elements: {
431
- field: {
432
- id: '#/1',
433
- value: '2',
434
- min: 1,
435
- max: 9,
436
- step: 1
437
- }
438
- }
439
- },
440
- {
441
- meta: {
442
- type: 'number',
443
- item: 2,
444
- parentUri: '#/',
445
- uri: '#/2',
446
- rootSchema: schema,
447
- schema: {
448
- const: 3,
449
- minimum: 1,
450
- maximum: 9,
451
- exclusiveMinimum: true,
452
- exclusiveMaximum: true,
453
- multipleOf: 1
454
- },
455
- value: '3',
456
- min: 1,
457
- max: 9,
458
- isExclusiveMin: true,
459
- isExclusiveMax: true,
460
- step: 1
461
- },
462
- elements: {
463
- field: {
464
- id: '#/2',
465
- value: '3',
466
- min: 1,
467
- max: 9,
468
- step: 1
469
- }
470
- }
471
- }
472
- ],
473
- selectedItems: []
474
- }
475
- }
476
- })
477
- })
478
-
479
- it('transforms with `allOf`', () => {
480
- const schema = {
481
- type: 'number',
482
- allOf: [
483
- {
484
- minimum: 1
485
- },
486
- {
487
- const: 0
488
- },
489
- {
490
- maximum: 9
491
- },
492
- {
493
- exclusiveMinimum: true
494
- },
495
- {
496
- exclusiveMaximum: true
497
- },
498
- {
499
- multipleOf: 1
500
- }
501
- ]
502
- }
503
-
504
- expect(transform(schema))
505
- .to.eql({
506
- meta: {
507
- type: 'number',
508
- uri: '#/',
509
- schema,
510
- value: '0',
511
- min: 1,
512
- max: 9,
513
- isExclusiveMin: true,
514
- isExclusiveMax: true,
515
- step: 1
516
- },
517
- elements: {
518
- field: {
519
- id: '#/',
520
- value: '0',
521
- min: 1,
522
- max: 9,
523
- step: 1
524
- }
525
- }
526
- })
527
- })
528
-
529
- it('transforms without `enum` or `anyOf` or `oneOf` or `allOf`', () => {
530
- const schema = {
531
- type: 'number',
532
- minimum: 1,
533
- const: 0,
534
- maximum: 9,
535
- exclusiveMinimum: true,
536
- exclusiveMaximum: true,
537
- multipleOf: 1
538
- }
539
-
540
- expect(transform(schema))
541
- .to.eql({
542
- meta: {
543
- type: 'number',
544
- uri: '#/',
545
- schema,
546
- value: '0',
547
- min: 1,
548
- max: 9,
549
- isExclusiveMin: true,
550
- isExclusiveMax: true,
551
- step: 1
552
- },
553
- elements: {
554
- field: {
555
- id: '#/',
556
- value: '0',
557
- min: 1,
558
- max: 9,
559
- step: 1
560
- }
561
- }
562
- })
563
- })
564
- })
565
- })