quicktype-core 7.0.36 → 7.0.37

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 (130) hide show
  1. package/dist/Annotation.js +1 -0
  2. package/dist/ConvenienceRenderer.d.ts +17 -17
  3. package/dist/ConvenienceRenderer.js +81 -80
  4. package/dist/CycleBreaker.js +6 -5
  5. package/dist/DateTime.js +1 -0
  6. package/dist/DeclarationIR.d.ts +1 -1
  7. package/dist/DeclarationIR.js +11 -10
  8. package/dist/EncodedMarkovChain.js +1 -0
  9. package/dist/GatherNames.js +44 -20
  10. package/dist/Graph.d.ts +2 -2
  11. package/dist/Graph.js +20 -19
  12. package/dist/GraphRewriting.d.ts +2 -2
  13. package/dist/GraphRewriting.js +48 -47
  14. package/dist/MakeTransformations.js +23 -22
  15. package/dist/MarkovChain.d.ts +3 -3
  16. package/dist/MarkovChain.js +9 -8
  17. package/dist/Messages.d.ts +3 -3
  18. package/dist/Messages.js +5 -3
  19. package/dist/Naming.d.ts +11 -11
  20. package/dist/Naming.js +30 -29
  21. package/dist/Renderer.d.ts +6 -6
  22. package/dist/Renderer.js +12 -11
  23. package/dist/RendererOptions.d.ts +5 -5
  24. package/dist/RendererOptions.js +4 -3
  25. package/dist/Run.d.ts +5 -5
  26. package/dist/Run.js +49 -24
  27. package/dist/Source.d.ts +3 -3
  28. package/dist/Source.js +19 -18
  29. package/dist/TargetLanguage.d.ts +10 -10
  30. package/dist/TargetLanguage.js +3 -2
  31. package/dist/Transformers.d.ts +25 -25
  32. package/dist/Transformers.js +67 -66
  33. package/dist/Type.d.ts +40 -42
  34. package/dist/Type.js +79 -71
  35. package/dist/TypeBuilder.d.ts +2 -2
  36. package/dist/TypeBuilder.js +43 -42
  37. package/dist/TypeGraph.d.ts +4 -4
  38. package/dist/TypeGraph.js +34 -33
  39. package/dist/TypeUtils.d.ts +2 -2
  40. package/dist/TypeUtils.js +23 -22
  41. package/dist/UnifyClasses.js +13 -12
  42. package/dist/UnionBuilder.d.ts +3 -3
  43. package/dist/UnionBuilder.js +25 -24
  44. package/dist/attributes/AccessorNames.d.ts +2 -2
  45. package/dist/attributes/AccessorNames.js +18 -17
  46. package/dist/attributes/Constraints.d.ts +3 -3
  47. package/dist/attributes/Constraints.js +5 -4
  48. package/dist/attributes/Description.js +6 -5
  49. package/dist/attributes/EnumValues.js +4 -3
  50. package/dist/attributes/StringTypes.d.ts +1 -1
  51. package/dist/attributes/StringTypes.js +22 -21
  52. package/dist/attributes/TypeAttributes.d.ts +3 -3
  53. package/dist/attributes/TypeAttributes.js +11 -10
  54. package/dist/attributes/TypeNames.d.ts +9 -9
  55. package/dist/attributes/TypeNames.js +45 -21
  56. package/dist/attributes/URIAttributes.d.ts +1 -1
  57. package/dist/attributes/URIAttributes.js +9 -5
  58. package/dist/index.js +128 -125
  59. package/dist/input/CompressedJSON.d.ts +7 -7
  60. package/dist/input/CompressedJSON.js +29 -27
  61. package/dist/input/FetchingJSONSchemaStore.js +4 -2
  62. package/dist/input/Inference.d.ts +2 -2
  63. package/dist/input/Inference.js +18 -17
  64. package/dist/input/Inputs.d.ts +2 -2
  65. package/dist/input/Inputs.js +16 -14
  66. package/dist/input/JSONSchemaInput.d.ts +11 -11
  67. package/dist/input/JSONSchemaInput.js +101 -96
  68. package/dist/input/JSONSchemaStore.d.ts +1 -1
  69. package/dist/input/JSONSchemaStore.js +4 -2
  70. package/dist/input/PostmanCollection.js +2 -1
  71. package/dist/input/io/NodeIO.js +33 -9
  72. package/dist/input/io/get-stream/index.js +6 -2
  73. package/dist/language/All.js +3 -2
  74. package/dist/language/CPlusPlus.d.ts +8 -8
  75. package/dist/language/CPlusPlus.js +56 -55
  76. package/dist/language/CSharp.d.ts +7 -7
  77. package/dist/language/CSharp.js +71 -70
  78. package/dist/language/Crystal.d.ts +2 -2
  79. package/dist/language/Crystal.js +18 -17
  80. package/dist/language/Dart.d.ts +4 -4
  81. package/dist/language/Dart.js +29 -28
  82. package/dist/language/Elm.d.ts +6 -6
  83. package/dist/language/Elm.js +44 -43
  84. package/dist/language/Golang.d.ts +4 -4
  85. package/dist/language/Golang.js +20 -19
  86. package/dist/language/Haskell.d.ts +5 -5
  87. package/dist/language/Haskell.js +24 -23
  88. package/dist/language/JSONSchema.d.ts +3 -3
  89. package/dist/language/JSONSchema.js +17 -16
  90. package/dist/language/Java.d.ts +2 -2
  91. package/dist/language/Java.js +32 -31
  92. package/dist/language/JavaScript.d.ts +7 -7
  93. package/dist/language/JavaScript.js +18 -17
  94. package/dist/language/JavaScriptPropTypes.js +14 -13
  95. package/dist/language/JavaScriptUnicodeMaps.js +12 -11
  96. package/dist/language/Kotlin.d.ts +2 -2
  97. package/dist/language/Kotlin.js +38 -37
  98. package/dist/language/Objective-C.d.ts +3 -3
  99. package/dist/language/Objective-C.js +42 -41
  100. package/dist/language/Php.d.ts +2 -2
  101. package/dist/language/Php.js +61 -37
  102. package/dist/language/Pike.d.ts +1 -1
  103. package/dist/language/Pike.js +18 -17
  104. package/dist/language/Python.d.ts +8 -8
  105. package/dist/language/Python.js +55 -54
  106. package/dist/language/Rust.d.ts +2 -2
  107. package/dist/language/Rust.js +20 -19
  108. package/dist/language/Swift.d.ts +7 -7
  109. package/dist/language/Swift.js +27 -26
  110. package/dist/language/TypeScriptFlow.d.ts +7 -7
  111. package/dist/language/TypeScriptFlow.js +27 -26
  112. package/dist/language/ruby/index.d.ts +4 -4
  113. package/dist/language/ruby/index.js +48 -24
  114. package/dist/language/ruby/keywords.js +1 -0
  115. package/dist/rewrites/CombineClasses.js +9 -8
  116. package/dist/rewrites/ExpandStrings.d.ts +1 -1
  117. package/dist/rewrites/ExpandStrings.js +18 -17
  118. package/dist/rewrites/FlattenStrings.js +7 -6
  119. package/dist/rewrites/FlattenUnions.js +9 -8
  120. package/dist/rewrites/InferMaps.js +11 -10
  121. package/dist/rewrites/ReplaceObjectType.js +8 -7
  122. package/dist/rewrites/ResolveIntersections.js +48 -47
  123. package/dist/support/Acronyms.js +3 -1
  124. package/dist/support/Chance.js +1 -0
  125. package/dist/support/Converters.js +1 -0
  126. package/dist/support/Strings.d.ts +4 -4
  127. package/dist/support/Strings.js +17 -16
  128. package/dist/support/Support.d.ts +1 -1
  129. package/dist/support/Support.js +30 -6
  130. package/package.json +8 -8
