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