quicktype 17.0.1 → 17.0.3
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/dist/cli/CompressedJSONFromStream.js +26 -38
- package/dist/cli/GraphQLIntrospection.js +33 -41
- package/dist/cli/TypeSource.d.ts +1 -1
- package/dist/cli/URLGrammar.js +4 -3
- package/dist/cli/index.js +363 -364
- package/dist/quicktype-core/Annotation.js +2 -0
- package/dist/quicktype-core/ConvenienceRenderer.d.ts +17 -17
- package/dist/quicktype-core/ConvenienceRenderer.js +104 -81
- package/dist/quicktype-core/DateTime.js +1 -0
- package/dist/quicktype-core/DeclarationIR.d.ts +1 -1
- package/dist/quicktype-core/DeclarationIR.js +13 -10
- package/dist/quicktype-core/EncodedMarkovChain.js +1 -0
- package/dist/quicktype-core/GatherNames.js +47 -25
- package/dist/quicktype-core/Graph.d.ts +2 -2
- package/dist/quicktype-core/Graph.js +23 -19
- package/dist/quicktype-core/GraphRewriting.d.ts +2 -2
- package/dist/quicktype-core/GraphRewriting.js +65 -54
- package/dist/quicktype-core/MakeTransformations.js +23 -22
- package/dist/quicktype-core/MarkovChain.d.ts +3 -3
- package/dist/quicktype-core/MarkovChain.js +9 -8
- package/dist/quicktype-core/Messages.d.ts +3 -3
- package/dist/quicktype-core/Messages.js +8 -3
- package/dist/quicktype-core/Naming.d.ts +11 -11
- package/dist/quicktype-core/Naming.js +76 -61
- package/dist/quicktype-core/Renderer.d.ts +6 -6
- package/dist/quicktype-core/Renderer.js +34 -17
- package/dist/quicktype-core/RendererOptions.d.ts +5 -5
- package/dist/quicktype-core/RendererOptions.js +6 -3
- package/dist/quicktype-core/Run.d.ts +9 -9
- package/dist/quicktype-core/Run.js +72 -67
- package/dist/quicktype-core/Source.d.ts +3 -3
- package/dist/quicktype-core/Source.js +19 -18
- package/dist/quicktype-core/TargetLanguage.d.ts +10 -10
- package/dist/quicktype-core/TargetLanguage.js +6 -2
- package/dist/quicktype-core/Transformers.d.ts +25 -25
- package/dist/quicktype-core/Transformers.js +94 -66
- package/dist/quicktype-core/Type.d.ts +41 -43
- package/dist/quicktype-core/Type.js +96 -71
- package/dist/quicktype-core/TypeBuilder.d.ts +2 -2
- package/dist/quicktype-core/TypeBuilder.js +53 -47
- package/dist/quicktype-core/TypeGraph.d.ts +4 -4
- package/dist/quicktype-core/TypeGraph.js +49 -40
- package/dist/quicktype-core/TypeUtils.d.ts +2 -2
- package/dist/quicktype-core/TypeUtils.js +23 -22
- package/dist/quicktype-core/UnifyClasses.js +16 -12
- package/dist/quicktype-core/UnionBuilder.d.ts +3 -3
- package/dist/quicktype-core/UnionBuilder.js +33 -30
- package/dist/quicktype-core/attributes/AccessorNames.d.ts +2 -2
- package/dist/quicktype-core/attributes/AccessorNames.js +18 -17
- package/dist/quicktype-core/attributes/Constraints.d.ts +3 -3
- package/dist/quicktype-core/attributes/Constraints.js +8 -4
- package/dist/quicktype-core/attributes/Description.js +6 -5
- package/dist/quicktype-core/attributes/EnumValues.js +4 -3
- package/dist/quicktype-core/attributes/StringTypes.d.ts +1 -1
- package/dist/quicktype-core/attributes/StringTypes.js +24 -21
- package/dist/quicktype-core/attributes/TypeAttributes.d.ts +3 -3
- package/dist/quicktype-core/attributes/TypeAttributes.js +12 -10
- package/dist/quicktype-core/attributes/TypeNames.d.ts +9 -9
- package/dist/quicktype-core/attributes/TypeNames.js +49 -21
- package/dist/quicktype-core/attributes/URIAttributes.d.ts +1 -1
- package/dist/quicktype-core/attributes/URIAttributes.js +10 -6
- package/dist/quicktype-core/index.js +128 -125
- package/dist/quicktype-core/input/CompressedJSON.d.ts +7 -7
- package/dist/quicktype-core/input/CompressedJSON.js +49 -54
- package/dist/quicktype-core/input/FetchingJSONSchemaStore.js +5 -13
- package/dist/quicktype-core/input/Inference.d.ts +2 -2
- package/dist/quicktype-core/input/Inference.js +25 -17
- package/dist/quicktype-core/input/Inputs.d.ts +2 -2
- package/dist/quicktype-core/input/Inputs.js +38 -54
- package/dist/quicktype-core/input/JSONSchemaInput.d.ts +11 -11
- package/dist/quicktype-core/input/JSONSchemaInput.js +503 -523
- package/dist/quicktype-core/input/JSONSchemaStore.d.ts +1 -1
- package/dist/quicktype-core/input/JSONSchemaStore.js +24 -35
- package/dist/quicktype-core/input/PostmanCollection.js +2 -1
- package/dist/quicktype-core/input/io/NodeIO.js +55 -44
- package/dist/quicktype-core/input/io/get-stream/index.js +6 -2
- package/dist/quicktype-core/language/All.js +3 -2
- package/dist/quicktype-core/language/CPlusPlus.d.ts +8 -8
- package/dist/quicktype-core/language/CPlusPlus.js +185 -151
- package/dist/quicktype-core/language/CSharp.d.ts +7 -7
- package/dist/quicktype-core/language/CSharp.js +82 -72
- package/dist/quicktype-core/language/Crystal.d.ts +2 -2
- package/dist/quicktype-core/language/Crystal.js +18 -17
- package/dist/quicktype-core/language/Dart.d.ts +4 -4
- package/dist/quicktype-core/language/Dart.js +36 -34
- package/dist/quicktype-core/language/Elm.d.ts +6 -6
- package/dist/quicktype-core/language/Elm.js +47 -45
- package/dist/quicktype-core/language/Golang.d.ts +4 -4
- package/dist/quicktype-core/language/Golang.js +23 -20
- package/dist/quicktype-core/language/Haskell.d.ts +5 -5
- package/dist/quicktype-core/language/Haskell.js +25 -23
- package/dist/quicktype-core/language/JSONSchema.d.ts +3 -3
- package/dist/quicktype-core/language/JSONSchema.js +17 -16
- package/dist/quicktype-core/language/Java.d.ts +2 -2
- package/dist/quicktype-core/language/Java.js +97 -97
- package/dist/quicktype-core/language/JavaScript.d.ts +7 -7
- package/dist/quicktype-core/language/JavaScript.js +19 -17
- package/dist/quicktype-core/language/JavaScriptPropTypes.js +15 -13
- package/dist/quicktype-core/language/JavaScriptUnicodeMaps.js +12 -11
- package/dist/quicktype-core/language/Kotlin.d.ts +2 -2
- package/dist/quicktype-core/language/Kotlin.js +39 -37
- package/dist/quicktype-core/language/Objective-C.d.ts +3 -3
- package/dist/quicktype-core/language/Objective-C.js +45 -41
- package/dist/quicktype-core/language/Php.d.ts +2 -2
- package/dist/quicktype-core/language/Php.js +66 -41
- package/dist/quicktype-core/language/Pike.d.ts +1 -1
- package/dist/quicktype-core/language/Pike.js +18 -17
- package/dist/quicktype-core/language/Python.d.ts +8 -8
- package/dist/quicktype-core/language/Python.js +63 -64
- package/dist/quicktype-core/language/Rust.d.ts +2 -2
- package/dist/quicktype-core/language/Rust.js +21 -19
- package/dist/quicktype-core/language/Swift.d.ts +7 -7
- package/dist/quicktype-core/language/Swift.js +568 -565
- package/dist/quicktype-core/language/TypeScriptFlow.d.ts +7 -7
- package/dist/quicktype-core/language/TypeScriptFlow.js +28 -26
- package/dist/quicktype-core/language/ruby/index.d.ts +4 -4
- package/dist/quicktype-core/language/ruby/index.js +49 -24
- package/dist/quicktype-core/language/ruby/keywords.js +1 -0
- package/dist/quicktype-core/rewrites/CombineClasses.js +9 -8
- package/dist/quicktype-core/rewrites/ExpandStrings.d.ts +1 -1
- package/dist/quicktype-core/rewrites/ExpandStrings.js +18 -17
- package/dist/quicktype-core/rewrites/FlattenStrings.js +7 -6
- package/dist/quicktype-core/rewrites/FlattenUnions.js +9 -8
- package/dist/quicktype-core/rewrites/InferMaps.js +11 -10
- package/dist/quicktype-core/rewrites/ReplaceObjectType.js +8 -7
- package/dist/quicktype-core/rewrites/ResolveIntersections.js +68 -67
- package/dist/quicktype-core/support/Acronyms.js +3 -1
- package/dist/quicktype-core/support/Chance.js +10 -0
- package/dist/quicktype-core/support/Converters.js +1 -0
- package/dist/quicktype-core/support/Strings.d.ts +4 -4
- package/dist/quicktype-core/support/Strings.js +17 -16
- package/dist/quicktype-core/support/Support.d.ts +1 -1
- package/dist/quicktype-core/support/Support.js +30 -6
- package/dist/quicktype-graphql-input/GraphQLSchema.d.ts +4 -4
- package/dist/quicktype-graphql-input/GraphQLSchema.js +1 -0
- package/dist/quicktype-graphql-input/index.d.ts +1 -1
- package/dist/quicktype-graphql-input/index.js +229 -212
- package/dist/quicktype-typescript-input/index.js +30 -5
- package/package.json +25 -19
|
@@ -11,7 +11,7 @@ import { uriInferenceAttributesProducer } from "./attributes/URIAttributes";
|
|
|
11
11
|
* For transformed type kinds that map to an existing primitive type, `primitive`
|
|
12
12
|
* must specify that type kind.
|
|
13
13
|
*/
|
|
14
|
-
export
|
|
14
|
+
export type TransformedStringTypeTargets = {
|
|
15
15
|
jsonSchema: string;
|
|
16
16
|
primitive: PrimitiveNonStringTypeKind | undefined;
|
|
17
17
|
attributesProducer?: (s: string) => TypeAttributes;
|
|
@@ -48,14 +48,14 @@ declare const transformedStringTypeTargetTypeKinds: {
|
|
|
48
48
|
"bool-string": TransformedStringTypeTargets;
|
|
49
49
|
};
|
|
50
50
|
export declare const transformedStringTypeTargetTypeKindsMap: Map<string, TransformedStringTypeTargets>;
|
|
51
|
-
export
|
|
52
|
-
export
|
|
53
|
-
export
|
|
54
|
-
export
|
|
55
|
-
export
|
|
56
|
-
export
|
|
57
|
-
export
|
|
58
|
-
export declare const transformedStringTypeKinds: ReadonlySet<"
|
|
51
|
+
export type TransformedStringTypeKind = keyof typeof transformedStringTypeTargetTypeKinds;
|
|
52
|
+
export type PrimitiveStringTypeKind = "string" | TransformedStringTypeKind;
|
|
53
|
+
export type PrimitiveNonStringTypeKind = "none" | "any" | "null" | "bool" | "integer" | "double";
|
|
54
|
+
export type PrimitiveTypeKind = PrimitiveNonStringTypeKind | PrimitiveStringTypeKind;
|
|
55
|
+
export type NamedTypeKind = "class" | "enum" | "union";
|
|
56
|
+
export type TypeKind = PrimitiveTypeKind | NamedTypeKind | "array" | "object" | "map" | "intersection";
|
|
57
|
+
export type ObjectTypeKind = "object" | "map" | "class";
|
|
58
|
+
export declare const transformedStringTypeKinds: ReadonlySet<"date" | "time" | "date-time" | "uuid" | "uri" | "integer-string" | "bool-string">;
|
|
59
59
|
export declare function isPrimitiveStringTypeKind(kind: string): kind is PrimitiveStringTypeKind;
|
|
60
60
|
export declare function targetTypeKindForTransformedStringTypeKind(kind: PrimitiveStringTypeKind): PrimitiveNonStringTypeKind | undefined;
|
|
61
61
|
export declare function isNumberTypeKind(kind: TypeKind): kind is "integer" | "double";
|
|
@@ -68,24 +68,24 @@ export declare class TypeIdentity {
|
|
|
68
68
|
equals(other: any): boolean;
|
|
69
69
|
hashCode(): number;
|
|
70
70
|
}
|
|
71
|
-
export
|
|
71
|
+
export type MaybeTypeIdentity = TypeIdentity | undefined;
|
|
72
72
|
export declare abstract class Type {
|
|
73
73
|
readonly typeRef: TypeRef;
|
|
74
74
|
protected readonly graph: TypeGraph;
|
|
75
|
-
readonly kind: TypeKind;
|
|
76
|
-
constructor(typeRef: TypeRef, graph: TypeGraph
|
|
77
|
-
|
|
75
|
+
abstract readonly kind: TypeKind;
|
|
76
|
+
constructor(typeRef: TypeRef, graph: TypeGraph);
|
|
77
|
+
get index(): number;
|
|
78
78
|
abstract getNonAttributeChildren(): Set<Type>;
|
|
79
79
|
getChildren(): ReadonlySet<Type>;
|
|
80
80
|
getAttributes(): TypeAttributes;
|
|
81
|
-
|
|
81
|
+
get hasNames(): boolean;
|
|
82
82
|
getNames(): TypeNames;
|
|
83
83
|
getCombinedName(): string;
|
|
84
|
-
abstract
|
|
84
|
+
abstract get isNullable(): boolean;
|
|
85
85
|
abstract isPrimitive(): this is PrimitiveType;
|
|
86
|
-
abstract
|
|
86
|
+
abstract get identity(): MaybeTypeIdentity;
|
|
87
87
|
abstract reconstitute<T extends BaseGraphRewriteBuilder>(builder: TypeReconstituter<T>, canonicalOrder: boolean): void;
|
|
88
|
-
|
|
88
|
+
get debugPrintKind(): string;
|
|
89
89
|
equals(other: any): boolean;
|
|
90
90
|
hashCode(): number;
|
|
91
91
|
protected abstract structuralEqualityStep(other: Type, conflateNumbers: boolean, queue: (a: Type, b: Type) => boolean): boolean;
|
|
@@ -96,25 +96,26 @@ export declare abstract class Type {
|
|
|
96
96
|
export declare function primitiveTypeIdentity(kind: PrimitiveTypeKind, attributes: TypeAttributes): MaybeTypeIdentity;
|
|
97
97
|
export declare class PrimitiveType extends Type {
|
|
98
98
|
readonly kind: PrimitiveTypeKind;
|
|
99
|
-
|
|
99
|
+
constructor(typeRef: TypeRef, graph: TypeGraph, kind: PrimitiveTypeKind);
|
|
100
|
+
get isNullable(): boolean;
|
|
100
101
|
isPrimitive(): this is PrimitiveType;
|
|
101
102
|
getNonAttributeChildren(): Set<Type>;
|
|
102
|
-
|
|
103
|
+
get identity(): MaybeTypeIdentity;
|
|
103
104
|
reconstitute<T extends BaseGraphRewriteBuilder>(builder: TypeReconstituter<T>): void;
|
|
104
105
|
protected structuralEqualityStep(_other: Type, _conflateNumbers: boolean, _queue: (a: Type, b: Type) => boolean): boolean;
|
|
105
106
|
}
|
|
106
107
|
export declare function arrayTypeIdentity(attributes: TypeAttributes, itemsRef: TypeRef): MaybeTypeIdentity;
|
|
107
108
|
export declare class ArrayType extends Type {
|
|
108
109
|
private _itemsRef?;
|
|
109
|
-
readonly kind
|
|
110
|
+
readonly kind = "array";
|
|
110
111
|
constructor(typeRef: TypeRef, graph: TypeGraph, _itemsRef?: number | undefined);
|
|
111
112
|
setItems(itemsRef: TypeRef): undefined;
|
|
112
113
|
private getItemsRef;
|
|
113
|
-
|
|
114
|
+
get items(): Type;
|
|
114
115
|
getNonAttributeChildren(): Set<Type>;
|
|
115
|
-
|
|
116
|
+
get isNullable(): boolean;
|
|
116
117
|
isPrimitive(): this is PrimitiveType;
|
|
117
|
-
|
|
118
|
+
get identity(): MaybeTypeIdentity;
|
|
118
119
|
reconstitute<T extends BaseGraphRewriteBuilder>(builder: TypeReconstituter<T>): void;
|
|
119
120
|
protected structuralEqualityStep(other: ArrayType, _conflateNumbers: boolean, queue: (a: Type, b: Type) => boolean): boolean;
|
|
120
121
|
}
|
|
@@ -128,16 +129,16 @@ export declare class GenericClassProperty<T> {
|
|
|
128
129
|
export declare class ClassProperty extends GenericClassProperty<TypeRef> {
|
|
129
130
|
readonly graph: TypeGraph;
|
|
130
131
|
constructor(typeRef: TypeRef, graph: TypeGraph, isOptional: boolean);
|
|
131
|
-
|
|
132
|
-
|
|
132
|
+
get typeRef(): TypeRef;
|
|
133
|
+
get type(): Type;
|
|
133
134
|
}
|
|
134
135
|
export declare function classTypeIdentity(attributes: TypeAttributes, properties: ReadonlyMap<string, ClassProperty>): MaybeTypeIdentity;
|
|
135
136
|
export declare function mapTypeIdentify(attributes: TypeAttributes, additionalPropertiesRef: TypeRef | undefined): MaybeTypeIdentity;
|
|
136
137
|
export declare class ObjectType extends Type {
|
|
138
|
+
readonly kind: ObjectTypeKind;
|
|
137
139
|
readonly isFixed: boolean;
|
|
138
140
|
private _properties;
|
|
139
141
|
private _additionalPropertiesRef;
|
|
140
|
-
readonly kind: ObjectTypeKind;
|
|
141
142
|
constructor(typeRef: TypeRef, graph: TypeGraph, kind: ObjectTypeKind, isFixed: boolean, _properties: ReadonlyMap<string, ClassProperty> | undefined, _additionalPropertiesRef: TypeRef | undefined);
|
|
142
143
|
setProperties(properties: ReadonlyMap<string, ClassProperty>, additionalPropertiesRef: TypeRef | undefined): void;
|
|
143
144
|
getProperties(): ReadonlyMap<string, ClassProperty>;
|
|
@@ -145,29 +146,27 @@ export declare class ObjectType extends Type {
|
|
|
145
146
|
private getAdditionalPropertiesRef;
|
|
146
147
|
getAdditionalProperties(): Type | undefined;
|
|
147
148
|
getNonAttributeChildren(): Set<Type>;
|
|
148
|
-
|
|
149
|
+
get isNullable(): boolean;
|
|
149
150
|
isPrimitive(): this is PrimitiveType;
|
|
150
|
-
|
|
151
|
+
get identity(): MaybeTypeIdentity;
|
|
151
152
|
reconstitute<T extends BaseGraphRewriteBuilder>(builder: TypeReconstituter<T>, canonicalOrder: boolean): void;
|
|
152
153
|
protected structuralEqualityStep(other: ObjectType, _conflateNumbers: boolean, queue: (a: Type, b: Type) => boolean): boolean;
|
|
153
154
|
}
|
|
154
155
|
export declare class ClassType extends ObjectType {
|
|
155
|
-
kind: "class";
|
|
156
156
|
constructor(typeRef: TypeRef, graph: TypeGraph, isFixed: boolean, properties: ReadonlyMap<string, ClassProperty> | undefined);
|
|
157
157
|
}
|
|
158
158
|
export declare class MapType extends ObjectType {
|
|
159
|
-
readonly kind: "map";
|
|
160
159
|
constructor(typeRef: TypeRef, graph: TypeGraph, valuesRef: TypeRef | undefined);
|
|
161
|
-
|
|
160
|
+
get values(): Type;
|
|
162
161
|
}
|
|
163
162
|
export declare function enumTypeIdentity(attributes: TypeAttributes, cases: ReadonlySet<string>): MaybeTypeIdentity;
|
|
164
163
|
export declare class EnumType extends Type {
|
|
165
164
|
readonly cases: ReadonlySet<string>;
|
|
166
|
-
kind
|
|
165
|
+
readonly kind = "enum";
|
|
167
166
|
constructor(typeRef: TypeRef, graph: TypeGraph, cases: ReadonlySet<string>);
|
|
168
|
-
|
|
167
|
+
get isNullable(): boolean;
|
|
169
168
|
isPrimitive(): this is PrimitiveType;
|
|
170
|
-
|
|
169
|
+
get identity(): MaybeTypeIdentity;
|
|
171
170
|
getNonAttributeChildren(): Set<Type>;
|
|
172
171
|
reconstitute<T extends BaseGraphRewriteBuilder>(builder: TypeReconstituter<T>): void;
|
|
173
172
|
protected structuralEqualityStep(other: EnumType, _conflateNumbers: boolean, _queue: (a: Type, b: Type) => void): boolean;
|
|
@@ -177,32 +176,31 @@ export declare function setOperationTypeIdentity(kind: TypeKind, attributes: Typ
|
|
|
177
176
|
export declare function unionTypeIdentity(attributes: TypeAttributes, memberRefs: ReadonlySet<TypeRef>): MaybeTypeIdentity;
|
|
178
177
|
export declare function intersectionTypeIdentity(attributes: TypeAttributes, memberRefs: ReadonlySet<TypeRef>): MaybeTypeIdentity;
|
|
179
178
|
export declare abstract class SetOperationType extends Type {
|
|
179
|
+
readonly kind: TypeKind;
|
|
180
180
|
private _memberRefs?;
|
|
181
181
|
constructor(typeRef: TypeRef, graph: TypeGraph, kind: TypeKind, _memberRefs?: ReadonlySet<number> | undefined);
|
|
182
182
|
setMembers(memberRefs: ReadonlySet<TypeRef>): void;
|
|
183
183
|
protected getMemberRefs(): ReadonlySet<TypeRef>;
|
|
184
|
-
|
|
185
|
-
|
|
184
|
+
get members(): ReadonlySet<Type>;
|
|
185
|
+
get sortedMembers(): ReadonlySet<Type>;
|
|
186
186
|
getNonAttributeChildren(): Set<Type>;
|
|
187
187
|
isPrimitive(): this is PrimitiveType;
|
|
188
|
-
|
|
188
|
+
get identity(): MaybeTypeIdentity;
|
|
189
189
|
protected reconstituteSetOperation<T extends BaseGraphRewriteBuilder>(builder: TypeReconstituter<T>, canonicalOrder: boolean, getType: (members: ReadonlySet<TypeRef> | undefined) => void): void;
|
|
190
190
|
protected structuralEqualityStep(other: SetOperationType, conflateNumbers: boolean, queue: (a: Type, b: Type) => boolean): boolean;
|
|
191
191
|
}
|
|
192
192
|
export declare class IntersectionType extends SetOperationType {
|
|
193
|
-
kind: "intersection";
|
|
194
193
|
constructor(typeRef: TypeRef, graph: TypeGraph, memberRefs?: ReadonlySet<TypeRef>);
|
|
195
|
-
|
|
194
|
+
get isNullable(): boolean;
|
|
196
195
|
reconstitute<T extends BaseGraphRewriteBuilder>(builder: TypeReconstituter<T>, canonicalOrder: boolean): void;
|
|
197
196
|
}
|
|
198
197
|
export declare class UnionType extends SetOperationType {
|
|
199
|
-
kind: "union";
|
|
200
198
|
constructor(typeRef: TypeRef, graph: TypeGraph, memberRefs?: ReadonlySet<TypeRef>);
|
|
201
199
|
setMembers(memberRefs: ReadonlySet<TypeRef>): void;
|
|
202
|
-
|
|
200
|
+
get stringTypeMembers(): ReadonlySet<Type>;
|
|
203
201
|
findMember(kind: TypeKind): Type | undefined;
|
|
204
|
-
|
|
205
|
-
|
|
202
|
+
get isNullable(): boolean;
|
|
203
|
+
get isCanonical(): boolean;
|
|
206
204
|
reconstitute<T extends BaseGraphRewriteBuilder>(builder: TypeReconstituter<T>, canonicalOrder: boolean): void;
|
|
207
205
|
}
|
|
208
206
|
export {};
|