@povio/openapi-codegen-cli 2.0.8-rc.15 → 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-CxXf-IaZ.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,7 +4099,8 @@ 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
4106
  if (hasAclCheck) lines.push(` const { checkAcl } = ${ACL_CHECK_HOOK}();`);
@@ -4117,10 +4125,12 @@ function renderMutation({ resolver, endpoint, inlineEndpoints, precomputed }) {
4117
4125
  const hasAclCheck = resolver.options.checkAcl && endpoint.acl;
4118
4126
  const hasMutationEffects = resolver.options.mutationEffects;
4119
4127
  const hasAxiosRequestConfig = resolver.options.axiosRequestConfig;
4128
+ const tag = getEndpointTag(endpoint, resolver.options);
4120
4129
  const workspaceParamReplacements = resolver.options.workspaceContext ? getWorkspaceParamReplacements(resolver, endpoint) : {};
4121
4130
  const endpointParams = renderEndpointParams(resolver, endpoint, {
4122
4131
  includeFileParam: true,
4123
- optionalPathParams: resolver.options.workspaceContext
4132
+ optionalPathParams: resolver.options.workspaceContext,
4133
+ modelNamespaceTag: tag
4124
4134
  });
4125
4135
  const resolvedEndpointArgs = renderEndpointArgs(resolver, endpoint, {}, workspaceParamReplacements);
4126
4136
  const destructuredMutationArgs = renderEndpointArgs(resolver, endpoint, { includeFileParam: true });
@@ -4133,7 +4143,8 @@ function renderMutation({ resolver, endpoint, inlineEndpoints, precomputed }) {
4133
4143
  lines.push(renderQueryJsDocs({
4134
4144
  resolver,
4135
4145
  endpoint,
4136
- mode: "mutation"
4146
+ mode: "mutation",
4147
+ tag
4137
4148
  }));
4138
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}` : ""}) => {`);
4139
4150
  lines.push(" const queryConfig = OpenApiQueryConfig.useConfig();");
@@ -4233,14 +4244,15 @@ function groupEndpoints(endpoints, resolver) {
4233
4244
  function renderInfiniteQuery({ resolver, endpoint, inlineEndpoints }) {
4234
4245
  const hasAclCheck = resolver.options.checkAcl && endpoint.acl;
4235
4246
  const hasAxiosRequestConfig = resolver.options.axiosRequestConfig;
4247
+ const tag = getEndpointTag(endpoint, resolver.options);
4236
4248
  const workspaceParamReplacements = resolver.options.workspaceContext ? getWorkspaceParamReplacements(resolver, endpoint) : {};
4237
4249
  const endpointParams = renderEndpointParams(resolver, endpoint, {
4238
4250
  excludePageParam: true,
4239
- optionalPathParams: resolver.options.workspaceContext
4251
+ optionalPathParams: resolver.options.workspaceContext,
4252
+ modelNamespaceTag: tag
4240
4253
  });
4241
4254
  const endpointArgsWithoutPage = renderEndpointArgs(resolver, endpoint, { excludePageParam: true });
4242
4255
  const resolvedEndpointArgsWithoutPage = renderEndpointArgs(resolver, endpoint, { excludePageParam: true }, workspaceParamReplacements);
4243
- renderEndpointArgs(resolver, endpoint, { replacePageParam: true });
4244
4256
  const resolvedEndpointArgsWithPage = renderEndpointArgs(resolver, endpoint, { replacePageParam: true }, workspaceParamReplacements);
4245
4257
  const endpointFunction = inlineEndpoints ? getEndpointName(endpoint) : getImportedEndpointName(endpoint, resolver.options);
4246
4258
  const hasQueryFnBody = Boolean(hasAclCheck) || Object.keys(workspaceParamReplacements).length > 0;
@@ -4248,10 +4260,10 @@ function renderInfiniteQuery({ resolver, endpoint, inlineEndpoints }) {
4248
4260
  lines.push(renderQueryJsDocs({
4249
4261
  resolver,
4250
4262
  endpoint,
4251
- mode: "infiniteQuery"
4263
+ mode: "infiniteQuery",
4264
+ tag
4252
4265
  }));
4253
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}` : ""}) => {`);
4254
- lines.push(" const queryConfig = OpenApiQueryConfig.useConfig();");
4255
4267
  if (hasAclCheck) lines.push(` const { checkAcl } = ${ACL_CHECK_HOOK}();`);
4256
4268
  lines.push(...renderWorkspaceParamResolutions({
4257
4269
  replacements: workspaceParamReplacements,
@@ -4269,7 +4281,6 @@ function renderInfiniteQuery({ resolver, endpoint, inlineEndpoints }) {
4269
4281
  lines.push(` return pageParam * limitParam < ${resolver.options.infiniteQueryResponseParamNames.totalItems} ? pageParam + 1 : null;`);
4270
4282
  lines.push(" },");
4271
4283
  lines.push(" ...options,");
4272
- lines.push(" onError: options?.onError ?? queryConfig.onError,");
4273
4284
  lines.push(" });");
4274
4285
  lines.push("};");
4275
4286
  return lines.join("\n");
@@ -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-CxXf-IaZ.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-CxXf-IaZ.mjs";
3
- import { n as resolveConfig, t as runGenerate } from "./generate.runner-tAVdp_fl.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.15";
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-CxXf-IaZ.mjs";
2
- import { t as runGenerate } from "./generate.runner-tAVdp_fl.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.15",
3
+ "version": "2.0.8-rc.16",
4
4
  "keywords": [
5
5
  "codegen",
6
6
  "openapi",