shinkansen-transmission 2.2.234 → 2.3.0

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 (38) hide show
  1. package/babel.config.cjs +1 -0
  2. package/eslint.config.mjs +28 -30
  3. package/index.d.mts +321 -16
  4. package/package.json +8 -8
  5. package/src/index.cjs +2 -0
  6. package/src/index.d.mts +10 -9
  7. package/src/transmission/common/index.d.mts +152 -87
  8. package/src/transmission/common/index.mjs +627 -193
  9. package/src/transmission/from-document-to-hash/array/index.mjs +20 -4
  10. package/src/transmission/from-document-to-hash/boolean/index.mjs +25 -9
  11. package/src/transmission/from-document-to-hash/index.d.mts +8 -19
  12. package/src/transmission/from-document-to-hash/index.mjs +102 -16
  13. package/src/transmission/from-document-to-hash/null/index.mjs +25 -9
  14. package/src/transmission/from-document-to-hash/number/index.mjs +25 -9
  15. package/src/transmission/from-document-to-hash/object/index.mjs +22 -6
  16. package/src/transmission/from-document-to-hash/string/index.mjs +25 -9
  17. package/src/transmission/from-hash-to-document/array/index.mjs +22 -5
  18. package/src/transmission/from-hash-to-document/boolean/index.mjs +21 -4
  19. package/src/transmission/from-hash-to-document/index.d.mts +24 -26
  20. package/src/transmission/from-hash-to-document/index.mjs +264 -142
  21. package/src/transmission/from-hash-to-document/null/index.mjs +21 -4
  22. package/src/transmission/from-hash-to-document/number/index.mjs +21 -4
  23. package/src/transmission/from-hash-to-document/object/index.mjs +22 -5
  24. package/src/transmission/from-hash-to-document/string/index.mjs +26 -4
  25. package/src/transmission/index.d.mts +4 -10
  26. package/src/transmission/to-zashiki/index.d.mts +5 -13
  27. package/src/transmission/to-zashiki/params/index.mjs +430 -0
  28. package/src/transmission/to-zashiki/render/array/index.mjs +737 -0
  29. package/src/transmission/to-zashiki/render/boolean/index.mjs +794 -0
  30. package/src/transmission/to-zashiki/render/index.mjs +157 -0
  31. package/src/transmission/to-zashiki/render/null/index.mjs +796 -0
  32. package/src/transmission/to-zashiki/render/number/index.mjs +940 -0
  33. package/src/transmission/to-zashiki/render/object/index.mjs +653 -0
  34. package/src/transmission/to-zashiki/render/string/index.mjs +910 -0
  35. package/src/transmission/to-zashiki/render-params/root-schema/index.mjs +212 -0
  36. package/src/transmission/to-zashiki/render-params/schema/index.mjs +731 -0
  37. package/src/transmission/to-zashiki/transform-root-schema.mjs +485 -421
  38. package/src/transmission/to-zashiki/transform-schema.mjs +1988 -4663
