quicktype 17.0.4 → 17.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (139) hide show
  1. package/dist/cli/CompressedJSONFromStream.js +38 -26
  2. package/dist/cli/GraphQLIntrospection.js +41 -33
  3. package/dist/cli/TypeSource.d.ts +1 -1
  4. package/dist/cli/URLGrammar.js +3 -4
  5. package/dist/cli/index.js +364 -363
  6. package/dist/quicktype-core/Annotation.js +0 -2
  7. package/dist/quicktype-core/ConvenienceRenderer.d.ts +17 -17
  8. package/dist/quicktype-core/ConvenienceRenderer.js +81 -104
  9. package/dist/quicktype-core/DateTime.js +0 -1
  10. package/dist/quicktype-core/DeclarationIR.d.ts +1 -1
  11. package/dist/quicktype-core/DeclarationIR.js +10 -13
  12. package/dist/quicktype-core/EncodedMarkovChain.js +0 -1
  13. package/dist/quicktype-core/GatherNames.js +25 -47
  14. package/dist/quicktype-core/Graph.d.ts +2 -2
  15. package/dist/quicktype-core/Graph.js +19 -23
  16. package/dist/quicktype-core/GraphRewriting.d.ts +2 -2
  17. package/dist/quicktype-core/GraphRewriting.js +54 -65
  18. package/dist/quicktype-core/MakeTransformations.js +22 -23
  19. package/dist/quicktype-core/MarkovChain.d.ts +3 -3
  20. package/dist/quicktype-core/MarkovChain.js +8 -9
  21. package/dist/quicktype-core/Messages.d.ts +3 -3
  22. package/dist/quicktype-core/Messages.js +3 -8
  23. package/dist/quicktype-core/Naming.d.ts +11 -11
  24. package/dist/quicktype-core/Naming.js +61 -76
  25. package/dist/quicktype-core/Renderer.d.ts +6 -6
  26. package/dist/quicktype-core/Renderer.js +17 -34
  27. package/dist/quicktype-core/RendererOptions.d.ts +5 -5
  28. package/dist/quicktype-core/RendererOptions.js +3 -6
  29. package/dist/quicktype-core/Run.d.ts +9 -9
  30. package/dist/quicktype-core/Run.js +67 -72
  31. package/dist/quicktype-core/Source.d.ts +3 -3
  32. package/dist/quicktype-core/Source.js +18 -19
  33. package/dist/quicktype-core/TargetLanguage.d.ts +10 -10
  34. package/dist/quicktype-core/TargetLanguage.js +2 -6
  35. package/dist/quicktype-core/Transformers.d.ts +25 -25
  36. package/dist/quicktype-core/Transformers.js +66 -94
  37. package/dist/quicktype-core/Type.d.ts +43 -41
  38. package/dist/quicktype-core/Type.js +71 -96
  39. package/dist/quicktype-core/TypeBuilder.d.ts +2 -2
  40. package/dist/quicktype-core/TypeBuilder.js +47 -53
  41. package/dist/quicktype-core/TypeGraph.d.ts +4 -4
  42. package/dist/quicktype-core/TypeGraph.js +40 -49
  43. package/dist/quicktype-core/TypeUtils.d.ts +2 -2
  44. package/dist/quicktype-core/TypeUtils.js +22 -23
  45. package/dist/quicktype-core/UnifyClasses.js +12 -16
  46. package/dist/quicktype-core/UnionBuilder.d.ts +3 -3
  47. package/dist/quicktype-core/UnionBuilder.js +30 -33
  48. package/dist/quicktype-core/attributes/AccessorNames.d.ts +2 -2
  49. package/dist/quicktype-core/attributes/AccessorNames.js +17 -18
  50. package/dist/quicktype-core/attributes/Constraints.d.ts +3 -3
  51. package/dist/quicktype-core/attributes/Constraints.js +4 -8
  52. package/dist/quicktype-core/attributes/Description.js +5 -6
  53. package/dist/quicktype-core/attributes/EnumValues.js +3 -4
  54. package/dist/quicktype-core/attributes/StringTypes.d.ts +1 -1
  55. package/dist/quicktype-core/attributes/StringTypes.js +21 -24
  56. package/dist/quicktype-core/attributes/TypeAttributes.d.ts +3 -3
  57. package/dist/quicktype-core/attributes/TypeAttributes.js +10 -12
  58. package/dist/quicktype-core/attributes/TypeNames.d.ts +9 -9
  59. package/dist/quicktype-core/attributes/TypeNames.js +21 -49
  60. package/dist/quicktype-core/attributes/URIAttributes.d.ts +1 -1
  61. package/dist/quicktype-core/attributes/URIAttributes.js +6 -10
  62. package/dist/quicktype-core/index.js +125 -128
  63. package/dist/quicktype-core/input/CompressedJSON.d.ts +7 -7
  64. package/dist/quicktype-core/input/CompressedJSON.js +54 -49
  65. package/dist/quicktype-core/input/FetchingJSONSchemaStore.js +13 -5
  66. package/dist/quicktype-core/input/Inference.d.ts +2 -2
  67. package/dist/quicktype-core/input/Inference.js +17 -25
  68. package/dist/quicktype-core/input/Inputs.d.ts +2 -2
  69. package/dist/quicktype-core/input/Inputs.js +54 -38
  70. package/dist/quicktype-core/input/JSONSchemaInput.d.ts +11 -11
  71. package/dist/quicktype-core/input/JSONSchemaInput.js +523 -503
  72. package/dist/quicktype-core/input/JSONSchemaStore.d.ts +1 -1
  73. package/dist/quicktype-core/input/JSONSchemaStore.js +35 -24
  74. package/dist/quicktype-core/input/PostmanCollection.js +1 -2
  75. package/dist/quicktype-core/input/io/NodeIO.js +44 -55
  76. package/dist/quicktype-core/input/io/get-stream/index.js +2 -6
  77. package/dist/quicktype-core/language/All.js +2 -3
  78. package/dist/quicktype-core/language/CPlusPlus.d.ts +8 -8
  79. package/dist/quicktype-core/language/CPlusPlus.js +151 -185
  80. package/dist/quicktype-core/language/CSharp.d.ts +7 -7
  81. package/dist/quicktype-core/language/CSharp.js +72 -82
  82. package/dist/quicktype-core/language/Crystal.d.ts +2 -2
  83. package/dist/quicktype-core/language/Crystal.js +17 -18
  84. package/dist/quicktype-core/language/Dart.d.ts +4 -4
  85. package/dist/quicktype-core/language/Dart.js +34 -36
  86. package/dist/quicktype-core/language/Elm.d.ts +6 -6
  87. package/dist/quicktype-core/language/Elm.js +45 -47
  88. package/dist/quicktype-core/language/Golang.d.ts +4 -4
  89. package/dist/quicktype-core/language/Golang.js +20 -23
  90. package/dist/quicktype-core/language/Haskell.d.ts +5 -5
  91. package/dist/quicktype-core/language/Haskell.js +23 -25
  92. package/dist/quicktype-core/language/JSONSchema.d.ts +3 -3
  93. package/dist/quicktype-core/language/JSONSchema.js +16 -17
  94. package/dist/quicktype-core/language/Java.d.ts +2 -2
  95. package/dist/quicktype-core/language/Java.js +97 -97
  96. package/dist/quicktype-core/language/JavaScript.d.ts +7 -7
  97. package/dist/quicktype-core/language/JavaScript.js +17 -19
  98. package/dist/quicktype-core/language/JavaScriptPropTypes.js +13 -15
  99. package/dist/quicktype-core/language/JavaScriptUnicodeMaps.js +11 -12
  100. package/dist/quicktype-core/language/Kotlin.d.ts +2 -2
  101. package/dist/quicktype-core/language/Kotlin.js +37 -39
  102. package/dist/quicktype-core/language/Objective-C.d.ts +3 -3
  103. package/dist/quicktype-core/language/Objective-C.js +41 -45
  104. package/dist/quicktype-core/language/Php.d.ts +2 -2
  105. package/dist/quicktype-core/language/Php.js +41 -66
  106. package/dist/quicktype-core/language/Pike.d.ts +1 -1
  107. package/dist/quicktype-core/language/Pike.js +17 -18
  108. package/dist/quicktype-core/language/Python.d.ts +8 -8
  109. package/dist/quicktype-core/language/Python.js +64 -63
  110. package/dist/quicktype-core/language/Rust.d.ts +2 -2
  111. package/dist/quicktype-core/language/Rust.js +19 -21
  112. package/dist/quicktype-core/language/Swift.d.ts +7 -7
  113. package/dist/quicktype-core/language/Swift.js +804 -807
  114. package/dist/quicktype-core/language/TypeScriptFlow.d.ts +7 -7
  115. package/dist/quicktype-core/language/TypeScriptFlow.js +26 -28
  116. package/dist/quicktype-core/language/ruby/index.d.ts +4 -4
  117. package/dist/quicktype-core/language/ruby/index.js +24 -49
  118. package/dist/quicktype-core/language/ruby/keywords.js +0 -1
  119. package/dist/quicktype-core/rewrites/CombineClasses.js +8 -9
  120. package/dist/quicktype-core/rewrites/ExpandStrings.d.ts +1 -1
  121. package/dist/quicktype-core/rewrites/ExpandStrings.js +17 -18
  122. package/dist/quicktype-core/rewrites/FlattenStrings.js +6 -7
  123. package/dist/quicktype-core/rewrites/FlattenUnions.js +8 -9
  124. package/dist/quicktype-core/rewrites/InferMaps.js +10 -11
  125. package/dist/quicktype-core/rewrites/ReplaceObjectType.js +7 -8
  126. package/dist/quicktype-core/rewrites/ResolveIntersections.js +67 -68
  127. package/dist/quicktype-core/support/Acronyms.js +1 -3
  128. package/dist/quicktype-core/support/Chance.js +0 -10
  129. package/dist/quicktype-core/support/Converters.js +0 -1
  130. package/dist/quicktype-core/support/Strings.d.ts +4 -4
  131. package/dist/quicktype-core/support/Strings.js +16 -17
  132. package/dist/quicktype-core/support/Support.d.ts +1 -1
  133. package/dist/quicktype-core/support/Support.js +6 -30
  134. package/dist/quicktype-graphql-input/GraphQLSchema.d.ts +4 -4
  135. package/dist/quicktype-graphql-input/GraphQLSchema.js +0 -1
  136. package/dist/quicktype-graphql-input/index.d.ts +1 -1
  137. package/dist/quicktype-graphql-input/index.js +212 -229
  138. package/dist/quicktype-typescript-input/index.js +4 -28
  139. package/package.json +19 -25
