@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/index.cjs
CHANGED
|
@@ -37,6 +37,7 @@ __export(src_exports, {
|
|
|
37
37
|
FileNamingStyle: () => FileNamingStyle,
|
|
38
38
|
ModuleDefinition: () => ModuleDefinition,
|
|
39
39
|
OperationDefinition: () => OperationDefinition,
|
|
40
|
+
QsArrayFormat: () => QsArrayFormat,
|
|
40
41
|
RuntimeConfig: () => RuntimeConfig,
|
|
41
42
|
SchemaDefinition: () => SchemaDefinition,
|
|
42
43
|
defineKeqConfig: () => defineKeqConfig
|
|
@@ -1256,7 +1257,7 @@ function indent(space, text) {
|
|
|
1256
1257
|
return text.split("\n").map((line) => `${indentation}${line}`).join("\n");
|
|
1257
1258
|
}
|
|
1258
1259
|
function generateObject(schema, alias) {
|
|
1259
|
-
if (!schema.properties ||
|
|
1260
|
+
if ((!schema.properties || R11.isEmpty(schema.properties)) && (!schema.additionalProperties || R11.isEmpty(schema.additionalProperties))) {
|
|
1260
1261
|
return "object";
|
|
1261
1262
|
}
|
|
1262
1263
|
const $properties = Object.entries(schema.properties || {}).map(([propertyName, propertySchema]) => {
|
|
@@ -1616,7 +1617,10 @@ async function compileSchemaDefinition(options) {
|
|
|
1616
1617
|
const artifact = new Artifact({
|
|
1617
1618
|
id: filepath,
|
|
1618
1619
|
filepath,
|
|
1619
|
-
content:
|
|
1620
|
+
content: [
|
|
1621
|
+
"/* @anchor:file:start */",
|
|
1622
|
+
"/* @anchor:file:end */"
|
|
1623
|
+
].join("\n")
|
|
1620
1624
|
});
|
|
1621
1625
|
for (const schemaDefinition of schemaDefinitions2 || []) {
|
|
1622
1626
|
const dependentArtifact = artifacts.find(isArtifactCompiledBy(schemaDefinition));
|
|
@@ -1729,7 +1733,7 @@ async function operationTypeRenderer(operationDefinition, alias = R15.identity)
|
|
|
1729
1733
|
$parameterBodies || void 0,
|
|
1730
1734
|
$requestParameters,
|
|
1731
1735
|
"",
|
|
1732
|
-
`export interface Operation<STATUS extends keyof ${typeName("ResponseBodies")}, CONTENT_TYPE extends keyof ${typeName("ParameterBodies")}> extends KeqOperation {`,
|
|
1736
|
+
`export interface Operation<STATUS extends keyof ${typeName("ResponseBodies")}, CONTENT_TYPE extends ${$parameterBodies ? `keyof ${typeName("ParameterBodies")}` : "string"} > extends KeqOperation {`,
|
|
1733
1737
|
` requestParams: ${typeName("RouteParameters")} & { [key: string]: KeqPathParameterInit }`,
|
|
1734
1738
|
` requestQuery: ${typeName("RequestQuery")} & { [key: string]: KeqQueryInit }`,
|
|
1735
1739
|
` requestHeaders: ${typeName("RequestHeaders")} & { [key: string]: string | number }`,
|
|
@@ -2026,7 +2030,10 @@ async function compileOperationDefinition(options) {
|
|
|
2026
2030
|
const artifact = new Artifact({
|
|
2027
2031
|
id: filepath,
|
|
2028
2032
|
filepath,
|
|
2029
|
-
content:
|
|
2033
|
+
content: [
|
|
2034
|
+
"/* @anchor:file:start */",
|
|
2035
|
+
"/* @anchor:file:end */"
|
|
2036
|
+
].join("\n")
|
|
2030
2037
|
});
|
|
2031
2038
|
for (const operationDefinition of operationDefinitions2 || []) {
|
|
2032
2039
|
const dependentArtifact = artifacts.find((artifact2) => artifact2.filepath === genOperationRequestFilepath(operationDefinition));
|
|
@@ -2044,14 +2051,12 @@ async function compileOperationDefinition(options) {
|
|
|
2044
2051
|
// src/renderer/request/index.ts
|
|
2045
2052
|
async function requestRenderer() {
|
|
2046
2053
|
return [
|
|
2047
|
-
"import { KeqRequest } from 'keq'",
|
|
2048
|
-
"",
|
|
2049
2054
|
"/* @anchor:file:start */",
|
|
2050
2055
|
"",
|
|
2051
2056
|
"/* @anchor:request-declaration */",
|
|
2052
2057
|
"export const request = new KeqRequest()",
|
|
2053
2058
|
"",
|
|
2054
|
-
"/* @anchor:file:end"
|
|
2059
|
+
"/* @anchor:file:end */"
|
|
2055
2060
|
].join("\n");
|
|
2056
2061
|
}
|
|
2057
2062
|
|
|
@@ -2064,13 +2069,15 @@ function main6(compiler) {
|
|
|
2064
2069
|
const rc = context.setup.rc;
|
|
2065
2070
|
const matcher = context.setup.matcher;
|
|
2066
2071
|
const documents = context.shaken.documents.filter((document) => !matcher.isModuleIgnored(document.module));
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2072
|
+
let requestArtifact = new Artifact({
|
|
2073
|
+
id: "request",
|
|
2074
|
+
filepath: "request",
|
|
2075
|
+
content: await requestRenderer(),
|
|
2076
|
+
extensionName: ".ts"
|
|
2077
|
+
});
|
|
2078
|
+
requestArtifact.addDependence("keq", ["KeqRequest"]);
|
|
2079
|
+
requestArtifact = await compiler.hooks.afterCompileKeqRequest.promise(
|
|
2080
|
+
requestArtifact,
|
|
2074
2081
|
task
|
|
2075
2082
|
);
|
|
2076
2083
|
const schemaDefinitions = documents.flatMap((document) => document.schemas);
|
|
@@ -2314,6 +2321,7 @@ var Compiler = class {
|
|
|
2314
2321
|
FileNamingStyle,
|
|
2315
2322
|
ModuleDefinition,
|
|
2316
2323
|
OperationDefinition,
|
|
2324
|
+
QsArrayFormat,
|
|
2317
2325
|
RuntimeConfig,
|
|
2318
2326
|
SchemaDefinition,
|
|
2319
2327
|
defineKeqConfig
|