@@ -1,123 +1,188 @@
1
- declare module '#transmission/transmission/common' {
2
- type ObjectLiteralType = ZashikiTypes.ObjectLiteralType
3
- type ObjectType = ZashikiTypes.ObjectType
4
- type ArrayLiteralType = ZashikiTypes.ArrayLiteralType
5
- type ArrayType = ZashikiTypes.ArrayType
1
+ type ObjectLiteralType = TransmissionTypes.ObjectLiteralType
2
+ type ObjectType = TransmissionTypes.ObjectType
3
+
4
+ type ItemsType = TransmissionTypes.ItemsType
5
+
6
+ type TransmissionStringMetaType = TransmissionTypes.Transmission.StringMetaType
7
+ type TransmissionNumberMetaType = TransmissionTypes.Transmission.NumberMetaType
8
+ type TransmissionArrayMetaType = TransmissionTypes.Transmission.ArrayMetaType
9
+ type TransmissionObjectMetaType = TransmissionTypes.Transmission.ObjectMetaType
10
+ type TransmissionBooleanMetaType = TransmissionTypes.Transmission.BooleanMetaType
11
+ type TransmissionNullMetaType = TransmissionTypes.Transmission.NullMetaType
12
+
13
+ type TransmissionStringElementsType = TransmissionTypes.Transmission.StringElementsType
14
+ type TransmissionNumberElementsType = TransmissionTypes.Transmission.NumberElementsType
15
+ type TransmissionArrayElementsType = TransmissionTypes.Transmission.ArrayElementsType
16
+ type TransmissionObjectElementsType = TransmissionTypes.Transmission.ObjectElementsType
17
+ type TransmissionBooleanElementsType = TransmissionTypes.Transmission.BooleanElementsType
18
+ type TransmissionNullElementsType = TransmissionTypes.Transmission.NullElementsType
19
+
20
+ type EnumType = TransmissionTypes.EnumType
21
+ type OneOfType = TransmissionTypes.OneOfType
22
+ type AnyOfType = TransmissionTypes.AnyOfType
23
+ type FieldType = TransmissionTypes.FieldType
24
+
25
+ type SchemaType = TransmissionTypes.SchemaType
6
26
 
7
- type SchemaType = ZashikiTypes.SchemaType
27
+ type StringSchemaType = TransmissionTypes.StringSchemaType
28
+ type NumberSchemaType = TransmissionTypes.NumberSchemaType
29
+ type ArraySchemaType = TransmissionTypes.ArraySchemaType
30
+ type ObjectSchemaType = TransmissionTypes.ObjectSchemaType
31
+ type BooleanSchemaType = TransmissionTypes.BooleanSchemaType
32
+ type NullSchemaType = TransmissionTypes.NullSchemaType
8
33
 
9
- export function isObject (v: unknown): boolean
10
- export function isArray (v: unknown): boolean
11
- export function isPrimitive (v: unknown): boolean
12
- export function isSchema (v: SchemaType | undefined): boolean
13
- export function isStringSchema (schema: SchemaType | undefined): boolean
14
- export function isNumberSchema (schema: SchemaType | undefined): boolean
15
- export function isArraySchema (schema: SchemaType | undefined): boolean
16
- export function isObjectSchema (schema: SchemaType | undefined): boolean
17
- export function isBooleanSchema (schema: SchemaType | undefined): boolean
18
- export function isNullSchema (schema: SchemaType | undefined): boolean
34
+ type ValuesType = TransmissionTypes.ValuesType
35
+ type ParamsType = TransmissionTypes.ParamsType
19
36
 
20
- export function getTitle (schema: SchemaType | undefined): { title: string } | ObjectLiteralType
21
- export function getDescription (schema: SchemaType | undefined): { description: string } | ObjectLiteralType
22
- export function getIsReadOnly (schema: SchemaType | undefined): { readOnly: boolean } | ObjectLiteralType
23
- export function getIsWriteOnly (schema: SchemaType | undefined): { writeOnly: boolean } | ObjectLiteralType
37
+ export function isObject (v?: unknown): v is (Record<PropertyKey, string | number | object | boolean | null | string[] | number[] | object[] | boolean[] | null[]> | Record<PropertyKey, never>)
38
+ export function isArray (v?: unknown): v is (string[] | number[] | object[] | boolean[] | null[])
39
+ export function isPrimitive (v?: unknown): v is string | number | boolean | null
24
40
 
25
- export function getSelectedItems (values: ObjectType | ObjectLiteralType, uri: string | undefined): ArrayType
41
+ export function isSchema (v?: SchemaType | object): v is SchemaType
42
+ export function isStringSchema (schema?: SchemaType): schema is StringSchemaType
43
+ export function isNumberSchema (schema?: SchemaType): schema is NumberSchemaType
44
+ export function isArraySchema (schema?: SchemaType): schema is ArraySchemaType
45
+ export function isObjectSchema (schema?: SchemaType): schema is ObjectSchemaType
46
+ export function isBooleanSchema (schema?: SchemaType): schema is BooleanSchemaType
47
+ export function isNullSchema (schema?: SchemaType): schema is NullSchemaType
26
48
 
27
- export function isParentUri (parentUri: string | undefined, uri: string | undefined): boolean
49
+ export function getTitle (schema?: SchemaType): { title: string } | ObjectLiteralType
50
+ export function getDescription (schema?: SchemaType): { description: string } | ObjectLiteralType
51
+ export function getIsReadOnly (schema?: SchemaType): { readOnly: boolean } | ObjectLiteralType
52
+ export function getIsWriteOnly (schema?: SchemaType): { writeOnly: boolean } | ObjectLiteralType
28
53
 
29
- export function getMetaProps (params: ObjectType | ObjectLiteralType, uri: string | undefined): ObjectType
30
- export function getMetaDefaultValue (schema: SchemaType | undefined): { defaultValue: string } | ObjectLiteralType
31
- export function hasMetaValue (values: ObjectType | ObjectLiteralType, uri: string | undefined, schema: SchemaType | undefined): boolean
32
- export function getMetaValue (values: ObjectType | ObjectLiteralType, uri: string | undefined, schema: SchemaType | undefined): { value: string } | ObjectLiteralType
54
+ export function getSelectedItems (values?: ValuesType, uri?: string): Array<string | number | boolean | null>
33
55
 
34
- export function transformValue (schema: SchemaType | undefined): SchemaType | ObjectType | ObjectLiteralType | ArrayType | ArrayLiteralType | undefined
56
+ export function isParentUri (parentUri?: string, uri?: string): boolean
35
57
 
36
- export function findByKey (parentUri: string | undefined, uri: string | undefined): (key: string) => boolean
37
- export function findByIndex (parentUri: string | undefined, uri: string | undefined): (schema: SchemaType, index: number) => boolean
38
- export function findByValue (value: unknown): (schema: SchemaType) => boolean
39
- export function findByEqual (value: unknown): (schema: SchemaType) => boolean
58
+ export function getMetaProps (params?: ParamsType, uri?: string): TransmissionStringMetaType | TransmissionNumberMetaType | TransmissionArrayMetaType | TransmissionObjectMetaType | TransmissionBooleanMetaType | TransmissionNullMetaType | Record<string, never>
59
+ export function hasMetaDefaultValue (schema?: SchemaType): boolean
60
+ export function getMetaDefaultValue (schema?: SchemaType): { defaultValue: string } | ObjectLiteralType
61
+ export function hasMetaValue (values?: ValuesType, uri?: string, schema?: SchemaType): boolean
62
+ export function getMetaValue (values?: ValuesType, uri?: string, schema?: SchemaType): { value: string } | ObjectLiteralType
40
63
 
41
- export function toString (value: unknown): string
64
+ export function transformToValue (schema?: string | number | object | boolean | null): string | number | object | boolean | null | undefined
42
65
 
43
- export function getObject (value: { properties: ObjectType /* object */ }, parentUri: string | undefined, uri: string | undefined): ObjectType
44
- export function getArray (value: { items: ObjectType | ObjectLiteralType | ArrayType | ArrayLiteralType /* object or array */ }, parentUri: string | undefined, uri: string | undefined): ArrayType
45
- export function getSchema (schema: SchemaType | ObjectType, parentUri: string | undefined, uri: string | undefined): ObjectType | ObjectLiteralType | ArrayType | ArrayLiteralType | SchemaType
66
+ export function findByUri (parentUri: string, uri: string): (key: string | number) => boolean
67
+ export function findByValue (value?: string | number | object | boolean | null): (item?: string | number | object | boolean | null | string[] | number[] | object[] | boolean[] | null[]) => boolean
68
+ export function findByEqual (value?: string | number | object | boolean | null): (item?: string | number | object | boolean | null | string[] | number[] | object[] | boolean[] | null[]) => boolean
46
69
 
47
- export function transformValueIndexFor (array: ArrayType, value: unknown): string
48
- export function transformEqualIndexFor (array: ArrayType, value: unknown): string
70
+ export function toString (value?: string | number | object | boolean | null): string
49
71
 
50
- export function hasValue (values: ObjectType | ObjectLiteralType, uri: string | undefined, schema: SchemaType | undefined): boolean
51
- export function getValue (values: ObjectType | ObjectLiteralType, uri: string | undefined, schema: SchemaType | undefined): string
72
+ export function getArray (schema?: { items?: SchemaType | SchemaType[] }, parentUri?: string, uri?: string): SchemaType | undefined
73
+ export function getObject (schema?: { properties?: Record<string, SchemaType> }, parentUri?: string, uri?: string): SchemaType | undefined
52
74
 
53
- export function getValueForEnum (v: string | number, schema: SchemaType): string
54
- export function getIndexForEnum (values: ObjectType | ObjectLiteralType, parentUri: string | undefined, uri: string | undefined, schema: SchemaType | undefined): number
75
+ declare function getSchema (
76
+ schema: (
77
+ StringSchemaType |
78
+ NumberSchemaType |
79
+ ArraySchemaType |
80
+ ObjectSchemaType |
81
+ BooleanSchemaType |
82
+ NullSchemaType
83
+ ),
84
+ parentUri?: string,
85
+ uri?: string
86
+ ): SchemaType | undefined
55
87
 
56
- export function getValueForAnyOf (v: string | number, schema: SchemaType): string
57
- export function getIndexForAnyOf (values: ObjectType | ObjectLiteralType, parentUri: string | undefined, uri: string | undefined, schema: SchemaType | undefined): number
88
+ declare function getSchema (
89
+ schema?: ObjectLiteralType | ObjectType,
90
+ parentUri?: string,
91
+ uri?: string
92
+ ): SchemaType | undefined
58
93
 
59
- export function getValueForOneOf (v: string | number, schema: SchemaType): string
60
- export function getIndexForOneOf (values: ObjectType | ObjectLiteralType, parentUri: string | undefined, uri: string | undefined, schema: SchemaType | undefined): number
94
+ export { getSchema }
61
95
 
62
- export function getElementsProps (params: ObjectType | ObjectLiteralType, uri: string | undefined): ObjectType | ObjectLiteralType
63
- export function getElementsTitleProps (params: ObjectType | ObjectLiteralType, uri: string | undefined): ObjectType | ObjectLiteralType
64
- export function getElementsDescriptionProps (params: ObjectType | ObjectLiteralType, uri: string | undefined): ObjectType | ObjectLiteralType
96
+ export function transformValueIndexFor (array: string[] | number[] | object[] | boolean[] | null[], value?: string | number | object | boolean | null): string
97
+ export function transformEqualIndexFor (array: string[] | number[] | object[] | boolean[] | null[], value?: string | number | object | boolean | null): string
65
98
 
66
- export function getElementsFieldPropsForEnum (params: ObjectType | ObjectLiteralType, uri: string | undefined): ObjectType | ObjectLiteralType
67
- export function getElementsFieldPropsForOneOf (params: ObjectType | ObjectLiteralType, uri: string | undefined): ObjectType | ObjectLiteralType
68
- export function getElementsFieldPropsForAnyOf (params: ObjectType | ObjectLiteralType, uri: string | undefined): ObjectType | ObjectLiteralType
69
- export function getElementsFieldPropsForAllOf (params: ObjectType | ObjectLiteralType, uri: string | undefined): ObjectType | ObjectLiteralType
99
+ export function hasValue (values?: ValuesType, uri?: string, schema?: SchemaType): boolean
100
+ export function getValue (values?: ValuesType, uri?: string, schema?: SchemaType): string
70
101
 
71
- export function getElementsFieldProps (params: ObjectType | ObjectLiteralType, uri: string | undefined): ObjectType | ObjectLiteralType
72
- export function getElementsFieldValue (values: ObjectType | ObjectLiteralType, uri: string | undefined, schema: SchemaType | undefined): { value: string } | ObjectLiteralType
102
+ export function getValueForEnum (v: string | number, schema?: { enum?: ItemsType }): string
103
+ export function getIndexForEnum (values?: ValuesType, parentUri?: string, uri?: string, schema?: SchemaType): number
73
104
 
74
- export function hasEnum (schema: SchemaType | undefined): boolean
75
- export function getEnum (schema: SchemaType | undefined): ObjectType | ObjectLiteralType | ArrayType | ArrayLiteralType
105
+ export function getValueForAnyOf (v: string | number, schema?: { anyOf?: ItemsType }): string
106
+ export function getIndexForAnyOf (values?: ValuesType, parentUri?: string, uri?: string, schema?: SchemaType): number
76
107
 
77
- export function hasConst (schema: SchemaType | undefined): boolean
78
- export function getConst (schema: SchemaType | undefined): unknown
108
+ export function getValueForOneOf (v: string | number, schema?: { oneOf?: ItemsType }): string
109
+ export function getIndexForOneOf (values: ValuesType, parentUri?: string, uri?: string, schema?: SchemaType): number
79
110
 
80
- export function hasDefault (schema: SchemaType | undefined): boolean
81
- export function getDefault (schema: SchemaType | undefined): unknown
111
+ export function getElementsProps (params?: ParamsType, uri?: string): TransmissionStringElementsType | TransmissionNumberElementsType | TransmissionArrayElementsType | TransmissionObjectElementsType | TransmissionBooleanElementsType | TransmissionNullElementsType | Record<string, never>
82
112
 
83
- export function hasAnyOf (schema: SchemaType | undefined): boolean
84
- export function getAnyOf (schema: SchemaType | undefined): ObjectType | ObjectLiteralType | ArrayType | ArrayLiteralType
113
+ export function getElementsFieldPropsForEnum (params?: ParamsType, uri?: string): EnumType | ObjectLiteralType
114
+ export function getElementsFieldPropsForOneOf (params?: ParamsType, uri?: string): OneOfType | ObjectLiteralType
115
+ export function getElementsFieldPropsForAnyOf (params?: ParamsType, uri?: string): AnyOfType | ObjectLiteralType
116
+ export function getElementsFieldPropsForAllOf (params?: ParamsType, uri?: string): FieldType | ObjectLiteralType
117
+ export function getElementsFieldProps (params?: ParamsType, uri?: string): FieldType | ObjectLiteralType
118
+ export function getElementsFieldValue (values?: ValuesType, uri?: string, schema?: SchemaType): { value: string } | ObjectLiteralType
85
119
 
86
- export function hasOneOf (schema: SchemaType | undefined): boolean
87
- export function getOneOf (schema: SchemaType | undefined): ObjectType | ObjectLiteralType | ArrayType | ArrayLiteralType
120
+ export function hasEnum (schema?: { enum?: ItemsType }): schema is { enum: ItemsType }
88
121
 
89
- export function hasAllOf (schema: SchemaType | undefined): boolean
90
- export function getAllOf (schema: SchemaType | undefined): ObjectType | ObjectLiteralType | ArrayType | ArrayLiteralType
122
+ declare function getEnum (schema: { enum: ItemsType }): ItemsType
123
+ declare function getEnum (schema?: { enum?: ItemsType }): ItemsType | undefined
91
124
 
92
- export function getUri (uri: string | undefined, resource: string | undefined): string
125
+ export { getEnum }
93
126
 
94
- export function normaliseUri (uri: string | undefined): string
127
+ export function hasConst (schema?: { const?: string | number | object | boolean | null }): schema is { const: string | number | object | boolean | null }
95
128
 
96
- export function getMin (schema: SchemaType | undefined): { min: number } | ObjectLiteralType
97
- export function getMax (schema: SchemaType | undefined): { max: number } | ObjectLiteralType
129
+ declare function getConst (schema: { const: string | number | object | boolean | null }): string | number | object | boolean | null
130
+ declare function getConst (schema?: { const?: string | number | object | boolean | null }): string | number | object | boolean | null | undefined
98
131
 
99
- export function getMinLength (schema: SchemaType | undefined): { minLength: number } | ObjectLiteralType
100
- export function getMaxLength (schema: SchemaType | undefined): { maxLength: number } | ObjectLiteralType
132
+ export { getConst }
101
133
 
102
- export function getMinItems (schema: SchemaType | undefined): { minItems: number } | ObjectLiteralType
103
- export function getMaxItems (schema: SchemaType | undefined): { maxItems: number } | ObjectLiteralType
134
+ export function hasDefault (schema?: { default?: string | number | object | boolean | null }): schema is { default: string | number | object | boolean | null }
104
135
 
105
- export function getHasUniqueItems (schema: SchemaType | undefined): { hasUniqueItems: boolean } | ObjectLiteralType
136
+ declare function getDefault (schema: { default: string | number | object | boolean | null }): string | number | object | boolean | null
137
+ declare function getDefault (schema?: { default?: string | number | object | boolean | null }): string | number | object | boolean | null | undefined
106
138
 
107
- export function getMinContains (schema: SchemaType | undefined): { minContains: number } | ObjectLiteralType
108
- export function getMaxContains (schema: SchemaType | undefined): { maxContains: number } | ObjectLiteralType
139
+ export { getDefault }
109
140
 
110
- export function getMinProperties (schema: SchemaType | undefined): { minProperties: number } | ObjectLiteralType
111
- export function getMaxProperties (schema: SchemaType | undefined): { maxProperties: number } | ObjectLiteralType
141
+ export function hasAnyOf (schema?: { anyOf?: ItemsType }): schema is { anyOf: ItemsType }
112
142
 
113
- export function getIsExclusiveMin (schema: SchemaType | undefined): { isExclusiveMin: boolean } | ObjectLiteralType
114
- export function getIsExclusiveMax (schema: SchemaType | undefined): { isExclusiveMax: boolean } | ObjectLiteralType
143
+ declare function getAnyOf (schema: { anyOf: ItemsType }): ItemsType
144
+ declare function getAnyOf (schema?: { anyOf?: ItemsType }): ItemsType | undefined
115
145
 
116
- export function getPattern (schema: SchemaType | undefined): { pattern: string } | ObjectLiteralType
146
+ export { getAnyOf }
117
147
 
118
- export function getStep (schema: SchemaType | undefined): { step: number } | ObjectLiteralType
119
- }
148
+ export function hasOneOf (schema?: { oneOf?: ItemsType }): schema is { oneOf: ItemsType }
120
149
 
