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