shinkansen-transmission 2.2.235 → 2.3.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.
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 +6 -6
  5. package/src/index.cjs +2 -0
  6. package/src/index.d.mts +10 -9
  7. package/src/transmission/common/index.d.mts +153 -87
  8. package/src/transmission/common/index.mjs +670 -175
  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,189 @@
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
26
+
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
6
33
 
7
- type SchemaType = ZashikiTypes.SchemaType
34
+ type ValuesType = TransmissionTypes.ValuesType
35
+ type ParamsType = TransmissionTypes.ParamsType
8
36
 
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
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
19
40
 
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
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
24
48
 
25
- export function getSelectedItems (values: ObjectType | ObjectLiteralType, uri: string | undefined): ArrayType
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
26
53
 
27
- export function isParentUri (parentUri: string | undefined, uri: string | undefined): boolean
54
+ export function getSelectedItems (values?: ValuesType, uri?: string): Array<string | number | boolean | null>
28
55
 
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
56
+ export function isParentUri (parentUri?: string, uri?: string): boolean
33
57
 
34
- export function transformValue (schema: SchemaType | undefined): SchemaType | ObjectType | ObjectLiteralType | ArrayType | ArrayLiteralType | undefined
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
35
63
 
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
64
+ export function transformToValue (schema?: string | number | object | boolean | null): string | number | object | boolean | null | undefined
40
65
 
41
- export function toString (value: unknown): string
66
+ export function findByKey (parentUri: string, uri: string): (key: string | number) => boolean
67
+ export function findByIndex (parentUri: string, uri: string): (item: SchemaType, index: number) => boolean
68
+ export function findByValue (value?: string | number | object | boolean | null): (item?: string | number | object | boolean | null | string[] | number[] | object[] | boolean[] | null[]) => boolean
69
+ export function findByEqual (value?: string | number | object | boolean | null): (item?: string | number | object | boolean | null | string[] | number[] | object[] | boolean[] | null[]) => boolean
42
70
 
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
71
+ export function toString (value?: string | number | object | boolean | null): string
46
72
 
47
- export function transformValueIndexFor (array: ArrayType, value: unknown): string
48
- export function transformEqualIndexFor (array: ArrayType, value: unknown): string
73
+ export function getArray (schema?: { items?: SchemaType | SchemaType[] }, parentUri?: string, uri?: string): SchemaType | undefined
74
+ export function getObject (schema?: { properties?: Record<string, SchemaType> }, parentUri?: string, uri?: string): SchemaType | undefined
49
75
 
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
76
+ declare function getSchema (
77
+ schema: (
78
+ StringSchemaType |
79
+ NumberSchemaType |
80
+ ArraySchemaType |
81
+ ObjectSchemaType |
82
+ BooleanSchemaType |
83
+ NullSchemaType
84
+ ),
85
+ parentUri?: string,
86
+ uri?: string
87
+ ): SchemaType | undefined
52
88
 
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
89
+ declare function getSchema (
90
+ schema?: ObjectLiteralType | ObjectType,
91
+ parentUri?: string,
92
+ uri?: string
93
+ ): SchemaType | undefined
55
94
 
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
95
+ export { getSchema }
58
96
 
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
97
+ export function transformValueIndexFor (array: string[] | number[] | object[] | boolean[] | null[], value?: string | number | object | boolean | null): string
98
+ export function transformEqualIndexFor (array: string[] | number[] | object[] | boolean[] | null[], value?: string | number | object | boolean | null): string
61
99
 
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
100
+ export function hasValue (values?: ValuesType, uri?: string, schema?: SchemaType): boolean
101
+ export function getValue (values?: ValuesType, uri?: string, schema?: SchemaType): string
65
102
 
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
103
+ export function getValueForEnum (v: string | number, schema?: { enum?: ItemsType }): string
104
+ export function getIndexForEnum (values?: ValuesType, parentUri?: string, uri?: string, schema?: SchemaType): number
70
105
 
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
106
+ export function getValueForAnyOf (v: string | number, schema?: { anyOf?: ItemsType }): string
107
+ export function getIndexForAnyOf (values?: ValuesType, parentUri?: string, uri?: string, schema?: SchemaType): number
73
108
 
