shinkansen-transmission 2.4.9 → 2.5.1

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shinkansen-transmission",
3
- "version": "2.4.9",
3
+ "version": "2.5.1",
4
4
  "description": "Shinkansen Transmission",
5
5
  "keywords": [
6
6
  "Shinkansen",
@@ -41,11 +41,10 @@
41
41
  },
42
42
  "devDependencies": {
43
43
  "@babel/core": "^7.26.9",
44
- "@babel/eslint-parser": "^7.26.8",
45
44
  "@babel/preset-env": "^7.26.9",
46
45
  "@babel/register": "^7.25.9",
47
- "@sequencemedia/eslint-config-standard": "^0.2.41",
48
- "@sequencemedia/eslint-config-typescript": "^0.1.57",
46
+ "@sequencemedia/eslint-config-standard": "^0.2.42",
47
+ "@sequencemedia/eslint-config-typescript": "^0.1.58",
49
48
  "@types/babel__register": "^7.17.3",
50
49
  "@types/chai": "^5.2.0",
51
50
  "@types/debug": "^4.1.12",
@@ -54,13 +53,16 @@
54
53
  "chai": "^5.2.0",
55
54
  "core-js": "^3.41.0",
56
55
  "cross-env": "^7.0.3",
57
- "eslint": "^9.21.0",
56
+ "eslint": "^9.22.0",
58
57
  "globals": "^16.0.0",
59
58
  "husky": "^9.1.7",
60
59
  "mocha": "^11.1.0"
61
60
  },
