quicktype 17.0.4 → 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.
Files changed (139) hide show
  1. package/dist/cli/CompressedJSONFromStream.js +38 -26
  2. package/dist/cli/GraphQLIntrospection.js +41 -33
  3. package/dist/cli/TypeSource.d.ts +1 -1
  4. package/dist/cli/URLGrammar.js +3 -4
  5. package/dist/cli/index.js +364 -363
  6. package/dist/quicktype-core/Annotation.js +0 -2
  7. package/dist/quicktype-core/ConvenienceRenderer.d.ts +17 -17
  8. package/dist/quicktype-core/ConvenienceRenderer.js +81 -104
  9. package/dist/quicktype-core/DateTime.js +0 -1
  10. package/dist/quicktype-core/DeclarationIR.d.ts +1 -1
  11. package/dist/quicktype-core/DeclarationIR.js +10 -13
  12. package/dist/quicktype-core/EncodedMarkovChain.js +0 -1
  13. package/dist/quicktype-core/GatherNames.js +25 -47
  14. package/dist/quicktype-core/Graph.d.ts +2 -2
  15. package/dist/quicktype-core/Graph.js +19 -23
  16. package/dist/quicktype-core/GraphRewriting.d.ts +2 -2
  17. package/dist/quicktype-core/GraphRewriting.js +54 -65
  18. package/dist/quicktype-core/MakeTransformations.js +22 -23
  19. package/dist/quicktype-core/MarkovChain.d.ts +3 -3
  20. package/dist/quicktype-core/MarkovChain.js +8 -9
  21. package/dist/quicktype-core/Messages.d.ts +3 -3
  22. package/dist/quicktype-core/Messages.js +3 -8
  23. package/dist/quicktype-core/Naming.d.ts +11 -11
  24. package/dist/quicktype-core/Naming.js +61 -76
  25. package/dist/quicktype-core/Renderer.d.ts +6 -6
  26. package/dist/quicktype-core/Renderer.js +17 -34
  27. package/dist/quicktype-core/RendererOptions.d.ts +5 -5
  28. package/dist/quicktype-core/RendererOptions.js +3 -6
  29. package/dist/quicktype-core/Run.d.ts +9 -9
  30. package/dist/quicktype-core/Run.js +67 -72
  31. package/dist/quicktype-core/Source.d.ts +3 -3
  32. package/dist/quicktype-core/Source.js +18 -19
  33. package/dist/quicktype-core/TargetLanguage.d.ts +10 -10
  34. package/dist/quicktype-core/TargetLanguage.js +2 -6
  35. package/dist/quicktype-core/Transformers.d.ts +25 -25
  36. package/dist/quicktype-core/Transformers.js +66 -94
  37. package/dist/quicktype-core/Type.d.ts +43 -41
  38. package/dist/quicktype-core/Type.js +71 -96
  39. package/dist/quicktype-core/TypeBuilder.d.ts +2 -2
  40. package/dist/quicktype-core/TypeBuilder.js +47 -53
  41. package/dist/quicktype-core/TypeGraph.d.ts +4 -4
  42. package/dist/quicktype-core/TypeGraph.js +40 -49
  43. package/dist/quicktype-core/TypeUtils.d.ts +2 -2
  44. package/dist/quicktype-core/TypeUtils.js +22 -23
  45. package/dist/quicktype-core/UnifyClasses.js +12 -16
  46. package/dist/quicktype-core/UnionBuilder.d.ts +3 -3
  47. package/dist/quicktype-core/UnionBuilder.js +30 -33
  48. package/dist/quicktype-core/attributes/AccessorNames.d.ts +2 -2
  49. package/dist/quicktype-core/attributes/AccessorNames.js +17 -18
  50. package/dist/quicktype-core/attributes/Constraints.d.ts +3 -3
  51. package/dist/quicktype-core/attributes/Constraints.js +4 -8
  52. package/dist/quicktype-core/attributes/Description.js +5 -6
  53. package/dist/quicktype-core/attributes/EnumValues.js +3 -4
  54. package/dist/quicktype-core/attributes/StringTypes.d.ts +1 -1
  55. package/dist/quicktype-core/attributes/StringTypes.js +21 -24
  56. package/dist/quicktype-core/attributes/TypeAttributes.d.ts +3 -3
  57. package/dist/quicktype-core/attributes/TypeAttributes.js +10 -12
  58. package/dist/quicktype-core/attributes/TypeNames.d.ts +9 -9
  59. package/dist/quicktype-core/attributes/TypeNames.js +21 -49
  60. package/dist/quicktype-core/attributes/URIAttributes.d.ts +1 -1
  61. package/dist/quicktype-core/attributes/URIAttributes.js +6 -10
  62. package/dist/quicktype-core/index.js +125 -128
  63. package/dist/quicktype-core/input/CompressedJSON.d.ts +7 -7
  64. package/dist/quicktype-core/input/CompressedJSON.js +54 -49
  65. package/dist/quicktype-core/input/FetchingJSONSchemaStore.js +13 -5
  66. package/dist/quicktype-core/input/Inference.d.ts +2 -2
  67. package/dist/quicktype-core/input/Inference.js +17 -25
  68. package/dist/quicktype-core/input/Inputs.d.ts +2 -2
  69. package/dist/quicktype-core/input/Inputs.js +54 -38
  70. package/dist/quicktype-core/input/JSONSchemaInput.d.ts +11 -11
  71. package/dist/quicktype-core/input/JSONSchemaInput.js +523 -503
  72. package/dist/quicktype-core/input/JSONSchemaStore.d.ts +1 -1
  73. package/dist/quicktype-core/input/JSONSchemaStore.js +35 -24
  74. package/dist/quicktype-core/input/PostmanCollection.js +1 -2
  75. package/dist/quicktype-core/input/io/NodeIO.js +44 -55
  76. package/dist/quicktype-core/input/io/get-stream/index.js +2 -6
  77. package/dist/quicktype-core/language/All.js +2 -3
  78. package/dist/quicktype-core/language/CPlusPlus.d.ts +8 -8
  79. package/dist/quicktype-core/language/CPlusPlus.js +151 -185
  80. package/dist/quicktype-core/language/CSharp.d.ts +7 -7
  81. package/dist/quicktype-core/language/CSharp.js +72 -82
  82. package/dist/quicktype-core/language/Crystal.d.ts +2 -2
  83. package/dist/quicktype-core/language/Crystal.js +17 -18
  84. package/dist/quicktype-core/language/Dart.d.ts +4 -4
  85. package/dist/quicktype-core/language/Dart.js +34 -36
  86. package/dist/quicktype-core/language/Elm.d.ts +6 -6
  87. package/dist/quicktype-core/language/Elm.js +45 -47
  88. package/dist/quicktype-core/language/Golang.d.ts +4 -4
  89. package/dist/quicktype-core/language/Golang.js +20 -23
  90. package/dist/quicktype-core/language/Haskell.d.ts +5 -5
  91. package/dist/quicktype-core/language/Haskell.js +23 -25
  92. package/dist/quicktype-core/language/JSONSchema.d.ts +3 -3
  93. package/dist/quicktype-core/language/JSONSchema.js +16 -17
  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 +17 -19
  98. package/dist/quicktype-core/language/JavaScriptPropTypes.js +13 -15
  99. package/dist/quicktype-core/language/JavaScriptUnicodeMaps.js +11 -12
  100. package/dist/quicktype-core/language/Kotlin.d.ts +2 -2
  101. package/dist/quicktype-core/language/Kotlin.js +37 -39
  102. package/dist/quicktype-core/language/Objective-C.d.ts +3 -3
  103. package/dist/quicktype-core/language/Objective-C.js +41 -45
  104. package/dist/quicktype-core/language/Php.d.ts +2 -2
  105. package/dist/quicktype-core/language/Php.js +41 -66
  106. package/dist/quicktype-core/language/Pike.d.ts +1 -1
  107. package/dist/quicktype-core/language/Pike.js +17 -18
  108. package/dist/quicktype-core/language/Python.d.ts +8 -8
  109. package/dist/quicktype-core/language/Python.js +64 -63
  110. package/dist/quicktype-core/language/Rust.d.ts +2 -2
  111. package/dist/quicktype-core/language/Rust.js +19 -21
  112. package/dist/quicktype-core/language/Swift.d.ts +7 -7
  113. package/dist/quicktype-core/language/Swift.js +804 -807
  114. package/dist/quicktype-core/language/TypeScriptFlow.d.ts +7 -7
  115. package/dist/quicktype-core/language/TypeScriptFlow.js +26 -28
  116. package/dist/quicktype-core/language/ruby/index.d.ts +4 -4
  117. package/dist/quicktype-core/language/ruby/index.js +24 -49
  118. package/dist/quicktype-core/language/ruby/keywords.js +0 -1
  119. package/dist/quicktype-core/rewrites/CombineClasses.js +8 -9
  120. package/dist/quicktype-core/rewrites/ExpandStrings.d.ts +1 -1
  121. package/dist/quicktype-core/rewrites/ExpandStrings.js +17 -18
  122. package/dist/quicktype-core/rewrites/FlattenStrings.js +6 -7
  123. package/dist/quicktype-core/rewrites/FlattenUnions.js +8 -9
  124. package/dist/quicktype-core/rewrites/InferMaps.js +10 -11
  125. package/dist/quicktype-core/rewrites/ReplaceObjectType.js +7 -8
  126. package/dist/quicktype-core/rewrites/ResolveIntersections.js +67 -68
  127. package/dist/quicktype-core/support/Acronyms.js +1 -3
  128. package/dist/quicktype-core/support/Chance.js +0 -10
  129. package/dist/quicktype-core/support/Converters.js +0 -1
  130. package/dist/quicktype-core/support/Strings.d.ts +4 -4
  131. package/dist/quicktype-core/support/Strings.js +16 -17
  132. package/dist/quicktype-core/support/Support.d.ts +1 -1
  133. package/dist/quicktype-core/support/Support.js +6 -30
  134. package/dist/quicktype-graphql-input/GraphQLSchema.d.ts +4 -4
  135. package/dist/quicktype-graphql-input/GraphQLSchema.js +0 -1
  136. package/dist/quicktype-graphql-input/index.d.ts +1 -1
  137. package/dist/quicktype-graphql-input/index.js +212 -229
  138. package/dist/quicktype-typescript-input/index.js +4 -28
  139. package/package.json +19 -25
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UnionType = exports.IntersectionType = exports.SetOperationType = exports.intersectionTypeIdentity = exports.unionTypeIdentity = exports.setOperationTypeIdentity = exports.setOperationCasesEqual = exports.EnumType = exports.enumTypeIdentity = exports.MapType = exports.ClassType = exports.ObjectType = exports.mapTypeIdentify = exports.classTypeIdentity = exports.ClassProperty = exports.GenericClassProperty = exports.ArrayType = exports.arrayTypeIdentity = exports.PrimitiveType = exports.primitiveTypeIdentity = exports.Type = exports.TypeIdentity = exports.isPrimitiveTypeKind = exports.isNumberTypeKind = exports.targetTypeKindForTransformedStringTypeKind = exports.isPrimitiveStringTypeKind = exports.transformedStringTypeKinds = exports.transformedStringTypeTargetTypeKindsMap = void 0;
4
3
  const collection_utils_1 = require("collection-utils");
