@povio/openapi-codegen-cli 3.2.0-rc.8 → 3.2.0

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.
Files changed (54) hide show
  1. package/dist/AuthGuard-GbtTDXs0.d.mts +32 -0
  2. package/dist/AuthGuard-qpAtHaBz.mjs +24 -0
  3. package/dist/acl.d.mts +1 -1
  4. package/dist/acl.mjs +3 -2
  5. package/dist/{auth.context-YFWzkwoN.mjs → auth.context-COWO6ssl.mjs} +1 -19
  6. package/dist/auth.d.mts +2 -0
  7. package/dist/auth.mjs +3 -0
  8. package/dist/axios.d.mts +2 -0
  9. package/dist/axios.mjs +2 -0
  10. package/dist/config.d.mts +4 -0
  11. package/dist/config.mjs +5 -0
  12. package/dist/{error-handling-BMXC5P08.mjs → error-handling-BeydPL7s.mjs} +2 -36
  13. package/dist/{error-handling-CNOHs4Fc.d.mts → error-handling-LPEPQV1V.d.mts} +2 -38
  14. package/dist/errors.d.mts +3 -0
  15. package/dist/errors.mjs +2 -0
  16. package/dist/{generate.runner-BvSprH6D.mjs → generate.runner-BD9BbYIx.mjs} +9 -32
  17. package/dist/{generate.utils-CH2U2Dpr.cjs → generate.utils-BqlgVd-i.cjs} +11 -58
  18. package/dist/{generateCodeFromOpenAPIDoc-CZT3sThI.cjs → generateCodeFromOpenAPIDoc-CkVgg5Zy.cjs} +111 -41
  19. package/dist/{generateCodeFromOpenAPIDoc-glAKBEGP.mjs → generateCodeFromOpenAPIDoc-idp1RVDa.mjs} +77 -12
  20. package/dist/generator.mjs +3 -3
  21. package/dist/{getDataFromOpenAPIDoc-7RxjULpB.mjs → getDataFromOpenAPIDoc-Cyrm3VKA.mjs} +16 -11
  22. package/dist/i18n-B_brQh4X.d.mts +38 -0
  23. package/dist/i18n-D-FesqFb.mjs +36 -0
  24. package/dist/index.d.mts +9 -160
  25. package/dist/index.mjs +10 -257
  26. package/dist/metro.cjs +2 -2
  27. package/dist/metro.mjs +2 -2
  28. package/dist/{native-rest-interceptor-CAWR8H5Y.mjs → native-rest-interceptor-Np4Ov54n.mjs} +15 -8
  29. package/dist/{native-rest-interceptor-Cz6saoq5.d.mts → native-rest-interceptor-PgziZt1f.d.mts} +4 -1
  30. package/dist/native.d.mts +1 -1
  31. package/dist/native.mjs +1 -1
  32. package/dist/openapi-codegen-native-darwin-arm64.node +0 -0
  33. package/dist/openapi-codegen-native-linux-x64.node +0 -0
  34. package/dist/openapi-codegen-native-win32-x64.node +0 -0
  35. package/dist/{openapi-codegen.runner-C93V7SGj.mjs → openapi-codegen.runner-BZH4V6rq.mjs} +1 -1
  36. package/dist/{openapi-source.runner-BZ6ZLgRO.mjs → openapi-source.runner-DPUNTduQ.mjs} +7 -5
  37. package/dist/query.d.mts +3 -0
  38. package/dist/query.mjs +3 -0
  39. package/dist/queryConfig.context-CRJOgf19.d.mts +22 -0
  40. package/dist/queryConfig.context-CldQ5YL9.mjs +34 -0
  41. package/dist/rest-client-CQyFvqYC.d.mts +55 -0
  42. package/dist/rest-interceptor-D5NCNTm1.mjs +115 -0
  43. package/dist/rest.utils-rezWAIYL.d.mts +10 -0
  44. package/dist/router.context-EPlMBk3G.mjs +21 -0
  45. package/dist/sh.mjs +9 -7
  46. package/dist/tiny.mjs +1 -1
  47. package/dist/useMutationEffects-DIdL8tlx.d.mts +29 -0
  48. package/dist/useMutationEffects-PB1fvKWM.mjs +68 -0
  49. package/dist/vite.mjs +2 -2
  50. package/dist/workspace.context-XWvQ_7Hg.mjs +26 -0
  51. package/dist/workspace.context-isVY9ves.d.mts +23 -0
  52. package/dist/zod.d.mts +1 -1
  53. package/dist/zod.mjs +1 -1
  54. package/package.json +44 -7
