@goast/kotlin 0.4.18-springwebclient1 → 0.4.19
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.
- package/LICENSE +21 -21
- package/README.md +45 -45
- package/assets/client/okhttp3/ApiClient.kt +252 -252
- package/assets/client/spring-reactive-web-clients/ApiRequestFile.kt +33 -33
- package/esm/src/generators/models/model-generator.js +2 -2
- package/esm/src/generators/services/okhttp3-clients/okhttp3-client-generator.js +28 -28
- package/esm/src/generators/services/spring-controllers/spring-controller-generator.js +9 -9
- package/esm/src/generators/services/spring-reactive-web-clients/models.d.ts +1 -1
- package/esm/src/generators/services/spring-reactive-web-clients/models.d.ts.map +1 -1
- package/esm/src/generators/services/spring-reactive-web-clients/spring-reactive-web-client-generator.d.ts.map +1 -1
- package/package.json +2 -2
- package/script/src/generators/models/model-generator.js +2 -2
- package/script/src/generators/services/okhttp3-clients/okhttp3-client-generator.js +28 -28
- package/script/src/generators/services/spring-controllers/spring-controller-generator.js +9 -9
- package/script/src/generators/services/spring-reactive-web-clients/models.d.ts +1 -1
- package/script/src/generators/services/spring-reactive-web-clients/models.d.ts.map +1 -1
- package/script/src/generators/services/spring-reactive-web-clients/spring-reactive-web-client-generator.d.ts.map +1 -1
- package/src/mod.ts +8 -0
- package/src/src/assets.ts +9 -0
- package/src/src/ast/_index.ts +66 -0
- package/src/src/ast/common.ts +1 -0
- package/src/src/ast/index.ts +1 -0
- package/src/src/ast/node.ts +10 -0
- package/src/src/ast/nodes/annotation.ts +79 -0
- package/src/src/ast/nodes/argument.ts +62 -0
- package/src/src/ast/nodes/call.ts +75 -0
- package/src/src/ast/nodes/class.ts +178 -0
- package/src/src/ast/nodes/collection-literal.ts +49 -0
- package/src/src/ast/nodes/constructor.ts +126 -0
- package/src/src/ast/nodes/doc-tag.ts +138 -0
- package/src/src/ast/nodes/doc.ts +111 -0
- package/src/src/ast/nodes/enum-value.ts +100 -0
- package/src/src/ast/nodes/enum.ts +163 -0
- package/src/src/ast/nodes/function.ts +178 -0
- package/src/src/ast/nodes/generic-parameter.ts +54 -0
- package/src/src/ast/nodes/init-block.ts +38 -0
- package/src/src/ast/nodes/interface.ts +133 -0
- package/src/src/ast/nodes/lambda-type.ts +73 -0
- package/src/src/ast/nodes/lambda.ts +74 -0
- package/src/src/ast/nodes/object.ts +102 -0
- package/src/src/ast/nodes/parameter.ts +118 -0
- package/src/src/ast/nodes/property.ts +225 -0
- package/src/src/ast/nodes/reference.ts +178 -0
- package/src/src/ast/nodes/string.ts +114 -0
- package/src/src/ast/nodes/types.ts +23 -0
- package/src/src/ast/references/index.ts +10 -0
- package/src/src/ast/references/jackson.ts +24 -0
- package/src/src/ast/references/jakarta.ts +14 -0
- package/src/src/ast/references/java.ts +20 -0
- package/src/src/ast/references/kotlin.ts +41 -0
- package/src/src/ast/references/kotlinx.ts +14 -0
- package/src/src/ast/references/okhttp3.ts +5 -0
- package/src/src/ast/references/reactor.ts +5 -0
- package/src/src/ast/references/spring-reactive.ts +33 -0
- package/src/src/ast/references/spring.ts +86 -0
- package/src/src/ast/references/swagger.ts +23 -0
- package/src/src/ast/utils/get-kotlin-builder-options.ts +19 -0
- package/src/src/ast/utils/to-kt-node.ts +31 -0
- package/src/src/ast/utils/write-kt-annotations.ts +15 -0
- package/src/src/ast/utils/write-kt-arguments.ts +45 -0
- package/src/src/ast/utils/write-kt-enum-values.ts +27 -0
- package/src/src/ast/utils/write-kt-generic-parameters.ts +12 -0
- package/src/src/ast/utils/write-kt-members.ts +25 -0
- package/src/src/ast/utils/write-kt-node.ts +37 -0
- package/src/src/ast/utils/write-kt-parameters.ts +25 -0
- package/src/src/common-results.ts +4 -0
- package/src/src/config.ts +41 -0
- package/src/src/file-builder.ts +108 -0
- package/src/src/generators/file-generator.ts +29 -0
- package/src/src/generators/index.ts +5 -0
- package/src/src/generators/models/args.ts +132 -0
- package/src/src/generators/models/index.ts +4 -0
- package/src/src/generators/models/model-generator.ts +691 -0
- package/src/src/generators/models/models-generator.ts +65 -0
- package/src/src/generators/models/models.ts +95 -0
- package/src/src/generators/services/okhttp3-clients/args.ts +88 -0
- package/src/src/generators/services/okhttp3-clients/index.ts +4 -0
- package/src/src/generators/services/okhttp3-clients/models.ts +62 -0
- package/src/src/generators/services/okhttp3-clients/okhttp3-client-generator.ts +594 -0
- package/src/src/generators/services/okhttp3-clients/okhttp3-clients-generator.ts +130 -0
- package/src/src/generators/services/okhttp3-clients/refs.ts +55 -0
- package/src/src/generators/services/spring-controllers/args.ts +93 -0
- package/src/src/generators/services/spring-controllers/index.ts +4 -0
- package/src/src/generators/services/spring-controllers/models.ts +71 -0
- package/src/src/generators/services/spring-controllers/refs.ts +17 -0
- package/src/src/generators/services/spring-controllers/spring-controller-generator.ts +814 -0
- package/src/src/generators/services/spring-controllers/spring-controllers-generator.ts +118 -0
- package/src/src/generators/services/spring-reactive-web-clients/args.ts +101 -0
- package/src/src/generators/services/spring-reactive-web-clients/index.ts +4 -0
- package/src/src/generators/services/spring-reactive-web-clients/models.ts +62 -0
- package/src/src/generators/services/spring-reactive-web-clients/refs.ts +11 -0
- package/src/src/generators/services/spring-reactive-web-clients/spring-reactive-web-client-generator.ts +572 -0
- package/src/src/generators/services/spring-reactive-web-clients/spring-reactive-web-clients-generator.ts +128 -0
- package/src/src/import-collection.ts +98 -0
- package/src/src/types.ts +3 -0
- package/src/src/utils.ts +39 -0
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
package @PACKAGE_NAME@
|
|
2
|
-
|
|
3
|
-
import org.springframework.core.io.buffer.DataBuffer
|
|
4
|
-
import org.springframework.http.MediaType
|
|
5
|
-
import org.springframework.http.client.MultipartBodyBuilder
|
|
6
|
-
import org.springframework.http.codec.multipart.FilePart
|
|
7
|
-
import java.io.File
|
|
8
|
-
|
|
9
|
-
interface ApiRequestFile {
|
|
10
|
-
companion object {
|
|
11
|
-
fun from(file: File): ApiRequestFile =
|
|
12
|
-
object : ApiRequestFile {
|
|
13
|
-
override fun addToBuilder(builder: MultipartBodyBuilder) {
|
|
14
|
-
builder
|
|
15
|
-
.part("file", file)
|
|
16
|
-
.filename(file.name)
|
|
17
|
-
.contentType(MediaType.APPLICATION_OCTET_STREAM)
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
fun from(filePart: FilePart): ApiRequestFile =
|
|
22
|
-
object : ApiRequestFile {
|
|
23
|
-
override fun addToBuilder(builder: MultipartBodyBuilder) {
|
|
24
|
-
builder
|
|
25
|
-
.asyncPart("file", filePart.content(), DataBuffer::class.java)
|
|
26
|
-
.filename(filePart.filename())
|
|
27
|
-
.contentType(filePart.headers().contentType ?: MediaType.APPLICATION_OCTET_STREAM)
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
fun addToBuilder(builder: MultipartBodyBuilder)
|
|
33
|
-
}
|
|
1
|
+
package @PACKAGE_NAME@
|
|
2
|
+
|
|
3
|
+
import org.springframework.core.io.buffer.DataBuffer
|
|
4
|
+
import org.springframework.http.MediaType
|
|
5
|
+
import org.springframework.http.client.MultipartBodyBuilder
|
|
6
|
+
import org.springframework.http.codec.multipart.FilePart
|
|
7
|
+
import java.io.File
|
|
8
|
+
|
|
9
|
+
interface ApiRequestFile {
|
|
10
|
+
companion object {
|
|
11
|
+
fun from(file: File): ApiRequestFile =
|
|
12
|
+
object : ApiRequestFile {
|
|
13
|
+
override fun addToBuilder(builder: MultipartBodyBuilder) {
|
|
14
|
+
builder
|
|
15
|
+
.part("file", file)
|
|
16
|
+
.filename(file.name)
|
|
17
|
+
.contentType(MediaType.APPLICATION_OCTET_STREAM)
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
fun from(filePart: FilePart): ApiRequestFile =
|
|
22
|
+
object : ApiRequestFile {
|
|
23
|
+
override fun addToBuilder(builder: MultipartBodyBuilder) {
|
|
24
|
+
builder
|
|
25
|
+
.asyncPart("file", filePart.content(), DataBuffer::class.java)
|
|
26
|
+
.filename(filePart.filename())
|
|
27
|
+
.contentType(filePart.headers().contentType ?: MediaType.APPLICATION_OCTET_STREAM)
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
fun addToBuilder(builder: MultipartBodyBuilder)
|
|
33
|
+
}
|
|
@@ -98,8 +98,8 @@ export class DefaultKotlinModelGenerator extends KotlinFileGenerator {
|
|
|
98
98
|
singleExpression: true,
|
|
99
99
|
body: !((_d = schema.enum) === null || _d === void 0 ? void 0 : _d.length) ? 'null' : s `\nwhen(value) {${s.indent `${appendValueGroup([
|
|
100
100
|
schema.enum.map((x) => s `\n${kt.string(String(x))} -> ${toCasing(String(x), ctx.config.enumValueNameCasing)}`),
|
|
101
|
-
])}
|
|
102
|
-
else -> null`}
|
|
101
|
+
])}
|
|
102
|
+
else -> null`}
|
|
103
103
|
}`,
|
|
104
104
|
}),
|
|
105
105
|
],
|
|
@@ -100,31 +100,31 @@ export class DefaultKotlinOkHttp3Generator extends KotlinFileGenerator {
|
|
|
100
100
|
return appendValueGroup([
|
|
101
101
|
s `val localVarResponse = ${kt.call([toCasing(endpoint.name + '_WithHttpInfo', ctx.config.functionNameCasing)], parameters.map((x) => toCasing(x.name, ctx.config.parameterNameCasing)))}`,
|
|
102
102
|
'',
|
|
103
|
-
s `return when (localVarResponse.responseType) {${s.indent `
|
|
103
|
+
s `return when (localVarResponse.responseType) {${s.indent `
|
|
104
104
|
${ctx.refs.responseType()}.Success -> ${responseSchema === undefined
|
|
105
105
|
? kt.refs.unit()
|
|
106
106
|
: s `(localVarResponse as ${ctx.refs.success(['*'])}).data as ${this.getTypeUsage(ctx, {
|
|
107
107
|
schema: responseSchema,
|
|
108
|
-
})}`}
|
|
109
|
-
${ctx.refs.responseType()}.Informational -> throw ${kt.refs.java.unsupportedOperationException()}("Client does not support Informational responses.")
|
|
110
|
-
${ctx.refs.responseType()}.Redirection -> throw ${kt.refs.java.unsupportedOperationException()}("Client does not support Redirection responses.")
|
|
111
|
-
${ctx.refs.responseType()}.ClientError -> {${s.indent `
|
|
112
|
-
val localVarError = localVarResponse as ${ctx.refs.clientError(['*'])}
|
|
113
|
-
throw ${ctx.refs.clientException()}(${s.indent `
|
|
114
|
-
"Client error : \${localVarError.statusCode} \${localVarError.message.orEmpty()}",
|
|
115
|
-
localVarError.statusCode,
|
|
116
|
-
localVarResponse`}
|
|
117
|
-
)`}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
${ctx.refs.responseType()}.ServerError -> {${s.indent `
|
|
121
|
-
val localVarError = localVarResponse as ${ctx.refs.serverError(['*'])}
|
|
122
|
-
throw ${ctx.refs.serverException()}(${s.indent `
|
|
123
|
-
"Server error : \${localVarError.statusCode} \${localVarError.message.orEmpty()}",
|
|
124
|
-
localVarError.statusCode,
|
|
125
|
-
localVarResponse`}
|
|
126
|
-
)`}
|
|
127
|
-
}`}
|
|
108
|
+
})}`}
|
|
109
|
+
${ctx.refs.responseType()}.Informational -> throw ${kt.refs.java.unsupportedOperationException()}("Client does not support Informational responses.")
|
|
110
|
+
${ctx.refs.responseType()}.Redirection -> throw ${kt.refs.java.unsupportedOperationException()}("Client does not support Redirection responses.")
|
|
111
|
+
${ctx.refs.responseType()}.ClientError -> {${s.indent `
|
|
112
|
+
val localVarError = localVarResponse as ${ctx.refs.clientError(['*'])}
|
|
113
|
+
throw ${ctx.refs.clientException()}(${s.indent `
|
|
114
|
+
"Client error : \${localVarError.statusCode} \${localVarError.message.orEmpty()}",
|
|
115
|
+
localVarError.statusCode,
|
|
116
|
+
localVarResponse`}
|
|
117
|
+
)`}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
${ctx.refs.responseType()}.ServerError -> {${s.indent `
|
|
121
|
+
val localVarError = localVarResponse as ${ctx.refs.serverError(['*'])}
|
|
122
|
+
throw ${ctx.refs.serverException()}(${s.indent `
|
|
123
|
+
"Server error : \${localVarError.statusCode} \${localVarError.message.orEmpty()}",
|
|
124
|
+
localVarError.statusCode,
|
|
125
|
+
localVarResponse`}
|
|
126
|
+
)`}
|
|
127
|
+
}`}
|
|
128
128
|
}`,
|
|
129
129
|
], '\n');
|
|
130
130
|
}
|
|
@@ -203,16 +203,16 @@ export class DefaultKotlinOkHttp3Generator extends KotlinFileGenerator {
|
|
|
203
203
|
result.values.push(`val localVariableBody = ${bodyParamName}`);
|
|
204
204
|
}
|
|
205
205
|
}
|
|
206
|
-
result.values.push(s `val localVariableQuery: ${ctx.refs.multiValueMap()} = ${kt.call([kt.refs.mutableMapOf([kt.refs.string(), kt.refs.list([kt.refs.string()])])], [])}${queryParameters.length === 0 ? '' : s.indent `
|
|
207
|
-
.apply {${s.indent `
|
|
206
|
+
result.values.push(s `val localVariableQuery: ${ctx.refs.multiValueMap()} = ${kt.call([kt.refs.mutableMapOf([kt.refs.string(), kt.refs.list([kt.refs.string()])])], [])}${queryParameters.length === 0 ? '' : s.indent `
|
|
207
|
+
.apply {${s.indent `
|
|
208
208
|
${appendValueGroup(queryParameters.map((param) => {
|
|
209
209
|
const paramName = toCasing(param.name, ctx.config.parameterNameCasing);
|
|
210
210
|
const toString = this.getParameterToString(ctx, { endpoint, parameter: param });
|
|
211
211
|
const put = s `put(${kt.string(paramName)}, listOf(${paramName}${toString}))`;
|
|
212
|
-
return param.required ? put : s `if (${paramName} != null) {${s.indent `
|
|
213
|
-
${put}`}
|
|
212
|
+
return param.required ? put : s `if (${paramName} != null) {${s.indent `
|
|
213
|
+
${put}`}
|
|
214
214
|
}`;
|
|
215
|
-
}), '\n')}`}
|
|
215
|
+
}), '\n')}`}
|
|
216
216
|
}`}`);
|
|
217
217
|
result.values.push('val localVariableHeaders: MutableMap<String, String> = mutableMapOf()');
|
|
218
218
|
if (((_b = endpoint.requestBody) === null || _b === void 0 ? void 0 : _b.content[0]) !== undefined) {
|
|
@@ -221,8 +221,8 @@ export class DefaultKotlinOkHttp3Generator extends KotlinFileGenerator {
|
|
|
221
221
|
for (const header of headerParameters) {
|
|
222
222
|
const paramName = toCasing(header.name, ctx.config.parameterNameCasing);
|
|
223
223
|
const toString = this.getParameterToString(ctx, { endpoint, parameter: header });
|
|
224
|
-
result.values.push(s `if (${paramName} != null) {${s.indent `
|
|
225
|
-
localVariableHeaders["${header.name}"] = ${paramName}${toString}`}
|
|
224
|
+
result.values.push(s `if (${paramName} != null) {${s.indent `
|
|
225
|
+
localVariableHeaders["${header.name}"] = ${paramName}${toString}`}
|
|
226
226
|
}`);
|
|
227
227
|
}
|
|
228
228
|
result.values.push(s `return ${kt.call([ctx.refs.requestConfig.infer()], [
|
|
@@ -216,10 +216,10 @@ export class DefaultKotlinSpringControllerGenerator extends KotlinFileGenerator
|
|
|
216
216
|
}
|
|
217
217
|
}
|
|
218
218
|
});
|
|
219
|
-
body.values.push(s `try {${s.indent `
|
|
220
|
-
return ${kt.call([kt.call(kt.reference('getDelegate'), []), toCasing(endpoint.name, ctx.config.functionNameCasing)], parameters.map((x) => toCasing(x.name, ctx.config.parameterNameCasing)))}`}
|
|
221
|
-
} catch (e: ${kt.refs.throwable()}) {${s.indent `
|
|
222
|
-
return getExceptionHandler()?.handleApiException(e) ?: throw e`}
|
|
219
|
+
body.values.push(s `try {${s.indent `
|
|
220
|
+
return ${kt.call([kt.call(kt.reference('getDelegate'), []), toCasing(endpoint.name, ctx.config.functionNameCasing)], parameters.map((x) => toCasing(x.name, ctx.config.parameterNameCasing)))}`}
|
|
221
|
+
} catch (e: ${kt.refs.throwable()}) {${s.indent `
|
|
222
|
+
return getExceptionHandler()?.handleApiException(e) ?: throw e`}
|
|
223
223
|
}`);
|
|
224
224
|
return body;
|
|
225
225
|
}
|
|
@@ -266,11 +266,11 @@ export class DefaultKotlinSpringControllerGenerator extends KotlinFileGenerator
|
|
|
266
266
|
hasResponseBody ? kt.argument('body') : kt.toNode(null),
|
|
267
267
|
kt.toNode(code),
|
|
268
268
|
contentType
|
|
269
|
-
? s `${kt.refs.spring.linkedMultiValueMap([kt.refs.string(), kt.refs.string()])}().also {
|
|
270
|
-
if (headers != null) {
|
|
271
|
-
it.putAll(headers)
|
|
272
|
-
}
|
|
273
|
-
it.addIfAbsent("Content-Type", ${kt.string(contentType)})
|
|
269
|
+
? s `${kt.refs.spring.linkedMultiValueMap([kt.refs.string(), kt.refs.string()])}().also {
|
|
270
|
+
if (headers != null) {
|
|
271
|
+
it.putAll(headers)
|
|
272
|
+
}
|
|
273
|
+
it.addIfAbsent("Content-Type", ${kt.string(contentType)})
|
|
274
274
|
}`
|
|
275
275
|
: kt.argument('headers'),
|
|
276
276
|
]),
|
|
@@ -2,7 +2,7 @@ import type { ApiEndpoint, ApiService, DefaultGenerationProviderConfig, OpenApiS
|
|
|
2
2
|
import type { KotlinImport } from '../../../common-results.js';
|
|
3
3
|
import { type KotlinGeneratorConfig } from '../../../config.js';
|
|
4
4
|
import type { KotlinModelsGeneratorOutput } from '../../models/index.js';
|
|
5
|
-
import { getReferenceFactories } from './refs.js';
|
|
5
|
+
import type { getReferenceFactories } from './refs.js';
|
|
6
6
|
export type KotlinSpringReactiveWebClientsGeneratorConfig = KotlinGeneratorConfig & {
|
|
7
7
|
packageName: string;
|
|
8
8
|
packageSuffix: string | ((service?: ApiService) => string);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../../../../src/src/generators/services/spring-reactive-web-clients/models.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,UAAU,EACV,+BAA+B,EAC/B,wCAAwC,EACzC,MAAM,aAAa,CAAC;AAErB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAgC,KAAK,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC9F,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../../../../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EAAE,MAAM,GAAG,4CAA4C,CAAC;SACnE,CAAC;KACH,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,4CAA4C,GAAG,YAAY,CAAC;AAExE,MAAM,MAAM,8CAA8C,GACtD,wCAAwC,CACxC,4CAA4C,EAC5C,6CAA6C,EAC7C,6CAA6C,EAC7C,4CAA4C,CAC7C,GACC;IACA,yBAAyB,EAAE,MAAM,CAAC;IAClC,IAAI,EAAE,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAC;CAChD,CAAC;AAEJ,MAAM,MAAM,6CAA6C,GAAG,8CAA8C,GAAG;IAC3G,OAAO,EAAE,UAAU,CAAC;CACrB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spring-reactive-web-client-generator.d.ts","sourceRoot":"","sources":["../../../../../src/src/generators/services/spring-reactive-web-clients/spring-reactive-web-client-generator.ts"],"names":[],"mappings":"AAKA,OAAO,EAEL,KAAK,SAAS,EACd,KAAK,gBAAgB,EAIrB,KAAK,YAAY,EAEjB,aAAa,EAEd,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,EAAE,EAAE,MAAM,uBAAuB,CAAC;AAE3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,mBAAmB,CAAC;AAEvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EAAE,iDAAiD,IAAI,IAAI,EAAE,MAAM,YAAY,CAAC;AAC5F,OAAO,KAAK,EACV,6CAA6C,EAC7C,4CAA4C,EAC7C,MAAM,aAAa,CAAC;AAErB,KAAK,OAAO,GAAG,6CAA6C,CAAC;AAC7D,KAAK,MAAM,GAAG,4CAA4C,CAAC;AAC3D,KAAK,OAAO,GAAG,iBAAiB,CAAC;AAEjC,MAAM,WAAW,sCAAsC,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM;IACrF,QAAQ,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C,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC;IASxF,SAAS,CAAC,cAAc,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,cAAc,GAAG,MAAM;IAOzE,SAAS,CAAC,iBAAiB,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,iBAAiB,GAAG,SAAS,GAAG,SAAS;IAM/F,SAAS,CAAC,aAAa,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,aAAa,GAAG,EAAE,CAAC,SAAS,CAAC,aAAa,CAAC,GAAG,SAAS;IAKxG,SAAS,CAAC,gBAAgB,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,gBAAgB,GAAG,6BAA6B,EAAE;IAmDtG,SAAS,CAAC,uBAAuB,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,uBAAuB,GAAG,MAAM;IAU3F,SAAS,CAAC,WAAW,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,WAAW,GAAG,MAAM;IAQpE,SAAS,CAAC,eAAe,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,eAAe,GAAG,MAAM;IAK3E,SAAS,CAAC,WAAW,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,WAAW,GAAG,MAAM;IAMnE,SAAS,CAAC,qBAAqB,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,qBAAqB;
|
|
1
|
+
{"version":3,"file":"spring-reactive-web-client-generator.d.ts","sourceRoot":"","sources":["../../../../../src/src/generators/services/spring-reactive-web-clients/spring-reactive-web-client-generator.ts"],"names":[],"mappings":"AAKA,OAAO,EAEL,KAAK,SAAS,EACd,KAAK,gBAAgB,EAIrB,KAAK,YAAY,EAEjB,aAAa,EAEd,MAAM,aAAa,CAAC;AAErB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I,CAAC,WAAW,GAAG,MAAM;IAQpE,SAAS,CAAC,eAAe,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,eAAe,GAAG,MAAM;IAK3E,SAAS,CAAC,WAAW,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,WAAW,GAAG,MAAM;IAMnE,SAAS,CAAC,qBAAqB,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,qBAAqB,GAAG,MAAM;IAIvF,OAAO,CAAC,kBAAkB;CAgB3B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@goast/kotlin",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.19",
|
|
4
4
|
"description": "Provides gOAst generators for generating Kotlin code from OpenAPI specifications.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Marc Schmidt (MaSch0212)",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"tslib": "^2.6.2",
|
|
27
27
|
"fs-extra": "^11.2.0",
|
|
28
28
|
"http-status-codes": "^2.3.0",
|
|
29
|
-
"@goast/core": "0.4.
|
|
29
|
+
"@goast/core": "0.4.2"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@types/node": "^20.9.0",
|
|
@@ -102,8 +102,8 @@ class DefaultKotlinModelGenerator extends file_generator_js_1.KotlinFileGenerato
|
|
|
102
102
|
singleExpression: true,
|
|
103
103
|
body: !((_d = schema.enum) === null || _d === void 0 ? void 0 : _d.length) ? 'null' : (0, core_1.builderTemplate) `\nwhen(value) {${core_1.builderTemplate.indent `${(0, core_1.appendValueGroup)([
|
|
104
104
|
schema.enum.map((x) => (0, core_1.builderTemplate) `\n${index_js_1.kt.string(String(x))} -> ${(0, core_1.toCasing)(String(x), ctx.config.enumValueNameCasing)}`),
|
|
105
|
-
])}
|
|
106
|
-
else -> null`}
|
|
105
|
+
])}
|
|
106
|
+
else -> null`}
|
|
107
107
|
}`,
|
|
108
108
|
}),
|
|
109
109
|
],
|
|
@@ -104,31 +104,31 @@ class DefaultKotlinOkHttp3Generator extends file_generator_js_1.KotlinFileGenera
|
|
|
104
104
|
return (0, core_1.appendValueGroup)([
|
|
105
105
|
(0, core_1.builderTemplate) `val localVarResponse = ${index_js_1.kt.call([(0, core_1.toCasing)(endpoint.name + '_WithHttpInfo', ctx.config.functionNameCasing)], parameters.map((x) => (0, core_1.toCasing)(x.name, ctx.config.parameterNameCasing)))}`,
|
|
106
106
|
'',
|
|
107
|
-
(0, core_1.builderTemplate) `return when (localVarResponse.responseType) {${core_1.builderTemplate.indent `
|
|
107
|
+
(0, core_1.builderTemplate) `return when (localVarResponse.responseType) {${core_1.builderTemplate.indent `
|
|
108
108
|
${ctx.refs.responseType()}.Success -> ${responseSchema === undefined
|
|
109
109
|
? index_js_1.kt.refs.unit()
|
|
110
110
|
: (0, core_1.builderTemplate) `(localVarResponse as ${ctx.refs.success(['*'])}).data as ${this.getTypeUsage(ctx, {
|
|
111
111
|
schema: responseSchema,
|
|
112
|
-
})}`}
|
|
113
|
-
${ctx.refs.responseType()}.Informational -> throw ${index_js_1.kt.refs.java.unsupportedOperationException()}("Client does not support Informational responses.")
|
|
114
|
-
${ctx.refs.responseType()}.Redirection -> throw ${index_js_1.kt.refs.java.unsupportedOperationException()}("Client does not support Redirection responses.")
|
|
115
|
-
${ctx.refs.responseType()}.ClientError -> {${core_1.builderTemplate.indent `
|
|
116
|
-
val localVarError = localVarResponse as ${ctx.refs.clientError(['*'])}
|
|
117
|
-
throw ${ctx.refs.clientException()}(${core_1.builderTemplate.indent `
|
|
118
|
-
"Client error : \${localVarError.statusCode} \${localVarError.message.orEmpty()}",
|
|
119
|
-
localVarError.statusCode,
|
|
120
|
-
localVarResponse`}
|
|
121
|
-
)`}
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
${ctx.refs.responseType()}.ServerError -> {${core_1.builderTemplate.indent `
|
|
125
|
-
val localVarError = localVarResponse as ${ctx.refs.serverError(['*'])}
|
|
126
|
-
throw ${ctx.refs.serverException()}(${core_1.builderTemplate.indent `
|
|
127
|
-
"Server error : \${localVarError.statusCode} \${localVarError.message.orEmpty()}",
|
|
128
|
-
localVarError.statusCode,
|
|
129
|
-
localVarResponse`}
|
|
130
|
-
)`}
|
|
131
|
-
}`}
|
|
112
|
+
})}`}
|
|
113
|
+
${ctx.refs.responseType()}.Informational -> throw ${index_js_1.kt.refs.java.unsupportedOperationException()}("Client does not support Informational responses.")
|
|
114
|
+
${ctx.refs.responseType()}.Redirection -> throw ${index_js_1.kt.refs.java.unsupportedOperationException()}("Client does not support Redirection responses.")
|
|
115
|
+
${ctx.refs.responseType()}.ClientError -> {${core_1.builderTemplate.indent `
|
|
116
|
+
val localVarError = localVarResponse as ${ctx.refs.clientError(['*'])}
|
|
117
|
+
throw ${ctx.refs.clientException()}(${core_1.builderTemplate.indent `
|
|
118
|
+
"Client error : \${localVarError.statusCode} \${localVarError.message.orEmpty()}",
|
|
119
|
+
localVarError.statusCode,
|
|
120
|
+
localVarResponse`}
|
|
121
|
+
)`}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
${ctx.refs.responseType()}.ServerError -> {${core_1.builderTemplate.indent `
|
|
125
|
+
val localVarError = localVarResponse as ${ctx.refs.serverError(['*'])}
|
|
126
|
+
throw ${ctx.refs.serverException()}(${core_1.builderTemplate.indent `
|
|
127
|
+
"Server error : \${localVarError.statusCode} \${localVarError.message.orEmpty()}",
|
|
128
|
+
localVarError.statusCode,
|
|
129
|
+
localVarResponse`}
|
|
130
|
+
)`}
|
|
131
|
+
}`}
|
|
132
132
|
}`,
|
|
133
133
|
], '\n');
|
|
134
134
|
}
|
|
@@ -207,16 +207,16 @@ class DefaultKotlinOkHttp3Generator extends file_generator_js_1.KotlinFileGenera
|
|
|
207
207
|
result.values.push(`val localVariableBody = ${bodyParamName}`);
|
|
208
208
|
}
|
|
209
209
|
}
|
|
210
|
-
result.values.push((0, core_1.builderTemplate) `val localVariableQuery: ${ctx.refs.multiValueMap()} = ${index_js_1.kt.call([index_js_1.kt.refs.mutableMapOf([index_js_1.kt.refs.string(), index_js_1.kt.refs.list([index_js_1.kt.refs.string()])])], [])}${queryParameters.length === 0 ? '' : core_1.builderTemplate.indent `
|
|
211
|
-
.apply {${core_1.builderTemplate.indent `
|
|
210
|
+
result.values.push((0, core_1.builderTemplate) `val localVariableQuery: ${ctx.refs.multiValueMap()} = ${index_js_1.kt.call([index_js_1.kt.refs.mutableMapOf([index_js_1.kt.refs.string(), index_js_1.kt.refs.list([index_js_1.kt.refs.string()])])], [])}${queryParameters.length === 0 ? '' : core_1.builderTemplate.indent `
|
|
211
|
+
.apply {${core_1.builderTemplate.indent `
|
|
212
212
|
${(0, core_1.appendValueGroup)(queryParameters.map((param) => {
|
|
213
213
|
const paramName = (0, core_1.toCasing)(param.name, ctx.config.parameterNameCasing);
|
|
214
214
|
const toString = this.getParameterToString(ctx, { endpoint, parameter: param });
|
|
215
215
|
const put = (0, core_1.builderTemplate) `put(${index_js_1.kt.string(paramName)}, listOf(${paramName}${toString}))`;
|
|
216
|
-
return param.required ? put : (0, core_1.builderTemplate) `if (${paramName} != null) {${core_1.builderTemplate.indent `
|
|
217
|
-
${put}`}
|
|
216
|
+
return param.required ? put : (0, core_1.builderTemplate) `if (${paramName} != null) {${core_1.builderTemplate.indent `
|
|
217
|
+
${put}`}
|
|
218
218
|
}`;
|
|
219
|
-
}), '\n')}`}
|
|
219
|
+
}), '\n')}`}
|
|
220
220
|
}`}`);
|
|
221
221
|
result.values.push('val localVariableHeaders: MutableMap<String, String> = mutableMapOf()');
|
|
222
222
|
if (((_b = endpoint.requestBody) === null || _b === void 0 ? void 0 : _b.content[0]) !== undefined) {
|
|
@@ -225,8 +225,8 @@ class DefaultKotlinOkHttp3Generator extends file_generator_js_1.KotlinFileGenera
|
|
|
225
225
|
for (const header of headerParameters) {
|
|
226
226
|
const paramName = (0, core_1.toCasing)(header.name, ctx.config.parameterNameCasing);
|
|
227
227
|
const toString = this.getParameterToString(ctx, { endpoint, parameter: header });
|
|
228
|
-
result.values.push((0, core_1.builderTemplate) `if (${paramName} != null) {${core_1.builderTemplate.indent `
|
|
229
|
-
localVariableHeaders["${header.name}"] = ${paramName}${toString}`}
|
|
228
|
+
result.values.push((0, core_1.builderTemplate) `if (${paramName} != null) {${core_1.builderTemplate.indent `
|
|
229
|
+
localVariableHeaders["${header.name}"] = ${paramName}${toString}`}
|
|
230
230
|
}`);
|
|
231
231
|
}
|
|
232
232
|
result.values.push((0, core_1.builderTemplate) `return ${index_js_1.kt.call([ctx.refs.requestConfig.infer()], [
|
|
@@ -221,10 +221,10 @@ class DefaultKotlinSpringControllerGenerator extends file_generator_js_1.KotlinF
|
|
|
221
221
|
}
|
|
222
222
|
}
|
|
223
223
|
});
|
|
224
|
-
body.values.push((0, core_1.builderTemplate) `try {${core_1.builderTemplate.indent `
|
|
225
|
-
return ${index_js_1.kt.call([index_js_1.kt.call(index_js_1.kt.reference('getDelegate'), []), (0, core_1.toCasing)(endpoint.name, ctx.config.functionNameCasing)], parameters.map((x) => (0, core_1.toCasing)(x.name, ctx.config.parameterNameCasing)))}`}
|
|
226
|
-
} catch (e: ${index_js_1.kt.refs.throwable()}) {${core_1.builderTemplate.indent `
|
|
227
|
-
return getExceptionHandler()?.handleApiException(e) ?: throw e`}
|
|
224
|
+
body.values.push((0, core_1.builderTemplate) `try {${core_1.builderTemplate.indent `
|
|
225
|
+
return ${index_js_1.kt.call([index_js_1.kt.call(index_js_1.kt.reference('getDelegate'), []), (0, core_1.toCasing)(endpoint.name, ctx.config.functionNameCasing)], parameters.map((x) => (0, core_1.toCasing)(x.name, ctx.config.parameterNameCasing)))}`}
|
|
226
|
+
} catch (e: ${index_js_1.kt.refs.throwable()}) {${core_1.builderTemplate.indent `
|
|
227
|
+
return getExceptionHandler()?.handleApiException(e) ?: throw e`}
|
|
228
228
|
}`);
|
|
229
229
|
return body;
|
|
230
230
|
}
|
|
@@ -271,11 +271,11 @@ class DefaultKotlinSpringControllerGenerator extends file_generator_js_1.KotlinF
|
|
|
271
271
|
hasResponseBody ? index_js_1.kt.argument('body') : index_js_1.kt.toNode(null),
|
|
272
272
|
index_js_1.kt.toNode(code),
|
|
273
273
|
contentType
|
|
274
|
-
? (0, core_1.builderTemplate) `${index_js_1.kt.refs.spring.linkedMultiValueMap([index_js_1.kt.refs.string(), index_js_1.kt.refs.string()])}().also {
|
|
275
|
-
if (headers != null) {
|
|
276
|
-
it.putAll(headers)
|
|
277
|
-
}
|
|
278
|
-
it.addIfAbsent("Content-Type", ${index_js_1.kt.string(contentType)})
|
|
274
|
+
? (0, core_1.builderTemplate) `${index_js_1.kt.refs.spring.linkedMultiValueMap([index_js_1.kt.refs.string(), index_js_1.kt.refs.string()])}().also {
|
|
275
|
+
if (headers != null) {
|
|
276
|
+
it.putAll(headers)
|
|
277
|
+
}
|
|
278
|
+
it.addIfAbsent("Content-Type", ${index_js_1.kt.string(contentType)})
|
|
279
279
|
}`
|
|
280
280
|
: index_js_1.kt.argument('headers'),
|
|
281
281
|
]),
|
|
@@ -2,7 +2,7 @@ import type { ApiEndpoint, ApiService, DefaultGenerationProviderConfig, OpenApiS
|
|
|
2
2
|
import type { KotlinImport } from '../../../common-results.js';
|
|
3
3
|
import { type KotlinGeneratorConfig } from '../../../config.js';
|
|
4
4
|
import type { KotlinModelsGeneratorOutput } from '../../models/index.js';
|
|
5
|
-
import { getReferenceFactories } from './refs.js';
|
|
5
|
+
import type { getReferenceFactories } from './refs.js';
|
|
6
6
|
export type KotlinSpringReactiveWebClientsGeneratorConfig = KotlinGeneratorConfig & {
|
|
7
7
|
packageName: string;
|
|
8
8
|
packageSuffix: string | ((service?: ApiService) => string);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../../../../src/src/generators/services/spring-reactive-web-clients/models.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,UAAU,EACV,+BAA+B,EAC/B,wCAAwC,EACzC,MAAM,aAAa,CAAC;AAErB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAgC,KAAK,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC9F,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../../../../src/src/generators/services/spring-reactive-web-clients/models.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,UAAU,EACV,+BAA+B,EAC/B,wCAAwC,EACzC,MAAM,aAAa,CAAC;AAErB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAgC,KAAK,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC9F,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAEvD,MAAM,MAAM,6CAA6C,GAAG,qBAAqB,GAAG;IAClF,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,GAAG,CAAC,CAAC,OAAO,CAAC,EAAE,UAAU,KAAK,MAAM,CAAC,CAAC;IAC3D,yBAAyB,EACrB,MAAM,GACN;QAAE,IAAI,EAAE,qBAAqB,GAAG,0BAA0B,GAAG,SAAS,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAE5F,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,CAAC,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,KAAK,MAAM,CAAC,CAAC;IACjF,YAAY,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,KAAK,MAAM,CAAC,CAAC;IAC1E,qBAAqB,EAAE,QAAQ,GAAG,UAAU,GAAG,YAAY,GAAG,aAAa,GAAG,WAAW,GAAG,cAAc,CAAC;CAC5G,CAAC;AAEF,eAAO,MAAM,oDAAoD,EAAE,+BAA+B,CAChG,6CAA6C,CAQ9C,CAAC;AAEF,MAAM,MAAM,4CAA4C,GAAG,2BAA2B,CAAC;AAEvF,MAAM,MAAM,6CAA6C,GAAG;IAC1D,MAAM,EAAE;QACN,OAAO,EAAE;YACP,CAAC,SAAS,EAAE,MAAM,GAAG,4CAA4C,CAAC;SACnE,CAAC;KACH,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,4CAA4C,GAAG,YAAY,CAAC;AAExE,MAAM,MAAM,8CAA8C,GACtD,wCAAwC,CACxC,4CAA4C,EAC5C,6CAA6C,EAC7C,6CAA6C,EAC7C,4CAA4C,CAC7C,GACC;IACA,yBAAyB,EAAE,MAAM,CAAC;IAClC,IAAI,EAAE,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAC;CAChD,CAAC;AAEJ,MAAM,MAAM,6CAA6C,GAAG,8CAA8C,GAAG;IAC3G,OAAO,EAAE,UAAU,CAAC;CACrB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spring-reactive-web-client-generator.d.ts","sourceRoot":"","sources":["../../../../../src/src/generators/services/spring-reactive-web-clients/spring-reactive-web-client-generator.ts"],"names":[],"mappings":"AAKA,OAAO,EAEL,KAAK,SAAS,EACd,KAAK,gBAAgB,EAIrB,KAAK,YAAY,EAEjB,aAAa,EAEd,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,EAAE,EAAE,MAAM,uBAAuB,CAAC;AAE3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,mBAAmB,CAAC;AAEvE,OAAO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,EAAE,IAAI,EAAE,IAAI,CAAC,WAAW,GAAG,MAAM;IAMnE,SAAS,CAAC,qBAAqB,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,qBAAqB;
|
|
1
|
+
{"version":3,"file":"spring-reactive-web-client-generator.d.ts","sourceRoot":"","sources":["../../../../../src/src/generators/services/spring-reactive-web-clients/spring-reactive-web-client-generator.ts"],"names":[],"mappings":"AAKA,OAAO,EAEL,KAAK,SAAS,EACd,KAAK,gBAAgB,EAIrB,KAAK,YAAY,EAEjB,aAAa,EAEd,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,EAAE,EAAE,MAAM,uBAAuB,CAAC;AAE3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,mBAAmB,CAAC;AAEvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EAAE,iDAAiD,IAAI,IAAI,EAAE,MAAM,YAAY,CAAC;AAC5F,OAAO,KAAK,EACV,6CAA6C,EAC7C,4CAA4C,EAC7C,MAAM,aAAa,CAAC;AAErB,KAAK,OAAO,GAAG,6CAA6C,CAAC;AAC7D,KAAK,MAAM,GAAG,4CAA4C,CAAC;AAC3D,KAAK,OAAO,GAAG,iBAAiB,CAAC;AAEjC,MAAM,WAAW,sCAAsC,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM;IACrF,QAAQ,CAAC,GAAG,EAAE,OAAO,GAAG,YAAY,CAAC,OAAO,CAAC,CAAC;CAC/C;AAED,qBAAa,6CAA8C,SAAQ,mBAAmB,CAAC,OAAO,EAAE,MAAM,CACpG,YAAW,sCAAsC;IAC1C,QAAQ,CAAC,GAAG,EAAE,OAAO,GAAG,YAAY,CAAC,MAAM,CAAC;IAiBnD,SAAS,CAAC,oBAAoB,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,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AAO,EAAE,IAAI,EAAE,IAAI,CAAC,aAAa,GAAG,EAAE,CAAC,SAAS,CAAC,aAAa,CAAC,GAAG,SAAS;IAKxG,SAAS,CAAC,gBAAgB,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,gBAAgB,GAAG,6BAA6B,EAAE;IAmDtG,SAAS,CAAC,uBAAuB,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,uBAAuB,GAAG,MAAM;IAU3F,SAAS,CAAC,WAAW,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,WAAW,GAAG,MAAM;IAQpE,SAAS,CAAC,eAAe,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,eAAe,GAAG,MAAM;IAK3E,SAAS,CAAC,WAAW,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,WAAW,GAAG,MAAM;IAMnE,SAAS,CAAC,qBAAqB,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,qBAAqB,GAAG,MAAM;IAIvF,OAAO,CAAC,kBAAkB;CAgB3B"}
|
package/src/mod.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './src/ast/index.js';
|
|
2
|
+
export * from './src/common-results.js';
|
|
3
|
+
export * from './src/config.js';
|
|
4
|
+
export * from './src/file-builder.js';
|
|
5
|
+
export * from './src/generators/index.js';
|
|
6
|
+
export * from './src/import-collection.js';
|
|
7
|
+
export * from './src/types.js';
|
|
8
|
+
export * from './src/utils.js';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AssetManager } from '@goast/core';
|
|
2
|
+
import { pathToFileURL, URL } from 'node:url';
|
|
3
|
+
|
|
4
|
+
declare const __filename: string | undefined;
|
|
5
|
+
const scriptUrl = typeof __filename === 'undefined' ? import.meta.url : pathToFileURL(__filename);
|
|
6
|
+
|
|
7
|
+
const manager = new AssetManager(new URL('../assets/', scriptUrl));
|
|
8
|
+
export const getAssetFileContent = manager.getAssetFileContent.bind(manager);
|
|
9
|
+
export const copyAssetFile = manager.copyAssetFile.bind(manager);
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
export { type KtAccessModifier as AccessModifier } from './common.js';
|
|
2
|
+
export { KtNode as Node } from './node.js';
|
|
3
|
+
export {
|
|
4
|
+
KtAnnotation as Annotation,
|
|
5
|
+
ktAnnotation as annotation,
|
|
6
|
+
type KtAnnotationTarget as AnnotationTarget,
|
|
7
|
+
} from './nodes/annotation.js';
|
|
8
|
+
export { KtArgument as Argument, ktArgument as argument } from './nodes/argument.js';
|
|
9
|
+
export { KtCall as Call, ktCall as call } from './nodes/call.js';
|
|
10
|
+
export {
|
|
11
|
+
KtClass as Class,
|
|
12
|
+
ktClass as class,
|
|
13
|
+
type KtClassKind as ClassKind,
|
|
14
|
+
type KtClassMember as ClassMember,
|
|
15
|
+
} from './nodes/class.js';
|
|
16
|
+
export {
|
|
17
|
+
KtCollectionLiteral as CollectionLiteral,
|
|
18
|
+
ktCollectionLiteral as collectionLiteral,
|
|
19
|
+
} from './nodes/collection-literal.js';
|
|
20
|
+
export {
|
|
21
|
+
KtConstructor as Constructor,
|
|
22
|
+
ktConstructor as constructor,
|
|
23
|
+
type KtDelegateTarget as DelegateTarget,
|
|
24
|
+
} from './nodes/constructor.js';
|
|
25
|
+
export { KtDocTag as DocTag, ktDocTag as docTag } from './nodes/doc-tag.js';
|
|
26
|
+
export { KtDoc as Doc, ktDoc as doc } from './nodes/doc.js';
|
|
27
|
+
export {
|
|
28
|
+
KtEnumValue as EnumValue,
|
|
29
|
+
ktEnumValue as enumValue,
|
|
30
|
+
type KtEnumValueMember as EnumValueMember,
|
|
31
|
+
} from './nodes/enum-value.js';
|
|
32
|
+
export { KtEnum as Enum, ktEnum as enum, type KtEnumMember as EnumMember } from './nodes/enum.js';
|
|
33
|
+
export { KtFunction as Function, ktFunction as function } from './nodes/function.js';
|
|
34
|
+
export {
|
|
35
|
+
KtGenericParameter as GenericParameter,
|
|
36
|
+
ktGenericParameter as genericParameter,
|
|
37
|
+
} from './nodes/generic-parameter.js';
|
|
38
|
+
export { KtInitBlock as InitBlock, ktInitBlock as initBlock } from './nodes/init-block.js';
|
|
39
|
+
export {
|
|
40
|
+
KtInterface as Interface,
|
|
41
|
+
ktInterface as interface,
|
|
42
|
+
type KtInterfaceMember as InterfaceMember,
|
|
43
|
+
} from './nodes/interface.js';
|
|
44
|
+
export { KtLambdaType as LambdaType, ktLambdaType as lambdaType } from './nodes/lambda-type.js';
|
|
45
|
+
export { KtLambda as Lambda, ktLambda as lambda } from './nodes/lambda.js';
|
|
46
|
+
export { KtObject as Object, ktObject as object, type KtObjectMember as ObjectMember } from './nodes/object.js';
|
|
47
|
+
export { KtParameter as Parameter, ktParameter as parameter } from './nodes/parameter.js';
|
|
48
|
+
export {
|
|
49
|
+
KtProperty as Property,
|
|
50
|
+
ktProperty as property,
|
|
51
|
+
KtPropertyAccessor as PropertyAccessor,
|
|
52
|
+
KtPropertyGetter as PropertyGetter,
|
|
53
|
+
KtPropertySetter as PropertySetter,
|
|
54
|
+
} from './nodes/property.js';
|
|
55
|
+
export {
|
|
56
|
+
type KtGenericReferenceFactory as GenericReferenceFactory,
|
|
57
|
+
KtReference as Reference,
|
|
58
|
+
ktReference as reference,
|
|
59
|
+
type KtReferenceFactory as ReferenceFactory,
|
|
60
|
+
} from './nodes/reference.js';
|
|
61
|
+
export { KtString as String, ktString as string } from './nodes/string.js';
|
|
62
|
+
export { type KtType as Type, type KtValue as Value } from './nodes/types.js';
|
|
63
|
+
export * as refs from './references/index.js';
|
|
64
|
+
export { getKotlinBuilderOptions as getBuilderOptions } from './utils/get-kotlin-builder-options.js';
|
|
65
|
+
export { toKtNode as toNode } from './utils/to-kt-node.js';
|
|
66
|
+
export { writeKtNode as writeNode, writeKtNodes as writeNodes } from './utils/write-kt-node.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type KtAccessModifier = 'public' | 'protected' | 'internal' | 'private';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * as kt from './_index.js';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { AstNode, type AstNodeOptions, type SourceBuilder } from '@goast/core';
|
|
2
|
+
|
|
3
|
+
export abstract class KtNode<TBuilder extends SourceBuilder, TInjects extends string = never> extends AstNode<
|
|
4
|
+
TBuilder,
|
|
5
|
+
TInjects
|
|
6
|
+
> {
|
|
7
|
+
constructor(options: AstNodeOptions<typeof AstNode<TBuilder, TInjects>>) {
|
|
8
|
+
super(options);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { type AstNodeOptions, notNullish, type Nullable, type Prettify, type SourceBuilder } from '@goast/core';
|
|
2
|
+
|
|
3
|
+
import { KtNode } from '../node.js';
|
|
4
|
+
import { writeKtAnnotations } from '../utils/write-kt-annotations.js';
|
|
5
|
+
import { writeKtNode } from '../utils/write-kt-node.js';
|
|
6
|
+
import { type KtArgument, ktArgument } from './argument.js';
|
|
7
|
+
import type { KtType, KtValue } from './types.js';
|
|
8
|
+
|
|
9
|
+
type Injects = 'class' | 'target' | 'arguments';
|
|
10
|
+
|
|
11
|
+
type Options<TBuilder extends SourceBuilder, TInjects extends string = never> = AstNodeOptions<
|
|
12
|
+
typeof KtNode<TBuilder, TInjects | Injects>,
|
|
13
|
+
{
|
|
14
|
+
class: KtType<TBuilder>;
|
|
15
|
+
arguments?: Nullable<Nullable<KtArgument<TBuilder> | KtValue<TBuilder>>[]>;
|
|
16
|
+
target?: Nullable<KtAnnotationTarget>;
|
|
17
|
+
}
|
|
18
|
+
>;
|
|
19
|
+
|
|
20
|
+
export type KtAnnotationTarget =
|
|
21
|
+
| 'file'
|
|
22
|
+
| 'property'
|
|
23
|
+
| 'field'
|
|
24
|
+
| 'get'
|
|
25
|
+
| 'set'
|
|
26
|
+
| 'receiver'
|
|
27
|
+
| 'param'
|
|
28
|
+
| 'setparam'
|
|
29
|
+
| 'delegate';
|
|
30
|
+
|
|
31
|
+
export class KtAnnotation<TBuilder extends SourceBuilder, TInjects extends string = never> extends KtNode<
|
|
32
|
+
TBuilder,
|
|
33
|
+
TInjects | Injects
|
|
34
|
+
> {
|
|
35
|
+
public class: KtType<TBuilder>;
|
|
36
|
+
public arguments: (KtArgument<TBuilder> | KtValue<TBuilder>)[];
|
|
37
|
+
public target: KtAnnotationTarget | null;
|
|
38
|
+
|
|
39
|
+
constructor(options: Options<TBuilder, TInjects>) {
|
|
40
|
+
super(options);
|
|
41
|
+
this.class = options.class;
|
|
42
|
+
this.arguments = options.arguments?.filter(notNullish) ?? [];
|
|
43
|
+
this.target = options.target ?? null;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
protected override onWrite(builder: TBuilder): void {
|
|
47
|
+
builder.append('@');
|
|
48
|
+
|
|
49
|
+
if (this.target) {
|
|
50
|
+
builder.append(this.inject.beforeTarget);
|
|
51
|
+
builder.append(this.target);
|
|
52
|
+
builder.append(this.inject.afterTarget);
|
|
53
|
+
builder.append(':');
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
builder.append(this.inject.beforeClass);
|
|
57
|
+
writeKtNode(builder, this.class);
|
|
58
|
+
builder.append(this.inject.afterClass);
|
|
59
|
+
|
|
60
|
+
if (this.arguments.length > 0) {
|
|
61
|
+
builder.append(this.inject.beforeArguments);
|
|
62
|
+
ktArgument.write(builder, this.arguments);
|
|
63
|
+
builder.append(this.inject.afterArguments);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const createAnnotation = <TBuilder extends SourceBuilder>(
|
|
69
|
+
$class: Options<TBuilder>['class'],
|
|
70
|
+
$arguments?: Options<TBuilder>['arguments'],
|
|
71
|
+
options?: Prettify<Omit<Options<TBuilder>, 'class' | 'arguments'>>,
|
|
72
|
+
): KtAnnotation<TBuilder> => new KtAnnotation<TBuilder>({ ...options, class: $class, arguments: $arguments });
|
|
73
|
+
|
|
74
|
+
export const ktAnnotation: typeof createAnnotation & { write: typeof writeKtAnnotations } = Object.assign(
|
|
75
|
+
createAnnotation,
|
|
76
|
+
{
|
|
77
|
+
write: writeKtAnnotations,
|
|
78
|
+
},
|
|
79
|
+
);
|