@goast/kotlin 0.7.0 → 0.7.1

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 (132) hide show
  1. package/dist/src/assets.d.ts +17 -0
  2. package/dist/src/assets.js +17 -0
  3. package/dist/src/ast/common.d.ts +4 -0
  4. package/dist/src/ast/node.d.ts +11 -0
  5. package/dist/src/ast/node.js +11 -0
  6. package/dist/src/ast/nodes/annotation.d.ts +44 -0
  7. package/dist/src/ast/nodes/annotation.js +40 -0
  8. package/dist/src/ast/nodes/argument.d.ts +33 -0
  9. package/dist/src/ast/nodes/argument.js +33 -0
  10. package/dist/src/ast/nodes/call.d.ts +42 -0
  11. package/dist/src/ast/nodes/call.js +42 -0
  12. package/dist/src/ast/nodes/class.d.ts +96 -0
  13. package/dist/src/ast/nodes/class.js +90 -0
  14. package/dist/src/ast/nodes/collection-literal.d.ts +35 -0
  15. package/dist/src/ast/nodes/collection-literal.js +35 -0
  16. package/dist/src/ast/nodes/constructor.d.ts +65 -0
  17. package/dist/src/ast/nodes/constructor.js +62 -0
  18. package/dist/src/ast/nodes/doc-tag.d.ts +41 -0
  19. package/dist/src/ast/nodes/doc-tag.js +41 -0
  20. package/dist/src/ast/nodes/doc.d.ts +44 -0
  21. package/dist/src/ast/nodes/doc.js +44 -0
  22. package/dist/src/ast/nodes/enum-value.d.ts +50 -0
  23. package/dist/src/ast/nodes/enum-value.js +47 -0
  24. package/dist/src/ast/nodes/enum.d.ts +67 -0
  25. package/dist/src/ast/nodes/enum.js +64 -0
  26. package/dist/src/ast/nodes/function.d.ts +105 -0
  27. package/dist/src/ast/nodes/function.js +105 -0
  28. package/dist/src/ast/nodes/generic-parameter.d.ts +37 -0
  29. package/dist/src/ast/nodes/generic-parameter.js +37 -0
  30. package/dist/src/ast/nodes/init-block.d.ts +32 -0
  31. package/dist/src/ast/nodes/init-block.js +32 -0
  32. package/dist/src/ast/nodes/interface.d.ts +73 -0
  33. package/dist/src/ast/nodes/interface.js +68 -0
  34. package/dist/src/ast/nodes/lambda-type.d.ts +42 -0
  35. package/dist/src/ast/nodes/lambda-type.js +42 -0
  36. package/dist/src/ast/nodes/lambda.d.ts +41 -0
  37. package/dist/src/ast/nodes/lambda.js +41 -0
  38. package/dist/src/ast/nodes/object.d.ts +66 -0
  39. package/dist/src/ast/nodes/object.js +62 -0
  40. package/dist/src/ast/nodes/parameter.d.ts +68 -0
  41. package/dist/src/ast/nodes/parameter.js +68 -0
  42. package/dist/src/ast/nodes/property.d.ts +152 -0
  43. package/dist/src/ast/nodes/property.js +148 -0
  44. package/dist/src/ast/nodes/reference.d.ts +107 -0
  45. package/dist/src/ast/nodes/reference.js +75 -0
  46. package/dist/src/ast/nodes/string.d.ts +57 -0
  47. package/dist/src/ast/nodes/string.js +57 -0
  48. package/dist/src/ast/nodes/types.d.ts +9 -0
  49. package/dist/src/ast/references/jackson.d.ts +67 -0
  50. package/dist/src/ast/references/jackson.js +59 -0
  51. package/dist/src/ast/references/jakarta.d.ts +13 -0
  52. package/dist/src/ast/references/jakarta.js +13 -0
  53. package/dist/src/ast/references/java.d.ts +19 -0
  54. package/dist/src/ast/references/java.js +19 -0
  55. package/dist/src/ast/references/kotlin.d.ts +28 -0
  56. package/dist/src/ast/references/kotlin.js +28 -0
  57. package/dist/src/ast/references/kotlinx.d.ts +8 -0
  58. package/dist/src/ast/references/kotlinx.js +8 -0
  59. package/dist/src/ast/references/okhttp3.d.ts +8 -0
  60. package/dist/src/ast/references/okhttp3.js +8 -0
  61. package/dist/src/ast/references/reactor.d.ts +8 -0
  62. package/dist/src/ast/references/reactor.js +8 -0
  63. package/dist/src/ast/references/spring-reactive.d.ts +18 -0
  64. package/dist/src/ast/references/spring-reactive.js +18 -0
  65. package/dist/src/ast/references/spring.d.ts +27 -0
  66. package/dist/src/ast/references/spring.js +27 -0
  67. package/dist/src/ast/references/swagger.d.ts +13 -0
  68. package/dist/src/ast/references/swagger.js +13 -0
  69. package/dist/src/ast/utils/get-kotlin-builder-options.d.ts +10 -0
  70. package/dist/src/ast/utils/get-kotlin-builder-options.js +10 -0
  71. package/dist/src/ast/utils/to-kt-node.d.ts +40 -0
  72. package/dist/src/ast/utils/write-kt-annotations.d.ts +13 -0
  73. package/dist/src/ast/utils/write-kt-annotations.js +13 -0
  74. package/dist/src/ast/utils/write-kt-arguments.d.ts +15 -0
  75. package/dist/src/ast/utils/write-kt-arguments.js +15 -0
  76. package/dist/src/ast/utils/write-kt-enum-values.d.ts +13 -0
  77. package/dist/src/ast/utils/write-kt-enum-values.js +13 -0
  78. package/dist/src/ast/utils/write-kt-generic-parameters.d.ts +10 -0
  79. package/dist/src/ast/utils/write-kt-generic-parameters.js +10 -0
  80. package/dist/src/ast/utils/write-kt-members.d.ts +16 -0
  81. package/dist/src/ast/utils/write-kt-members.js +16 -0
  82. package/dist/src/ast/utils/write-kt-node.d.ts +29 -0
  83. package/dist/src/ast/utils/write-kt-node.js +24 -0
  84. package/dist/src/ast/utils/write-kt-parameters.d.ts +13 -0
  85. package/dist/src/ast/utils/write-kt-parameters.js +13 -0
  86. package/dist/src/common-results.d.ts +9 -0
  87. package/dist/src/config.d.ts +72 -0
  88. package/dist/src/config.js +5 -0
  89. package/dist/src/file-builder.d.ts +91 -0
  90. package/dist/src/file-builder.js +81 -0
  91. package/dist/src/generators/file-generator.d.ts +12 -0
  92. package/dist/src/generators/file-generator.js +7 -0
  93. package/dist/src/generators/models/args.d.ts +233 -0
  94. package/dist/src/generators/models/model-generator.d.ts +25 -0
  95. package/dist/src/generators/models/model-generator.js +14 -0
  96. package/dist/src/generators/models/models-generator.d.ts +15 -0
  97. package/dist/src/generators/models/models-generator.js +15 -0
  98. package/dist/src/generators/models/models.d.ts +93 -2
  99. package/dist/src/generators/models/models.js +5 -0
  100. package/dist/src/generators/services/okhttp3-clients/args.d.ts +138 -0
  101. package/dist/src/generators/services/okhttp3-clients/models.d.ts +83 -0
  102. package/dist/src/generators/services/okhttp3-clients/models.js +5 -0
  103. package/dist/src/generators/services/okhttp3-clients/okhttp3-client-generator.d.ts +33 -0
  104. package/dist/src/generators/services/okhttp3-clients/okhttp3-client-generator.js +20 -0
  105. package/dist/src/generators/services/okhttp3-clients/okhttp3-clients-generator.d.ts +21 -0
  106. package/dist/src/generators/services/okhttp3-clients/okhttp3-clients-generator.js +21 -0
  107. package/dist/src/generators/services/okhttp3-clients/refs.d.ts +25 -0
  108. package/dist/src/generators/services/okhttp3-clients/refs.js +7 -0
  109. package/dist/src/generators/services/spring-controllers/args.d.ts +169 -0
  110. package/dist/src/generators/services/spring-controllers/models.d.ts +120 -0
  111. package/dist/src/generators/services/spring-controllers/models.js +4 -0
  112. package/dist/src/generators/services/spring-controllers/refs.d.ts +9 -0
  113. package/dist/src/generators/services/spring-controllers/refs.js +9 -0
  114. package/dist/src/generators/services/spring-controllers/spring-controller-generator.d.ts +29 -0
  115. package/dist/src/generators/services/spring-controllers/spring-controller-generator.js +19 -0
  116. package/dist/src/generators/services/spring-controllers/spring-controllers-generator.d.ts +22 -0
  117. package/dist/src/generators/services/spring-controllers/spring-controllers-generator.js +22 -0
  118. package/dist/src/generators/services/spring-reactive-web-clients/args.d.ts +224 -0
  119. package/dist/src/generators/services/spring-reactive-web-clients/models.d.ts +86 -0
  120. package/dist/src/generators/services/spring-reactive-web-clients/models.js +4 -0
  121. package/dist/src/generators/services/spring-reactive-web-clients/refs.d.ts +7 -0
  122. package/dist/src/generators/services/spring-reactive-web-clients/refs.js +7 -0
  123. package/dist/src/generators/services/spring-reactive-web-clients/spring-reactive-web-client-generator.d.ts +36 -0
  124. package/dist/src/generators/services/spring-reactive-web-clients/spring-reactive-web-client-generator.js +25 -0
  125. package/dist/src/generators/services/spring-reactive-web-clients/spring-reactive-web-clients-generator.d.ts +20 -0
  126. package/dist/src/generators/services/spring-reactive-web-clients/spring-reactive-web-clients-generator.js +20 -0
  127. package/dist/src/import-collection.d.ts +64 -0
  128. package/dist/src/import-collection.js +46 -0
  129. package/dist/src/types.d.ts +4 -0
  130. package/dist/src/utils.d.ts +52 -0
  131. package/dist/src/utils.js +52 -0
  132. package/package.json +2 -2