@@ -0,0 +1,32 @@
1
+ import { PropsWithChildren, ReactNode } from "react";
2
+ //#region src/lib/auth/auth.context.d.ts
3
+ declare namespace AuthContext {
4
+ export interface Routes {
5
+ authenticated?: string;
6
+ unauthenticated?: string;
7
+ }
8
+ interface Type<TUser = unknown> {
9
+ isAuthenticated: boolean;
10
+ isInitializing: boolean;
11
+ logout: () => void;
12
+ updateTokens?: (accessToken: string | null, refreshToken?: string | null) => void;
13
+ accessToken?: string | null;
14
+ user?: TUser | null;
15
+ userPromise?: () => Promise<TUser | null>;
16
+ routes?: Routes;
17
+ loadingState?: ReactNode;
18
+ }
19
+ type ProviderProps<TUser = unknown> = Type<TUser>;
20
+ export const Provider: <TUser>({ isAuthenticated, isInitializing, logout, updateTokens, accessToken, user, userPromise, routes, loadingState, children }: PropsWithChildren<ProviderProps<TUser>>) => import("react").JSX.Element;
21
+ export const useAuth: <TUser>() => Type<TUser>;
22
+ export {};
23
+ }
24
+ //#endregion
25
+ //#region src/lib/auth/AuthGuard.d.ts
26
+ interface AuthGuardProps {
27
+ type: "public-only" | "private";
28
+ redirectTo?: string;
29
+ }
30
+ declare const AuthGuard: ({ type, redirectTo, children }: PropsWithChildren<AuthGuardProps>) => import("react").ReactNode;
31
+ //#endregion
32
+ export { AuthGuardProps as n, AuthContext as r, AuthGuard as t };
@@ -0,0 +1,24 @@
1
+ import { t as OpenApiRouter } from "./router.context-EPlMBk3G.mjs";
2
+ import { t as AuthContext } from "./auth.context-COWO6ssl.mjs";
3
+ import { useEffect, useState } from "react";
4
+ //#region src/lib/auth/AuthGuard.tsx
5
+ const AuthGuard = ({ type, redirectTo, children }) => {
6
+ const { isAuthenticated, routes, loadingState } = AuthContext.useAuth();
7
+ const { replace } = OpenApiRouter.useRouter();
8
+ const [hasMounted, setHasMounted] = useState(false);
9
+ useEffect(() => {
10
+ setHasMounted(true);
11
+ }, []);
12
+ if (!hasMounted) return loadingState;
13
+ if (type === "private" && !isAuthenticated) {
14
+ replace(redirectTo || routes?.unauthenticated || "/");
15
+ return null;
16
+ }
17
+ if (type === "public-only" && isAuthenticated) {
18
+ replace(redirectTo || routes?.authenticated || "/");
19
+ return null;
20
+ }
21
+ return children;
22
+ };
23
+ //#endregion
24
+ export { AuthGuard as t };
package/dist/acl.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { a as ErrorHandler } from "./error-handling-CNOHs4Fc.mjs";
1
+ import { a as ErrorHandler } from "./error-handling-LPEPQV1V.mjs";
2
2
  import { PropsWithChildren } from "react";
3
3
  import { AbilityTuple, PureAbility, RawRuleOf, Subject } from "@casl/ability";
4
4
  import { PackRule } from "@casl/ability/extra";
package/dist/acl.mjs CHANGED
@@ -1,5 +1,6 @@
1
- import { i as SharedErrorHandler } from "./error-handling-BMXC5P08.mjs";
2
- import { n as OpenApiRouter, t as AuthContext } from "./auth.context-YFWzkwoN.mjs";
1
+ import { i as SharedErrorHandler } from "./error-handling-BeydPL7s.mjs";
2
+ import { t as OpenApiRouter } from "./router.context-EPlMBk3G.mjs";
3
+ import { t as AuthContext } from "./auth.context-COWO6ssl.mjs";
3
4
  import { createContext, useCallback, useMemo } from "react";
4
5
  import { jsx } from "react/jsx-runtime";
5
6
  import { AbilityBuilder, createMongoAbility } from "@casl/ability";
@@ -1,23 +1,5 @@
1
1
  import { createContext, use, useMemo } from "react";
2
2
  import { jsx } from "react/jsx-runtime";
3
- //#region src/lib/config/router.context.tsx
4
- let OpenApiRouter;
5
- (function(_OpenApiRouter) {
6
- const Context = createContext(null);
7
- _OpenApiRouter.Provider = ({ children, replace }) => {
8
- const value = useMemo(() => ({ replace }), [replace]);
9
- return /* @__PURE__ */ jsx(Context, {
10
- value,
11
- children
12
- });
13
- };
14
- _OpenApiRouter.useRouter = () => {
15
- const context = use(Context);
16
- if (!context) throw new Error("useRouter must be used within an OpenApiRouter.Provider");
17
- return context;
18
- };
19
- })(OpenApiRouter || (OpenApiRouter = {}));
20
- //#endregion
21
3
  //#region src/lib/auth/auth.context.tsx
22
4
  let AuthContext;
23
5
  (function(_AuthContext) {
@@ -54,4 +36,4 @@ let AuthContext;
54
36
  };
55
37
  })(AuthContext || (AuthContext = {}));
56
38
  //#endregion
