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