quicktype 17.0.4 → 17.0.6

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 +12 -9
  79. package/dist/quicktype-core/language/CPlusPlus.js +249 -251
  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,7 +1,6 @@
1
1
  "use strict";
2
2
  // Taken from https://github.com/Microsoft/TypeScript
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.isES3IdentifierPart = exports.isES3IdentifierStart = void 0;
5
4
  function lookupInUnicodeMap(code, map) {
6
5
  // Bail out quickly if it couldn't possibly be in the map.
7
6
  if (code < map[0]) {
@@ -28,20 +27,20 @@ function lookupInUnicodeMap(code, map) {
28
27
  return false;
29
28
  }
30
29
  function isES3IdentifierStart(ch) {
31
- return ((ch >= 65 /* CharacterCodes.A */ && ch <= 90 /* CharacterCodes.Z */) ||
32
- (ch >= 97 /* CharacterCodes.a */ && ch <= 122 /* CharacterCodes.z */) ||
33
- ch === 36 /* CharacterCodes.$ */ ||
34
- ch === 95 /* CharacterCodes._ */ ||
35
- (ch > 127 /* CharacterCodes.maxAsciiCharacter */ && lookupInUnicodeMap(ch, unicodeES3IdentifierStart)));
30
+ return ((ch >= 65 /* A */ && ch <= 90 /* Z */) ||
31
+ (ch >= 97 /* a */ && ch <= 122 /* z */) ||
32
+ ch === 36 /* $ */ ||
33
+ ch === 95 /* _ */ ||
34
+ (ch > 127 /* maxAsciiCharacter */ && lookupInUnicodeMap(ch, unicodeES3IdentifierStart)));
36
35
  }
37
36
  exports.isES3IdentifierStart = isES3IdentifierStart;
38
37
  function isES3IdentifierPart(ch) {
39
- return ((ch >= 65 /* CharacterCodes.A */ && ch <= 90 /* CharacterCodes.Z */) ||
40
- (ch >= 97 /* CharacterCodes.a */ && ch <= 122 /* CharacterCodes.z */) ||
41
- (ch >= 48 /* CharacterCodes._0 */ && ch <= 57 /* CharacterCodes._9 */) ||
42
- ch === 36 /* CharacterCodes.$ */ ||
43
- ch === 95 /* CharacterCodes._ */ ||
44
- (ch > 127 /* CharacterCodes.maxAsciiCharacter */ && lookupInUnicodeMap(ch, unicodeES3IdentifierPart)));
38
+ return ((ch >= 65 /* A */ && ch <= 90 /* Z */) ||
39
+ (ch >= 97 /* a */ && ch <= 122 /* z */) ||
40
+ (ch >= 48 /* _0 */ && ch <= 57 /* _9 */) ||
41
+ ch === 36 /* $ */ ||
42
+ ch === 95 /* _ */ ||
43
+ (ch > 127 /* maxAsciiCharacter */ && lookupInUnicodeMap(ch, unicodeES3IdentifierPart)));
45
44
  }
46
45
  exports.isES3IdentifierPart = isES3IdentifierPart;
47
46
  /*
@@ -20,8 +20,8 @@ export declare const kotlinOptions: {
20
20
  export declare class KotlinTargetLanguage extends TargetLanguage {
21
21
  constructor();
22
22
  protected getOptions(): Option<any>[];
23
- get supportsOptionalClassProperties(): boolean;
24
- get supportsUnionsWithBothNumberTypes(): boolean;
23
+ readonly supportsOptionalClassProperties: boolean;
24
+ readonly supportsUnionsWithBothNumberTypes: boolean;
25
25
  protected makeRenderer(renderContext: RenderContext, untypedOptionValues: {
26
26
  [name: string]: any;
27
27
  }): ConvenienceRenderer;
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.KotlinXRenderer = exports.KotlinJacksonRenderer = exports.KotlinKlaxonRenderer = exports.KotlinRenderer = exports.KotlinTargetLanguage = exports.kotlinOptions = exports.Framework = void 0;
4
3
  const collection_utils_1 = require("collection-utils");
5
4
  const Annotation_1 = require("../Annotation");
6
5
  const ConvenienceRenderer_1 = require("../ConvenienceRenderer");
@@ -27,7 +26,7 @@ exports.kotlinOptions = {
27
26
  ["klaxon", Framework.Klaxon],
28
27
  ["kotlinx", Framework.KotlinX]
29
28
  ], "klaxon"),
30
- acronymStyle: (0, Acronyms_1.acronymOption)(Acronyms_1.AcronymStyleOptions.Pascal),
29
+ acronymStyle: Acronyms_1.acronymOption(Acronyms_1.AcronymStyleOptions.Pascal),
31
30
  packageName: new RendererOptions_1.StringOption("package", "Package", "PACKAGE", "quicktype")
32
31
  };
33
32
  class KotlinTargetLanguage extends TargetLanguage_1.TargetLanguage {
@@ -44,7 +43,7 @@ class KotlinTargetLanguage extends TargetLanguage_1.TargetLanguage {
44
43
  return true;
45
44
  }
46
45
  makeRenderer(renderContext, untypedOptionValues) {
47
- const options = (0, RendererOptions_1.getOptionValues)(exports.kotlinOptions, untypedOptionValues);
46
+ const options = RendererOptions_1.getOptionValues(exports.kotlinOptions, untypedOptionValues);
48
47
  switch (options.framework) {
49
48
  case Framework.None:
50
49
  return new KotlinRenderer(this, renderContext, options);
@@ -55,7 +54,7 @@ class KotlinTargetLanguage extends TargetLanguage_1.TargetLanguage {
55
54
  case Framework.KotlinX:
56
55
  return new KotlinXRenderer(this, renderContext, options);
57
56
  default:
58
- return (0, Support_1.assertNever)(options.framework);
57
+ return Support_1.assertNever(options.framework);
59
58
  }
60
59
  }
61
60
  }
@@ -112,26 +111,25 @@ const keywords = [
112
111
  "Klaxon"
113
112
  ];
114
113
  function isPartCharacter(codePoint) {
115
- return (0, Strings_1.isLetterOrUnderscore)(codePoint) || (0, Strings_1.isNumeric)(codePoint);
114
+ return Strings_1.isLetterOrUnderscore(codePoint) || Strings_1.isNumeric(codePoint);
116
115
  }
117
116
  function isStartCharacter(codePoint) {
118
- return isPartCharacter(codePoint) && !(0, Strings_1.isDigit)(codePoint);
117
+ return isPartCharacter(codePoint) && !Strings_1.isDigit(codePoint);
119
118
  }
120
- const legalizeName = (0, Strings_1.legalizeCharacters)(isPartCharacter);
119
+ const legalizeName = Strings_1.legalizeCharacters(isPartCharacter);
121
120
  function kotlinNameStyle(isUpper, original, acronymsStyle = Strings_1.allUpperWordStyle) {
122
- const words = (0, Strings_1.splitIntoWords)(original);
123
- return (0, Strings_1.combineWords)(words, legalizeName, isUpper ? Strings_1.firstUpperWordStyle : Strings_1.allLowerWordStyle, Strings_1.firstUpperWordStyle, isUpper ? Strings_1.allUpperWordStyle : Strings_1.allLowerWordStyle, acronymsStyle, "", isStartCharacter);
121
+ const words = Strings_1.splitIntoWords(original);
122
+ return Strings_1.combineWords(words, legalizeName, isUpper ? Strings_1.firstUpperWordStyle : Strings_1.allLowerWordStyle, Strings_1.firstUpperWordStyle, isUpper ? Strings_1.allUpperWordStyle : Strings_1.allLowerWordStyle, acronymsStyle, "", isStartCharacter);
124
123
  }
125
124
  function unicodeEscape(codePoint) {
126
- return "\\u" + (0, Strings_1.intToHex)(codePoint, 4);
125
+ return "\\u" + Strings_1.intToHex(codePoint, 4);
127
126
  }
128
- const _stringEscape = (0, Strings_1.utf32ConcatMap)((0, Strings_1.escapeNonPrintableMapper)(Strings_1.isPrintable, unicodeEscape));
127
+ const _stringEscape = Strings_1.utf32ConcatMap(Strings_1.escapeNonPrintableMapper(Strings_1.isPrintable, unicodeEscape));
129
128
  function stringEscape(s) {
130
129
  // "$this" is a template string in Kotlin so we have to escape $
131
130
  return _stringEscape(s).replace(/\$/g, "\\$");
132
131
  }
133
132
  class KotlinRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
134
- _kotlinOptions;
135
133
  constructor(targetLanguage, renderContext, _kotlinOptions) {
136
134
  super(targetLanguage, renderContext);
137
135
  this._kotlinOptions = _kotlinOptions;
@@ -152,16 +150,16 @@ class KotlinRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
152
150
  return kotlinNameStyle(true, rawName);
153
151
  }
154
152
  makeNamedTypeNamer() {
155
- return (0, Naming_1.funPrefixNamer)("upper", s => kotlinNameStyle(true, s, (0, Acronyms_1.acronymStyle)(this._kotlinOptions.acronymStyle)));
153
+ return Naming_1.funPrefixNamer("upper", s => kotlinNameStyle(true, s, Acronyms_1.acronymStyle(this._kotlinOptions.acronymStyle)));
156
154
  }
157
155
  namerForObjectProperty() {
158
- return (0, Naming_1.funPrefixNamer)("lower", s => kotlinNameStyle(false, s, (0, Acronyms_1.acronymStyle)(this._kotlinOptions.acronymStyle)));
156
+ return Naming_1.funPrefixNamer("lower", s => kotlinNameStyle(false, s, Acronyms_1.acronymStyle(this._kotlinOptions.acronymStyle)));
159
157
  }
160
158
  makeUnionMemberNamer() {
161
- return (0, Naming_1.funPrefixNamer)("upper", s => kotlinNameStyle(true, s) + "Value");
159
+ return Naming_1.funPrefixNamer("upper", s => kotlinNameStyle(true, s) + "Value");
162
160
  }
163
161
  makeEnumCaseNamer() {
164
- return (0, Naming_1.funPrefixNamer)("upper", s => kotlinNameStyle(true, s, (0, Acronyms_1.acronymStyle)(this._kotlinOptions.acronymStyle)));
162
+ return Naming_1.funPrefixNamer("upper", s => kotlinNameStyle(true, s, Acronyms_1.acronymStyle(this._kotlinOptions.acronymStyle)));
165
163
  }
166
164
  emitDescriptionBlock(lines) {
167
165
  this.emitCommentLines(lines, " * ", "/**", " */");
@@ -185,12 +183,12 @@ class KotlinRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
185
183
  }
186
184
  kotlinType(t, withIssues = false, noOptional = false) {
187
185
  const optional = noOptional ? "" : "?";
188
- return (0, TypeUtils_1.matchType)(t, _anyType => {
189
- return (0, Source_1.maybeAnnotated)(withIssues, Annotation_1.anyTypeIssueAnnotation, this.anySourceType(optional));
186
+ return TypeUtils_1.matchType(t, _anyType => {
187
+ return Source_1.maybeAnnotated(withIssues, Annotation_1.anyTypeIssueAnnotation, this.anySourceType(optional));
190
188
  }, _nullType => {
191
- return (0, Source_1.maybeAnnotated)(withIssues, Annotation_1.nullTypeIssueAnnotation, this.anySourceType(optional));
189
+ return Source_1.maybeAnnotated(withIssues, Annotation_1.nullTypeIssueAnnotation, this.anySourceType(optional));
192
190
  }, _boolType => "Boolean", _integerType => "Long", _doubleType => "Double", _stringType => "String", arrayType => this.arrayType(arrayType, withIssues), classType => this.nameForNamedType(classType), mapType => this.mapType(mapType, withIssues), enumType => this.nameForNamedType(enumType), unionType => {
193
- const nullable = (0, TypeUtils_1.nullableFromUnion)(unionType);
191
+ const nullable = TypeUtils_1.nullableFromUnion(unionType);
194
192
  if (nullable !== null)
195
193
  return [this.kotlinType(nullable, withIssues), optional];
196
194
  return this.nameForNamedType(unionType);
@@ -243,7 +241,7 @@ class KotlinRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
243
241
  let count = c.getProperties().size;
244
242
  let first = true;
245
243
  this.forEachClassProperty(c, "none", (name, jsonName, p) => {
246
- const nullable = p.type.kind === "union" && (0, TypeUtils_1.nullableFromUnion)(p.type) !== null;
244
+ const nullable = p.type.kind === "union" && TypeUtils_1.nullableFromUnion(p.type) !== null;
247
245
  const nullableOrOptional = p.isOptional || p.type.kind === "null" || nullable;
248
246
  const last = --count === 0;
249
247
  let meta = [];
@@ -293,7 +291,7 @@ class KotlinRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
293
291
  return "_" + kind;
294
292
  }
295
293
  this.emitDescription(this.descriptionForType(u));
296
- const [maybeNull, nonNulls] = (0, TypeUtils_1.removeNullFromUnion)(u, sortBy);
294
+ const [maybeNull, nonNulls] = TypeUtils_1.removeNullFromUnion(u, sortBy);
297
295
  this.emitClassAnnotations(u, unionName);
298
296
  this.emitBlock(["sealed class ", unionName], () => {
299
297
  {
@@ -338,29 +336,29 @@ class KotlinKlaxonRenderer extends KotlinRenderer {
338
336
  super(targetLanguage, renderContext, _kotlinOptions);
339
337
  }
340
338
  unionMemberFromJsonValue(t, e) {
341
- return (0, TypeUtils_1.matchType)(t, _anyType => [e, ".inside"], _nullType => "null", _boolType => [e, ".boolean"], _integerType => ["(", e, ".int?.toLong() ?: ", e, ".longValue)"], _doubleType => [e, ".double"], _stringType => [e, ".string"], arrayType => [e, ".array?.let { klaxon.parseFromJsonArray<", this.kotlinType(arrayType.items), ">(it) }"], _classType => [e, ".obj?.let { klaxon.parseFromJsonObject<", this.kotlinType(t), ">(it) }"], _mapType => [e, ".obj?.let { klaxon.parseFromJsonObject<", this.kotlinType(t), ">(it) }"], enumType => [e, ".string?.let { ", this.kotlinType(enumType), ".fromValue(it) }"], _unionType => (0, Support_1.mustNotHappen)());
339
+ return TypeUtils_1.matchType(t, _anyType => [e, ".inside"], _nullType => "null", _boolType => [e, ".boolean"], _integerType => ["(", e, ".int?.toLong() ?: ", e, ".longValue)"], _doubleType => [e, ".double"], _stringType => [e, ".string"], arrayType => [e, ".array?.let { klaxon.parseFromJsonArray<", this.kotlinType(arrayType.items), ">(it) }"], _classType => [e, ".obj?.let { klaxon.parseFromJsonObject<", this.kotlinType(t), ">(it) }"], _mapType => [e, ".obj?.let { klaxon.parseFromJsonObject<", this.kotlinType(t), ">(it) }"], enumType => [e, ".string?.let { ", this.kotlinType(enumType), ".fromValue(it) }"], _unionType => Support_1.mustNotHappen());
342
340
  }
343
341
  unionMemberJsonValueGuard(t, _e) {
344
- return (0, TypeUtils_1.matchType)(t, _anyType => "is Any", _nullType => "null", _boolType => "is Boolean", _integerType => "is Int, is Long", _doubleType => "is Double", _stringType => "is String", _arrayType => "is JsonArray<*>",
342
+ return TypeUtils_1.matchType(t, _anyType => "is Any", _nullType => "null", _boolType => "is Boolean", _integerType => "is Int, is Long", _doubleType => "is Double", _stringType => "is String", _arrayType => "is JsonArray<*>",
345
343
  // These could be stricter, but for now we don't allow maps
346
344
  // and objects in the same union
347
345
  _classType => "is JsonObject", _mapType => "is JsonObject",
348
346
  // This could be stricter, but for now we don't allow strings
349
347
  // and enums in the same union
350
- _enumType => "is String", _unionType => (0, Support_1.mustNotHappen)());
348
+ _enumType => "is String", _unionType => Support_1.mustNotHappen());
351
349
  }
352
350
  emitUsageHeader() {
353
351
  this.emitLine("// To parse the JSON, install Klaxon and do:");
354
352
  this.emitLine("//");
355
353
  this.forEachTopLevel("none", (_, name) => {
356
- this.emitLine("// val ", (0, Source_1.modifySource)(Strings_1.camelCase, name), " = ", name, ".fromJson(jsonString)");
354
+ this.emitLine("// val ", Source_1.modifySource(Strings_1.camelCase, name), " = ", name, ".fromJson(jsonString)");
357
355
  });
358
356
  }
359
357
  emitHeader() {
360
358
  super.emitHeader();
361
359
  this.emitLine("import com.beust.klaxon.*");
362
- const hasUnions = (0, collection_utils_1.iterableSome)(this.typeGraph.allNamedTypes(), t => t instanceof Type_1.UnionType && (0, TypeUtils_1.nullableFromUnion)(t) === null);
363
- const hasEmptyObjects = (0, collection_utils_1.iterableSome)(this.typeGraph.allNamedTypes(), c => c instanceof Type_1.ClassType && c.getProperties().size === 0);
360
+ const hasUnions = collection_utils_1.iterableSome(this.typeGraph.allNamedTypes(), t => t instanceof Type_1.UnionType && TypeUtils_1.nullableFromUnion(t) === null);
361
+ const hasEmptyObjects = collection_utils_1.iterableSome(this.typeGraph.allNamedTypes(), c => c instanceof Type_1.ClassType && c.getProperties().size === 0);
364
362
  if (hasUnions || this.haveEnums || hasEmptyObjects) {
365
363
  this.emitGenericConverter();
366
364
  }
@@ -428,14 +426,14 @@ class KotlinKlaxonRenderer extends KotlinRenderer {
428
426
  if (ignore) {
429
427
  properties.push("ignored = true");
430
428
  }
431
- return properties.length === 0 ? undefined : ["@Json(", (0, collection_utils_1.arrayIntercalate)(", ", properties), ")"];
429
+ return properties.length === 0 ? undefined : ["@Json(", collection_utils_1.arrayIntercalate(", ", properties), ")"];
432
430
  }
433
431
  emitEmptyClassDefinition(c, className) {
434
432
  this.emitDescription(this.descriptionForType(c));
435
433
  this.emitLine("typealias ", className, " = JsonObject");
436
434
  }
437
435
  emitClassDefinitionMethods(c, className) {
438
- const isTopLevel = (0, collection_utils_1.iterableSome)(this.topLevels, ([_, top]) => top === c);
436
+ const isTopLevel = collection_utils_1.iterableSome(this.topLevels, ([_, top]) => top === c);
439
437
  if (isTopLevel) {
440
438
  this.emitBlock(")", () => {
441
439
  this.emitLine("public fun toJson() = klaxon.toJsonString(this)");
@@ -537,19 +535,19 @@ class KotlinJacksonRenderer extends KotlinRenderer {
537
535
  super(targetLanguage, renderContext, _kotlinOptions);
538
536
  }
539
537
  unionMemberJsonValueGuard(t, _e) {
540
- return (0, TypeUtils_1.matchType)(t, _anyType => "is Any", _nullType => "null", _boolType => "is BooleanNode", _integerType => "is IntNode, is LongNode", _doubleType => "is DoubleNode", _stringType => "is TextNode", _arrayType => "is ArrayNode",
538
+ return TypeUtils_1.matchType(t, _anyType => "is Any", _nullType => "null", _boolType => "is BooleanNode", _integerType => "is IntNode, is LongNode", _doubleType => "is DoubleNode", _stringType => "is TextNode", _arrayType => "is ArrayNode",
541
539
  // These could be stricter, but for now we don't allow maps
542
540
  // and objects in the same union
543
541
  _classType => "is ObjectNode", _mapType => "is ObjectNode",
544
542
  // This could be stricter, but for now we don't allow strings
545
543
  // and enums in the same union
546
- _enumType => "is TextNode", _unionType => (0, Support_1.mustNotHappen)());
544
+ _enumType => "is TextNode", _unionType => Support_1.mustNotHappen());
547
545
  }
548
546
  emitUsageHeader() {
549
547
  this.emitLine("// To parse the JSON, install jackson-module-kotlin and do:");
550
548
  this.emitLine("//");
551
549
  this.forEachTopLevel("none", (_, name) => {
552
- this.emitLine("// val ", (0, Source_1.modifySource)(Strings_1.camelCase, name), " = ", name, ".fromJson(jsonString)");
550
+ this.emitLine("// val ", Source_1.modifySource(Strings_1.camelCase, name), " = ", name, ".fromJson(jsonString)");
553
551
  });
554
552
  }
555
553
  emitHeader() {
@@ -562,8 +560,8 @@ import com.fasterxml.jackson.databind.module.SimpleModule
562
560
  import com.fasterxml.jackson.databind.node.*
563
561
  import com.fasterxml.jackson.databind.ser.std.StdSerializer
564
562
  import com.fasterxml.jackson.module.kotlin.*`);
565
- const hasUnions = (0, collection_utils_1.iterableSome)(this.typeGraph.allNamedTypes(), t => t instanceof Type_1.UnionType && (0, TypeUtils_1.nullableFromUnion)(t) === null);
566
- const hasEmptyObjects = (0, collection_utils_1.iterableSome)(this.typeGraph.allNamedTypes(), c => c instanceof Type_1.ClassType && c.getProperties().size === 0);
563
+ const hasUnions = collection_utils_1.iterableSome(this.typeGraph.allNamedTypes(), t => t instanceof Type_1.UnionType && TypeUtils_1.nullableFromUnion(t) === null);
564
+ const hasEmptyObjects = collection_utils_1.iterableSome(this.typeGraph.allNamedTypes(), c => c instanceof Type_1.ClassType && c.getProperties().size === 0);
567
565
  if (hasUnions || this.haveEnums || hasEmptyObjects) {
568
566
  this.emitGenericConverter();
569
567
  }
@@ -637,8 +635,8 @@ import com.fasterxml.jackson.module.kotlin.*`);
637
635
  propertyOpts.push("required=true");
638
636
  }
639
637
  if (propertyOpts.length > 0) {
640
- properties.push(["@get:JsonProperty(", (0, collection_utils_1.arrayIntercalate)(", ", propertyOpts), ")"]);
641
- properties.push(["@field:JsonProperty(", (0, collection_utils_1.arrayIntercalate)(", ", propertyOpts), ")"]);
638
+ properties.push(["@get:JsonProperty(", collection_utils_1.arrayIntercalate(", ", propertyOpts), ")"]);
639
+ properties.push(["@field:JsonProperty(", collection_utils_1.arrayIntercalate(", ", propertyOpts), ")"]);
642
640
  }
643
641
  if (ignore) {
644
642
  properties.push("@get:JsonIgnore");
@@ -651,7 +649,7 @@ import com.fasterxml.jackson.module.kotlin.*`);
651
649
  this.emitLine("typealias ", className, " = JsonNode");
652
650
  }
653
651
  emitClassDefinitionMethods(c, className) {
654
- const isTopLevel = (0, collection_utils_1.iterableSome)(this.topLevels, ([_, top]) => top === c);
652
+ const isTopLevel = collection_utils_1.iterableSome(this.topLevels, ([_, top]) => top === c);
655
653
  if (isTopLevel) {
656
654
  this.emitBlock(")", () => {
657
655
  this.emitLine("fun toJson() = mapper.writeValueAsString(this)");
@@ -787,7 +785,7 @@ class KotlinXRenderer extends KotlinRenderer {
787
785
  this.forEachTopLevel("none", (_, name) => {
788
786
  table.push([
789
787
  "// val ",
790
- (0, Source_1.modifySource)(Strings_1.camelCase, name),
788
+ Source_1.modifySource(Strings_1.camelCase, name),
791
789
  ` = json.parse(${this.sourcelikeToString(name)}.serializer(), jsonString)`
792
790
  ]);
793
791
  });
@@ -5,8 +5,8 @@ import { Sourcelike } from "../Source";
5
5
  import { ConvenienceRenderer, ForbiddenWordsInfo } from "../ConvenienceRenderer";
6
6
  import { StringOption, BooleanOption, EnumOption, Option, OptionValues } from "../RendererOptions";
7
7
  import { RenderContext } from "../Renderer";
8
- export type MemoryAttribute = "assign" | "strong" | "copy";
9
- export type OutputFeatures = {
8
+ export declare type MemoryAttribute = "assign" | "strong" | "copy";
9
+ export declare type OutputFeatures = {
10
10
  interface: boolean;
11
11
  implementation: boolean;
12
12
  };
@@ -74,6 +74,6 @@ export declare class ObjectiveCRenderer extends ConvenienceRenderer {
74
74
  private emitPseudoEnumInterface;
75
75
  private emitPseudoEnumImplementation;
76
76
  protected emitSourceStructure(proposedFilename: string): void;
77
- private get needsMap();
77
+ private readonly needsMap;
78
78
  protected emitMapFunction(): void;
79
79
  }
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ObjectiveCRenderer = exports.ObjectiveCTargetLanguage = exports.objcOptions = void 0;
4
3
  const collection_utils_1 = require("collection-utils");
5
4
  const TargetLanguage_1 = require("../TargetLanguage");
6
5
  const Type_1 = require("../Type");
@@ -39,14 +38,14 @@ class ObjectiveCTargetLanguage extends TargetLanguage_1.TargetLanguage {
39
38
  ];
40
39
  }
41
40
  makeRenderer(renderContext, untypedOptionValues) {
42
- return new ObjectiveCRenderer(this, renderContext, (0, RendererOptions_1.getOptionValues)(exports.objcOptions, untypedOptionValues));
41
+ return new ObjectiveCRenderer(this, renderContext, RendererOptions_1.getOptionValues(exports.objcOptions, untypedOptionValues));
43
42
  }
44
43
  }
45
44
  exports.ObjectiveCTargetLanguage = ObjectiveCTargetLanguage;
46
45
  function typeNameStyle(prefix, original) {
47
- const words = (0, Strings_1.splitIntoWords)(original);
48
- const result = (0, Strings_1.combineWords)(words, legalizeName, Strings_1.firstUpperWordStyle, Strings_1.firstUpperWordStyle, Strings_1.allUpperWordStyle, Strings_1.allUpperWordStyle, "", isStartCharacter);
49
- return (0, Strings_1.addPrefixIfNecessary)(prefix, result);
46
+ const words = Strings_1.splitIntoWords(original);
47
+ const result = Strings_1.combineWords(words, legalizeName, Strings_1.firstUpperWordStyle, Strings_1.firstUpperWordStyle, Strings_1.allUpperWordStyle, Strings_1.allUpperWordStyle, "", isStartCharacter);
48
+ return Strings_1.addPrefixIfNecessary(prefix, result);
50
49
  }
51
50
  function propertyNameStyle(original, isBool = false) {
52
51
  // Objective-C developers are uncomfortable with property "id"
@@ -54,7 +53,7 @@ function propertyNameStyle(original, isBool = false) {
54
53
  if (original === "id") {
55
54
  original = "identifier";
56
55
  }
57
- let words = (0, Strings_1.splitIntoWords)(original);
56
+ let words = Strings_1.splitIntoWords(original);
58
57
  if (isBool) {
59
58
  if (words.length === 0) {
60
59
  words = [{ word: "flag", isAcronym: false }];
@@ -68,7 +67,7 @@ function propertyNameStyle(original, isBool = false) {
68
67
  if (words.length > 0 && forbiddenPropertyNames.indexOf(words[0].word) >= 0) {
69
68
  words = [{ word: "the", isAcronym: false }, ...words];
70
69
  }
71
- return (0, Strings_1.combineWords)(words, legalizeName, Strings_1.allLowerWordStyle, Strings_1.firstUpperWordStyle, Strings_1.allLowerWordStyle, Strings_1.allUpperWordStyle, "", isStartCharacter);
70
+ return Strings_1.combineWords(words, legalizeName, Strings_1.allLowerWordStyle, Strings_1.firstUpperWordStyle, Strings_1.allLowerWordStyle, Strings_1.allUpperWordStyle, "", isStartCharacter);
72
71
  }
73
72
  const keywords = [
74
73
  /*
@@ -157,7 +156,7 @@ function isPartCharacter(utf16Unit) {
157
156
  const category = unicode.getCategory(utf16Unit);
158
157
  return ["Nd", "Pc", "Mn", "Mc"].indexOf(category) >= 0 || isStartCharacter(utf16Unit);
159
158
  }
160
- const legalizeName = (0, Strings_1.utf16LegalizeCharacters)(isPartCharacter);
159
+ const legalizeName = Strings_1.utf16LegalizeCharacters(isPartCharacter);
161
160
  const staticEnumValuesIdentifier = "values";
162
161
  const forbiddenForEnumCases = ["new", staticEnumValuesIdentifier];
163
162
  function splitExtension(filename) {
@@ -167,15 +166,12 @@ function splitExtension(filename) {
167
166
  return [filename, extension === undefined ? "m" : extension];
168
167
  }
169
168
  class ObjectiveCRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
170
- _options;
171
- _currentFilename;
172
- _classPrefix;
173
169
  constructor(targetLanguage, renderContext, _options) {
174
170
  super(targetLanguage, renderContext);
175
171
  this._options = _options;
176
172
  // Infer the class prefix from a top-level name if it's not given
177
173
  if (_options.classPrefix === DEFAULT_CLASS_PREFIX) {
178
- const aTopLevel = (0, Support_1.defined)((0, collection_utils_1.iterableFirst)(this.topLevels.keys()));
174
+ const aTopLevel = Support_1.defined(collection_utils_1.iterableFirst(this.topLevels.keys()));
179
175
  this._classPrefix = this.inferClassPrefix(aTopLevel);
180
176
  }
181
177
  else {
@@ -185,7 +181,7 @@ class ObjectiveCRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
185
181
  inferClassPrefix(name) {
186
182
  const l = name.length;
187
183
  let firstNonUpper = 0;
188
- while (firstNonUpper < l && (0, Strings_1.fastIsUpperCase)(name.charCodeAt(firstNonUpper))) {
184
+ while (firstNonUpper < l && Strings_1.fastIsUpperCase(name.charCodeAt(firstNonUpper))) {
189
185
  firstNonUpper += 1;
190
186
  }
191
187
  if (firstNonUpper < 2)
@@ -202,7 +198,7 @@ class ObjectiveCRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
202
198
  return { names: forbiddenForEnumCases, includeGlobalForbidden: true };
203
199
  }
204
200
  makeNamedTypeNamer() {
205
- return (0, Naming_1.funPrefixNamer)("types", rawName => typeNameStyle(this._classPrefix, rawName));
201
+ return Naming_1.funPrefixNamer("types", rawName => typeNameStyle(this._classPrefix, rawName));
206
202
  }
207
203
  namerForObjectProperty(_, p) {
208
204
  // TODO why is underscore being removed?
@@ -245,52 +241,52 @@ class ObjectiveCRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
245
241
  }
246
242
  }
247
243
  startFile(basename, extension) {
248
- (0, Support_1.assert)(this._currentFilename === undefined, "Previous file wasn't finished");
244
+ Support_1.assert(this._currentFilename === undefined, "Previous file wasn't finished");
249
245
  // FIXME: The filenames should actually be Sourcelikes, too
250
246
  this._currentFilename = `${this.sourcelikeToString(basename)}.${extension}`;
251
247
  }
252
248
  finishFile() {
253
- super.finishFile((0, Support_1.defined)(this._currentFilename));
249
+ super.finishFile(Support_1.defined(this._currentFilename));
254
250
  this._currentFilename = undefined;
255
251
  }
256
252
  memoryAttribute(t, isNullable) {
257
- return (0, TypeUtils_1.matchType)(t, _anyType => "copy", _nullType => "copy", _boolType => (isNullable ? "strong" : "assign"), _integerType => (isNullable ? "strong" : "assign"), _doubleType => (isNullable ? "strong" : "assign"), _stringType => "copy", _arrayType => "copy", _classType => "strong", _mapType => "copy", _enumType => "assign", unionType => {
258
- const nullable = (0, TypeUtils_1.nullableFromUnion)(unionType);
253
+ return TypeUtils_1.matchType(t, _anyType => "copy", _nullType => "copy", _boolType => (isNullable ? "strong" : "assign"), _integerType => (isNullable ? "strong" : "assign"), _doubleType => (isNullable ? "strong" : "assign"), _stringType => "copy", _arrayType => "copy", _classType => "strong", _mapType => "copy", _enumType => "assign", unionType => {
254
+ const nullable = TypeUtils_1.nullableFromUnion(unionType);
259
255
  return nullable !== null ? this.memoryAttribute(nullable, true) : "copy";
260
256
  });
261
257
  }
262
258
  objcType(t, nullableOrBoxed = false) {
263
- return (0, TypeUtils_1.matchType)(t, _anyType => ["id", ""],
259
+ return TypeUtils_1.matchType(t, _anyType => ["id", ""],
264
260
  // For now, we're treating nulls just like any
265
261
  _nullType => ["id", ""], _boolType => (nullableOrBoxed ? ["NSNumber", " *"] : ["BOOL", ""]), _integerType => (nullableOrBoxed ? ["NSNumber", " *"] : ["NSInteger", ""]), _doubleType => (nullableOrBoxed ? ["NSNumber", " *"] : ["double", ""]), _stringType => ["NSString", " *"], arrayType => {
266
262
  const itemType = arrayType.items;
267
263
  const itemTypeName = this.objcType(itemType, true);
268
264
  // NSArray<id>* === NSArray*
269
- if ((0, TypeUtils_1.isAnyOrNull)(itemType)) {
265
+ if (TypeUtils_1.isAnyOrNull(itemType)) {
270
266
  return ["NSArray", " *"];
271
267
  }
272
268
  return [["NSArray<", itemTypeName, ">"], " *"];
273
269
  }, classType => [this.nameForNamedType(classType), " *"], mapType => [["NSDictionary<NSString *, ", this.objcType(mapType.values, true), ">"], " *"], enumType => [this.nameForNamedType(enumType), " *"], unionType => {
274
- const nullable = (0, TypeUtils_1.nullableFromUnion)(unionType);
270
+ const nullable = TypeUtils_1.nullableFromUnion(unionType);
275
271
  return nullable !== null ? this.objcType(nullable, true) : ["id", ""];
276
272
  });
277
273
  }
278
274
  jsonType(t) {
279
- return (0, TypeUtils_1.matchType)(t, _anyType => ["id", ""],
275
+ return TypeUtils_1.matchType(t, _anyType => ["id", ""],
280
276
  // For now, we're treating nulls just like any
281
277
  _nullType => ["id", ""], _boolType => ["NSNumber", " *"], _integerType => ["NSNumber", " *"], _doubleType => ["NSNumber", " *"], _stringType => ["NSString", " *"], _arrayType => ["NSArray", " *"], _classType => ["NSDictionary<NSString *, id>", " *"], mapType => [["NSDictionary<NSString *, ", this.jsonType(mapType.values), ">"], " *"], _enumType => ["NSString", " *"], unionType => {
282
- const nullable = (0, TypeUtils_1.nullableFromUnion)(unionType);
278
+ const nullable = TypeUtils_1.nullableFromUnion(unionType);
283
279
  return nullable !== null ? this.jsonType(nullable) : ["id", ""];
284
280
  });
285
281
  }
286
282
  fromDynamicExpression(t, ...dynamic) {
287
- return (0, TypeUtils_1.matchType)(t, _anyType => dynamic, _nullType => dynamic, _boolType => dynamic, _integerType => dynamic, _doubleType => dynamic, _stringType => dynamic, arrayType => ["map(", dynamic, ", λ(id x, ", this.fromDynamicExpression(arrayType.items, "x"), "))"], classType => ["[", this.nameForNamedType(classType), " fromJSONDictionary:", dynamic, "]"], mapType => ["map(", dynamic, ", λ(id x, ", this.fromDynamicExpression(mapType.values, "x"), "))"], enumType => ["[", this.nameForNamedType(enumType), " withValue:", dynamic, "]"], unionType => {
288
- const nullable = (0, TypeUtils_1.nullableFromUnion)(unionType);
283
+ return TypeUtils_1.matchType(t, _anyType => dynamic, _nullType => dynamic, _boolType => dynamic, _integerType => dynamic, _doubleType => dynamic, _stringType => dynamic, arrayType => ["map(", dynamic, ", λ(id x, ", this.fromDynamicExpression(arrayType.items, "x"), "))"], classType => ["[", this.nameForNamedType(classType), " fromJSONDictionary:", dynamic, "]"], mapType => ["map(", dynamic, ", λ(id x, ", this.fromDynamicExpression(mapType.values, "x"), "))"], enumType => ["[", this.nameForNamedType(enumType), " withValue:", dynamic, "]"], unionType => {
284
+ const nullable = TypeUtils_1.nullableFromUnion(unionType);
289
285
  return nullable !== null ? this.fromDynamicExpression(nullable, dynamic) : dynamic;
290
286
  });
291
287
  }
292
288
  toDynamicExpression(t, typed) {
293
- return (0, TypeUtils_1.matchType)(t, _anyType => ["NSNullify(", typed, ")"], _nullType => ["NSNullify(", typed, ")"],
289
+ return TypeUtils_1.matchType(t, _anyType => ["NSNullify(", typed, ")"], _nullType => ["NSNullify(", typed, ")"],
294
290
  // Sadly, KVC
295
291
  _boolType => [typed, ` ? @YES : @NO`], _integerType => typed, _doubleType => typed, _stringType => typed, arrayType => {
296
292
  if (this.implicitlyConvertsFromJSON(arrayType)) {
@@ -305,7 +301,7 @@ class ObjectiveCRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
305
301
  }
306
302
  return ["map(", typed, ", λ(id x, ", this.toDynamicExpression(mapType.values, "x"), "))"];
307
303
  }, _enumType => ["[", typed, " value]"], unionType => {
308
- const nullable = (0, TypeUtils_1.nullableFromUnion)(unionType);
304
+ const nullable = TypeUtils_1.nullableFromUnion(unionType);
309
305
  if (nullable !== null) {
310
306
  if (this.implicitlyConvertsFromJSON(nullable)) {
311
307
  return ["NSNullify(", typed, ")"];
@@ -337,7 +333,7 @@ class ObjectiveCRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
337
333
  return true;
338
334
  }
339
335
  else if (t instanceof Type_1.UnionType) {
340
- const nullable = (0, TypeUtils_1.nullableFromUnion)(t);
336
+ const nullable = TypeUtils_1.nullableFromUnion(t);
341
337
  if (nullable !== null) {
342
338
  return this.implicitlyConvertsFromJSON(nullable);
343
339
  }
@@ -355,11 +351,11 @@ class ObjectiveCRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
355
351
  }
356
352
  emitPropertyAssignment(propertyName, jsonName, propertyType) {
357
353
  const name = ["_", propertyName];
358
- (0, TypeUtils_1.matchType)(propertyType, anyType => this.emitLine(name, " = ", this.fromDynamicExpression(anyType, name), ";"), nullType => this.emitLine(name, " = ", this.fromDynamicExpression(nullType, name), ";"), boolType => this.emitLine(name, " = ", this.fromDynamicExpression(boolType, name), ";"), integerType => this.emitLine(name, " = ", this.fromDynamicExpression(integerType, name), ";"), doubleType => this.emitLine(name, " = ", this.fromDynamicExpression(doubleType, name), ";"), stringType => this.emitLine(name, " = ", this.fromDynamicExpression(stringType, name), ";"), arrayType => this.emitLine(name, " = ", this.fromDynamicExpression(arrayType, name), ";"), classType => this.emitLine(name, " = ", this.fromDynamicExpression(classType, ["(id)", name]), ";"), mapType => {
354
+ TypeUtils_1.matchType(propertyType, anyType => this.emitLine(name, " = ", this.fromDynamicExpression(anyType, name), ";"), nullType => this.emitLine(name, " = ", this.fromDynamicExpression(nullType, name), ";"), boolType => this.emitLine(name, " = ", this.fromDynamicExpression(boolType, name), ";"), integerType => this.emitLine(name, " = ", this.fromDynamicExpression(integerType, name), ";"), doubleType => this.emitLine(name, " = ", this.fromDynamicExpression(doubleType, name), ";"), stringType => this.emitLine(name, " = ", this.fromDynamicExpression(stringType, name), ";"), arrayType => this.emitLine(name, " = ", this.fromDynamicExpression(arrayType, name), ";"), classType => this.emitLine(name, " = ", this.fromDynamicExpression(classType, ["(id)", name]), ";"), mapType => {
359
355
  const itemType = mapType.values;
360
356
  this.emitLine(name, " = map(", name, ", ", ["λ(id x, ", this.fromDynamicExpression(itemType, "x"), ")"], ");");
361
357
  }, enumType => this.emitLine(name, " = ", this.fromDynamicExpression(enumType, ["(id)", name]), ";"), unionType => {
362
- const nullable = (0, TypeUtils_1.nullableFromUnion)(unionType);
358
+ const nullable = TypeUtils_1.nullableFromUnion(unionType);
363
359
  if (nullable !== null) {
364
360
  this.emitPropertyAssignment(propertyName, jsonName, nullable);
365
361
  }
@@ -392,12 +388,12 @@ class ObjectiveCRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
392
388
  }
393
389
  topLevelToDataPrototype(name, pad = false) {
394
390
  const parameter = this.variableNameForTopLevel(name);
395
- const padding = pad ? (0, Strings_1.repeatString)(" ", this.sourcelikeToString(name).length - "NSData".length) : "";
391
+ const padding = pad ? Strings_1.repeatString(" ", this.sourcelikeToString(name).length - "NSData".length) : "";
396
392
  return ["NSData", padding, " *_Nullable ", name, "ToData(", name, " *", parameter, ", NSError **error)"];
397
393
  }
398
394
  topLevelToJSONPrototype(name, pad = false) {
399
395
  const parameter = this.variableNameForTopLevel(name);
400
- const padding = pad ? (0, Strings_1.repeatString)(" ", this.sourcelikeToString(name).length - "NSString".length) : "";
396
+ const padding = pad ? Strings_1.repeatString(" ", this.sourcelikeToString(name).length - "NSString".length) : "";
401
397
  return [
402
398
  "NSString",
403
399
  padding,
@@ -454,7 +450,7 @@ class ObjectiveCRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
454
450
  });
455
451
  }
456
452
  emitClassInterface(t, className) {
457
- const isTopLevel = (0, collection_utils_1.mapContains)(this.topLevels, t);
453
+ const isTopLevel = collection_utils_1.mapContains(this.topLevels, t);
458
454
  this.emitDescription(this.descriptionForType(t));
459
455
  this.emitLine("@interface ", className, " : NSObject");
460
456
  if (DEBUG)
@@ -485,7 +481,7 @@ class ObjectiveCRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
485
481
  hasIrregularProperties(t) {
486
482
  let irregular = false;
487
483
  this.forEachClassProperty(t, "none", (name, jsonName) => {
488
- irregular = irregular || (0, Strings_1.stringEscape)(jsonName) !== this.sourcelikeToString(name);
484
+ irregular = irregular || Strings_1.stringEscape(jsonName) !== this.sourcelikeToString(name);
489
485
  });
490
486
  return irregular;
491
487
  }
@@ -498,7 +494,7 @@ class ObjectiveCRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
498
494
  }
499
495
  // TODO Implement NSCopying
500
496
  emitClassImplementation(t, className) {
501
- const isTopLevel = (0, collection_utils_1.mapContains)(this.topLevels, t);
497
+ const isTopLevel = collection_utils_1.mapContains(this.topLevels, t);
502
498
  const hasIrregularProperties = this.hasIrregularProperties(t);
503
499
  const hasUnsafeProperties = this.hasUnsafeProperties(t);
504
500
  this.emitLine("@implementation ", className);
@@ -507,7 +503,7 @@ class ObjectiveCRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
507
503
  this.emitLine("static NSDictionary<NSString *, NSString *> *properties;");
508
504
  this.emitLine("return properties = properties ? properties : @{");
509
505
  this.indent(() => {
510
- this.forEachClassProperty(t, "none", (name, jsonName) => this.emitLine(`@"${(0, Strings_1.stringEscape)(jsonName)}": @"`, name, `",`));
506
+ this.forEachClassProperty(t, "none", (name, jsonName) => this.emitLine(`@"${Strings_1.stringEscape(jsonName)}": @"`, name, `",`));
511
507
  });
512
508
  this.emitLine("};");
513
509
  });
@@ -577,7 +573,7 @@ class ObjectiveCRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
577
573
  this.indent(() => {
578
574
  this.forEachClassProperty(t, "none", (propertyName, jsonKey, property) => {
579
575
  if (!this.implicitlyConvertsToJSON(property.type)) {
580
- const key = (0, Strings_1.stringEscape)(jsonKey);
576
+ const key = Strings_1.stringEscape(jsonKey);
581
577
  const name = ["_", propertyName];
582
578
  this.emitLine('@"', key, '": ', this.toDynamicExpression(property.type, name), ",");
583
579
  }
@@ -607,11 +603,11 @@ class ObjectiveCRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
607
603
  this.ensureBlankLine();
608
604
  }
609
605
  variableNameForTopLevel(name) {
610
- const camelCaseName = (0, Source_1.modifySource)(serialized => {
606
+ const camelCaseName = Source_1.modifySource(serialized => {
611
607
  // 1. remove class prefix
612
608
  serialized = serialized.slice(this._classPrefix.length);
613
609
  // 2. camel case
614
- return (0, Strings_1.camelCase)(serialized);
610
+ return Strings_1.camelCase(serialized);
615
611
  }, name);
616
612
  return camelCaseName;
617
613
  }
@@ -633,7 +629,7 @@ class ObjectiveCRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
633
629
  this.emitLine("return ", staticEnumValuesIdentifier, " = ", staticEnumValuesIdentifier, " ? ", staticEnumValuesIdentifier, " : @{");
634
630
  this.indent(() => {
635
631
  this.forEachEnumCase(enumType, "none", (_, jsonValue) => {
636
- const value = ['@"', (0, Strings_1.stringEscape)(jsonValue), '"'];
632
+ const value = ['@"', Strings_1.stringEscape(jsonValue), '"'];
637
633
  this.emitLine(value, ": [[", enumName, " alloc] initWithValue:", value, "],");
638
634
  });
639
635
  });
@@ -641,7 +637,7 @@ class ObjectiveCRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
641
637
  });
642
638
  this.ensureBlankLine();
643
639
  this.forEachEnumCase(enumType, "none", (name, jsonValue) => {
644
- this.emitLine("+ (", enumName, " *)", name, " { return ", instances, '[@"', (0, Strings_1.stringEscape)(jsonValue), '"]; }');
640
+ this.emitLine("+ (", enumName, " *)", name, " { return ", instances, '[@"', Strings_1.stringEscape(jsonValue), '"]; }');
645
641
  });
646
642
  this.ensureBlankLine();
647
643
  this.emitMethod("+ (instancetype _Nullable)withValue:(NSString *)value", () => this.emitLine("return ", instances, "[value];"));
@@ -658,7 +654,7 @@ class ObjectiveCRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
658
654
  const fileMode = proposedFilename !== "stdout";
659
655
  if (!fileMode) {
660
656
  // We don't have a filename, so we use a top-level name
661
- const firstTopLevel = (0, Support_1.defined)((0, collection_utils_1.mapFirst)(this.topLevels));
657
+ const firstTopLevel = Support_1.defined(collection_utils_1.mapFirst(this.topLevels));
662
658
  proposedFilename = this.sourcelikeToString(this.nameForNamedType(firstTopLevel)) + ".m";
663
659
  }
664
660
  const [filename, extension] = splitExtension(proposedFilename);
@@ -692,7 +688,7 @@ class ObjectiveCRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
692
688
  }
693
689
  // Emit interfaces for top-level array+maps and classes
694
690
  this.forEachTopLevel("leading-and-interposing", (t, n) => this.emitNonClassTopLevelTypedef(t, n), t => !(t instanceof Type_1.ClassType));
695
- const hasTopLevelNonClassTypes = (0, collection_utils_1.iterableSome)(this.topLevels, ([_, t]) => !(t instanceof Type_1.ClassType));
691
+ const hasTopLevelNonClassTypes = collection_utils_1.iterableSome(this.topLevels, ([_, t]) => !(t instanceof Type_1.ClassType));
696
692
  if (!this._options.justTypes && (hasTopLevelNonClassTypes || this._options.marshallingFunctions)) {
697
693
  this.ensureBlankLine();
698
694
  this.emitMark("Top-level marshaling functions");
@@ -754,9 +750,9 @@ class ObjectiveCRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
754
750
  function needsMap(t) {
755
751
  return (t instanceof Type_1.MapType ||
756
752
  t instanceof Type_1.ArrayType ||
757
- (t instanceof Type_1.ClassType && (0, collection_utils_1.mapSome)(t.getProperties(), p => needsMap(p.type))));
753
+ (t instanceof Type_1.ClassType && collection_utils_1.mapSome(t.getProperties(), p => needsMap(p.type))));
758
754
  }
759
- return (0, collection_utils_1.iterableSome)(this.typeGraph.allTypesUnordered(), needsMap);
755
+ return collection_utils_1.iterableSome(this.typeGraph.allTypesUnordered(), needsMap);
760
756
  }
761
757
  emitMapFunction() {
762
758
  if (this.needsMap) {