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