@gopowerteam/request-generate 0.1.12 → 0.1.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.
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var _class; var _class2; var _class3;
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } var _class; var _class2; var _class3;
|
|
2
2
|
|
|
3
3
|
var _chunkXXPGZHWZjs = require('./chunk-XXPGZHWZ.js');
|
|
4
4
|
|
|
@@ -91,8 +91,16 @@ var Field = class {
|
|
|
91
91
|
}
|
|
92
92
|
};
|
|
93
93
|
|
|
94
|
-
// src/utils/get-
|
|
94
|
+
// src/utils/get-built-in-type.ts
|
|
95
95
|
var TYPE_MAPPINGS = /* @__PURE__ */ new Map([
|
|
96
|
+
["MapStringObject", "Record<string, any>"]
|
|
97
|
+
]);
|
|
98
|
+
var getBuiltInType = (ref) => {
|
|
99
|
+
return TYPE_MAPPINGS.get(ref);
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
// src/utils/get-mapped-type.ts
|
|
103
|
+
var TYPE_MAPPINGS2 = /* @__PURE__ */ new Map([
|
|
96
104
|
["file", "binary"],
|
|
97
105
|
["any", "any"],
|
|
98
106
|
["object", "any"],
|
|
@@ -118,7 +126,7 @@ var getMappedType = (type = "object", format) => {
|
|
|
118
126
|
if (format === "binary") {
|
|
119
127
|
return "binary";
|
|
120
128
|
}
|
|
121
|
-
return
|
|
129
|
+
return TYPE_MAPPINGS2.get(type) || "any";
|
|
122
130
|
};
|
|
123
131
|
|
|
124
132
|
// src/parse/v2/strip-namespace.ts
|
|
@@ -145,10 +153,11 @@ function parseSchemaType(schema) {
|
|
|
145
153
|
}
|
|
146
154
|
if (!("$ref" in schema) && schema.type === "array" && schema.items && "$ref" in schema.items && schema.items.$ref) {
|
|
147
155
|
const ref = getCamelName(stripNamespace(schema.items.$ref));
|
|
156
|
+
const type = getBuiltInType(ref);
|
|
148
157
|
return {
|
|
149
158
|
type: "any[]",
|
|
150
|
-
ref: `${ref}[]`,
|
|
151
|
-
imports: [ref]
|
|
159
|
+
ref: `${_nullishCoalesce(type, () => ( ref))}[]`,
|
|
160
|
+
imports: type ? void 0 : [ref]
|
|
152
161
|
};
|
|
153
162
|
}
|
|
154
163
|
if (!("$ref" in schema) && schema.type === "array" && schema.items && !("$ref" in schema.items)) {
|
|
@@ -498,10 +507,11 @@ function parseSchemaType2(schema) {
|
|
|
498
507
|
}
|
|
499
508
|
if (schema.type === "array" && "$ref" in schema.items) {
|
|
500
509
|
const ref = getCamelName(stripNamespace2(schema.items.$ref));
|
|
510
|
+
const type = getBuiltInType(ref);
|
|
501
511
|
return {
|
|
502
512
|
type: "any[]",
|
|
503
|
-
ref: `${ref}[]`,
|
|
504
|
-
imports: [ref]
|
|
513
|
+
ref: `${_nullishCoalesce(type, () => ( ref))}[]`,
|
|
514
|
+
imports: type ? void 0 : [ref]
|
|
505
515
|
};
|
|
506
516
|
}
|
|
507
517
|
if (schema.type === "array" && !("$ref" in schema.items)) {
|
package/dist/index.mjs
CHANGED
|
@@ -92,8 +92,16 @@ var Field = class {
|
|
|
92
92
|
}
|
|
93
93
|
};
|
|
94
94
|
|
|
95
|
-
// src/utils/get-
|
|
95
|
+
// src/utils/get-built-in-type.ts
|
|
96
96
|
var TYPE_MAPPINGS = /* @__PURE__ */ new Map([
|
|
97
|
+
["MapStringObject", "Record<string, any>"]
|
|
98
|
+
]);
|
|
99
|
+
var getBuiltInType = (ref) => {
|
|
100
|
+
return TYPE_MAPPINGS.get(ref);
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
// src/utils/get-mapped-type.ts
|
|
104
|
+
var TYPE_MAPPINGS2 = /* @__PURE__ */ new Map([
|
|
97
105
|
["file", "binary"],
|
|
98
106
|
["any", "any"],
|
|
99
107
|
["object", "any"],
|
|
@@ -119,7 +127,7 @@ var getMappedType = (type = "object", format) => {
|
|
|
119
127
|
if (format === "binary") {
|
|
120
128
|
return "binary";
|
|
121
129
|
}
|
|
122
|
-
return
|
|
130
|
+
return TYPE_MAPPINGS2.get(type) || "any";
|
|
123
131
|
};
|
|
124
132
|
|
|
125
133
|
// src/parse/v2/strip-namespace.ts
|
|
@@ -146,10 +154,11 @@ function parseSchemaType(schema) {
|
|
|
146
154
|
}
|
|
147
155
|
if (!("$ref" in schema) && schema.type === "array" && schema.items && "$ref" in schema.items && schema.items.$ref) {
|
|
148
156
|
const ref = getCamelName(stripNamespace(schema.items.$ref));
|
|
157
|
+
const type = getBuiltInType(ref);
|
|
149
158
|
return {
|
|
150
159
|
type: "any[]",
|
|
151
|
-
ref: `${ref}[]`,
|
|
152
|
-
imports: [ref]
|
|
160
|
+
ref: `${type ?? ref}[]`,
|
|
161
|
+
imports: type ? void 0 : [ref]
|
|
153
162
|
};
|
|
154
163
|
}
|
|
155
164
|
if (!("$ref" in schema) && schema.type === "array" && schema.items && !("$ref" in schema.items)) {
|
|
@@ -499,10 +508,11 @@ function parseSchemaType2(schema) {
|
|
|
499
508
|
}
|
|
500
509
|
if (schema.type === "array" && "$ref" in schema.items) {
|
|
501
510
|
const ref = getCamelName(stripNamespace2(schema.items.$ref));
|
|
511
|
+
const type = getBuiltInType(ref);
|
|
502
512
|
return {
|
|
503
513
|
type: "any[]",
|
|
504
|
-
ref: `${ref}[]`,
|
|
505
|
-
imports: [ref]
|
|
514
|
+
ref: `${type ?? ref}[]`,
|
|
515
|
+
imports: type ? void 0 : [ref]
|
|
506
516
|
};
|
|
507
517
|
}
|
|
508
518
|
if (schema.type === "array" && !("$ref" in schema.items)) {
|
|
@@ -10,7 +10,7 @@ public {{{name}}}(
|
|
|
10
10
|
{{>export-operation-params-path}}
|
|
11
11
|
{{>export-operation-params-query}}
|
|
12
12
|
{{>export-operation-params-body}}
|
|
13
|
-
requestPlugins
|
|
13
|
+
requestPlugins?: RequestPlugin[],
|
|
14
14
|
requestGenerateOptions?: RequestGenerateOptions
|
|
15
15
|
): {{>export-operation-response }}
|
|
16
16
|
public {{{name}}}(
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gopowerteam/request-generate",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.14",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"files": [
|
|
7
7
|
"dist",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"tsup": "^6.6.3",
|
|
46
46
|
"typescript": "^4.9.5",
|
|
47
47
|
"vite": "^4.1.4",
|
|
48
|
-
"@gopowerteam/request": "0.1.
|
|
48
|
+
"@gopowerteam/request": "0.1.15"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"@apidevtools/swagger-parser": "^10.1.0",
|