@povio/openapi-codegen-cli 2.0.8-rc.14 → 2.0.8-rc.16

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.
@@ -1,4 +1,4 @@
1
- import { a as deepMerge, p as DEFAULT_GENERATE_OPTIONS, r as writeGenerateFileData, t as generateCodeFromOpenAPIDoc, x as Profiler } from "./generateCodeFromOpenAPIDoc-BzDj8b_0.mjs";
1
+ import { a as deepMerge, p as DEFAULT_GENERATE_OPTIONS, r as writeGenerateFileData, t as generateCodeFromOpenAPIDoc, x as Profiler } from "./generateCodeFromOpenAPIDoc-ao1R1u57.mjs";
2
2
  import fs from "fs";
3
3
  import path from "path";
4
4
  import SwaggerParser from "@apidevtools/swagger-parser";
@@ -3986,7 +3986,7 @@ function renderAclCheckCall(resolver, endpoint, replacements, indent = "") {
3986
3986
  function addAsteriskAfterNewLine(str) {
3987
3987
  return str.replace(/\n/g, "\n *");
3988
3988
  }
3989
- function renderQueryJsDocs({ resolver, endpoint, mode }) {
3989
+ function renderQueryJsDocs({ resolver, endpoint, mode, tag }) {
3990
3990
  const lines = ["/** "];
3991
3991
  if (mode === "infiniteQuery") lines.push(` * Infinite query \`${getInfiniteQueryName(endpoint)}${endpoint.summary ? "" : ""}`);
3992
3992
  else if (mode === "query") lines.push(` * Query \`${getQueryName(endpoint)}\`${endpoint.summary && endpoint.mediaDownload ? " - recommended when file should be cached" : ""}`);
@@ -3994,13 +3994,16 @@ function renderQueryJsDocs({ resolver, endpoint, mode }) {
3994
3994
  if (endpoint.summary) lines.push(` * @summary ${addAsteriskAfterNewLine(endpoint.summary)}`);
3995
3995
  if (endpoint.description) lines.push(` * @description ${addAsteriskAfterNewLine(endpoint.description)}`);
3996
3996
  if (endpoint.acl) lines.push(` * @permission Requires \`${getAbilityFunctionName(endpoint)}\` ability `);
3997
- const params = getEndpointParamMapping(resolver, endpoint, { ...mode !== "infiniteQuery" ? { includeFileParam: true } : {} });
3997
+ const params = getEndpointParamMapping(resolver, endpoint, {
3998
+ ...mode !== "infiniteQuery" ? { includeFileParam: true } : {},
3999
+ modelNamespaceTag: tag
4000
+ });
3998
4001
  for (const endpointParam of params) lines.push(` * @param { ${endpointParam.type} } ${endpointParam.name} ${renderEndpointParamDescription(endpointParam)}`);
3999
4002
  if (mode === "query") lines.push(" * @param { AppQueryOptions } options Query options");
4000
4003
  else if (mode === "mutation") lines.push(` * @param { AppMutationOptions${resolver.options.mutationEffects ? ` & ${MUTATION_EFFECTS.optionsType}` : ""} } options Mutation options`);
4001
4004
  else lines.push(" * @param { AppInfiniteQueryOptions } options Infinite query options");
4002
4005
  const withAxiosResponse = endpoint.mediaDownload && mode !== "infiniteQuery";
4003
- const resultType = `${withAxiosResponse ? "AxiosResponse<" : ""}${getImportedZodSchemaInferedTypeName(resolver, endpoint.response)}${withAxiosResponse ? ">" : ""}`;
4006
+ const resultType = `${withAxiosResponse ? "AxiosResponse<" : ""}${getImportedZodSchemaInferedTypeName(resolver, endpoint.response, void 0, tag)}${withAxiosResponse ? ">" : ""}`;
4004
4007
  if (mode === "query") lines.push(` * @returns { UseQueryResult<${resultType}> } ${endpoint.responseDescription ?? ""}`);
4005
4008
  else if (mode === "mutation") lines.push(` * @returns { UseMutationResult<${resultType}> } ${endpoint.responseDescription ?? ""}`);
4006
4009
  else lines.push(` * @returns { UseInfiniteQueryResult<${resultType}> } ${endpoint.responseDescription ?? ""}`);
@@ -4081,10 +4084,14 @@ function renderInlineEndpointConfig(resolver, endpoint, modelNamespaceTag) {
4081
4084
  function renderQuery({ resolver, endpoint, inlineEndpoints }) {
4082
4085
  const hasAxiosRequestConfig = resolver.options.axiosRequestConfig;
4083
4086
  const hasAclCheck = resolver.options.checkAcl && endpoint.acl;
4087
+ const tag = getEndpointTag(endpoint, resolver.options);
4084
4088
  const workspaceParamReplacements = resolver.options.workspaceContext ? getWorkspaceParamReplacements(resolver, endpoint) : {};
4085
4089
  const endpointArgs = renderEndpointArgs(resolver, endpoint, {});
4086
4090
  const resolvedEndpointArgs = renderEndpointArgs(resolver, endpoint, {}, workspaceParamReplacements);
4087
- const endpointParams = renderEndpointParams(resolver, endpoint, { optionalPathParams: resolver.options.workspaceContext });
4091
+ const endpointParams = renderEndpointParams(resolver, endpoint, {
4092
+ optionalPathParams: resolver.options.workspaceContext,
4093
+ modelNamespaceTag: tag
4094
+ });
4088
4095
  const hasQueryFn = endpointArgs.length > 0 || hasAxiosRequestConfig || hasAclCheck;
4089
4096
  const hasQueryFnBody = Boolean(hasAclCheck) || Object.keys(workspaceParamReplacements).length > 0;
4090
4097
  const importedEndpoint = inlineEndpoints ? getEndpointName(endpoint) : getImportedEndpointName(endpoint, resolver.options);
@@ -4092,10 +4099,10 @@ function renderQuery({ resolver, endpoint, inlineEndpoints }) {
4092
4099
  lines.push(renderQueryJsDocs({
4093
4100
  resolver,
4094
4101
  endpoint,
4095
- mode: "query"
4102
+ mode: "query",
4103
+ tag
4096
4104
  }));
4097
4105
  lines.push(`export const ${getQueryName(endpoint)} = <TData>(${endpointParams ? `{ ${endpointArgs} }: { ${endpointParams} }, ` : ""}options?: AppQueryOptions<typeof ${importedEndpoint}, TData>${hasAxiosRequestConfig ? `, ${AXIOS_REQUEST_CONFIG_NAME}?: ${AXIOS_REQUEST_CONFIG_TYPE}` : ""}) => {`);
4098
- lines.push(" const queryConfig = OpenApiQueryConfig.useConfig();");
4099
4106
  if (hasAclCheck) lines.push(` const { checkAcl } = ${ACL_CHECK_HOOK}();`);
4100
4107
  lines.push(...renderWorkspaceParamResolutions({
4101
4108
  replacements: workspaceParamReplacements,
@@ -4118,10 +4125,12 @@ function renderMutation({ resolver, endpoint, inlineEndpoints, precomputed }) {
4118
4125
  const hasAclCheck = resolver.options.checkAcl && endpoint.acl;
4119
4126
  const hasMutationEffects = resolver.options.mutationEffects;
4120
4127
  const hasAxiosRequestConfig = resolver.options.axiosRequestConfig;
4128
+ const tag = getEndpointTag(endpoint, resolver.options);
4121
4129
  const workspaceParamReplacements = resolver.options.workspaceContext ? getWorkspaceParamReplacements(resolver, endpoint) : {};
4122
4130
  const endpointParams = renderEndpointParams(resolver, endpoint, {
4123
4131
  includeFileParam: true,
4124
- optionalPathParams: resolver.options.workspaceContext
4132
+ optionalPathParams: resolver.options.workspaceContext,
4133
+ modelNamespaceTag: tag
4125
4134
  });
4126
4135
  const resolvedEndpointArgs = renderEndpointArgs(resolver, endpoint, {}, workspaceParamReplacements);
4127
4136
  const destructuredMutationArgs = renderEndpointArgs(resolver, endpoint, { includeFileParam: true });
@@ -4134,7 +4143,8 @@ function renderMutation({ resolver, endpoint, inlineEndpoints, precomputed }) {
4134
4143
  lines.push(renderQueryJsDocs({
4135
4144
  resolver,
4136
4145
  endpoint,
4137
- mode: "mutation"
4146
+ mode: "mutation",
4147
+ tag
4138
4148
  }));
4139
4149
  lines.push(`export const ${getQueryName(endpoint, true)} = (options?: AppMutationOptions<typeof ${endpointFunction}, { ${mutationVariablesType} }>${hasMutationEffects ? ` & ${MUTATION_EFFECTS.optionsType}` : ""}${hasAxiosRequestConfig ? `, ${AXIOS_REQUEST_CONFIG_NAME}?: ${AXIOS_REQUEST_CONFIG_TYPE}` : ""}) => {`);
4140
4150
  lines.push(" const queryConfig = OpenApiQueryConfig.useConfig();");
@@ -4234,14 +4244,15 @@ function groupEndpoints(endpoints, resolver) {
4234
4244
  function renderInfiniteQuery({ resolver, endpoint, inlineEndpoints }) {
4235
4245
  const hasAclCheck = resolver.options.checkAcl && endpoint.acl;
4236
4246
  const hasAxiosRequestConfig = resolver.options.axiosRequestConfig;
4247
+ const tag = getEndpointTag(endpoint, resolver.options);
4237
4248
  const workspaceParamReplacements = resolver.options.workspaceContext ? getWorkspaceParamReplacements(resolver, endpoint) : {};
4238
4249
  const endpointParams = renderEndpointParams(resolver, endpoint, {
4239
4250
  excludePageParam: true,
4240
- optionalPathParams: resolver.options.workspaceContext
4251
+ optionalPathParams: resolver.options.workspaceContext,
4252
+ modelNamespaceTag: tag
4241
4253
  });
4242
4254
  const endpointArgsWithoutPage = renderEndpointArgs(resolver, endpoint, { excludePageParam: true });
4243
4255
  const resolvedEndpointArgsWithoutPage = renderEndpointArgs(resolver, endpoint, { excludePageParam: true }, workspaceParamReplacements);
4244
- renderEndpointArgs(resolver, endpoint, { replacePageParam: true });
4245
4256
  const resolvedEndpointArgsWithPage = renderEndpointArgs(resolver, endpoint, { replacePageParam: true }, workspaceParamReplacements);
4246
4257
  const endpointFunction = inlineEndpoints ? getEndpointName(endpoint) : getImportedEndpointName(endpoint, resolver.options);
4247
4258
  const hasQueryFnBody = Boolean(hasAclCheck) || Object.keys(workspaceParamReplacements).length > 0;
@@ -4249,10 +4260,10 @@ function renderInfiniteQuery({ resolver, endpoint, inlineEndpoints }) {
4249
4260
  lines.push(renderQueryJsDocs({
4250
4261
  resolver,
4251
4262
  endpoint,
4252
- mode: "infiniteQuery"
4263
+ mode: "infiniteQuery",
4264
+ tag
4253
4265
  }));
4254
4266
  lines.push(`export const ${getInfiniteQueryName(endpoint)} = <TData>(${endpointParams ? `{ ${endpointArgsWithoutPage} }: { ${endpointParams} }, ` : ""}options?: AppInfiniteQueryOptions<typeof ${endpointFunction}, TData>${hasAxiosRequestConfig ? `, ${AXIOS_REQUEST_CONFIG_NAME}?: ${AXIOS_REQUEST_CONFIG_TYPE}` : ""}) => {`);
4255
- lines.push(" const queryConfig = OpenApiQueryConfig.useConfig();");
4256
4267
  if (hasAclCheck) lines.push(` const { checkAcl } = ${ACL_CHECK_HOOK}();`);
4257
4268
  lines.push(...renderWorkspaceParamResolutions({
4258
4269
  replacements: workspaceParamReplacements,
@@ -1,4 +1,4 @@
1
- import { _ as isMediaTypeAllowed, b as formatTag, c as getSchemaTsMetaType, d as getTagImportPath, f as getQueryName, h as GenerateType, i as getDataFromOpenAPIDoc, l as getTsTypeBase, m as getNamespaceName, o as isMutation, p as DEFAULT_GENERATE_OPTIONS, s as isQuery, t as generateCodeFromOpenAPIDoc, v as isParamMediaTypeAllowed, y as invalidVariableNameCharactersToCamel } from "./generateCodeFromOpenAPIDoc-BzDj8b_0.mjs";
1
+ import { _ as isMediaTypeAllowed, b as formatTag, c as getSchemaTsMetaType, d as getTagImportPath, f as getQueryName, h as GenerateType, i as getDataFromOpenAPIDoc, l as getTsTypeBase, m as getNamespaceName, o as isMutation, p as DEFAULT_GENERATE_OPTIONS, s as isQuery, t as generateCodeFromOpenAPIDoc, v as isParamMediaTypeAllowed, y as invalidVariableNameCharactersToCamel } from "./generateCodeFromOpenAPIDoc-ao1R1u57.mjs";
2
2
  import SwaggerParser from "@apidevtools/swagger-parser";
3
3
 
4
4
  //#region src/generators/core/getMetadataFromOpenAPIDoc.ts
package/dist/sh.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { S as VALIDATION_ERROR_TYPE_TITLE, g as groupByType, h as GenerateType, i as getDataFromOpenAPIDoc, n as getOutputFileName, u as getTagFileName, x as Profiler } from "./generateCodeFromOpenAPIDoc-BzDj8b_0.mjs";
3
- import { n as resolveConfig, t as runGenerate } from "./generate.runner-D5SXtGjD.mjs";
2
+ import { S as VALIDATION_ERROR_TYPE_TITLE, g as groupByType, h as GenerateType, i as getDataFromOpenAPIDoc, n as getOutputFileName, u as getTagFileName, x as Profiler } from "./generateCodeFromOpenAPIDoc-ao1R1u57.mjs";
3
+ import { n as resolveConfig, t as runGenerate } from "./generate.runner-DF2eZ4P-.mjs";
4
4
  import { createRequire } from "node:module";
5
5
  import yargs from "yargs";
6
6
  import { hideBin } from "yargs/helpers";
@@ -39,7 +39,7 @@ function logBanner(message) {
39
39
  * Fetch the version from package.json
40
40
  */
41
41
  function getVersion() {
42
- return "2.0.8-rc.14";
42
+ return "2.0.8-rc.16";
43
43
  }
44
44
 
45
45
  //#endregion
package/dist/vite.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { x as Profiler } from "./generateCodeFromOpenAPIDoc-BzDj8b_0.mjs";
2
- import { t as runGenerate } from "./generate.runner-D5SXtGjD.mjs";
1
+ import { x as Profiler } from "./generateCodeFromOpenAPIDoc-ao1R1u57.mjs";
2
+ import { t as runGenerate } from "./generate.runner-DF2eZ4P-.mjs";
3
3
  import path from "path";
4
4
 
5
5
  //#region src/vite/openapi-codegen.plugin.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@povio/openapi-codegen-cli",
3
- "version": "2.0.8-rc.14",
3
+ "version": "2.0.8-rc.16",
4
4
  "keywords": [
5
5
  "codegen",
6
6
  "openapi",