57
- export { OpenApiRouter as n, AuthContext as t };
39
+ export { AuthContext as t };
@@ -0,0 +1,2 @@
1
+ import { n as AuthGuardProps, r as AuthContext, t as AuthGuard } from "./AuthGuard-GbtTDXs0.mjs";
2
+ export { AuthContext, AuthGuard, type AuthGuardProps };
package/dist/auth.mjs ADDED
@@ -0,0 +1,3 @@
1
+ import { t as AuthContext } from "./auth.context-COWO6ssl.mjs";
2
+ import { t as AuthGuard } from "./AuthGuard-qpAtHaBz.mjs";
3
+ export { AuthContext, AuthGuard };
@@ -0,0 +1,2 @@
1
+ import { a as RestClient, i as Response, n as RequestConfig, o as RestInterceptor, r as RequestInfo, t as RestClient$1 } from "./rest-client-CQyFvqYC.mjs";
2
+ export { type RestClient as IRestClient, type RequestConfig, type RequestInfo, type Response, RestClient$1 as RestClient, RestInterceptor };
package/dist/axios.mjs ADDED
@@ -0,0 +1,2 @@
1
+ import { n as RestClient, t as RestInterceptor } from "./rest-interceptor-D5NCNTm1.mjs";
2
+ export { RestClient, RestInterceptor };
@@ -0,0 +1,4 @@
1
+ import { i as resources, n as configureTranslations, r as ns, t as TranslateFunction } from "./i18n-B_brQh4X.mjs";
2
+ import { n as useWorkspaceContext, r as OpenApiRouter, t as OpenApiWorkspaceContext } from "./workspace.context-isVY9ves.mjs";
3
+ import { i as QueryModule, n as InvalidationMapFunc, r as OpenApiQueryConfig, t as InvalidationMap } from "./queryConfig.context-CRJOgf19.mjs";
4
+ export { type InvalidationMap, type InvalidationMapFunc, OpenApiQueryConfig, OpenApiRouter, OpenApiWorkspaceContext, type QueryModule, type TranslateFunction, configureTranslations, ns, resources, useWorkspaceContext };
@@ -0,0 +1,5 @@
1
+ import { i as resources, n as ns, t as configureTranslations } from "./i18n-D-FesqFb.mjs";
2
+ import { t as OpenApiQueryConfig } from "./queryConfig.context-CldQ5YL9.mjs";
3
+ import { t as OpenApiRouter } from "./router.context-EPlMBk3G.mjs";
4
+ import { n as useWorkspaceContext, t as OpenApiWorkspaceContext } from "./workspace.context-XWvQ_7Hg.mjs";
5
+ export { OpenApiQueryConfig, OpenApiRouter, OpenApiWorkspaceContext, configureTranslations, ns, resources, useWorkspaceContext };
@@ -1,40 +1,6 @@
1
+ import { n as ns, r as resolveT } from "./i18n-D-FesqFb.mjs";
1
2
  import { t as HttpError } from "./rest-transport.types-DxitRtsB.mjs";
2
3
  import { z } from "zod";
3
- //#region src/lib/assets/locales/en/translation.json
4
- var translation_default$1 = { openapi: { "sharedErrors": {
5
- "dataValidation": "An error occurred while validating the data",
6
- "internalError": "An internal error occurred. This is most likely a bug on our end. Please try again later.",
7
- "networkError": "A network error occurred. Are you connected to the internet?",
8
- "canceledError": "The request was canceled.",
9
- "unknownError": "An unknown error occurred. Please try again later.",
10
- "unknownErrorWithCode": "An unknown error occurred. Error code: \"{{code}}\""
11
- } } };
12
- //#endregion
13
- //#region src/lib/assets/locales/sl/translation.json
14
- var translation_default = { openapi: { "sharedErrors": {
15
- "dataValidation": "Pri preverjanju podatkov je prišlo do napake",
16
- "internalError": "Prišlo je do notranje napake.",
17
- "networkError": "Prišlo je do napake v omrežju.",
18
- "canceledError": "Zahteva je bila preklicana.",
19
- "unknownError": "Prišlo je do neznane napake.",
20
- "unknownErrorWithCode": "Prišlo je do neznane napake. Koda napake: \"{{code}}\""
21
- } } };
22
- //#endregion
23
- //#region src/lib/config/i18n.ts
24
- const ns = "openapi";
25
- const resources = {
26
- en: { [ns]: translation_default$1 },
27
- sl: { [ns]: translation_default }
28
- };
29
- let getT = null;
30
- function configureTranslations(getter) {
31
- getT = () => getter();
32
- }
33
- function resolveT() {
34
- if (!getT) throw new Error("Translations not configured. Call configureTranslations() at app startup.");
35
- return getT();
36
- }
37
- //#endregion
38
4
  //#region src/lib/rest/http-error.utils.ts
