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,496 +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
- * String
20
- */
21
- describe('Transforming `string` type schemas', () => {
22
- it('transforms', () => {
23
- const schema = { type: 'string' }
24
-
25
- expect(transform(schema))
26
- .to.eql({
27
- meta: {
28
- type: 'string',
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: 'string',
43
- enum: [
44
- 'One',
45
- 'Two',
46
- 'Three'
47
- ],
48
- minLength: 1,
49
- maxLength: 9,
50
- pattern: /.*/
51
- }
52
-
53
- expect(transform(schema))
54
- .to.eql({
55
- meta: {
56
- type: 'string',
57
- uri: '#/',
58
- schema,
59
- minLength: 1,
60
- maxLength: 9,
61
- pattern: /.*/,
62
- items: [
63
- 'One',
64
- 'Two',
65
- 'Three'
66
- ],
67
- selectedItems: []
68
- },
69
- elements: {
70
- enum: {
71
- id: '#/',
72
- minLength: 1,
73
- maxLength: 9,
74
- pattern: /.*/,
75
- items: [
76
- 'One',
77
- 'Two',
78
- 'Three'
79
- ],
80
- selectedItems: []
81
- }
82
- }
83
- })
84
- })
85
-
86
- it('transforms with `anyOf`', () => {
87
- const schema = {
88
- type: 'string',
89
- anyOf: [
90
- { const: 'One' },
91
- { const: 'Two' },
92
- { const: 'Three' }
93
- ]
94
- }
95
-
96
- expect(transform(schema))
97
- .to.eql({
98
- meta: {
99
- type: 'string',
100
- uri: '#/',
101
- schema,
102
- items: [
103
- {
104
- meta: {
105
- type: 'string',
106
- item: 0,
107
- parentUri: '#/',
108
- uri: '#/0',
109
- rootSchema: schema,
110
- schema: {
111
- const: 'One'
112
- },
113
- value: 'One'
114
- },
115
- elements: {
116
- field: {
117
- id: '#/0',
118
- value: 'One'
119
- }
120
- }
121
- },
122
- {
123
- meta: {
124
- type: 'string',
125
- item: 1,
126
- parentUri: '#/',
127
- uri: '#/1',
128
- rootSchema: schema,
129
- schema: {
130
- const: 'Two'
131
- },
132
- value: 'Two'
133
- },
134
- elements: {
135
- field: {
136
- id: '#/1',
137
- value: 'Two'
138
- }
139
- }
140
- },
141
- {
142
- meta: {
143
- type: 'string',
144
- item: 2,
145
- parentUri: '#/',
146
- uri: '#/2',
147
- rootSchema: schema,
148
- schema: {
149
- const: 'Three'
150
- },
151
- value: 'Three'
152
- },
153
- elements: {
154
- field: {
155
- id: '#/2',
156
- value: 'Three'
157
- }
158
- }
159
- }
160
- ],
161
- selectedItems: []
162
- },
163
- elements: {
164
- anyOf: {
165
- id: '#/',
166
- items: [
167
- {
168
- meta: {
169
- type: 'string',
170
- item: 0,
171
- parentUri: '#/',
172
- uri: '#/0',
173
- rootSchema: schema,
174
- schema: {
175
- const: 'One'
176
- },
177
- value: 'One'
178
- },
179
- elements: {
180
- field: {
181
- id: '#/0',
182
- value: 'One'
183
- }
184
- }
185
- },
186
- {
187
- meta: {
188
- type: 'string',
189
- item: 1,
190
- parentUri: '#/',
191
- uri: '#/1',
192
- rootSchema: schema,
193
- schema: {
194
- const: 'Two'
195
- },
196
- value: 'Two'
197
- },
198
- elements: {
199
- field: {
200
- id: '#/1',
201
- value: 'Two'
202
- }
203
- }
204
- },
205
- {
206
- meta: {
207
- type: 'string',
208
- item: 2,
209
- parentUri: '#/',
210
- uri: '#/2',
211
- rootSchema: schema,
212
- schema: {
213
- const: 'Three'
214
- },
215
- value: 'Three'
216
- },
217
- elements: {
218
- field: {
219
- id: '#/2',
220
- value: 'Three'
221
- }
222
- }
223
- }
224
- ],
225
- selectedItems: []
226
- }
227
- }
228
- })
229
- })
230
-
231
- it('transforms with `oneOf`', () => {
232
- const schema = {
233
- type: 'string',
234
- oneOf: [
235
- { const: 'One', minLength: 1, maxLength: 9, pattern: /.*/ },
236
- { const: 'Two', minLength: 1, maxLength: 9, pattern: /.*/ },
237
- { const: 'Three', minLength: 1, maxLength: 9, pattern: /.*/ }
238
- ]
239
- }
240
-
241
- expect(transform(schema))
242
- .to.eql({
243
- meta: {
244
- type: 'string',
245
- uri: '#/',
246
- schema,
247
- items: [
248
- {
249
- meta: {
250
- type: 'string',
251
- item: 0,
252
- parentUri: '#/',
253
- uri: '#/0',
254
- rootSchema: schema,
255
- schema: {
256
- const: 'One',
257
- minLength: 1,
258
- maxLength: 9,
259
- pattern: /.*/
260
- },
261
- value: 'One',
262
- minLength: 1,
263
- maxLength: 9,
264
- pattern: /.*/
265
- },
266
- elements: {
267
- field: {
268
- id: '#/0',
269
- value: 'One',
270
- minLength: 1,
271
- maxLength: 9,
272
- pattern: /.*/
273
- }
274
- }
275
- },
276
- {
277
- meta: {
278
- type: 'string',
279
- item: 1,
280
- parentUri: '#/',
281
- uri: '#/1',
282
- rootSchema: schema,
283
- schema: {
284
- const: 'Two',
285
- minLength: 1,
286
- maxLength: 9,
287
- pattern: /.*/
288
- },
289
- value: 'Two',
290
- minLength: 1,
291
- maxLength: 9,
292
- pattern: /.*/
293
- },
294
- elements: {
295
- field: {
296
- id: '#/1',
297
- value: 'Two',
298
- minLength: 1,
299
- maxLength: 9,
300
- pattern: /.*/
301
- }
302
- }
303
- },
304
- {
305
- meta: {
306
- type: 'string',
307
- item: 2,
308
- parentUri: '#/',
309
- uri: '#/2',
310
- rootSchema: schema,
311
- schema: {
312
- const: 'Three',
313
- minLength: 1,
314
- maxLength: 9,
315
- pattern: /.*/
316
- },
317
- value: 'Three',
318
- minLength: 1,
319
- maxLength: 9,
320
- pattern: /.*/
321
- },
322
- elements: {
323
- field: {
324
- id: '#/2',
325
- value: 'Three',
326
- minLength: 1,
327
- maxLength: 9,
328
- pattern: /.*/
329
- }
330
- }
331
- }
332
- ],
333
- selectedItems: []
334
- },
335
- elements: {
336
- oneOf: {
337
- id: '#/',
338
- items: [
339
- {
340
- meta: {
341
- type: 'string',
342
- item: 0,
343
- parentUri: '#/',
344
- uri: '#/0',
345
- rootSchema: schema,
346
- schema: {
347
- const: 'One',
348
- minLength: 1,
349
- maxLength: 9,
350
- pattern: /.*/
351
- },
352
- value: 'One',
353
- minLength: 1,
354
- maxLength: 9,
355
- pattern: /.*/
356
- },
357
- elements: {
358
- field: {
359
- id: '#/0',
360
- value: 'One',
361
- minLength: 1,
362
- maxLength: 9,
363
- pattern: /.*/
364
- }
365
- }
366
- },
367
- {
368
- meta: {
369
- type: 'string',
370
- item: 1,
371
- parentUri: '#/',
372
- uri: '#/1',
373
- rootSchema: schema,
374
- schema: {
375
- const: 'Two',
376
- minLength: 1,
377
- maxLength: 9,
378
- pattern: /.*/
379
- },
380
- value: 'Two',
381
- minLength: 1,
382
- maxLength: 9,
383
- pattern: /.*/
384
- },
385
- elements: {
386
- field: {
387
- id: '#/1',
388
- value: 'Two',
389
- minLength: 1,
390
- maxLength: 9,
391
- pattern: /.*/
392
- }
393
- }
394
- },
395
- {
396
- meta: {
397
- type: 'string',
398
- item: 2,
399
- parentUri: '#/',
400
- uri: '#/2',
401
- rootSchema: schema,
402
- schema: {
403
- const: 'Three',
404
- minLength: 1,
405
- maxLength: 9,
406
- pattern: /.*/
407
- },
408
- value: 'Three',
409
- minLength: 1,
410
- maxLength: 9,
411
- pattern: /.*/
412
- },
413
- elements: {
414
- field: {
415
- id: '#/2',
416
- value: 'Three',
417
- minLength: 1,
418
- maxLength: 9,
419
- pattern: /.*/
420
- }
421
- }
422
- }
423
- ],
424
- selectedItems: []
425
- }
426
- }
427
- })
428
- })
429
-
430
- it('transforms with `allOf`', () => {
431
- const schema = {
432
- type: 'string',
433
- allOf: [
434
- { minLength: 1 },
435
- { const: 'Value' },
436
- { maxLength: 9 },
437
- { pattern: /.*/ }
438
- ]
439
- }
440
-
441
- expect(transform(schema))
442
- .to.eql({
443
- meta: {
444
- type: 'string',
445
- uri: '#/',
446
- schema,
447
- value: 'Value',
448
- minLength: 1,
449
- maxLength: 9,
450
- pattern: /.*/
451
- },
452
- elements: {
453
- field: {
454
- id: '#/',
455
- value: 'Value',
456
- minLength: 1,
457
- maxLength: 9,
458
- pattern: /.*/
459
- }
460
- }
461
- })
462
- })
463
-
464
- it('transforms without `enum` or `anyOf` or `oneOf` or `allOf`', () => {
465
- const schema = {
466
- type: 'string',
467
- minLength: 1,
468
- const: 'Value',
469
- maxLength: 9,
470
- pattern: /.*/
471
- }
472
-
473
- expect(transform(schema))
474
- .to.eql({
475
- meta: {
476
- type: 'string',
477
- uri: '#/',
478
- schema,
479
- value: 'Value',
480
- minLength: 1,
481
- maxLength: 9,
482
- pattern: /.*/
483
- },
484
- elements: {
485
- field: {
486
- id: '#/',
487
- value: 'Value',
488
- minLength: 1,
489
- maxLength: 9,
490
- pattern: /.*/
491
- }
492
- }
493
- })
494
- })
495
- })
496
- })