@@ -11,8 +11,8 @@ export declare enum Framework {
11
11
  Newtonsoft = 0,
12
12
  SystemTextJson = 1
13
13
  }
14
- export type Version = 5 | 6;
15
- export type OutputFeatures = {
14
+ export declare type Version = 5 | 6;
15
+ export declare type OutputFeatures = {
16
16
  helpers: boolean;
17
17
  attributes: boolean;
18
18
  };
@@ -21,7 +21,7 @@ export declare enum AccessModifier {
21
21
  Public = 1,
22
22
  Internal = 2
23
23
  }
24
- export type CSharpTypeForAny = "object" | "dynamic";
24
+ export declare type CSharpTypeForAny = "object" | "dynamic";
25
25
  export declare const cSharpOptions: {
26
26
  framework: EnumOption<Framework>;
27
27
  useList: EnumOption<boolean>;
@@ -35,9 +35,9 @@ export declare const cSharpOptions: {
35
35
  export declare class CSharpTargetLanguage extends TargetLanguage {
36
36
  constructor();
37
37
  protected getOptions(): Option<any>[];
38
- get stringTypeMapping(): StringTypeMapping;
39
- get supportsUnionsWithBothNumberTypes(): boolean;
40
- get supportsOptionalClassProperties(): boolean;
38
+ readonly stringTypeMapping: StringTypeMapping;
39
+ readonly supportsUnionsWithBothNumberTypes: boolean;
40
+ readonly supportsOptionalClassProperties: boolean;
41
41
  needsTransformerForType(t: Type): boolean;
42
42
  protected makeRenderer(renderContext: RenderContext, untypedOptionValues: {
43
43
  [name: string]: any;
@@ -56,7 +56,7 @@ export declare class CSharpRenderer extends ConvenienceRenderer {
56
56
  protected unionNeedsName(u: UnionType): boolean;
57
57
  protected namedTypeToNameForTopLevel(type: Type): Type | undefined;
58
58
  protected emitBlock(f: () => void, semicolon?: boolean): void;
59
- protected get doubleType(): string;
59
+ protected readonly doubleType: string;
60
60
  protected csType(t: Type, follow?: (t: Type) => Type, withIssues?: boolean): Sourcelike;
61
61
  protected nullableCSType(t: Type, follow?: (t: Type) => Type, withIssues?: boolean): Sourcelike;
62
62
  protected baseclassForType(_t: Type): Sourcelike | undefined;
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SystemTextJsonCSharpRenderer = exports.systemTextJsonCSharpOptions = exports.NewtonsoftCSharpRenderer = exports.newtonsoftCSharpOptions = exports.CSharpRenderer = exports.CSharpTargetLanguage = exports.cSharpOptions = exports.AccessModifier = exports.Framework = void 0;
4
3
  const collection_utils_1 = require("collection-utils");
5
4
  const Type_1 = require("../Type");
6
5
  const TypeUtils_1 = require("../TypeUtils");
@@ -31,7 +30,7 @@ function noFollow(t) {
31
30
  }
32
31
  function needTransformerForType(t) {
33
32
  if (t instanceof Type_1.UnionType) {
34
- const maybeNullable = (0, TypeUtils_1.nullableFromUnion)(t);
33
+ const maybeNullable = TypeUtils_1.nullableFromUnion(t);
35
34
  if (maybeNullable === null)
36
35
  return "automatic";
37
36
  if (needTransformerForType(maybeNullable) === "manual")
@@ -47,11 +46,11 @@ function needTransformerForType(t) {
47
46
  if (t instanceof Type_1.EnumType)
48
47
  return "automatic";
49
48
  if (t.kind === "double")
50
- return (0, Constraints_1.minMaxValueForType)(t) !== undefined ? "manual" : "none";
49
+ return Constraints_1.minMaxValueForType(t) !== undefined ? "manual" : "none";
51
50
  if (t.kind === "integer-string" || t.kind === "bool-string")
52
51
  return "manual";
53
52
  if (t.kind === "string") {
54
- return (0, Constraints_1.minMaxLengthForType)(t) !== undefined ? "manual" : "none";
53
+ return Constraints_1.minMaxLengthForType(t) !== undefined ? "manual" : "none";
55
54
  }
56
55
  return "none";
57
56
  }
@@ -60,7 +59,7 @@ function alwaysApplyTransformation(xf) {
60
59
  if (t instanceof Type_1.EnumType)
61
60
  return true;
62
61
  if (t instanceof Type_1.UnionType)
63
- return (0, TypeUtils_1.nullableFromUnion)(t) === null;
62
+ return TypeUtils_1.nullableFromUnion(t) === null;
64
63
  return false;
65
64
  }
66
65
  /**
@@ -75,7 +74,7 @@ function csTypeForTransformedStringType(t) {
75
74
  case "uri":
76
75
  return "Uri";
77
76
  default:
78
- return (0, Support_1.panic)(`Transformed string type ${t.kind} not supported`);
77
+ return Support_1.panic(`Transformed string type ${t.kind} not supported`);
79
78
  }
80
79
  }
81
80
  exports.cSharpOptions = {
@@ -145,19 +144,19 @@ class CSharpTargetLanguage extends TargetLanguage_1.TargetLanguage {
145
144
  return need !== "none" && need !== "nullable";
146
145
  }
147
146
  makeRenderer(renderContext, untypedOptionValues) {
148
- const options = (0, RendererOptions_1.getOptionValues)(exports.cSharpOptions, untypedOptionValues);
147
+ const options = RendererOptions_1.getOptionValues(exports.cSharpOptions, untypedOptionValues);
149
148
  switch (options.framework) {
150
149
  case Framework.Newtonsoft:
151
- return new NewtonsoftCSharpRenderer(this, renderContext, (0, RendererOptions_1.getOptionValues)(exports.newtonsoftCSharpOptions, untypedOptionValues));
150
+ return new NewtonsoftCSharpRenderer(this, renderContext, RendererOptions_1.getOptionValues(exports.newtonsoftCSharpOptions, untypedOptionValues));
152
151
  case Framework.SystemTextJson:
153
- return new SystemTextJsonCSharpRenderer(this, renderContext, (0, RendererOptions_1.getOptionValues)(exports.systemTextJsonCSharpOptions, untypedOptionValues));
152
+ return new SystemTextJsonCSharpRenderer(this, renderContext, RendererOptions_1.getOptionValues(exports.systemTextJsonCSharpOptions, untypedOptionValues));
154
153
  default:
155
- return (0, Support_1.assertNever)(options.framework);
154
+ return Support_1.assertNever(options.framework);
156
155
  }
157
156
  }
158
157
  }
159
158
  exports.CSharpTargetLanguage = CSharpTargetLanguage;
160
- const namingFunction = (0, Naming_1.funPrefixNamer)("namer", csNameStyle);
159
+ const namingFunction = Naming_1.funPrefixNamer("namer", csNameStyle);
161
160
  // FIXME: Make a Named?
162
161
  const denseJsonPropertyName = "J";
163
162
  const denseRequiredEnumName = "R";
@@ -175,19 +174,18 @@ function isPartCharacter(utf16Unit) {
175
174
  }
176
175
  return isStartCharacter(utf16Unit);
177
176
  }
178
- const legalizeName = (0, Strings_1.utf16LegalizeCharacters)(isPartCharacter);
177
+ const legalizeName = Strings_1.utf16LegalizeCharacters(isPartCharacter);
179
178
  function csNameStyle(original) {
180
- const words = (0, Strings_1.splitIntoWords)(original);
181
- return (0, Strings_1.combineWords)(words, legalizeName, Strings_1.firstUpperWordStyle, Strings_1.firstUpperWordStyle, Strings_1.firstUpperWordStyle, Strings_1.firstUpperWordStyle, "", isStartCharacter);
179
+ const words = Strings_1.splitIntoWords(original);
180
+ return Strings_1.combineWords(words, legalizeName, Strings_1.firstUpperWordStyle, Strings_1.firstUpperWordStyle, Strings_1.firstUpperWordStyle, Strings_1.firstUpperWordStyle, "", isStartCharacter);
182
181
  }
183
182
  function isValueType(t) {
184
183
  if (t instanceof Type_1.UnionType) {
185
- return (0, TypeUtils_1.nullableFromUnion)(t) === null;
184
+ return TypeUtils_1.nullableFromUnion(t) === null;
186
185
  }
187
186
  return ["integer", "double", "bool", "enum", "date-time", "uuid"].indexOf(t.kind) >= 0;
188
187
  }
189
188
  class CSharpRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
190
- _csOptions;
191
189
  constructor(targetLanguage, renderContext, _csOptions) {
192
190
  super(targetLanguage, renderContext);
193
191
  this._csOptions = _csOptions;
@@ -226,13 +224,13 @@ class CSharpRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
226
224
  return namingFunction;
227
225
  }
228
226
  unionNeedsName(u) {
229
- return (0, TypeUtils_1.nullableFromUnion)(u) === null;
227
+ return TypeUtils_1.nullableFromUnion(u) === null;
230
228
  }
231
229
  namedTypeToNameForTopLevel(type) {
232
230
  // If the top-level type doesn't contain any classes or unions
233
231
  // we have to define a class just for the `FromJson` method, in
234
232
  // emitFromJsonForTopLevel.
235
- return (0, TypeUtils_1.directlyReachableSingleNamedType)(type);
233
+ return TypeUtils_1.directlyReachableSingleNamedType(type);
236
234
  }
237
235
  emitBlock(f, semicolon = false) {
238
236
  this.emitLine("{");
@@ -244,7 +242,7 @@ class CSharpRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
244
242
  }
245
243
  csType(t, follow = Transformers_1.followTargetType, withIssues = false) {
246
244
  const actualType = follow(t);
247
- return (0, TypeUtils_1.matchType)(actualType, _anyType => (0, Source_1.maybeAnnotated)(withIssues, Annotation_1.anyTypeIssueAnnotation, this._csOptions.typeForAny), _nullType => (0, Source_1.maybeAnnotated)(withIssues, Annotation_1.nullTypeIssueAnnotation, this._csOptions.typeForAny), _boolType => "bool", _integerType => "long", _doubleType => this.doubleType, _stringType => "string", arrayType => {
245
+ return TypeUtils_1.matchType(actualType, _anyType => Source_1.maybeAnnotated(withIssues, Annotation_1.anyTypeIssueAnnotation, this._csOptions.typeForAny), _nullType => Source_1.maybeAnnotated(withIssues, Annotation_1.nullTypeIssueAnnotation, this._csOptions.typeForAny), _boolType => "bool", _integerType => "long", _doubleType => this.doubleType, _stringType => "string", arrayType => {
248
246
  const itemsType = this.csType(arrayType.items, follow, withIssues);
249
247
  if (this._csOptions.useList) {
250
248
  return ["System.Collections.Generic.List<", itemsType, ">"];
@@ -257,14 +255,14 @@ class CSharpRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
257
255
  this.csType(mapType.values, follow, withIssues),
258
256
  ">"
259
257
  ], enumType => this.nameForNamedType(enumType), unionType => {
260
- const nullable = (0, TypeUtils_1.nullableFromUnion)(unionType);
258
+ const nullable = TypeUtils_1.nullableFromUnion(unionType);
261
259
  if (nullable !== null)
262
260
  return this.nullableCSType(nullable, noFollow);
263
261
  return this.nameForNamedType(unionType);
264
262
  }, transformedStringType => csTypeForTransformedStringType(transformedStringType));
265
263
  }
266
264
  nullableCSType(t, follow = Transformers_1.followTargetType, withIssues = false) {
267
- t = (0, Transformers_1.followTargetType)(t);
265
+ t = Transformers_1.followTargetType(t);
268
266
  const csType = this.csType(t, follow, withIssues);
269
267
  if (isValueType(t)) {
270
268
  return [csType, "?"];
@@ -364,7 +362,7 @@ class CSharpRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
364
362
  });
365
363
  }
366
364
  emitUnionDefinition(u, unionName) {
367
- const nonNulls = (0, TypeUtils_1.removeNullFromUnion)(u, true)[1];
365
+ const nonNulls = TypeUtils_1.removeNullFromUnion(u, true)[1];
368
366
  this.emitType(this.descriptionForType(u), AccessModifier.Public, "partial struct", unionName, this.baseclassForType(u), () => {
369
367
  this.forEachUnionMember(u, nonNulls, "none", null, (fieldName, t) => {
370
368
  const csType = this.nullableCSType(t);
@@ -382,7 +380,7 @@ class CSharpRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
382
380
  });
383
381
  if (u.findMember("null") === undefined)
384
382
  return;
385
- this.emitExpressionMember("public bool IsNull", (0, collection_utils_1.arrayIntercalate)(" && ", nullTests), true);
383
+ this.emitExpressionMember("public bool IsNull", collection_utils_1.arrayIntercalate(" && ", nullTests), true);
386
384
  });
387
385
  }
388
386
  emitEnumDefinition(e, enumName) {
@@ -414,7 +412,7 @@ class CSharpRenderer extends ConvenienceRenderer_1.ConvenienceRenderer {
414
412
  }
415
413
  }
416
414
  emitTypeSwitch(types, condition, withBlock, withReturn, f) {
417
- (0, Support_1.assert)(!withReturn || withBlock, "Can only have return with block");
415
+ Support_1.assert(!withReturn || withBlock, "Can only have return with block");
418
416
  for (const t of types) {
419
417
  this.emitLine("if (", condition(t), ")");
420
418
  if (withBlock) {
@@ -493,14 +491,10 @@ exports.newtonsoftCSharpOptions = Object.assign({}, exports.cSharpOptions, {
493
491
  checkRequired: new RendererOptions_1.BooleanOption("check-required", "Fail if required properties are missing", false)
494
492
  });
495
493
  class NewtonsoftCSharpRenderer extends CSharpRenderer {
496
- _options;
497
- _enumExtensionsNames = new Map();
498
- _needHelpers;
499
- _needAttributes;
500
- _needNamespaces;
501
494
  constructor(targetLanguage, renderContext, _options) {
502
495
  super(targetLanguage, renderContext, _options);
503
496
  this._options = _options;
497
+ this._enumExtensionsNames = new Map();
504
498
  this._needHelpers = _options.features.helpers;
505
499
  this._needAttributes = _options.features.attributes;
506
500
  this._needNamespaces = _options.features.namespaces;
@@ -587,31 +581,31 @@ class NewtonsoftCSharpRenderer extends CSharpRenderer {
587
581
  else {
588
582
  rhs = [topLevelName, ".FromJson(jsonString)"];
589
583
  }
590
- this.emitLine("// var ", (0, Source_1.modifySource)(Strings_1.camelCase, topLevelName), " = ", rhs, ";");
584
+ this.emitLine("// var ", Source_1.modifySource(Strings_1.camelCase, topLevelName), " = ", rhs, ";");
591
585
  });
592
586
  }
593
587
  converterForType(t) {
594
- let xf = (0, Transformers_1.transformationForType)(t);
588
+ let xf = Transformers_1.transformationForType(t);
595
589
  if (xf === undefined && t instanceof Type_1.UnionType) {
596
- const maybeNullable = (0, TypeUtils_1.nullableFromUnion)(t);
590
+ const maybeNullable = TypeUtils_1.nullableFromUnion(t);
597
591
  if (maybeNullable !== null) {
598
592
  t = maybeNullable;
599
- xf = (0, Transformers_1.transformationForType)(t);
593
+ xf = Transformers_1.transformationForType(t);
600
594
  }
601
595
  }
602
596
  if (xf === undefined)
603
597
  return undefined;
604
598
  if (alwaysApplyTransformation(xf))
605
599
  return undefined;
606
- return (0, Support_1.defined)(this.nameForTransformation(t));
600
+ return Support_1.defined(this.nameForTransformation(t));
607
601
  }
608
602
  attributesForProperty(property, _name, _c, jsonName) {
609
603
  if (!this._needAttributes)
610
604
  return undefined;
611
605
  const attributes = [];
612
606
  const jsonProperty = this._options.dense ? denseJsonPropertyName : "JsonProperty";
613
- const escapedName = (0, Strings_1.utf16StringEscape)(jsonName);
614
- const isNullable = (0, Transformers_1.followTargetType)(property.type).isNullable;
607
+ const escapedName = Strings_1.utf16StringEscape(jsonName);
608
+ const isNullable = Transformers_1.followTargetType(property.type).isNullable;
615
609
  const isOptional = property.isOptional;
616
610
  const requiredClass = this._options.dense ? "R" : "Required";
617
611
  const nullValueHandlingClass = this._options.dense ? "N" : "NullValueHandling";
@@ -721,7 +715,7 @@ class NewtonsoftCSharpRenderer extends CSharpRenderer {
721
715
  this.emitLine("{");
722
716
  this.indent(() => {
723
717
  for (const [t, converter] of this.typesWithNamedTransformations) {
724
- if (alwaysApplyTransformation((0, Support_1.defined)((0, Transformers_1.transformationForType)(t)))) {
718
+ if (alwaysApplyTransformation(Support_1.defined(Transformers_1.transformationForType(t)))) {
725
719
  this.emitLine(this.converterObject(converter), ",");
726
720
  }
727
721
  }
@@ -771,7 +765,7 @@ class NewtonsoftCSharpRenderer extends CSharpRenderer {
771
765
  else if (xfer instanceof Transformers_1.ArrayDecodingTransformer) {
772
766
  // FIXME: Consume StartArray
773
767
  if (!(targetType instanceof Type_1.ArrayType)) {
774
- return (0, Support_1.panic)("Array decoding must produce an array type");
768
+ return Support_1.panic("Array decoding must produce an array type");
775
769
  }
776
770
  // FIXME: handle EOF
777
771
  this.emitLine("reader.Read();");
@@ -811,24 +805,24 @@ class NewtonsoftCSharpRenderer extends CSharpRenderer {
811
805
  return false;
812
806
  }
813
807
  else {
814
- return (0, Support_1.panic)("Unknown transformer");
808
+ return Support_1.panic("Unknown transformer");
815
809
  }
816
810
  }
817
811
  stringCaseValue(t, stringCase) {
818
812
  if (t.kind === "string") {
819
- return ['"', (0, Strings_1.utf16StringEscape)(stringCase), '"'];
813
+ return ['"', Strings_1.utf16StringEscape(stringCase), '"'];
820
814
  }
821
815
  else if (t instanceof Type_1.EnumType) {
822
816
  return [this.nameForNamedType(t), ".", this.nameForEnumCase(t, stringCase)];
823
817
  }
824
- return (0, Support_1.panic)(`Type ${t.kind} does not have string cases`);
818
+ return Support_1.panic(`Type ${t.kind} does not have string cases`);
825
819
  }
826
820
  emitTransformer(variable, xfer, targetType, emitFinish) {
827
821
  function directTargetType(continuation) {
828
822
  if (continuation === undefined) {
829
823
  return targetType;
830
824
  }
831
- return (0, Transformers_1.followTargetType)(continuation.sourceType);
825
+ return Transformers_1.followTargetType(continuation.sourceType);
832
826
  }
833
827
  if (xfer instanceof Transformers_1.ChoiceTransformer) {
834
828
  const caseXfers = xfer.transformers;
@@ -837,7 +831,7 @@ class NewtonsoftCSharpRenderer extends CSharpRenderer {
837
831
  this.emitBlock(() => {
838
832
  for (const caseXfer of caseXfers) {
839
833
  const matchXfer = caseXfer;
840
- const value = this.stringCaseValue((0, Transformers_1.followTargetType)(matchXfer.sourceType), matchXfer.stringCase);
834
+ const value = this.stringCaseValue(Transformers_1.followTargetType(matchXfer.sourceType), matchXfer.stringCase);
841
835
  this.emitLine("case ", value, ":");
842
836
  this.indent(() => {
843
837
  const allDone = this.emitTransformer(variable, matchXfer.transformer, targetType, emitFinish);
@@ -858,7 +852,7 @@ class NewtonsoftCSharpRenderer extends CSharpRenderer {
858
852
  }
859
853
  else if (xfer instanceof Transformers_1.UnionMemberMatchTransformer) {
860
854
  const memberType = xfer.memberType;
861
- const maybeNullable = (0, TypeUtils_1.nullableFromUnion)(xfer.sourceType);
855
+ const maybeNullable = TypeUtils_1.nullableFromUnion(xfer.sourceType);
862
856
  let test;
863
857
  let member;
864
858
  if (maybeNullable !== null) {
@@ -887,7 +881,7 @@ class NewtonsoftCSharpRenderer extends CSharpRenderer {
887
881
  this.emitBlock(() => this.emitTransformer(member, xfer.transformer, targetType, emitFinish));
888
882
  }
889
883
  else if (xfer instanceof Transformers_1.StringMatchTransformer) {
890
- const value = this.stringCaseValue((0, Transformers_1.followTargetType)(xfer.sourceType), xfer.stringCase);
884
+ const value = this.stringCaseValue(Transformers_1.followTargetType(xfer.sourceType), xfer.stringCase);
891
885
  this.emitLine("if (", variable, " == ", value, ")");
892
886
  this.emitBlock(() => this.emitTransformer(variable, xfer.transformer, targetType, emitFinish));
893
887
  }
@@ -948,7 +942,7 @@ class NewtonsoftCSharpRenderer extends CSharpRenderer {
948
942
  this.emitBlock(() => this.emitConsume("b", xfer.consumer, targetType, emitFinish));
949
943
  break;
950
944
  default:
951
- return (0, Support_1.panic)(`Parsing string to ${immediateTargetType.kind} not supported`);
945
+ return Support_1.panic(`Parsing string to ${immediateTargetType.kind} not supported`);
952
946
  }
953
947
  }
954
948
  else if (xfer instanceof Transformers_1.StringifyTransformer) {
@@ -964,7 +958,7 @@ class NewtonsoftCSharpRenderer extends CSharpRenderer {
964
958
  this.emitLine("var boolString = ", variable, ' ? "true" : "false";');
965
959
  return this.emitConsume("boolString", xfer.consumer, targetType, emitFinish);
966
960
  default:
967
- return (0, Support_1.panic)(`Stringifying ${xfer.sourceType.kind} not supported`);
961
+ return Support_1.panic(`Stringifying ${xfer.sourceType.kind} not supported`);
968
962
  }
969
963
  }
970
964
  else if (xfer instanceof Transformers_1.StringProducerTransformer) {
@@ -981,7 +975,7 @@ class NewtonsoftCSharpRenderer extends CSharpRenderer {
981
975
  if (max !== undefined) {
982
976
  conditions.push([variable, ".Length <= ", max.toString()]);
983
977
  }
984
- this.emitLine("if (", (0, collection_utils_1.arrayIntercalate)([" && "], conditions), ")");
978
+ this.emitLine("if (", collection_utils_1.arrayIntercalate([" && "], conditions), ")");
985
979
  this.emitBlock(() => this.emitConsume(variable, xfer.consumer, targetType, emitFinish));
986
980
  return false;
987
981
  }
@@ -995,15 +989,15 @@ class NewtonsoftCSharpRenderer extends CSharpRenderer {
995
989
  if (max !== undefined) {
996
990
  conditions.push([variable, " <= ", max.toString()]);
997
991
  }
998
- this.emitLine("if (", (0, collection_utils_1.arrayIntercalate)([" && "], conditions), ")");
992
+ this.emitLine("if (", collection_utils_1.arrayIntercalate([" && "], conditions), ")");
999
993
  this.emitBlock(() => this.emitConsume(variable, xfer.consumer, targetType, emitFinish));
1000
994
  return false;
1001
995
  }
1002
996
  else if (xfer instanceof Transformers_1.UnionInstantiationTransformer) {
1003
997
  if (!(targetType instanceof Type_1.UnionType)) {
1004
- return (0, Support_1.panic)("Union instantiation transformer must produce a union type");
998
+ return Support_1.panic("Union instantiation transformer must produce a union type");
1005
999
  }
1006
- const maybeNullable = (0, TypeUtils_1.nullableFromUnion)(targetType);
1000
+ const maybeNullable = TypeUtils_1.nullableFromUnion(targetType);
1007
1001
  if (maybeNullable !== null) {
1008
1002
  emitFinish(variable);
1009
1003
  }
@@ -1022,12 +1016,12 @@ class NewtonsoftCSharpRenderer extends CSharpRenderer {
1022
1016
  return true;
1023
1017
  }
1024
1018
  else {
1025
- return (0, Support_1.panic)("Unknown transformer");
1019
+ return Support_1.panic("Unknown transformer");
1026
1020
  }
1027
1021
  return false;
1028
1022
  }
1029
1023
  emitTransformation(converterName, t) {
1030
- const xf = (0, Support_1.defined)((0, Transformers_1.transformationForType)(t));
1024
+ const xf = Support_1.defined(Transformers_1.transformationForType(t));
1031
1025
  const reverse = xf.reverse;
1032
1026
  const targetType = xf.targetType;
1033
1027
  const xfer = xf.transformer;
@@ -1106,14 +1100,10 @@ exports.systemTextJsonCSharpOptions = Object.assign({}, exports.cSharpOptions, {
1106
1100
  checkRequired: new RendererOptions_1.BooleanOption("check-required", "Fail if required properties are missing", false)
1107
1101
  });
1108
1102
  class SystemTextJsonCSharpRenderer extends CSharpRenderer {
1109
- _options;
1110
- _enumExtensionsNames = new Map();
1111
- _needHelpers;
1112
- _needAttributes;
1113
- _needNamespaces;
1114
1103
  constructor(targetLanguage, renderContext, _options) {
1115
1104
  super(targetLanguage, renderContext, _options);
1116
1105
  this._options = _options;
1106
+ this._enumExtensionsNames = new Map();
1117
1107
  this._needHelpers = _options.features.helpers;
1118
1108
  this._needAttributes = _options.features.attributes;
1119
1109
  this._needNamespaces = _options.features.namespaces;
@@ -1208,7 +1198,7 @@ class SystemTextJsonCSharpRenderer extends CSharpRenderer {
1208
1198
  else {
1209
1199
  rhs = [topLevelName, ".FromJson(jsonString)"];
1210
1200
  }
1211
- this.emitLine("// var ", (0, Source_1.modifySource)(Strings_1.camelCase, topLevelName), " = ", rhs, ";");
1201
+ this.emitLine("// var ", Source_1.modifySource(Strings_1.camelCase, topLevelName), " = ", rhs, ";");
1212
1202
  });
1213
1203
  // fix: should this be an option? Or respond to an existing option?
1214
1204
  this.emitLine("#nullable enable");
@@ -1217,27 +1207,27 @@ class SystemTextJsonCSharpRenderer extends CSharpRenderer {
1217
1207
  this.emitLine("#pragma warning disable CS8603");
1218
1208
  }
1219
1209
  converterForType(t) {
1220
- let xf = (0, Transformers_1.transformationForType)(t);
1210
+ let xf = Transformers_1.transformationForType(t);
1221
1211
  if (xf === undefined && t instanceof Type_1.UnionType) {
1222
- const maybeNullable = (0, TypeUtils_1.nullableFromUnion)(t);
1212
+ const maybeNullable = TypeUtils_1.nullableFromUnion(t);
1223
1213
  if (maybeNullable !== null) {
1224
1214
  t = maybeNullable;
1225
- xf = (0, Transformers_1.transformationForType)(t);
1215
+ xf = Transformers_1.transformationForType(t);
1226
1216
  }
1227
1217
  }
1228
1218
  if (xf === undefined)
1229
1219
  return undefined;
1230
1220
  if (alwaysApplyTransformation(xf))
1231
1221
  return undefined;
1232
- return (0, Support_1.defined)(this.nameForTransformation(t));
1222
+ return Support_1.defined(this.nameForTransformation(t));
1233
1223
  }
1234
1224
  attributesForProperty(property, _name, _c, jsonName) {
1235
1225
  if (!this._needAttributes)
1236
1226
  return undefined;
1237
1227
  const attributes = [];
1238
1228
  const jsonPropertyName = this._options.dense ? denseJsonPropertyName : "JsonPropertyName";
1239
- const escapedName = (0, Strings_1.utf16StringEscape)(jsonName);
1240
- const isNullable = (0, Transformers_1.followTargetType)(property.type).isNullable;
1229
+ const escapedName = Strings_1.utf16StringEscape(jsonName);
1230
+ const isNullable = Transformers_1.followTargetType(property.type).isNullable;
1241
1231
  const isOptional = property.isOptional;
1242
1232
  if (isOptional && !isNullable) {
1243
1233
  attributes.push(["[", "JsonIgnore", "(Condition = JsonIgnoreCondition.WhenWritingNull)]"]);
@@ -1364,7 +1354,7 @@ class SystemTextJsonCSharpRenderer extends CSharpRenderer {
1364
1354
  this.emitLine("{");
1365
1355
  this.indent(() => {
1366
1356
  for (const [t, converter] of this.typesWithNamedTransformations) {
1367
- if (alwaysApplyTransformation((0, Support_1.defined)((0, Transformers_1.transformationForType)(t)))) {
1357
+ if (alwaysApplyTransformation(Support_1.defined(Transformers_1.transformationForType(t)))) {
1368
1358
  this.emitLine(this.converterObject(converter), ",");
1369
1359
  }
1370
1360
  }
@@ -1417,7 +1407,7 @@ class SystemTextJsonCSharpRenderer extends CSharpRenderer {
1417
1407
  else if (xfer instanceof Transformers_1.ArrayDecodingTransformer) {
1418
1408
  // FIXME: Consume StartArray
1419
1409
  if (!(targetType instanceof Type_1.ArrayType)) {
1420
- return (0, Support_1.panic)("Array decoding must produce an array type");
1410
+ return Support_1.panic("Array decoding must produce an array type");
1421
1411
  }
1422
1412
  // FIXME: handle EOF
1423
1413
  this.emitLine("reader.Read();");
@@ -1461,24 +1451,24 @@ class SystemTextJsonCSharpRenderer extends CSharpRenderer {
1461
1451
  return false;
1462
1452
  }
1463
1453
  else {
1464
- return (0, Support_1.panic)("Unknown transformer");
1454
+ return Support_1.panic("Unknown transformer");
1465
1455
  }
1466
1456
  }
1467
1457
  stringCaseValue(t, stringCase) {
1468
1458
  if (t.kind === "string") {
1469
- return ['"', (0, Strings_1.utf16StringEscape)(stringCase), '"'];
1459
+ return ['"', Strings_1.utf16StringEscape(stringCase), '"'];
1470
1460
  }
1471
1461
  else if (t instanceof Type_1.EnumType) {
1472
1462
  return [this.nameForNamedType(t), ".", this.nameForEnumCase(t, stringCase)];
1473
1463
  }
1474
- return (0, Support_1.panic)(`Type ${t.kind} does not have string cases`);
1464
+ return Support_1.panic(`Type ${t.kind} does not have string cases`);
1475
1465
  }
1476
1466
  emitTransformer(variable, xfer, targetType, emitFinish) {
1477
1467
  function directTargetType(continuation) {
1478
1468
  if (continuation === undefined) {
1479
1469
  return targetType;
1480
1470
  }
1481
- return (0, Transformers_1.followTargetType)(continuation.sourceType);
1471
+ return Transformers_1.followTargetType(continuation.sourceType);
1482
1472
  }
1483
1473
  if (xfer instanceof Transformers_1.ChoiceTransformer) {
1484
1474
  const caseXfers = xfer.transformers;
@@ -1487,7 +1477,7 @@ class SystemTextJsonCSharpRenderer extends CSharpRenderer {
1487
1477
  this.emitBlock(() => {
1488
1478
  for (const caseXfer of caseXfers) {
1489
1479
  const matchXfer = caseXfer;
1490
- const value = this.stringCaseValue((0, Transformers_1.followTargetType)(matchXfer.sourceType), matchXfer.stringCase);
1480
+ const value = this.stringCaseValue(Transformers_1.followTargetType(matchXfer.sourceType), matchXfer.stringCase);
1491
1481
  this.emitLine("case ", value, ":");
1492
1482
  this.indent(() => {
1493
1483
  const allDone = this.emitTransformer(variable, matchXfer.transformer, targetType, emitFinish);
@@ -1508,7 +1498,7 @@ class SystemTextJsonCSharpRenderer extends CSharpRenderer {
1508
1498
  }
1509
1499
  else if (xfer instanceof Transformers_1.UnionMemberMatchTransformer) {
1510
1500
  const memberType = xfer.memberType;
1511
- const maybeNullable = (0, TypeUtils_1.nullableFromUnion)(xfer.sourceType);
1501
+ const maybeNullable = TypeUtils_1.nullableFromUnion(xfer.sourceType);
1512
1502
  let test;
1513
1503
  let member;
1514
1504
  if (maybeNullable !== null) {
@@ -1537,7 +1527,7 @@ class SystemTextJsonCSharpRenderer extends CSharpRenderer {
1537
1527
  this.emitBlock(() => this.emitTransformer(member, xfer.transformer, targetType, emitFinish));
1538
1528
  }
1539
1529
  else if (xfer instanceof Transformers_1.StringMatchTransformer) {
1540
- const value = this.stringCaseValue((0, Transformers_1.followTargetType)(xfer.sourceType), xfer.stringCase);
1530
+ const value = this.stringCaseValue(Transformers_1.followTargetType(xfer.sourceType), xfer.stringCase);
1541
1531
  this.emitLine("if (", variable, " == ", value, ")");
1542
1532
  this.emitBlock(() => this.emitTransformer(variable, xfer.transformer, targetType, emitFinish));
1543
1533
  }
@@ -1604,7 +1594,7 @@ class SystemTextJsonCSharpRenderer extends CSharpRenderer {
1604
1594
  this.emitBlock(() => this.emitConsume("b", xfer.consumer, targetType, emitFinish));
1605
1595
  break;
1606
1596
  default:
1607
- return (0, Support_1.panic)(`Parsing string to ${immediateTargetType.kind} not supported`);
1597
+ return Support_1.panic(`Parsing string to ${immediateTargetType.kind} not supported`);
1608
1598
  }
1609
1599
  }
1610
1600
  else if (xfer instanceof Transformers_1.StringifyTransformer) {
@@ -1620,7 +1610,7 @@ class SystemTextJsonCSharpRenderer extends CSharpRenderer {
1620
1610
  this.emitLine("var boolString = ", variable, ' ? "true" : "false";');
1621
1611
  return this.emitConsume("boolString", xfer.consumer, targetType, emitFinish);
1622
1612
  default:
1623
- return (0, Support_1.panic)(`Stringifying ${xfer.sourceType.kind} not supported`);
1613
+ return Support_1.panic(`Stringifying ${xfer.sourceType.kind} not supported`);
1624
1614
  }
1625
1615
  }
1626
1616
  else if (xfer instanceof Transformers_1.StringProducerTransformer) {
@@ -1637,7 +1627,7 @@ class SystemTextJsonCSharpRenderer extends CSharpRenderer {
1637
1627
  if (max !== undefined) {
1638
1628
  conditions.push([variable, ".Length <= ", max.toString()]);
1639
1629
  }
1640
- this.emitLine("if (", (0, collection_utils_1.arrayIntercalate)([" && "], conditions), ")");
1630
+ this.emitLine("if (", collection_utils_1.arrayIntercalate([" && "], conditions), ")");
1641
1631
  this.emitBlock(() => this.emitConsume(variable, xfer.consumer, targetType, emitFinish));
1642
1632
  return false;
1643
1633
  }
@@ -1651,15 +1641,15 @@ class SystemTextJsonCSharpRenderer extends CSharpRenderer {
1651
1641
  if (max !== undefined) {
1652
1642
  conditions.push([variable, " <= ", max.toString()]);
1653
1643
  }
1654
- this.emitLine("if (", (0, collection_utils_1.arrayIntercalate)([" && "], conditions), ")");
1644
+ this.emitLine("if (", collection_utils_1.arrayIntercalate([" && "], conditions), ")");
1655
1645
  this.emitBlock(() => this.emitConsume(variable, xfer.consumer, targetType, emitFinish));
1656
1646
  return false;
1657
1647
  }
1658
1648
  else if (xfer instanceof Transformers_1.UnionInstantiationTransformer) {
1659
1649
  if (!(targetType instanceof Type_1.UnionType)) {
1660
- return (0, Support_1.panic)("Union instantiation transformer must produce a union type");
1650
+ return Support_1.panic("Union instantiation transformer must produce a union type");
1661
1651
  }
1662
- const maybeNullable = (0, TypeUtils_1.nullableFromUnion)(targetType);
1652
+ const maybeNullable = TypeUtils_1.nullableFromUnion(targetType);
1663
1653
  if (maybeNullable !== null) {
1664
1654
  emitFinish(variable);
1665
1655
  }
@@ -1678,12 +1668,12 @@ class SystemTextJsonCSharpRenderer extends CSharpRenderer {
1678
1668
  return true;
1679
1669
  }
1680
1670
  else {
1681
- return (0, Support_1.panic)("Unknown transformer");
1671
+ return Support_1.panic("Unknown transformer");
1682
1672
  }
1683
1673
  return false;
1684
1674
  }
1685
1675
  emitTransformation(converterName, t) {
1686
- const xf = (0, Support_1.defined)((0, Transformers_1.transformationForType)(t));
1676
+ const xf = Support_1.defined(Transformers_1.transformationForType(t));
1687
1677
  const reverse = xf.reverse;
1688
1678
  const targetType = xf.targetType;
1689
1679
  const xfer = xf.transformer;
@@ -8,7 +8,7 @@ import { RenderContext } from "../Renderer";
8
8
  export declare class CrystalTargetLanguage extends TargetLanguage {
9
9
  protected makeRenderer(renderContext: RenderContext): CrystalRenderer;
10
10
  constructor();
11
- protected get defaultIndentation(): string;
11
+ protected readonly defaultIndentation: string;
12
12
  protected getOptions(): Option<any>[];
13
13
  }
14
14
  export declare class CrystalRenderer extends ConvenienceRenderer {
@@ -21,7 +21,7 @@ export declare class CrystalRenderer extends ConvenienceRenderer {
21
21
  protected forbiddenForObjectProperties(_c: ClassType, _className: Name): ForbiddenWordsInfo;
22
22
  protected forbiddenForUnionMembers(_u: UnionType, _unionName: Name): ForbiddenWordsInfo;
23
23
  protected forbiddenForEnumCases(_e: EnumType, _enumName: Name): ForbiddenWordsInfo;
24
- protected get commentLineStart(): string;
24
+ protected readonly commentLineStart: string;
25
25
  private nullableCrystalType;
26
26
  protected isImplicitCycleBreaker(t: Type): boolean;
27
27
  private crystalType;