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