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