@saltify/milky-generator 0.2.0 → 0.2.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/dist/cli.mjs +23 -9
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -58,9 +58,7 @@ function getApiTypeNames(endpoint) {
|
|
|
58
58
|
return {
|
|
59
59
|
pascalEndpoint,
|
|
60
60
|
inputName: `${pascalEndpoint}Input`,
|
|
61
|
-
outputName: `${pascalEndpoint}Output
|
|
62
|
-
requestName: `${pascalEndpoint}Request`,
|
|
63
|
-
responseName: `${pascalEndpoint}Response`
|
|
61
|
+
outputName: `${pascalEndpoint}Output`
|
|
64
62
|
};
|
|
65
63
|
}
|
|
66
64
|
function isSameField(first, second) {
|
|
@@ -24919,26 +24917,42 @@ function generateTypeScriptStaticSpec(ir) {
|
|
|
24919
24917
|
const typeNames = getApiTypeNames(api.endpoint);
|
|
24920
24918
|
l(`/** ${api.description} API 请求参数 */`);
|
|
24921
24919
|
if (api.requestFields !== void 0) {
|
|
24922
|
-
l(`export interface ${typeNames.
|
|
24920
|
+
l(`export interface ${typeNames.inputName} {`);
|
|
24923
24921
|
api.requestFields.forEach((field) => {
|
|
24924
24922
|
l(` /** ${field.description} */`);
|
|
24925
24923
|
l(` ${field.name}${field.isOptional ? "?" : ""}: ${getTypeScriptTypeProjection(field)};`);
|
|
24926
24924
|
});
|
|
24927
24925
|
l("}");
|
|
24928
|
-
} else l(`export type ${typeNames.
|
|
24926
|
+
} else l(`export type ${typeNames.inputName} = {};`);
|
|
24929
24927
|
l();
|
|
24930
24928
|
l(`/** ${api.description} API 响应数据 */`);
|
|
24931
24929
|
if (api.responseFields !== void 0) {
|
|
24932
|
-
l(`export interface ${typeNames.
|
|
24930
|
+
l(`export interface ${typeNames.outputName} {`);
|
|
24933
24931
|
api.responseFields.forEach((field) => {
|
|
24934
24932
|
l(` /** ${field.description} */`);
|
|
24935
24933
|
l(` ${field.name}${field.isOptional ? "?" : ""}: ${getTypeScriptTypeProjection(field)};`);
|
|
24936
24934
|
});
|
|
24937
24935
|
l("}");
|
|
24938
|
-
} else l(`export type ${typeNames.
|
|
24936
|
+
} else l(`export type ${typeNames.outputName} = {};`);
|
|
24939
24937
|
l();
|
|
24940
24938
|
});
|
|
24941
24939
|
});
|
|
24940
|
+
l("export interface ApiCategories {");
|
|
24941
|
+
ir.apiCategories.forEach((category) => {
|
|
24942
|
+
l(` /** ${category.name} */`);
|
|
24943
|
+
l(` ${category.key}: {`);
|
|
24944
|
+
category.apis.forEach((api) => {
|
|
24945
|
+
const typeNames = getApiTypeNames(api.endpoint);
|
|
24946
|
+
l(` /** ${api.description} */`);
|
|
24947
|
+
l(` ${api.endpoint}: {`);
|
|
24948
|
+
l(` request: ${typeNames.inputName};`);
|
|
24949
|
+
l(` response: ${typeNames.outputName};`);
|
|
24950
|
+
l(" };");
|
|
24951
|
+
});
|
|
24952
|
+
l(" };");
|
|
24953
|
+
});
|
|
24954
|
+
l("}");
|
|
24955
|
+
l();
|
|
24942
24956
|
return writer.toString();
|
|
24943
24957
|
}
|
|
24944
24958
|
//#endregion
|
|
@@ -25679,7 +25693,7 @@ const apiCategories = [
|
|
|
25679
25693
|
];
|
|
25680
25694
|
//#endregion
|
|
25681
25695
|
//#region ../protocol/package.json
|
|
25682
|
-
var version$1 = "1.2.1
|
|
25696
|
+
var version$1 = "1.2.1";
|
|
25683
25697
|
//#endregion
|
|
25684
25698
|
//#region ../protocol/src/index.ts
|
|
25685
25699
|
const ir = {
|
|
@@ -29447,7 +29461,7 @@ var import_cjs = (/* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
29447
29461
|
}
|
|
29448
29462
|
});
|
|
29449
29463
|
})))();
|
|
29450
|
-
var version = "0.2.
|
|
29464
|
+
var version = "0.2.1";
|
|
29451
29465
|
var description = "Milky codegen CLI";
|
|
29452
29466
|
//#endregion
|
|
29453
29467
|
//#region src/cli.ts
|