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