74
- export function hasEnum (schema: SchemaType | undefined): boolean
75
- export function getEnum (schema: SchemaType | undefined): ObjectType | ObjectLiteralType | ArrayType | ArrayLiteralType
109
+ export function getValueForOneOf (v: string | number, schema?: { oneOf?: ItemsType }): string
110
+ export function getIndexForOneOf (values: ValuesType, parentUri?: string, uri?: string, schema?: SchemaType): number
76
111
 
77
- export function hasConst (schema: SchemaType | undefined): boolean
78
- export function getConst (schema: SchemaType | undefined): unknown
112
+ export function getElementsProps (params?: ParamsType, uri?: string): TransmissionStringElementsType | TransmissionNumberElementsType | TransmissionArrayElementsType | TransmissionObjectElementsType | TransmissionBooleanElementsType | TransmissionNullElementsType | Record<string, never>
79
113
 
80
- export function hasDefault (schema: SchemaType | undefined): boolean
81
- export function getDefault (schema: SchemaType | undefined): unknown
114
+ export function getElementsFieldPropsForEnum (params?: ParamsType, uri?: string): EnumType | ObjectLiteralType
115
+ export function getElementsFieldPropsForOneOf (params?: ParamsType, uri?: string): OneOfType | ObjectLiteralType
116
+ export function getElementsFieldPropsForAnyOf (params?: ParamsType, uri?: string): AnyOfType | ObjectLiteralType
117
+ export function getElementsFieldPropsForAllOf (params?: ParamsType, uri?: string): FieldType | ObjectLiteralType
118
+ export function getElementsFieldProps (params?: ParamsType, uri?: string): FieldType | ObjectLiteralType
119
+ export function getElementsFieldValue (values?: ValuesType, uri?: string, schema?: SchemaType): { value: string } | ObjectLiteralType
82
120
 
83
- export function hasAnyOf (schema: SchemaType | undefined): boolean
84
- export function getAnyOf (schema: SchemaType | undefined): ObjectType | ObjectLiteralType | ArrayType | ArrayLiteralType
121
+ export function hasEnum (schema?: { enum?: ItemsType }): schema is { enum: ItemsType }
85
122
 
86
- export function hasOneOf (schema: SchemaType | undefined): boolean
87
- export function getOneOf (schema: SchemaType | undefined): ObjectType | ObjectLiteralType | ArrayType | ArrayLiteralType
123
+ declare function getEnum (schema: { enum: ItemsType }): ItemsType
124
+ declare function getEnum (schema?: { enum?: ItemsType }): ItemsType | undefined
88
125
 
89
- export function hasAllOf (schema: SchemaType | undefined): boolean
90
- export function getAllOf (schema: SchemaType | undefined): ObjectType | ObjectLiteralType | ArrayType | ArrayLiteralType
126
+ export { getEnum }
91
127
 
92
- export function getUri (uri: string | undefined, resource: string | undefined): string
128
+ export function hasConst (schema?: { const?: string | number | object | boolean | null }): schema is { const: string | number | object | boolean | null }
93
129
 
94
- export function normaliseUri (uri: string | undefined): string
130
+ declare function getConst (schema: { const: string | number | object | boolean | null }): string | number | object | boolean | null
131
+ declare function getConst (schema?: { const?: string | number | object | boolean | null }): string | number | object | boolean | null | undefined
95
132
 
96
- export function getMin (schema: SchemaType | undefined): { min: number } | ObjectLiteralType
97
- export function getMax (schema: SchemaType | undefined): { max: number } | ObjectLiteralType
133
+ export { getConst }
98
134
 
99
- export function getMinLength (schema: SchemaType | undefined): { minLength: number } | ObjectLiteralType
100
- export function getMaxLength (schema: SchemaType | undefined): { maxLength: number } | ObjectLiteralType
135
+ export function hasDefault (schema?: { default?: string | number | object | boolean | null }): schema is { default: string | number | object | boolean | null }
101
136
 
102
- export function getMinItems (schema: SchemaType | undefined): { minItems: number } | ObjectLiteralType
103
- export function getMaxItems (schema: SchemaType | undefined): { maxItems: number } | ObjectLiteralType
137
+ declare function getDefault (schema: { default: string | number | object | boolean | null }): string | number | object | boolean | null
138
+ declare function getDefault (schema?: { default?: string | number | object | boolean | null }): string | number | object | boolean | null | undefined
104
139
 