5
4
  const Support_1 = require("./support/Support");
6
5
  const TypeNames_1 = require("./attributes/TypeNames");
@@ -22,10 +21,10 @@ const transformedStringTypeTargetTypeKinds = {
22
21
  "integer-string": { jsonSchema: "integer", primitive: "integer" },
23
22
  "bool-string": { jsonSchema: "boolean", primitive: "bool" }
24
23
  };
25
- exports.transformedStringTypeTargetTypeKindsMap = (0, collection_utils_1.mapFromObject)(transformedStringTypeTargetTypeKinds);
24
+ exports.transformedStringTypeTargetTypeKindsMap = collection_utils_1.mapFromObject(transformedStringTypeTargetTypeKinds);
26
25
  exports.transformedStringTypeKinds = new Set(Object.getOwnPropertyNames(transformedStringTypeTargetTypeKinds));
27
26
  function isPrimitiveStringTypeKind(kind) {
28
- return kind === "string" || (0, collection_utils_1.hasOwnProperty)(transformedStringTypeTargetTypeKinds, kind);
27
+ return kind === "string" || collection_utils_1.hasOwnProperty(transformedStringTypeTargetTypeKinds, kind);
29
28
  }
30
29
  exports.isPrimitiveStringTypeKind = isPrimitiveStringTypeKind;