39
5
  function isAxiosErrorLike(error) {
40
6
  return typeof error === "object" && error !== null && "isAxiosError" in error;
@@ -215,4 +181,4 @@ var ErrorHandler = class ErrorHandler {
215
181
  };
216
182
  const SharedErrorHandler = new ErrorHandler({ entries: [] });
217
183
  //#endregion
218
- export { RestUtils as a, resources as c, SharedErrorHandler as i, DomainErrorRegistry as n, configureTranslations as o, ErrorHandler as r, ns as s, ApplicationException as t };
184
+ export { RestUtils as a, SharedErrorHandler as i, DomainErrorRegistry as n, ErrorHandler as r, ApplicationException as t };
@@ -1,40 +1,4 @@
1
- //#region src/lib/config/i18n.d.ts
2
- declare const ns = "openapi";
3
- declare const resources: {
4
- readonly en: {
5
- readonly openapi: {
6
- openapi: {
7
- sharedErrors: {
8
- dataValidation: string;
9
- internalError: string;
10
- networkError: string;
11
- canceledError: string;
12
- unknownError: string;
13
- unknownErrorWithCode: string;
14
- };
15
- };
16
- };
17
- };
18
- readonly sl: {
19
- readonly openapi: {
20
- openapi: {
21
- sharedErrors: {
22
- dataValidation: string;
23
- internalError: string;
24
- networkError: string;
25
- canceledError: string;
26
- unknownError: string;
27
- unknownErrorWithCode: string;
28
- };
29
- };
30
- };
31
- };
32
- };
33
- type TranslateFunction = (key: string, options?: {
34
- ns?: string;
35
- }) => string;
36
- declare function configureTranslations<T>(getter: () => T): void;
37
- //#endregion
1
+ import { t as TranslateFunction } from "./i18n-B_brQh4X.mjs";
38
2
  //#region src/lib/rest/error-handling.d.ts
39
3
  type GeneralErrorCodes = "DATA_VALIDATION_ERROR" | "NETWORK_ERROR" | "CANCELED_ERROR" | "INTERNAL_ERROR" | "UNKNOWN_ERROR";
40
4
  declare class ApplicationException<CodeT> extends Error {
@@ -80,4 +44,4 @@ declare class ErrorHandler<CodeT extends string | number> {
80
44
  }
81
45
  declare const SharedErrorHandler: ErrorHandler<never>;
82
46
  //#endregion
83
- export { ErrorHandler as a, SharedErrorHandler as c, ns as d, resources as f, ErrorEntry as i, TranslateFunction as l, DomainErrorEntry as n, ErrorHandlerOptions as o, DomainErrorRegistry as r, GeneralErrorCodes as s, ApplicationException as t, configureTranslations as u };
47
+ export { ErrorHandler as a, SharedErrorHandler as c, ErrorEntry as i, DomainErrorEntry as n, ErrorHandlerOptions as o, DomainErrorRegistry as r, GeneralErrorCodes as s, ApplicationException as t };
@@ -0,0 +1,3 @@
1
+ import { a as ErrorHandler, c as SharedErrorHandler, i as ErrorEntry, n as DomainErrorEntry, o as ErrorHandlerOptions, r as DomainErrorRegistry, s as GeneralErrorCodes, t as ApplicationException } from "./error-handling-LPEPQV1V.mjs";
2
+ import { t as RestUtils } from "./rest.utils-rezWAIYL.mjs";
3
+ export { ApplicationException, type DomainErrorEntry, DomainErrorRegistry, type ErrorEntry, ErrorHandler, type ErrorHandlerOptions, type GeneralErrorCodes, RestUtils, SharedErrorHandler };
@@ -0,0 +1,2 @@
1
+ import { a as RestUtils, i as SharedErrorHandler, n as DomainErrorRegistry, r as ErrorHandler, t as ApplicationException } from "./error-handling-BeydPL7s.mjs";
2
+ export { ApplicationException, DomainErrorRegistry, ErrorHandler, RestUtils, SharedErrorHandler };
@@ -369,6 +369,8 @@ const getNamespaceName = ({ type, tag, options }) => `${capitalize(tag)}${option
369
369
  const PACKAGE_IMPORT_PATH = "@povio/openapi-codegen-cli";
370
370
  const NATIVE_PACKAGE_IMPORT_PATH = `${PACKAGE_IMPORT_PATH}/native`;
371
371
  const REST_PACKAGE_IMPORT_PATH = `${PACKAGE_IMPORT_PATH}/rest`;
372
+ const QUERY_PACKAGE_IMPORT_PATH = `${PACKAGE_IMPORT_PATH}/query`;
373
+ const CONFIG_PACKAGE_IMPORT_PATH = `${PACKAGE_IMPORT_PATH}/config`;
372
374
  //#endregion
373
375
  //#region src/generators/const/deps.const.ts
374
376
  const APP_REST_CLIENT_NAME = "AppRestClient";
@@ -449,31 +451,6 @@ const hasMatchingPath = (endpoint, readAllEndpoint) => readAllEndpoint.pathSegme
449
451
  const hasMatchingPathWithoutTrailingParam = (endpoint, readAllEndpoint) => endpoint.pathSegments.length === readAllEndpoint.pathSegments.length && hasMatchingPath(endpoint, readAllEndpoint);
450
452
  const hasMatchingPathWithTrailingParam = (endpoint, readAllEndpoint) => endpoint.pathSegments.length - 1 === readAllEndpoint.pathSegments.length && isPathSegmentParam(endpoint.pathSegments.at(-1)) && hasMatchingPath(endpoint, readAllEndpoint);
451
453
  //#endregion
452
- //#region src/generators/const/acl.const.ts
453
- const ACL_APP_ABILITY_FILE = {
454
- fileName: "acl/app.ability",
455
- extension: "ts"
456
- };
457
- const ACL_APP_ABILITIES = "AppAbilities";
458
- const ACL_CHECK_HOOK = "useAclCheck";
459
- const CASL_ABILITY_BINDING = {
460
- abilityTuple: "AbilityTuple",
461
- pureAbility: "PureAbility",
462
- forcedSubject: "ForcedSubject",
463
- subjectType: "Subject",
464
- subject: "subject"
465
- };
466
- const CASL_ABILITY_IMPORT = {
467
- bindings: [
468
- CASL_ABILITY_BINDING.abilityTuple,
469
- CASL_ABILITY_BINDING.pureAbility,
470
- CASL_ABILITY_BINDING.forcedSubject,
471
- CASL_ABILITY_BINDING.subjectType,
472
- CASL_ABILITY_BINDING.subject
473
- ],
474
- from: "@casl/ability"
475
- };
476
- //#endregion
477
454
  //#region src/generators/const/options.const.ts
478
455
  const DEFAULT_GENERATE_OPTIONS = {
479
456
  input: "http://localhost:4000/docs-json/",
@@ -530,8 +507,8 @@ const DEFAULT_GENERATE_OPTIONS = {
530
507
  parseRequestParams: true,
531
508
  inlineEndpoints: false,
532
509
  inlineEndpointsExcludeModules: [],
533
- queryTypesImportPath: PACKAGE_IMPORT_PATH,
534
- mutationEffectsImportPath: PACKAGE_IMPORT_PATH,
510
+ queryTypesImportPath: QUERY_PACKAGE_IMPORT_PATH,
511
+ mutationEffectsImportPath: QUERY_PACKAGE_IMPORT_PATH,
535
512
  axiosRequestConfig: false,
536
513
  mutationEffects: true,
537
514
  mutationDefaultOnError: false,
@@ -1283,9 +1260,9 @@ function renderMediaUploadMutationBody({ resolver, endpointFunction, resolvedEnd
1283
1260
  " let dataToSend: File | FormData = file;",
1284
1261
  " if (method === \"post\") {",
1285
1262
  " dataToSend = new FormData();",
1286
- " if (uploadInstructions.fields) {",
1287
- " for (const [key, value] of uploadInstructions.fields) {",
1288
- " 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));",
1289
1266
  " }",
1290
1267
  " }",
1291
1268
  " dataToSend.append(\"file\", file);",
@@ -1592,7 +1569,7 @@ async function runGenerate({ fileConfig, params, formatGeneratedFile, profiler =
1592
1569
  const nativeFiles = generateFilesFromNativeOpenAPI(nativeInput.source, nativeInput.yaml, config);
1593
1570
  if (nativeFiles) return nativeFiles;
1594
1571
  }
1595
- const { generateCodeFromOpenAPIDoc } = await import("./generateCodeFromOpenAPIDoc-glAKBEGP.mjs").then((n) => n.n);
1572
+ const { generateCodeFromOpenAPIDoc } = await import("./generateCodeFromOpenAPIDoc-idp1RVDa.mjs").then((n) => n.n);
1596
1573
  return generateCodeFromOpenAPIDoc(openApiDoc, config, profiler, {
1597
1574
  source: nativeInput.source,
1598
1575
  yaml: nativeInput.yaml
@@ -1680,4 +1657,4 @@ function getGenerateStats(filesData, config) {
1680
1657
  };
1681
1658
  }
1682
1659
  //#endregion
1683
- export { getImportedAbilityFunctionName as $, isMainResponseStatus as $t, getEndpointsImports as A, AXIOS_REQUEST_CONFIG_NAME as An, getZodSchemaName as At, getPrefetchInfiniteQueryName as B, shouldInlineEndpointsForTag as Bn, QUERY_MODULE_ENUM as Bt, getAppRestClientImportPath as C, STRING_SCHEMA as Cn, isReadEndpoint as Ct, getTagFileName as D, ZOD_IMPORT as Dn, getEnumZodSchemaName as Dt, getQueryTypesImportPath as E, VOID_SCHEMA as En, getBodyZodSchemaName as Et, mergeImports as F, getRequestConfigTypeName as Fn, APP_REST_CLIENT_NAME as Ft, getAbilityConditionType as G, kebabToCamel as Gn, REST_PACKAGE_IMPORT_PATH as Gt, getQueryName as H, capitalize as Hn, ZOD_EXTENDED as Ht, getImportedInfiniteQueryName as I, formatTag as In, BUILDERS_UTILS as It, getAbilityFunctionName as J, Profiler as Jn, escapeControlCharacters as Jt, getAbilityConditionsTypes as K, removeWord as Kn, getNamespaceName as Kt, getImportedQueryName as L, getEndpointTag as Ln, DOMAIN_ERRORS_FILE as Lt, getInfiniteQueriesImports as M, BODY_PARAMETER_NAME as Mn, isEnumZodSchema as Mt, getModelsImports as N, JSON_APPLICATION_FORMAT as Nn, isNamedZodSchema as Nt, getTagImportPath as O, AXIOS_DEFAULT_IMPORT_NAME as On, getParamZodSchemaName as Ot, getQueriesImports as P, NATIVE_RESPONSE_TYPE as Pn, APP_REST_CLIENT_FILE as Pt, getAppAbilitiesType as Q, isErrorStatus as Qt, getInfiniteQueryName as R, getOperationTag as Rn, MUTATION_EFFECTS as Rt, getTsTypeBase as S, NUMBER_SCHEMA as Sn, isReadAllEndpoint as St, getQueryModulesImportPath as T, UUID_SCHEMA as Tn, invalidVariableNameCharactersToCamel as Tt, getQueryOptionsName as U, decapitalize as Un, NATIVE_PACKAGE_IMPORT_PATH as Ut, getPrefetchQueryName as V, camelToSpaceSeparated as Vn, QUERY_OPTIONS_TYPES as Vt, getAbilityAction as W, getMostCommonAdjacentCombinationSplit as Wn, PACKAGE_IMPORT_PATH as Wt, getAbilitySubjectTypes as X, getSchemaNameByRef as Xt, getAbilitySubject as Y, getParameterEnumNames as Yt, getAclData as Z, getSchemaRef as Zt, hasEndpointConfig as _, BLOB_SCHEMA as _n, getPathSegments as _t, resolveConfig as a, pathParamToVariableName as an, getZodSchemaInferedTypeName as at, requiresBody as b, ENUM_SCHEMA as bn, isDeleteEndpoint as bt, getDestructuredVariables as c, unwrapQuotesIfNeeded as cn, getSchemaDescriptions as ct, isQuery as d, isArraySchemaObject as dn, DEFAULT_GENERATE_OPTIONS as dt, isMediaTypeAllowed as en, hasAbilityConditions as et, getEndpointBody as f, isReferenceObject as fn, ACL_APP_ABILITIES as ft, getImportedEndpointName as g, ANY_SCHEMA as gn, CASL_ABILITY_IMPORT as gt, getEndpointPath as h, ALLOWED_PATH_IN as hn, CASL_ABILITY_BINDING as ht, shouldUseNativeCodegen as i, isSortingParameterObject as in, getZodSchemaDescription as it, getImportPath as j, AXIOS_REQUEST_CONFIG_TYPE as jn, getZodSchemaOperationName as jt, getAclImports as k, AXIOS_IMPORT as kn, getResponseZodSchemaName as kt, isInfiniteQuery as l, wrapWithQuotesIfNeeded as ln, iterateSchema as lt, getEndpointName as m, ALLOWED_METHODS as mn, ACL_CHECK_HOOK as mt, runGenerate as n, isPathExcluded as nn, getImportedZodSchemaInferedTypeName as nt, getOutputFileName as o, pathToVariableName as on, getZodSchemaPropertyDescriptions as ot, getEndpointConfig as p, isSchemaObject as pn, ACL_APP_ABILITY_FILE as pt, getAbilityDescription as q, snakeToCamel as qn, autocorrectRef as qt, compileNativeData as r, isPrimitiveType as rn, getImportedZodSchemaName as rt, pick as s, replaceHyphenatedPath as sn, getZodSchemaType as st, getOpenApiDoc as t, isParamMediaTypeAllowed as tn, renderAclCheckCall as tt, isMutation as u, inferRequiredSchema as un, getUniqueArray as ut, mapEndpointParamsToFunctionParams as v, DATETIME_SCHEMA as vn, isBulkDeleteEndpoint as vt, getFileNameWithExtension as w, URL_SCHEMA as wn, isUpdateEndpoint as wt, getSchemaTsMetaType as x, INT_SCHEMA as xn, isPathSegmentParam as xt, renderMediaUploadMutationBody as y, EMAIL_SCHEMA as yn, isCreateEndpoint as yt, getInfiniteQueryOptionsName as z, isTagIncluded as zn, QUERY_MODULES_FILE as zt };
1660
+ export { getImportedAbilityFunctionName as $, isPrimitiveType as $t, getEndpointsImports as A, NATIVE_RESPONSE_TYPE as An, APP_REST_CLIENT_NAME as At, getPrefetchInfiniteQueryName as B, getMostCommonAdjacentCombinationSplit as Bn, PACKAGE_IMPORT_PATH as Bt, getAppRestClientImportPath as C, ZOD_IMPORT as Cn, getParamZodSchemaName as Ct, getTagFileName as D, AXIOS_REQUEST_CONFIG_TYPE as Dn, isEnumZodSchema as Dt, getQueryTypesImportPath as E, AXIOS_REQUEST_CONFIG_NAME as En, getZodSchemaOperationName as Et, mergeImports as F, isTagIncluded as Fn, QUERY_MODULE_ENUM as Ft, getAbilityConditionType as G, getParameterEnumNames as Gt, getQueryName as H, removeWord as Hn, getNamespaceName as Ht, getImportedInfiniteQueryName as I, shouldInlineEndpointsForTag as In, QUERY_OPTIONS_TYPES as It, getAbilityFunctionName as J, isErrorStatus as Jt, getAbilityConditionsTypes as K, getSchemaNameByRef as Kt, getImportedQueryName as L, camelToSpaceSeparated as Ln, ZOD_EXTENDED as Lt, getInfiniteQueriesImports as M, formatTag as Mn, DOMAIN_ERRORS_FILE as Mt, getModelsImports as N, getEndpointTag as Nn, MUTATION_EFFECTS as Nt, getTagImportPath as O, BODY_PARAMETER_NAME as On, isNamedZodSchema as Ot, getQueriesImports as P, getOperationTag as Pn, QUERY_MODULES_FILE as Pt, getAppAbilitiesType as Q, isPathExcluded as Qt, getInfiniteQueryName as R, capitalize as Rn, CONFIG_PACKAGE_IMPORT_PATH as Rt, getTsTypeBase as S, VOID_SCHEMA as Sn, getEnumZodSchemaName as St, getQueryModulesImportPath as T, AXIOS_IMPORT as Tn, getZodSchemaName as Tt, getQueryOptionsName as U, snakeToCamel as Un, autocorrectRef as Ut, getPrefetchQueryName as V, kebabToCamel as Vn, REST_PACKAGE_IMPORT_PATH as Vt, getAbilityAction as W, Profiler as Wn, escapeControlCharacters as Wt, getAbilitySubjectTypes as X, isMediaTypeAllowed as Xt, getAbilitySubject as Y, isMainResponseStatus as Yt, getAclData as Z, isParamMediaTypeAllowed as Zt, hasEndpointConfig as _, INT_SCHEMA as _n, isReadAllEndpoint as _t, resolveConfig as a, wrapWithQuotesIfNeeded as an, getZodSchemaInferedTypeName as at, requiresBody as b, URL_SCHEMA as bn, invalidVariableNameCharactersToCamel as bt, getDestructuredVariables as c, isReferenceObject as cn, getSchemaDescriptions as ct, isQuery as d, ALLOWED_PATH_IN as dn, DEFAULT_GENERATE_OPTIONS as dt, isSortingParameterObject as en, hasAbilityConditions as et, getEndpointBody as f, ANY_SCHEMA as fn, getPathSegments as ft, getImportedEndpointName as g, ENUM_SCHEMA as gn, isPathSegmentParam as gt, getEndpointPath as h, EMAIL_SCHEMA as hn, isDeleteEndpoint as ht, shouldUseNativeCodegen as i, unwrapQuotesIfNeeded as in, getZodSchemaDescription as it, getImportPath as j, getRequestConfigTypeName as jn, BUILDERS_UTILS as jt, getAclImports as k, JSON_APPLICATION_FORMAT as kn, APP_REST_CLIENT_FILE as kt, isInfiniteQuery as l, isSchemaObject as ln, iterateSchema as lt, getEndpointName as m, DATETIME_SCHEMA as mn, isCreateEndpoint as mt, runGenerate as n, pathToVariableName as nn, getImportedZodSchemaInferedTypeName as nt, getOutputFileName as o, inferRequiredSchema as on, getZodSchemaPropertyDescriptions as ot, getEndpointConfig as p, BLOB_SCHEMA as pn, isBulkDeleteEndpoint as pt, getAbilityDescription as q, getSchemaRef as qt, compileNativeData as r, replaceHyphenatedPath as rn, getImportedZodSchemaName as rt, pick as s, isArraySchemaObject as sn, getZodSchemaType as st, getOpenApiDoc as t, pathParamToVariableName as tn, renderAclCheckCall as tt, isMutation as u, ALLOWED_METHODS as un, getUniqueArray as ut, mapEndpointParamsToFunctionParams as v, NUMBER_SCHEMA as vn, isReadEndpoint as vt, getFileNameWithExtension as w, AXIOS_DEFAULT_IMPORT_NAME as wn, getResponseZodSchemaName as wt, getSchemaTsMetaType as x, UUID_SCHEMA as xn, getBodyZodSchemaName as xt, renderMediaUploadMutationBody as y, STRING_SCHEMA as yn, isUpdateEndpoint as yt, getInfiniteQueryOptionsName as z, decapitalize as zn, NATIVE_PACKAGE_IMPORT_PATH as zt };
@@ -35,6 +35,8 @@ let openapi_types = require("openapi-types");
35
35
  const PACKAGE_IMPORT_PATH = "@povio/openapi-codegen-cli";
36
36
  const NATIVE_PACKAGE_IMPORT_PATH = `${PACKAGE_IMPORT_PATH}/native`;
37
37
  const REST_PACKAGE_IMPORT_PATH = `${PACKAGE_IMPORT_PATH}/rest`;
38
+ const QUERY_PACKAGE_IMPORT_PATH = `${PACKAGE_IMPORT_PATH}/query`;
39
+ const CONFIG_PACKAGE_IMPORT_PATH = `${PACKAGE_IMPORT_PATH}/config`;
38
40
  //#endregion
39
41
  //#region src/generators/const/zod.const.ts
40
42
  const SCHEMA_SUFFIX = "Schema";
@@ -115,8 +117,8 @@ const DEFAULT_GENERATE_OPTIONS = {
115
117
  parseRequestParams: true,
116
118
  inlineEndpoints: false,
117
119
  inlineEndpointsExcludeModules: [],
118
- queryTypesImportPath: PACKAGE_IMPORT_PATH,
119
- mutationEffectsImportPath: PACKAGE_IMPORT_PATH,
120
+ queryTypesImportPath: QUERY_PACKAGE_IMPORT_PATH,
121
+ mutationEffectsImportPath: QUERY_PACKAGE_IMPORT_PATH,
120
122
  axiosRequestConfig: false,
121
123
  mutationEffects: true,
122
124
  mutationDefaultOnError: false,
@@ -362,13 +364,13 @@ function shouldUseNativeCodegen() {
362
364
  }
363
365
  function getNativeBindings() {
364
366
  if (!bindings) {
365
- const require = (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href);
367
+ const require$1 = (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href);
366
368
  const resolvedNativePath = getNativePath();
367
369
  if (typeof process.dlopen === "function") {
368
370
  const nativeModule = { exports: {} };
369
371
  process.dlopen(nativeModule, resolvedNativePath);
370
372
  bindings = nativeModule.exports;
371
- } else bindings = require(resolvedNativePath);
373
+ } else bindings = require$1(resolvedNativePath);
372
374
  }
373
375
  return bindings;
374
376
  }
@@ -376,31 +378,6 @@ function compileNativeData(source, yaml, optionsJson) {
376
378
  return getNativeBindings().compileData(source, yaml, optionsJson);
377
379
  }
378
380
  //#endregion
379
- //#region src/generators/const/acl.const.ts
380
- const ACL_APP_ABILITY_FILE = {
381
- fileName: "acl/app.ability",
382
- extension: "ts"
383
- };
384
- const ACL_APP_ABILITIES = "AppAbilities";
385
- const ACL_CHECK_HOOK = "useAclCheck";
386
- const CASL_ABILITY_BINDING = {
387
- abilityTuple: "AbilityTuple",
388
- pureAbility: "PureAbility",
389
- forcedSubject: "ForcedSubject",
390
- subjectType: "Subject",
391
- subject: "subject"
392
- };
393
- const CASL_ABILITY_IMPORT = {
394
- bindings: [
395
- CASL_ABILITY_BINDING.abilityTuple,
396
- CASL_ABILITY_BINDING.pureAbility,
397
- CASL_ABILITY_BINDING.forcedSubject,
398
- CASL_ABILITY_BINDING.subjectType,
399
- CASL_ABILITY_BINDING.subject
400
- ],
401
- from: "@casl/ability"
402
- };
403
- //#endregion
404
381
  //#region src/generators/const/deps.const.ts
405
382
  const APP_REST_CLIENT_NAME = "AppRestClient";
406
383
  const APP_REST_CLIENT_FILE = {
@@ -1168,9 +1145,9 @@ function renderMediaUploadMutationBody({ resolver, endpointFunction, resolvedEnd
1168
1145
  " let dataToSend: File | FormData = file;",
1169
1146
  " if (method === \"post\") {",
1170
1147
  " dataToSend = new FormData();",
1171
- " if (uploadInstructions.fields) {",
1172
- " for (const [key, value] of uploadInstructions.fields) {",
1173
- " 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));",
1174
1151
  " }",
1175
1152
  " }",
1176
1153
  " dataToSend.append(\"file\", file);",
@@ -1382,24 +1359,6 @@ function getQueryTypesImportPath(options) {
1382
1359
  return options.queryTypesImportPath;
1383
1360
  }
1384
1361
  //#endregion
1385
- Object.defineProperty(exports, "ACL_APP_ABILITIES", {
1386
- enumerable: true,
1387
- get: function() {
1388
- return ACL_APP_ABILITIES;
1389
- }
1390
- });
1391
- Object.defineProperty(exports, "ACL_APP_ABILITY_FILE", {
1392
- enumerable: true,
1393
- get: function() {
1394
- return ACL_APP_ABILITY_FILE;
1395
- }
1396
- });
1397
- Object.defineProperty(exports, "ACL_CHECK_HOOK", {
1398
- enumerable: true,
1399
- get: function() {
1400
- return ACL_CHECK_HOOK;
1401
- }
1402
- });
1403
1362
  Object.defineProperty(exports, "ALLOWED_METHODS", {
1404
1363
  enumerable: true,
1405
1364
  get: function() {
@@ -1472,16 +1431,10 @@ Object.defineProperty(exports, "BUILDERS_UTILS", {
1472
1431
  return BUILDERS_UTILS;
1473
1432
  }
1474
1433
  });
1475
- Object.defineProperty(exports, "CASL_ABILITY_BINDING", {
1476
- enumerable: true,
1477
- get: function() {
1478
- return CASL_ABILITY_BINDING;
1479
- }
1480
- });
1481
- Object.defineProperty(exports, "CASL_ABILITY_IMPORT", {
1434
+ Object.defineProperty(exports, "CONFIG_PACKAGE_IMPORT_PATH", {
1482
1435
  enumerable: true,
1483
1436
  get: function() {
1484
- return CASL_ABILITY_IMPORT;
1437
+ return CONFIG_PACKAGE_IMPORT_PATH;
1485
1438
  }
1486
1439
  });
1487
1440
  Object.defineProperty(exports, "DATETIME_SCHEMA", {