@povio/openapi-codegen-cli 3.0.0 → 3.0.1-rc.1
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/{generate.runner-BXTc97I0.mjs → generate.runner-DnUDkoAZ.mjs} +1 -1
- package/dist/{generateCodeFromOpenAPIDoc-C-n0Knj8.mjs → generateCodeFromOpenAPIDoc-CbQ9gQss.mjs} +11 -6
- package/dist/generator.mjs +1 -1
- package/dist/metro.mjs +3 -3
- package/dist/{openapi-codegen.runner-QGd35-a3.mjs → openapi-codegen.runner-Bht20Dfx.mjs} +2 -2
- package/dist/sh.mjs +3 -3
- package/dist/vite.mjs +3 -3
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as Profiler, h as deepMerge, i as writeGenerateFileData, p as DEFAULT_GENERATE_OPTIONS, r as removeStaleGeneratedFiles, t as generateCodeFromOpenAPIDoc } from "./generateCodeFromOpenAPIDoc-
|
|
1
|
+
import { S as Profiler, h as deepMerge, i as writeGenerateFileData, p as DEFAULT_GENERATE_OPTIONS, r as removeStaleGeneratedFiles, t as generateCodeFromOpenAPIDoc } from "./generateCodeFromOpenAPIDoc-CbQ9gQss.mjs";
|
|
2
2
|
import path from "path";
|
|
3
3
|
import SwaggerParser from "@apidevtools/swagger-parser";
|
|
4
4
|
|
package/dist/{generateCodeFromOpenAPIDoc-C-n0Knj8.mjs → generateCodeFromOpenAPIDoc-CbQ9gQss.mjs}
RENAMED
|
@@ -4507,6 +4507,9 @@ function renderInlineRequestInfo(resolver, endpoint, tag) {
|
|
|
4507
4507
|
function getRequestConfigType() {
|
|
4508
4508
|
return `${AXIOS_REQUEST_CONFIG_TYPE} & { allowInvalidResponseData?: boolean }`;
|
|
4509
4509
|
}
|
|
4510
|
+
function renderRequestConfigWithSignal(hasRequestConfigParam) {
|
|
4511
|
+
return `{ ${hasRequestConfigParam ? `...${AXIOS_REQUEST_CONFIG_NAME}, ` : ""}signal }`;
|
|
4512
|
+
}
|
|
4510
4513
|
function renderInlineEndpointParamParse(resolver, param, paramName, modelNamespaceTag) {
|
|
4511
4514
|
const addOptional = !(param.parameterObject ?? param.bodyObject)?.required && (Boolean(param.parameterSortingEnumSchemaName) || isNamedZodSchema(param.zodSchema));
|
|
4512
4515
|
const schemaValue = param.parameterSortingEnumSchemaName ? `${ZOD_EXTENDED.namespace}.${ZOD_EXTENDED.exports.sortExp}(${getImportedZodSchemaName(resolver, param.parameterSortingEnumSchemaName, modelNamespaceTag)})${getSortingPresenceChain(resolver, param)}` : `${getImportedZodSchemaName(resolver, param.zodSchema, modelNamespaceTag)}${addOptional ? ".optional()" : ""}`;
|
|
@@ -4553,7 +4556,8 @@ function renderQueryOptions({ resolver, endpoint, inlineEndpoints }) {
|
|
|
4553
4556
|
const lines = [];
|
|
4554
4557
|
lines.push(`const ${getQueryOptionsName(endpoint)} = (${endpointParams ? `{ ${endpointArgs} }: { ${endpointParams} }` : ""}${hasRequestConfigParam ? `${endpointParams ? ", " : ""}${AXIOS_REQUEST_CONFIG_NAME}?: ${getRequestConfigType()}` : ""}) => ({`);
|
|
4555
4558
|
lines.push(` queryKey: keys.${getEndpointName(endpoint)}(${endpointArgs}),`);
|
|
4556
|
-
|
|
4559
|
+
const requestConfigWithSignal = renderRequestConfigWithSignal(hasRequestConfigParam);
|
|
4560
|
+
lines.push(` queryFn: ({ signal }: { signal: AbortSignal }) => ${endpointFunction}(${endpointArgs}${hasRequestConfigParam ? `${endpointArgs ? ", " : ""}${requestConfigWithSignal}` : ""}),`);
|
|
4557
4561
|
lines.push("});");
|
|
4558
4562
|
return lines.join("\n");
|
|
4559
4563
|
}
|
|
@@ -4569,7 +4573,8 @@ function renderInfiniteQueryOptions({ resolver, endpoint, inlineEndpoints }) {
|
|
|
4569
4573
|
const lines = [];
|
|
4570
4574
|
lines.push(`const ${getInfiniteQueryOptionsName(endpoint)} = (${endpointParams ? `{ ${endpointArgsWithoutPage} }: { ${endpointParams} }` : ""}${hasRequestConfigParam ? `${endpointParams ? ", " : ""}${AXIOS_REQUEST_CONFIG_NAME}?: ${getRequestConfigType()}` : ""}) => ({`);
|
|
4571
4575
|
lines.push(` queryKey: keys.${getEndpointName(endpoint)}Infinite(${endpointArgsWithoutPage}),`);
|
|
4572
|
-
|
|
4576
|
+
const requestConfigWithSignal = renderRequestConfigWithSignal(hasRequestConfigParam);
|
|
4577
|
+
lines.push(` queryFn: ({ pageParam, signal }: { pageParam: number; signal: AbortSignal }) => ${endpointFunction}(${endpointArgsWithPage}${hasRequestConfigParam ? `, ${requestConfigWithSignal}` : ""}),`);
|
|
4573
4578
|
lines.push(" initialPageParam: 1,");
|
|
4574
4579
|
lines.push(` getNextPageParam: ({ ${resolver.options.infiniteQueryResponseParamNames.page}, ${resolver.options.infiniteQueryResponseParamNames.totalItems}, ${resolver.options.infiniteQueryResponseParamNames.limit}: limitParam }: Awaited<ReturnType<typeof ${endpointFunction}>>) => {`);
|
|
4575
4580
|
lines.push(` const pageParam = ${resolver.options.infiniteQueryResponseParamNames.page} ?? 1;`);
|
|
@@ -4637,9 +4642,9 @@ function renderQuery({ resolver, endpoint, inlineEndpoints }) {
|
|
|
4637
4642
|
lines.push(` return ${QUERY_HOOKS.query}({`);
|
|
4638
4643
|
lines.push(` ...${queryOptionsName}(${queryOptionsArgs}),`);
|
|
4639
4644
|
if (hasQueryFnOverride) {
|
|
4640
|
-
lines.push(" queryFn: async () => {");
|
|
4645
|
+
lines.push(" queryFn: async ({ signal }: { signal: AbortSignal }) => {");
|
|
4641
4646
|
if (hasAclCheck) lines.push(renderAclCheckCall(resolver, endpoint, workspaceParamReplacements, " "));
|
|
4642
|
-
lines.push(` return ${queryOptionsName}(${queryOptionsArgs}).queryFn();`);
|
|
4647
|
+
lines.push(` return ${queryOptionsName}(${queryOptionsArgs}).queryFn({ signal });`);
|
|
4643
4648
|
lines.push(" },");
|
|
4644
4649
|
}
|
|
4645
4650
|
lines.push(" ...options,");
|
|
@@ -4826,9 +4831,9 @@ function renderInfiniteQuery({ resolver, endpoint, inlineEndpoints }) {
|
|
|
4826
4831
|
lines.push(` return ${QUERY_HOOKS.infiniteQuery}({`);
|
|
4827
4832
|
lines.push(` ...${queryOptionsName}(${queryOptionsArgs}),`);
|
|
4828
4833
|
if (hasQueryFnOverride) {
|
|
4829
|
-
lines.push(" queryFn: async ({ pageParam }) => {");
|
|
4834
|
+
lines.push(" queryFn: async ({ pageParam, signal }: { pageParam: number; signal: AbortSignal }) => {");
|
|
4830
4835
|
lines.push(renderAclCheckCall(resolver, endpoint, workspaceParamReplacements, " "));
|
|
4831
|
-
lines.push(` return ${queryOptionsName}(${queryOptionsArgs}).queryFn({ pageParam });`);
|
|
4836
|
+
lines.push(` return ${queryOptionsName}(${queryOptionsArgs}).queryFn({ pageParam, signal });`);
|
|
4832
4837
|
lines.push(" },");
|
|
4833
4838
|
}
|
|
4834
4839
|
lines.push(" ...options,");
|
package/dist/generator.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as getNamespaceName, a as getDataFromOpenAPIDoc, b as isParamMediaTypeAllowed, c as getSchemaTsMetaType, d as getTagImportPath, f as getQueryName, g as invalidVariableNameCharactersToCamel, l as getTsTypeBase, o as isMutation, p as DEFAULT_GENERATE_OPTIONS, s as isQuery, t as generateCodeFromOpenAPIDoc, v as GenerateType, x as formatTag, y as isMediaTypeAllowed } from "./generateCodeFromOpenAPIDoc-
|
|
1
|
+
import { _ as getNamespaceName, a as getDataFromOpenAPIDoc, b as isParamMediaTypeAllowed, c as getSchemaTsMetaType, d as getTagImportPath, f as getQueryName, g as invalidVariableNameCharactersToCamel, l as getTsTypeBase, o as isMutation, p as DEFAULT_GENERATE_OPTIONS, s as isQuery, t as generateCodeFromOpenAPIDoc, v as GenerateType, x as formatTag, y as isMediaTypeAllowed } from "./generateCodeFromOpenAPIDoc-CbQ9gQss.mjs";
|
|
2
2
|
import SwaggerParser from "@apidevtools/swagger-parser";
|
|
3
3
|
|
|
4
4
|
//#region src/generators/core/getMetadataFromOpenAPIDoc.ts
|
package/dist/metro.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import "./generateCodeFromOpenAPIDoc-
|
|
2
|
-
import "./generate.runner-
|
|
3
|
-
import { t as createOpenApiCodegenRunner } from "./openapi-codegen.runner-
|
|
1
|
+
import "./generateCodeFromOpenAPIDoc-CbQ9gQss.mjs";
|
|
2
|
+
import "./generate.runner-DnUDkoAZ.mjs";
|
|
3
|
+
import { t as createOpenApiCodegenRunner } from "./openapi-codegen.runner-Bht20Dfx.mjs";
|
|
4
4
|
import fs from "fs";
|
|
5
5
|
import path from "path";
|
|
6
6
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { S as Profiler } from "./generateCodeFromOpenAPIDoc-
|
|
2
|
-
import { t as runGenerate } from "./generate.runner-
|
|
1
|
+
import { S as Profiler } from "./generateCodeFromOpenAPIDoc-CbQ9gQss.mjs";
|
|
2
|
+
import { t as runGenerate } from "./generate.runner-DnUDkoAZ.mjs";
|
|
3
3
|
import path from "path";
|
|
4
4
|
|
|
5
5
|
//#region src/plugins/openapi-codegen.runner.ts
|
package/dist/sh.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { C as VALIDATION_ERROR_TYPE_TITLE, S as Profiler, a as getDataFromOpenAPIDoc, m as groupByType, n as getOutputFileName, u as getTagFileName, v as GenerateType } from "./generateCodeFromOpenAPIDoc-
|
|
3
|
-
import { n as resolveConfig, t as runGenerate } from "./generate.runner-
|
|
2
|
+
import { C as VALIDATION_ERROR_TYPE_TITLE, S as Profiler, a as getDataFromOpenAPIDoc, m as groupByType, n as getOutputFileName, u as getTagFileName, v as GenerateType } from "./generateCodeFromOpenAPIDoc-CbQ9gQss.mjs";
|
|
3
|
+
import { n as resolveConfig, t as runGenerate } from "./generate.runner-DnUDkoAZ.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 "3.0.
|
|
42
|
+
return "3.0.1-rc.1";
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
//#endregion
|
package/dist/vite.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import "./generateCodeFromOpenAPIDoc-
|
|
2
|
-
import "./generate.runner-
|
|
3
|
-
import { t as createOpenApiCodegenRunner } from "./openapi-codegen.runner-
|
|
1
|
+
import "./generateCodeFromOpenAPIDoc-CbQ9gQss.mjs";
|
|
2
|
+
import "./generate.runner-DnUDkoAZ.mjs";
|
|
3
|
+
import { t as createOpenApiCodegenRunner } from "./openapi-codegen.runner-Bht20Dfx.mjs";
|
|
4
4
|
import path from "path";
|
|
5
5
|
|
|
6
6
|
//#region src/vite/openapi-codegen.plugin.ts
|
package/package.json
CHANGED