quicktype 17.0.6 → 18.0.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 (139) hide show
  1. package/dist/cli/CompressedJSONFromStream.js +26 -38
  2. package/dist/cli/GraphQLIntrospection.js +33 -41
  3. package/dist/cli/TypeSource.d.ts +1 -1
  4. package/dist/cli/URLGrammar.js +4 -3
  5. package/dist/cli/index.js +363 -364
  6. package/dist/quicktype-core/Annotation.js +2 -0
  7. package/dist/quicktype-core/ConvenienceRenderer.d.ts +17 -17
  8. package/dist/quicktype-core/ConvenienceRenderer.js +104 -81
  9. package/dist/quicktype-core/DateTime.js +1 -0
  10. package/dist/quicktype-core/DeclarationIR.d.ts +1 -1
  11. package/dist/quicktype-core/DeclarationIR.js +13 -10
  12. package/dist/quicktype-core/EncodedMarkovChain.js +1 -0
  13. package/dist/quicktype-core/GatherNames.js +47 -25
  14. package/dist/quicktype-core/Graph.d.ts +2 -2
  15. package/dist/quicktype-core/Graph.js +23 -19
  16. package/dist/quicktype-core/GraphRewriting.d.ts +2 -2
  17. package/dist/quicktype-core/GraphRewriting.js +65 -54
  18. package/dist/quicktype-core/MakeTransformations.js +23 -22
  19. package/dist/quicktype-core/MarkovChain.d.ts +3 -3
  20. package/dist/quicktype-core/MarkovChain.js +9 -8
  21. package/dist/quicktype-core/Messages.d.ts +3 -3
  22. package/dist/quicktype-core/Messages.js +8 -3
  23. package/dist/quicktype-core/Naming.d.ts +11 -11
  24. package/dist/quicktype-core/Naming.js +76 -61
  25. package/dist/quicktype-core/Renderer.d.ts +6 -6
  26. package/dist/quicktype-core/Renderer.js +34 -17
  27. package/dist/quicktype-core/RendererOptions.d.ts +5 -5
  28. package/dist/quicktype-core/RendererOptions.js +6 -3
  29. package/dist/quicktype-core/Run.d.ts +9 -9
  30. package/dist/quicktype-core/Run.js +72 -67
  31. package/dist/quicktype-core/Source.d.ts +3 -3
  32. package/dist/quicktype-core/Source.js +19 -18
  33. package/dist/quicktype-core/TargetLanguage.d.ts +10 -10
  34. package/dist/quicktype-core/TargetLanguage.js +6 -2
  35. package/dist/quicktype-core/Transformers.d.ts +25 -25
  36. package/dist/quicktype-core/Transformers.js +94 -66
  37. package/dist/quicktype-core/Type.d.ts +41 -43
  38. package/dist/quicktype-core/Type.js +96 -71
  39. package/dist/quicktype-core/TypeBuilder.d.ts +2 -2
  40. package/dist/quicktype-core/TypeBuilder.js +53 -47
  41. package/dist/quicktype-core/TypeGraph.d.ts +4 -4
  42. package/dist/quicktype-core/TypeGraph.js +49 -40
  43. package/dist/quicktype-core/TypeUtils.d.ts +2 -2
  44. package/dist/quicktype-core/TypeUtils.js +23 -22
  45. package/dist/quicktype-core/UnifyClasses.js +16 -12
  46. package/dist/quicktype-core/UnionBuilder.d.ts +3 -3
  47. package/dist/quicktype-core/UnionBuilder.js +33 -30
  48. package/dist/quicktype-core/attributes/AccessorNames.d.ts +2 -2
  49. package/dist/quicktype-core/attributes/AccessorNames.js +18 -17
  50. package/dist/quicktype-core/attributes/Constraints.d.ts +3 -3
  51. package/dist/quicktype-core/attributes/Constraints.js +8 -4
  52. package/dist/quicktype-core/attributes/Description.js +6 -5
  53. package/dist/quicktype-core/attributes/EnumValues.js +4 -3
  54. package/dist/quicktype-core/attributes/StringTypes.d.ts +1 -1
  55. package/dist/quicktype-core/attributes/StringTypes.js +24 -21
  56. package/dist/quicktype-core/attributes/TypeAttributes.d.ts +3 -3
  57. package/dist/quicktype-core/attributes/TypeAttributes.js +12 -10
  58. package/dist/quicktype-core/attributes/TypeNames.d.ts +9 -9
  59. package/dist/quicktype-core/attributes/TypeNames.js +49 -21
  60. package/dist/quicktype-core/attributes/URIAttributes.d.ts +1 -1
  61. package/dist/quicktype-core/attributes/URIAttributes.js +10 -6
  62. package/dist/quicktype-core/index.js +128 -125
  63. package/dist/quicktype-core/input/CompressedJSON.d.ts +7 -7
  64. package/dist/quicktype-core/input/CompressedJSON.js +49 -54
  65. package/dist/quicktype-core/input/FetchingJSONSchemaStore.js +5 -13
  66. package/dist/quicktype-core/input/Inference.d.ts +2 -2
  67. package/dist/quicktype-core/input/Inference.js +25 -17
  68. package/dist/quicktype-core/input/Inputs.d.ts +2 -2
  69. package/dist/quicktype-core/input/Inputs.js +38 -54
  70. package/dist/quicktype-core/input/JSONSchemaInput.d.ts +11 -11
  71. package/dist/quicktype-core/input/JSONSchemaInput.js +503 -523
  72. package/dist/quicktype-core/input/JSONSchemaStore.d.ts +1 -1
  73. package/dist/quicktype-core/input/JSONSchemaStore.js +24 -35
  74. package/dist/quicktype-core/input/PostmanCollection.js +2 -1
  75. package/dist/quicktype-core/input/io/NodeIO.js +55 -44
  76. package/dist/quicktype-core/input/io/get-stream/index.js +6 -2
  77. package/dist/quicktype-core/language/All.js +3 -2
  78. package/dist/quicktype-core/language/CPlusPlus.d.ts +8 -8
  79. package/dist/quicktype-core/language/CPlusPlus.js +185 -151
  80. package/dist/quicktype-core/language/CSharp.d.ts +7 -7
  81. package/dist/quicktype-core/language/CSharp.js +82 -72
  82. package/dist/quicktype-core/language/Crystal.d.ts +2 -2
  83. package/dist/quicktype-core/language/Crystal.js +18 -17
  84. package/dist/quicktype-core/language/Dart.d.ts +4 -4
  85. package/dist/quicktype-core/language/Dart.js +36 -34
  86. package/dist/quicktype-core/language/Elm.d.ts +6 -6
  87. package/dist/quicktype-core/language/Elm.js +47 -45
  88. package/dist/quicktype-core/language/Golang.d.ts +4 -4
  89. package/dist/quicktype-core/language/Golang.js +23 -20
  90. package/dist/quicktype-core/language/Haskell.d.ts +5 -5
  91. package/dist/quicktype-core/language/Haskell.js +25 -23
  92. package/dist/quicktype-core/language/JSONSchema.d.ts +3 -3
  93. package/dist/quicktype-core/language/JSONSchema.js +17 -16
  94. package/dist/quicktype-core/language/Java.d.ts +2 -2
  95. package/dist/quicktype-core/language/Java.js +97 -97
  96. package/dist/quicktype-core/language/JavaScript.d.ts +7 -7
  97. package/dist/quicktype-core/language/JavaScript.js +20 -18
  98. package/dist/quicktype-core/language/JavaScriptPropTypes.js +15 -13
  99. package/dist/quicktype-core/language/JavaScriptUnicodeMaps.js +12 -11
  100. package/dist/quicktype-core/language/Kotlin.d.ts +2 -2
  101. package/dist/quicktype-core/language/Kotlin.js +39 -37
  102. package/dist/quicktype-core/language/Objective-C.d.ts +3 -3
  103. package/dist/quicktype-core/language/Objective-C.js +45 -41
  104. package/dist/quicktype-core/language/Php.d.ts +2 -2
  105. package/dist/quicktype-core/language/Php.js +66 -41
  106. package/dist/quicktype-core/language/Pike.d.ts +1 -1
  107. package/dist/quicktype-core/language/Pike.js +18 -17
  108. package/dist/quicktype-core/language/Python.d.ts +8 -8
  109. package/dist/quicktype-core/language/Python.js +63 -64
  110. package/dist/quicktype-core/language/Rust.d.ts +2 -2
  111. package/dist/quicktype-core/language/Rust.js +21 -19
  112. package/dist/quicktype-core/language/Swift.d.ts +7 -7
  113. package/dist/quicktype-core/language/Swift.js +568 -565
  114. package/dist/quicktype-core/language/TypeScriptFlow.d.ts +7 -7
  115. package/dist/quicktype-core/language/TypeScriptFlow.js +28 -26
  116. package/dist/quicktype-core/language/ruby/index.d.ts +4 -4
  117. package/dist/quicktype-core/language/ruby/index.js +49 -24
  118. package/dist/quicktype-core/language/ruby/keywords.js +1 -0
  119. package/dist/quicktype-core/rewrites/CombineClasses.js +9 -8
  120. package/dist/quicktype-core/rewrites/ExpandStrings.d.ts +1 -1
  121. package/dist/quicktype-core/rewrites/ExpandStrings.js +18 -17
  122. package/dist/quicktype-core/rewrites/FlattenStrings.js +7 -6
  123. package/dist/quicktype-core/rewrites/FlattenUnions.js +9 -8
  124. package/dist/quicktype-core/rewrites/InferMaps.js +11 -10
  125. package/dist/quicktype-core/rewrites/ReplaceObjectType.js +8 -7
  126. package/dist/quicktype-core/rewrites/ResolveIntersections.js +68 -67
  127. package/dist/quicktype-core/support/Acronyms.js +3 -1
  128. package/dist/quicktype-core/support/Chance.js +10 -0
  129. package/dist/quicktype-core/support/Converters.js +1 -0
  130. package/dist/quicktype-core/support/Strings.d.ts +4 -4
  131. package/dist/quicktype-core/support/Strings.js +17 -16
  132. package/dist/quicktype-core/support/Support.d.ts +1 -1
  133. package/dist/quicktype-core/support/Support.js +30 -6
  134. package/dist/quicktype-graphql-input/GraphQLSchema.d.ts +4 -4
  135. package/dist/quicktype-graphql-input/GraphQLSchema.js +1 -0
  136. package/dist/quicktype-graphql-input/index.d.ts +1 -1
  137. package/dist/quicktype-graphql-input/index.js +229 -212
  138. package/dist/quicktype-typescript-input/index.js +28 -4
  139. package/package.json +24 -20
