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