@@ -3,6 +3,24 @@ import { KotlinFileBuilder } from '../../file-builder.js';
3
3
  import { KtNode } from '../node.js';
4
4
  import { writeKtNode, writeKtNodes } from '../utils/write-kt-node.js';
5
5
  import { ktGenericParameter } from './generic-parameter.js';
6
+ /**
7
+ * Represents a reference to a named Kotlin type or declaration, such as `List<String>?` or `Foo::class`.
8
+ *
9
+ * Written in this order: the name, the generic arguments in angle brackets, then one suffix. The suffix is `::class`
10
+ * when `classReference` is set, `::` followed by `subReference` when that is set, or `?` when `nullable` is set. The
11
+ * suffixes exclude each other, so `nullable` has no effect when `classReference` or `subReference` is set.
12
+ *
13
+ * Writing a reference also imports it. When `packageName` is set and the builder is a `KotlinFileBuilder`, the file
14
+ * gets an import for `<packageName>.<name>`, unless the package is the package of the file itself. Imports that match
15
+ * the `globalImports` option of the generator configuration are left out when the import block is written. Builders
16
+ * with no registered handler, such as a plain string builder, only receive the name. The import is added when the
17
+ * reference is written, so use `addImport` or `ktReference.import` to add an import without writing the reference.
18
+ *
19
+ * @template TBuilder The type of the source builder the reference is written to.
20
+ * @template TInjects Additional names of custom injection points (`before*` and `after*`) accepted by this node.
21
+ * @see ktReference
22
+ * @see KtReference.registerAddImportHandler
23
+ */
6
24
  export class KtReference extends KtNode {
7
25
  static addImportHandlers = [
8
26
  {
@@ -10,12 +28,40 @@ export class KtReference extends KtNode {
10
28
  handler: (builder, reference) => builder.addImport(reference.name, reference.packageName),
11
29
  },
12
30
  ];
31
+ /**
32
+ * The name written verbatim, such as `List`. When `packageName` is set, the same name is imported.
33
+ */
13
34
  name;
35
+ /**
36
+ * The package the name is imported from, such as `com.example.models`. `null` writes the name without an import.
37
+ */
14
38
  packageName;
39
+ /**
40
+ * The generic arguments written in angle brackets after the name, such as `<String>` in `List<String>`. An empty list
41
+ * writes nothing.
42
+ */
15
43
  generics;
44
+ /**
45
+ * Whether a `?` is written after the name, which makes the type nullable. Ignored when `classReference` or
46
+ * `subReference` is set.
47
+ * @default false
48
+ */
16
49
  nullable;
50
+ /**
51
+ * Whether the reference is written as a class literal, such as `Foo::class`. Takes precedence over `subReference` and
52
+ * `nullable`.
53
+ * @default false
54
+ */
17
55
  classReference;
56
+ /**
57
+ * A reference or call written after `::`, such as `Bar` in `Foo::Bar`, or `null` for none. Takes precedence over
58
+ * `nullable`, and `classReference` takes precedence over it.
59
+ */
18
60
  subReference;
61
+ /**
62
+ * Initializes a new instance of the KtReference class.
63
+ * @param options The options to use for this instance.
64
+ */
19
65
  constructor(options) {
20
66
  super(options);
21
67
  this.name = options.name;
@@ -25,6 +71,11 @@ export class KtReference extends KtNode {
25
71
  this.classReference = options.classReference ?? false;
26
72
  this.subReference = options.subReference ?? null;
27
73
  }
74
+ /**
75
+ * Adds the import for this reference to the builder without writing the reference. Nothing is added when
76
+ * `packageName` is not set, or when no handler is registered for the class of the builder.
77
+ * @param builder The builder to add the import to.
78
+ */
28
79
  addImport(builder) {
29
80
  if (this.packageName) {
30
81
  const handler = KtReference.addImportHandlers.find((h) => builder instanceof h.builderClass);
@@ -48,6 +99,14 @@ export class KtReference extends KtNode {
48
99
  }
49
100
  this.addImport(builder);
50
101
  }
102
+ /**
103
+ * Registers a handler that adds imports for references written to builders of the given class. The handlers are tried
104
+ * in the order they were registered, and the first one whose class matches the builder is used. The handler for
105
+ * `KotlinFileBuilder` is registered first, so it also matches subclasses of that class.
106
+ * @template TBuilder The type of the builder that the handler supports.
107
+ * @param builderClass The class of the builders that the handler applies to.
108
+ * @param handler Adds the import for the reference to the builder.
109
+ */
51
110
  static registerAddImportHandler(builderClass, handler) {
52
111
  KtReference.addImportHandlers.push({ builderClass, handler });
53
112
  }
@@ -71,6 +130,22 @@ const createGenericFactory = (name, packageName) => {
71
130
  const importRefs = (builder, references) => {
72
131
  references.forEach((ref) => ref.addImport(builder));
73
132
  };
133
+ /**
134
+ * Factory for creating reference nodes. The `factory` and `genericFactory` functions create factories for one fixed
135
+ * name and package, `import` adds the imports of references without writing them, and `write` writes one or more
136
+ * reference nodes to a builder.
137
+ *
138
+ * @param name The name of the referenced type, such as `List`.
139
+ * @param packageName The package the name is imported from, or `null` to write the name without an import.
140
+ * @param options The settings of the reference. See `KtReference` for the available properties.
141
+ * @example
142
+ * ```ts
143
+ * ktReference('User', 'com.example.models', { generics: ['String'], nullable: true });
144
+ * // Emits:
145
+ * // User<String>?
146
+ * // and adds the import `com.example.models.User` to the file.
147
+ * ```
148
+ */
74
149
  export const ktReference = Object.assign(createReference, {
75
150
  factory: createFactory,
76
151
  genericFactory: createGenericFactory,
@@ -10,13 +10,55 @@ type Options<TBuilder extends SourceBuilder, TInjects extends string = never> =
10
10
  marginPrefix?: Nullable<string>;
11
11
  autoAddMarginPrefix?: Nullable<boolean>;
12
12
  }>;
13
+ /**
14
+ * Represents a Kotlin string literal, such as `"Hello"`, or the `null` literal when the value is `null`.
15
+ *
16
+ * The value is escaped like a JSON string, and `$` is escaped so that it stays literal, unless `template` is set. A
17
+ * multiline string is written as a raw string in triple quotes. Its line breaks are kept, and with `trimMargin` each
18
+ * line is prefixed with `marginPrefix` and the string is followed by `.trimMargin()`.
19
+ *
20
+ * @template TBuilder The type of the source builder the string is written to.
21
+ * @template TInjects Additional names of custom injection points (`before*` and `after*`) accepted by this node.
22
+ * @see ktString
23
+ */
13
24
  export declare class KtString<TBuilder extends SourceBuilder, TInjects extends string = never> extends KtNode<TBuilder, TInjects | Injects> {
25
+ /**
26
+ * The text of the string, escaped as described above. `null` writes the Kotlin `null` literal instead of a string.
27
+ */
14
28
  value: string | null;
29
+ /**
30
+ * Whether `${...}` placeholders in the value are kept as Kotlin string templates. Otherwise `$` is escaped as
31
+ * `\$`, so the placeholder text is written literally.
32
+ * @default false
33
+ */
15
34
  template: boolean;
35
+ /**
36
+ * Whether the string is written as a raw string in triple quotes. Line breaks in the value become line breaks in the
37
+ * output, and without `trimMargin` the text is written in one piece.
38
+ * @default false
39
+ */
16
40
  multiline: boolean;
41
+ /**
42
+ * Whether a multiline string starts on a new line and is followed by `.trimMargin()`, the Kotlin call that removes
43
+ * the margin prefix at runtime. Has no effect on single-line strings.
44
+ * @default true
45
+ */
17
46
  trimMargin: boolean;
47
+ /**
48
+ * The prefix written at the start of each line of a multiline string, and passed to `trimMargin` as its argument,
49
+ * such as `.trimMargin("!")`. `null` uses `|` as the prefix and writes `.trimMargin()` without an argument.
50
+ */
18
51
  marginPrefix: string | null;
52
+ /**
53
+ * Whether the margin prefix is written at the start of each line of a multiline string. When `false`, the lines are
54
+ * written as they are, and `.trimMargin()` is still appended.
55
+ * @default true
56
+ */
19
57
  autoAddMarginPrefix: boolean;
58
+ /**
59
+ * Initializes a new instance of the KtString class.
60
+ * @param options The options to use for this instance.
61
+ */
20
62
  constructor(options: Options<TBuilder, TInjects>);
21
63
  protected onWrite(builder: TBuilder): void;
22
64
  protected findTemplateParts(value: string): {
@@ -25,6 +67,21 @@ export declare class KtString<TBuilder extends SourceBuilder, TInjects extends s
25
67
  }[];
26
68
  }
27
69
  declare const createString: <TBuilder extends SourceBuilder>(value: Options<TBuilder>['value'], options?: Prettify<Omit<Options<TBuilder>, 'value'>>) => KtString<TBuilder>;
70
+ /**
71
+ * Factory for creating string nodes. The `write` function writes one or more string nodes to a builder.
72
+ *
73
+ * @param value The text of the string, or `null` for the Kotlin `null` literal.
74
+ * @param options The settings of the string. See `KtString` for the available properties.
75
+ * @example
76
+ * ```ts
77
+ * ktString('first line\nsecond line', { multiline: true });
78
+ * // Emits:
79
+ * // """
80
+ * // |first line
81
+ * // |second line
82
+ * // """.trimMargin()
83
+ * ```
84
+ */
28
85
  export declare const ktString: typeof createString & {
29
86
  write: typeof writeKtNodes;
30
87
  };
@@ -2,13 +2,55 @@ import { spliceString } from '@goast/core';
2
2
  import { KtNode } from '../node.js';
3
3
  import { writeKtNodes } from '../utils/write-kt-node.js';
4
4
  import { ktArgument } from './argument.js';
5
+ /**
6
+ * Represents a Kotlin string literal, such as `"Hello"`, or the `null` literal when the value is `null`.
7
+ *
8
+ * The value is escaped like a JSON string, and `$` is escaped so that it stays literal, unless `template` is set. A
9
+ * multiline string is written as a raw string in triple quotes. Its line breaks are kept, and with `trimMargin` each
10
+ * line is prefixed with `marginPrefix` and the string is followed by `.trimMargin()`.
11
+ *
12
+ * @template TBuilder The type of the source builder the string is written to.
13
+ * @template TInjects Additional names of custom injection points (`before*` and `after*`) accepted by this node.
14
+ * @see ktString
15
+ */
5
16
  export class KtString extends KtNode {
17
+ /**
18
+ * The text of the string, escaped as described above. `null` writes the Kotlin `null` literal instead of a string.
19
+ */
6
20
  value;
21
+ /**
22
+ * Whether `${...}` placeholders in the value are kept as Kotlin string templates. Otherwise `$` is escaped as
23
+ * `\$`, so the placeholder text is written literally.
24
+ * @default false
25
+ */
7
26
  template;
27
+ /**
28
+ * Whether the string is written as a raw string in triple quotes. Line breaks in the value become line breaks in the
29
+ * output, and without `trimMargin` the text is written in one piece.
30
+ * @default false
31
+ */
8
32
  multiline;
33
+ /**
34
+ * Whether a multiline string starts on a new line and is followed by `.trimMargin()`, the Kotlin call that removes
35
+ * the margin prefix at runtime. Has no effect on single-line strings.
36
+ * @default true
37
+ */
9
38
  trimMargin;
39
+ /**
40
+ * The prefix written at the start of each line of a multiline string, and passed to `trimMargin` as its argument,
41
+ * such as `.trimMargin("!")`. `null` uses `|` as the prefix and writes `.trimMargin()` without an argument.
42
+ */
10
43
  marginPrefix;
44
+ /**
45
+ * Whether the margin prefix is written at the start of each line of a multiline string. When `false`, the lines are
46
+ * written as they are, and `.trimMargin()` is still appended.
47
+ * @default true
48
+ */
11
49
  autoAddMarginPrefix;
50
+ /**
51
+ * Initializes a new instance of the KtString class.
52
+ * @param options The options to use for this instance.
53
+ */
12
54
  constructor(options) {
13
55
  super(options);
14
56
  this.value = options?.value ?? null;
@@ -82,6 +124,21 @@ export class KtString extends KtNode {
82
124
  }
83
125
  }
84
126
  const createString = (value, options) => new KtString({ ...options, value });
127
+ /**
128
+ * Factory for creating string nodes. The `write` function writes one or more string nodes to a builder.
129
+ *
130
+ * @param value The text of the string, or `null` for the Kotlin `null` literal.
131
+ * @param options The settings of the string. See `KtString` for the available properties.
132
+ * @example
133
+ * ```ts
134
+ * ktString('first line\nsecond line', { multiline: true });
135
+ * // Emits:
136
+ * // """
137
+ * // |first line
138
+ * // |second line
139
+ * // """.trimMargin()
140
+ * ```
141
+ */
85
142
  export const ktString = Object.assign(createString, {
86
143
  write: writeKtNodes,
87
144
  });
@@ -6,5 +6,14 @@ import type { KtLambda } from './lambda.ts';
6
6
  import type { KtObject } from './object.ts';
7
7
  import type { KtReference } from './reference.ts';
8
8
  import type { KtString } from './string.ts';
9
+ /**
10
+ * A value that can be written where a Kotlin type is expected: a reference, a lambda type, or any appended value.
11
+ * @template TBuilder The type of the builder that the type is written to.
12
+ */
9
13
  export type KtType<TBuilder extends SourceBuilder> = KtReference<TBuilder> | KtLambdaType<TBuilder> | BasicAppendValue<TBuilder>;
14
+ /**
15
+ * A value that can be written where a Kotlin expression is expected, such as a default value or an argument: a
16
+ * reference, a string, a call, an object, a lambda, a collection literal, or any appended value.
17
+ * @template TBuilder The type of the builder that the value is written to.
18
+ */
10
19
  export type KtValue<TBuilder extends SourceBuilder> = KtReference<TBuilder> | KtString<TBuilder> | KtCall<TBuilder> | KtObject<TBuilder> | KtLambda<TBuilder> | KtCollectionLiteral<TBuilder> | BasicAppendValue<TBuilder>;
@@ -1,17 +1,64 @@
1
+ /**
2
+ * Pre-built references to Jackson types.
3
+ *
4
+ * Annotation references are fixed to `com.fasterxml.jackson.annotation` on Spring Boot 3 and 4. The databind and
5
+ * Kotlin module factories take a `springBootVersion` and select `com.fasterxml.jackson.*` (Spring Boot 3, Jackson 2)
6
+ * or `tools.jackson.*` (Spring Boot 4, Jackson 3). `dateTimeFeature` is Jackson 3 only and is always
7
+ * `tools.jackson.databind.cfg`.
8
+ */
1
9
  import type { SourceBuilder } from '@goast/core';
2
10
  import type { SpringBootVersion } from '../../config.ts';
3
11
  import { type KtReference, type KtReferenceFactory } from '../nodes/reference.ts';
12
+ /** Reference to the `JsonTypeInfo` annotation from the `com.fasterxml.jackson.annotation` package. */
4
13
  export declare const jsonTypeInfo: KtReferenceFactory;
14
+ /** Reference to the `JsonSubTypes` annotation from the `com.fasterxml.jackson.annotation` package. */
5
15
  export declare const jsonSubTypes: KtReferenceFactory;
16
+ /** Reference to the `JsonClassDescription` annotation from the `com.fasterxml.jackson.annotation` package. */
6
17
  export declare const jsonClassDescription: KtReferenceFactory;
18
+ /** Reference to the `JsonProperty` annotation from the `com.fasterxml.jackson.annotation` package. */
7
19
  export declare const jsonProperty: KtReferenceFactory;
20
+ /** Reference to the `JsonPropertyDescription` annotation from the `com.fasterxml.jackson.annotation` package. */
8
21
  export declare const jsonPropertyDescription: KtReferenceFactory;
22
+ /** Reference to the `JsonInclude` annotation from the `com.fasterxml.jackson.annotation` package. */
9
23
  export declare const jsonInclude: KtReferenceFactory;
24
+ /** Reference to the `JsonIgnore` annotation from the `com.fasterxml.jackson.annotation` package. */
10
25
  export declare const jsonIgnore: KtReferenceFactory;
26
+ /** Reference to the `JsonAnySetter` annotation from the `com.fasterxml.jackson.annotation` package. */
11
27
  export declare const jsonAnySetter: KtReferenceFactory;
28
+ /** Reference to the `JsonAnyGetter` annotation from the `com.fasterxml.jackson.annotation` package. */
12
29
  export declare const jsonAnyGetter: KtReferenceFactory;
30
+ /**
31
+ * Factory for a reference to the `ObjectMapper` class from the `com.fasterxml.jackson.databind` package
32
+ * (Spring Boot 3) or the `tools.jackson.databind` package (Spring Boot 4).
33
+ *
34
+ * @template TBuilder The type of the source builder the reference is written to.
35
+ * @param springBootVersion The targeted Spring Boot major version. Selects the Jackson package.
36
+ * @default 3
37
+ * @returns A reference to `ObjectMapper`.
38
+ * @see SpringBootVersion
39
+ */
13
40
  export declare const objectMapper: <TBuilder extends SourceBuilder>(springBootVersion?: SpringBootVersion) => KtReference<TBuilder>;
41
+ /**
42
+ * Factory for a reference to the `SerializationFeature` type from the `com.fasterxml.jackson.databind` package
43
+ * (Spring Boot 3) or the `tools.jackson.databind` package (Spring Boot 4).
44
+ *
45
+ * @template TBuilder The type of the source builder the reference is written to.
46
+ * @param springBootVersion The targeted Spring Boot major version. Selects the Jackson package.
47
+ * @default 3
48
+ * @returns A reference to `SerializationFeature`.
49
+ * @see SpringBootVersion
50
+ */
14
51
  export declare const serializationFeature: <TBuilder extends SourceBuilder>(springBootVersion?: SpringBootVersion) => KtReference<TBuilder>;
52
+ /**
53
+ * Factory for a reference to the `DeserializationFeature` type from the `com.fasterxml.jackson.databind` package
54
+ * (Spring Boot 3) or the `tools.jackson.databind` package (Spring Boot 4).
55
+ *
56
+ * @template TBuilder The type of the source builder the reference is written to.
57
+ * @param springBootVersion The targeted Spring Boot major version. Selects the Jackson package.
58
+ * @default 3
59
+ * @returns A reference to `DeserializationFeature`.
60
+ * @see SpringBootVersion
61
+ */
15
62
  export declare const deserializationFeature: <TBuilder extends SourceBuilder>(springBootVersion?: SpringBootVersion) => KtReference<TBuilder>;
16
63
  /**
17
64
  * `tools.jackson.databind.cfg.DateTimeFeature` — Jackson 3 only.
@@ -21,5 +68,25 @@ export declare const deserializationFeature: <TBuilder extends SourceBuilder>(sp
21
68
  * line the constant still lives on `SerializationFeature`.
22
69
  */
23
70
  export declare const dateTimeFeature: KtReferenceFactory;
71
+ /**
72
+ * Factory for a reference to the `jacksonObjectMapper` function from the Jackson Kotlin module package,
73
+ * `com.fasterxml.jackson.module.kotlin` (Spring Boot 3) or `tools.jackson.module.kotlin` (Spring Boot 4).
74
+ *
75
+ * @template TBuilder The type of the source builder the reference is written to.
76
+ * @param springBootVersion The targeted Spring Boot major version. Selects the Jackson package.
77
+ * @default 3
78
+ * @returns A reference to `jacksonObjectMapper`.
79
+ * @see SpringBootVersion
80
+ */
24
81
  export declare const jacksonObjectMapper: <TBuilder extends SourceBuilder>(springBootVersion?: SpringBootVersion) => KtReference<TBuilder>;
82
+ /**
83
+ * Factory for a reference to the `jacksonMapperBuilder` function from the Jackson Kotlin module package,
84
+ * `com.fasterxml.jackson.module.kotlin` (Spring Boot 3) or `tools.jackson.module.kotlin` (Spring Boot 4).
85
+ *
86
+ * @template TBuilder The type of the source builder the reference is written to.
87
+ * @param springBootVersion The targeted Spring Boot major version. Selects the Jackson package.
88
+ * @default 3
89
+ * @returns A reference to `jacksonMapperBuilder`.
90
+ * @see SpringBootVersion
91
+ */
25
92
  export declare const jacksonMapperBuilder: <TBuilder extends SourceBuilder>(springBootVersion?: SpringBootVersion) => KtReference<TBuilder>;
@@ -7,18 +7,57 @@ import { ktReference } from '../nodes/reference.js';
7
7
  */
8
8
  const jacksonPackage = (subPackage, springBootVersion) => `${springBootVersion === 4 ? 'tools.jackson' : 'com.fasterxml.jackson'}.${subPackage}`;
9
9
  // com.fasterxml.jackson.annotation
10
+ /** Reference to the `JsonTypeInfo` annotation from the `com.fasterxml.jackson.annotation` package. */
10
11
  export const jsonTypeInfo = ktReference.factory('JsonTypeInfo', 'com.fasterxml.jackson.annotation');
12
+ /** Reference to the `JsonSubTypes` annotation from the `com.fasterxml.jackson.annotation` package. */
11
13
  export const jsonSubTypes = ktReference.factory('JsonSubTypes', 'com.fasterxml.jackson.annotation');
14
+ /** Reference to the `JsonClassDescription` annotation from the `com.fasterxml.jackson.annotation` package. */
12
15
  export const jsonClassDescription = ktReference.factory('JsonClassDescription', 'com.fasterxml.jackson.annotation');
16
+ /** Reference to the `JsonProperty` annotation from the `com.fasterxml.jackson.annotation` package. */
13
17
  export const jsonProperty = ktReference.factory('JsonProperty', 'com.fasterxml.jackson.annotation');
18
+ /** Reference to the `JsonPropertyDescription` annotation from the `com.fasterxml.jackson.annotation` package. */
14
19
  export const jsonPropertyDescription = ktReference.factory('JsonPropertyDescription', 'com.fasterxml.jackson.annotation');
20
+ /** Reference to the `JsonInclude` annotation from the `com.fasterxml.jackson.annotation` package. */
15
21
  export const jsonInclude = ktReference.factory('JsonInclude', 'com.fasterxml.jackson.annotation');
22
+ /** Reference to the `JsonIgnore` annotation from the `com.fasterxml.jackson.annotation` package. */
16
23
  export const jsonIgnore = ktReference.factory('JsonIgnore', 'com.fasterxml.jackson.annotation');
24
+ /** Reference to the `JsonAnySetter` annotation from the `com.fasterxml.jackson.annotation` package. */
17
25
  export const jsonAnySetter = ktReference.factory('JsonAnySetter', 'com.fasterxml.jackson.annotation');
26
+ /** Reference to the `JsonAnyGetter` annotation from the `com.fasterxml.jackson.annotation` package. */
18
27
  export const jsonAnyGetter = ktReference.factory('JsonAnyGetter', 'com.fasterxml.jackson.annotation');
19
28
  // com.fasterxml.jackson.databind (Jackson 2) / tools.jackson.databind (Jackson 3, Spring Boot 4)
29
+ /**
30
+ * Factory for a reference to the `ObjectMapper` class from the `com.fasterxml.jackson.databind` package
31
+ * (Spring Boot 3) or the `tools.jackson.databind` package (Spring Boot 4).
32
+ *
33
+ * @template TBuilder The type of the source builder the reference is written to.
34
+ * @param springBootVersion The targeted Spring Boot major version. Selects the Jackson package.
35
+ * @default 3
36
+ * @returns A reference to `ObjectMapper`.
37
+ * @see SpringBootVersion
38
+ */
20
39
  export const objectMapper = (springBootVersion = 3) => ktReference('ObjectMapper', jacksonPackage('databind', springBootVersion));
40
+ /**
41
+ * Factory for a reference to the `SerializationFeature` type from the `com.fasterxml.jackson.databind` package
42
+ * (Spring Boot 3) or the `tools.jackson.databind` package (Spring Boot 4).
43
+ *
44
+ * @template TBuilder The type of the source builder the reference is written to.
45
+ * @param springBootVersion The targeted Spring Boot major version. Selects the Jackson package.
46
+ * @default 3
47
+ * @returns A reference to `SerializationFeature`.
48
+ * @see SpringBootVersion
49
+ */
21
50
  export const serializationFeature = (springBootVersion = 3) => ktReference('SerializationFeature', jacksonPackage('databind', springBootVersion));
51
+ /**
52
+ * Factory for a reference to the `DeserializationFeature` type from the `com.fasterxml.jackson.databind` package
53
+ * (Spring Boot 3) or the `tools.jackson.databind` package (Spring Boot 4).
54
+ *
55
+ * @template TBuilder The type of the source builder the reference is written to.
56
+ * @param springBootVersion The targeted Spring Boot major version. Selects the Jackson package.
57
+ * @default 3
58
+ * @returns A reference to `DeserializationFeature`.
59
+ * @see SpringBootVersion
60
+ */
22
61
  export const deserializationFeature = (springBootVersion = 3) => ktReference('DeserializationFeature', jacksonPackage('databind', springBootVersion));
23
62
  /**
24
63
  * `tools.jackson.databind.cfg.DateTimeFeature` — Jackson 3 only.
@@ -29,5 +68,25 @@ export const deserializationFeature = (springBootVersion = 3) => ktReference('De
29
68
  */
30
69
  export const dateTimeFeature = ktReference.factory('DateTimeFeature', 'tools.jackson.databind.cfg');
31
70
  // com.fasterxml.jackson.module.kotlin (Jackson 2) / tools.jackson.module.kotlin (Jackson 3, Spring Boot 4)
71
+ /**
72
+ * Factory for a reference to the `jacksonObjectMapper` function from the Jackson Kotlin module package,
73
+ * `com.fasterxml.jackson.module.kotlin` (Spring Boot 3) or `tools.jackson.module.kotlin` (Spring Boot 4).
74
+ *
75
+ * @template TBuilder The type of the source builder the reference is written to.
76
+ * @param springBootVersion The targeted Spring Boot major version. Selects the Jackson package.
77
+ * @default 3
78
+ * @returns A reference to `jacksonObjectMapper`.
79
+ * @see SpringBootVersion
80
+ */
32
81
  export const jacksonObjectMapper = (springBootVersion = 3) => ktReference('jacksonObjectMapper', jacksonPackage('module.kotlin', springBootVersion));
82
+ /**
83
+ * Factory for a reference to the `jacksonMapperBuilder` function from the Jackson Kotlin module package,
84
+ * `com.fasterxml.jackson.module.kotlin` (Spring Boot 3) or `tools.jackson.module.kotlin` (Spring Boot 4).
85
+ *
86
+ * @template TBuilder The type of the source builder the reference is written to.
87
+ * @param springBootVersion The targeted Spring Boot major version. Selects the Jackson package.
88
+ * @default 3
89
+ * @returns A reference to `jacksonMapperBuilder`.
90
+ * @see SpringBootVersion
91
+ */
33
92
  export const jacksonMapperBuilder = (springBootVersion = 3) => ktReference('jacksonMapperBuilder', jacksonPackage('module.kotlin', springBootVersion));
@@ -1,8 +1,21 @@
1
+ /**
2
+ * Pre-built references to Jakarta annotation and Bean Validation (`jakarta.validation`) types.
3
+ *
4
+ * Each `export const` is a factory that creates a `KtReference` with the given name and package, so the
5
+ * generated code imports the type automatically. See `KtReferenceFactory` for the optional `options`.
6
+ */
1
7
  import { type KtReferenceFactory } from '../nodes/reference.ts';
8
+ /** Reference to `Generated` from the `jakarta.annotation` package. */
2
9
  export declare const generated: KtReferenceFactory;
10
+ /** Reference to `Valid` from the `jakarta.validation` package. */
3
11
  export declare const valid: KtReferenceFactory;
12
+ /** Reference to `Pattern` from the `jakarta.validation.constraints` package. */
4
13
  export declare const pattern: KtReferenceFactory;
14
+ /** Reference to `Min` from the `jakarta.validation.constraints` package. */
5
15
  export declare const min: KtReferenceFactory;
16
+ /** Reference to `Max` from the `jakarta.validation.constraints` package. */
6
17
  export declare const max: KtReferenceFactory;
18
+ /** Reference to `NotEmpty` from the `jakarta.validation.constraints` package. */
7
19
  export declare const notEmpty: KtReferenceFactory;
20
+ /** Reference to `Size` from the `jakarta.validation.constraints` package. */
8
21
  export declare const size: KtReferenceFactory;
@@ -1,11 +1,24 @@
1
+ /**
2
+ * Pre-built references to Jakarta annotation and Bean Validation (`jakarta.validation`) types.
3
+ *
4
+ * Each `export const` is a factory that creates a `KtReference` with the given name and package, so the
5
+ * generated code imports the type automatically. See `KtReferenceFactory` for the optional `options`.
6
+ */
1
7
  import { ktReference } from '../nodes/reference.js';
2
8
  // jakarta.annotation
9
+ /** Reference to `Generated` from the `jakarta.annotation` package. */
3
10
  export const generated = ktReference.factory('Generated', 'jakarta.annotation');
4
11
  // jakarta.validation
12
+ /** Reference to `Valid` from the `jakarta.validation` package. */
5
13
  export const valid = ktReference.factory('Valid', 'jakarta.validation');
6
14
  // jakarta.validation.constraints
15
+ /** Reference to `Pattern` from the `jakarta.validation.constraints` package. */
7
16
  export const pattern = ktReference.factory('Pattern', 'jakarta.validation.constraints');
17
+ /** Reference to `Min` from the `jakarta.validation.constraints` package. */
8
18
  export const min = ktReference.factory('Min', 'jakarta.validation.constraints');
19
+ /** Reference to `Max` from the `jakarta.validation.constraints` package. */
9
20
  export const max = ktReference.factory('Max', 'jakarta.validation.constraints');
21
+ /** Reference to `NotEmpty` from the `jakarta.validation.constraints` package. */
10
22
  export const notEmpty = ktReference.factory('NotEmpty', 'jakarta.validation.constraints');
23
+ /** Reference to `Size` from the `jakarta.validation.constraints` package. */
11
24
  export const size = ktReference.factory('Size', 'jakarta.validation.constraints');
@@ -1,14 +1,33 @@
1
+ /**
2
+ * Pre-built references to Java standard library types.
3
+ *
4
+ * The `java.lang` package is in the default `globalImports`, so no `import` is emitted for its references unless
5
+ * `globalImports` is changed. References from the other packages in this file always emit an `import`.
6
+ */
1
7
  import { type KtGenericReferenceFactory, type KtReferenceFactory } from '../nodes/reference.ts';
8
+ /** Reference to `File` from the `java.io` package. */
2
9
  export declare const file: KtReferenceFactory;
10
+ /** Reference to `IOException` from the `java.io` package. */
3
11
  export declare const ioException: KtReferenceFactory;
12
+ /** Reference to `IllegalStateException` from the `java.lang` package. */
4
13
  export declare const illegalStateException: KtReferenceFactory;
14
+ /** Reference to `System` from the `java.lang` package. */
5
15
  export declare const system: KtReferenceFactory;
16
+ /** Reference to `UnsupportedOperationException` from the `java.lang` package. */
6
17
  export declare const unsupportedOperationException: KtReferenceFactory;
18
+ /** Reference to `Void` from the `java.lang` package. Named `void_` because `void` is reserved in TypeScript. */
7
19
  export declare const void_: KtReferenceFactory;
20
+ /** Reference to `URI` from the `java.net` package. */
8
21
  export declare const uri: KtReferenceFactory;
22
+ /** Reference to `OffsetDateTime` from the `java.time` package. */
9
23
  export declare const offsetDateTime: KtReferenceFactory;
24
+ /** Reference to `OffsetTime` from the `java.time` package. */
10
25
  export declare const offsetTime: KtReferenceFactory;
26
+ /** Reference to `LocalDateTime` from the `java.time` package. */
11
27
  export declare const localDateTime: KtReferenceFactory;
28
+ /** Reference to `LocalDate` from the `java.time` package. */
12
29
  export declare const localDate: KtReferenceFactory;
30
+ /** Reference to `LocalTime` from the `java.time` package. */
13
31
  export declare const localTime: KtReferenceFactory;
32
+ /** Reference to `Optional` from the `java.util` package. Takes one type argument. */
14
33
  export declare const optional: KtGenericReferenceFactory<1>;
@@ -1,19 +1,38 @@
1
+ /**
2
+ * Pre-built references to Java standard library types.
3
+ *
4
+ * The `java.lang` package is in the default `globalImports`, so no `import` is emitted for its references unless
5
+ * `globalImports` is changed. References from the other packages in this file always emit an `import`.
6
+ */
1
7
  import { ktReference } from '../nodes/reference.js';
2
8
  // java.io
9
+ /** Reference to `File` from the `java.io` package. */
3
10
  export const file = ktReference.factory('File', 'java.io');
11
+ /** Reference to `IOException` from the `java.io` package. */
4
12
  export const ioException = ktReference.factory('IOException', 'java.io');
5
13
  // java.lang
14
+ /** Reference to `IllegalStateException` from the `java.lang` package. */
6
15
  export const illegalStateException = ktReference.factory('IllegalStateException', 'java.lang');
16
+ /** Reference to `System` from the `java.lang` package. */
7
17
  export const system = ktReference.factory('System', 'java.lang');
18
+ /** Reference to `UnsupportedOperationException` from the `java.lang` package. */
8
19
  export const unsupportedOperationException = ktReference.factory('UnsupportedOperationException', 'java.lang');
20
+ /** Reference to `Void` from the `java.lang` package. Named `void_` because `void` is reserved in TypeScript. */
9
21
  export const void_ = ktReference.factory('Void', 'java.lang');
10
22
  // java.net
23
+ /** Reference to `URI` from the `java.net` package. */
11
24
  export const uri = ktReference.factory('URI', 'java.net');
12
25
  // java.time
26
+ /** Reference to `OffsetDateTime` from the `java.time` package. */
13
27
  export const offsetDateTime = ktReference.factory('OffsetDateTime', 'java.time');
28
+ /** Reference to `OffsetTime` from the `java.time` package. */
14
29
  export const offsetTime = ktReference.factory('OffsetTime', 'java.time');
30
+ /** Reference to `LocalDateTime` from the `java.time` package. */
15
31
  export const localDateTime = ktReference.factory('LocalDateTime', 'java.time');
32
+ /** Reference to `LocalDate` from the `java.time` package. */
16
33
  export const localDate = ktReference.factory('LocalDate', 'java.time');
34
+ /** Reference to `LocalTime` from the `java.time` package. */
17
35
  export const localTime = ktReference.factory('LocalTime', 'java.time');
18
36
  // java.util
37
+ /** Reference to `Optional` from the `java.util` package. Takes one type argument. */
19
38
  export const optional = ktReference.genericFactory('Optional', 'java.util');
@@ -1,23 +1,51 @@
1
+ /**
2
+ * Pre-built references to Kotlin standard library types, functions and annotations.
3
+ *
4
+ * The `kotlin`, `kotlin.collections` and `kotlin.jvm` packages are in the default `globalImports`, so no `import`
5
+ * is emitted for these references unless `globalImports` is changed.
6
+ */
1
7
  import { type KtGenericReferenceFactory, type KtReferenceFactory } from '../nodes/reference.ts';
8
+ /** Reference to `Any` from the `kotlin` package. */
2
9
  export declare const any: KtReferenceFactory;
10
+ /** Reference to `Nothing` from the `kotlin` package. */
3
11
  export declare const nothing: KtReferenceFactory;
12
+ /** Reference to `Unit` from the `kotlin` package. */
4
13
  export declare const unit: KtReferenceFactory;
14
+ /** Reference to `String` from the `kotlin` package. */
5
15
  export declare const string: KtReferenceFactory;
16
+ /** Reference to `Int` from the `kotlin` package. */
6
17
  export declare const int: KtReferenceFactory;
18
+ /** Reference to `Long` from the `kotlin` package. */
7
19
  export declare const long: KtReferenceFactory;
20
+ /** Reference to `Float` from the `kotlin` package. */
8
21
  export declare const float: KtReferenceFactory;
22
+ /** Reference to `Double` from the `kotlin` package. */
9
23
  export declare const double: KtReferenceFactory;
24
+ /** Reference to `Boolean` from the `kotlin` package. */
10
25
  export declare const boolean: KtReferenceFactory;
26
+ /** Reference to the `lazy` function from the `kotlin` package. Takes one type argument. */
11
27
  export declare const lazyFun: KtGenericReferenceFactory<1>;
28
+ /** Reference to the `Throws` annotation from the `kotlin` package. */
12
29
  export declare const throws: KtReferenceFactory;
30
+ /** Reference to the `Deprecated` annotation from the `kotlin` package. */
13
31
  export declare const deprecated: KtReferenceFactory;
32
+ /** Reference to `Throwable` from the `kotlin` package. */
14
33
  export declare const throwable: KtReferenceFactory;
34
+ /** Reference to the `List` type from the `kotlin.collections` package. Takes one type argument. */
15
35
  export declare const list: KtGenericReferenceFactory<1>;
36
+ /** Reference to the `MutableList` type from the `kotlin.collections` package. Takes one type argument. */
16
37
  export declare const mutableList: KtGenericReferenceFactory<1>;
38
+ /** Reference to the `Map` type from the `kotlin.collections` package. Takes two type arguments. */
17
39
  export declare const map: KtGenericReferenceFactory<2>;
40
+ /** Reference to the `MutableMap` type from the `kotlin.collections` package. Takes two type arguments. */
18
41
  export declare const mutableMap: KtGenericReferenceFactory<2>;
42
+ /** Reference to the `listOf` function from the `kotlin.collections` package. Takes one type argument. */
19
43
  export declare const listOf: KtGenericReferenceFactory<1>;
44
+ /** Reference to the `mutableListOf` function from the `kotlin.collections` package. Takes one type argument. */
20
45
  export declare const mutableListOf: KtGenericReferenceFactory<1>;
46
+ /** Reference to the `mapOf` function from the `kotlin.collections` package. Takes two type arguments. */
21
47
  export declare const mapOf: KtGenericReferenceFactory<2>;
48
+ /** Reference to the `mutableMapOf` function from the `kotlin.collections` package. Takes two type arguments. */
22
49
  export declare const mutableMapOf: KtGenericReferenceFactory<2>;
50
+ /** Reference to the `JvmStatic` annotation from the `kotlin.jvm` package. */
23
51
  export declare const jvmStatic: KtReferenceFactory;