31
30
  function targetTypeKindForTransformedStringTypeKind(kind) {
@@ -55,16 +54,13 @@ function triviallyStructurallyCompatible(x, y) {
55
54
  return false;
56
55
  }
57
56
  class TypeIdentity {
58
- _kind;
59
- _components;
60
- _hashCode;
61
57
  constructor(_kind, _components) {
62
58
  this._kind = _kind;
63
59
  this._components = _components;
64
60
  let h = collection_utils_1.hashCodeInit;
65
- h = (0, collection_utils_1.addHashCode)(h, (0, collection_utils_1.hashCodeOf)(this._kind));
61
+ h = collection_utils_1.addHashCode(h, collection_utils_1.hashCodeOf(this._kind));
66
62
  for (const c of _components) {
67
- h = (0, collection_utils_1.addHashCode)(h, (0, collection_utils_1.hashCodeOf)(c));
63
+ h = collection_utils_1.addHashCode(h, collection_utils_1.hashCodeOf(c));
68
64
  }
69
65
  this._hashCode = h;
70
66
  }
@@ -74,9 +70,9 @@ class TypeIdentity {
74
70
  if (this._kind !== other._kind)
75
71
  return false;
76
72
  const n = this._components.length;
77
- (0, Support_1.assert)(n === other._components.length, "Components of a type kind's identity must have the same length");
73
+ Support_1.assert(n === other._components.length, "Components of a type kind's identity must have the same length");
78
74
  for (let i = 0; i < n; i++) {
79
- if (!(0, collection_utils_1.areEqual)(this._components[i], other._components[i]))
75
+ if (!collection_utils_1.areEqual(this._components[i], other._components[i]))
80
76
  return false;
81
77
  }
82
78
  return true;
@@ -87,32 +83,31 @@ class TypeIdentity {
87
83
  }
88
84
  exports.TypeIdentity = TypeIdentity;
89
85
  class Type {
90
- typeRef;
91
- graph;
92
- constructor(typeRef, graph) {
86
+ constructor(typeRef, graph, kind) {
93
87
  this.typeRef = typeRef;
94
88
  this.graph = graph;
89
+ this.kind = kind;
95
90
  }
96
91
  get index() {
97
- return (0, TypeGraph_1.typeRefIndex)(this.typeRef);
92
+ return TypeGraph_1.typeRefIndex(this.typeRef);
98
93
  }
99
94
  getChildren() {
100
95
  let result = this.getNonAttributeChildren();
101
96
  for (const [k, v] of this.getAttributes()) {
102
97
  if (k.children === undefined)
103
98
  continue;
104
- (0, collection_utils_1.setUnionInto)(result, k.children(v));
99
+ collection_utils_1.setUnionInto(result, k.children(v));
105
100
  }
106
101
  return result;
107
102
  }
108
103
  getAttributes() {
109
- return (0, TypeGraph_1.attributesForTypeRef)(this.typeRef, this.graph);
104
+ return TypeGraph_1.attributesForTypeRef(this.typeRef, this.graph);
110
105
  }
111
106
  get hasNames() {
112
107
  return TypeNames_1.namesTypeAttributeKind.tryGetInAttributes(this.getAttributes()) !== undefined;
113
108
  }
114
109
  getNames() {
115
- return (0, Support_1.defined)(TypeNames_1.namesTypeAttributeKind.tryGetInAttributes(this.getAttributes()));
110
+ return Support_1.defined(TypeNames_1.namesTypeAttributeKind.tryGetInAttributes(this.getAttributes()));
116
111
  }
117
112
  getCombinedName() {
118
113
  return this.getNames().combinedName;
@@ -126,7 +121,7 @@ class Type {
126
121
  return this.typeRef === other.typeRef;
127
122
  }
128
123
  hashCode() {
129
- return (0, collection_utils_1.hashCodeOf)(this.typeRef);
124
+ return collection_utils_1.hashCodeOf(this.typeRef);
130
125
  }
131
126
  structurallyCompatible(other, conflateNumbers = false) {
132
127
  function kindsCompatible(kind1, kind2) {
@@ -161,7 +156,7 @@ class Type {
161
156
  return true;
162
157
  };
163
158
  while (workList.length > 0) {
164
- let [a, b] = (0, Support_1.defined)(workList.pop());
159
+ let [a, b] = Support_1.defined(workList.pop());
165
160
  if (a.index > b.index) {
166
161
  [a, b] = [b, a];
167
162
  }
@@ -219,10 +214,10 @@ class Type {
219
214
  }
220
215
  exports.Type = Type;
221
216
  function hasUniqueIdentityAttributes(attributes) {
222
- return (0, collection_utils_1.mapSome)(attributes, (v, ta) => ta.requiresUniqueIdentity(v));
217
+ return collection_utils_1.mapSome(attributes, (v, ta) => ta.requiresUniqueIdentity(v));
223
218
  }
224
219
  function identityAttributes(attributes) {
225
- return (0, collection_utils_1.mapFilter)(attributes, (_, kind) => kind.inIdentity);
220
+ return collection_utils_1.mapFilter(attributes, (_, kind) => kind.inIdentity);
226
221
  }
227
222
  function primitiveTypeIdentity(kind, attributes) {
228
223
  if (hasUniqueIdentityAttributes(attributes))
@@ -231,11 +226,6 @@ function primitiveTypeIdentity(kind, attributes) {
231
226
  }
232
227
  exports.primitiveTypeIdentity = primitiveTypeIdentity;
233
228
  class PrimitiveType extends Type {
234
- kind;
235
- constructor(typeRef, graph, kind) {
236
- super(typeRef, graph);
237
- this.kind = kind;
238
- }
239
229
  get isNullable() {
240
230
  return this.kind === "null" || this.kind === "any" || this.kind === "none";
241
231
  }
@@ -263,26 +253,24 @@ function arrayTypeIdentity(attributes, itemsRef) {
263
253
  }
264
254
  exports.arrayTypeIdentity = arrayTypeIdentity;
265
255
  class ArrayType extends Type {
266
- _itemsRef;
267
- kind = "array";
268
256
  constructor(typeRef, graph, _itemsRef) {
269
- super(typeRef, graph);
257
+ super(typeRef, graph, "array");
270
258
  this._itemsRef = _itemsRef;
271
259
  }
272
260
  setItems(itemsRef) {
273
261
  if (this._itemsRef !== undefined) {
274
- return (0, Support_1.panic)("Can only set array items once");
262
+ return Support_1.panic("Can only set array items once");
275
263
  }
276
264
  this._itemsRef = itemsRef;
277
265
  }
278
266
  getItemsRef() {
279
267
  if (this._itemsRef === undefined) {
280
- return (0, Support_1.panic)("Array items accessed before they were set");
268
+ return Support_1.panic("Array items accessed before they were set");
281
269
  }
282
270
  return this._itemsRef;
283
271
  }
284
272
  get items() {
285
- return (0, TypeGraph_1.derefTypeRef)(this.getItemsRef(), this.graph);
273
+ return TypeGraph_1.derefTypeRef(this.getItemsRef(), this.graph);
286
274
  }
287
275
  getNonAttributeChildren() {
288
276
  return new Set([this.items]);
@@ -313,8 +301,6 @@ class ArrayType extends Type {
313
301
  }
314
302
  exports.ArrayType = ArrayType;
315
303
  class GenericClassProperty {
316
- typeData;
317
- isOptional;
318
304
  constructor(typeData, isOptional) {
319
305
  this.typeData = typeData;
320
306
  this.isOptional = isOptional;
@@ -323,15 +309,14 @@ class GenericClassProperty {
323
309
  if (!(other instanceof GenericClassProperty)) {
324
310
  return false;
325
311
  }
326
- return (0, collection_utils_1.areEqual)(this.typeData, other.typeData) && this.isOptional === other.isOptional;
312
+ return collection_utils_1.areEqual(this.typeData, other.typeData) && this.isOptional === other.isOptional;
327
313
  }
328
314
  hashCode() {
329
- return (0, collection_utils_1.hashCodeOf)(this.typeData) + (this.isOptional ? 17 : 23);
315
+ return collection_utils_1.hashCodeOf(this.typeData) + (this.isOptional ? 17 : 23);
330
316
  }
331
317
  }
332
318
  exports.GenericClassProperty = GenericClassProperty;
333
319
  class ClassProperty extends GenericClassProperty {
334
- graph;
335
320
  constructor(typeRef, graph, isOptional) {
336
321
  super(typeRef, isOptional);
337
322
  this.graph = graph;
@@ -340,7 +325,7 @@ class ClassProperty extends GenericClassProperty {
340
325
  return this.typeData;
341
326
  }
342
327
  get type() {
343
- return (0, TypeGraph_1.derefTypeRef)(this.typeRef, this.graph);
328
+ return TypeGraph_1.derefTypeRef(this.typeRef, this.graph);
344
329
  }
345
330
  }
346
331
  exports.ClassProperty = ClassProperty;
@@ -358,58 +343,53 @@ function mapTypeIdentify(attributes, additionalPropertiesRef) {
358
343
  }
359
344
  exports.mapTypeIdentify = mapTypeIdentify;
360
345
  class ObjectType extends Type {
361
- kind;
362
- isFixed;
363
- _properties;
364
- _additionalPropertiesRef;
365
346
  constructor(typeRef, graph, kind, isFixed, _properties, _additionalPropertiesRef) {
366
- super(typeRef, graph);
367
- this.kind = kind;
347
+ super(typeRef, graph, kind);
368
348
  this.isFixed = isFixed;
369
349
  this._properties = _properties;
370
350
  this._additionalPropertiesRef = _additionalPropertiesRef;
371
351
  if (kind === "map") {
372
352
  if (_properties !== undefined) {
373
- (0, Support_1.assert)(_properties.size === 0);
353
+ Support_1.assert(_properties.size === 0);
374
354
  }
375
- (0, Support_1.assert)(!isFixed);
355
+ Support_1.assert(!isFixed);
376
356
  }
377
357
  else if (kind === "class") {
378
- (0, Support_1.assert)(_additionalPropertiesRef === undefined);
358
+ Support_1.assert(_additionalPropertiesRef === undefined);
379
359
  }
380
360
  else {
381
- (0, Support_1.assert)(isFixed);
361
+ Support_1.assert(isFixed);
382
362
  }
383
363
  }
384
364
  setProperties(properties, additionalPropertiesRef) {
385
- (0, Support_1.assert)(this._properties === undefined, "Tried to set object properties twice");
365
+ Support_1.assert(this._properties === undefined, "Tried to set object properties twice");
386
366
  if (this instanceof MapType) {
387
- (0, Support_1.assert)(properties.size === 0, "Cannot set properties on map type");
367
+ Support_1.assert(properties.size === 0, "Cannot set properties on map type");
388
368
  }
389
369
  if (this instanceof ClassType) {
390
- (0, Support_1.assert)(additionalPropertiesRef === undefined, "Cannot set additional properties of class type");
370
+ Support_1.assert(additionalPropertiesRef === undefined, "Cannot set additional properties of class type");
391
371
  }
392
372
  this._properties = properties;
393
373
  this._additionalPropertiesRef = additionalPropertiesRef;
394
374
  }
395
375
  getProperties() {
396
- return (0, Support_1.defined)(this._properties);
376
+ return Support_1.defined(this._properties);
397
377
  }
398
378
  getSortedProperties() {
399
- return (0, collection_utils_1.mapSortByKey)(this.getProperties());
379
+ return collection_utils_1.mapSortByKey(this.getProperties());
400
380
  }
401
381
  getAdditionalPropertiesRef() {
402
- (0, Support_1.assert)(this._properties !== undefined, "Properties are not set yet");
382
+ Support_1.assert(this._properties !== undefined, "Properties are not set yet");
403
383
  return this._additionalPropertiesRef;
404
384
  }
405
385
  getAdditionalProperties() {
406
386
  const tref = this.getAdditionalPropertiesRef();
407
387
  if (tref === undefined)
408
388
  return undefined;
409
- return (0, TypeGraph_1.derefTypeRef)(tref, this.graph);
389
+ return TypeGraph_1.derefTypeRef(tref, this.graph);
410
390
  }
411
391
  getNonAttributeChildren() {
412
- const types = (0, collection_utils_1.mapSortToArray)(this.getProperties(), (_, k) => k).map(([_, p]) => p.type);
392
+ const types = collection_utils_1.mapSortToArray(this.getProperties(), (_, k) => k).map(([_, p]) => p.type);
413
393
  const additionalProperties = this.getAdditionalProperties();
414
394
  if (additionalProperties !== undefined) {
415
395
  types.push(additionalProperties);
@@ -430,18 +410,18 @@ class ObjectType extends Type {
430
410
  reconstitute(builder, canonicalOrder) {
431
411
  const sortedProperties = this.getSortedProperties();
432
412
  const propertiesInNewOrder = canonicalOrder ? sortedProperties : this.getProperties();
433
- const maybePropertyTypes = builder.lookupMap((0, collection_utils_1.mapMap)(sortedProperties, cp => cp.typeRef));
434
- const maybeAdditionalProperties = (0, collection_utils_1.definedMap)(this._additionalPropertiesRef, r => builder.lookup(r));
413
+ const maybePropertyTypes = builder.lookupMap(collection_utils_1.mapMap(sortedProperties, cp => cp.typeRef));
414
+ const maybeAdditionalProperties = collection_utils_1.definedMap(this._additionalPropertiesRef, r => builder.lookup(r));
435
415
  if (maybePropertyTypes !== undefined &&
436
416
  (maybeAdditionalProperties !== undefined || this._additionalPropertiesRef === undefined)) {
437
- const properties = (0, collection_utils_1.mapMap)(propertiesInNewOrder, (cp, n) => builder.makeClassProperty((0, Support_1.defined)(maybePropertyTypes.get(n)), cp.isOptional));
417
+ const properties = collection_utils_1.mapMap(propertiesInNewOrder, (cp, n) => builder.makeClassProperty(Support_1.defined(maybePropertyTypes.get(n)), cp.isOptional));
438
418
  switch (this.kind) {
439
419
  case "object":
440
- (0, Support_1.assert)(this.isFixed);
420
+ Support_1.assert(this.isFixed);
441
421
  builder.getObjectType(properties, maybeAdditionalProperties);
442
422
  break;
443
423
  case "map":
444
- builder.getMapType((0, Support_1.defined)(maybeAdditionalProperties));
424
+ builder.getMapType(Support_1.defined(maybeAdditionalProperties));
445
425
  break;
446
426
  case "class":
447
427
  if (this.isFixed) {
@@ -452,13 +432,13 @@ class ObjectType extends Type {
452
432
  }
453
433
  break;
454
434
  default:
455
- return (0, Support_1.panic)(`Invalid object type kind ${this.kind}`);
435
+ return Support_1.panic(`Invalid object type kind ${this.kind}`);
456
436
  }
457
437
  }
458
438
  else {
459
439
  switch (this.kind) {
460
440
  case "object":
461
- (0, Support_1.assert)(this.isFixed);
441
+ Support_1.assert(this.isFixed);
462
442
  builder.getUniqueObjectType(undefined, undefined);
463
443
  break;
464
444
  case "map":
@@ -468,11 +448,11 @@ class ObjectType extends Type {
468
448
  builder.getUniqueClassType(this.isFixed, undefined);
469
449
  break;
470
450
  default:
471
- return (0, Support_1.panic)(`Invalid object type kind ${this.kind}`);
451
+ return Support_1.panic(`Invalid object type kind ${this.kind}`);
472
452
  }
473
- const reconstitutedTypes = (0, collection_utils_1.mapMap)(sortedProperties, cp => builder.reconstitute(cp.typeRef));
474
- const properties = (0, collection_utils_1.mapMap)(propertiesInNewOrder, (cp, n) => builder.makeClassProperty((0, Support_1.defined)(reconstitutedTypes.get(n)), cp.isOptional));
475
- const additionalProperties = (0, collection_utils_1.definedMap)(this._additionalPropertiesRef, r => builder.reconstitute(r));
453
+ const reconstitutedTypes = collection_utils_1.mapMap(sortedProperties, cp => builder.reconstitute(cp.typeRef));
454
+ const properties = collection_utils_1.mapMap(propertiesInNewOrder, (cp, n) => builder.makeClassProperty(Support_1.defined(reconstitutedTypes.get(n)), cp.isOptional));
455
+ const additionalProperties = collection_utils_1.definedMap(this._additionalPropertiesRef, r => builder.reconstitute(r));
476
456
  builder.setObjectProperties(properties, additionalProperties);
477
457
  }
478
458
  }
@@ -509,11 +489,11 @@ class ClassType extends ObjectType {
509
489
  exports.ClassType = ClassType;
510
490
  class MapType extends ObjectType {
511
491
  constructor(typeRef, graph, valuesRef) {
512
- super(typeRef, graph, "map", false, (0, collection_utils_1.definedMap)(valuesRef, () => new Map()), valuesRef);
492
+ super(typeRef, graph, "map", false, collection_utils_1.definedMap(valuesRef, () => new Map()), valuesRef);
513
493
  }
514
494
  // FIXME: Remove and use `getAdditionalProperties()` instead.
515
495
  get values() {
516
- return (0, Support_1.defined)(this.getAdditionalProperties());
496
+ return Support_1.defined(this.getAdditionalProperties());
517
497
  }
518
498
  }
519
499
  exports.MapType = MapType;
@@ -524,10 +504,8 @@ function enumTypeIdentity(attributes, cases) {
524
504
  }
525
505
  exports.enumTypeIdentity = enumTypeIdentity;
526
506
  class EnumType extends Type {
527
- cases;
528
- kind = "enum";
529
507
  constructor(typeRef, graph, cases) {
530
- super(typeRef, graph);
508
+ super(typeRef, graph, "enum");
531
509
  this.cases = cases;
532
510
  }
533
511
  get isNullable() {
@@ -546,25 +524,25 @@ class EnumType extends Type {
546
524
  builder.getEnumType(this.cases);
547
525
  }
548
526
  structuralEqualityStep(other, _conflateNumbers, _queue) {
549
- return (0, collection_utils_1.areEqual)(this.cases, other.cases);
527
+ return collection_utils_1.areEqual(this.cases, other.cases);
550
528
  }
551
529
  }
552
530
  exports.EnumType = EnumType;
553
531
  function setOperationCasesEqual(typesA, typesB, conflateNumbers, membersEqual) {
554
- const ma = (0, collection_utils_1.toReadonlySet)(typesA);
555
- const mb = (0, collection_utils_1.toReadonlySet)(typesB);
532
+ const ma = collection_utils_1.toReadonlySet(typesA);
533
+ const mb = collection_utils_1.toReadonlySet(typesB);
556
534
  if (ma.size !== mb.size)
557
535
  return false;
558
- return (0, collection_utils_1.iterableEvery)(ma, ta => {
559
- const tb = (0, collection_utils_1.iterableFind)(mb, t => t.kind === ta.kind);
536
+ return collection_utils_1.iterableEvery(ma, ta => {
537
+ const tb = collection_utils_1.iterableFind(mb, t => t.kind === ta.kind);
560
538
  if (tb !== undefined) {
561
539
  if (membersEqual(ta, tb))
562
540
  return true;
563
541
  }
564
542
  if (conflateNumbers) {
565
- if (ta.kind === "integer" && (0, collection_utils_1.iterableSome)(mb, t => t.kind === "double"))
543
+ if (ta.kind === "integer" && collection_utils_1.iterableSome(mb, t => t.kind === "double"))
566
544
  return true;
567
- if (ta.kind === "double" && (0, collection_utils_1.iterableSome)(mb, t => t.kind === "integer"))
545
+ if (ta.kind === "double" && collection_utils_1.iterableSome(mb, t => t.kind === "integer"))
568
546
  return true;
569
547
  }
570
548
  return false;
@@ -586,34 +564,31 @@ function intersectionTypeIdentity(attributes, memberRefs) {
586
564
  }
587
565
  exports.intersectionTypeIdentity = intersectionTypeIdentity;
588
566
  class SetOperationType extends Type {
589
- kind;
590
- _memberRefs;
591
567
  constructor(typeRef, graph, kind, _memberRefs) {
592
- super(typeRef, graph);
593
- this.kind = kind;
568
+ super(typeRef, graph, kind);
594
569
  this._memberRefs = _memberRefs;
595
570
  }
596
571
  setMembers(memberRefs) {
597
572
  if (this._memberRefs !== undefined) {
598
- return (0, Support_1.panic)("Can only set map members once");
573
+ return Support_1.panic("Can only set map members once");
599
574
  }
600
575
  this._memberRefs = memberRefs;
601
576
  }
602
577
  getMemberRefs() {
603
578
  if (this._memberRefs === undefined) {
604
- return (0, Support_1.panic)("Map members accessed before they were set");
579
+ return Support_1.panic("Map members accessed before they were set");
605
580
  }
606
581
  return this._memberRefs;
607
582
  }
608
583
  get members() {
609
- return (0, collection_utils_1.setMap)(this.getMemberRefs(), tref => (0, TypeGraph_1.derefTypeRef)(tref, this.graph));
584
+ return collection_utils_1.setMap(this.getMemberRefs(), tref => TypeGraph_1.derefTypeRef(tref, this.graph));
610
585
  }
611
586
  get sortedMembers() {
612
587
  return this.getNonAttributeChildren();
613
588
  }
614
589
  getNonAttributeChildren() {
615
590
  // FIXME: We're assuming no two members of the same kind.
616
- return (0, collection_utils_1.setSortBy)(this.members, t => t.kind);
591
+ return collection_utils_1.setSortBy(this.members, t => t.kind);
617
592
  }
618
593
  isPrimitive() {
619
594
  return false;
@@ -622,16 +597,16 @@ class SetOperationType extends Type {
622
597
  return setOperationTypeIdentity(this.kind, this.getAttributes(), this.getMemberRefs());
623
598
  }
624
599
  reconstituteSetOperation(builder, canonicalOrder, getType) {
625
- const sortedMemberRefs = (0, collection_utils_1.mapMap)(this.sortedMembers.entries(), t => t.typeRef);
600
+ const sortedMemberRefs = collection_utils_1.mapMap(this.sortedMembers.entries(), t => t.typeRef);
626
601
  const membersInOrder = canonicalOrder ? this.sortedMembers : this.members;
627
602
  const maybeMembers = builder.lookupMap(sortedMemberRefs);
628
603
  if (maybeMembers === undefined) {
629
604
  getType(undefined);
630
605
  const reconstituted = builder.reconstituteMap(sortedMemberRefs);
631
- builder.setSetOperationMembers((0, collection_utils_1.setMap)(membersInOrder, t => (0, Support_1.defined)(reconstituted.get(t))));
606
+ builder.setSetOperationMembers(collection_utils_1.setMap(membersInOrder, t => Support_1.defined(reconstituted.get(t))));
632
607
  }
633
608
  else {
634
- getType((0, collection_utils_1.setMap)(membersInOrder, t => (0, Support_1.defined)(maybeMembers.get(t))));
609
+ getType(collection_utils_1.setMap(membersInOrder, t => Support_1.defined(maybeMembers.get(t))));
635
610
  }
636
611
  }
637
612
  structuralEqualityStep(other, conflateNumbers, queue) {
@@ -644,7 +619,7 @@ class IntersectionType extends SetOperationType {
644
619
  super(typeRef, graph, "intersection", memberRefs);
645
620
  }
646
621
  get isNullable() {
647
- return (0, Support_1.panic)("isNullable not implemented for IntersectionType");
622
+ return Support_1.panic("isNullable not implemented for IntersectionType");
648
623
  }
649
624
  reconstitute(builder, canonicalOrder) {
650
625
  this.reconstituteSetOperation(builder, canonicalOrder, members => {
@@ -662,18 +637,18 @@ class UnionType extends SetOperationType {
662
637
  constructor(typeRef, graph, memberRefs) {
663
638
  super(typeRef, graph, "union", memberRefs);
664
639
  if (memberRefs !== undefined) {
665
- (0, Messages_1.messageAssert)(memberRefs.size > 0, "IRNoEmptyUnions", {});
640
+ Messages_1.messageAssert(memberRefs.size > 0, "IRNoEmptyUnions", {});
666
641
  }
667
642
  }
668
643
  setMembers(memberRefs) {
669
- (0, Messages_1.messageAssert)(memberRefs.size > 0, "IRNoEmptyUnions", {});
644
+ Messages_1.messageAssert(memberRefs.size > 0, "IRNoEmptyUnions", {});
670
645
  super.setMembers(memberRefs);
671
646
  }
672
647
  get stringTypeMembers() {
673
- return (0, collection_utils_1.setFilter)(this.members, t => isPrimitiveStringTypeKind(t.kind) || t.kind === "enum");
648
+ return collection_utils_1.setFilter(this.members, t => isPrimitiveStringTypeKind(t.kind) || t.kind === "enum");
674
649
  }
675
650
  findMember(kind) {
676
- return (0, collection_utils_1.iterableFind)(this.members, t => t.kind === kind);
651
+ return collection_utils_1.iterableFind(this.members, t => t.kind === kind);
677
652
  }
678
653
  get isNullable() {
679
654
  return this.findMember("null") !== undefined;
@@ -682,7 +657,7 @@ class UnionType extends SetOperationType {
682
657
  const members = this.members;
683
658
  if (members.size <= 1)
684
659
  return false;
685
- const kinds = (0, collection_utils_1.setMap)(members, t => t.kind);
660
+ const kinds = collection_utils_1.setMap(members, t => t.kind);
686
661
  if (kinds.size < members.size)
687
662
  return false;
688
663
  if (kinds.has("union") || kinds.has("intersection"))
@@ -3,7 +3,7 @@ import { TypeGraph, TypeRef } from "./TypeGraph";
3
3
  import { TypeAttributes, TypeAttributeKind } from "./attributes/TypeAttributes";
4
4
  import { StringTypes } from "./attributes/StringTypes";
5
5
  export declare const provenanceTypeAttributeKind: TypeAttributeKind<Set<number>>;
6
- export type StringTypeMapping = ReadonlyMap<TransformedStringTypeKind, PrimitiveStringTypeKind>;
6
+ export declare type StringTypeMapping = ReadonlyMap<TransformedStringTypeKind, PrimitiveStringTypeKind>;
7
7
  export declare function stringTypeMappingGet(stm: StringTypeMapping, kind: TransformedStringTypeKind): PrimitiveStringTypeKind;
8
8
  export declare function getNoStringTypeMapping(): StringTypeMapping;
9
9
  export declare class TypeBuilder {
@@ -32,7 +32,7 @@ export declare class TypeBuilder {
32
32
  protected forwardIfNecessary(forwardingRef: TypeRef | undefined, tref: undefined): undefined;
33
33
  protected forwardIfNecessary(forwardingRef: TypeRef | undefined, tref: TypeRef): TypeRef;
34
34
  protected forwardIfNecessary(forwardingRef: TypeRef | undefined, tref: TypeRef | undefined): TypeRef | undefined;
35
- get didAddForwardingIntersection(): boolean;
35
+ readonly didAddForwardingIntersection: boolean;
36
36
  private readonly _typeForIdentity;
37
37
  private registerTypeForIdentity;
38
38
  protected makeIdentity(maker: () => MaybeTypeIdentity): MaybeTypeIdentity;