@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/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export { defineKeqConfig } from './define-keq-config.js';
2
2
  export { RuntimeConfig } from './types/runtime-config.js';
3
3
  export { FileNamingStyle } from './constants/file-naming-style.js';
4
+ export { QsArrayFormat } from './constants/qs-array-format.js';
4
5
  export { Compiler } from './compiler/compiler.js';
5
6
  export { Plugin } from './types/plugin.js';
6
7
  export { Artifact } from './tasks/utils/artifact.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAA;AAElE,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAA;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAA;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAA;AACrE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAA;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAA;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAA;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAA;AAE9D,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAA;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAA;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAA;AACrE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAA;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAA;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAA"}
package/dist/index.js CHANGED
@@ -1211,7 +1211,7 @@ function indent(space, text) {
1211
1211
  return text.split("\n").map((line) => `${indentation}${line}`).join("\n");
1212
1212
  }
1213
1213
  function generateObject(schema, alias) {
1214
- if (!schema.properties || !Object.keys(schema.properties).length) {
1214
+ if ((!schema.properties || R11.isEmpty(schema.properties)) && (!schema.additionalProperties || R11.isEmpty(schema.additionalProperties))) {
1215
1215
  return "object";
1216
1216
  }
1217
1217
  const $properties = Object.entries(schema.properties || {}).map(([propertyName, propertySchema]) => {
@@ -1571,7 +1571,10 @@ async function compileSchemaDefinition(options) {
1571
1571
  const artifact = new Artifact({
1572
1572
  id: filepath,
1573
1573
  filepath,
1574
- content: ""
1574
+ content: [
1575
+ "/* @anchor:file:start */",
1576
+ "/* @anchor:file:end */"
1577
+ ].join("\n")
1575
1578
  });
1576
1579
  for (const schemaDefinition of schemaDefinitions2 || []) {
1577
1580
  const dependentArtifact = artifacts.find(isArtifactCompiledBy(schemaDefinition));
@@ -1684,7 +1687,7 @@ async function operationTypeRenderer(operationDefinition, alias = R15.identity)
1684
1687
  $parameterBodies || void 0,
1685
1688
  $requestParameters,
1686
1689
  "",
1687
- `export interface Operation<STATUS extends keyof ${typeName("ResponseBodies")}, CONTENT_TYPE extends keyof ${typeName("ParameterBodies")}> extends KeqOperation {`,
1690
+ `export interface Operation<STATUS extends keyof ${typeName("ResponseBodies")}, CONTENT_TYPE extends ${$parameterBodies ? `keyof ${typeName("ParameterBodies")}` : "string"} > extends KeqOperation {`,
1688
1691
  ` requestParams: ${typeName("RouteParameters")} & { [key: string]: KeqPathParameterInit }`,
1689
1692
  ` requestQuery: ${typeName("RequestQuery")} & { [key: string]: KeqQueryInit }`,
1690
1693
  ` requestHeaders: ${typeName("RequestHeaders")} & { [key: string]: string | number }`,
@@ -1981,7 +1984,10 @@ async function compileOperationDefinition(options) {
1981
1984
  const artifact = new Artifact({
1982
1985
  id: filepath,
1983
1986
  filepath,
1984
- content: ""
1987
+ content: [
1988
+ "/* @anchor:file:start */",
1989
+ "/* @anchor:file:end */"
1990
+ ].join("\n")
1985
1991
  });
1986
1992
  for (const operationDefinition of operationDefinitions2 || []) {
1987
1993
  const dependentArtifact = artifacts.find((artifact2) => artifact2.filepath === genOperationRequestFilepath(operationDefinition));
@@ -1999,14 +2005,12 @@ async function compileOperationDefinition(options) {
1999
2005
  // src/renderer/request/index.ts
2000
2006
  async function requestRenderer() {
2001
2007
  return [
2002
- "import { KeqRequest } from 'keq'",
2003
- "",
2004
2008
  "/* @anchor:file:start */",
2005
2009
  "",
2006
2010
  "/* @anchor:request-declaration */",
2007
2011
  "export const request = new KeqRequest()",
2008
2012
  "",
2009
- "/* @anchor:file:end"
2013
+ "/* @anchor:file:end */"
2010
2014
  ].join("\n");
2011
2015
  }
2012
2016
 
@@ -2019,13 +2023,15 @@ function main6(compiler) {
2019
2023
  const rc = context.setup.rc;
2020
2024
  const matcher = context.setup.matcher;
2021
2025
  const documents = context.shaken.documents.filter((document) => !matcher.isModuleIgnored(document.module));
2022
- const requestArtifact = await compiler.hooks.afterCompileKeqRequest.promise(
2023
- new Artifact({
2024
- id: "request",
2025
- filepath: "request",
2026
- content: await requestRenderer(),
2027
- extensionName: ".ts"
2028
- }),
2026
+ let requestArtifact = new Artifact({
2027
+ id: "request",
2028
+ filepath: "request",
2029
+ content: await requestRenderer(),
2030
+ extensionName: ".ts"
2031
+ });
2032
+ requestArtifact.addDependence("keq", ["KeqRequest"]);
2033
+ requestArtifact = await compiler.hooks.afterCompileKeqRequest.promise(
2034
+ requestArtifact,
2029
2035
  task
2030
2036
  );
2031
2037
  const schemaDefinitions = documents.flatMap((document) => document.schemas);
@@ -2268,6 +2274,7 @@ export {
2268
2274
  FileNamingStyle,
2269
2275
  ModuleDefinition,
2270
2276
  OperationDefinition,
2277
+ QsArrayFormat,
2271
2278
  RuntimeConfig,
2272
2279
  SchemaDefinition,
2273
2280
  defineKeqConfig