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