shinkansen-transmission 2.2.17 → 2.2.20
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.
- package/package.json +3 -1
 - package/src/transmission/common/index.mjs +11 -17
 - package/src/transmission/from-document-to-hash/index.mjs +5 -14
 - package/src/transmission/from-hash-to-document/index.mjs +5 -186
 - package/src/transmission/from-hash-to-document/transform-array-schema.mjs +102 -0
 - package/src/transmission/from-hash-to-document/transform-object-schema.mjs +102 -0
 
    
        package/package.json
    CHANGED
    
    | 
         @@ -1,6 +1,6 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            {
         
     | 
| 
       2 
2 
     | 
    
         
             
              "name": "shinkansen-transmission",
         
     | 
| 
       3 
     | 
    
         
            -
              "version": "2.2. 
     | 
| 
      
 3 
     | 
    
         
            +
              "version": "2.2.20",
         
     | 
| 
       4 
4 
     | 
    
         
             
              "description": "Shinkansen Transmission",
         
     | 
| 
       5 
5 
     | 
    
         
             
              "keywords": [
         
     | 
| 
       6 
6 
     | 
    
         
             
                "Shinkansen",
         
     | 
| 
         @@ -66,6 +66,8 @@ 
     | 
|
| 
       66 
66 
     | 
    
         
             
                "./transmission/common": "./src/transmission/common/index.mjs",
         
     | 
| 
       67 
67 
     | 
    
         
             
                "./transmission/from-document-to-hash": "./src/transmission/from-document-to-hash/index.mjs",
         
     | 
| 
       68 
68 
     | 
    
         
             
                "./transmission/from-hash-to-document": "./src/transmission/from-hash-to-document/index.mjs",
         
     | 
| 
      
 69 
     | 
    
         
            +
                "./transmission/from-hash-to-document/transform-array-schema": "./src/transmission/from-hash-to-document/transform-array-schema.mjs",
         
     | 
| 
      
 70 
     | 
    
         
            +
                "./transmission/from-hash-to-document/transform-object-schema": "./src/transmission/from-hash-to-document/transform-object-schema.mjs",
         
     | 
| 
       69 
71 
     | 
    
         
             
                "./transmission/to-zashiki/transform-root-schema": "./src/transmission/to-zashiki/transform-root-schema.mjs",
         
     | 
| 
       70 
72 
     | 
    
         
             
                "./transmission/to-zashiki/transform-schema": "./src/transmission/to-zashiki/transform-schema.mjs",
         
     | 
| 
       71 
73 
     | 
    
         
             
                "./transmission/to-zashiki": "./src/transmission/to-zashiki/index.mjs",
         
     | 
| 
         @@ -24,14 +24,6 @@ export const isNullSchema = ({ type } = {}) => type === 'null' 
     | 
|
| 
       24 
24 
     | 
    
         | 
| 
       25 
25 
     | 
    
         
             
            export const isPrimitive = (v) => !isObject(v) && !isArray(v)
         
     | 
| 
       26 
26 
     | 
    
         | 
| 
       27 
     | 
    
         
            -
            export const toConstValue = (schema = {}) => Reflect.get(schema, 'const')
         
     | 
| 
       28 
     | 
    
         
            -
             
     | 
| 
       29 
     | 
    
         
            -
            export const isConstValue = (schema = {}) => Reflect.has(schema, 'const')
         
     | 
| 
       30 
     | 
    
         
            -
             
     | 
| 
       31 
     | 
    
         
            -
            export const toDefaultValue = (schema = {}) => Reflect.get(schema, 'default')
         
     | 
| 
       32 
     | 
    
         
            -
             
     | 
| 
       33 
     | 
    
         
            -
            export const isDefaultValue = (schema = {}) => Reflect.has(schema, 'default')
         
     | 
| 
       34 
     | 
    
         
            -
             
     | 
| 
       35 
27 
     | 
    
         
             
            export const getTitle = ({ title } = {}) => (title ? { title } : {})
         
     | 
| 
       36 
28 
     | 
    
         | 
| 
       37 
29 
     | 
    
         
             
            export const getDescription = ({ description } = {}) => (description ? { description } : {})
         
     | 
| 
         @@ -157,15 +149,17 @@ export function getMetaValue (values = {}, uri = '#', schema = {}) { 
     | 
|
| 
       157 
149 
     | 
    
         
             
              return {}
         
     | 
| 
       158 
150 
     | 
    
         
             
            }
         
     | 
| 
       159 
151 
     | 
    
         | 
| 
       160 
     | 
    
         
            -
            export  
     | 
| 
       161 
     | 
    
         
            -
               
     | 
| 
       162 
     | 
    
         
            -
                 
     | 
| 
       163 
     | 
    
         
            -
                  ?  
     | 
| 
       164 
     | 
    
         
            -
             
     | 
| 
       165 
     | 
    
         
            -
                     
     | 
| 
       166 
     | 
    
         
            -
             
     | 
| 
       167 
     | 
    
         
            -
             
     | 
| 
       168 
     | 
    
         
            -
             
     | 
| 
      
 152 
     | 
    
         
            +
            export function transformValue (schema) {
         
     | 
| 
      
 153 
     | 
    
         
            +
              return (
         
     | 
| 
      
 154 
     | 
    
         
            +
                isObject(schema)
         
     | 
| 
      
 155 
     | 
    
         
            +
                  ? hasConst(schema)
         
     | 
| 
      
 156 
     | 
    
         
            +
                    ? getConst(schema)
         
     | 
| 
      
 157 
     | 
    
         
            +
                    : hasDefault(schema)
         
     | 
| 
      
 158 
     | 
    
         
            +
                      ? getDefault(schema)
         
     | 
| 
      
 159 
     | 
    
         
            +
                      : schema
         
     | 
| 
      
 160 
     | 
    
         
            +
                  : schema
         
     | 
| 
      
 161 
     | 
    
         
            +
              )
         
     | 
| 
      
 162 
     | 
    
         
            +
            }
         
     | 
| 
       169 
163 
     | 
    
         | 
| 
       170 
164 
     | 
    
         
             
            export function hasValue (values = {}, uri = '#', schema = {}) {
         
     | 
| 
       171 
165 
     | 
    
         
             
              if (Reflect.has(values, uri)) {
         
     | 
| 
         @@ -3,10 +3,6 @@ import debug from 'debug' 
     | 
|
| 
       3 
3 
     | 
    
         
             
            import equal from 'fast-deep-equal'
         
     | 
| 
       4 
4 
     | 
    
         | 
| 
       5 
5 
     | 
    
         
             
            import {
         
     | 
| 
       6 
     | 
    
         
            -
              isConstValue,
         
     | 
| 
       7 
     | 
    
         
            -
              toConstValue,
         
     | 
| 
       8 
     | 
    
         
            -
              isDefaultValue,
         
     | 
| 
       9 
     | 
    
         
            -
              toDefaultValue,
         
     | 
| 
       10 
6 
     | 
    
         
             
              isObject,
         
     | 
| 
       11 
7 
     | 
    
         
             
              isArray,
         
     | 
| 
       12 
8 
     | 
    
         
             
              hasEnum,
         
     | 
| 
         @@ -15,7 +11,8 @@ import { 
     | 
|
| 
       15 
11 
     | 
    
         
             
              getAnyOf,
         
     | 
| 
       16 
12 
     | 
    
         
             
              hasOneOf,
         
     | 
| 
       17 
13 
     | 
    
         
             
              getOneOf,
         
     | 
| 
       18 
     | 
    
         
            -
              getUri
         
     | 
| 
      
 14 
     | 
    
         
            +
              getUri,
         
     | 
| 
      
 15 
     | 
    
         
            +
              transformValue
         
     | 
| 
       19 
16 
     | 
    
         
             
            } from 'shinkansen-transmission/transmission/common'
         
     | 
| 
       20 
17 
     | 
    
         | 
| 
       21 
18 
     | 
    
         
             
            const log = debug('shinkansen-transmission/from-document-to-hash')
         
     | 
| 
         @@ -132,15 +129,9 @@ export function getSchema (schema = {}, parentUri = '', uri = '') { 
     | 
|
| 
       132 
129 
     | 
    
         
             
              }
         
     | 
| 
       133 
130 
     | 
    
         
             
            }
         
     | 
| 
       134 
131 
     | 
    
         | 
| 
       135 
     | 
    
         
            -
            export  
     | 
| 
       136 
     | 
    
         
            -
               
     | 
| 
       137 
     | 
    
         
            -
             
     | 
| 
       138 
     | 
    
         
            -
                  ? toConstValue(schema)
         
     | 
| 
       139 
     | 
    
         
            -
                  : isDefaultValue(schema)
         
     | 
| 
       140 
     | 
    
         
            -
                    ? toDefaultValue(schema)
         
     | 
| 
       141 
     | 
    
         
            -
                    : schema // object
         
     | 
| 
       142 
     | 
    
         
            -
                : schema // primitive or array
         
     | 
| 
       143 
     | 
    
         
            -
            )
         
     | 
| 
      
 132 
     | 
    
         
            +
            export {
         
     | 
| 
      
 133 
     | 
    
         
            +
              transformValue
         
     | 
| 
      
 134 
     | 
    
         
            +
            }
         
     | 
| 
       144 
135 
     | 
    
         | 
| 
       145 
136 
     | 
    
         
             
            export function transformValueIndexFor (array, value) {
         
     | 
| 
       146 
137 
     | 
    
         
             
              /*
         
     | 
| 
         @@ -4,17 +4,14 @@ import { 
     | 
|
| 
       4 
4 
     | 
    
         
             
              isArray,
         
     | 
| 
       5 
5 
     | 
    
         
             
              isObject,
         
     | 
| 
       6 
6 
     | 
    
         
             
              isPrimitive,
         
     | 
| 
       7 
     | 
    
         
            -
              isConstValue,
         
     | 
| 
       8 
     | 
    
         
            -
              toConstValue,
         
     | 
| 
       9 
     | 
    
         
            -
              isDefaultValue,
         
     | 
| 
       10 
     | 
    
         
            -
              toDefaultValue,
         
     | 
| 
       11 
7 
     | 
    
         
             
              hasEnum,
         
     | 
| 
       12 
8 
     | 
    
         
             
              getEnum,
         
     | 
| 
       13 
9 
     | 
    
         
             
              hasAnyOf,
         
     | 
| 
       14 
10 
     | 
    
         
             
              getAnyOf,
         
     | 
| 
       15 
11 
     | 
    
         
             
              hasOneOf,
         
     | 
| 
       16 
12 
     | 
    
         
             
              getOneOf,
         
     | 
| 
       17 
     | 
    
         
            -
              getUri
         
     | 
| 
      
 13 
     | 
    
         
            +
              getUri,
         
     | 
| 
      
 14 
     | 
    
         
            +
              transformValue
         
     | 
| 
       18 
15 
     | 
    
         
             
            } from 'shinkansen-transmission/transmission/common'
         
     | 
| 
       19 
16 
     | 
    
         | 
| 
       20 
17 
     | 
    
         
             
            const log = debug('shinkansen-transmission/from-hash-to-document')
         
     | 
| 
         @@ -61,15 +58,9 @@ export function toNumber (v) { 
     | 
|
| 
       61 
58 
     | 
    
         | 
| 
       62 
59 
     | 
    
         
             
            const handleError = ({ message = 'No error message defined' }) => { log(message) }
         
     | 
| 
       63 
60 
     | 
    
         | 
| 
       64 
     | 
    
         
            -
            export  
     | 
| 
       65 
     | 
    
         
            -
               
     | 
| 
       66 
     | 
    
         
            -
             
     | 
| 
       67 
     | 
    
         
            -
                  ? toConstValue(schema)
         
     | 
| 
       68 
     | 
    
         
            -
                  : isDefaultValue(schema)
         
     | 
| 
       69 
     | 
    
         
            -
                    ? toDefaultValue(schema)
         
     | 
| 
       70 
     | 
    
         
            -
                    : schema
         
     | 
| 
       71 
     | 
    
         
            -
                : schema
         
     | 
| 
       72 
     | 
    
         
            -
            )
         
     | 
| 
      
 61 
     | 
    
         
            +
            export {
         
     | 
| 
      
 62 
     | 
    
         
            +
              transformValue
         
     | 
| 
      
 63 
     | 
    
         
            +
            }
         
     | 
| 
       73 
64 
     | 
    
         | 
| 
       74 
65 
     | 
    
         
             
            export function transformValueFor (value, array) {
         
     | 
| 
       75 
66 
     | 
    
         
             
              /*
         
     | 
| 
         @@ -214,178 +205,6 @@ export function transformItemsObjectFor (values, items = {}, parentUri = '#', ur 
     | 
|
| 
       214 
205 
     | 
    
         
             
              )
         
     | 
| 
       215 
206 
     | 
    
         
             
            }
         
     | 
| 
       216 
207 
     | 
    
         | 
| 
       217 
     | 
    
         
            -
            // https://json-schema.org/draft/2019-09/json-schema-validation.html#rfc.section.6
         
     | 
| 
       218 
     | 
    
         
            -
            export function transformObjectSchemaNull (values, schema, { uri: parentUri, key: fieldKey }, uri = getUri(parentUri, fieldKey)) {
         
     | 
| 
       219 
     | 
    
         
            -
              /*
         
     | 
| 
       220 
     | 
    
         
            -
               *  log('transformObjectSchemaNull')
         
     | 
| 
       221 
     | 
    
         
            -
               */
         
     | 
| 
       222 
     | 
    
         
            -
             
     | 
| 
       223 
     | 
    
         
            -
              return transformNull(values, schema, parentUri, uri)
         
     | 
| 
       224 
     | 
    
         
            -
            }
         
     | 
| 
       225 
     | 
    
         
            -
             
     | 
| 
       226 
     | 
    
         
            -
            // https://json-schema.org/draft/2019-09/json-schema-validation.html#rfc.section.6
         
     | 
| 
       227 
     | 
    
         
            -
            export function transformObjectSchemaBoolean (values, schema, { uri: parentUri, key: fieldKey }, uri = getUri(parentUri, fieldKey)) {
         
     | 
| 
       228 
     | 
    
         
            -
              /*
         
     | 
| 
       229 
     | 
    
         
            -
               *  log('transformObjectSchemaBoolean')
         
     | 
| 
       230 
     | 
    
         
            -
               */
         
     | 
| 
       231 
     | 
    
         
            -
             
     | 
| 
       232 
     | 
    
         
            -
              return transformBoolean(values, schema, parentUri, uri)
         
     | 
| 
       233 
     | 
    
         
            -
            }
         
     | 
| 
       234 
     | 
    
         
            -
             
     | 
| 
       235 
     | 
    
         
            -
            // https://json-schema.org/draft/2019-09/json-schema-validation.html#rfc.section.6.5
         
     | 
| 
       236 
     | 
    
         
            -
            export function transformObjectSchemaObject (values, schema, { uri: parentUri, key: fieldKey }, uri = getUri(parentUri, fieldKey)) {
         
     | 
| 
       237 
     | 
    
         
            -
              /*
         
     | 
| 
       238 
     | 
    
         
            -
               *  log('transformObjectSchemaObject')
         
     | 
| 
       239 
     | 
    
         
            -
               */
         
     | 
| 
       240 
     | 
    
         
            -
             
     | 
| 
       241 
     | 
    
         
            -
              return transformObject(values, schema, uri, uri) // uri is parentUri and uri
         
     | 
| 
       242 
     | 
    
         
            -
            }
         
     | 
| 
       243 
     | 
    
         
            -
             
     | 
| 
       244 
     | 
    
         
            -
            // https://json-schema.org/draft/2019-09/json-schema-validation.html#rfc.section.6.4
         
     | 
| 
       245 
     | 
    
         
            -
            export function transformObjectSchemaArray (values, schema, { uri: parentUri, key: fieldKey }, uri = getUri(parentUri, fieldKey)) {
         
     | 
| 
       246 
     | 
    
         
            -
              /*
         
     | 
| 
       247 
     | 
    
         
            -
               *  log('transformObjectSchemaArray')
         
     | 
| 
       248 
     | 
    
         
            -
               */
         
     | 
| 
       249 
     | 
    
         
            -
             
     | 
| 
       250 
     | 
    
         
            -
              return transformArray(values, schema, uri, uri) // uri is parentUri and uri
         
     | 
| 
       251 
     | 
    
         
            -
            }
         
     | 
| 
       252 
     | 
    
         
            -
             
     | 
| 
       253 
     | 
    
         
            -
            // https://json-schema.org/draft/2019-09/json-schema-validation.html#rfc.section.6.2
         
     | 
| 
       254 
     | 
    
         
            -
            export function transformObjectSchemaNumber (values, schema, { uri: parentUri, key: fieldKey }, uri = getUri(parentUri, fieldKey)) {
         
     | 
| 
       255 
     | 
    
         
            -
              /*
         
     | 
| 
       256 
     | 
    
         
            -
               *  log('transformObjectSchemaNumber')
         
     | 
| 
       257 
     | 
    
         
            -
               */
         
     | 
| 
       258 
     | 
    
         
            -
             
     | 
| 
       259 
     | 
    
         
            -
              return transformNumber(values, schema, parentUri, uri)
         
     | 
| 
       260 
     | 
    
         
            -
            }
         
     | 
| 
       261 
     | 
    
         
            -
             
     | 
| 
       262 
     | 
    
         
            -
            // https://json-schema.org/draft/2019-09/json-schema-validation.html#rfc.section.6.3
         
     | 
| 
       263 
     | 
    
         
            -
            export function transformObjectSchemaString (values, schema, { uri: parentUri, key: fieldKey }, uri = getUri(parentUri, fieldKey)) {
         
     | 
| 
       264 
     | 
    
         
            -
              /*
         
     | 
| 
       265 
     | 
    
         
            -
               *  log('transformObjectSchemaString')
         
     | 
| 
       266 
     | 
    
         
            -
               */
         
     | 
| 
       267 
     | 
    
         
            -
             
     | 
| 
       268 
     | 
    
         
            -
              return transformString(values, schema, parentUri, uri)
         
     | 
| 
       269 
     | 
    
         
            -
            }
         
     | 
| 
       270 
     | 
    
         
            -
             
     | 
| 
       271 
     | 
    
         
            -
            export function transformObjectSchema (values = {}, schema = {}, params = {}) {
         
     | 
| 
       272 
     | 
    
         
            -
              /*
         
     | 
| 
       273 
     | 
    
         
            -
               *  log('transformObjectSchema')
         
     | 
| 
       274 
     | 
    
         
            -
               */
         
     | 
| 
       275 
     | 
    
         
            -
             
     | 
| 
       276 
     | 
    
         
            -
              const { type } = schema
         
     | 
| 
       277 
     | 
    
         
            -
             
     | 
| 
       278 
     | 
    
         
            -
              // https://json-schema.org/draft/2019-09/json-schema-core.html#rfc.section.4.2.1
         
     | 
| 
       279 
     | 
    
         
            -
              switch (type) {
         
     | 
| 
       280 
     | 
    
         
            -
                case 'null':
         
     | 
| 
       281 
     | 
    
         
            -
                  return transformObjectSchemaNull(values, schema, params)
         
     | 
| 
       282 
     | 
    
         
            -
             
     | 
| 
       283 
     | 
    
         
            -
                case 'boolean':
         
     | 
| 
       284 
     | 
    
         
            -
                  return transformObjectSchemaBoolean(values, schema, params)
         
     | 
| 
       285 
     | 
    
         
            -
             
     | 
| 
       286 
     | 
    
         
            -
                case 'object':
         
     | 
| 
       287 
     | 
    
         
            -
                  return transformObjectSchemaObject(values, schema, params)
         
     | 
| 
       288 
     | 
    
         
            -
             
     | 
| 
       289 
     | 
    
         
            -
                case 'array':
         
     | 
| 
       290 
     | 
    
         
            -
                  return transformObjectSchemaArray(values, schema, params)
         
     | 
| 
       291 
     | 
    
         
            -
             
     | 
| 
       292 
     | 
    
         
            -
                case 'number':
         
     | 
| 
       293 
     | 
    
         
            -
                  return transformObjectSchemaNumber(values, schema, params)
         
     | 
| 
       294 
     | 
    
         
            -
             
     | 
| 
       295 
     | 
    
         
            -
                case 'string':
         
     | 
| 
       296 
     | 
    
         
            -
                  return transformObjectSchemaString(values, schema, params)
         
     | 
| 
       297 
     | 
    
         
            -
             
     | 
| 
       298 
     | 
    
         
            -
                default:
         
     | 
| 
       299 
     | 
    
         
            -
                  throw new Error('Schema does not conform to Instance Data Model, https://json-schema.org/draft/2019-09/json-schema-core.html#rfc.section.4.2.1')
         
     | 
| 
       300 
     | 
    
         
            -
              }
         
     | 
| 
       301 
     | 
    
         
            -
            }
         
     | 
| 
       302 
     | 
    
         
            -
             
     | 
| 
       303 
     | 
    
         
            -
            // https://json-schema.org/draft/2019-09/json-schema-validation.html#rfc.section.6
         
     | 
| 
       304 
     | 
    
         
            -
            export function transformArraySchemaNull (values, schema, { uri: parentUri, index: arrayIndex }, uri = getUri(parentUri, arrayIndex)) {
         
     | 
| 
       305 
     | 
    
         
            -
              /*
         
     | 
| 
       306 
     | 
    
         
            -
               *  log('transformArraySchemaNull')
         
     | 
| 
       307 
     | 
    
         
            -
               */
         
     | 
| 
       308 
     | 
    
         
            -
             
     | 
| 
       309 
     | 
    
         
            -
              return transformNull(values, schema, parentUri, uri)
         
     | 
| 
       310 
     | 
    
         
            -
            }
         
     | 
| 
       311 
     | 
    
         
            -
             
     | 
| 
       312 
     | 
    
         
            -
            // https://json-schema.org/draft/2019-09/json-schema-validation.html#rfc.section.6
         
     | 
| 
       313 
     | 
    
         
            -
            export function transformArraySchemaBoolean (values, schema, { uri: parentUri, index: arrayIndex }, uri = getUri(parentUri, arrayIndex)) {
         
     | 
| 
       314 
     | 
    
         
            -
              /*
         
     | 
| 
       315 
     | 
    
         
            -
               *  log('transformArraySchemaBoolean')
         
     | 
| 
       316 
     | 
    
         
            -
               */
         
     | 
| 
       317 
     | 
    
         
            -
             
     | 
| 
       318 
     | 
    
         
            -
              return transformBoolean(values, schema, parentUri, uri)
         
     | 
| 
       319 
     | 
    
         
            -
            }
         
     | 
| 
       320 
     | 
    
         
            -
             
     | 
| 
       321 
     | 
    
         
            -
            // https://json-schema.org/draft/2019-09/json-schema-validation.html#rfc.section.6.5
         
     | 
| 
       322 
     | 
    
         
            -
            export function transformArraySchemaObject (values, schema, { uri: parentUri, index: arrayIndex }, uri = getUri(parentUri, arrayIndex)) {
         
     | 
| 
       323 
     | 
    
         
            -
              /*
         
     | 
| 
       324 
     | 
    
         
            -
               *  log('transformArraySchemaObject')
         
     | 
| 
       325 
     | 
    
         
            -
               */
         
     | 
| 
       326 
     | 
    
         
            -
             
     | 
| 
       327 
     | 
    
         
            -
              return transformObject(values, schema, uri, uri) // uri is parentUri and uri
         
     | 
| 
       328 
     | 
    
         
            -
            }
         
     | 
| 
       329 
     | 
    
         
            -
             
     | 
| 
       330 
     | 
    
         
            -
            // https://json-schema.org/draft/2019-09/json-schema-validation.html#rfc.section.6.4
         
     | 
| 
       331 
     | 
    
         
            -
            export function transformArraySchemaArray (values, schema, { uri: parentUri, index: arrayIndex }, uri = getUri(parentUri, arrayIndex)) {
         
     | 
| 
       332 
     | 
    
         
            -
              /*
         
     | 
| 
       333 
     | 
    
         
            -
               *  log('transformArraySchemaArray')
         
     | 
| 
       334 
     | 
    
         
            -
               */
         
     | 
| 
       335 
     | 
    
         
            -
             
     | 
| 
       336 
     | 
    
         
            -
              return transformArray(values, schema, uri, uri) // uri is parentUri and uri
         
     | 
| 
       337 
     | 
    
         
            -
            }
         
     | 
| 
       338 
     | 
    
         
            -
             
     | 
| 
       339 
     | 
    
         
            -
            // https://json-schema.org/draft/2019-09/json-schema-validation.html#rfc.section.6.2
         
     | 
| 
       340 
     | 
    
         
            -
            export function transformArraySchemaNumber (values, schema, { uri: parentUri, index: arrayIndex }, uri = getUri(parentUri, arrayIndex)) {
         
     | 
| 
       341 
     | 
    
         
            -
              /*
         
     | 
| 
       342 
     | 
    
         
            -
               *  log('transformArraySchemaNumber')
         
     | 
| 
       343 
     | 
    
         
            -
               */
         
     | 
| 
       344 
     | 
    
         
            -
             
     | 
| 
       345 
     | 
    
         
            -
              return transformNumber(values, schema, parentUri, uri)
         
     | 
| 
       346 
     | 
    
         
            -
            }
         
     | 
| 
       347 
     | 
    
         
            -
             
     | 
| 
       348 
     | 
    
         
            -
            // https://json-schema.org/draft/2019-09/json-schema-validation.html#rfc.section.6.3
         
     | 
| 
       349 
     | 
    
         
            -
            export function transformArraySchemaString (values, schema, { uri: parentUri, index: arrayIndex }, uri = getUri(parentUri, arrayIndex)) {
         
     | 
| 
       350 
     | 
    
         
            -
              /*
         
     | 
| 
       351 
     | 
    
         
            -
               *  log('transformArraySchemaString')
         
     | 
| 
       352 
     | 
    
         
            -
               */
         
     | 
| 
       353 
     | 
    
         
            -
             
     | 
| 
       354 
     | 
    
         
            -
              return transformString(values, schema, parentUri, uri)
         
     | 
| 
       355 
     | 
    
         
            -
            }
         
     | 
| 
       356 
     | 
    
         
            -
             
     | 
| 
       357 
     | 
    
         
            -
            export function transformArraySchema (values = {}, schema = {}, params = {}) {
         
     | 
| 
       358 
     | 
    
         
            -
              /*
         
     | 
| 
       359 
     | 
    
         
            -
               *  log('transformArraySchema')
         
     | 
| 
       360 
     | 
    
         
            -
               */
         
     | 
| 
       361 
     | 
    
         
            -
             
     | 
| 
       362 
     | 
    
         
            -
              const { type } = schema
         
     | 
| 
       363 
     | 
    
         
            -
             
     | 
| 
       364 
     | 
    
         
            -
              // https://json-schema.org/draft/2019-09/json-schema-core.html#rfc.section.4.2.1
         
     | 
| 
       365 
     | 
    
         
            -
              switch (type) {
         
     | 
| 
       366 
     | 
    
         
            -
                case 'null':
         
     | 
| 
       367 
     | 
    
         
            -
                  return transformArraySchemaNull(values, schema, params)
         
     | 
| 
       368 
     | 
    
         
            -
             
     | 
| 
       369 
     | 
    
         
            -
                case 'boolean':
         
     | 
| 
       370 
     | 
    
         
            -
                  return transformArraySchemaBoolean(values, schema, params)
         
     | 
| 
       371 
     | 
    
         
            -
             
     | 
| 
       372 
     | 
    
         
            -
                case 'object':
         
     | 
| 
       373 
     | 
    
         
            -
                  return transformArraySchemaObject(values, schema, params)
         
     | 
| 
       374 
     | 
    
         
            -
             
     | 
| 
       375 
     | 
    
         
            -
                case 'array':
         
     | 
| 
       376 
     | 
    
         
            -
                  return transformArraySchemaArray(values, schema, params)
         
     | 
| 
       377 
     | 
    
         
            -
             
     | 
| 
       378 
     | 
    
         
            -
                case 'number':
         
     | 
| 
       379 
     | 
    
         
            -
                  return transformArraySchemaNumber(values, schema, params)
         
     | 
| 
       380 
     | 
    
         
            -
             
     | 
| 
       381 
     | 
    
         
            -
                case 'string':
         
     | 
| 
       382 
     | 
    
         
            -
                  return transformArraySchemaString(values, schema, params)
         
     | 
| 
       383 
     | 
    
         
            -
             
     | 
| 
       384 
     | 
    
         
            -
                default:
         
     | 
| 
       385 
     | 
    
         
            -
                  throw new Error('Schema does not conform to Instance Data Model, https://json-schema.org/draft/2019-09/json-schema-core.html#rfc.section.4.2.1')
         
     | 
| 
       386 
     | 
    
         
            -
              }
         
     | 
| 
       387 
     | 
    
         
            -
            }
         
     | 
| 
       388 
     | 
    
         
            -
             
     | 
| 
       389 
208 
     | 
    
         
             
            export function transformNull (values, schema, parentUri, uri) {
         
     | 
| 
       390 
209 
     | 
    
         
             
              /*
         
     | 
| 
       391 
210 
     | 
    
         
             
               *  log('transformNull')
         
     | 
| 
         @@ -0,0 +1,102 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            import debug from 'debug'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            import {
         
     | 
| 
      
 4 
     | 
    
         
            +
              getUri
         
     | 
| 
      
 5 
     | 
    
         
            +
            } from 'shinkansen-transmission/transmission/common'
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            import {
         
     | 
| 
      
 8 
     | 
    
         
            +
              transformNull,
         
     | 
| 
      
 9 
     | 
    
         
            +
              transformBoolean,
         
     | 
| 
      
 10 
     | 
    
         
            +
              transformObject,
         
     | 
| 
      
 11 
     | 
    
         
            +
              transformArray,
         
     | 
| 
      
 12 
     | 
    
         
            +
              transformNumber,
         
     | 
| 
      
 13 
     | 
    
         
            +
              transformString
         
     | 
| 
      
 14 
     | 
    
         
            +
            } from 'shinkansen-transmission/transmission/from-hash-to-document'
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
            const log = debug('shinkansen-transmission/from-hash-to-document/transform-array-schema')
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
            log('`shinkansen` is awake')
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
            // https://json-schema.org/draft/2019-09/json-schema-validation.html#rfc.section.6
         
     | 
| 
      
 21 
     | 
    
         
            +
            export function transformArraySchemaNull (values, schema, { uri: parentUri, index: arrayIndex }, uri = getUri(parentUri, arrayIndex)) {
         
     | 
| 
      
 22 
     | 
    
         
            +
              /*
         
     | 
| 
      
 23 
     | 
    
         
            +
               *  log('transformArraySchemaNull')
         
     | 
| 
      
 24 
     | 
    
         
            +
               */
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
              return transformNull(values, schema, parentUri, uri)
         
     | 
| 
      
 27 
     | 
    
         
            +
            }
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
            // https://json-schema.org/draft/2019-09/json-schema-validation.html#rfc.section.6
         
     | 
| 
      
 30 
     | 
    
         
            +
            export function transformArraySchemaBoolean (values, schema, { uri: parentUri, index: arrayIndex }, uri = getUri(parentUri, arrayIndex)) {
         
     | 
| 
      
 31 
     | 
    
         
            +
              /*
         
     | 
| 
      
 32 
     | 
    
         
            +
               *  log('transformArraySchemaBoolean')
         
     | 
| 
      
 33 
     | 
    
         
            +
               */
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
              return transformBoolean(values, schema, parentUri, uri)
         
     | 
| 
      
 36 
     | 
    
         
            +
            }
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
            // https://json-schema.org/draft/2019-09/json-schema-validation.html#rfc.section.6.5
         
     | 
| 
      
 39 
     | 
    
         
            +
            export function transformArraySchemaObject (values, schema, { uri: parentUri, index: arrayIndex }, uri = getUri(parentUri, arrayIndex)) {
         
     | 
| 
      
 40 
     | 
    
         
            +
              /*
         
     | 
| 
      
 41 
     | 
    
         
            +
               *  log('transformArraySchemaObject')
         
     | 
| 
      
 42 
     | 
    
         
            +
               */
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
              return transformObject(values, schema, uri, uri) // uri is parentUri and uri
         
     | 
| 
      
 45 
     | 
    
         
            +
            }
         
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
      
 47 
     | 
    
         
            +
            // https://json-schema.org/draft/2019-09/json-schema-validation.html#rfc.section.6.4
         
     | 
| 
      
 48 
     | 
    
         
            +
            export function transformArraySchemaArray (values, schema, { uri: parentUri, index: arrayIndex }, uri = getUri(parentUri, arrayIndex)) {
         
     | 
| 
      
 49 
     | 
    
         
            +
              /*
         
     | 
| 
      
 50 
     | 
    
         
            +
               *  log('transformArraySchemaArray')
         
     | 
| 
      
 51 
     | 
    
         
            +
               */
         
     | 
| 
      
 52 
     | 
    
         
            +
             
     | 
| 
      
 53 
     | 
    
         
            +
              return transformArray(values, schema, uri, uri) // uri is parentUri and uri
         
     | 
| 
      
 54 
     | 
    
         
            +
            }
         
     | 
| 
      
 55 
     | 
    
         
            +
             
     | 
| 
      
 56 
     | 
    
         
            +
            // https://json-schema.org/draft/2019-09/json-schema-validation.html#rfc.section.6.2
         
     | 
| 
      
 57 
     | 
    
         
            +
            export function transformArraySchemaNumber (values, schema, { uri: parentUri, index: arrayIndex }, uri = getUri(parentUri, arrayIndex)) {
         
     | 
| 
      
 58 
     | 
    
         
            +
              /*
         
     | 
| 
      
 59 
     | 
    
         
            +
               *  log('transformArraySchemaNumber')
         
     | 
| 
      
 60 
     | 
    
         
            +
               */
         
     | 
| 
      
 61 
     | 
    
         
            +
             
     | 
| 
      
 62 
     | 
    
         
            +
              return transformNumber(values, schema, parentUri, uri)
         
     | 
| 
      
 63 
     | 
    
         
            +
            }
         
     | 
| 
      
 64 
     | 
    
         
            +
             
     | 
| 
      
 65 
     | 
    
         
            +
            // https://json-schema.org/draft/2019-09/json-schema-validation.html#rfc.section.6.3
         
     | 
| 
      
 66 
     | 
    
         
            +
            export function transformArraySchemaString (values, schema, { uri: parentUri, index: arrayIndex }, uri = getUri(parentUri, arrayIndex)) {
         
     | 
| 
      
 67 
     | 
    
         
            +
              /*
         
     | 
| 
      
 68 
     | 
    
         
            +
               *  log('transformArraySchemaString')
         
     | 
| 
      
 69 
     | 
    
         
            +
               */
         
     | 
| 
      
 70 
     | 
    
         
            +
             
     | 
| 
      
 71 
     | 
    
         
            +
              return transformString(values, schema, parentUri, uri)
         
     | 
| 
      
 72 
     | 
    
         
            +
            }
         
     | 
| 
      
 73 
     | 
    
         
            +
             
     | 
| 
      
 74 
     | 
    
         
            +
            export default function transformArraySchema (values = {}, schema = {}, params = {}) {
         
     | 
| 
      
 75 
     | 
    
         
            +
              log('transformArraySchema')
         
     | 
| 
      
 76 
     | 
    
         
            +
             
     | 
| 
      
 77 
     | 
    
         
            +
              const { type } = schema
         
     | 
| 
      
 78 
     | 
    
         
            +
             
     | 
| 
      
 79 
     | 
    
         
            +
              // https://json-schema.org/draft/2019-09/json-schema-core.html#rfc.section.4.2.1
         
     | 
| 
      
 80 
     | 
    
         
            +
              switch (type) {
         
     | 
| 
      
 81 
     | 
    
         
            +
                case 'null':
         
     | 
| 
      
 82 
     | 
    
         
            +
                  return transformArraySchemaNull(values, schema, params)
         
     | 
| 
      
 83 
     | 
    
         
            +
             
     | 
| 
      
 84 
     | 
    
         
            +
                case 'boolean':
         
     | 
| 
      
 85 
     | 
    
         
            +
                  return transformArraySchemaBoolean(values, schema, params)
         
     | 
| 
      
 86 
     | 
    
         
            +
             
     | 
| 
      
 87 
     | 
    
         
            +
                case 'object':
         
     | 
| 
      
 88 
     | 
    
         
            +
                  return transformArraySchemaObject(values, schema, params)
         
     | 
| 
      
 89 
     | 
    
         
            +
             
     | 
| 
      
 90 
     | 
    
         
            +
                case 'array':
         
     | 
| 
      
 91 
     | 
    
         
            +
                  return transformArraySchemaArray(values, schema, params)
         
     | 
| 
      
 92 
     | 
    
         
            +
             
     | 
| 
      
 93 
     | 
    
         
            +
                case 'number':
         
     | 
| 
      
 94 
     | 
    
         
            +
                  return transformArraySchemaNumber(values, schema, params)
         
     | 
| 
      
 95 
     | 
    
         
            +
             
     | 
| 
      
 96 
     | 
    
         
            +
                case 'string':
         
     | 
| 
      
 97 
     | 
    
         
            +
                  return transformArraySchemaString(values, schema, params)
         
     | 
| 
      
 98 
     | 
    
         
            +
             
     | 
| 
      
 99 
     | 
    
         
            +
                default:
         
     | 
| 
      
 100 
     | 
    
         
            +
                  throw new Error('Schema does not conform to Instance Data Model, https://json-schema.org/draft/2019-09/json-schema-core.html#rfc.section.4.2.1')
         
     | 
| 
      
 101 
     | 
    
         
            +
              }
         
     | 
| 
      
 102 
     | 
    
         
            +
            }
         
     | 
| 
         @@ -0,0 +1,102 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            import debug from 'debug'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            import {
         
     | 
| 
      
 4 
     | 
    
         
            +
              getUri
         
     | 
| 
      
 5 
     | 
    
         
            +
            } from 'shinkansen-transmission/transmission/common'
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            import {
         
     | 
| 
      
 8 
     | 
    
         
            +
              transformNull,
         
     | 
| 
      
 9 
     | 
    
         
            +
              transformBoolean,
         
     | 
| 
      
 10 
     | 
    
         
            +
              transformObject,
         
     | 
| 
      
 11 
     | 
    
         
            +
              transformArray,
         
     | 
| 
      
 12 
     | 
    
         
            +
              transformNumber,
         
     | 
| 
      
 13 
     | 
    
         
            +
              transformString
         
     | 
| 
      
 14 
     | 
    
         
            +
            } from 'shinkansen-transmission/transmission/from-hash-to-document'
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
            const log = debug('shinkansen-transmission/from-hash-to-document/transform-object-schema')
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
            log('`shinkansen` is awake')
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
            // https://json-schema.org/draft/2019-09/json-schema-validation.html#rfc.section.6
         
     | 
| 
      
 21 
     | 
    
         
            +
            export function transformObjectSchemaNull (values, schema, { uri: parentUri, key: fieldKey }, uri = getUri(parentUri, fieldKey)) {
         
     | 
| 
      
 22 
     | 
    
         
            +
              /*
         
     | 
| 
      
 23 
     | 
    
         
            +
               *  log('transformObjectSchemaNull')
         
     | 
| 
      
 24 
     | 
    
         
            +
               */
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
              return transformNull(values, schema, parentUri, uri)
         
     | 
| 
      
 27 
     | 
    
         
            +
            }
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
            // https://json-schema.org/draft/2019-09/json-schema-validation.html#rfc.section.6
         
     | 
| 
      
 30 
     | 
    
         
            +
            export function transformObjectSchemaBoolean (values, schema, { uri: parentUri, key: fieldKey }, uri = getUri(parentUri, fieldKey)) {
         
     | 
| 
      
 31 
     | 
    
         
            +
              /*
         
     | 
| 
      
 32 
     | 
    
         
            +
               *  log('transformObjectSchemaBoolean')
         
     | 
| 
      
 33 
     | 
    
         
            +
               */
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
              return transformBoolean(values, schema, parentUri, uri)
         
     | 
| 
      
 36 
     | 
    
         
            +
            }
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
            // https://json-schema.org/draft/2019-09/json-schema-validation.html#rfc.section.6.5
         
     | 
| 
      
 39 
     | 
    
         
            +
            export function transformObjectSchemaObject (values, schema, { uri: parentUri, key: fieldKey }, uri = getUri(parentUri, fieldKey)) {
         
     | 
| 
      
 40 
     | 
    
         
            +
              /*
         
     | 
| 
      
 41 
     | 
    
         
            +
               *  log('transformObjectSchemaObject')
         
     | 
| 
      
 42 
     | 
    
         
            +
               */
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
              return transformObject(values, schema, uri, uri) // uri is parentUri and uri
         
     | 
| 
      
 45 
     | 
    
         
            +
            }
         
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
      
 47 
     | 
    
         
            +
            // https://json-schema.org/draft/2019-09/json-schema-validation.html#rfc.section.6.4
         
     | 
| 
      
 48 
     | 
    
         
            +
            export function transformObjectSchemaArray (values, schema, { uri: parentUri, key: fieldKey }, uri = getUri(parentUri, fieldKey)) {
         
     | 
| 
      
 49 
     | 
    
         
            +
              /*
         
     | 
| 
      
 50 
     | 
    
         
            +
               *  log('transformObjectSchemaArray')
         
     | 
| 
      
 51 
     | 
    
         
            +
               */
         
     | 
| 
      
 52 
     | 
    
         
            +
             
     | 
| 
      
 53 
     | 
    
         
            +
              return transformArray(values, schema, uri, uri) // uri is parentUri and uri
         
     | 
| 
      
 54 
     | 
    
         
            +
            }
         
     | 
| 
      
 55 
     | 
    
         
            +
             
     | 
| 
      
 56 
     | 
    
         
            +
            // https://json-schema.org/draft/2019-09/json-schema-validation.html#rfc.section.6.2
         
     | 
| 
      
 57 
     | 
    
         
            +
            export function transformObjectSchemaNumber (values, schema, { uri: parentUri, key: fieldKey }, uri = getUri(parentUri, fieldKey)) {
         
     | 
| 
      
 58 
     | 
    
         
            +
              /*
         
     | 
| 
      
 59 
     | 
    
         
            +
               *  log('transformObjectSchemaNumber')
         
     | 
| 
      
 60 
     | 
    
         
            +
               */
         
     | 
| 
      
 61 
     | 
    
         
            +
             
     | 
| 
      
 62 
     | 
    
         
            +
              return transformNumber(values, schema, parentUri, uri)
         
     | 
| 
      
 63 
     | 
    
         
            +
            }
         
     | 
| 
      
 64 
     | 
    
         
            +
             
     | 
| 
      
 65 
     | 
    
         
            +
            // https://json-schema.org/draft/2019-09/json-schema-validation.html#rfc.section.6.3
         
     | 
| 
      
 66 
     | 
    
         
            +
            export function transformObjectSchemaString (values, schema, { uri: parentUri, key: fieldKey }, uri = getUri(parentUri, fieldKey)) {
         
     | 
| 
      
 67 
     | 
    
         
            +
              /*
         
     | 
| 
      
 68 
     | 
    
         
            +
               *  log('transformObjectSchemaString')
         
     | 
| 
      
 69 
     | 
    
         
            +
               */
         
     | 
| 
      
 70 
     | 
    
         
            +
             
     | 
| 
      
 71 
     | 
    
         
            +
              return transformString(values, schema, parentUri, uri)
         
     | 
| 
      
 72 
     | 
    
         
            +
            }
         
     | 
| 
      
 73 
     | 
    
         
            +
             
     | 
| 
      
 74 
     | 
    
         
            +
            export default function transformObjectSchema (values = {}, schema = {}, params = {}) {
         
     | 
| 
      
 75 
     | 
    
         
            +
              log('transformObjectSchema')
         
     | 
| 
      
 76 
     | 
    
         
            +
             
     | 
| 
      
 77 
     | 
    
         
            +
              const { type } = schema
         
     | 
| 
      
 78 
     | 
    
         
            +
             
     | 
| 
      
 79 
     | 
    
         
            +
              // https://json-schema.org/draft/2019-09/json-schema-core.html#rfc.section.4.2.1
         
     | 
| 
      
 80 
     | 
    
         
            +
              switch (type) {
         
     | 
| 
      
 81 
     | 
    
         
            +
                case 'null':
         
     | 
| 
      
 82 
     | 
    
         
            +
                  return transformObjectSchemaNull(values, schema, params)
         
     | 
| 
      
 83 
     | 
    
         
            +
             
     | 
| 
      
 84 
     | 
    
         
            +
                case 'boolean':
         
     | 
| 
      
 85 
     | 
    
         
            +
                  return transformObjectSchemaBoolean(values, schema, params)
         
     | 
| 
      
 86 
     | 
    
         
            +
             
     | 
| 
      
 87 
     | 
    
         
            +
                case 'object':
         
     | 
| 
      
 88 
     | 
    
         
            +
                  return transformObjectSchemaObject(values, schema, params)
         
     | 
| 
      
 89 
     | 
    
         
            +
             
     | 
| 
      
 90 
     | 
    
         
            +
                case 'array':
         
     | 
| 
      
 91 
     | 
    
         
            +
                  return transformObjectSchemaArray(values, schema, params)
         
     | 
| 
      
 92 
     | 
    
         
            +
             
     | 
| 
      
 93 
     | 
    
         
            +
                case 'number':
         
     | 
| 
      
 94 
     | 
    
         
            +
                  return transformObjectSchemaNumber(values, schema, params)
         
     | 
| 
      
 95 
     | 
    
         
            +
             
     | 
| 
      
 96 
     | 
    
         
            +
                case 'string':
         
     | 
| 
      
 97 
     | 
    
         
            +
                  return transformObjectSchemaString(values, schema, params)
         
     | 
| 
      
 98 
     | 
    
         
            +
             
     | 
| 
      
 99 
     | 
    
         
            +
                default:
         
     | 
| 
      
 100 
     | 
    
         
            +
                  throw new Error('Schema does not conform to Instance Data Model, https://json-schema.org/draft/2019-09/json-schema-core.html#rfc.section.4.2.1')
         
     | 
| 
      
 101 
     | 
    
         
            +
              }
         
     | 
| 
      
 102 
     | 
    
         
            +
            }
         
     |