@gopowerteam/request-generate 0.1.8 → 0.1.9
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/dist/index.d.ts
CHANGED
|
@@ -43,6 +43,8 @@ type GenerateApplicationOptions = Pick<
|
|
|
43
43
|
> & {
|
|
44
44
|
// 服务名称
|
|
45
45
|
name?: string
|
|
46
|
+
// 应用名称
|
|
47
|
+
application?: string
|
|
46
48
|
// OPENAPI地址
|
|
47
49
|
input: string
|
|
48
50
|
}
|
|
@@ -98,6 +100,7 @@ declare class Operation {
|
|
|
98
100
|
declare class Service {
|
|
99
101
|
constructor(name: string);
|
|
100
102
|
name: string;
|
|
103
|
+
application?: string;
|
|
101
104
|
imports: string[];
|
|
102
105
|
operations: Operation[];
|
|
103
106
|
responseType: 'promise' | 'observable';
|
package/dist/index.js
CHANGED
|
@@ -32,7 +32,11 @@ var _path = require('path'); var path2 = _interopRequireWildcard(_path); var pat
|
|
|
32
32
|
function createOptions(options, name, application = "") {
|
|
33
33
|
return {
|
|
34
34
|
name,
|
|
35
|
-
|
|
35
|
+
application,
|
|
36
|
+
input: `${options.gateway}/${application}/${options.openapi}`.replace(
|
|
37
|
+
/\/{2,3}/g,
|
|
38
|
+
"/"
|
|
39
|
+
),
|
|
36
40
|
output: name ? path2.default.join(options.output, name) : options.output,
|
|
37
41
|
exportModels: options.exportModels
|
|
38
42
|
};
|
|
@@ -204,6 +208,7 @@ var Service = (_class = class {
|
|
|
204
208
|
this.responseType = ((_b = (_a = Generate.options) == null ? void 0 : _a.exportServices) == null ? void 0 : _b.responseType) || "promise";
|
|
205
209
|
}
|
|
206
210
|
|
|
211
|
+
|
|
207
212
|
__init() {this.imports = []}
|
|
208
213
|
__init2() {this.operations = []}
|
|
209
214
|
|
|
@@ -863,6 +868,7 @@ function writeServices(client, options) {
|
|
|
863
868
|
fs4.mkdirSync(output, { recursive: true });
|
|
864
869
|
client.services.forEach((service) => {
|
|
865
870
|
const filename = `${service.name}Service.ts`;
|
|
871
|
+
service.application = options.application;
|
|
866
872
|
writeService(service, path4.join(output, filename));
|
|
867
873
|
});
|
|
868
874
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -33,7 +33,11 @@ import path from "node:path";
|
|
|
33
33
|
function createOptions(options, name, application = "") {
|
|
34
34
|
return {
|
|
35
35
|
name,
|
|
36
|
-
|
|
36
|
+
application,
|
|
37
|
+
input: `${options.gateway}/${application}/${options.openapi}`.replace(
|
|
38
|
+
/\/{2,3}/g,
|
|
39
|
+
"/"
|
|
40
|
+
),
|
|
37
41
|
output: name ? path.join(options.output, name) : options.output,
|
|
38
42
|
exportModels: options.exportModels
|
|
39
43
|
};
|
|
@@ -205,6 +209,7 @@ var Service = class {
|
|
|
205
209
|
this.responseType = ((_b = (_a = Generate.options) == null ? void 0 : _a.exportServices) == null ? void 0 : _b.responseType) || "promise";
|
|
206
210
|
}
|
|
207
211
|
name;
|
|
212
|
+
application;
|
|
208
213
|
imports = [];
|
|
209
214
|
operations = [];
|
|
210
215
|
responseType;
|
|
@@ -864,6 +869,7 @@ function writeServices(client, options) {
|
|
|
864
869
|
fs4.mkdirSync(output, { recursive: true });
|
|
865
870
|
client.services.forEach((service) => {
|
|
866
871
|
const filename = `${service.name}Service.ts`;
|
|
872
|
+
service.application = options.application;
|
|
867
873
|
writeService(service, path4.join(output, filename));
|
|
868
874
|
});
|
|
869
875
|
}
|