quicktype 18.0.5 → 19.0.4

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 (174) hide show
  1. package/README.md +1 -1
  2. package/dist/{cli/CompressedJSONFromStream.d.ts → CompressedJSONFromStream.d.ts} +1 -1
  3. package/dist/{cli/CompressedJSONFromStream.js → CompressedJSONFromStream.js} +2 -2
  4. package/dist/{cli/GraphQLIntrospection.d.ts → GraphQLIntrospection.d.ts} +0 -0
  5. package/dist/{cli/GraphQLIntrospection.js → GraphQLIntrospection.js} +1 -1
  6. package/dist/{cli/TypeSource.d.ts → TypeSource.d.ts} +2 -2
  7. package/dist/{cli/TypeSource.js → TypeSource.js} +0 -0
  8. package/dist/{cli/URLGrammar.d.ts → URLGrammar.d.ts} +0 -0
  9. package/dist/{cli/URLGrammar.js → URLGrammar.js} +1 -1
  10. package/dist/{cli/index.d.ts → index.d.ts} +1 -1
  11. package/dist/{cli/index.js → index.js} +4 -5
  12. package/package.json +61 -77
  13. package/dist/quicktype-core/Annotation.d.ts +0 -8
  14. package/dist/quicktype-core/Annotation.js +0 -16
  15. package/dist/quicktype-core/ConvenienceRenderer.d.ts +0 -138
  16. package/dist/quicktype-core/ConvenienceRenderer.js +0 -668
  17. package/dist/quicktype-core/DateTime.d.ts +0 -10
  18. package/dist/quicktype-core/DateTime.js +0 -57
  19. package/dist/quicktype-core/DeclarationIR.d.ts +0 -14
  20. package/dist/quicktype-core/DeclarationIR.js +0 -167
  21. package/dist/quicktype-core/EncodedMarkovChain.d.ts +0 -1
  22. package/dist/quicktype-core/EncodedMarkovChain.js +0 -4
  23. package/dist/quicktype-core/GatherNames.d.ts +0 -2
  24. package/dist/quicktype-core/GatherNames.js +0 -333
  25. package/dist/quicktype-core/Graph.d.ts +0 -12
  26. package/dist/quicktype-core/Graph.js +0 -220
  27. package/dist/quicktype-core/GraphRewriting.d.ts +0 -87
  28. package/dist/quicktype-core/GraphRewriting.js +0 -421
  29. package/dist/quicktype-core/MakeTransformations.d.ts +0 -4
  30. package/dist/quicktype-core/MakeTransformations.js +0 -193
  31. package/dist/quicktype-core/MarkovChain.d.ts +0 -15
  32. package/dist/quicktype-core/MarkovChain.js +0 -154
  33. package/dist/quicktype-core/Messages.d.ts +0 -294
  34. package/dist/quicktype-core/Messages.js +0 -105
  35. package/dist/quicktype-core/Naming.d.ts +0 -64
  36. package/dist/quicktype-core/Naming.js +0 -356
  37. package/dist/quicktype-core/Renderer.d.ts +0 -50
  38. package/dist/quicktype-core/Renderer.js +0 -274
  39. package/dist/quicktype-core/RendererOptions.d.ts +0 -71
  40. package/dist/quicktype-core/RendererOptions.js +0 -141
  41. package/dist/quicktype-core/Run.d.ts +0 -174
  42. package/dist/quicktype-core/Run.js +0 -393
  43. package/dist/quicktype-core/Source.d.ts +0 -65
  44. package/dist/quicktype-core/Source.js +0 -204
  45. package/dist/quicktype-core/TargetLanguage.d.ts +0 -34
  46. package/dist/quicktype-core/TargetLanguage.js +0 -66
  47. package/dist/quicktype-core/Transformers.d.ts +0 -209
  48. package/dist/quicktype-core/Transformers.js +0 -836
  49. package/dist/quicktype-core/Type.d.ts +0 -206
  50. package/dist/quicktype-core/Type.js +0 -716
  51. package/dist/quicktype-core/TypeBuilder.d.ts +0 -61
  52. package/dist/quicktype-core/TypeBuilder.js +0 -324
  53. package/dist/quicktype-core/TypeGraph.d.ts +0 -75
  54. package/dist/quicktype-core/TypeGraph.js +0 -420
  55. package/dist/quicktype-core/TypeUtils.d.ts +0 -33
  56. package/dist/quicktype-core/TypeUtils.js +0 -230
  57. package/dist/quicktype-core/UnifyClasses.d.ts +0 -16
  58. package/dist/quicktype-core/UnifyClasses.js +0 -159
  59. package/dist/quicktype-core/UnionBuilder.d.ts +0 -49
  60. package/dist/quicktype-core/UnionBuilder.js +0 -282
  61. package/dist/quicktype-core/attributes/AccessorNames.d.ts +0 -18
  62. package/dist/quicktype-core/attributes/AccessorNames.js +0 -182
  63. package/dist/quicktype-core/attributes/Constraints.d.ts +0 -38
  64. package/dist/quicktype-core/attributes/Constraints.js +0 -172
  65. package/dist/quicktype-core/attributes/Description.d.ts +0 -9
  66. package/dist/quicktype-core/attributes/Description.js +0 -97
  67. package/dist/quicktype-core/attributes/EnumValues.d.ts +0 -8
  68. package/dist/quicktype-core/attributes/EnumValues.js +0 -31
  69. package/dist/quicktype-core/attributes/StringTypes.d.ts +0 -28
  70. package/dist/quicktype-core/attributes/StringTypes.js +0 -189
  71. package/dist/quicktype-core/attributes/TypeAttributes.d.ts +0 -34
  72. package/dist/quicktype-core/attributes/TypeAttributes.js +0 -119
  73. package/dist/quicktype-core/attributes/TypeNames.d.ts +0 -46
  74. package/dist/quicktype-core/attributes/TypeNames.js +0 -274
  75. package/dist/quicktype-core/attributes/URIAttributes.d.ts +0 -8
  76. package/dist/quicktype-core/attributes/URIAttributes.js +0 -85
  77. package/dist/quicktype-core/index.d.ts +0 -48
  78. package/dist/quicktype-core/index.js +0 -180
  79. package/dist/quicktype-core/input/CompressedJSON.d.ts +0 -69
  80. package/dist/quicktype-core/input/CompressedJSON.js +0 -276
  81. package/dist/quicktype-core/input/FetchingJSONSchemaStore.d.ts +0 -6
  82. package/dist/quicktype-core/input/FetchingJSONSchemaStore.js +0 -18
  83. package/dist/quicktype-core/input/Inference.d.ts +0 -22
  84. package/dist/quicktype-core/input/Inference.js +0 -240
  85. package/dist/quicktype-core/input/Inputs.d.ts +0 -48
  86. package/dist/quicktype-core/input/Inputs.js +0 -145
  87. package/dist/quicktype-core/input/JSONSchemaInput.d.ts +0 -91
  88. package/dist/quicktype-core/input/JSONSchemaInput.js +0 -1041
  89. package/dist/quicktype-core/input/JSONSchemaStore.d.ts +0 -8
  90. package/dist/quicktype-core/input/JSONSchemaStore.js +0 -36
  91. package/dist/quicktype-core/input/PostmanCollection.d.ts +0 -5
  92. package/dist/quicktype-core/input/PostmanCollection.js +0 -60
  93. package/dist/quicktype-core/input/io/NodeIO.d.ts +0 -3
  94. package/dist/quicktype-core/input/io/NodeIO.js +0 -87
  95. package/dist/quicktype-core/input/io/get-stream/buffer-stream.d.ts +0 -2
  96. package/dist/quicktype-core/input/io/get-stream/buffer-stream.js +0 -45
  97. package/dist/quicktype-core/input/io/get-stream/index.d.ts +0 -9
  98. package/dist/quicktype-core/input/io/get-stream/index.js +0 -52
  99. package/dist/quicktype-core/language/All.d.ts +0 -3
  100. package/dist/quicktype-core/language/All.js +0 -57
  101. package/dist/quicktype-core/language/CPlusPlus.d.ts +0 -241
  102. package/dist/quicktype-core/language/CPlusPlus.js +0 -1847
  103. package/dist/quicktype-core/language/CSharp.d.ts +0 -201
  104. package/dist/quicktype-core/language/CSharp.js +0 -1850
  105. package/dist/quicktype-core/language/Crystal.d.ts +0 -37
  106. package/dist/quicktype-core/language/Crystal.js +0 -337
  107. package/dist/quicktype-core/language/Dart.d.ts +0 -66
  108. package/dist/quicktype-core/language/Dart.js +0 -576
  109. package/dist/quicktype-core/language/Elm.d.ts +0 -58
  110. package/dist/quicktype-core/language/Elm.js +0 -522
  111. package/dist/quicktype-core/language/Golang.d.ts +0 -51
  112. package/dist/quicktype-core/language/Golang.js +0 -460
  113. package/dist/quicktype-core/language/Haskell.d.ts +0 -56
  114. package/dist/quicktype-core/language/Haskell.js +0 -411
  115. package/dist/quicktype-core/language/JSONSchema.d.ts +0 -31
  116. package/dist/quicktype-core/language/JSONSchema.js +0 -169
  117. package/dist/quicktype-core/language/Java.d.ts +0 -125
  118. package/dist/quicktype-core/language/Java.js +0 -1081
  119. package/dist/quicktype-core/language/JavaScript.d.ts +0 -68
  120. package/dist/quicktype-core/language/JavaScript.js +0 -435
  121. package/dist/quicktype-core/language/JavaScriptPropTypes.d.ts +0 -40
  122. package/dist/quicktype-core/language/JavaScriptPropTypes.js +0 -213
  123. package/dist/quicktype-core/language/JavaScriptUnicodeMaps.d.ts +0 -2
  124. package/dist/quicktype-core/language/JavaScriptUnicodeMaps.js +0 -134
  125. package/dist/quicktype-core/language/Kotlin.d.ts +0 -109
  126. package/dist/quicktype-core/language/Kotlin.js +0 -832
  127. package/dist/quicktype-core/language/Objective-C.d.ts +0 -79
  128. package/dist/quicktype-core/language/Objective-C.js +0 -777
  129. package/dist/quicktype-core/language/Php.d.ts +0 -80
  130. package/dist/quicktype-core/language/Php.js +0 -702
  131. package/dist/quicktype-core/language/Pike.d.ts +0 -37
  132. package/dist/quicktype-core/language/Pike.js +0 -276
  133. package/dist/quicktype-core/language/Python.d.ts +0 -107
  134. package/dist/quicktype-core/language/Python.js +0 -969
  135. package/dist/quicktype-core/language/Rust.d.ts +0 -56
  136. package/dist/quicktype-core/language/Rust.js +0 -309
  137. package/dist/quicktype-core/language/Swift.d.ts +0 -96
  138. package/dist/quicktype-core/language/Swift.js +0 -1211
  139. package/dist/quicktype-core/language/TypeScriptFlow.d.ts +0 -77
  140. package/dist/quicktype-core/language/TypeScriptFlow.js +0 -286
  141. package/dist/quicktype-core/language/ruby/index.d.ts +0 -52
  142. package/dist/quicktype-core/language/ruby/index.js +0 -557
  143. package/dist/quicktype-core/language/ruby/keywords.d.ts +0 -3
  144. package/dist/quicktype-core/language/ruby/keywords.js +0 -358
  145. package/dist/quicktype-core/rewrites/CombineClasses.d.ts +0 -3
  146. package/dist/quicktype-core/rewrites/CombineClasses.js +0 -125
  147. package/dist/quicktype-core/rewrites/ExpandStrings.d.ts +0 -4
  148. package/dist/quicktype-core/rewrites/ExpandStrings.js +0 -143
  149. package/dist/quicktype-core/rewrites/FlattenStrings.d.ts +0 -3
  150. package/dist/quicktype-core/rewrites/FlattenStrings.js +0 -45
  151. package/dist/quicktype-core/rewrites/FlattenUnions.d.ts +0 -3
  152. package/dist/quicktype-core/rewrites/FlattenUnions.js +0 -47
  153. package/dist/quicktype-core/rewrites/InferMaps.d.ts +0 -3
  154. package/dist/quicktype-core/rewrites/InferMaps.js +0 -117
  155. package/dist/quicktype-core/rewrites/ReplaceObjectType.d.ts +0 -3
  156. package/dist/quicktype-core/rewrites/ReplaceObjectType.js +0 -60
  157. package/dist/quicktype-core/rewrites/ResolveIntersections.d.ts +0 -3
  158. package/dist/quicktype-core/rewrites/ResolveIntersections.js +0 -244
  159. package/dist/quicktype-core/support/Acronyms.d.ts +0 -10
  160. package/dist/quicktype-core/support/Acronyms.js +0 -1128
  161. package/dist/quicktype-core/support/Chance.d.ts +0 -38
  162. package/dist/quicktype-core/support/Chance.js +0 -2146
  163. package/dist/quicktype-core/support/Converters.d.ts +0 -6
  164. package/dist/quicktype-core/support/Converters.js +0 -16
  165. package/dist/quicktype-core/support/Strings.d.ts +0 -44
  166. package/dist/quicktype-core/support/Strings.js +0 -525
  167. package/dist/quicktype-core/support/Support.d.ts +0 -29
  168. package/dist/quicktype-core/support/Support.js +0 -162
  169. package/dist/quicktype-graphql-input/GraphQLSchema.d.ts +0 -645
  170. package/dist/quicktype-graphql-input/GraphQLSchema.js +0 -39
  171. package/dist/quicktype-graphql-input/index.d.ts +0 -17
  172. package/dist/quicktype-graphql-input/index.js +0 -407
  173. package/dist/quicktype-typescript-input/index.d.ts +0 -2
  174. package/dist/quicktype-typescript-input/index.js +0 -98
