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