@@ -1,9 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.nullTypeIssueAnnotation = exports.anyTypeIssueAnnotation = exports.IssueAnnotationData = exports.AnnotationData = void 0;
3
4
  class AnnotationData {
4
5
  }
5
6
  exports.AnnotationData = AnnotationData;
6
7
  class IssueAnnotationData extends AnnotationData {
8
+ message;
7
9
  constructor(message) {
8
10
  super();
9
11
  this.message = message;
@@ -7,7 +7,7 @@ import { Transformation } from "./Transformers";
7
7
  import { TargetLanguage } from "./TargetLanguage";
8
8
  export declare const topLevelNameOrder = 1;
9
9
  export declare const inferredNameOrder = 30;
10
- export declare type ForbiddenWordsInfo = {
10
+ export type ForbiddenWordsInfo = {
11
11
  names: (Name | string)[];
12
12
  includeGlobalForbidden: boolean;
13
13
  };
@@ -34,7 +34,7 @@ export declare abstract class ConvenienceRenderer extends Renderer {
34
34
  private _cycleBreakerTypes?;
35
35
  private _alphabetizeProperties;
36
36
  constructor(targetLanguage: TargetLanguage, renderContext: RenderContext);
37
- readonly topLevels: ReadonlyMap<string, Type>;
37
+ get topLevels(): ReadonlyMap<string, Type>;
38
38
  /**
39
39
  * Return an array of strings which are not allowed as names in the global
40
40
  * namespace. Since names of generated types are in the global namespace,
@@ -65,13 +65,13 @@ export declare abstract class ConvenienceRenderer extends Renderer {
65
65
  protected abstract emitSourceStructure(givenOutputFilename: string): void;
66
66
  protected makeNameForTransformation(_xf: Transformation, _typeName: Name | undefined): Name | undefined;
67
67
  protected namedTypeToNameForTopLevel(type: Type): Type | undefined;
68
- protected readonly unionMembersInGlobalNamespace: boolean;
69
- protected readonly enumCasesInGlobalNamespace: boolean;
70
- protected readonly needsTypeDeclarationBeforeUse: boolean;
68
+ protected get unionMembersInGlobalNamespace(): boolean;
69
+ protected get enumCasesInGlobalNamespace(): boolean;
70
+ protected get needsTypeDeclarationBeforeUse(): boolean;
71
71
  protected canBeForwardDeclared(_t: Type): boolean;
72
72
  protected unionNeedsName(u: UnionType): boolean;
73
- private readonly globalNamespace;
74
- private readonly nameStoreView;
73
+ private get globalNamespace();
74
+ private get nameStoreView();
75
75
  protected descriptionForType(t: Type): string[] | undefined;
76
76
  protected descriptionForClassProperty(o: ObjectType, name: string): string[] | undefined;
77
77
  protected setUpNaming(): ReadonlySet<Namespace>;
@@ -81,7 +81,7 @@ export declare abstract class ConvenienceRenderer extends Renderer {
81
81
  private makeNameForType;
82
82
  protected makeNameForNamedType(t: Type): Name;
83
83
  private addNameForNamedType;
84
- protected readonly typesWithNamedTransformations: ReadonlyMap<Type, Name>;
84
+ protected get typesWithNamedTransformations(): ReadonlyMap<Type, Name>;
85
85
  protected nameForTransformation(t: Type): Name | undefined;
86
86
  private addNameForTransformation;
87
87
  private processForbiddenWordsInfo;
@@ -93,14 +93,14 @@ export declare abstract class ConvenienceRenderer extends Renderer {
93
93
  protected makeNameForEnumCase(e: EnumType, _enumName: Name, caseName: string, assignedName: string | undefined): Name;
94
94
  private addEnumCaseNames;
95
95
  private childrenOfType;
96
- protected readonly namedUnions: ReadonlySet<UnionType>;
97
- protected readonly haveNamedUnions: boolean;
98
- protected readonly haveNamedTypes: boolean;
99
- protected readonly haveUnions: boolean;
100
- protected readonly haveMaps: boolean;
101
- protected readonly haveOptionalProperties: boolean;
102
- protected readonly enums: ReadonlySet<EnumType>;
103
- protected readonly haveEnums: boolean;
96
+ protected get namedUnions(): ReadonlySet<UnionType>;
97
+ protected get haveNamedUnions(): boolean;
98
+ protected get haveNamedTypes(): boolean;
99
+ protected get haveUnions(): boolean;
100
+ protected get haveMaps(): boolean;
101
+ protected get haveOptionalProperties(): boolean;
102
+ protected get enums(): ReadonlySet<EnumType>;
103
+ protected get haveEnums(): boolean;
104
104
  protected proposedUnionMemberNameForTypeKind(_kind: TypeKind): string | null;
105
105
  protected proposeUnionMemberName(_u: UnionType, _unionName: Name, fieldType: Type, lookup: (n: Name) => string): string;
106
106
  protected nameForNamedType(t: Type): Name;
@@ -127,7 +127,7 @@ export declare abstract class ConvenienceRenderer extends Renderer {
127
127
  protected forEachUniqueUnion<T>(blankLocations: BlankLineConfig, uniqueValue: (u: UnionType) => T, f: (firstUnion: UnionType, value: T, position: ForEachPosition) => void): void;
128
128
  protected forEachNamedType(blankLocations: BlankLineConfig, objectFunc: ((c: ClassType, className: Name, position: ForEachPosition) => void) | ((o: ObjectType, objectName: Name, position: ForEachPosition) => void), enumFunc: (e: EnumType, enumName: Name, position: ForEachPosition) => void, unionFunc: (u: UnionType, unionName: Name, position: ForEachPosition) => void): void;
129
129
  protected sourcelikeToString(src: Sourcelike): string;
130
- protected readonly commentLineStart: string;
130
+ protected get commentLineStart(): string;
131
131
  protected emitCommentLines(lines: Sourcelike[], lineStart?: string, beforeLine?: string, afterLine?: string, firstLineStart?: string): void;
132
132
  protected emitDescription(description: Sourcelike[] | undefined): void;
133
133
  protected emitDescriptionBlock(lines: Sourcelike[]): void;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ConvenienceRenderer = exports.inferredNameOrder = exports.topLevelNameOrder = void 0;
3
4
  const collection_utils_1 = require("collection-utils");
4
5
  const Type_1 = require("./Type");
5
6
  const TypeUtils_1 = require("./TypeUtils");
@@ -38,9 +39,31 @@ const assignedPropertyNamesAttributeKind = new TypeAttributes_1.TypeAttributeKin
38
39
  const assignedMemberNamesAttributeKind = new TypeAttributes_1.TypeAttributeKind("assignedMemberNames");
39
40
  const assignedCaseNamesAttributeKind = new TypeAttributes_1.TypeAttributeKind("assignedCaseNames");
40
41
  class ConvenienceRenderer extends Renderer_1.Renderer {
42
+ _globalForbiddenNamespace;
43
+ _otherForbiddenNamespaces;
44
+ _globalNamespace;
45
+ _nameStoreView;
46
+ _propertyNamesStoreView;
47
+ _memberNamesStoreView;
48
+ _caseNamesStoreView;
49
+ _namesForTransformations;
50
+ _namedTypeNamer;
51
+ // @ts-ignore: FIXME: Make this `Namer | undefined`
52
+ _unionMemberNamer;
53
+ // @ts-ignore: FIXME: Make this `Namer | undefined`
54
+ _enumCaseNamer;
55
+ _declarationIR;
56
+ _namedTypes;
57
+ _namedObjects;
58
+ _namedEnums;
59
+ _namedUnions;
60
+ _haveUnions;
61
+ _haveMaps;
62
+ _haveOptionalProperties;
63
+ _cycleBreakerTypes;
64
+ _alphabetizeProperties = false;
41
65
  constructor(targetLanguage, renderContext) {
42
66
  super(targetLanguage, renderContext);
43
- this._alphabetizeProperties = false;
44
67
  }
45
68
  get topLevels() {
46
69
  return this.typeGraph.topLevels;
@@ -84,7 +107,7 @@ class ConvenienceRenderer extends Renderer_1.Renderer {
84
107
  return undefined;
85
108
  }
86
109
  namedTypeToNameForTopLevel(type) {
87
- if (TypeUtils_1.isNamedType(type)) {
110
+ if ((0, TypeUtils_1.isNamedType)(type)) {
88
111
  return type;
89
112
  }
90
113
  return undefined;
@@ -99,16 +122,16 @@ class ConvenienceRenderer extends Renderer_1.Renderer {
99
122
  return false;
100
123
  }
101
124
  canBeForwardDeclared(_t) {
102
- return Support_1.panic("If needsTypeDeclarationBeforeUse returns true, canBeForwardDeclared must be implemented");
125
+ return (0, Support_1.panic)("If needsTypeDeclarationBeforeUse returns true, canBeForwardDeclared must be implemented");
103
126
  }
104
127
  unionNeedsName(u) {
105
- return TypeUtils_1.nullableFromUnion(u) === null;
128
+ return (0, TypeUtils_1.nullableFromUnion)(u) === null;
106
129
  }
107
130
  get globalNamespace() {
108
- return Support_1.defined(this._globalNamespace);
131
+ return (0, Support_1.defined)(this._globalNamespace);
109
132
  }
110
133
  get nameStoreView() {
111
- return Support_1.defined(this._nameStoreView);
134
+ return (0, Support_1.defined)(this._nameStoreView);
112
135
  }
113
136
  descriptionForType(t) {
114
137
  let description = this.typeGraph.attributeStore.tryGet(Description_1.descriptionTypeAttributeKind, t);
@@ -129,11 +152,11 @@ class ConvenienceRenderer extends Renderer_1.Renderer {
129
152
  this._namedTypeNamer = this.makeNamedTypeNamer();
130
153
  this._unionMemberNamer = this.makeUnionMemberNamer();
131
154
  this._enumCaseNamer = this.makeEnumCaseNamer();
132
- this._globalForbiddenNamespace = Naming_1.keywordNamespace("forbidden", this.forbiddenNamesForGlobalNamespace());
155
+ this._globalForbiddenNamespace = (0, Naming_1.keywordNamespace)("forbidden", this.forbiddenNamesForGlobalNamespace());
133
156
  this._otherForbiddenNamespaces = new Map();
134
157
  this._globalNamespace = new Naming_1.Namespace("global", undefined, [this._globalForbiddenNamespace], []);
135
158
  const { objects, enums, unions } = this.typeGraph.allNamedTypesSeparated();
136
- const namedUnions = collection_utils_1.setFilter(unions, u => this.unionNeedsName(u));
159
+ const namedUnions = (0, collection_utils_1.setFilter)(unions, u => this.unionNeedsName(u));
137
160
  for (const [name, t] of this.topLevels) {
138
161
  this.nameStoreView.setForTopLevel(name, this.addNameForTopLevel(t, name));
139
162
  }
@@ -152,7 +175,7 @@ class ConvenienceRenderer extends Renderer_1.Renderer {
152
175
  for (const t of this.typeGraph.allTypesUnordered()) {
153
176
  this.addNameForTransformation(t);
154
177
  }
155
- return collection_utils_1.setUnion([this._globalForbiddenNamespace, this._globalNamespace], this._otherForbiddenNamespaces.values());
178
+ return (0, collection_utils_1.setUnion)([this._globalForbiddenNamespace, this._globalNamespace], this._otherForbiddenNamespaces.values());
156
179
  }
157
180
  addDependenciesForNamedType(type, named) {
158
181
  const dependencyNames = this.makeNamedTypeDependencyNames(type, named);
@@ -161,7 +184,7 @@ class ConvenienceRenderer extends Renderer_1.Renderer {
161
184
  }
162
185
  }
163
186
  makeNameForTopLevel(_t, givenName, _maybeNamedType) {
164
- return new Naming_1.SimpleName([givenName], Support_1.defined(this._namedTypeNamer), exports.topLevelNameOrder);
187
+ return new Naming_1.SimpleName([givenName], (0, Support_1.defined)(this._namedTypeNamer), exports.topLevelNameOrder);
165
188
  }
166
189
  addNameForTopLevel(type, givenName) {
167
190
  const maybeNamedType = this.namedTypeToNameForTopLevel(type);
@@ -183,7 +206,7 @@ class ConvenienceRenderer extends Renderer_1.Renderer {
183
206
  return new Naming_1.SimpleName(names.proposedNames, namer, order);
184
207
  }
185
208
  makeNameForNamedType(t) {
186
- return this.makeNameForType(t, Support_1.defined(this._namedTypeNamer), givenNameOrder, exports.inferredNameOrder);
209
+ return this.makeNameForType(t, (0, Support_1.defined)(this._namedTypeNamer), givenNameOrder, exports.inferredNameOrder);
187
210
  }
188
211
  addNameForNamedType(type) {
189
212
  const existing = this.nameStoreView.tryGet(type);
@@ -195,28 +218,28 @@ class ConvenienceRenderer extends Renderer_1.Renderer {
195
218
  return name;
196
219
  }
197
220
  get typesWithNamedTransformations() {
198
- return Support_1.defined(this._namesForTransformations);
221
+ return (0, Support_1.defined)(this._namesForTransformations);
199
222
  }
200
223
  nameForTransformation(t) {
201
- const xf = Transformers_1.transformationForType(t);
224
+ const xf = (0, Transformers_1.transformationForType)(t);
202
225
  if (xf === undefined)
203
226
  return undefined;
204
- const name = Support_1.defined(this._namesForTransformations).get(t);
227
+ const name = (0, Support_1.defined)(this._namesForTransformations).get(t);
205
228
  if (name === undefined) {
206
- return Support_1.panic("No name for transformation");
229
+ return (0, Support_1.panic)("No name for transformation");
207
230
  }
208
231
  return name;
209
232
  }
210
233
  addNameForTransformation(t) {
211
- const xf = Transformers_1.transformationForType(t);
234
+ const xf = (0, Transformers_1.transformationForType)(t);
212
235
  if (xf === undefined)
213
236
  return;
214
- Support_1.assert(Support_1.defined(this._namesForTransformations).get(t) === undefined, "Tried to give two names to the same transformation");
237
+ (0, Support_1.assert)((0, Support_1.defined)(this._namesForTransformations).get(t) === undefined, "Tried to give two names to the same transformation");
215
238
  const name = this.makeNameForTransformation(xf, this.nameStoreView.tryGet(xf.targetType));
216
239
  if (name === undefined)
217
240
  return;
218
241
  this.globalNamespace.add(name);
219
- Support_1.defined(this._namesForTransformations).set(t, name);
242
+ (0, Support_1.defined)(this._namesForTransformations).set(t, name);
220
243
  }
221
244
  processForbiddenWordsInfo(info, namespaceName) {
222
245
  const forbiddenNames = [];
@@ -229,14 +252,14 @@ class ConvenienceRenderer extends Renderer_1.Renderer {
229
252
  forbiddenNames.push(nameOrString);
230
253
  }
231
254
  }
232
- let namespace = Support_1.defined(this._otherForbiddenNamespaces).get(namespaceName);
255
+ let namespace = (0, Support_1.defined)(this._otherForbiddenNamespaces).get(namespaceName);
233
256
  if (forbiddenStrings.length > 0 && namespace === undefined) {
234
- namespace = Naming_1.keywordNamespace(namespaceName, forbiddenStrings);
235
- this._otherForbiddenNamespaces = Support_1.defined(this._otherForbiddenNamespaces).set(namespaceName, namespace);
257
+ namespace = (0, Naming_1.keywordNamespace)(namespaceName, forbiddenStrings);
258
+ this._otherForbiddenNamespaces = (0, Support_1.defined)(this._otherForbiddenNamespaces).set(namespaceName, namespace);
236
259
  }
237
260
  let forbiddenNamespaces = new Set();
238
261
  if (info.includeGlobalForbidden) {
239
- forbiddenNamespaces = forbiddenNamespaces.add(Support_1.defined(this._globalForbiddenNamespace));
262
+ forbiddenNamespaces = forbiddenNamespaces.add((0, Support_1.defined)(this._globalForbiddenNamespace));
240
263
  }
241
264
  if (namespace !== undefined) {
242
265
  forbiddenNamespaces = forbiddenNamespaces.add(namespace);
@@ -267,12 +290,12 @@ class ConvenienceRenderer extends Renderer_1.Renderer {
267
290
  addPropertyNames(o, className) {
268
291
  const { forbiddenNames, forbiddenNamespaces } = this.processForbiddenWordsInfo(this.forbiddenForObjectProperties(o, className), "forbidden-for-properties");
269
292
  let ns;
270
- const accessorNames = AccessorNames_1.objectPropertyNames(o, this.targetLanguage.name);
271
- const names = collection_utils_1.mapFilterMap(o.getSortedProperties(), (p, jsonName) => {
272
- const [assignedName, isFixed] = AccessorNames_1.getAccessorName(accessorNames, jsonName);
293
+ const accessorNames = (0, AccessorNames_1.objectPropertyNames)(o, this.targetLanguage.name);
294
+ const names = (0, collection_utils_1.mapFilterMap)(o.getSortedProperties(), (p, jsonName) => {
295
+ const [assignedName, isFixed] = (0, AccessorNames_1.getAccessorName)(accessorNames, jsonName);
273
296
  let name;
274
297
  if (isFixed) {
275
- name = new Naming_1.FixedName(Support_1.defined(assignedName));
298
+ name = new Naming_1.FixedName((0, Support_1.defined)(assignedName));
276
299
  }
277
300
  else {
278
301
  name = this.makeNameForProperty(o, className, p, jsonName, assignedName);
@@ -288,14 +311,14 @@ class ConvenienceRenderer extends Renderer_1.Renderer {
288
311
  }
289
312
  return name;
290
313
  });
291
- Support_1.defined(this._propertyNamesStoreView).set(o, names);
314
+ (0, Support_1.defined)(this._propertyNamesStoreView).set(o, names);
292
315
  }
293
316
  makeNameForUnionMember(u, unionName, t) {
294
- const [assignedName, isFixed] = AccessorNames_1.unionMemberName(u, t, this.targetLanguage.name);
317
+ const [assignedName, isFixed] = (0, AccessorNames_1.unionMemberName)(u, t, this.targetLanguage.name);
295
318
  if (isFixed) {
296
- return new Naming_1.FixedName(Support_1.defined(assignedName));
319
+ return new Naming_1.FixedName((0, Support_1.defined)(assignedName));
297
320
  }
298
- return new Naming_1.DependencyName(Support_1.nonNull(this._unionMemberNamer), unionMemberNameOrder, lookup => {
321
+ return new Naming_1.DependencyName((0, Support_1.nonNull)(this._unionMemberNamer), unionMemberNameOrder, lookup => {
299
322
  if (assignedName !== undefined)
300
323
  return assignedName;
301
324
  return this.proposeUnionMemberName(u, unionName, t, lookup);
@@ -315,10 +338,10 @@ class ConvenienceRenderer extends Renderer_1.Renderer {
315
338
  }
316
339
  let names = new Map();
317
340
  for (const t of u.members) {
318
- const name = this.makeNameForUnionMember(u, unionName, Transformers_1.followTargetType(t));
341
+ const name = this.makeNameForUnionMember(u, unionName, (0, Transformers_1.followTargetType)(t));
319
342
  names.set(t, ns.add(name));
320
343
  }
321
- Support_1.defined(this._memberNamesStoreView).set(u, names);
344
+ (0, Support_1.defined)(this._memberNamesStoreView).set(u, names);
322
345
  }
323
346
  makeNameForEnumCase(e, _enumName, caseName, assignedName) {
324
347
  // FIXME: See the FIXME in `makeNameForProperty`. We do have global
@@ -326,7 +349,7 @@ class ConvenienceRenderer extends Renderer_1.Renderer {
326
349
  const alternative = `${e.getCombinedName()}_${caseName}`;
327
350
  const order = assignedName === undefined ? enumCaseNameOrder : assignedEnumCaseNameOrder;
328
351
  const names = assignedName === undefined ? [caseName, alternative] : [assignedName];
329
- return new Naming_1.SimpleName(names, Support_1.nonNull(this._enumCaseNamer), order);
352
+ return new Naming_1.SimpleName(names, (0, Support_1.nonNull)(this._enumCaseNamer), order);
330
353
  }
331
354
  // FIXME: this is very similar to addPropertyNameds and addUnionMemberNames
332
355
  addEnumCaseNames(e, enumName) {
@@ -341,56 +364,56 @@ class ConvenienceRenderer extends Renderer_1.Renderer {
341
364
  ns = new Naming_1.Namespace(e.getCombinedName(), this.globalNamespace, forbiddenNamespaces, forbiddenNames);
342
365
  }
343
366
  let names = new Map();
344
- const accessorNames = AccessorNames_1.enumCaseNames(e, this.targetLanguage.name);
367
+ const accessorNames = (0, AccessorNames_1.enumCaseNames)(e, this.targetLanguage.name);
345
368
  for (const caseName of e.cases) {
346
- const [assignedName, isFixed] = AccessorNames_1.getAccessorName(accessorNames, caseName);
369
+ const [assignedName, isFixed] = (0, AccessorNames_1.getAccessorName)(accessorNames, caseName);
347
370
  let name;
348
371
  if (isFixed) {
349
- name = new Naming_1.FixedName(Support_1.defined(assignedName));
372
+ name = new Naming_1.FixedName((0, Support_1.defined)(assignedName));
350
373
  }
351
374
  else {
352
375
  name = this.makeNameForEnumCase(e, enumName, caseName, assignedName);
353
376
  }
354
377
  names.set(caseName, ns.add(name));
355
378
  }
356
- Support_1.defined(this._caseNamesStoreView).set(e, names);
379
+ (0, Support_1.defined)(this._caseNamesStoreView).set(e, names);
357
380
  }
358
381
  childrenOfType(t) {
359
382
  const names = this.names;
360
383
  if (t instanceof Type_1.ClassType) {
361
- const propertyNameds = Support_1.defined(this._propertyNamesStoreView).get(t);
362
- const filteredMap = collection_utils_1.mapFilterMap(t.getProperties(), (p, n) => {
384
+ const propertyNameds = (0, Support_1.defined)(this._propertyNamesStoreView).get(t);
385
+ const filteredMap = (0, collection_utils_1.mapFilterMap)(t.getProperties(), (p, n) => {
363
386
  if (propertyNameds.get(n) === undefined)
364
387
  return undefined;
365
388
  return p.type;
366
389
  });
367
- const sortedMap = collection_utils_1.mapSortBy(filteredMap, (_, n) => Support_1.defined(names.get(Support_1.defined(propertyNameds.get(n)))));
390
+ const sortedMap = (0, collection_utils_1.mapSortBy)(filteredMap, (_, n) => (0, Support_1.defined)(names.get((0, Support_1.defined)(propertyNameds.get(n)))));
368
391
  return new Set(sortedMap.values());
369
392
  }
370
393
  return t.getChildren();
371
394
  }
372
395
  get namedUnions() {
373
- return Support_1.defined(this._namedUnions);
396
+ return (0, Support_1.defined)(this._namedUnions);
374
397
  }
375
398
  get haveNamedUnions() {
376
399
  return this.namedUnions.size > 0;
377
400
  }
378
401
  get haveNamedTypes() {
379
- return Support_1.defined(this._namedTypes).length > 0;
402
+ return (0, Support_1.defined)(this._namedTypes).length > 0;
380
403
  }
381
404
  get haveUnions() {
382
- return Support_1.defined(this._haveUnions);
405
+ return (0, Support_1.defined)(this._haveUnions);
383
406
  }
384
407
  get haveMaps() {
385
- return Support_1.defined(this._haveMaps);
408
+ return (0, Support_1.defined)(this._haveMaps);
386
409
  }
387
410
  get haveOptionalProperties() {
388
- return Support_1.defined(this._haveOptionalProperties);
411
+ return (0, Support_1.defined)(this._haveOptionalProperties);
389
412
  }
390
413
  // FIXME: Inconsistently named, though technically correct. Right now all enums are named,
391
414
  // but this should really be called `namedEnums`.
392
415
  get enums() {
393
- return Support_1.defined(this._namedEnums);
416
+ return (0, Support_1.defined)(this._namedEnums);
394
417
  }
395
418
  get haveEnums() {
396
419
  return this.enums.size > 0;
@@ -403,10 +426,10 @@ class ConvenienceRenderer extends Renderer_1.Renderer {
403
426
  if (simpleName !== null) {
404
427
  return simpleName;
405
428
  }
406
- const typeNameForUnionMember = (t) => TypeUtils_1.matchTypeExhaustive(t, _noneType => {
407
- return Support_1.panic("none type should have been replaced");
429
+ const typeNameForUnionMember = (t) => (0, TypeUtils_1.matchTypeExhaustive)(t, _noneType => {
430
+ return (0, Support_1.panic)("none type should have been replaced");
408
431
  }, _anyType => "anything", _nullType => "null", _boolType => "bool", _integerType => "integer", _doubleType => "double", _stringType => "string", arrayType => typeNameForUnionMember(arrayType.items) + "_array", classType => lookup(this.nameForNamedType(classType)), mapType => typeNameForUnionMember(mapType.values) + "_map", objectType => {
409
- Support_1.assert(this.targetLanguage.supportsFullObjectType, "Object type should have been replaced in `replaceObjectType`");
432
+ (0, Support_1.assert)(this.targetLanguage.supportsFullObjectType, "Object type should have been replaced in `replaceObjectType`");
410
433
  return lookup(this.nameForNamedType(objectType));
411
434
  }, _enumType => "enum", _unionType => "union", transformedType => transformedType.kind.replace("-", "_"));
412
435
  return typeNameForUnionMember(fieldType);
@@ -415,24 +438,24 @@ class ConvenienceRenderer extends Renderer_1.Renderer {
415
438
  return this.nameStoreView.get(t);
416
439
  }
417
440
  isForwardDeclaredType(t) {
418
- return Support_1.defined(this._declarationIR).forwardedTypes.has(t);
441
+ return (0, Support_1.defined)(this._declarationIR).forwardedTypes.has(t);
419
442
  }
420
443
  isImplicitCycleBreaker(_t) {
421
- return Support_1.panic("A renderer that invokes isCycleBreakerType must implement isImplicitCycleBreaker");
444
+ return (0, Support_1.panic)("A renderer that invokes isCycleBreakerType must implement isImplicitCycleBreaker");
422
445
  }
423
446
  canBreakCycles(_t) {
424
447
  return true;
425
448
  }
426
449
  isCycleBreakerType(t) {
427
450
  if (this._cycleBreakerTypes === undefined) {
428
- this._cycleBreakerTypes = DeclarationIR_1.cycleBreakerTypesForGraph(this.typeGraph, s => this.isImplicitCycleBreaker(s), s => this.canBreakCycles(s));
451
+ this._cycleBreakerTypes = (0, DeclarationIR_1.cycleBreakerTypesForGraph)(this.typeGraph, s => this.isImplicitCycleBreaker(s), s => this.canBreakCycles(s));
429
452
  }
430
453
  return this._cycleBreakerTypes.has(t);
431
454
  }
432
455
  forEachTopLevel(blankLocations, f, predicate) {
433
456
  let topLevels;
434
457
  if (predicate !== undefined) {
435
- topLevels = collection_utils_1.mapFilter(this.topLevels, predicate);
458
+ topLevels = (0, collection_utils_1.mapFilter)(this.topLevels, predicate);
436
459
  }
437
460
  else {
438
461
  topLevels = this.topLevels;
@@ -440,7 +463,7 @@ class ConvenienceRenderer extends Renderer_1.Renderer {
440
463
  return this.forEachWithBlankLines(topLevels, blankLocations, (t, name, pos) => f(t, this.nameStoreView.getForTopLevel(name), pos));
441
464
  }
442
465
  forEachDeclaration(blankLocations, f) {
443
- this.forEachWithBlankLines(collection_utils_1.iterableEnumerate(Support_1.defined(this._declarationIR).declarations), blankLocations, (decl, _, pos) => f(decl, pos));
466
+ this.forEachWithBlankLines((0, collection_utils_1.iterableEnumerate)((0, Support_1.defined)(this._declarationIR).declarations), blankLocations, (decl, _, pos) => f(decl, pos));
444
467
  }
445
468
  setAlphabetizeProperties(value) {
446
469
  this._alphabetizeProperties = value;
@@ -450,14 +473,14 @@ class ConvenienceRenderer extends Renderer_1.Renderer {
450
473
  }
451
474
  // Returns the number of properties defined for the specified object type.
452
475
  propertyCount(o) {
453
- const propertyNames = Support_1.defined(this._propertyNamesStoreView).get(o);
476
+ const propertyNames = (0, Support_1.defined)(this._propertyNamesStoreView).get(o);
454
477
  return propertyNames.size;
455
478
  }
456
479
  sortClassProperties(properties, propertyNames) {
457
480
  if (this._alphabetizeProperties) {
458
- return collection_utils_1.mapSortBy(properties, (_p, jsonName) => {
459
- const name = Support_1.defined(propertyNames.get(jsonName));
460
- return Support_1.defined(this.names.get(name));
481
+ return (0, collection_utils_1.mapSortBy)(properties, (_p, jsonName) => {
482
+ const name = (0, Support_1.defined)(propertyNames.get(jsonName));
483
+ return (0, Support_1.defined)(this.names.get(name));
461
484
  });
462
485
  }
463
486
  else {
@@ -465,43 +488,43 @@ class ConvenienceRenderer extends Renderer_1.Renderer {
465
488
  }
466
489
  }
467
490
  forEachClassProperty(o, blankLocations, f) {
468
- const propertyNames = Support_1.defined(this._propertyNamesStoreView).get(o);
491
+ const propertyNames = (0, Support_1.defined)(this._propertyNamesStoreView).get(o);
469
492
  const sortedProperties = this.sortClassProperties(o.getProperties(), propertyNames);
470
493
  this.forEachWithBlankLines(sortedProperties, blankLocations, (p, jsonName, pos) => {
471
- const name = Support_1.defined(propertyNames.get(jsonName));
494
+ const name = (0, Support_1.defined)(propertyNames.get(jsonName));
472
495
  f(name, jsonName, p, pos);
473
496
  });
474
497
  }
475
498
  nameForUnionMember(u, t) {
476
- return Support_1.defined(Support_1.defined(this._memberNamesStoreView).get(u).get(t));
499
+ return (0, Support_1.defined)((0, Support_1.defined)(this._memberNamesStoreView).get(u).get(t));
477
500
  }
478
501
  nameForEnumCase(e, caseName) {
479
- const caseNames = Support_1.defined(this._caseNamesStoreView).get(e);
480
- return Support_1.defined(caseNames.get(caseName));
502
+ const caseNames = (0, Support_1.defined)(this._caseNamesStoreView).get(e);
503
+ return (0, Support_1.defined)(caseNames.get(caseName));
481
504
  }
482
505
  forEachUnionMember(u, members, blankLocations, sortOrder, f) {
483
506
  const iterateMembers = members === null ? u.members : members;
484
507
  if (sortOrder === null) {
485
- sortOrder = n => Support_1.defined(this.names.get(n));
508
+ sortOrder = n => (0, Support_1.defined)(this.names.get(n));
486
509
  }
487
- const memberNames = collection_utils_1.mapFilter(Support_1.defined(this._memberNamesStoreView).get(u), (_, t) => iterateMembers.has(t));
488
- const sortedMemberNames = collection_utils_1.mapSortBy(memberNames, sortOrder);
510
+ const memberNames = (0, collection_utils_1.mapFilter)((0, Support_1.defined)(this._memberNamesStoreView).get(u), (_, t) => iterateMembers.has(t));
511
+ const sortedMemberNames = (0, collection_utils_1.mapSortBy)(memberNames, sortOrder);
489
512
  this.forEachWithBlankLines(sortedMemberNames, blankLocations, f);
490
513
  }
491
514
  forEachEnumCase(e, blankLocations, f) {
492
- const caseNames = Support_1.defined(this._caseNamesStoreView).get(e);
493
- const sortedCaseNames = collection_utils_1.mapSortBy(caseNames, n => Support_1.defined(this.names.get(n)));
515
+ const caseNames = (0, Support_1.defined)(this._caseNamesStoreView).get(e);
516
+ const sortedCaseNames = (0, collection_utils_1.mapSortBy)(caseNames, n => (0, Support_1.defined)(this.names.get(n)));
494
517
  this.forEachWithBlankLines(sortedCaseNames, blankLocations, f);
495
518
  }
496
519
  forEachTransformation(blankLocations, f) {
497
- this.forEachWithBlankLines(Support_1.defined(this._namesForTransformations), blankLocations, f);
520
+ this.forEachWithBlankLines((0, Support_1.defined)(this._namesForTransformations), blankLocations, f);
498
521
  }
499
522
  forEachSpecificNamedType(blankLocations, types, f) {
500
523
  this.forEachWithBlankLines(types, blankLocations, (t, _, pos) => f(t, this.nameForNamedType(t), pos));
501
524
  }
502
525
  forEachObject(blankLocations, f) {
503
526
  // FIXME: This is ugly.
504
- this.forEachSpecificNamedType(blankLocations, Support_1.defined(this._namedObjects).entries(), f);
527
+ this.forEachSpecificNamedType(blankLocations, (0, Support_1.defined)(this._namedObjects).entries(), f);
505
528
  }
506
529
  forEachEnum(blankLocations, f) {
507
530
  this.forEachSpecificNamedType(blankLocations, this.enums.entries(), f);
@@ -520,7 +543,7 @@ class ConvenienceRenderer extends Renderer_1.Renderer {
520
543
  this.forEachWithBlankLines(firstUnionByValue, blankLocations, f);
521
544
  }
522
545
  forEachNamedType(blankLocations, objectFunc, enumFunc, unionFunc) {
523
- this.forEachWithBlankLines(Support_1.defined(this._namedTypes).entries(), blankLocations, (t, _, pos) => {
546
+ this.forEachWithBlankLines((0, Support_1.defined)(this._namedTypes).entries(), blankLocations, (t, _, pos) => {
524
547
  const name = this.nameForNamedType(t);
525
548
  if (t instanceof Type_1.ObjectType) {
526
549
  // FIXME: This is ugly. We can't runtime check that the function
@@ -534,7 +557,7 @@ class ConvenienceRenderer extends Renderer_1.Renderer {
534
557
  unionFunc(t, name, pos);
535
558
  }
536
559
  else {
537
- return Support_1.panic("Named type that's neither a class nor union");
560
+ return (0, Support_1.panic)("Named type that's neither a class nor union");
538
561
  }
539
562
  });
540
563
  }
@@ -542,7 +565,7 @@ class ConvenienceRenderer extends Renderer_1.Renderer {
542
565
  // code. If you need to modify a Name, for example to change its casing,
543
566
  // use `modifySource`.
544
567
  sourcelikeToString(src) {
545
- return Source_1.serializeRenderResult(Source_1.sourcelikeToSource(src), this.names, "").lines.join("\n");
568
+ return (0, Source_1.serializeRenderResult)((0, Source_1.sourcelikeToSource)(src), this.names, "").lines.join("\n");
546
569
  }
547
570
  get commentLineStart() {
548
571
  return "// ";
@@ -561,7 +584,7 @@ class ConvenienceRenderer extends Renderer_1.Renderer {
561
584
  for (const line of lines) {
562
585
  let start = first ? firstLineStart : lineStart;
563
586
  if (this.sourcelikeToString(line) === "") {
564
- start = Strings_1.trimEnd(start);
587
+ start = (0, Strings_1.trimEnd)(start);
565
588
  }
566
589
  this.emitLine(start, line);
567
590
  first = false;
@@ -598,19 +621,19 @@ class ConvenienceRenderer extends Renderer_1.Renderer {
598
621
  emitTable();
599
622
  }
600
623
  processGraph() {
601
- this._declarationIR = DeclarationIR_1.declarationsForGraph(this.typeGraph, this.needsTypeDeclarationBeforeUse ? t => this.canBeForwardDeclared(t) : undefined, t => this.childrenOfType(t), t => {
624
+ this._declarationIR = (0, DeclarationIR_1.declarationsForGraph)(this.typeGraph, this.needsTypeDeclarationBeforeUse ? t => this.canBeForwardDeclared(t) : undefined, t => this.childrenOfType(t), t => {
602
625
  if (t instanceof Type_1.UnionType) {
603
626
  return this.unionNeedsName(t);
604
627
  }
605
- return TypeUtils_1.isNamedType(t);
628
+ return (0, TypeUtils_1.isNamedType)(t);
606
629
  });
607
630
  const types = this.typeGraph.allTypesUnordered();
608
- this._haveUnions = collection_utils_1.iterableSome(types, t => t instanceof Type_1.UnionType);
609
- this._haveMaps = collection_utils_1.iterableSome(types, t => t instanceof Type_1.MapType);
610
- const classTypes = collection_utils_1.setFilter(types, t => t instanceof Type_1.ClassType);
611
- this._haveOptionalProperties = collection_utils_1.iterableSome(classTypes, c => collection_utils_1.mapSome(c.getProperties(), p => p.isOptional));
631
+ this._haveUnions = (0, collection_utils_1.iterableSome)(types, t => t instanceof Type_1.UnionType);
632
+ this._haveMaps = (0, collection_utils_1.iterableSome)(types, t => t instanceof Type_1.MapType);
633
+ const classTypes = (0, collection_utils_1.setFilter)(types, t => t instanceof Type_1.ClassType);
634
+ this._haveOptionalProperties = (0, collection_utils_1.iterableSome)(classTypes, c => (0, collection_utils_1.mapSome)(c.getProperties(), p => p.isOptional));
612
635
  this._namedTypes = this._declarationIR.declarations.filter(d => d.kind === "define").map(d => d.type);
613
- const { objects, enums, unions } = TypeUtils_1.separateNamedTypes(this._namedTypes);
636
+ const { objects, enums, unions } = (0, TypeUtils_1.separateNamedTypes)(this._namedTypes);
614
637
  this._namedObjects = new Set(objects);
615
638
  this._namedEnums = new Set(enums);
616
639
  this._namedUnions = new Set(unions);
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  // https://github.com/epoberezkin/ajv/blob/4d76c6fb813b136b6ec4fe74990bc97233d75dea/lib/compile/formats.js
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.DefaultDateTimeRecognizer = void 0;
4
5
  /*
5
6
  The MIT License (MIT)
6
7
 
@@ -1,6 +1,6 @@
1
1
  import { TypeGraph } from "./TypeGraph";
2
2
  import { Type } from "./Type";
3
- export declare type DeclarationKind = "forward" | "define";
3
+ export type DeclarationKind = "forward" | "define";
4
4
  export interface Declaration {
5
5
  readonly kind: DeclarationKind;
6
6
  readonly type: Type;