quicktype 17.0.3 → 17.0.5
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 +38 -26
- package/dist/cli/GraphQLIntrospection.js +41 -33
- package/dist/cli/TypeSource.d.ts +1 -1
- package/dist/cli/URLGrammar.js +3 -4
- package/dist/cli/index.js +364 -363
- package/dist/quicktype-core/Annotation.js +0 -2
- package/dist/quicktype-core/ConvenienceRenderer.d.ts +17 -17
- package/dist/quicktype-core/ConvenienceRenderer.js +81 -104
- package/dist/quicktype-core/DateTime.js +0 -1
- package/dist/quicktype-core/DeclarationIR.d.ts +1 -1
- package/dist/quicktype-core/DeclarationIR.js +10 -13
- package/dist/quicktype-core/EncodedMarkovChain.js +0 -1
- package/dist/quicktype-core/GatherNames.js +25 -47
- package/dist/quicktype-core/Graph.d.ts +2 -2
- package/dist/quicktype-core/Graph.js +19 -23
- package/dist/quicktype-core/GraphRewriting.d.ts +2 -2
- package/dist/quicktype-core/GraphRewriting.js +54 -65
- package/dist/quicktype-core/MakeTransformations.js +22 -23
- package/dist/quicktype-core/MarkovChain.d.ts +3 -3
- package/dist/quicktype-core/MarkovChain.js +8 -9
- package/dist/quicktype-core/Messages.d.ts +3 -3
- package/dist/quicktype-core/Messages.js +3 -8
- package/dist/quicktype-core/Naming.d.ts +11 -11
- package/dist/quicktype-core/Naming.js +61 -76
- package/dist/quicktype-core/Renderer.d.ts +6 -6
- package/dist/quicktype-core/Renderer.js +17 -34
- package/dist/quicktype-core/RendererOptions.d.ts +5 -5
- package/dist/quicktype-core/RendererOptions.js +3 -6
- package/dist/quicktype-core/Run.d.ts +9 -9
- package/dist/quicktype-core/Run.js +67 -72
- package/dist/quicktype-core/Source.d.ts +3 -3
- package/dist/quicktype-core/Source.js +18 -19
- package/dist/quicktype-core/TargetLanguage.d.ts +10 -10
- package/dist/quicktype-core/TargetLanguage.js +2 -6
- package/dist/quicktype-core/Transformers.d.ts +25 -25
- package/dist/quicktype-core/Transformers.js +66 -94
- package/dist/quicktype-core/Type.d.ts +43 -41
- package/dist/quicktype-core/Type.js +71 -96
- package/dist/quicktype-core/TypeBuilder.d.ts +2 -2
- package/dist/quicktype-core/TypeBuilder.js +47 -53
- package/dist/quicktype-core/TypeGraph.d.ts +4 -4
- package/dist/quicktype-core/TypeGraph.js +40 -49
- package/dist/quicktype-core/TypeUtils.d.ts +2 -2
- package/dist/quicktype-core/TypeUtils.js +22 -23
- package/dist/quicktype-core/UnifyClasses.js +12 -16
- package/dist/quicktype-core/UnionBuilder.d.ts +3 -3
- package/dist/quicktype-core/UnionBuilder.js +30 -33
- package/dist/quicktype-core/attributes/AccessorNames.d.ts +2 -2
- package/dist/quicktype-core/attributes/AccessorNames.js +17 -18
- package/dist/quicktype-core/attributes/Constraints.d.ts +3 -3
- package/dist/quicktype-core/attributes/Constraints.js +4 -8
- package/dist/quicktype-core/attributes/Description.js +5 -6
- package/dist/quicktype-core/attributes/EnumValues.js +3 -4
- package/dist/quicktype-core/attributes/StringTypes.d.ts +1 -1
- package/dist/quicktype-core/attributes/StringTypes.js +21 -24
- package/dist/quicktype-core/attributes/TypeAttributes.d.ts +3 -3
- package/dist/quicktype-core/attributes/TypeAttributes.js +10 -12
- package/dist/quicktype-core/attributes/TypeNames.d.ts +9 -9
- package/dist/quicktype-core/attributes/TypeNames.js +21 -49
- package/dist/quicktype-core/attributes/URIAttributes.d.ts +1 -1
- package/dist/quicktype-core/attributes/URIAttributes.js +6 -10
- package/dist/quicktype-core/index.js +125 -128
- package/dist/quicktype-core/input/CompressedJSON.d.ts +7 -7
- package/dist/quicktype-core/input/CompressedJSON.js +54 -49
- package/dist/quicktype-core/input/FetchingJSONSchemaStore.js +13 -5
- package/dist/quicktype-core/input/Inference.d.ts +2 -2
- package/dist/quicktype-core/input/Inference.js +17 -25
- package/dist/quicktype-core/input/Inputs.d.ts +2 -2
- package/dist/quicktype-core/input/Inputs.js +54 -38
- package/dist/quicktype-core/input/JSONSchemaInput.d.ts +11 -11
- package/dist/quicktype-core/input/JSONSchemaInput.js +523 -503
- package/dist/quicktype-core/input/JSONSchemaStore.d.ts +1 -1
- package/dist/quicktype-core/input/JSONSchemaStore.js +35 -24
- package/dist/quicktype-core/input/PostmanCollection.js +1 -2
- package/dist/quicktype-core/input/io/NodeIO.js +44 -55
- package/dist/quicktype-core/input/io/get-stream/index.js +2 -6
- package/dist/quicktype-core/language/All.js +2 -3
- package/dist/quicktype-core/language/CPlusPlus.d.ts +8 -8
- package/dist/quicktype-core/language/CPlusPlus.js +151 -185
- package/dist/quicktype-core/language/CSharp.d.ts +7 -7
- package/dist/quicktype-core/language/CSharp.js +72 -82
- package/dist/quicktype-core/language/Crystal.d.ts +2 -2
- package/dist/quicktype-core/language/Crystal.js +17 -18
- package/dist/quicktype-core/language/Dart.d.ts +4 -4
- package/dist/quicktype-core/language/Dart.js +34 -36
- package/dist/quicktype-core/language/Elm.d.ts +6 -6
- package/dist/quicktype-core/language/Elm.js +45 -47
- package/dist/quicktype-core/language/Golang.d.ts +4 -4
- package/dist/quicktype-core/language/Golang.js +20 -23
- package/dist/quicktype-core/language/Haskell.d.ts +5 -5
- package/dist/quicktype-core/language/Haskell.js +23 -25
- package/dist/quicktype-core/language/JSONSchema.d.ts +3 -3
- package/dist/quicktype-core/language/JSONSchema.js +16 -17
- 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 +17 -19
- package/dist/quicktype-core/language/JavaScriptPropTypes.js +13 -15
- package/dist/quicktype-core/language/JavaScriptUnicodeMaps.js +11 -12
- package/dist/quicktype-core/language/Kotlin.d.ts +2 -2
- package/dist/quicktype-core/language/Kotlin.js +37 -39
- package/dist/quicktype-core/language/Objective-C.d.ts +3 -3
- package/dist/quicktype-core/language/Objective-C.js +41 -45
- package/dist/quicktype-core/language/Php.d.ts +2 -2
- package/dist/quicktype-core/language/Php.js +41 -66
- package/dist/quicktype-core/language/Pike.d.ts +1 -1
- package/dist/quicktype-core/language/Pike.js +17 -18
- package/dist/quicktype-core/language/Python.d.ts +8 -8
- package/dist/quicktype-core/language/Python.js +64 -63
- package/dist/quicktype-core/language/Rust.d.ts +2 -2
- package/dist/quicktype-core/language/Rust.js +19 -21
- package/dist/quicktype-core/language/Swift.d.ts +7 -7
- package/dist/quicktype-core/language/Swift.js +804 -807
- package/dist/quicktype-core/language/TypeScriptFlow.d.ts +7 -7
- package/dist/quicktype-core/language/TypeScriptFlow.js +26 -28
- package/dist/quicktype-core/language/ruby/index.d.ts +4 -4
- package/dist/quicktype-core/language/ruby/index.js +24 -49
- package/dist/quicktype-core/language/ruby/keywords.js +0 -1
- package/dist/quicktype-core/rewrites/CombineClasses.js +8 -9
- package/dist/quicktype-core/rewrites/ExpandStrings.d.ts +1 -1
- package/dist/quicktype-core/rewrites/ExpandStrings.js +17 -18
- package/dist/quicktype-core/rewrites/FlattenStrings.js +6 -7
- package/dist/quicktype-core/rewrites/FlattenUnions.js +8 -9
- package/dist/quicktype-core/rewrites/InferMaps.js +10 -11
- package/dist/quicktype-core/rewrites/ReplaceObjectType.js +7 -8
- package/dist/quicktype-core/rewrites/ResolveIntersections.js +67 -68
- package/dist/quicktype-core/support/Acronyms.js +1 -3
- package/dist/quicktype-core/support/Chance.js +0 -10
- package/dist/quicktype-core/support/Converters.js +0 -1
- package/dist/quicktype-core/support/Strings.d.ts +4 -4
- package/dist/quicktype-core/support/Strings.js +16 -17
- package/dist/quicktype-core/support/Support.d.ts +1 -1
- package/dist/quicktype-core/support/Support.js +6 -30
- package/dist/quicktype-graphql-input/GraphQLSchema.d.ts +4 -4
- package/dist/quicktype-graphql-input/GraphQLSchema.js +0 -1
- package/dist/quicktype-graphql-input/index.d.ts +1 -1
- package/dist/quicktype-graphql-input/index.js +212 -229
- package/dist/quicktype-typescript-input/index.js +4 -28
- package/package.json +19 -25
|
@@ -1,176 +1,173 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ClassType = exports.ArrayType = exports.PrimitiveType = exports.Type = exports.messageAssert = exports.messageError = exports.QuickTypeError = exports.trainMarkovChain = exports.isLetterOrDigit = exports.legalizeCharacters = exports.allUpperWordStyle = exports.firstUpperWordStyle = exports.combineWords = exports.capitalize = exports.splitIntoWords = exports.inflateBase64 = exports.checkArray = exports.checkStringMap = exports.parseJSON = exports.assertNever = exports.defined = exports.assert = exports.panic = exports.IssueAnnotationData = exports.Namer = exports.funPrefixNamer = exports.Name = exports.parenIfNeeded = exports.singleWord = exports.modifySource = exports.languageNamed = exports.defaultTargetLanguages = exports.TargetLanguage = exports.getOptionValues = exports.Option = exports.Ref = exports.JSONSchemaInput = exports.jsonInputForTargetLanguage = exports.JSONInput = exports.InputData = exports.CompressedJSON = exports.inferenceFlagsObject = exports.defaultInferenceFlags = exports.inferenceFlagNames = exports.inferenceFlags = exports.combineRenderResults = exports.quicktype = exports.quicktypeMultiFileSync = exports.quicktypeMultiFile = exports.getTargetLanguage = void 0;
|
|
4
|
-
exports.tsFlowOptions = exports.FlowRenderer = exports.FlowTargetLanguage = exports.TypeScriptRenderer = exports.TypeScriptTargetLanguage = exports.javaScriptPropTypesOptions = exports.JavaScriptPropTypesRenderer = exports.JavaScriptPropTypesTargetLanguage = exports.javaScriptOptions = exports.JavaScriptRenderer = exports.JavaScriptTargetLanguage = exports.javaOptions = exports.JavaRenderer = exports.JavaTargetLanguage = exports.objcOptions = exports.ObjectiveCRenderer = exports.ObjectiveCTargetLanguage = exports.goOptions = exports.GoRenderer = exports.GoTargetLanguage = exports.CSharpRenderer = exports.cSharpOptions = exports.CSharpTargetLanguage = exports.cPlusPlusOptions = exports.CPlusPlusRenderer = exports.CPlusPlusTargetLanguage = exports.uriTypeAttributeKind = exports.ConvenienceRenderer = exports.nullableFromUnion = exports.matchType = exports.removeNullFromUnion = exports.StringTypes = exports.namesTypeAttributeKind = exports.makeNamesTypeAttributes = exports.TypeNames = exports.emptyTypeAttributes = exports.TypeAttributeKind = exports.derefTypeRef = exports.TypeBuilder = exports.sourcesFromPostmanCollection = exports.JSONSchemaStore = exports.FetchingJSONSchemaStore = exports.readFromFileOrURL = exports.readableFromFileOrURL = exports.getStream = exports.ObjectType = exports.UnionType = exports.MapType = exports.EnumType = exports.ClassProperty = void 0;
|
|
5
|
-
exports.dartOptions = exports.DartRenderer = exports.DartTargetLanguage = exports.haskellOptions = exports.HaskellRenderer = exports.HaskellTargetLanguage = exports.CrystalRenderer = exports.CrystalTargetLanguage = exports.rubyOptions = exports.RubyRenderer = exports.RubyTargetLanguage = exports.rustOptions = exports.RustRenderer = exports.RustTargetLanguage = exports.JSONSchemaRenderer = exports.JSONSchemaTargetLanguage = exports.elmOptions = exports.ElmRenderer = exports.ElmTargetLanguage = exports.kotlinOptions = exports.KotlinRenderer = exports.KotlinTargetLanguage = exports.swiftOptions = exports.SwiftRenderer = exports.SwiftTargetLanguage = void 0;
|
|
6
3
|
var Run_1 = require("./Run");
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
4
|
+
exports.getTargetLanguage = Run_1.getTargetLanguage;
|
|
5
|
+
exports.quicktypeMultiFile = Run_1.quicktypeMultiFile;
|
|
6
|
+
exports.quicktypeMultiFileSync = Run_1.quicktypeMultiFileSync;
|
|
7
|
+
exports.quicktype = Run_1.quicktype;
|
|
8
|
+
exports.combineRenderResults = Run_1.combineRenderResults;
|
|
9
|
+
exports.inferenceFlags = Run_1.inferenceFlags;
|
|
10
|
+
exports.inferenceFlagNames = Run_1.inferenceFlagNames;
|
|
11
|
+
exports.defaultInferenceFlags = Run_1.defaultInferenceFlags;
|
|
12
|
+
exports.inferenceFlagsObject = Run_1.inferenceFlagsObject;
|
|
16
13
|
var CompressedJSON_1 = require("./input/CompressedJSON");
|
|
17
|
-
|
|
14
|
+
exports.CompressedJSON = CompressedJSON_1.CompressedJSON;
|
|
18
15
|
var Inputs_1 = require("./input/Inputs");
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
exports.InputData = Inputs_1.InputData;
|
|
17
|
+
exports.JSONInput = Inputs_1.JSONInput;
|
|
18
|
+
exports.jsonInputForTargetLanguage = Inputs_1.jsonInputForTargetLanguage;
|
|
22
19
|
var JSONSchemaInput_1 = require("./input/JSONSchemaInput");
|
|
23
|
-
|
|
20
|
+
exports.JSONSchemaInput = JSONSchemaInput_1.JSONSchemaInput;
|
|
24
21
|
var JSONSchemaInput_2 = require("./input/JSONSchemaInput");
|
|
25
|
-
|
|
22
|
+
exports.Ref = JSONSchemaInput_2.Ref;
|
|
26
23
|
var RendererOptions_1 = require("./RendererOptions");
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
exports.Option = RendererOptions_1.Option;
|
|
25
|
+
exports.getOptionValues = RendererOptions_1.getOptionValues;
|
|
29
26
|
var TargetLanguage_1 = require("./TargetLanguage");
|
|
30
|
-
|
|
27
|
+
exports.TargetLanguage = TargetLanguage_1.TargetLanguage;
|
|
31
28
|
var All_1 = require("./language/All");
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
exports.defaultTargetLanguages = All_1.all;
|
|
30
|
+
exports.languageNamed = All_1.languageNamed;
|
|
34
31
|
var Source_1 = require("./Source");
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
32
|
+
exports.modifySource = Source_1.modifySource;
|
|
33
|
+
exports.singleWord = Source_1.singleWord;
|
|
34
|
+
exports.parenIfNeeded = Source_1.parenIfNeeded;
|
|
38
35
|
var Naming_1 = require("./Naming");
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
36
|
+
exports.Name = Naming_1.Name;
|
|
37
|
+
exports.funPrefixNamer = Naming_1.funPrefixNamer;
|
|
38
|
+
exports.Namer = Naming_1.Namer;
|
|
42
39
|
var Annotation_1 = require("./Annotation");
|
|
43
|
-
|
|
40
|
+
exports.IssueAnnotationData = Annotation_1.IssueAnnotationData;
|
|
44
41
|
var Support_1 = require("./support/Support");
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
42
|
+
exports.panic = Support_1.panic;
|
|
43
|
+
exports.assert = Support_1.assert;
|
|
44
|
+
exports.defined = Support_1.defined;
|
|
45
|
+
exports.assertNever = Support_1.assertNever;
|
|
46
|
+
exports.parseJSON = Support_1.parseJSON;
|
|
47
|
+
exports.checkStringMap = Support_1.checkStringMap;
|
|
48
|
+
exports.checkArray = Support_1.checkArray;
|
|
49
|
+
exports.inflateBase64 = Support_1.inflateBase64;
|
|
53
50
|
var Strings_1 = require("./support/Strings");
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
51
|
+
exports.splitIntoWords = Strings_1.splitIntoWords;
|
|
52
|
+
exports.capitalize = Strings_1.capitalize;
|
|
53
|
+
exports.combineWords = Strings_1.combineWords;
|
|
54
|
+
exports.firstUpperWordStyle = Strings_1.firstUpperWordStyle;
|
|
55
|
+
exports.allUpperWordStyle = Strings_1.allUpperWordStyle;
|
|
56
|
+
exports.legalizeCharacters = Strings_1.legalizeCharacters;
|
|
57
|
+
exports.isLetterOrDigit = Strings_1.isLetterOrDigit;
|
|
61
58
|
var MarkovChain_1 = require("./MarkovChain");
|
|
62
|
-
|
|
59
|
+
exports.trainMarkovChain = MarkovChain_1.train;
|
|
63
60
|
var Messages_1 = require("./Messages");
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
61
|
+
exports.QuickTypeError = Messages_1.QuickTypeError;
|
|
62
|
+
exports.messageError = Messages_1.messageError;
|
|
63
|
+
exports.messageAssert = Messages_1.messageAssert;
|
|
67
64
|
var Type_1 = require("./Type");
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
65
|
+
exports.Type = Type_1.Type;
|
|
66
|
+
exports.PrimitiveType = Type_1.PrimitiveType;
|
|
67
|
+
exports.ArrayType = Type_1.ArrayType;
|
|
68
|
+
exports.ClassType = Type_1.ClassType;
|
|
69
|
+
exports.ClassProperty = Type_1.ClassProperty;
|
|
70
|
+
exports.EnumType = Type_1.EnumType;
|
|
71
|
+
exports.MapType = Type_1.MapType;
|
|
72
|
+
exports.UnionType = Type_1.UnionType;
|
|
73
|
+
exports.ObjectType = Type_1.ObjectType;
|
|
77
74
|
var get_stream_1 = require("./input/io/get-stream");
|
|
78
|
-
|
|
75
|
+
exports.getStream = get_stream_1.getStream;
|
|
79
76
|
var NodeIO_1 = require("./input/io/NodeIO");
|
|
80
|
-
|
|
81
|
-
|
|
77
|
+
exports.readableFromFileOrURL = NodeIO_1.readableFromFileOrURL;
|
|
78
|
+
exports.readFromFileOrURL = NodeIO_1.readFromFileOrURL;
|
|
82
79
|
var FetchingJSONSchemaStore_1 = require("./input/FetchingJSONSchemaStore");
|
|
83
|
-
|
|
80
|
+
exports.FetchingJSONSchemaStore = FetchingJSONSchemaStore_1.FetchingJSONSchemaStore;
|
|
84
81
|
var JSONSchemaStore_1 = require("./input/JSONSchemaStore");
|
|
85
|
-
|
|
82
|
+
exports.JSONSchemaStore = JSONSchemaStore_1.JSONSchemaStore;
|
|
86
83
|
var PostmanCollection_1 = require("./input/PostmanCollection");
|
|
87
|
-
|
|
84
|
+
exports.sourcesFromPostmanCollection = PostmanCollection_1.sourcesFromPostmanCollection;
|
|
88
85
|
var TypeBuilder_1 = require("./TypeBuilder");
|
|
89
|
-
|
|
86
|
+
exports.TypeBuilder = TypeBuilder_1.TypeBuilder;
|
|
90
87
|
var TypeGraph_1 = require("./TypeGraph");
|
|
91
|
-
|
|
88
|
+
exports.derefTypeRef = TypeGraph_1.derefTypeRef;
|
|
92
89
|
var TypeAttributes_1 = require("./attributes/TypeAttributes");
|
|
93
|
-
|
|
94
|
-
|
|
90
|
+
exports.TypeAttributeKind = TypeAttributes_1.TypeAttributeKind;
|
|
91
|
+
exports.emptyTypeAttributes = TypeAttributes_1.emptyTypeAttributes;
|
|
95
92
|
var TypeNames_1 = require("./attributes/TypeNames");
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
93
|
+
exports.TypeNames = TypeNames_1.TypeNames;
|
|
94
|
+
exports.makeNamesTypeAttributes = TypeNames_1.makeNamesTypeAttributes;
|
|
95
|
+
exports.namesTypeAttributeKind = TypeNames_1.namesTypeAttributeKind;
|
|
99
96
|
var StringTypes_1 = require("./attributes/StringTypes");
|
|
100
|
-
|
|
97
|
+
exports.StringTypes = StringTypes_1.StringTypes;
|
|
101
98
|
var TypeUtils_1 = require("./TypeUtils");
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
99
|
+
exports.removeNullFromUnion = TypeUtils_1.removeNullFromUnion;
|
|
100
|
+
exports.matchType = TypeUtils_1.matchType;
|
|
101
|
+
exports.nullableFromUnion = TypeUtils_1.nullableFromUnion;
|
|
105
102
|
var ConvenienceRenderer_1 = require("./ConvenienceRenderer");
|
|
106
|
-
|
|
103
|
+
exports.ConvenienceRenderer = ConvenienceRenderer_1.ConvenienceRenderer;
|
|
107
104
|
var URIAttributes_1 = require("./attributes/URIAttributes");
|
|
108
|
-
|
|
105
|
+
exports.uriTypeAttributeKind = URIAttributes_1.uriTypeAttributeKind;
|
|
109
106
|
var CPlusPlus_1 = require("./language/CPlusPlus");
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
107
|
+
exports.CPlusPlusTargetLanguage = CPlusPlus_1.CPlusPlusTargetLanguage;
|
|
108
|
+
exports.CPlusPlusRenderer = CPlusPlus_1.CPlusPlusRenderer;
|
|
109
|
+
exports.cPlusPlusOptions = CPlusPlus_1.cPlusPlusOptions;
|
|
113
110
|
var CSharp_1 = require("./language/CSharp");
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
111
|
+
exports.CSharpTargetLanguage = CSharp_1.CSharpTargetLanguage;
|
|
112
|
+
exports.cSharpOptions = CSharp_1.cSharpOptions;
|
|
113
|
+
exports.CSharpRenderer = CSharp_1.CSharpRenderer;
|
|
117
114
|
var Golang_1 = require("./language/Golang");
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
115
|
+
exports.GoTargetLanguage = Golang_1.GoTargetLanguage;
|
|
116
|
+
exports.GoRenderer = Golang_1.GoRenderer;
|
|
117
|
+
exports.goOptions = Golang_1.goOptions;
|
|
121
118
|
var Objective_C_1 = require("./language/Objective-C");
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
119
|
+
exports.ObjectiveCTargetLanguage = Objective_C_1.ObjectiveCTargetLanguage;
|
|
120
|
+
exports.ObjectiveCRenderer = Objective_C_1.ObjectiveCRenderer;
|
|
121
|
+
exports.objcOptions = Objective_C_1.objcOptions;
|
|
125
122
|
var Java_1 = require("./language/Java");
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
123
|
+
exports.JavaTargetLanguage = Java_1.JavaTargetLanguage;
|
|
124
|
+
exports.JavaRenderer = Java_1.JavaRenderer;
|
|
125
|
+
exports.javaOptions = Java_1.javaOptions;
|
|
129
126
|
var JavaScript_1 = require("./language/JavaScript");
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
127
|
+
exports.JavaScriptTargetLanguage = JavaScript_1.JavaScriptTargetLanguage;
|
|
128
|
+
exports.JavaScriptRenderer = JavaScript_1.JavaScriptRenderer;
|
|
129
|
+
exports.javaScriptOptions = JavaScript_1.javaScriptOptions;
|
|
133
130
|
var JavaScriptPropTypes_1 = require("./language/JavaScriptPropTypes");
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
131
|
+
exports.JavaScriptPropTypesTargetLanguage = JavaScriptPropTypes_1.JavaScriptPropTypesTargetLanguage;
|
|
132
|
+
exports.JavaScriptPropTypesRenderer = JavaScriptPropTypes_1.JavaScriptPropTypesRenderer;
|
|
133
|
+
exports.javaScriptPropTypesOptions = JavaScriptPropTypes_1.javaScriptPropTypesOptions;
|
|
137
134
|
var TypeScriptFlow_1 = require("./language/TypeScriptFlow");
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
135
|
+
exports.TypeScriptTargetLanguage = TypeScriptFlow_1.TypeScriptTargetLanguage;
|
|
136
|
+
exports.TypeScriptRenderer = TypeScriptFlow_1.TypeScriptRenderer;
|
|
137
|
+
exports.FlowTargetLanguage = TypeScriptFlow_1.FlowTargetLanguage;
|
|
138
|
+
exports.FlowRenderer = TypeScriptFlow_1.FlowRenderer;
|
|
139
|
+
exports.tsFlowOptions = TypeScriptFlow_1.tsFlowOptions;
|
|
143
140
|
var Swift_1 = require("./language/Swift");
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
141
|
+
exports.SwiftTargetLanguage = Swift_1.SwiftTargetLanguage;
|
|
142
|
+
exports.SwiftRenderer = Swift_1.SwiftRenderer;
|
|
143
|
+
exports.swiftOptions = Swift_1.swiftOptions;
|
|
147
144
|
var Kotlin_1 = require("./language/Kotlin");
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
145
|
+
exports.KotlinTargetLanguage = Kotlin_1.KotlinTargetLanguage;
|
|
146
|
+
exports.KotlinRenderer = Kotlin_1.KotlinRenderer;
|
|
147
|
+
exports.kotlinOptions = Kotlin_1.kotlinOptions;
|
|
151
148
|
var Elm_1 = require("./language/Elm");
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
149
|
+
exports.ElmTargetLanguage = Elm_1.ElmTargetLanguage;
|
|
150
|
+
exports.ElmRenderer = Elm_1.ElmRenderer;
|
|
151
|
+
exports.elmOptions = Elm_1.elmOptions;
|
|
155
152
|
var JSONSchema_1 = require("./language/JSONSchema");
|
|
156
|
-
|
|
157
|
-
|
|
153
|
+
exports.JSONSchemaTargetLanguage = JSONSchema_1.JSONSchemaTargetLanguage;
|
|
154
|
+
exports.JSONSchemaRenderer = JSONSchema_1.JSONSchemaRenderer;
|
|
158
155
|
var Rust_1 = require("./language/Rust");
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
156
|
+
exports.RustTargetLanguage = Rust_1.RustTargetLanguage;
|
|
157
|
+
exports.RustRenderer = Rust_1.RustRenderer;
|
|
158
|
+
exports.rustOptions = Rust_1.rustOptions;
|
|
162
159
|
var ruby_1 = require("./language/ruby");
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
160
|
+
exports.RubyTargetLanguage = ruby_1.RubyTargetLanguage;
|
|
161
|
+
exports.RubyRenderer = ruby_1.RubyRenderer;
|
|
162
|
+
exports.rubyOptions = ruby_1.rubyOptions;
|
|
166
163
|
var Crystal_1 = require("./language/Crystal");
|
|
167
|
-
|
|
168
|
-
|
|
164
|
+
exports.CrystalTargetLanguage = Crystal_1.CrystalTargetLanguage;
|
|
165
|
+
exports.CrystalRenderer = Crystal_1.CrystalRenderer;
|
|
169
166
|
var Haskell_1 = require("./language/Haskell");
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
167
|
+
exports.HaskellTargetLanguage = Haskell_1.HaskellTargetLanguage;
|
|
168
|
+
exports.HaskellRenderer = Haskell_1.HaskellRenderer;
|
|
169
|
+
exports.haskellOptions = Haskell_1.haskellOptions;
|
|
173
170
|
var Dart_1 = require("./language/Dart");
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
171
|
+
exports.DartTargetLanguage = Dart_1.DartTargetLanguage;
|
|
172
|
+
exports.DartRenderer = Dart_1.DartRenderer;
|
|
173
|
+
exports.dartOptions = Dart_1.dartOptions;
|
|
@@ -13,10 +13,10 @@ export declare enum Tag {
|
|
|
13
13
|
StringFormat = 9,
|
|
14
14
|
TransformedString = 10
|
|
15
15
|
}
|
|
16
|
-
export type Value = number;
|
|
16
|
+
export declare type Value = number;
|
|
17
17
|
export declare function makeValue(t: Tag, index: number): Value;
|
|
18
18
|
export declare function valueTag(v: Value): Tag;
|
|
19
|
-
type Context = {
|
|
19
|
+
declare type Context = {
|
|
20
20
|
currentObject: Value[] | undefined;
|
|
21
21
|
currentArray: Value[] | undefined;
|
|
22
22
|
currentKey: string | undefined;
|
|
@@ -36,15 +36,15 @@ export declare abstract class CompressedJSON<T> {
|
|
|
36
36
|
abstract parse(input: T): Promise<Value>;
|
|
37
37
|
parseSync(_input: T): Value;
|
|
38
38
|
getStringForValue(v: Value): string;
|
|
39
|
-
getObjectForValue: (v:
|
|
40
|
-
getArrayForValue: (v:
|
|
39
|
+
getObjectForValue: (v: number) => number[];
|
|
40
|
+
getArrayForValue: (v: number) => number[];
|
|
41
41
|
getStringFormatTypeKind(v: Value): TransformedStringTypeKind;
|
|
42
|
-
protected
|
|
42
|
+
protected readonly context: Context;
|
|
43
43
|
protected internString(s: string): number;
|
|
44
44
|
protected makeString(s: string): Value;
|
|
45
45
|
protected internObject(obj: Value[]): Value;
|
|
46
|
-
protected internArray: (arr:
|
|
47
|
-
protected
|
|
46
|
+
protected internArray: (arr: number[]) => number;
|
|
47
|
+
protected readonly isExpectingRef: boolean;
|
|
48
48
|
protected commitValue(value: Value): void;
|
|
49
49
|
protected commitNull(): void;
|
|
50
50
|
protected commitBoolean(v: boolean): void;
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
2
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CompressedJSONFromString = exports.CompressedJSON = exports.valueTag = exports.makeValue = exports.Tag = void 0;
|
|
4
11
|
const collection_utils_1 = require("collection-utils");
|
|
5
12
|
const Support_1 = require("../support/Support");
|
|
6
13
|
const Type_1 = require("../Type");
|
|
@@ -26,7 +33,7 @@ function makeValue(t, index) {
|
|
|
26
33
|
}
|
|
27
34
|
exports.makeValue = makeValue;
|
|
28
35
|
function getIndex(v, tag) {
|
|
29
|
-
|
|
36
|
+
Support_1.assert(valueTag(v) === tag, "Trying to get index for value with invalid tag");
|
|
30
37
|
return v >> TAG_BITS;
|
|
31
38
|
}
|
|
32
39
|
function valueTag(v) {
|
|
@@ -34,42 +41,43 @@ function valueTag(v) {
|
|
|
34
41
|
}
|
|
35
42
|
exports.valueTag = valueTag;
|
|
36
43
|
class CompressedJSON {
|
|
37
|
-
dateTimeRecognizer;
|
|
38
|
-
handleRefs;
|
|
39
|
-
_rootValue;
|
|
40
|
-
_ctx;
|
|
41
|
-
_contextStack = [];
|
|
42
|
-
_strings = [];
|
|
43
|
-
_stringIndexes = {};
|
|
44
|
-
_objects = [];
|
|
45
|
-
_arrays = [];
|
|
46
44
|
constructor(dateTimeRecognizer, handleRefs) {
|
|
47
45
|
this.dateTimeRecognizer = dateTimeRecognizer;
|
|
48
46
|
this.handleRefs = handleRefs;
|
|
47
|
+
this._contextStack = [];
|
|
48
|
+
this._strings = [];
|
|
49
|
+
this._stringIndexes = {};
|
|
50
|
+
this._objects = [];
|
|
51
|
+
this._arrays = [];
|
|
52
|
+
this.getObjectForValue = (v) => {
|
|
53
|
+
return this._objects[getIndex(v, Tag.Object)];
|
|
54
|
+
};
|
|
55
|
+
this.getArrayForValue = (v) => {
|
|
56
|
+
return this._arrays[getIndex(v, Tag.Array)];
|
|
57
|
+
};
|
|
58
|
+
this.internArray = (arr) => {
|
|
59
|
+
const index = this._arrays.length;
|
|
60
|
+
this._arrays.push(arr);
|
|
61
|
+
return makeValue(Tag.Array, index);
|
|
62
|
+
};
|
|
49
63
|
}
|
|
50
64
|
parseSync(_input) {
|
|
51
|
-
return
|
|
65
|
+
return Support_1.panic("parseSync not implemented in CompressedJSON");
|
|
52
66
|
}
|
|
53
67
|
getStringForValue(v) {
|
|
54
68
|
const tag = valueTag(v);
|
|
55
|
-
|
|
69
|
+
Support_1.assert(tag === Tag.InternedString || tag === Tag.TransformedString);
|
|
56
70
|
return this._strings[getIndex(v, tag)];
|
|
57
71
|
}
|
|
58
|
-
getObjectForValue = (v) => {
|
|
59
|
-
return this._objects[getIndex(v, Tag.Object)];
|
|
60
|
-
};
|
|
61
|
-
getArrayForValue = (v) => {
|
|
62
|
-
return this._arrays[getIndex(v, Tag.Array)];
|
|
63
|
-
};
|
|
64
72
|
getStringFormatTypeKind(v) {
|
|
65
73
|
const kind = this._strings[getIndex(v, Tag.StringFormat)];
|
|
66
|
-
if (!
|
|
67
|
-
return
|
|
74
|
+
if (!Type_1.isPrimitiveStringTypeKind(kind) || kind === "string") {
|
|
75
|
+
return Support_1.panic("Not a transformed string type kind");
|
|
68
76
|
}
|
|
69
77
|
return kind;
|
|
70
78
|
}
|
|
71
79
|
get context() {
|
|
72
|
-
return
|
|
80
|
+
return Support_1.defined(this._ctx);
|
|
73
81
|
}
|
|
74
82
|
internString(s) {
|
|
75
83
|
if (Object.prototype.hasOwnProperty.call(this._stringIndexes, s)) {
|
|
@@ -82,7 +90,7 @@ class CompressedJSON {
|
|
|
82
90
|
}
|
|
83
91
|
makeString(s) {
|
|
84
92
|
const value = makeValue(Tag.InternedString, this.internString(s));
|
|
85
|
-
|
|
93
|
+
Support_1.assert(typeof value === "number", `Interned string value is not a number: ${value}`);
|
|
86
94
|
return value;
|
|
87
95
|
}
|
|
88
96
|
internObject(obj) {
|
|
@@ -90,23 +98,18 @@ class CompressedJSON {
|
|
|
90
98
|
this._objects.push(obj);
|
|
91
99
|
return makeValue(Tag.Object, index);
|
|
92
100
|
}
|
|
93
|
-
internArray = (arr) => {
|
|
94
|
-
const index = this._arrays.length;
|
|
95
|
-
this._arrays.push(arr);
|
|
96
|
-
return makeValue(Tag.Array, index);
|
|
97
|
-
};
|
|
98
101
|
get isExpectingRef() {
|
|
99
102
|
return this._ctx !== undefined && this._ctx.currentKey === "$ref";
|
|
100
103
|
}
|
|
101
104
|
commitValue(value) {
|
|
102
|
-
|
|
105
|
+
Support_1.assert(typeof value === "number", `CompressedJSON value is not a number: ${value}`);
|
|
103
106
|
if (this._ctx === undefined) {
|
|
104
|
-
|
|
107
|
+
Support_1.assert(this._rootValue === undefined, "Committing value but nowhere to commit to - root value still there.");
|
|
105
108
|
this._rootValue = value;
|
|
106
109
|
}
|
|
107
110
|
else if (this._ctx.currentObject !== undefined) {
|
|
108
111
|
if (this._ctx.currentKey === undefined) {
|
|
109
|
-
return
|
|
112
|
+
return Support_1.panic("Must have key and can't have string when committing");
|
|
110
113
|
}
|
|
111
114
|
this._ctx.currentObject.push(this.makeString(this._ctx.currentKey), value);
|
|
112
115
|
this._ctx.currentKey = undefined;
|
|
@@ -115,7 +118,7 @@ class CompressedJSON {
|
|
|
115
118
|
this._ctx.currentArray.push(value);
|
|
116
119
|
}
|
|
117
120
|
else {
|
|
118
|
-
return
|
|
121
|
+
return Support_1.panic("Committing value but nowhere to commit to");
|
|
119
122
|
}
|
|
120
123
|
}
|
|
121
124
|
commitNull() {
|
|
@@ -134,9 +137,9 @@ class CompressedJSON {
|
|
|
134
137
|
value = this.makeString(s);
|
|
135
138
|
}
|
|
136
139
|
else {
|
|
137
|
-
const format =
|
|
140
|
+
const format = StringTypes_1.inferTransformedStringTypeKindForString(s, this.dateTimeRecognizer);
|
|
138
141
|
if (format !== undefined) {
|
|
139
|
-
if (
|
|
142
|
+
if (Support_1.defined(Type_1.transformedStringTypeTargetTypeKindsMap.get(format)).attributesProducer !== undefined) {
|
|
140
143
|
value = makeValue(Tag.TransformedString, this.internString(s));
|
|
141
144
|
}
|
|
142
145
|
else {
|
|
@@ -155,9 +158,9 @@ class CompressedJSON {
|
|
|
155
158
|
finish() {
|
|
156
159
|
const value = this._rootValue;
|
|
157
160
|
if (value === undefined) {
|
|
158
|
-
return
|
|
161
|
+
return Support_1.panic("Finished without root document");
|
|
159
162
|
}
|
|
160
|
-
|
|
163
|
+
Support_1.assert(this._ctx === undefined && this._contextStack.length === 0, "Finished with contexts present");
|
|
161
164
|
this._rootValue = undefined;
|
|
162
165
|
return value;
|
|
163
166
|
}
|
|
@@ -174,7 +177,7 @@ class CompressedJSON {
|
|
|
174
177
|
}
|
|
175
178
|
pushObjectContext() {
|
|
176
179
|
this.pushContext();
|
|
177
|
-
|
|
180
|
+
Support_1.defined(this._ctx).currentObject = [];
|
|
178
181
|
}
|
|
179
182
|
setPropertyKey(key) {
|
|
180
183
|
const ctx = this.context;
|
|
@@ -183,25 +186,25 @@ class CompressedJSON {
|
|
|
183
186
|
finishObject() {
|
|
184
187
|
const obj = this.context.currentObject;
|
|
185
188
|
if (obj === undefined) {
|
|
186
|
-
return
|
|
189
|
+
return Support_1.panic("Object ended but not started");
|
|
187
190
|
}
|
|
188
191
|
this.popContext();
|
|
189
192
|
this.commitValue(this.internObject(obj));
|
|
190
193
|
}
|
|
191
194
|
pushArrayContext() {
|
|
192
195
|
this.pushContext();
|
|
193
|
-
|
|
196
|
+
Support_1.defined(this._ctx).currentArray = [];
|
|
194
197
|
}
|
|
195
198
|
finishArray() {
|
|
196
199
|
const arr = this.context.currentArray;
|
|
197
200
|
if (arr === undefined) {
|
|
198
|
-
return
|
|
201
|
+
return Support_1.panic("Array ended but not started");
|
|
199
202
|
}
|
|
200
203
|
this.popContext();
|
|
201
204
|
this.commitValue(this.internArray(arr));
|
|
202
205
|
}
|
|
203
206
|
popContext() {
|
|
204
|
-
|
|
207
|
+
Support_1.assert(this._ctx !== undefined, "Popping context when there isn't one");
|
|
205
208
|
this._ctx = this._contextStack.pop();
|
|
206
209
|
}
|
|
207
210
|
equals(other) {
|
|
@@ -210,20 +213,20 @@ class CompressedJSON {
|
|
|
210
213
|
hashCode() {
|
|
211
214
|
let hashAccumulator = collection_utils_1.hashCodeInit;
|
|
212
215
|
for (const s of this._strings) {
|
|
213
|
-
hashAccumulator =
|
|
216
|
+
hashAccumulator = collection_utils_1.addHashCode(hashAccumulator, collection_utils_1.hashString(s));
|
|
214
217
|
}
|
|
215
218
|
for (const s of Object.getOwnPropertyNames(this._stringIndexes).sort()) {
|
|
216
|
-
hashAccumulator =
|
|
217
|
-
hashAccumulator =
|
|
219
|
+
hashAccumulator = collection_utils_1.addHashCode(hashAccumulator, collection_utils_1.hashString(s));
|
|
220
|
+
hashAccumulator = collection_utils_1.addHashCode(hashAccumulator, this._stringIndexes[s]);
|
|
218
221
|
}
|
|
219
222
|
for (const o of this._objects) {
|
|
220
223
|
for (const v of o) {
|
|
221
|
-
hashAccumulator =
|
|
224
|
+
hashAccumulator = collection_utils_1.addHashCode(hashAccumulator, v);
|
|
222
225
|
}
|
|
223
226
|
}
|
|
224
227
|
for (const o of this._arrays) {
|
|
225
228
|
for (const v of o) {
|
|
226
|
-
hashAccumulator =
|
|
229
|
+
hashAccumulator = collection_utils_1.addHashCode(hashAccumulator, v);
|
|
227
230
|
}
|
|
228
231
|
}
|
|
229
232
|
return hashAccumulator;
|
|
@@ -231,8 +234,10 @@ class CompressedJSON {
|
|
|
231
234
|
}
|
|
232
235
|
exports.CompressedJSON = CompressedJSON;
|
|
233
236
|
class CompressedJSONFromString extends CompressedJSON {
|
|
234
|
-
|
|
235
|
-
return this
|
|
237
|
+
parse(input) {
|
|
238
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
239
|
+
return this.parseSync(input);
|
|
240
|
+
});
|
|
236
241
|
}
|
|
237
242
|
parseSync(input) {
|
|
238
243
|
const json = JSON.parse(input);
|
|
@@ -269,7 +274,7 @@ class CompressedJSONFromString extends CompressedJSON {
|
|
|
269
274
|
this.finishObject();
|
|
270
275
|
}
|
|
271
276
|
else {
|
|
272
|
-
return
|
|
277
|
+
return Support_1.panic("Invalid JSON object");
|
|
273
278
|
}
|
|
274
279
|
}
|
|
275
280
|
}
|