121
- declare module 'shinkansen-transmission/transmission/common' {
122
- export * from '#transmission/transmission/common'
123
- }
150
+ declare function getOneOf (schema: { oneOf: ItemsType }): ItemsType
151
+ declare function getOneOf (schema?: { oneOf?: ItemsType }): ItemsType | undefined
152
+
153
+ export { getOneOf }
154
+
155
+ export function hasAllOf (schema?: { allOf?: ItemsType }): schema is { allOf: ItemsType }
156
+
157
+ declare function getAllOf (schema: { allOf: ItemsType }): ItemsType
158
+ declare function getAllOf (schema?: { allOf?: ItemsType }): ItemsType | undefined
159
+
160
+ export { getAllOf }
161
+
162
+ export function getUri (uri?: string, resource?: string | number): string
163
+
164
+ export function normaliseUri (uri?: string): string
165
+
166
+ export function getMin (schema?: { minimum?: number }): { min: number } | ObjectLiteralType
167
+ export function getMax (schema?: { maximum?: number }): { max: number } | ObjectLiteralType
168
+
169
+ export function getMinLength (schema?: { minLength?: number }): { minLength: number } | ObjectLiteralType
170
+ export function getMaxLength (schema?: { maxLength?: number }): { maxLength: number } | ObjectLiteralType
171
+
172
+ export function getMinItems (schema?: { minItems?: number }): { minItems: number } | ObjectLiteralType
173
+ export function getMaxItems (schema?: { maxItems?: number }): { maxItems: number } | ObjectLiteralType
174
+
175
+ export function getHasUniqueItems (schema?: { uniqueItems?: boolean }): { hasUniqueItems: boolean } | ObjectLiteralType
176
+
177
+ export function getMinContains (schema?: { minContains?: number }): { minContains: number } | ObjectLiteralType
178
+ export function getMaxContains (schema?: { maxContains?: number }): { maxContains: number } | ObjectLiteralType
179
+
180
+ export function getMinProperties (schema?: { minProperties?: number }): { minProperties: number } | ObjectLiteralType
181
+ export function getMaxProperties (schema?: { maxProperties?: number }): { maxProperties: number } | ObjectLiteralType
182
+
183
+ export function getIsExclusiveMin (schema?: { exclusiveMinimum?: boolean }): { isExclusiveMin: boolean } | ObjectLiteralType
184
+ export function getIsExclusiveMax (schema?: { exclusiveMaximum?: boolean }): { isExclusiveMax: boolean } | ObjectLiteralType
185
+
186
+ export function getPattern (schema?: { pattern?: RegExp }): { pattern: RegExp } | ObjectLiteralType
187
+
188
+ export function getStep (schema?: { multipleOf?: number }): { step: number } | ObjectLiteralType