@opra/cli 1.0.0-alpha.13 → 1.0.0-alpha.14
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.
|
@@ -176,7 +176,7 @@ async function generateHttpController(controller) {
|
|
|
176
176
|
operationBlock.head += '\b}\b';
|
|
177
177
|
}
|
|
178
178
|
/* Determine return type */
|
|
179
|
-
|
|
179
|
+
const returnTypes = [];
|
|
180
180
|
let typeDef = '';
|
|
181
181
|
for (const resp of operation.responses) {
|
|
182
182
|
if (!resp.statusCode.find(r => r.intersects(200, 299)))
|
|
@@ -186,14 +186,6 @@ async function generateHttpController(controller) {
|
|
|
186
186
|
const xt = await this.generateDataType(resp.type, 'typeDef', file);
|
|
187
187
|
typeDef = xt.kind === 'embedded' ? xt.code : xt.typeName;
|
|
188
188
|
}
|
|
189
|
-
else if (resp.contentType && type_is_1.default.is(String(resp.contentType), [common_1.MimeTypes.opra_response_json])) {
|
|
190
|
-
file.addImport('@opra/common', ['OperationResult']);
|
|
191
|
-
typeDef = 'OperationResult';
|
|
192
|
-
}
|
|
193
|
-
if (typeDef === 'any') {
|
|
194
|
-
returnTypes = [];
|
|
195
|
-
break;
|
|
196
|
-
}
|
|
197
189
|
if (typeDef) {
|
|
198
190
|
if (typeDef !== 'OperationResult') {
|
|
199
191
|
if (resp.partial) {
|
|
@@ -206,6 +198,10 @@ async function generateHttpController(controller) {
|
|
|
206
198
|
}
|
|
207
199
|
}
|
|
208
200
|
}
|
|
201
|
+
if (resp.contentType && type_is_1.default.is(String(resp.contentType), [common_1.MimeTypes.opra_response_json])) {
|
|
202
|
+
file.addImport('@opra/common', ['OperationResult']);
|
|
203
|
+
typeDef = typeDef ? `OperationResult<${typeDef}>` : 'OperationResult';
|
|
204
|
+
}
|
|
209
205
|
typeDef = typeDef || 'undefined';
|
|
210
206
|
if (!returnTypes.includes(typeDef))
|
|
211
207
|
returnTypes.push(typeDef);
|
|
@@ -172,7 +172,7 @@ export async function generateHttpController(controller) {
|
|
|
172
172
|
operationBlock.head += '\b}\b';
|
|
173
173
|
}
|
|
174
174
|
/* Determine return type */
|
|
175
|
-
|
|
175
|
+
const returnTypes = [];
|
|
176
176
|
let typeDef = '';
|
|
177
177
|
for (const resp of operation.responses) {
|
|
178
178
|
if (!resp.statusCode.find(r => r.intersects(200, 299)))
|
|
@@ -182,14 +182,6 @@ export async function generateHttpController(controller) {
|
|
|
182
182
|
const xt = await this.generateDataType(resp.type, 'typeDef', file);
|
|
183
183
|
typeDef = xt.kind === 'embedded' ? xt.code : xt.typeName;
|
|
184
184
|
}
|
|
185
|
-
else if (resp.contentType && typeIs.is(String(resp.contentType), [MimeTypes.opra_response_json])) {
|
|
186
|
-
file.addImport('@opra/common', ['OperationResult']);
|
|
187
|
-
typeDef = 'OperationResult';
|
|
188
|
-
}
|
|
189
|
-
if (typeDef === 'any') {
|
|
190
|
-
returnTypes = [];
|
|
191
|
-
break;
|
|
192
|
-
}
|
|
193
185
|
if (typeDef) {
|
|
194
186
|
if (typeDef !== 'OperationResult') {
|
|
195
187
|
if (resp.partial) {
|
|
@@ -202,6 +194,10 @@ export async function generateHttpController(controller) {
|
|
|
202
194
|
}
|
|
203
195
|
}
|
|
204
196
|
}
|
|
197
|
+
if (resp.contentType && typeIs.is(String(resp.contentType), [MimeTypes.opra_response_json])) {
|
|
198
|
+
file.addImport('@opra/common', ['OperationResult']);
|
|
199
|
+
typeDef = typeDef ? `OperationResult<${typeDef}>` : 'OperationResult';
|
|
200
|
+
}
|
|
205
201
|
typeDef = typeDef || 'undefined';
|
|
206
202
|
if (!returnTypes.includes(typeDef))
|
|
207
203
|
returnTypes.push(typeDef);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opra/cli",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.14",
|
|
4
4
|
"description": "Opra CLI tools",
|
|
5
5
|
"author": "Panates",
|
|
6
6
|
"license": "MIT",
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@browsery/type-is": "^1.6.18-r3",
|
|
35
|
-
"@opra/client": "^1.0.0-alpha.
|
|
36
|
-
"@opra/common": "^1.0.0-alpha.
|
|
35
|
+
"@opra/client": "^1.0.0-alpha.14",
|
|
36
|
+
"@opra/common": "^1.0.0-alpha.14",
|
|
37
37
|
"chalk": "^5.3.0",
|
|
38
38
|
"commander": "^12.0.0",
|
|
39
39
|
"js-string-escape": "^1.0.1",
|