@keq-request/cli 5.0.0-alpha.12 → 5.0.0-alpha.13
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/CHANGELOG.md +8 -0
- package/dist/cli.cjs +20 -14
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +20 -14
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +22 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +21 -14
- package/dist/index.js.map +1 -1
- package/dist/plugins/eslint/index.d.ts.map +1 -1
- package/dist/plugins.cjs +11 -21
- package/dist/plugins.cjs.map +1 -1
- package/dist/plugins.js +11 -21
- package/dist/plugins.js.map +1 -1
- package/dist/renderer/request/index.d.ts.map +1 -1
- package/dist/tasks/compile/index.d.ts.map +1 -1
- package/dist/tasks/compile/utils/compile-operation-definition.d.ts.map +1 -1
- package/dist/tasks/compile/utils/compile-schema-definition.d.ts.map +1 -1
- package/dist/types/runtime-config.d.ts +2 -2
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
## 5.0.0-alpha.6 (2025-09-17)
|
|
2
2
|
|
|
3
|
+
## 5.0.0-alpha.13
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 9d481d8: Generation will no longer be skipped when the object schema contains only the `additionalProperties` key.
|
|
8
|
+
- 5150d57: The generated type file has an error when no requestBody definition in swagger.
|
|
9
|
+
- keq@5.0.0-alpha.13
|
|
10
|
+
|
|
3
11
|
## 5.0.0-alpha.12
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
package/dist/cli.cjs
CHANGED
|
@@ -1235,7 +1235,7 @@ function indent(space, text) {
|
|
|
1235
1235
|
return text.split("\n").map((line) => `${indentation}${line}`).join("\n");
|
|
1236
1236
|
}
|
|
1237
1237
|
function generateObject(schema, alias) {
|
|
1238
|
-
if (!schema.properties ||
|
|
1238
|
+
if ((!schema.properties || R11.isEmpty(schema.properties)) && (!schema.additionalProperties || R11.isEmpty(schema.additionalProperties))) {
|
|
1239
1239
|
return "object";
|
|
1240
1240
|
}
|
|
1241
1241
|
const $properties = Object.entries(schema.properties || {}).map(([propertyName, propertySchema]) => {
|
|
@@ -1595,7 +1595,10 @@ async function compileSchemaDefinition(options) {
|
|
|
1595
1595
|
const artifact = new Artifact({
|
|
1596
1596
|
id: filepath,
|
|
1597
1597
|
filepath,
|
|
1598
|
-
content:
|
|
1598
|
+
content: [
|
|
1599
|
+
"/* @anchor:file:start */",
|
|
1600
|
+
"/* @anchor:file:end */"
|
|
1601
|
+
].join("\n")
|
|
1599
1602
|
});
|
|
1600
1603
|
for (const schemaDefinition of schemaDefinitions2 || []) {
|
|
1601
1604
|
const dependentArtifact = artifacts.find(isArtifactCompiledBy(schemaDefinition));
|
|
@@ -1708,7 +1711,7 @@ async function operationTypeRenderer(operationDefinition, alias = R15.identity)
|
|
|
1708
1711
|
$parameterBodies || void 0,
|
|
1709
1712
|
$requestParameters,
|
|
1710
1713
|
"",
|
|
1711
|
-
`export interface Operation<STATUS extends keyof ${typeName("ResponseBodies")}, CONTENT_TYPE extends keyof ${typeName("ParameterBodies")}> extends KeqOperation {`,
|
|
1714
|
+
`export interface Operation<STATUS extends keyof ${typeName("ResponseBodies")}, CONTENT_TYPE extends ${$parameterBodies ? `keyof ${typeName("ParameterBodies")}` : "string"} > extends KeqOperation {`,
|
|
1712
1715
|
` requestParams: ${typeName("RouteParameters")} & { [key: string]: KeqPathParameterInit }`,
|
|
1713
1716
|
` requestQuery: ${typeName("RequestQuery")} & { [key: string]: KeqQueryInit }`,
|
|
1714
1717
|
` requestHeaders: ${typeName("RequestHeaders")} & { [key: string]: string | number }`,
|
|
@@ -2005,7 +2008,10 @@ async function compileOperationDefinition(options) {
|
|
|
2005
2008
|
const artifact = new Artifact({
|
|
2006
2009
|
id: filepath,
|
|
2007
2010
|
filepath,
|
|
2008
|
-
content:
|
|
2011
|
+
content: [
|
|
2012
|
+
"/* @anchor:file:start */",
|
|
2013
|
+
"/* @anchor:file:end */"
|
|
2014
|
+
].join("\n")
|
|
2009
2015
|
});
|
|
2010
2016
|
for (const operationDefinition of operationDefinitions2 || []) {
|
|
2011
2017
|
const dependentArtifact = artifacts.find((artifact2) => artifact2.filepath === genOperationRequestFilepath(operationDefinition));
|
|
@@ -2023,14 +2029,12 @@ async function compileOperationDefinition(options) {
|
|
|
2023
2029
|
// src/renderer/request/index.ts
|
|
2024
2030
|
async function requestRenderer() {
|
|
2025
2031
|
return [
|
|
2026
|
-
"import { KeqRequest } from 'keq'",
|
|
2027
|
-
"",
|
|
2028
2032
|
"/* @anchor:file:start */",
|
|
2029
2033
|
"",
|
|
2030
2034
|
"/* @anchor:request-declaration */",
|
|
2031
2035
|
"export const request = new KeqRequest()",
|
|
2032
2036
|
"",
|
|
2033
|
-
"/* @anchor:file:end"
|
|
2037
|
+
"/* @anchor:file:end */"
|
|
2034
2038
|
].join("\n");
|
|
2035
2039
|
}
|
|
2036
2040
|
|
|
@@ -2043,13 +2047,15 @@ function main6(compiler) {
|
|
|
2043
2047
|
const rc = context.setup.rc;
|
|
2044
2048
|
const matcher = context.setup.matcher;
|
|
2045
2049
|
const documents = context.shaken.documents.filter((document) => !matcher.isModuleIgnored(document.module));
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2050
|
+
let requestArtifact = new Artifact({
|
|
2051
|
+
id: "request",
|
|
2052
|
+
filepath: "request",
|
|
2053
|
+
content: await requestRenderer(),
|
|
2054
|
+
extensionName: ".ts"
|
|
2055
|
+
});
|
|
2056
|
+
requestArtifact.addDependence("keq", ["KeqRequest"]);
|
|
2057
|
+
requestArtifact = await compiler.hooks.afterCompileKeqRequest.promise(
|
|
2058
|
+
requestArtifact,
|
|
2053
2059
|
task
|
|
2054
2060
|
);
|
|
2055
2061
|
const schemaDefinitions = documents.flatMap((document) => document.schemas);
|