105
- export function getHasUniqueItems (schema: SchemaType | undefined): { hasUniqueItems: boolean } | ObjectLiteralType
140
+ export { getDefault }
106
141
 
107
- export function getMinContains (schema: SchemaType | undefined): { minContains: number } | ObjectLiteralType
108
- export function getMaxContains (schema: SchemaType | undefined): { maxContains: number } | ObjectLiteralType
142
+ export function hasAnyOf (schema?: { anyOf?: ItemsType }): schema is { anyOf: ItemsType }
109
143
 
110
- export function getMinProperties (schema: SchemaType | undefined): { minProperties: number } | ObjectLiteralType
111
- export function getMaxProperties (schema: SchemaType | undefined): { maxProperties: number } | ObjectLiteralType
144
+ declare function getAnyOf (schema: { anyOf: ItemsType }): ItemsType
145
+ declare function getAnyOf (schema?: { anyOf?: ItemsType }): ItemsType | undefined
112
146
 
113
- export function getIsExclusiveMin (schema: SchemaType | undefined): { isExclusiveMin: boolean } | ObjectLiteralType
114
- export function getIsExclusiveMax (schema: SchemaType | undefined): { isExclusiveMax: boolean } | ObjectLiteralType
147
+ export { getAnyOf }
115
148
 
116
- export function getPattern (schema: SchemaType | undefined): { pattern: string } | ObjectLiteralType
149
+ export function hasOneOf (schema?: { oneOf?: ItemsType }): schema is { oneOf: ItemsType }
117
150
 
118
- export function getStep (schema: SchemaType | undefined): { step: number } | ObjectLiteralType
119
- }
151
+ declare function getOneOf (schema: { oneOf: ItemsType }): ItemsType
152
+ declare function getOneOf (schema?: { oneOf?: ItemsType }): ItemsType | undefined
120
153
 
121
- declare module 'shinkansen-transmission/transmission/common' {
122
- export * from '#transmission/transmission/common'
123
- }
154
+ export { getOneOf }
155
+
156
+ export function hasAllOf (schema?: { allOf?: ItemsType }): schema is { allOf: ItemsType }
157
+
158
+ declare function getAllOf (schema: { allOf: ItemsType }): ItemsType
159
+ declare function getAllOf (schema?: { allOf?: ItemsType }): ItemsType | undefined
160
+
161
+ export { getAllOf }
162
+
163
+ export function getUri (uri?: string, resource?: string | number): string
164
+
165
+ export function normaliseUri (uri?: string): string
166
+
167
+ export function getMin (schema?: { minimum?: number }): { min: number } | ObjectLiteralType
168
+ export function getMax (schema?: { maximum?: number }): { max: number } | ObjectLiteralType
169
+
170
+ export function getMinLength (schema?: { minLength?: number }): { minLength: number } | ObjectLiteralType
171
+ export function getMaxLength (schema?: { maxLength?: number }): { maxLength: number } | ObjectLiteralType
172
+
173
+ export function getMinItems (schema?: { minItems?: number }): { minItems: number } | ObjectLiteralType
174
+ export function getMaxItems (schema?: { maxItems?: number }): { maxItems: number } | ObjectLiteralType
175
+
176
+ export function getHasUniqueItems (schema?: { uniqueItems?: boolean }): { hasUniqueItems: boolean } | ObjectLiteralType
177
+
178
+ export function getMinContains (schema?: { minContains?: number }): { minContains: number } | ObjectLiteralType
179
+ export function getMaxContains (schema?: { maxContains?: number }): { maxContains: number } | ObjectLiteralType
180
+
181
+ export function getMinProperties (schema?: { minProperties?: number }): { minProperties: number } | ObjectLiteralType
182
+ export function getMaxProperties (schema?: { maxProperties?: number }): { maxProperties: number } | ObjectLiteralType
183
+
184
+ export function getIsExclusiveMin (schema?: { exclusiveMinimum?: boolean }): { isExclusiveMin: boolean } | ObjectLiteralType
185
+ export function getIsExclusiveMax (schema?: { exclusiveMaximum?: boolean }): { isExclusiveMax: boolean } | ObjectLiteralType
186
+
187
+ export function getPattern (schema?: { pattern?: RegExp }): { pattern: RegExp } | ObjectLiteralType
188
+
189
+ export function getStep (schema?: { multipleOf?: number }): { step: number } | ObjectLiteralType