62
61
  "imports": {
63
- "#transmission": "./src/index.mjs",
62
+ "#transmission": {
63
+ "require": "./src/index.cjs",
64
+ "import": "./src/index.mjs"
65
+ },
64
66
  "#transmission/transmission": "./src/transmission/index.mjs",
65
67
  "#transmission/transmission/*": "./src/transmission/*/index.mjs",
66
68
  "#transmission/transmission/to-zashiki/transform-root-schema": "./src/transmission/to-zashiki/transform-root-schema.mjs",
package/src/index.cjs CHANGED
@@ -1,5 +1,3 @@
1
- // @ts-nocheck
2
-
3
1
  require('@babel/register')({
4
2
  ignore: [
5
3
  /node_modules\/(?!shinkansen|@modernpoacher)/
@@ -12,9 +10,10 @@ const log = debug('shinkansen-transmission')
12
10
 
13
11
  log('`shinkansen` is awake')
14
12
 
15
- const common = require('./transmission/common/index.mjs')
16
- const { default: fromDocumentToHash } = require('./transmission/from-document-to-hash/index.mjs')
17
- const { default: fromHashToDocument } = require('./transmission/from-hash-to-document/index.mjs')
13
+ // @ts-expect-error MJS
14
+ const common = require('./transmission/common/index.mjs') // @ts-expect-error MJS
15
+ const { default: fromDocumentToHash } = require('./transmission/from-document-to-hash/index.mjs') // @ts-expect-error MJS
16
+ const { default: fromHashToDocument } = require('./transmission/from-hash-to-document/index.mjs') // @ts-expect-error MJS
18
17
  const { default: toZashiki } = require('./transmission/to-zashiki/index.mjs')
19
18
 
20
19
  module.exports.common = common
@@ -0,0 +1,11 @@
1
+ export type SchemaType = TransmissionTypes.SchemaType
2
+ export type DocumentType = TransmissionTypes.DocumentType
3
+ export type HashType = TransmissionTypes.HashType
4
+
5
+ export type ZashikiType = TransmissionTypes.Zashiki.ZashikiType
6
+
7
+ // @ts-expect-error MJS
8
+ export * as common from '#transmission/transmission/common' // @ts-expect-error MJS
9
+ export { default as fromDocumentToHash } from '#transmission/transmission/from-document-to-hash' // @ts-expect-error MJS
10
+ export { default as fromHashToDocument } from '#transmission/transmission/from-hash-to-document'// @ts-expect-error MJS
11
+ export { default as toZashiki } from '#transmission/transmission/to-zashiki'
@@ -74,27 +74,6 @@ export function toString (value?: MemberType): string
74
74
  export function getSchemaFromItems (schema?: { items?: SchemaType | SchemaType[] }, parentUri?: string, uri?: string): SchemaType | undefined
75
75
  export function getSchemaFromProperties (schema?: { properties?: Record<string, SchemaType> }, parentUri?: string, uri?: string): SchemaType | undefined
76
76
 
77
- declare function getSchema (
78
- schema: (
79
- StringSchemaType |
80
- NumberSchemaType |
81
- ArraySchemaType |
82
- ObjectSchemaType |
83
- BooleanSchemaType |
84
- NullSchemaType
85
- ),
86
- parentUri?: string,
87
- uri?: string
88
- ): SchemaType | undefined
89
-
90
- declare function getSchema (
91
- schema?: ObjectLiteralType | ObjectType,
92
- parentUri?: string,
93
- uri?: string
94
- ): SchemaType | undefined
95
-
96
- export { getSchema }
97
-
98
77
  export function transformIndexToValueByFindValue (array: MemberArrayType, value?: MemberType): string
99
78
  export function transformIndexToValueByFindEqual (array: MemberArrayType, value?: MemberType): string
100
79
 
@@ -455,46 +455,6 @@ export function getSchemaFromProperties ({ properties /* object */ }, parentUri,
455
455
  return undefined
456
456
  }
457
457
 
458
- /**
459
- * @deprecated
460
- *
461
- * @overload
462
- * @param {(
463
- * StringSchemaType |
464
- * NumberSchemaType |
465
- * ArraySchemaType |
466
- * ObjectSchemaType |
467
- * BooleanSchemaType |
468
- * NullSchemaType
469
- * )} schema
470
- * @param {string} [parentUri]
471
- * @param {string} [uri]
472
- * @returns {SchemaType | undefined}
473
- *
474
- *
475
- * @param {*} schema
476
- * @param {string} parentUri
477
- * @param {string} uri
478
- * @returns {* | undefined}
479
- */
480
- export function getSchema (schema, parentUri, uri) {
481
- /*
482
- * log('getSchema')
483
- */
484
-
485
- const {
486
- type
487
- } = schema
488
-
489
- switch (type) {
490
- case 'array':
491
- return getSchemaFromItems(schema, parentUri, uri)
492
-
493
- case 'object':
494
- return getSchemaFromProperties(schema, parentUri, uri)
495
- }
496
- }
497
-
498
458
  /**
499
459
  * @param {MemberArrayType} array
500
460
  * @param {MemberType} [value]
@@ -551,7 +511,7 @@ export function transformIndexToValueByFindEqual (array, value) {
551
511
  /**
552
512
  * @param {MemberArrayType} array
553
513
  * @param {MemberType} [value]
554
- * @returns {string}
514
+ * @returns {MemberType}
555
515
  */
556
516
  export function findIndexByEqual (array, value) {
557
517
  /*
@@ -10,9 +10,9 @@ export function transformObjectFor (document: Record<string, DocumentType>, sche
10
10
  export function transformObject (document: Record<string, DocumentType>, schema: SchemaType, hash: HashType, parentUri: string, uri: string): HashType
11
11
  export function transformObjectSchema (document?: DocumentType, schema?: SchemaType, hash?: HashType, parentUri?: string, uri?: string): HashType
12
12
 
13
- export { default as transformStringSchema } from './string/index.mjs'
14
- export { default as transformNumberSchema } from './number/index.mjs'
15
- export { default as transformBooleanSchema } from './boolean/index.mjs'
16
- export { default as transformNullSchema } from './null/index.mjs'
13
+ export { default as transformStringSchema } from '#transmission/transmission/from-document-to-hash/string'
14
+ export { default as transformNumberSchema } from '#transmission/transmission/from-document-to-hash/number'
15
+ export { default as transformBooleanSchema } from '#transmission/transmission/from-document-to-hash/boolean'
16
+ export { default as transformNullSchema } from '#transmission/transmission/from-document-to-hash/null'
17
17
 
18
18
  export default function fromDocumentToHash (document?: DocumentType, schema?: SchemaType, hash?: HashType, parentUri?: string, uri?: string): HashType
@@ -30,12 +30,12 @@ const log = debug('shinkansen-transmission/from-hash-to-document/boolean')
30
30
  log('`shinkansen` is awake')
31
31
 
32
32
  /**
33
- * @overload
34
- * @param {unknown} error
35
- * @returns {void}
33
+ * @overload
34
+ * @param {unknown} error
35
+ * @returns {void}
36
36
  *
37
- * @param {{ message?: string }} error
38
- * @returns {void}
37
+ * @param {{ message?: string }} error
38
+ * @returns {void}
39
39
  */
40
40
  function handleError ({ message = 'No error message defined' }) { log(message) }
41
41
 
@@ -19,21 +19,21 @@ export function transformObjectSchema (hash?: HashType, schema?: SchemaType, par
19
19
  export {
20
20
  transformString,
21
21
  default as transformStringSchema
22
- } from './string/index.mjs'
22
+ } from '#transmission/transmission/from-hash-to-document/string'
23
23
 
24
24
  export {
25
25
  transformNumber,
26
26
  default as transformNumberSchema
27
- } from './number/index.mjs'
27
+ } from '#transmission/transmission/from-hash-to-document/number'
28
28
 
29
29
  export {
30
30
  transformBoolean,
31
31
  default as transformBooleanSchema
32
- } from './boolean/index.mjs'
32
+ } from '#transmission/transmission/from-hash-to-document/boolean'
33
33
 
34
34
  export {
35
35
  transformNull,
36
36
  default as transformNullSchema
37
- } from './null/index.mjs'
37
+ } from '#transmission/transmission/from-hash-to-document/null'
38
38
 
39
39
  export default function fromHashToDocument (hash?: HashType, rootSchema?: SchemaType, parentUri?: string, uri?: string): DocumentType | undefined
@@ -8,6 +8,7 @@
8
8
  *
9
9
  * @typedef {TransmissionTypes.DocumentType} DocumentType
10
10
  * @typedef {TransmissionTypes.SchemaType} SchemaType
11
+ * @typedef {TransmissionTypes.ParamsType} ParamsType
11
12
  * @typedef {TransmissionTypes.HashType} HashType
12
13
  */
13
14
 
@@ -246,7 +247,7 @@ export function transformArray (hash, schema, parentUri, uri) {
246
247
  * @param {HashType} [hash]
247
248
  * @param {SchemaType} [schema]
248
249
  * @param {ParamsType} [params]
249
- * @returns {DocumentType}
250
+ * @returns {DocumentType | undefined}
250
251
  */
251
252
  export function transformArraySchema (hash = {}, schema = {}, params = {}) {
252
253
  log('transformArraySchema')
@@ -361,7 +362,7 @@ export function transformObject (hash, schema, parentUri, uri) {
361
362
  * @param {HashType} [hash]
362
363
  * @param {SchemaType} [schema]
363
364
  * @param {ParamsType} [params]
364
- * @returns {DocumentType}
365
+ * @returns {DocumentType | undefined}
365
366
  */
366
367
  export function transformObjectSchema (hash = {}, schema = {}, params = {}) {
367
368
  log('transformObjectSchema')
@@ -30,12 +30,12 @@ const log = debug('shinkansen-transmission/from-hash-to-document/null')
30
30
  log('`shinkansen` is awake')
31
31
 
32
32
  /**
33
- * @overload
34
- * @param {unknown} error
35
- * @returns {void}
33
+ * @overload
34
+ * @param {unknown} error
35
+ * @returns {void}
36
36
  *
37
- * @param {{ message?: string }} error
38
- * @returns {void}
37
+ * @param {{ message?: string }} error
38
+ * @returns {void}
39
39
  */
40
40
  function handleError ({ message = 'No error message defined' }) { log(message) }
41
41
 
@@ -30,12 +30,12 @@ const log = debug('shinkansen-transmission/from-hash-to-document/number')
30
30
  log('`shinkansen` is awake')
31
31
 
32
32
  /**
33
- * @overload
34
- * @param {unknown} error
35
- * @returns {void}
33
+ * @overload
34
+ * @param {unknown} error
35
+ * @returns {void}
36
36
  *
37
- * @param {{ message?: string }} error
38
- * @returns {void}
37
+ * @param {{ message?: string }} error
38
+ * @returns {void}
39
39
  */
40
40
  function handleError ({ message = 'No error message defined' }) { log(message) }
41
41
 
@@ -35,12 +35,12 @@ const log = debug('shinkansen-transmission/from-hash-to-document/string')
35
35
  log('`shinkansen` is awake')
36
36
 
37
37
  /**
38
- * @overload
39
- * @param {unknown} error
40
- * @returns {void}
38
+ * @overload
39
+ * @param {unknown} error
40
+ * @returns {void}
41
41
  *
42
- * @param {{ message?: string }} error
43
- * @returns {void}
42
+ * @param {{ message?: string }} error
43
+ * @returns {void}
44
44
  */
45
45
  function handleError ({ message = 'No error message defined' }) { log(message) }
46
46