@@ -1,5 +1,6 @@
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;
@@ -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");
@@ -84,7 +85,7 @@ class ConvenienceRenderer extends Renderer_1.Renderer {
84
85
  return undefined;
85
86
  }
86
87
  namedTypeToNameForTopLevel(type) {
87
- if (TypeUtils_1.isNamedType(type)) {
88
+ if ((0, TypeUtils_1.isNamedType)(type)) {
88
89
  return type;
89
90
  }
90
91
  return undefined;
@@ -99,16 +100,16 @@ class ConvenienceRenderer extends Renderer_1.Renderer {
99
100
  return false;
100
101
  }
101
102
  canBeForwardDeclared(_t) {
102
- return Support_1.panic("If needsTypeDeclarationBeforeUse returns true, canBeForwardDeclared must be implemented");
103
+ return (0, Support_1.panic)("If needsTypeDeclarationBeforeUse returns true, canBeForwardDeclared must be implemented");
103
104
  }
104
105
  unionNeedsName(u) {
105
- return TypeUtils_1.nullableFromUnion(u) === null;
106
+ return (0, TypeUtils_1.nullableFromUnion)(u) === null;
106
107
  }
107
108
  get globalNamespace() {
108
- return Support_1.defined(this._globalNamespace);
109
+ return (0, Support_1.defined)(this._globalNamespace);
109
110
  }
110
111
  get nameStoreView() {
111
- return Support_1.defined(this._nameStoreView);
112
+ return (0, Support_1.defined)(this._nameStoreView);
112
113
  }
113
114
  descriptionForType(t) {
114
115
  let description = this.typeGraph.attributeStore.tryGet(Description_1.descriptionTypeAttributeKind, t);
@@ -129,11 +130,11 @@ class ConvenienceRenderer extends Renderer_1.Renderer {
129
130
  this._namedTypeNamer = this.makeNamedTypeNamer();
130
131
  this._unionMemberNamer = this.makeUnionMemberNamer();
131
132
  this._enumCaseNamer = this.makeEnumCaseNamer();
132
- this._globalForbiddenNamespace = Naming_1.keywordNamespace("forbidden", this.forbiddenNamesForGlobalNamespace());
133
+ this._globalForbiddenNamespace = (0, Naming_1.keywordNamespace)("forbidden", this.forbiddenNamesForGlobalNamespace());
133
134
  this._otherForbiddenNamespaces = new Map();
134
135
  this._globalNamespace = new Naming_1.Namespace("global", undefined, [this._globalForbiddenNamespace], []);
135
136
  const { objects, enums, unions } = this.typeGraph.allNamedTypesSeparated();
136
- const namedUnions = collection_utils_1.setFilter(unions, u => this.unionNeedsName(u));
137
+ const namedUnions = (0, collection_utils_1.setFilter)(unions, u => this.unionNeedsName(u));
137
138
  for (const [name, t] of this.topLevels) {
138
139
  this.nameStoreView.setForTopLevel(name, this.addNameForTopLevel(t, name));
139
140
  }
@@ -152,7 +153,7 @@ class ConvenienceRenderer extends Renderer_1.Renderer {
152
153
  for (const t of this.typeGraph.allTypesUnordered()) {
153
154
  this.addNameForTransformation(t);
154
155
  }
155
- return collection_utils_1.setUnion([this._globalForbiddenNamespace, this._globalNamespace], this._otherForbiddenNamespaces.values());
156
+ return (0, collection_utils_1.setUnion)([this._globalForbiddenNamespace, this._globalNamespace], this._otherForbiddenNamespaces.values());
156
157
  }
157
158
  addDependenciesForNamedType(type, named) {
158
159
  const dependencyNames = this.makeNamedTypeDependencyNames(type, named);
@@ -161,7 +162,7 @@ class ConvenienceRenderer extends Renderer_1.Renderer {
161
162
  }
162
163
  }
163
164
  makeNameForTopLevel(_t, givenName, _maybeNamedType) {
164
- return new Naming_1.SimpleName([givenName], Support_1.defined(this._namedTypeNamer), exports.topLevelNameOrder);
165
+ return new Naming_1.SimpleName([givenName], (0, Support_1.defined)(this._namedTypeNamer), exports.topLevelNameOrder);
165
166
  }
166
167
  addNameForTopLevel(type, givenName) {
167
168
  const maybeNamedType = this.namedTypeToNameForTopLevel(type);
@@ -183,7 +184,7 @@ class ConvenienceRenderer extends Renderer_1.Renderer {
183
184
  return new Naming_1.SimpleName(names.proposedNames, namer, order);
184
185
  }
185
186
  makeNameForNamedType(t) {
186
- return this.makeNameForType(t, Support_1.defined(this._namedTypeNamer), givenNameOrder, exports.inferredNameOrder);
187
+ return this.makeNameForType(t, (0, Support_1.defined)(this._namedTypeNamer), givenNameOrder, exports.inferredNameOrder);
187
188
  }
188
189
  addNameForNamedType(type) {
189
190
  const existing = this.nameStoreView.tryGet(type);
@@ -195,28 +196,28 @@ class ConvenienceRenderer extends Renderer_1.Renderer {
195
196
  return name;
196
197
  }
197
198
  get typesWithNamedTransformations() {
198
- return Support_1.defined(this._namesForTransformations);
199
+ return (0, Support_1.defined)(this._namesForTransformations);
199
200
  }
200
201
  nameForTransformation(t) {
201
- const xf = Transformers_1.transformationForType(t);
202
+ const xf = (0, Transformers_1.transformationForType)(t);
202
203
  if (xf === undefined)
203
204
  return undefined;
204
- const name = Support_1.defined(this._namesForTransformations).get(t);
205
+ const name = (0, Support_1.defined)(this._namesForTransformations).get(t);
205
206
  if (name === undefined) {
206
- return Support_1.panic("No name for transformation");
207
+ return (0, Support_1.panic)("No name for transformation");
207
208
  }
208
209
  return name;
209
210
  }
210
211
  addNameForTransformation(t) {
211
- const xf = Transformers_1.transformationForType(t);
212
+ const xf = (0, Transformers_1.transformationForType)(t);
212
213
  if (xf === undefined)
213
214
  return;
214
- Support_1.assert(Support_1.defined(this._namesForTransformations).get(t) === undefined, "Tried to give two names to the same transformation");
215
+ (0, Support_1.assert)((0, Support_1.defined)(this._namesForTransformations).get(t) === undefined, "Tried to give two names to the same transformation");
215
216
  const name = this.makeNameForTransformation(xf, this.nameStoreView.tryGet(xf.targetType));
216
217
  if (name === undefined)
217
218
  return;
218
219
  this.globalNamespace.add(name);
219
- Support_1.defined(this._namesForTransformations).set(t, name);
220
+ (0, Support_1.defined)(this._namesForTransformations).set(t, name);
220
221
  }
221
222
  processForbiddenWordsInfo(info, namespaceName) {
222
223
  const forbiddenNames = [];
@@ -229,14 +230,14 @@ class ConvenienceRenderer extends Renderer_1.Renderer {
229
230
  forbiddenNames.push(nameOrString);
230
231
  }
231
232
  }
232
- let namespace = Support_1.defined(this._otherForbiddenNamespaces).get(namespaceName);
233
+ let namespace = (0, Support_1.defined)(this._otherForbiddenNamespaces).get(namespaceName);
233
234
  if (forbiddenStrings.length > 0 && namespace === undefined) {
234
- namespace = Naming_1.keywordNamespace(namespaceName, forbiddenStrings);
235
- this._otherForbiddenNamespaces = Support_1.defined(this._otherForbiddenNamespaces).set(namespaceName, namespace);
235
+ namespace = (0, Naming_1.keywordNamespace)(namespaceName, forbiddenStrings);
236
+ this._otherForbiddenNamespaces = (0, Support_1.defined)(this._otherForbiddenNamespaces).set(namespaceName, namespace);
236
237
  }
237
238
  let forbiddenNamespaces = new Set();
238
239
  if (info.includeGlobalForbidden) {
239
- forbiddenNamespaces = forbiddenNamespaces.add(Support_1.defined(this._globalForbiddenNamespace));
240
+ forbiddenNamespaces = forbiddenNamespaces.add((0, Support_1.defined)(this._globalForbiddenNamespace));
240
241
  }
241
242
  if (namespace !== undefined) {
242
243
  forbiddenNamespaces = forbiddenNamespaces.add(namespace);
@@ -267,12 +268,12 @@ class ConvenienceRenderer extends Renderer_1.Renderer {
267
268
  addPropertyNames(o, className) {
268
269
  const { forbiddenNames, forbiddenNamespaces } = this.processForbiddenWordsInfo(this.forbiddenForObjectProperties(o, className), "forbidden-for-properties");
269
270
  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);
271
+ const accessorNames = (0, AccessorNames_1.objectPropertyNames)(o, this.targetLanguage.name);
272
+ const names = (0, collection_utils_1.mapFilterMap)(o.getSortedProperties(), (p, jsonName) => {
273
+ const [assignedName, isFixed] = (0, AccessorNames_1.getAccessorName)(accessorNames, jsonName);
273
274
  let name;
274
275
  if (isFixed) {
275
- name = new Naming_1.FixedName(Support_1.defined(assignedName));
276
+ name = new Naming_1.FixedName((0, Support_1.defined)(assignedName));
276
277
  }
277
278
  else {
278
279
  name = this.makeNameForProperty(o, className, p, jsonName, assignedName);
@@ -288,14 +289,14 @@ class ConvenienceRenderer extends Renderer_1.Renderer {
288
289
  }
289
290
  return name;
290
291
  });
291
- Support_1.defined(this._propertyNamesStoreView).set(o, names);
292
+ (0, Support_1.defined)(this._propertyNamesStoreView).set(o, names);
292
293
  }
293
294
  makeNameForUnionMember(u, unionName, t) {
294
- const [assignedName, isFixed] = AccessorNames_1.unionMemberName(u, t, this.targetLanguage.name);
295
+ const [assignedName, isFixed] = (0, AccessorNames_1.unionMemberName)(u, t, this.targetLanguage.name);
295
296
  if (isFixed) {
296
- return new Naming_1.FixedName(Support_1.defined(assignedName));
297
+ return new Naming_1.FixedName((0, Support_1.defined)(assignedName));
297
298
  }
298
- return new Naming_1.DependencyName(Support_1.nonNull(this._unionMemberNamer), unionMemberNameOrder, lookup => {
299
+ return new Naming_1.DependencyName((0, Support_1.nonNull)(this._unionMemberNamer), unionMemberNameOrder, lookup => {
299
300
  if (assignedName !== undefined)
300
301
  return assignedName;
301
302
  return this.proposeUnionMemberName(u, unionName, t, lookup);
@@ -315,10 +316,10 @@ class ConvenienceRenderer extends Renderer_1.Renderer {
315
316
  }
316
317
  let names = new Map();
317
318
  for (const t of u.members) {
318
- const name = this.makeNameForUnionMember(u, unionName, Transformers_1.followTargetType(t));
319
+ const name = this.makeNameForUnionMember(u, unionName, (0, Transformers_1.followTargetType)(t));
319
320
  names.set(t, ns.add(name));
320
321
  }
321
- Support_1.defined(this._memberNamesStoreView).set(u, names);
322
+ (0, Support_1.defined)(this._memberNamesStoreView).set(u, names);
322
323
  }
323
324
  makeNameForEnumCase(e, _enumName, caseName, assignedName) {
324
325
  // FIXME: See the FIXME in `makeNameForProperty`. We do have global
@@ -326,7 +327,7 @@ class ConvenienceRenderer extends Renderer_1.Renderer {
326
327
  const alternative = `${e.getCombinedName()}_${caseName}`;
327
328
  const order = assignedName === undefined ? enumCaseNameOrder : assignedEnumCaseNameOrder;
328
329
  const names = assignedName === undefined ? [caseName, alternative] : [assignedName];
329
- return new Naming_1.SimpleName(names, Support_1.nonNull(this._enumCaseNamer), order);
330
+ return new Naming_1.SimpleName(names, (0, Support_1.nonNull)(this._enumCaseNamer), order);
330
331
  }
331
332
  // FIXME: this is very similar to addPropertyNameds and addUnionMemberNames
332
333
  addEnumCaseNames(e, enumName) {
@@ -341,56 +342,56 @@ class ConvenienceRenderer extends Renderer_1.Renderer {
341
342
  ns = new Naming_1.Namespace(e.getCombinedName(), this.globalNamespace, forbiddenNamespaces, forbiddenNames);
342
343
  }
343
344
  let names = new Map();
344
- const accessorNames = AccessorNames_1.enumCaseNames(e, this.targetLanguage.name);
345
+ const accessorNames = (0, AccessorNames_1.enumCaseNames)(e, this.targetLanguage.name);
345
346
  for (const caseName of e.cases) {
346
- const [assignedName, isFixed] = AccessorNames_1.getAccessorName(accessorNames, caseName);
347
+ const [assignedName, isFixed] = (0, AccessorNames_1.getAccessorName)(accessorNames, caseName);
347
348
  let name;
348
349
  if (isFixed) {
349
- name = new Naming_1.FixedName(Support_1.defined(assignedName));
350
+ name = new Naming_1.FixedName((0, Support_1.defined)(assignedName));
350
351
  }
351
352
  else {
352
353
  name = this.makeNameForEnumCase(e, enumName, caseName, assignedName);
353
354
  }
354
355
  names.set(caseName, ns.add(name));
355
356
  }
356
- Support_1.defined(this._caseNamesStoreView).set(e, names);
357
+ (0, Support_1.defined)(this._caseNamesStoreView).set(e, names);
357
358
  }
358
359
  childrenOfType(t) {
359
360
  const names = this.names;
360
361
  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) => {
362
+ const propertyNameds = (0, Support_1.defined)(this._propertyNamesStoreView).get(t);
363
+ const filteredMap = (0, collection_utils_1.mapFilterMap)(t.getProperties(), (p, n) => {
363
364
  if (propertyNameds.get(n) === undefined)
364
365
  return undefined;
365
366
  return p.type;
366
367
  });
367
- const sortedMap = collection_utils_1.mapSortBy(filteredMap, (_, n) => Support_1.defined(names.get(Support_1.defined(propertyNameds.get(n)))));
368
+ const sortedMap = (0, collection_utils_1.mapSortBy)(filteredMap, (_, n) => (0, Support_1.defined)(names.get((0, Support_1.defined)(propertyNameds.get(n)))));
368
369
  return new Set(sortedMap.values());
369
370
  }
370
371
  return t.getChildren();
371
372
  }
372
373
  get namedUnions() {
373
- return Support_1.defined(this._namedUnions);
374
+ return (0, Support_1.defined)(this._namedUnions);
374
375
  }
375
376
  get haveNamedUnions() {
376
377
  return this.namedUnions.size > 0;
377
378
  }
378
379
  get haveNamedTypes() {
379
- return Support_1.defined(this._namedTypes).length > 0;
380
+ return (0, Support_1.defined)(this._namedTypes).length > 0;
380
381
  }
381
382
  get haveUnions() {
382
- return Support_1.defined(this._haveUnions);
383
+ return (0, Support_1.defined)(this._haveUnions);
383
384
  }
384
385
  get haveMaps() {
385
- return Support_1.defined(this._haveMaps);
386
+ return (0, Support_1.defined)(this._haveMaps);
386
387
  }
387
388
  get haveOptionalProperties() {
388
- return Support_1.defined(this._haveOptionalProperties);
389
+ return (0, Support_1.defined)(this._haveOptionalProperties);
389
390
  }
390
391
  // FIXME: Inconsistently named, though technically correct. Right now all enums are named,
391
392
  // but this should really be called `namedEnums`.
392
393
  get enums() {
393
- return Support_1.defined(this._namedEnums);
394
+ return (0, Support_1.defined)(this._namedEnums);
394
395
  }
395
396
  get haveEnums() {
396
397
  return this.enums.size > 0;
@@ -403,10 +404,10 @@ class ConvenienceRenderer extends Renderer_1.Renderer {
403
404
  if (simpleName !== null) {
404
405
  return simpleName;
405
406
  }
406
- const typeNameForUnionMember = (t) => TypeUtils_1.matchTypeExhaustive(t, _noneType => {
407
- return Support_1.panic("none type should have been replaced");
407
+ const typeNameForUnionMember = (t) => (0, TypeUtils_1.matchTypeExhaustive)(t, _noneType => {
408
+ return (0, Support_1.panic)("none type should have been replaced");
408
409
  }, _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`");
410
+ (0, Support_1.assert)(this.targetLanguage.supportsFullObjectType, "Object type should have been replaced in `replaceObjectType`");
410
411
  return lookup(this.nameForNamedType(objectType));
411
412
  }, _enumType => "enum", _unionType => "union", transformedType => transformedType.kind.replace("-", "_"));
412
413
  return typeNameForUnionMember(fieldType);
@@ -415,24 +416,24 @@ class ConvenienceRenderer extends Renderer_1.Renderer {
415
416
  return this.nameStoreView.get(t);
416
417
  }
417
418
  isForwardDeclaredType(t) {
418
- return Support_1.defined(this._declarationIR).forwardedTypes.has(t);
419
+ return (0, Support_1.defined)(this._declarationIR).forwardedTypes.has(t);
419
420
  }
420
421
  isImplicitCycleBreaker(_t) {
421
- return Support_1.panic("A renderer that invokes isCycleBreakerType must implement isImplicitCycleBreaker");
422
+ return (0, Support_1.panic)("A renderer that invokes isCycleBreakerType must implement isImplicitCycleBreaker");
422
423
  }
423
424
  canBreakCycles(_t) {
424
425
  return true;
425
426
  }
426
427
  isCycleBreakerType(t) {
427
428
  if (this._cycleBreakerTypes === undefined) {
428
- this._cycleBreakerTypes = DeclarationIR_1.cycleBreakerTypesForGraph(this.typeGraph, s => this.isImplicitCycleBreaker(s), s => this.canBreakCycles(s));
429
+ this._cycleBreakerTypes = (0, DeclarationIR_1.cycleBreakerTypesForGraph)(this.typeGraph, s => this.isImplicitCycleBreaker(s), s => this.canBreakCycles(s));
429
430
  }
430
431
  return this._cycleBreakerTypes.has(t);
431
432
  }
432
433
  forEachTopLevel(blankLocations, f, predicate) {
433
434
  let topLevels;
434
435
  if (predicate !== undefined) {
435
- topLevels = collection_utils_1.mapFilter(this.topLevels, predicate);
436
+ topLevels = (0, collection_utils_1.mapFilter)(this.topLevels, predicate);
436
437
  }
437
438
  else {
438
439
  topLevels = this.topLevels;
@@ -440,7 +441,7 @@ class ConvenienceRenderer extends Renderer_1.Renderer {
440
441
  return this.forEachWithBlankLines(topLevels, blankLocations, (t, name, pos) => f(t, this.nameStoreView.getForTopLevel(name), pos));
441
442
  }
442
443
  forEachDeclaration(blankLocations, f) {
443
- this.forEachWithBlankLines(collection_utils_1.iterableEnumerate(Support_1.defined(this._declarationIR).declarations), blankLocations, (decl, _, pos) => f(decl, pos));
444
+ this.forEachWithBlankLines((0, collection_utils_1.iterableEnumerate)((0, Support_1.defined)(this._declarationIR).declarations), blankLocations, (decl, _, pos) => f(decl, pos));
444
445
  }
445
446
  setAlphabetizeProperties(value) {
446
447
  this._alphabetizeProperties = value;
@@ -450,14 +451,14 @@ class ConvenienceRenderer extends Renderer_1.Renderer {
450
451
  }
451
452
  // Returns the number of properties defined for the specified object type.
452
453
  propertyCount(o) {
453
- const propertyNames = Support_1.defined(this._propertyNamesStoreView).get(o);
454
+ const propertyNames = (0, Support_1.defined)(this._propertyNamesStoreView).get(o);
454
455
  return propertyNames.size;
455
456
  }
456
457
  sortClassProperties(properties, propertyNames) {
457
458
  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));
459
+ return (0, collection_utils_1.mapSortBy)(properties, (_p, jsonName) => {
460
+ const name = (0, Support_1.defined)(propertyNames.get(jsonName));
461
+ return (0, Support_1.defined)(this.names.get(name));
461
462
  });
462
463
  }
463
464
  else {
@@ -465,43 +466,43 @@ class ConvenienceRenderer extends Renderer_1.Renderer {
465
466
  }
466
467
  }
467
468
  forEachClassProperty(o, blankLocations, f) {
468
- const propertyNames = Support_1.defined(this._propertyNamesStoreView).get(o);
469
+ const propertyNames = (0, Support_1.defined)(this._propertyNamesStoreView).get(o);
469
470
  const sortedProperties = this.sortClassProperties(o.getProperties(), propertyNames);
470
471
  this.forEachWithBlankLines(sortedProperties, blankLocations, (p, jsonName, pos) => {
471
- const name = Support_1.defined(propertyNames.get(jsonName));
472
+ const name = (0, Support_1.defined)(propertyNames.get(jsonName));
472
473
  f(name, jsonName, p, pos);
473
474
  });
474
475
  }
475
476
  nameForUnionMember(u, t) {
476
- return Support_1.defined(Support_1.defined(this._memberNamesStoreView).get(u).get(t));
477
+ return (0, Support_1.defined)((0, Support_1.defined)(this._memberNamesStoreView).get(u).get(t));
477
478
  }
478
479
  nameForEnumCase(e, caseName) {
479
- const caseNames = Support_1.defined(this._caseNamesStoreView).get(e);
480
- return Support_1.defined(caseNames.get(caseName));
480
+ const caseNames = (0, Support_1.defined)(this._caseNamesStoreView).get(e);
481
+ return (0, Support_1.defined)(caseNames.get(caseName));
481
482
  }
482
483
  forEachUnionMember(u, members, blankLocations, sortOrder, f) {
483
484
  const iterateMembers = members === null ? u.members : members;
484
485
  if (sortOrder === null) {
485
- sortOrder = n => Support_1.defined(this.names.get(n));
486
+ sortOrder = n => (0, Support_1.defined)(this.names.get(n));
486
487
  }
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);
488
+ const memberNames = (0, collection_utils_1.mapFilter)((0, Support_1.defined)(this._memberNamesStoreView).get(u), (_, t) => iterateMembers.has(t));
489
+ const sortedMemberNames = (0, collection_utils_1.mapSortBy)(memberNames, sortOrder);
489
490
  this.forEachWithBlankLines(sortedMemberNames, blankLocations, f);
490
491
  }
491
492
  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)));
493
+ const caseNames = (0, Support_1.defined)(this._caseNamesStoreView).get(e);
494
+ const sortedCaseNames = (0, collection_utils_1.mapSortBy)(caseNames, n => (0, Support_1.defined)(this.names.get(n)));
494
495
  this.forEachWithBlankLines(sortedCaseNames, blankLocations, f);
495
496
  }
496
497
  forEachTransformation(blankLocations, f) {
497
- this.forEachWithBlankLines(Support_1.defined(this._namesForTransformations), blankLocations, f);
498
+ this.forEachWithBlankLines((0, Support_1.defined)(this._namesForTransformations), blankLocations, f);
498
499
  }
499
500
  forEachSpecificNamedType(blankLocations, types, f) {
500
501
  this.forEachWithBlankLines(types, blankLocations, (t, _, pos) => f(t, this.nameForNamedType(t), pos));
501
502
  }
502
503
  forEachObject(blankLocations, f) {
503
504
  // FIXME: This is ugly.
504
- this.forEachSpecificNamedType(blankLocations, Support_1.defined(this._namedObjects).entries(), f);
505
+ this.forEachSpecificNamedType(blankLocations, (0, Support_1.defined)(this._namedObjects).entries(), f);
505
506
  }
506
507
  forEachEnum(blankLocations, f) {
507
508
  this.forEachSpecificNamedType(blankLocations, this.enums.entries(), f);
@@ -520,7 +521,7 @@ class ConvenienceRenderer extends Renderer_1.Renderer {
520
521
  this.forEachWithBlankLines(firstUnionByValue, blankLocations, f);
521
522
  }
522
523
  forEachNamedType(blankLocations, objectFunc, enumFunc, unionFunc) {
523
- this.forEachWithBlankLines(Support_1.defined(this._namedTypes).entries(), blankLocations, (t, _, pos) => {
524
+ this.forEachWithBlankLines((0, Support_1.defined)(this._namedTypes).entries(), blankLocations, (t, _, pos) => {
524
525
  const name = this.nameForNamedType(t);
525
526
  if (t instanceof Type_1.ObjectType) {
526
527
  // FIXME: This is ugly. We can't runtime check that the function
@@ -534,7 +535,7 @@ class ConvenienceRenderer extends Renderer_1.Renderer {
534
535
  unionFunc(t, name, pos);
535
536
  }
536
537
  else {
537
- return Support_1.panic("Named type that's neither a class nor union");
538
+ return (0, Support_1.panic)("Named type that's neither a class nor union");
538
539
  }
539
540
  });
540
541
  }
@@ -542,7 +543,7 @@ class ConvenienceRenderer extends Renderer_1.Renderer {
542
543
  // code. If you need to modify a Name, for example to change its casing,
543
544
  // use `modifySource`.
544
545
  sourcelikeToString(src) {
545
- return Source_1.serializeRenderResult(Source_1.sourcelikeToSource(src), this.names, "").lines.join("\n");
546
+ return (0, Source_1.serializeRenderResult)((0, Source_1.sourcelikeToSource)(src), this.names, "").lines.join("\n");
546
547
  }
547
548
  get commentLineStart() {
548
549
  return "// ";
@@ -561,7 +562,7 @@ class ConvenienceRenderer extends Renderer_1.Renderer {
561
562
  for (const line of lines) {
562
563
  let start = first ? firstLineStart : lineStart;
563
564
  if (this.sourcelikeToString(line) === "") {
564
- start = Strings_1.trimEnd(start);
565
+ start = (0, Strings_1.trimEnd)(start);
565
566
  }
566
567
  this.emitLine(start, line);
567
568
  first = false;
@@ -598,19 +599,19 @@ class ConvenienceRenderer extends Renderer_1.Renderer {
598
599
  emitTable();
599
600
  }
600
601
  processGraph() {
601
- this._declarationIR = DeclarationIR_1.declarationsForGraph(this.typeGraph, this.needsTypeDeclarationBeforeUse ? t => this.canBeForwardDeclared(t) : undefined, t => this.childrenOfType(t), t => {
602
+ this._declarationIR = (0, DeclarationIR_1.declarationsForGraph)(this.typeGraph, this.needsTypeDeclarationBeforeUse ? t => this.canBeForwardDeclared(t) : undefined, t => this.childrenOfType(t), t => {
602
603
  if (t instanceof Type_1.UnionType) {
603
604
  return this.unionNeedsName(t);
604
605
  }
605
- return TypeUtils_1.isNamedType(t);
606
+ return (0, TypeUtils_1.isNamedType)(t);
606
607
  });
607
608
  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));
609
+ this._haveUnions = (0, collection_utils_1.iterableSome)(types, t => t instanceof Type_1.UnionType);
610
+ this._haveMaps = (0, collection_utils_1.iterableSome)(types, t => t instanceof Type_1.MapType);
611
+ const classTypes = (0, collection_utils_1.setFilter)(types, t => t instanceof Type_1.ClassType);
612
+ this._haveOptionalProperties = (0, collection_utils_1.iterableSome)(classTypes, c => (0, collection_utils_1.mapSome)(c.getProperties(), p => p.isOptional));
612
613
  this._namedTypes = this._declarationIR.declarations.filter(d => d.kind === "define").map(d => d.type);
613
- const { objects, enums, unions } = TypeUtils_1.separateNamedTypes(this._namedTypes);
614
+ const { objects, enums, unions } = (0, TypeUtils_1.separateNamedTypes)(this._namedTypes);
614
615
  this._namedObjects = new Set(objects);
615
616
  this._namedEnums = new Set(enums);
616
617
  this._namedUnions = new Set(unions);
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.breakCycles = void 0;
3
4
  const Support_1 = require("./support/Support");
4
5
  function breakCycles(outEdges, chooseBreaker) {
5
6
  const numNodes = outEdges.length;
@@ -28,14 +29,14 @@ function breakCycles(outEdges, chooseBreaker) {
28
29
  }
29
30
  function removeNode(node) {
30
31
  for (const n of outEdges[node]) {
31
- Support_1.assert(inDegree[n] > 0);
32
+ (0, Support_1.assert)(inDegree[n] > 0);
32
33
  inDegree[n] -= 1;
33
34
  if (inDegree[n] === 0) {
34
35
  workList.push(n);
35
36
  }
36
37
  }
37
38
  for (const n of inEdges[node]) {
38
- Support_1.assert(outDegree[n] > 0);
39
+ (0, Support_1.assert)(outDegree[n] > 0);
39
40
  outDegree[n] -= 1;
40
41
  if (outDegree[n] === 0) {
41
42
  workList.push(n);
@@ -50,7 +51,7 @@ function breakCycles(outEdges, chooseBreaker) {
50
51
  done[i] = true;
51
52
  continue;
52
53
  }
53
- Support_1.assert(inDegree[i] === 0 || outDegree[i] === 0, "Can't have nodes in the worklist with in and out edges");
54
+ (0, Support_1.assert)(inDegree[i] === 0 || outDegree[i] === 0, "Can't have nodes in the worklist with in and out edges");
54
55
  removeNode(i);
55
56
  continue;
56
57
  }
@@ -73,7 +74,7 @@ function breakCycles(outEdges, chooseBreaker) {
73
74
  // the dependee cycle.
74
75
  const maybeEdge = outEdges[n].find(x => !done[x]);
75
76
  if (maybeEdge === undefined) {
76
- return Support_1.panic("Presumed cycle is not a cycle");
77
+ return (0, Support_1.panic)("Presumed cycle is not a cycle");
77
78
  }
78
79
  const maybeFirst = path.indexOf(maybeEdge);
79
80
  if (maybeFirst === undefined) {
@@ -85,7 +86,7 @@ function breakCycles(outEdges, chooseBreaker) {
85
86
  // We found a cycle - break it
86
87
  const cycle = path.slice(maybeFirst);
87
88
  const [breakNode, info] = chooseBreaker(cycle);
88
- Support_1.assert(cycle.indexOf(breakNode) >= 0, "Breaker chose an invalid node");
89
+ (0, Support_1.assert)(cycle.indexOf(breakNode) >= 0, "Breaker chose an invalid node");
89
90
  removeNode(breakNode);
90
91
  results.push([breakNode, info]);
91
92
  break;
package/dist/DateTime.js CHANGED
@@ -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;