@povio/openapi-codegen-cli 3.2.0-rc.12 → 3.2.0-rc.14

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 { D as getTagFileName, Wn as Profiler, a as writeGenerateFileData, dt as DEFAULT_GENERATE_OPTIONS, i as removeStaleGeneratedFiles, n as shouldUseNativeCodegen, o as deepMerge, r as getOutputFileName, t as compileNativeData } from "./native-bindings-BTQGSGhU.mjs";
1
+ import { D as getTagFileName, Wn as Profiler, a as writeGenerateFileData, dt as DEFAULT_GENERATE_OPTIONS, i as removeStaleGeneratedFiles, n as shouldUseNativeCodegen, o as deepMerge, r as getOutputFileName, t as compileNativeData } from "./native-bindings-DHQGvV7n.mjs";
2
2
  import fs from "fs";
3
3
  import path from "path";
4
4
  //#region src/generators/core/resolveConfig.ts
@@ -93,7 +93,7 @@ async function runGenerate({ fileConfig, params, formatGeneratedFile, profiler =
93
93
  const nativeFiles = generateFilesFromNativeOpenAPI(nativeInput.source, nativeInput.yaml, config);
94
94
  if (nativeFiles) return nativeFiles;
95
95
  }
96
- const { generateCodeFromOpenAPIDoc } = await import("./generateCodeFromOpenAPIDoc-DN2g91cW.mjs").then((n) => n.n);
96
+ const { generateCodeFromOpenAPIDoc } = await import("./generateCodeFromOpenAPIDoc-D9AxX3_a.mjs").then((n) => n.n);
97
97
  return generateCodeFromOpenAPIDoc(openApiDoc, config, profiler, {
98
98
  source: nativeInput.source,
99
99
  yaml: nativeInput.yaml
@@ -1145,9 +1145,9 @@ function renderMediaUploadMutationBody({ resolver, endpointFunction, resolvedEnd
1145
1145
  " let dataToSend: File | FormData = file;",
1146
1146
  " if (method === \"post\") {",
1147
1147
  " dataToSend = new FormData();",
1148
- " if (uploadInstructions.fields) {",
1149
- " for (const [key, value] of uploadInstructions.fields) {",
1150
- " dataToSend.append(key, value);",
1148
+ " if (\"fields\" in uploadInstructions && uploadInstructions.fields) {",
1149
+ " for (const [key, value] of Object.entries(uploadInstructions.fields)) {",
1150
+ " dataToSend.append(key, String(value));",
1151
1151
  " }",
1152
1152
  " }",
1153
1153
  " dataToSend.append(\"file\", file);",
@@ -1,5 +1,5 @@
1
- import { r as getZodSchemaRefs, t as getDataFromOpenAPIDoc } from "./getDataFromOpenAPIDoc-hQ6YoDgR.mjs";
2
- import { $ as getImportedAbilityFunctionName, A as getEndpointsImports, An as NATIVE_RESPONSE_TYPE, At as APP_REST_CLIENT_NAME, B as getPrefetchInfiniteQueryName, Bt as PACKAGE_IMPORT_PATH, C as getAppRestClientImportPath, Cn as ZOD_IMPORT, D as getTagFileName, Dn as AXIOS_REQUEST_CONFIG_TYPE, Dt as isEnumZodSchema, E as getQueryTypesImportPath, En as AXIOS_REQUEST_CONFIG_NAME, F as mergeImports, Ft as QUERY_MODULE_ENUM, G as getAbilityConditionType, H as getQueryName, Ht as getNamespaceName, I as getImportedInfiniteQueryName, In as shouldInlineEndpointsForTag, It as QUERY_OPTIONS_TYPES, J as getAbilityFunctionName, K as getAbilityConditionsTypes, L as getImportedQueryName, Ln as camelToSpaceSeparated, Lt as ZOD_EXTENDED, M as getInfiniteQueriesImports, Mt as DOMAIN_ERRORS_FILE, N as getModelsImports, Nn as getEndpointTag, Nt as MUTATION_EFFECTS, O as getTagImportPath, Ot as isNamedZodSchema, P as getQueriesImports, Pt as QUERY_MODULES_FILE, Q as getAppAbilitiesType, R as getInfiniteQueryName, Rn as capitalize, Rt as CONFIG_PACKAGE_IMPORT_PATH, T as getQueryModulesImportPath, Tn as AXIOS_IMPORT, U as getQueryOptionsName, V as getPrefetchQueryName, Vn as kebabToCamel, Vt as REST_PACKAGE_IMPORT_PATH, W as getAbilityAction, Wn as Profiler, X as getAbilitySubjectTypes, Y as getAbilitySubject, Z as getAclData, Zt as isParamMediaTypeAllowed, _ as hasEndpointConfig, _t as isReadAllEndpoint, an as wrapWithQuotesIfNeeded, at as getZodSchemaInferedTypeName, b as requiresBody, bt as invalidVariableNameCharactersToCamel, c as getDestructuredVariables, cn as isReferenceObject, ct as getSchemaDescriptions, d as isQuery, dt as DEFAULT_GENERATE_OPTIONS, et as hasAbilityConditions, f as getEndpointBody, fn as ANY_SCHEMA, ft as getPathSegments, g as getImportedEndpointName, gt as isPathSegmentParam, h as getEndpointPath, ht as isDeleteEndpoint, it as getZodSchemaDescription, j as getImportPath, jn as getRequestConfigTypeName, jt as BUILDERS_UTILS, k as getAclImports, kn as JSON_APPLICATION_FORMAT, kt as APP_REST_CLIENT_FILE, l as isInfiniteQuery, ln as isSchemaObject, m as getEndpointName, mt as isCreateEndpoint, n as shouldUseNativeCodegen, nt as getImportedZodSchemaInferedTypeName, ot as getZodSchemaPropertyDescriptions, p as getEndpointConfig, pt as isBulkDeleteEndpoint, q as getAbilityDescription, r as getOutputFileName, rt as getImportedZodSchemaName, st as getZodSchemaType, t as compileNativeData, tt as renderAclCheckCall, u as isMutation, ut as getUniqueArray, v as mapEndpointParamsToFunctionParams, vt as isReadEndpoint, w as getFileNameWithExtension, wn as AXIOS_DEFAULT_IMPORT_NAME, y as renderMediaUploadMutationBody, yt as isUpdateEndpoint, z as getInfiniteQueryOptionsName, zt as NATIVE_PACKAGE_IMPORT_PATH } from "./native-bindings-BTQGSGhU.mjs";
1
+ import { r as getZodSchemaRefs, t as getDataFromOpenAPIDoc } from "./getDataFromOpenAPIDoc-Dj0cdt9r.mjs";
2
+ import { $ as getImportedAbilityFunctionName, A as getEndpointsImports, An as NATIVE_RESPONSE_TYPE, At as APP_REST_CLIENT_NAME, B as getPrefetchInfiniteQueryName, Bt as PACKAGE_IMPORT_PATH, C as getAppRestClientImportPath, Cn as ZOD_IMPORT, D as getTagFileName, Dn as AXIOS_REQUEST_CONFIG_TYPE, Dt as isEnumZodSchema, E as getQueryTypesImportPath, En as AXIOS_REQUEST_CONFIG_NAME, F as mergeImports, Ft as QUERY_MODULE_ENUM, G as getAbilityConditionType, H as getQueryName, Ht as getNamespaceName, I as getImportedInfiniteQueryName, In as shouldInlineEndpointsForTag, It as QUERY_OPTIONS_TYPES, J as getAbilityFunctionName, K as getAbilityConditionsTypes, L as getImportedQueryName, Ln as camelToSpaceSeparated, Lt as ZOD_EXTENDED, M as getInfiniteQueriesImports, Mt as DOMAIN_ERRORS_FILE, N as getModelsImports, Nn as getEndpointTag, Nt as MUTATION_EFFECTS, O as getTagImportPath, Ot as isNamedZodSchema, P as getQueriesImports, Pt as QUERY_MODULES_FILE, Q as getAppAbilitiesType, R as getInfiniteQueryName, Rn as capitalize, Rt as CONFIG_PACKAGE_IMPORT_PATH, T as getQueryModulesImportPath, Tn as AXIOS_IMPORT, U as getQueryOptionsName, V as getPrefetchQueryName, Vn as kebabToCamel, Vt as REST_PACKAGE_IMPORT_PATH, W as getAbilityAction, Wn as Profiler, X as getAbilitySubjectTypes, Y as getAbilitySubject, Z as getAclData, Zt as isParamMediaTypeAllowed, _ as hasEndpointConfig, _t as isReadAllEndpoint, an as wrapWithQuotesIfNeeded, at as getZodSchemaInferedTypeName, b as requiresBody, bt as invalidVariableNameCharactersToCamel, c as getDestructuredVariables, cn as isReferenceObject, ct as getSchemaDescriptions, d as isQuery, dt as DEFAULT_GENERATE_OPTIONS, et as hasAbilityConditions, f as getEndpointBody, fn as ANY_SCHEMA, ft as getPathSegments, g as getImportedEndpointName, gt as isPathSegmentParam, h as getEndpointPath, ht as isDeleteEndpoint, it as getZodSchemaDescription, j as getImportPath, jn as getRequestConfigTypeName, jt as BUILDERS_UTILS, k as getAclImports, kn as JSON_APPLICATION_FORMAT, kt as APP_REST_CLIENT_FILE, l as isInfiniteQuery, ln as isSchemaObject, m as getEndpointName, mt as isCreateEndpoint, n as shouldUseNativeCodegen, nt as getImportedZodSchemaInferedTypeName, ot as getZodSchemaPropertyDescriptions, p as getEndpointConfig, pt as isBulkDeleteEndpoint, q as getAbilityDescription, r as getOutputFileName, rt as getImportedZodSchemaName, st as getZodSchemaType, t as compileNativeData, tt as renderAclCheckCall, u as isMutation, ut as getUniqueArray, v as mapEndpointParamsToFunctionParams, vt as isReadEndpoint, w as getFileNameWithExtension, wn as AXIOS_DEFAULT_IMPORT_NAME, y as renderMediaUploadMutationBody, yt as isUpdateEndpoint, z as getInfiniteQueryOptionsName, zt as NATIVE_PACKAGE_IMPORT_PATH } from "./native-bindings-DHQGvV7n.mjs";
3
3
  import "node:module";
4
4
  //#region \0rolldown/runtime.js
5
5
  var __defProp = Object.defineProperty;
@@ -1447,9 +1447,10 @@ function renderInfiniteQueryOptions({ resolver, endpoint, inlineEndpoints }) {
1447
1447
  const requestConfigWithSignal = renderRequestConfigWithSignal(hasRequestConfigParam);
1448
1448
  lines.push(` queryFn: ({ pageParam, signal }: { pageParam: number; signal: AbortSignal }) => ${endpointFunction}(${endpointArgsWithPage}${hasRequestConfigParam ? `, ${requestConfigWithSignal}` : ""}),`);
1449
1449
  lines.push(" initialPageParam: 1,");
1450
- lines.push(` getNextPageParam: ({ ${resolver.options.infiniteQueryResponseParamNames.page}, ${resolver.options.infiniteQueryResponseParamNames.totalItems}, ${resolver.options.infiniteQueryResponseParamNames.limit}: limitParam }: Awaited<ReturnType<typeof ${endpointFunction}>>) => {`);
1450
+ lines.push(` getNextPageParam: ({ ${resolver.options.infiniteQueryResponseParamNames.page}, ${resolver.options.infiniteQueryResponseParamNames.totalItems}, ${resolver.options.infiniteQueryResponseParamNames.limit}: limitParam }: Awaited<ReturnType<typeof ${endpointFunction}>> & Partial<Record<${JSON.stringify(resolver.options.infiniteQueryResponseParamNames.page)} | ${JSON.stringify(resolver.options.infiniteQueryResponseParamNames.totalItems)} | ${JSON.stringify(resolver.options.infiniteQueryResponseParamNames.limit)}, number | null>>) => {`);
1451
1451
  lines.push(` const pageParam = ${resolver.options.infiniteQueryResponseParamNames.page} ?? 1;`);
1452
- lines.push(` return pageParam * limitParam < (${resolver.options.infiniteQueryResponseParamNames.totalItems} ?? 0) ? pageParam + 1 : null;`);
1452
+ lines.push(" const pageSize = limitParam ?? 0;");
1453
+ lines.push(` return pageParam * pageSize < (${resolver.options.infiniteQueryResponseParamNames.totalItems} ?? 0) ? pageParam + 1 : null;`);
1453
1454
  lines.push(" },");
1454
1455
  lines.push("});");
1455
1456
  return lines.join("\n");
@@ -1,4 +1,4 @@
1
- const require_generate_utils = require("./generate.utils-CT-LA-gX.cjs");
1
+ const require_generate_utils = require("./generate.utils-DC1pIuhK.cjs");
2
2
  //#region src/generators/const/acl.const.ts
3
3
  const ACL_APP_ABILITY_FILE = {
4
4
  fileName: "acl/app.ability",
@@ -3426,9 +3426,10 @@ function renderInfiniteQueryOptions({ resolver, endpoint, inlineEndpoints }) {
3426
3426
  const requestConfigWithSignal = renderRequestConfigWithSignal(hasRequestConfigParam);
3427
3427
  lines.push(` queryFn: ({ pageParam, signal }: { pageParam: number; signal: AbortSignal }) => ${endpointFunction}(${endpointArgsWithPage}${hasRequestConfigParam ? `, ${requestConfigWithSignal}` : ""}),`);
3428
3428
  lines.push(" initialPageParam: 1,");
3429
- lines.push(` getNextPageParam: ({ ${resolver.options.infiniteQueryResponseParamNames.page}, ${resolver.options.infiniteQueryResponseParamNames.totalItems}, ${resolver.options.infiniteQueryResponseParamNames.limit}: limitParam }: Awaited<ReturnType<typeof ${endpointFunction}>>) => {`);
3429
+ lines.push(` getNextPageParam: ({ ${resolver.options.infiniteQueryResponseParamNames.page}, ${resolver.options.infiniteQueryResponseParamNames.totalItems}, ${resolver.options.infiniteQueryResponseParamNames.limit}: limitParam }: Awaited<ReturnType<typeof ${endpointFunction}>> & Partial<Record<${JSON.stringify(resolver.options.infiniteQueryResponseParamNames.page)} | ${JSON.stringify(resolver.options.infiniteQueryResponseParamNames.totalItems)} | ${JSON.stringify(resolver.options.infiniteQueryResponseParamNames.limit)}, number | null>>) => {`);
3430
3430
  lines.push(` const pageParam = ${resolver.options.infiniteQueryResponseParamNames.page} ?? 1;`);
3431
- lines.push(` return pageParam * limitParam < (${resolver.options.infiniteQueryResponseParamNames.totalItems} ?? 0) ? pageParam + 1 : null;`);
3431
+ lines.push(" const pageSize = limitParam ?? 0;");
3432
+ lines.push(` return pageParam * pageSize < (${resolver.options.infiniteQueryResponseParamNames.totalItems} ?? 0) ? pageParam + 1 : null;`);
3432
3433
  lines.push(" },");
3433
3434
  lines.push("});");
3434
3435
  return lines.join("\n");
@@ -1,7 +1,7 @@
1
- import { t as generateCodeFromOpenAPIDoc } from "./generateCodeFromOpenAPIDoc-DN2g91cW.mjs";
2
- import { t as getDataFromOpenAPIDoc } from "./getDataFromOpenAPIDoc-hQ6YoDgR.mjs";
3
- import { H as getQueryName, Ht as getNamespaceName, Mn as formatTag, O as getTagImportPath, S as getTsTypeBase, Xt as isMediaTypeAllowed, Zt as isParamMediaTypeAllowed, bt as invalidVariableNameCharactersToCamel, d as isQuery, dt as DEFAULT_GENERATE_OPTIONS, u as isMutation, x as getSchemaTsMetaType } from "./native-bindings-BTQGSGhU.mjs";
4
- import { t as getOpenApiDoc } from "./generate.runner-BgWuy2Tf.mjs";
1
+ import { t as generateCodeFromOpenAPIDoc } from "./generateCodeFromOpenAPIDoc-D9AxX3_a.mjs";
2
+ import { t as getDataFromOpenAPIDoc } from "./getDataFromOpenAPIDoc-Dj0cdt9r.mjs";
3
+ import { H as getQueryName, Ht as getNamespaceName, Mn as formatTag, O as getTagImportPath, S as getTsTypeBase, Xt as isMediaTypeAllowed, Zt as isParamMediaTypeAllowed, bt as invalidVariableNameCharactersToCamel, d as isQuery, dt as DEFAULT_GENERATE_OPTIONS, u as isMutation, x as getSchemaTsMetaType } from "./native-bindings-DHQGvV7n.mjs";
4
+ import { t as getOpenApiDoc } from "./generate.runner-Caxx62-r.mjs";
5
5
  //#region src/generators/core/getMetadataFromOpenAPIDoc.ts
6
6
  async function getMetadataFromOpenAPIDoc(openApiDoc, options) {
7
7
  const { resolver, data } = await getDataFromOpenAPIDoc(openApiDoc, options);
@@ -1,4 +1,4 @@
1
- import { $t as isPrimitiveType, Bn as getMostCommonAdjacentCombinationSplit, Ct as getParamZodSchemaName, Et as getZodSchemaOperationName, Fn as isTagIncluded, Gt as getParameterEnumNames, Hn as removeWord, Ht as getNamespaceName, Jt as isErrorStatus, Kt as getSchemaNameByRef, Mn as formatTag, Nn as getEndpointTag, On as BODY_PARAMETER_NAME, Ot as isNamedZodSchema, Pn as getOperationTag, Qt as isPathExcluded, Rn as capitalize, Sn as VOID_SCHEMA, St as getEnumZodSchemaName, Tt as getZodSchemaName, Un as snakeToCamel, Ut as autocorrectRef, Wn as Profiler, Wt as escapeControlCharacters, Xt as isMediaTypeAllowed, Yt as isMainResponseStatus, Zt as isParamMediaTypeAllowed, _n as INT_SCHEMA, an as wrapWithQuotesIfNeeded, bn as URL_SCHEMA, bt as invalidVariableNameCharactersToCamel, cn as isReferenceObject, d as isQuery, dn as ALLOWED_PATH_IN, en as isSortingParameterObject, fn as ANY_SCHEMA, gn as ENUM_SCHEMA, hn as EMAIL_SCHEMA, in as unwrapQuotesIfNeeded, kn as JSON_APPLICATION_FORMAT, ln as isSchemaObject, lt as iterateSchema, mn as DATETIME_SCHEMA, nn as pathToVariableName, on as inferRequiredSchema, pn as BLOB_SCHEMA, qt as getSchemaRef, rn as replaceHyphenatedPath, s as pick, sn as isArraySchemaObject, tn as pathParamToVariableName, un as ALLOWED_METHODS, ut as getUniqueArray, vn as NUMBER_SCHEMA, wt as getResponseZodSchemaName, xn as UUID_SCHEMA, xt as getBodyZodSchemaName, yn as STRING_SCHEMA, zn as decapitalize } from "./native-bindings-BTQGSGhU.mjs";
1
+ import { $t as isPrimitiveType, Bn as getMostCommonAdjacentCombinationSplit, Ct as getParamZodSchemaName, Et as getZodSchemaOperationName, Fn as isTagIncluded, Gt as getParameterEnumNames, Hn as removeWord, Ht as getNamespaceName, Jt as isErrorStatus, Kt as getSchemaNameByRef, Mn as formatTag, Nn as getEndpointTag, On as BODY_PARAMETER_NAME, Ot as isNamedZodSchema, Pn as getOperationTag, Qt as isPathExcluded, Rn as capitalize, Sn as VOID_SCHEMA, St as getEnumZodSchemaName, Tt as getZodSchemaName, Un as snakeToCamel, Ut as autocorrectRef, Wn as Profiler, Wt as escapeControlCharacters, Xt as isMediaTypeAllowed, Yt as isMainResponseStatus, Zt as isParamMediaTypeAllowed, _n as INT_SCHEMA, an as wrapWithQuotesIfNeeded, bn as URL_SCHEMA, bt as invalidVariableNameCharactersToCamel, cn as isReferenceObject, d as isQuery, dn as ALLOWED_PATH_IN, en as isSortingParameterObject, fn as ANY_SCHEMA, gn as ENUM_SCHEMA, hn as EMAIL_SCHEMA, in as unwrapQuotesIfNeeded, kn as JSON_APPLICATION_FORMAT, ln as isSchemaObject, lt as iterateSchema, mn as DATETIME_SCHEMA, nn as pathToVariableName, on as inferRequiredSchema, pn as BLOB_SCHEMA, qt as getSchemaRef, rn as replaceHyphenatedPath, s as pick, sn as isArraySchemaObject, tn as pathParamToVariableName, un as ALLOWED_METHODS, ut as getUniqueArray, vn as NUMBER_SCHEMA, wt as getResponseZodSchemaName, xn as UUID_SCHEMA, xt as getBodyZodSchemaName, yn as STRING_SCHEMA, zn as decapitalize } from "./native-bindings-DHQGvV7n.mjs";
2
2
  //#region src/generators/const/validation.const.ts
3
3
  const HTTP_STATUS_CODES = {
4
4
  "100": "Continue",
package/dist/index.d.mts CHANGED
@@ -7,6 +7,6 @@ import { i as QueryModule, n as InvalidationMapFunc, r as OpenApiQueryConfig, t
7
7
  import { t as RestUtils } from "./rest.utils-rezWAIYL.mjs";
8
8
  import { t as OpenAPICodegenConfig } from "./config-DgrOddSC.mjs";
9
9
  import { d as TransportResponse, l as TransportRequest, n as HttpError, p as UploadProgress, u as TransportRequestConfig } from "./rest-transport.types-DM5-qyOJ.mjs";
10
- import { n as NativeRestInterceptor, r as NativeRestClient, t as NativeInterceptor } from "./native-rest-interceptor-Cz6saoq5.mjs";
10
+ import { n as NativeRestInterceptor, r as NativeRestClient, t as NativeInterceptor } from "./native-rest-interceptor-PgziZt1f.mjs";
11
11
  import { a as AppQueryOptions, i as AppMutationOptions, n as useMutationEffects, r as AppInfiniteQueryOptions, t as MutationEffectsOptions } from "./useMutationEffects-DIdL8tlx.mjs";
12
12
  export { type AppInfiniteQueryOptions, type AppMutationOptions, type AppQueryOptions, ApplicationException, AuthContext, AuthGuard, type AuthGuardProps, type DomainErrorEntry, DomainErrorRegistry, type ErrorEntry, ErrorHandler, type ErrorHandlerOptions, type GeneralErrorCodes, type RestClient as IRestClient, type InvalidationMap, type InvalidationMapFunc, type MutationEffectsOptions, HttpError as NativeHttpError, type NativeInterceptor, type TransportRequest as NativeRequest, type TransportRequestConfig as NativeRequestConfig, type TransportResponse as NativeResponse, NativeRestClient, NativeRestInterceptor, type UploadProgress as NativeUploadProgress, OpenAPICodegenConfig, OpenApiQueryConfig, OpenApiRouter, OpenApiWorkspaceContext, type QueryModule, type RequestConfig, type RequestInfo, type Response, RestClient$1 as RestClient, RestInterceptor, RestUtils, SharedErrorHandler, type TranslateFunction, configureTranslations, ns, resources, useMutationEffects, useWorkspaceContext };
package/dist/index.mjs CHANGED
@@ -2,7 +2,7 @@ import { i as resources, n as ns, t as configureTranslations } from "./i18n-D-Fe
2
2
  import { a as RestUtils, i as SharedErrorHandler, n as DomainErrorRegistry, r as ErrorHandler, t as ApplicationException } from "./error-handling-BeydPL7s.mjs";
3
3
  import { t as HttpError } from "./rest-transport.types-DxitRtsB.mjs";
4
4
  import { n as RestClient, t as RestInterceptor } from "./rest-interceptor-D5NCNTm1.mjs";
5
- import { n as NativeRestClient, t as NativeRestInterceptor } from "./native-rest-interceptor-CAWR8H5Y.mjs";
5
+ import { n as NativeRestClient, t as NativeRestInterceptor } from "./native-rest-interceptor-Bn_XbZ1y.mjs";
6
6
  import { t as OpenApiQueryConfig } from "./queryConfig.context-CldQ5YL9.mjs";
7
7
  import { t as useMutationEffects } from "./useMutationEffects-PB1fvKWM.mjs";
8
8
  import { t as OpenApiRouter } from "./router.context-EPlMBk3G.mjs";
package/dist/metro.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_generate_utils = require("./generate.utils-CT-LA-gX.cjs");
2
+ const require_generate_utils = require("./generate.utils-DC1pIuhK.cjs");
3
3
  let fs = require("fs");
4
4
  fs = require_generate_utils.__toESM(fs, 1);
5
5
  let path = require("path");
@@ -97,7 +97,7 @@ async function runGenerate({ fileConfig, params, formatGeneratedFile, profiler =
97
97
  const nativeFiles = generateFilesFromNativeOpenAPI(nativeInput.source, nativeInput.yaml, config);
98
98
  if (nativeFiles) return nativeFiles;
99
99
  }
100
- const { generateCodeFromOpenAPIDoc } = await Promise.resolve().then(() => require("./generateCodeFromOpenAPIDoc-CPXeK8nd.cjs"));
100
+ const { generateCodeFromOpenAPIDoc } = await Promise.resolve().then(() => require("./generateCodeFromOpenAPIDoc-DDThW43F.cjs"));
101
101
  return generateCodeFromOpenAPIDoc(openApiDoc, config, profiler, {
102
102
  source: nativeInput.source,
103
103
  yaml: nativeInput.yaml
package/dist/metro.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { t as createOpenApiCodegenRunner } from "./openapi-codegen.runner-Cmx1wT2n.mjs";
1
+ import { t as createOpenApiCodegenRunner } from "./openapi-codegen.runner-Cic6E7Lr.mjs";
2
2
  import { i as normalizeWatchFolders, r as isTinyOpenApiFakeMode, t as createTinyOpenApiSourceRunner } from "./openapi-source.runner-BZ6ZLgRO.mjs";
3
3
  import fs from "fs";
4
4
  import path from "path";
@@ -1260,9 +1260,9 @@ function renderMediaUploadMutationBody({ resolver, endpointFunction, resolvedEnd
1260
1260
  " let dataToSend: File | FormData = file;",
1261
1261
  " if (method === \"post\") {",
1262
1262
  " dataToSend = new FormData();",
1263
- " if (uploadInstructions.fields) {",
1264
- " for (const [key, value] of uploadInstructions.fields) {",
1265
- " dataToSend.append(key, value);",
1263
+ " if (\"fields\" in uploadInstructions && uploadInstructions.fields) {",
1264
+ " for (const [key, value] of Object.entries(uploadInstructions.fields)) {",
1265
+ " dataToSend.append(key, String(value));",
1266
1266
  " }",
1267
1267
  " }",
1268
1268
  " dataToSend.append(\"file\", file);",
@@ -3,12 +3,14 @@ import { z } from "zod";
3
3
  //#region src/lib/rest/native-rest-client.ts
4
4
  var NativeRestClient = class {
5
5
  interceptors;
6
- constructor({ config, interceptors = [] } = {}) {
6
+ errorHandler;
7
+ constructor({ config, interceptors = [], errorHandler } = {}) {
7
8
  this.baseURL = config?.baseURL ?? "";
8
9
  this.headers = config?.headers;
9
10
  this.credentials = config?.credentials;
10
11
  this.fetch = config?.fetch ?? globalThis.fetch.bind(globalThis);
11
12
  this.interceptors = [...interceptors];
13
+ this.errorHandler = errorHandler;
12
14
  }
13
15
  baseURL;
14
16
  headers;
@@ -84,7 +86,8 @@ var NativeRestClient = class {
84
86
  } : dataResult;
85
87
  } catch (error) {
86
88
  if (error instanceof z.ZodError) error.name = "BE Response schema mismatch - ZodError";
87
- throw await this.runErrorInterceptors(error);
89
+ const transformed = await this.runErrorInterceptors(error);
90
+ throw this.errorHandler ? this.errorHandler.rethrowError(transformed) : transformed;
88
91
  }
89
92
  }
90
93
  async execute(request, config = {}, applyInterceptors = true) {
@@ -1,9 +1,11 @@
1
+ import { a as ErrorHandler } from "./error-handling-LPEPQV1V.mjs";
1
2
  import { a as RestTransport, c as TransportFetch, d as TransportResponse, l as TransportRequest, o as RestTransportInterceptor, r as RestRequestInfo, s as TransportErrorContext, t as GeneralTransportErrorCode, u as TransportRequestConfig } from "./rest-transport.types-DM5-qyOJ.mjs";
2
3
  //#region src/lib/rest/native-rest-client.d.ts
3
4
  type NativeResult<T, IsRawRes extends boolean> = IsRawRes extends true ? TransportResponse<T> : T;
4
5
  declare class NativeRestClient implements RestTransport {
5
6
  private readonly interceptors;
6
- constructor({ config, interceptors }?: {
7
+ private readonly errorHandler?;
8
+ constructor({ config, interceptors, errorHandler }?: {
7
9
  config?: {
8
10
  baseURL?: string;
9
11
  headers?: HeadersInit;
@@ -11,6 +13,7 @@ declare class NativeRestClient implements RestTransport {
11
13
  fetch?: TransportFetch;
12
14
  };
13
15
  interceptors?: RestTransportInterceptor[];
16
+ errorHandler?: ErrorHandler<any>;
14
17
  });
15
18
  private readonly baseURL;
16
19
  private readonly headers?;
package/dist/native.d.mts CHANGED
@@ -1,3 +1,3 @@
1
1
  import { a as RestTransport, d as TransportResponse, f as TransportResult, i as RestResponseType, l as TransportRequest, n as HttpError, o as RestTransportInterceptor, p as UploadProgress, r as RestRequestInfo, t as GeneralTransportErrorCode, u as TransportRequestConfig } from "./rest-transport.types-DM5-qyOJ.mjs";
2
- import { n as NativeRestInterceptor, r as NativeRestClient, t as NativeInterceptor } from "./native-rest-interceptor-Cz6saoq5.mjs";
2
+ import { n as NativeRestInterceptor, r as NativeRestClient, t as NativeInterceptor } from "./native-rest-interceptor-PgziZt1f.mjs";
3
3
  export { type GeneralTransportErrorCode, HttpError, HttpError as NativeHttpError, type NativeInterceptor, type TransportRequest as NativeRequest, type TransportRequest, type TransportRequestConfig as NativeRequestConfig, type TransportRequestConfig, type TransportResponse as NativeResponse, type TransportResponse, NativeRestClient, NativeRestInterceptor, type UploadProgress as NativeUploadProgress, type UploadProgress, type RestRequestInfo, type RestResponseType, type RestTransport, type RestTransportInterceptor, type TransportResult };
package/dist/native.mjs CHANGED
@@ -1,3 +1,3 @@
1
1
  import { t as HttpError } from "./rest-transport.types-DxitRtsB.mjs";
2
- import { n as NativeRestClient, t as NativeRestInterceptor } from "./native-rest-interceptor-CAWR8H5Y.mjs";
2
+ import { n as NativeRestClient, t as NativeRestInterceptor } from "./native-rest-interceptor-Bn_XbZ1y.mjs";
3
3
  export { HttpError, HttpError as NativeHttpError, NativeRestClient, NativeRestInterceptor };
@@ -1,5 +1,5 @@
1
- import { Wn as Profiler } from "./native-bindings-BTQGSGhU.mjs";
2
- import { n as runGenerate } from "./generate.runner-BgWuy2Tf.mjs";
1
+ import { Wn as Profiler } from "./native-bindings-DHQGvV7n.mjs";
2
+ import { n as runGenerate } from "./generate.runner-Caxx62-r.mjs";
3
3
  import path from "path";
4
4
  //#region src/plugins/openapi-codegen.runner.ts
5
5
  function createOpenApiCodegenRunner(config, options = {}) {
package/dist/sh.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env bun
2
- import { i as VALIDATION_ERROR_TYPE_TITLE, n as groupByType, t as getDataFromOpenAPIDoc } from "./getDataFromOpenAPIDoc-hQ6YoDgR.mjs";
3
- import { D as getTagFileName, Wn as Profiler, r as getOutputFileName } from "./native-bindings-BTQGSGhU.mjs";
4
- import { n as runGenerate, r as resolveConfig, t as getOpenApiDoc } from "./generate.runner-BgWuy2Tf.mjs";
2
+ import { i as VALIDATION_ERROR_TYPE_TITLE, n as groupByType, t as getDataFromOpenAPIDoc } from "./getDataFromOpenAPIDoc-Dj0cdt9r.mjs";
3
+ import { D as getTagFileName, Wn as Profiler, r as getOutputFileName } from "./native-bindings-DHQGvV7n.mjs";
4
+ import { n as runGenerate, r as resolveConfig, t as getOpenApiDoc } from "./generate.runner-Caxx62-r.mjs";
5
5
  import yargs from "yargs";
6
6
  import { hideBin } from "yargs/helpers";
7
7
  import { styleText } from "node:util";
@@ -32,7 +32,7 @@ function logBanner(message) {
32
32
  * Fetch the version from package.json
33
33
  */
34
34
  function getVersion() {
35
- return "3.2.0-rc.12";
35
+ return "3.2.0-rc.14";
36
36
  }
37
37
  //#endregion
38
38
  //#region src/helpers/yargs.helper.ts
package/dist/vite.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { t as createOpenApiCodegenRunner } from "./openapi-codegen.runner-Cmx1wT2n.mjs";
1
+ import { t as createOpenApiCodegenRunner } from "./openapi-codegen.runner-Cic6E7Lr.mjs";
2
2
  import { i as normalizeWatchFolders, r as isTinyOpenApiFakeMode, t as createTinyOpenApiSourceRunner } from "./openapi-source.runner-BZ6ZLgRO.mjs";
3
3
  import path from "path";
4
4
  //#region src/vite/openapi-codegen.plugin.ts
package/package.json CHANGED
@@ -186,5 +186,5 @@
186
186
  "node": ">= 18"
187
187
  },
188
188
  "packageManager": "bun@1.3.14",
189
- "version": "3.2.0-rc.12"
189
+ "version": "3.2.0-rc.14"
190
190
  }