quicktype 16.0.42 → 17.0.0

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