@goast/typescript 0.3.7-beta1 → 0.3.7
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/README.md +43 -43
- package/assets/client/angular/angular-service.utils.ts +82 -82
- package/assets/client/angular/request-builder.ts +374 -374
- package/assets/client/fetch/fetch-client.utils.ts +52 -52
- package/assets/client/k6/request-builder.js +411 -411
- package/assets/stubs/easy-network-stub/easy-network-stub.utils.ts +260 -260
- package/cjs/lib/generators/models/model-generator.js +26 -5
- package/cjs/lib/generators/models/models-generator.js +3 -1
- package/cjs/lib/generators/services/angular-services/angular-service-generator.js +9 -9
- package/cjs/lib/generators/services/easy-network-stub/easy-network-stub-generator.js +9 -9
- package/cjs/lib/generators/services/easy-network-stub/easy-network-stubs-generator.js +4 -8
- package/cjs/lib/generators/services/fetch-clients/fetch-client-generator.js +2 -2
- package/cjs/lib/generators/services/k6-clients/k6-client-generator.js +6 -6
- package/esm/lib/generators/models/model-generator.js +26 -5
- package/esm/lib/generators/models/models-generator.js +3 -1
- package/esm/lib/generators/services/angular-services/angular-service-generator.js +9 -9
- package/esm/lib/generators/services/easy-network-stub/easy-network-stub-generator.js +9 -9
- package/esm/lib/generators/services/easy-network-stub/easy-network-stubs-generator.js +4 -8
- package/esm/lib/generators/services/fetch-clients/fetch-client-generator.js +2 -2
- package/esm/lib/generators/services/k6-clients/k6-client-generator.js +6 -6
- package/package.json +3 -2
- package/types/lib/common-results.d.ts +2 -1
- package/types/lib/generators/models/model-generator.d.ts +2 -0
|
@@ -82,15 +82,13 @@ class TypeScriptEasyNetworkStubsGenerator extends core_1.OpenApiServicesGenerati
|
|
|
82
82
|
...Object.entries(ctx.output.typescript.stubs).map(([id, x]) => ast_1.ts.property((0, core_1.toCasing)(serviceNames[id], fieldCasing), {
|
|
83
83
|
accessModifier: 'private',
|
|
84
84
|
optional: true,
|
|
85
|
-
type: ctx.refs.easyNetworkStubGroup([ast_1.ts.reference(x.component, x.filePath), 'this'],
|
|
86
|
-
importType: 'type-import',
|
|
87
|
-
}),
|
|
85
|
+
type: ctx.refs.easyNetworkStubGroup([ast_1.ts.reference(x.component, x.filePath), 'this']),
|
|
88
86
|
})),
|
|
89
87
|
ast_1.ts.constructor({
|
|
90
88
|
parameters: [
|
|
91
89
|
ast_1.ts.constructorParameter('stub', { type: ast_1.ts.refs.easyNetworkStub.easyNetworkStub() }),
|
|
92
90
|
ast_1.ts.constructorParameter('options', {
|
|
93
|
-
type: ast_1.ts.refs.partial([ctx.refs.easyNetworkStubWrapperOptions()]
|
|
91
|
+
type: ast_1.ts.refs.partial([ctx.refs.easyNetworkStubWrapperOptions()]),
|
|
94
92
|
optional: true,
|
|
95
93
|
}),
|
|
96
94
|
],
|
|
@@ -98,16 +96,14 @@ class TypeScriptEasyNetworkStubsGenerator extends core_1.OpenApiServicesGenerati
|
|
|
98
96
|
}),
|
|
99
97
|
ast_1.ts.property('requests', {
|
|
100
98
|
accessModifier: 'public',
|
|
101
|
-
type: ast_1.ts.arrayType(ctx.refs.stubRequestItem(
|
|
99
|
+
type: ast_1.ts.arrayType(ctx.refs.stubRequestItem(), { readonly: true }),
|
|
102
100
|
get: ast_1.ts.property.getter({
|
|
103
101
|
body: (0, core_1.appendValueGroup)(['return this._stubWrapper.requests;'], '\n'),
|
|
104
102
|
}),
|
|
105
103
|
}),
|
|
106
104
|
...Object.entries(ctx.output.typescript.stubs).map(([id, x]) => ast_1.ts.property((0, core_1.toCasing)(serviceNames[id], ctx.config.propertyNameCasing), {
|
|
107
105
|
accessModifier: 'public',
|
|
108
|
-
type: ctx.refs.easyNetworkStubGroup([ast_1.ts.reference(x.component, x.filePath), 'this'],
|
|
109
|
-
importType: 'type-import',
|
|
110
|
-
}),
|
|
106
|
+
type: ctx.refs.easyNetworkStubGroup([ast_1.ts.reference(x.component, x.filePath), 'this']),
|
|
111
107
|
get: ast_1.ts.property.getter({
|
|
112
108
|
body: (0, core_1.appendValueGroup)([
|
|
113
109
|
(0, core_1.builderTemplate) `return this.${(0, core_1.toCasing)(serviceNames[id], fieldCasing)} ??= ${ctx.refs.createEasyNetworkStubGroup.infer()}(this, this._stubWrapper, ${ast_1.ts.reference(x.component, x.filePath)});`,
|
|
@@ -136,7 +136,7 @@ class DefaultTypeScriptFetchClientGenerator extends file_generator_1.TypeScriptF
|
|
|
136
136
|
const method = this.getInterfaceEndpointMethod(ctx, endpoint);
|
|
137
137
|
method.accessModifier = 'public';
|
|
138
138
|
method.body = (0, core_1.appendValueGroup)([
|
|
139
|
-
(0, core_1.builderTemplate) `const url = new ${ctx.refs.urlBuilder()}(this.options.baseUrl)${core_1.builderTemplate.indent `
|
|
139
|
+
(0, core_1.builderTemplate) `const url = new ${ctx.refs.urlBuilder()}(this.options.baseUrl)${core_1.builderTemplate.indent `
|
|
140
140
|
.withPath(${ast_1.ts.string(endpoint.path)})${(b) => b.forEach(endpoint.parameters, (b, p) => {
|
|
141
141
|
switch (p.target) {
|
|
142
142
|
case 'path':
|
|
@@ -146,7 +146,7 @@ class DefaultTypeScriptFetchClientGenerator extends file_generator_1.TypeScriptF
|
|
|
146
146
|
b.append((0, core_1.builderTemplate) `\n.withQueryParam(${ast_1.ts.string(p.name)}, params.${(0, core_1.toCasing)(p.name, ctx.config.paramNameCasing)})`);
|
|
147
147
|
break;
|
|
148
148
|
}
|
|
149
|
-
})}
|
|
149
|
+
})}
|
|
150
150
|
.build();`}`,
|
|
151
151
|
(0, core_1.builderTemplate) `const response = (this.options.fetch ?? fetch)(url, ${ast_1.ts.object({
|
|
152
152
|
members: [
|
|
@@ -189,7 +189,7 @@ class DefaultTypeScriptK6ClientGenerator extends file_generator_1.TypeScriptFile
|
|
|
189
189
|
],
|
|
190
190
|
}),
|
|
191
191
|
parameters: [ast_1.ts.constructorParameter('rootUrl'), ast_1.ts.constructorParameter('defaultK6ParamsFactory')],
|
|
192
|
-
body: (0, core_1.builderTemplate) `this.rootUrl = rootUrl;
|
|
192
|
+
body: (0, core_1.builderTemplate) `this.rootUrl = rootUrl;
|
|
193
193
|
this._defaultK6ParamsFactory = defaultK6ParamsFactory;`,
|
|
194
194
|
}),
|
|
195
195
|
...ctx.service.endpoints.map((e) => this.getEndpointMethod(ctx, e)),
|
|
@@ -248,11 +248,11 @@ class DefaultTypeScriptK6ClientGenerator extends file_generator_1.TypeScriptFile
|
|
|
248
248
|
}
|
|
249
249
|
: null,
|
|
250
250
|
'',
|
|
251
|
-
(0, core_1.builderTemplate) `return /** @type {${returnType}} */ (${core_1.builderTemplate.indent `
|
|
252
|
-
${ctx.config.async ? 'await rb.buildAsync' : 'rb.build'}({${core_1.builderTemplate.indent `
|
|
253
|
-
accept: ${ast_1.ts.string(accept)},
|
|
254
|
-
params: this.getK6Params(k6Params),`}
|
|
255
|
-
})`}
|
|
251
|
+
(0, core_1.builderTemplate) `return /** @type {${returnType}} */ (${core_1.builderTemplate.indent `
|
|
252
|
+
${ctx.config.async ? 'await rb.buildAsync' : 'rb.build'}({${core_1.builderTemplate.indent `
|
|
253
|
+
accept: ${ast_1.ts.string(accept)},
|
|
254
|
+
params: this.getK6Params(k6Params),`}
|
|
255
|
+
})`}
|
|
256
256
|
);`,
|
|
257
257
|
], '\n'),
|
|
258
258
|
});
|
|
@@ -16,15 +16,25 @@ export class DefaultTypeScriptModelGenerator extends TypeScriptFileGenerator {
|
|
|
16
16
|
generator: (b) => b.append(fileContent),
|
|
17
17
|
});
|
|
18
18
|
const exports = fileContent.values.filter((x) => typeof x === 'object' && x !== null && 'export' in x && x.export === true && 'name' in x);
|
|
19
|
-
const
|
|
19
|
+
const node = exports.find((x) => x.name === name);
|
|
20
20
|
return {
|
|
21
21
|
component: name,
|
|
22
22
|
filePath,
|
|
23
|
-
imports: [
|
|
23
|
+
imports: [
|
|
24
|
+
{
|
|
25
|
+
kind: 'file',
|
|
26
|
+
name,
|
|
27
|
+
modulePath: filePath,
|
|
28
|
+
type: node instanceof ts.Interface || node instanceof ts.TypeAlias ? 'type-import' : 'import',
|
|
29
|
+
},
|
|
30
|
+
],
|
|
24
31
|
additionalExports: exports
|
|
25
32
|
.filter((x) => x.name !== name)
|
|
26
|
-
.map((x) => ({
|
|
27
|
-
|
|
33
|
+
.map((x) => ({
|
|
34
|
+
name: x.name,
|
|
35
|
+
type: x instanceof ts.TypeAlias || x instanceof ts.Interface ? 'type-export' : 'export',
|
|
36
|
+
})),
|
|
37
|
+
kind: this.getNodeKind(node),
|
|
28
38
|
};
|
|
29
39
|
}
|
|
30
40
|
else {
|
|
@@ -32,9 +42,20 @@ export class DefaultTypeScriptModelGenerator extends TypeScriptFileGenerator {
|
|
|
32
42
|
builder.append(this.getType(ctx, ctx.schema));
|
|
33
43
|
const imports = builder.imports.imports;
|
|
34
44
|
builder.imports.clear();
|
|
35
|
-
return { component: builder.toString(false), imports
|
|
45
|
+
return { component: builder.toString(false), imports };
|
|
36
46
|
}
|
|
37
47
|
}
|
|
48
|
+
getNodeKind(node) {
|
|
49
|
+
if (node instanceof ts.Interface)
|
|
50
|
+
return 'interface';
|
|
51
|
+
if (node instanceof ts.TypeAlias)
|
|
52
|
+
return 'type';
|
|
53
|
+
if (node instanceof ts.Enum)
|
|
54
|
+
return 'enum';
|
|
55
|
+
if (node instanceof ts.Class)
|
|
56
|
+
return 'class';
|
|
57
|
+
return undefined;
|
|
58
|
+
}
|
|
38
59
|
getFileContent(ctx) {
|
|
39
60
|
var _a;
|
|
40
61
|
const content = appendValueGroup([], '\n');
|
|
@@ -55,7 +55,9 @@ export class TypeScriptModelsGenerator extends OpenApiSchemasGenerationProviderB
|
|
|
55
55
|
if (!filePath)
|
|
56
56
|
return [];
|
|
57
57
|
return [
|
|
58
|
-
ts.export(x.component, filePath, {
|
|
58
|
+
ts.export(x.component, filePath, {
|
|
59
|
+
kind: x.kind === 'type' || x.kind === 'interface' ? 'type-export' : 'export',
|
|
60
|
+
}),
|
|
59
61
|
...((_b = (_a = x.additionalExports) === null || _a === void 0 ? void 0 : _a.map((e) => typeof e === 'string' ? ts.export(e, filePath) : ts.export(e.name, filePath, { kind: e.type }))) !== null && _b !== void 0 ? _b : []),
|
|
60
62
|
];
|
|
61
63
|
}));
|
|
@@ -228,13 +228,13 @@ export class DefaultTypeScriptAngularServiceGenerator extends TypeScriptFileGene
|
|
|
228
228
|
}
|
|
229
229
|
: null,
|
|
230
230
|
'',
|
|
231
|
-
s `return ${ctx.refs.waitForResponse([responseModelType])}(${s.indent `
|
|
232
|
-
this.http.request(rb.build({${s.indent `
|
|
233
|
-
responseType: ${ts.string(responseType)},
|
|
234
|
-
accept: ${ts.string(accept)},
|
|
235
|
-
context,`}
|
|
236
|
-
})),
|
|
237
|
-
{${s.indent `
|
|
231
|
+
s `return ${ctx.refs.waitForResponse([responseModelType])}(${s.indent `
|
|
232
|
+
this.http.request(rb.build({${s.indent `
|
|
233
|
+
responseType: ${ts.string(responseType)},
|
|
234
|
+
accept: ${ts.string(accept)},
|
|
235
|
+
context,`}
|
|
236
|
+
})),
|
|
237
|
+
{${s.indent `
|
|
238
238
|
errorResponseTypes: ${ts.object({
|
|
239
239
|
members: [
|
|
240
240
|
...Object.entries(this.getEndpointStatusCodes(ctx, endpoint))
|
|
@@ -243,8 +243,8 @@ export class DefaultTypeScriptAngularServiceGenerator extends TypeScriptFileGene
|
|
|
243
243
|
return ts.property(key, { value: ts.string(value.parser) });
|
|
244
244
|
}),
|
|
245
245
|
],
|
|
246
|
-
})}`}
|
|
247
|
-
}`}
|
|
246
|
+
})}`}
|
|
247
|
+
}`}
|
|
248
248
|
)`,
|
|
249
249
|
], '\n'),
|
|
250
250
|
});
|
|
@@ -94,15 +94,15 @@ export class DefaultTypeScriptEasyNetworkStubGenerator extends TypeScriptFileGen
|
|
|
94
94
|
],
|
|
95
95
|
returnType: 'this',
|
|
96
96
|
body: appendValueGroup([
|
|
97
|
-
s `this.stubWrapper.stub2<${requestType}>()(${s.indent `
|
|
98
|
-
${ts.string(endpoint.method.toUpperCase())},
|
|
99
|
-
${this.getStubClassName(ctx)}.${this.getEndpointPathPropertyName(ctx, endpoint)},
|
|
100
|
-
async (request) => {${s.indent `
|
|
101
|
-
if (this.stubWrapper.options.rememberRequests) {${s.indent `
|
|
102
|
-
this.${this.getEndpointRequestsFieldName(ctx, endpoint)}.push(request);`}
|
|
103
|
-
}
|
|
104
|
-
throw await response(${this.getResponderVariableName(ctx, endpoint)}, request);`}
|
|
105
|
-
}`}
|
|
97
|
+
s `this.stubWrapper.stub2<${requestType}>()(${s.indent `
|
|
98
|
+
${ts.string(endpoint.method.toUpperCase())},
|
|
99
|
+
${this.getStubClassName(ctx)}.${this.getEndpointPathPropertyName(ctx, endpoint)},
|
|
100
|
+
async (request) => {${s.indent `
|
|
101
|
+
if (this.stubWrapper.options.rememberRequests) {${s.indent `
|
|
102
|
+
this.${this.getEndpointRequestsFieldName(ctx, endpoint)}.push(request);`}
|
|
103
|
+
}
|
|
104
|
+
throw await response(${this.getResponderVariableName(ctx, endpoint)}, request);`}
|
|
105
|
+
}`}
|
|
106
106
|
);`,
|
|
107
107
|
'return this;',
|
|
108
108
|
], '\n'),
|
|
@@ -79,15 +79,13 @@ export class TypeScriptEasyNetworkStubsGenerator extends OpenApiServicesGenerati
|
|
|
79
79
|
...Object.entries(ctx.output.typescript.stubs).map(([id, x]) => ts.property(toCasing(serviceNames[id], fieldCasing), {
|
|
80
80
|
accessModifier: 'private',
|
|
81
81
|
optional: true,
|
|
82
|
-
type: ctx.refs.easyNetworkStubGroup([ts.reference(x.component, x.filePath), 'this'],
|
|
83
|
-
importType: 'type-import',
|
|
84
|
-
}),
|
|
82
|
+
type: ctx.refs.easyNetworkStubGroup([ts.reference(x.component, x.filePath), 'this']),
|
|
85
83
|
})),
|
|
86
84
|
ts.constructor({
|
|
87
85
|
parameters: [
|
|
88
86
|
ts.constructorParameter('stub', { type: ts.refs.easyNetworkStub.easyNetworkStub() }),
|
|
89
87
|
ts.constructorParameter('options', {
|
|
90
|
-
type: ts.refs.partial([ctx.refs.easyNetworkStubWrapperOptions()]
|
|
88
|
+
type: ts.refs.partial([ctx.refs.easyNetworkStubWrapperOptions()]),
|
|
91
89
|
optional: true,
|
|
92
90
|
}),
|
|
93
91
|
],
|
|
@@ -95,16 +93,14 @@ export class TypeScriptEasyNetworkStubsGenerator extends OpenApiServicesGenerati
|
|
|
95
93
|
}),
|
|
96
94
|
ts.property('requests', {
|
|
97
95
|
accessModifier: 'public',
|
|
98
|
-
type: ts.arrayType(ctx.refs.stubRequestItem(
|
|
96
|
+
type: ts.arrayType(ctx.refs.stubRequestItem(), { readonly: true }),
|
|
99
97
|
get: ts.property.getter({
|
|
100
98
|
body: appendValueGroup(['return this._stubWrapper.requests;'], '\n'),
|
|
101
99
|
}),
|
|
102
100
|
}),
|
|
103
101
|
...Object.entries(ctx.output.typescript.stubs).map(([id, x]) => ts.property(toCasing(serviceNames[id], ctx.config.propertyNameCasing), {
|
|
104
102
|
accessModifier: 'public',
|
|
105
|
-
type: ctx.refs.easyNetworkStubGroup([ts.reference(x.component, x.filePath), 'this'],
|
|
106
|
-
importType: 'type-import',
|
|
107
|
-
}),
|
|
103
|
+
type: ctx.refs.easyNetworkStubGroup([ts.reference(x.component, x.filePath), 'this']),
|
|
108
104
|
get: ts.property.getter({
|
|
109
105
|
body: appendValueGroup([
|
|
110
106
|
s `return this.${toCasing(serviceNames[id], fieldCasing)} ??= ${ctx.refs.createEasyNetworkStubGroup.infer()}(this, this._stubWrapper, ${ts.reference(x.component, x.filePath)});`,
|
|
@@ -133,7 +133,7 @@ export class DefaultTypeScriptFetchClientGenerator extends TypeScriptFileGenerat
|
|
|
133
133
|
const method = this.getInterfaceEndpointMethod(ctx, endpoint);
|
|
134
134
|
method.accessModifier = 'public';
|
|
135
135
|
method.body = appendValueGroup([
|
|
136
|
-
s `const url = new ${ctx.refs.urlBuilder()}(this.options.baseUrl)${s.indent `
|
|
136
|
+
s `const url = new ${ctx.refs.urlBuilder()}(this.options.baseUrl)${s.indent `
|
|
137
137
|
.withPath(${ts.string(endpoint.path)})${(b) => b.forEach(endpoint.parameters, (b, p) => {
|
|
138
138
|
switch (p.target) {
|
|
139
139
|
case 'path':
|
|
@@ -143,7 +143,7 @@ export class DefaultTypeScriptFetchClientGenerator extends TypeScriptFileGenerat
|
|
|
143
143
|
b.append(s `\n.withQueryParam(${ts.string(p.name)}, params.${toCasing(p.name, ctx.config.paramNameCasing)})`);
|
|
144
144
|
break;
|
|
145
145
|
}
|
|
146
|
-
})}
|
|
146
|
+
})}
|
|
147
147
|
.build();`}`,
|
|
148
148
|
s `const response = (this.options.fetch ?? fetch)(url, ${ts.object({
|
|
149
149
|
members: [
|
|
@@ -186,7 +186,7 @@ export class DefaultTypeScriptK6ClientGenerator extends TypeScriptFileGenerator
|
|
|
186
186
|
],
|
|
187
187
|
}),
|
|
188
188
|
parameters: [ts.constructorParameter('rootUrl'), ts.constructorParameter('defaultK6ParamsFactory')],
|
|
189
|
-
body: s `this.rootUrl = rootUrl;
|
|
189
|
+
body: s `this.rootUrl = rootUrl;
|
|
190
190
|
this._defaultK6ParamsFactory = defaultK6ParamsFactory;`,
|
|
191
191
|
}),
|
|
192
192
|
...ctx.service.endpoints.map((e) => this.getEndpointMethod(ctx, e)),
|
|
@@ -245,11 +245,11 @@ export class DefaultTypeScriptK6ClientGenerator extends TypeScriptFileGenerator
|
|
|
245
245
|
}
|
|
246
246
|
: null,
|
|
247
247
|
'',
|
|
248
|
-
s `return /** @type {${returnType}} */ (${s.indent `
|
|
249
|
-
${ctx.config.async ? 'await rb.buildAsync' : 'rb.build'}({${s.indent `
|
|
250
|
-
accept: ${ts.string(accept)},
|
|
251
|
-
params: this.getK6Params(k6Params),`}
|
|
252
|
-
})`}
|
|
248
|
+
s `return /** @type {${returnType}} */ (${s.indent `
|
|
249
|
+
${ctx.config.async ? 'await rb.buildAsync' : 'rb.build'}({${s.indent `
|
|
250
|
+
accept: ${ts.string(accept)},
|
|
251
|
+
params: this.getK6Params(k6Params),`}
|
|
252
|
+
})`}
|
|
253
253
|
);`,
|
|
254
254
|
], '\n'),
|
|
255
255
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@goast/typescript",
|
|
3
|
-
"version": "0.3.7
|
|
3
|
+
"version": "0.3.7",
|
|
4
4
|
"repository": "https://github.com/MaSch0212/goast.git",
|
|
5
5
|
"description": "Provides gOAst generators for generating TypeScript code from OpenAPI specifications.",
|
|
6
6
|
"keywords": [
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
"@goast/core": "0.3.5",
|
|
31
31
|
"tslib": "2.6.3"
|
|
32
32
|
},
|
|
33
|
+
"packageManager": "pnpm@9.5.0",
|
|
33
34
|
"module": "./esm/index.js",
|
|
34
35
|
"main": "./cjs/index.js",
|
|
35
36
|
"types": "./types/index.d.ts",
|
|
@@ -41,4 +42,4 @@
|
|
|
41
42
|
},
|
|
42
43
|
"./package.json": "./package.json"
|
|
43
44
|
}
|
|
44
|
-
}
|
|
45
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { TypeScriptExportOptions } from './import-collection';
|
|
2
|
+
export type TypeScriptComponentOutputKind = 'interface' | 'type' | 'enum' | 'class' | 'function' | 'variable';
|
|
2
3
|
export type TypeScriptComponentOutput = {
|
|
3
4
|
component: string;
|
|
4
5
|
filePath?: string;
|
|
@@ -6,7 +7,7 @@ export type TypeScriptComponentOutput = {
|
|
|
6
7
|
additionalExports?: string[] | ({
|
|
7
8
|
name: string;
|
|
8
9
|
} & TypeScriptExportOptions)[];
|
|
9
|
-
kind
|
|
10
|
+
kind?: TypeScriptComponentOutputKind;
|
|
10
11
|
};
|
|
11
12
|
export type TypeScriptExportOutput = {
|
|
12
13
|
component: string;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ApiSchema, AppendValueGroup, ArrayLikeApiSchema, CombinedLikeApiSchema, Nullable, ObjectLikeApiSchema } from '@goast/core';
|
|
2
2
|
import { TypeScriptModelGeneratorContext, TypeScriptModelGeneratorOutput } from './models';
|
|
3
3
|
import { ts } from '../../ast';
|
|
4
|
+
import { TypeScriptComponentOutputKind } from '../../common-results';
|
|
4
5
|
import { TypeScriptFileBuilder } from '../../file-builder';
|
|
5
6
|
import { TypeScriptFileGenerator } from '../file-generator';
|
|
6
7
|
type Context = TypeScriptModelGeneratorContext;
|
|
@@ -11,6 +12,7 @@ export interface TypeScriptModelGenerator<TOutput extends Output = Output> {
|
|
|
11
12
|
}
|
|
12
13
|
export declare class DefaultTypeScriptModelGenerator extends TypeScriptFileGenerator<Context, Output> implements TypeScriptModelGenerator {
|
|
13
14
|
generate(ctx: Context): Output;
|
|
15
|
+
protected getNodeKind(node: unknown): TypeScriptComponentOutputKind | undefined;
|
|
14
16
|
protected getFileContent(ctx: Context): AppendValueGroup<Builder>;
|
|
15
17
|
protected getEnum(ctx: Context): ts.Enum<import("@goast/core").SourceBuilder<never>, never>;
|
|
16
18
|
protected getInterface(ctx: Context, schema: ObjectLikeApiSchema): ts.Interface<Builder, never>;
|