@opra/cli 0.30.1 → 0.31.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.
- package/cjs/api-exporter/api-exporter.js +1 -1
- package/cjs/api-exporter/process-types.js +5 -5
- package/esm/api-exporter/api-exporter.js +2 -2
- package/esm/api-exporter/process-types.js +4 -4
- package/package.json +2 -2
- package/types/api-exporter/api-exporter.d.ts +2 -2
- package/types/api-exporter/process-types.d.ts +2 -2
|
@@ -110,6 +110,6 @@ exports.ApiExporter = ApiExporter;
|
|
|
110
110
|
ApiExporter.prototype.generateSimpleTypeDefinition = process_types_js_1.generateSimpleTypeDefinition;
|
|
111
111
|
ApiExporter.prototype.resolveTypeNameOrDef = process_types_js_1.resolveTypeNameOrDef;
|
|
112
112
|
ApiExporter.prototype.generateEnumTypeDefinition = process_types_js_1.generateEnumTypeDefinition;
|
|
113
|
-
ApiExporter.prototype.
|
|
113
|
+
ApiExporter.prototype.generateMixinTypeDefinition = process_types_js_1.generateMixinTypeDefinition;
|
|
114
114
|
ApiExporter.prototype.generateMappedTypeDefinition = process_types_js_1.generateMappedTypeDefinition;
|
|
115
115
|
})();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.generateMappedTypeDefinition = exports.
|
|
3
|
+
exports.generateMappedTypeDefinition = exports.generateMixinTypeDefinition = exports.generateEnumTypeDefinition = exports.generateSimpleTypeDefinition = exports.generateComplexTypeDefinition = exports.resolveTypeNameOrDef = exports.generateTypeFile = exports.processTypes = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const node_path_1 = tslib_1.__importDefault(require("node:path"));
|
|
6
6
|
const common_1 = require("@opra/common");
|
|
@@ -95,8 +95,8 @@ async function resolveTypeNameOrDef(file, dataType, forInterface) {
|
|
|
95
95
|
return this.generateSimpleTypeDefinition(file, dataType);
|
|
96
96
|
if (dataType instanceof common_1.EnumType)
|
|
97
97
|
return this.generateEnumTypeDefinition(file, dataType);
|
|
98
|
-
if (dataType instanceof common_1.
|
|
99
|
-
return this.
|
|
98
|
+
if (dataType instanceof common_1.MixinType)
|
|
99
|
+
return this.generateMixinTypeDefinition(file, dataType, forInterface);
|
|
100
100
|
if (dataType instanceof common_1.MappedType)
|
|
101
101
|
return this.generateMappedTypeDefinition(file, dataType, forInterface);
|
|
102
102
|
if (dataType instanceof common_1.ComplexType)
|
|
@@ -202,12 +202,12 @@ exports.generateEnumTypeDefinition = generateEnumTypeDefinition;
|
|
|
202
202
|
* @param dataType
|
|
203
203
|
* @param forInterface
|
|
204
204
|
*/
|
|
205
|
-
async function
|
|
205
|
+
async function generateMixinTypeDefinition(file, dataType, forInterface) {
|
|
206
206
|
// let out = '';
|
|
207
207
|
return (await Promise.all(dataType.types
|
|
208
208
|
.map(t => this.resolveTypeNameOrDef(file, t, forInterface)))).join(forInterface ? ', ' : ' & ');
|
|
209
209
|
}
|
|
210
|
-
exports.
|
|
210
|
+
exports.generateMixinTypeDefinition = generateMixinTypeDefinition;
|
|
211
211
|
/**
|
|
212
212
|
*
|
|
213
213
|
* @param file
|
|
@@ -5,7 +5,7 @@ import process from 'node:process';
|
|
|
5
5
|
import { OpraHttpClient } from '@opra/client';
|
|
6
6
|
import { FileWriter } from './file-writer.js';
|
|
7
7
|
import { processResource } from './process-resources.js';
|
|
8
|
-
import { generateComplexTypeDefinition, generateEnumTypeDefinition, generateMappedTypeDefinition, generateSimpleTypeDefinition, generateTypeFile,
|
|
8
|
+
import { generateComplexTypeDefinition, generateEnumTypeDefinition, generateMappedTypeDefinition, generateMixinTypeDefinition, generateSimpleTypeDefinition, generateTypeFile, processTypes, resolveTypeNameOrDef } from './process-types.js';
|
|
9
9
|
import { TsFile } from './ts-file.js';
|
|
10
10
|
export class ApiExporter {
|
|
11
11
|
constructor(config) {
|
|
@@ -105,6 +105,6 @@ export class ApiExporter {
|
|
|
105
105
|
ApiExporter.prototype.generateSimpleTypeDefinition = generateSimpleTypeDefinition;
|
|
106
106
|
ApiExporter.prototype.resolveTypeNameOrDef = resolveTypeNameOrDef;
|
|
107
107
|
ApiExporter.prototype.generateEnumTypeDefinition = generateEnumTypeDefinition;
|
|
108
|
-
ApiExporter.prototype.
|
|
108
|
+
ApiExporter.prototype.generateMixinTypeDefinition = generateMixinTypeDefinition;
|
|
109
109
|
ApiExporter.prototype.generateMappedTypeDefinition = generateMappedTypeDefinition;
|
|
110
110
|
})();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
|
-
import { ComplexType, EnumType, MappedType,
|
|
2
|
+
import { ComplexType, EnumType, MappedType, MixinType, SimpleType } from '@opra/common';
|
|
3
3
|
import { wrapJSDocString } from '../utils/string-utils.js';
|
|
4
4
|
const internalTypeNames = ['any', 'boolean', 'bigint', 'number', 'null', 'string'];
|
|
5
5
|
/**
|
|
@@ -89,8 +89,8 @@ export async function resolveTypeNameOrDef(file, dataType, forInterface) {
|
|
|
89
89
|
return this.generateSimpleTypeDefinition(file, dataType);
|
|
90
90
|
if (dataType instanceof EnumType)
|
|
91
91
|
return this.generateEnumTypeDefinition(file, dataType);
|
|
92
|
-
if (dataType instanceof
|
|
93
|
-
return this.
|
|
92
|
+
if (dataType instanceof MixinType)
|
|
93
|
+
return this.generateMixinTypeDefinition(file, dataType, forInterface);
|
|
94
94
|
if (dataType instanceof MappedType)
|
|
95
95
|
return this.generateMappedTypeDefinition(file, dataType, forInterface);
|
|
96
96
|
if (dataType instanceof ComplexType)
|
|
@@ -192,7 +192,7 @@ export async function generateEnumTypeDefinition(file, dataType) {
|
|
|
192
192
|
* @param dataType
|
|
193
193
|
* @param forInterface
|
|
194
194
|
*/
|
|
195
|
-
export async function
|
|
195
|
+
export async function generateMixinTypeDefinition(file, dataType, forInterface) {
|
|
196
196
|
// let out = '';
|
|
197
197
|
return (await Promise.all(dataType.types
|
|
198
198
|
.map(t => this.resolveTypeNameOrDef(file, t, forInterface)))).join(forInterface ? ', ' : ' & ');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opra/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.31.1",
|
|
4
4
|
"description": "Opra CLI tools",
|
|
5
5
|
"author": "Panates",
|
|
6
6
|
"license": "MIT",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"clean:cover": "rimraf ../../coverage/client"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@opra/client": "^0.
|
|
31
|
+
"@opra/client": "^0.31.1",
|
|
32
32
|
"chalk": "^5.3.0",
|
|
33
33
|
"commander": "^11.0.0",
|
|
34
34
|
"js-string-escape": "^1.0.1",
|
|
@@ -3,7 +3,7 @@ import { ApiDocument } from '@opra/common';
|
|
|
3
3
|
import { IFileWriter } from '../interfaces/file-writer.interface.js';
|
|
4
4
|
import { ILogger } from '../interfaces/logger.interface.js';
|
|
5
5
|
import { processResource } from './process-resources.js';
|
|
6
|
-
import { generateComplexTypeDefinition, generateEnumTypeDefinition, generateMappedTypeDefinition, generateSimpleTypeDefinition, generateTypeFile,
|
|
6
|
+
import { generateComplexTypeDefinition, generateEnumTypeDefinition, generateMappedTypeDefinition, generateMixinTypeDefinition, generateSimpleTypeDefinition, generateTypeFile, processTypes, resolveTypeNameOrDef } from './process-types.js';
|
|
7
7
|
import { TsFile } from './ts-file.js';
|
|
8
8
|
export declare namespace ApiExporter {
|
|
9
9
|
interface Config {
|
|
@@ -35,7 +35,7 @@ export declare class ApiExporter {
|
|
|
35
35
|
protected generateSimpleTypeDefinition: typeof generateSimpleTypeDefinition;
|
|
36
36
|
protected resolveTypeNameOrDef: typeof resolveTypeNameOrDef;
|
|
37
37
|
protected generateEnumTypeDefinition: typeof generateEnumTypeDefinition;
|
|
38
|
-
protected
|
|
38
|
+
protected generateMixinTypeDefinition: typeof generateMixinTypeDefinition;
|
|
39
39
|
protected generateMappedTypeDefinition: typeof generateMappedTypeDefinition;
|
|
40
40
|
protected constructor(config: ApiExporter.Config);
|
|
41
41
|
protected execute(): Promise<void>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ComplexType, DataType, EnumType, MappedType,
|
|
1
|
+
import { ComplexType, DataType, EnumType, MappedType, MixinType, SimpleType } from '@opra/common';
|
|
2
2
|
import type { ApiExporter } from './api-exporter.js';
|
|
3
3
|
import { TsFile } from './ts-file.js';
|
|
4
4
|
/**
|
|
@@ -44,7 +44,7 @@ export declare function generateEnumTypeDefinition(this: ApiExporter, file: TsFi
|
|
|
44
44
|
* @param dataType
|
|
45
45
|
* @param forInterface
|
|
46
46
|
*/
|
|
47
|
-
export declare function
|
|
47
|
+
export declare function generateMixinTypeDefinition(this: ApiExporter, file: TsFile, dataType: MixinType, forInterface?: boolean): Promise<string>;
|
|
48
48
|
/**
|
|
49
49
|
*
|
|
50
50
|
* @param file
|