@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/dist/cli.js
CHANGED
|
@@ -1212,7 +1212,7 @@ function indent(space, text) {
|
|
|
1212
1212
|
return text.split("\n").map((line) => `${indentation}${line}`).join("\n");
|
|
1213
1213
|
}
|
|
1214
1214
|
function generateObject(schema, alias) {
|
|
1215
|
-
if (!schema.properties ||
|
|
1215
|
+
if ((!schema.properties || R11.isEmpty(schema.properties)) && (!schema.additionalProperties || R11.isEmpty(schema.additionalProperties))) {
|
|
1216
1216
|
return "object";
|
|
1217
1217
|
}
|
|
1218
1218
|
const $properties = Object.entries(schema.properties || {}).map(([propertyName, propertySchema]) => {
|
|
@@ -1572,7 +1572,10 @@ async function compileSchemaDefinition(options) {
|
|
|
1572
1572
|
const artifact = new Artifact({
|
|
1573
1573
|
id: filepath,
|
|
1574
1574
|
filepath,
|
|
1575
|
-
content:
|
|
1575
|
+
content: [
|
|
1576
|
+
"/* @anchor:file:start */",
|
|
1577
|
+
"/* @anchor:file:end */"
|
|
1578
|
+
].join("\n")
|
|
1576
1579
|
});
|
|
1577
1580
|
for (const schemaDefinition of schemaDefinitions2 || []) {
|
|
1578
1581
|
const dependentArtifact = artifacts.find(isArtifactCompiledBy(schemaDefinition));
|
|
@@ -1685,7 +1688,7 @@ async function operationTypeRenderer(operationDefinition, alias = R15.identity)
|
|
|
1685
1688
|
$parameterBodies || void 0,
|
|
1686
1689
|
$requestParameters,
|
|
1687
1690
|
"",
|
|
1688
|
-
`export interface Operation<STATUS extends keyof ${typeName("ResponseBodies")}, CONTENT_TYPE extends keyof ${typeName("ParameterBodies")}> extends KeqOperation {`,
|
|
1691
|
+
`export interface Operation<STATUS extends keyof ${typeName("ResponseBodies")}, CONTENT_TYPE extends ${$parameterBodies ? `keyof ${typeName("ParameterBodies")}` : "string"} > extends KeqOperation {`,
|
|
1689
1692
|
` requestParams: ${typeName("RouteParameters")} & { [key: string]: KeqPathParameterInit }`,
|
|
1690
1693
|
` requestQuery: ${typeName("RequestQuery")} & { [key: string]: KeqQueryInit }`,
|
|
1691
1694
|
` requestHeaders: ${typeName("RequestHeaders")} & { [key: string]: string | number }`,
|
|
@@ -1982,7 +1985,10 @@ async function compileOperationDefinition(options) {
|
|
|
1982
1985
|
const artifact = new Artifact({
|
|
1983
1986
|
id: filepath,
|
|
1984
1987
|
filepath,
|
|
1985
|
-
content:
|
|
1988
|
+
content: [
|
|
1989
|
+
"/* @anchor:file:start */",
|
|
1990
|
+
"/* @anchor:file:end */"
|
|
1991
|
+
].join("\n")
|
|
1986
1992
|
});
|
|
1987
1993
|
for (const operationDefinition of operationDefinitions2 || []) {
|
|
1988
1994
|
const dependentArtifact = artifacts.find((artifact2) => artifact2.filepath === genOperationRequestFilepath(operationDefinition));
|
|
@@ -2000,14 +2006,12 @@ async function compileOperationDefinition(options) {
|
|
|
2000
2006
|
// src/renderer/request/index.ts
|
|
2001
2007
|
async function requestRenderer() {
|
|
2002
2008
|
return [
|
|
2003
|
-
"import { KeqRequest } from 'keq'",
|
|
2004
|
-
"",
|
|
2005
2009
|
"/* @anchor:file:start */",
|
|
2006
2010
|
"",
|
|
2007
2011
|
"/* @anchor:request-declaration */",
|
|
2008
2012
|
"export const request = new KeqRequest()",
|
|
2009
2013
|
"",
|
|
2010
|
-
"/* @anchor:file:end"
|
|
2014
|
+
"/* @anchor:file:end */"
|
|
2011
2015
|
].join("\n");
|
|
2012
2016
|
}
|
|
2013
2017
|
|
|
@@ -2020,13 +2024,15 @@ function main6(compiler) {
|
|
|
2020
2024
|
const rc = context.setup.rc;
|
|
2021
2025
|
const matcher = context.setup.matcher;
|
|
2022
2026
|
const documents = context.shaken.documents.filter((document) => !matcher.isModuleIgnored(document.module));
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2027
|
+
let requestArtifact = new Artifact({
|
|
2028
|
+
id: "request",
|
|
2029
|
+
filepath: "request",
|
|
2030
|
+
content: await requestRenderer(),
|
|
2031
|
+
extensionName: ".ts"
|
|
2032
|
+
});
|
|
2033
|
+
requestArtifact.addDependence("keq", ["KeqRequest"]);
|
|
2034
|
+
requestArtifact = await compiler.hooks.afterCompileKeqRequest.promise(
|
|
2035
|
+
requestArtifact,
|
|
2030
2036
|
task
|
|
2031
2037
|
);
|
|
2032
2038
|
const schemaDefinitions = documents.flatMap((document) => document.schemas);
|