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