@@ -1,145 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.InputData = exports.jsonInputForTargetLanguage = exports.JSONInput = void 0;
4
- const collection_utils_1 = require("collection-utils");
5
- const CompressedJSON_1 = require("./CompressedJSON");
6
- const Support_1 = require("../support/Support");
7
- const Messages_1 = require("../Messages");
8
- const TypeNames_1 = require("../attributes/TypeNames");
9
- const Description_1 = require("../attributes/Description");
10
- const Inference_1 = require("./Inference");
11
- const All_1 = require("../language/All");
12
- function messageParseError(name, description, e) {
13
- return (0, Messages_1.messageError)("MiscJSONParseError", {
14
- description: (0, collection_utils_1.withDefault)(description, "input"),
15
- address: name,
16
- message: (0, Support_1.errorMessage)(e)
17
- });
18
- }
19
- class JSONInput {
20
- _compressedJSON;
21
- kind = "json";
22
- needIR = true;
23
- needSchemaProcessing = false;
24
- _topLevels = new Map();
25
- /* tslint:disable:no-unused-variable */
26
- constructor(_compressedJSON) {
27
- this._compressedJSON = _compressedJSON;
28
- }
29
- addSample(topLevelName, sample) {
30
- let topLevel = this._topLevels.get(topLevelName);
31
- if (topLevel === undefined) {
32
- topLevel = { samples: [], description: undefined };
33
- this._topLevels.set(topLevelName, topLevel);
34
- }
35
- topLevel.samples.push(sample);
36
- }
37
- setDescription(topLevelName, description) {
38
- let topLevel = this._topLevels.get(topLevelName);
39
- if (topLevel === undefined) {
40
- return (0, Support_1.panic)("Trying to set description for a top-level that doesn't exist");
41
- }
42
- topLevel.description = description;
43
- }
44
- addSamples(name, values, description) {
45
- for (const value of values) {
46
- this.addSample(name, value);
47
- if (description !== undefined) {
48
- this.setDescription(name, description);
49
- }
50
- }
51
- }
52
- async addSource(source) {
53
- const { name, samples, description } = source;
54
- try {
55
- const values = await (0, collection_utils_1.arrayMapSync)(samples, async (s) => await this._compressedJSON.parse(s));
56
- this.addSamples(name, values, description);
57
- }
58
- catch (e) {
59
- return messageParseError(name, description, e);
60
- }
61
- }
62
- addSourceSync(source) {
63
- const { name, samples, description } = source;
64
- try {
65
- const values = samples.map(s => this._compressedJSON.parseSync(s));
66
- this.addSamples(name, values, description);
67
- }
68
- catch (e) {
69
- return messageParseError(name, description, e);
70
- }
71
- }
72
- singleStringSchemaSource() {
73
- return undefined;
74
- }
75
- async addTypes(ctx, typeBuilder, inferMaps, inferEnums, fixedTopLevels) {
76
- return this.addTypesSync(ctx, typeBuilder, inferMaps, inferEnums, fixedTopLevels);
77
- }
78
- addTypesSync(_ctx, typeBuilder, inferMaps, inferEnums, fixedTopLevels) {
79
- const inference = new Inference_1.TypeInference(this._compressedJSON, typeBuilder, inferMaps, inferEnums);
80
- for (const [name, { samples, description }] of this._topLevels) {
81
- const tref = inference.inferTopLevelType((0, TypeNames_1.makeNamesTypeAttributes)(name, false), samples, fixedTopLevels);
82
- typeBuilder.addTopLevel(name, tref);
83
- if (description !== undefined) {
84
- const attributes = Description_1.descriptionTypeAttributeKind.makeAttributes(new Set([description]));
85
- typeBuilder.addAttributes(tref, attributes);
86
- }
87
- }
88
- }
89
- }
90
- exports.JSONInput = JSONInput;
91
- function jsonInputForTargetLanguage(targetLanguage, languages, handleJSONRefs = false) {
92
- if (typeof targetLanguage === "string") {
93
- targetLanguage = (0, Support_1.defined)((0, All_1.languageNamed)(targetLanguage, languages));
94
- }
95
- const compressedJSON = new CompressedJSON_1.CompressedJSONFromString(targetLanguage.dateTimeRecognizer, handleJSONRefs);
96
- return new JSONInput(compressedJSON);
97
- }
98
- exports.jsonInputForTargetLanguage = jsonInputForTargetLanguage;
99
- class InputData {
100
- // FIXME: Make into a Map, indexed by kind.
101
- _inputs = new Set();
102
- addInput(input) {
103
- this._inputs = this._inputs.add(input);
104
- }
105
- getOrAddInput(kind, makeInput) {
106
- let input = (0, collection_utils_1.iterableFind)(this._inputs, i => i.kind === kind);
107
- if (input === undefined) {
108
- input = makeInput();
109
- this.addInput(input);
110
- }
111
- return input;
112
- }
113
- async addSource(kind, source, makeInput) {
114
- const input = this.getOrAddInput(kind, makeInput);
115
- await input.addSource(source);
116
- }
117
- addSourceSync(kind, source, makeInput) {
118
- const input = this.getOrAddInput(kind, makeInput);
119
- input.addSourceSync(source);
120
- }
121
- async addTypes(ctx, typeBuilder, inferMaps, inferEnums, fixedTopLevels) {
122
- for (const input of this._inputs) {
123
- await input.addTypes(ctx, typeBuilder, inferMaps, inferEnums, fixedTopLevels);
124
- }
125
- }
126
- addTypesSync(ctx, typeBuilder, inferMaps, inferEnums, fixedTopLevels) {
127
- for (const input of this._inputs) {
128
- input.addTypesSync(ctx, typeBuilder, inferMaps, inferEnums, fixedTopLevels);
129
- }
130
- }
131
- get needIR() {
132
- return (0, collection_utils_1.iterableSome)(this._inputs, i => i.needIR);
133
- }
134
- get needSchemaProcessing() {
135
- return (0, collection_utils_1.iterableSome)(this._inputs, i => i.needSchemaProcessing);
136
- }
137
- singleStringSchemaSource() {
138
- const schemaStrings = (0, collection_utils_1.setFilterMap)(this._inputs, i => i.singleStringSchemaSource());
139
- if (schemaStrings.size > 1) {
140
- return (0, Support_1.panic)("We have more than one input with a string schema source");
141
- }
142
- return (0, collection_utils_1.iterableFirst)(schemaStrings);
143
- }
144
- }
145
- exports.InputData = InputData;
@@ -1,91 +0,0 @@
1
- import URI from "urijs";
2
- import { TypeBuilder } from "../TypeBuilder";
3
- import { TypeAttributes } from "../attributes/TypeAttributes";
4
- import { JSONSchema, JSONSchemaStore } from "./JSONSchemaStore";
5
- import { RunContext } from "../Run";
6
- import { Input } from "./Inputs";
7
- export declare enum PathElementKind {
8
- Root = 0,
9
- KeyOrIndex = 1,
10
- Type = 2,
11
- Object = 3
12
- }
13
- export type PathElement = {
14
- kind: PathElementKind.Root;
15
- } | {
16
- kind: PathElementKind.KeyOrIndex;
17
- key: string;
18
- } | {
19
- kind: PathElementKind.Type;
20
- index: number;
21
- } | {
22
- kind: PathElementKind.Object;
23
- };
24
- export declare class Ref {
25
- readonly path: ReadonlyArray<PathElement>;
26
- static root(address: string | undefined): Ref;
27
- private static parsePath;
28
- static parseURI(uri: URI, destroyURI?: boolean): Ref;
29
- static parse(ref: string): Ref;
30
- addressURI: URI | undefined;
31
- constructor(addressURI: URI | undefined, path: ReadonlyArray<PathElement>);
32
- get hasAddress(): boolean;
33
- get address(): string;
34
- get isRoot(): boolean;
35
- private pushElement;
36
- push(...keys: string[]): Ref;
37
- pushObject(): Ref;
38
- pushType(index: number): Ref;
39
- resolveAgainst(base: Ref | undefined): Ref;
40
- get name(): string;
41
- get definitionName(): string | undefined;
42
- toString(): string;
43
- private lookup;
44
- lookupRef(root: JSONSchema): JSONSchema;
45
- equals(other: any): boolean;
46
- hashCode(): number;
47
- }
48
- export declare const schemaTypeDict: {
49
- null: boolean;
50
- boolean: boolean;
51
- string: boolean;
52
- integer: boolean;
53
- number: boolean;
54
- array: boolean;
55
- object: boolean;
56
- };
57
- export type JSONSchemaType = keyof typeof schemaTypeDict;
58
- export type JSONSchemaAttributes = {
59
- forType?: TypeAttributes;
60
- forUnion?: TypeAttributes;
61
- forObject?: TypeAttributes;
62
- forNumber?: TypeAttributes;
63
- forString?: TypeAttributes;
64
- forCases?: TypeAttributes[];
65
- };
66
- export type JSONSchemaAttributeProducer = (schema: JSONSchema, canonicalRef: Ref, types: Set<JSONSchemaType>, unionCases: JSONSchema[] | undefined) => JSONSchemaAttributes | undefined;
67
- export interface JSONSchemaSourceData {
68
- name: string;
69
- uris?: string[];
70
- schema?: string;
71
- isConverted?: boolean;
72
- }
73
- export declare class JSONSchemaInput implements Input<JSONSchemaSourceData> {
74
- private _schemaStore;
75
- private readonly _additionalSchemaAddresses;
76
- readonly kind: string;
77
- readonly needSchemaProcessing: boolean;
78
- private readonly _attributeProducers;
79
- private readonly _schemaInputs;
80
- private _schemaSources;
81
- private readonly _topLevels;
82
- private _needIR;
83
- constructor(_schemaStore: JSONSchemaStore | undefined, additionalAttributeProducers?: JSONSchemaAttributeProducer[], _additionalSchemaAddresses?: ReadonlyArray<string>);
84
- get needIR(): boolean;
85
- addTopLevel(name: string, ref: Ref): void;
86
- addTypes(ctx: RunContext, typeBuilder: TypeBuilder): Promise<void>;
87
- addTypesSync(): void;
88
- addSource(schemaSource: JSONSchemaSourceData): Promise<void>;
89
- addSourceSync(schemaSource: JSONSchemaSourceData): void;
90
- singleStringSchemaSource(): string | undefined;
91
- }