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

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 (49) 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-D8AYuEFm.mjs +184 -0
  17. package/dist/{generate.utils-CH2U2Dpr.cjs → generate.utils-CT-LA-gX.cjs} +6 -53
  18. package/dist/{generateCodeFromOpenAPIDoc-glAKBEGP.mjs → generateCodeFromOpenAPIDoc--ufinTug.mjs} +29 -4
  19. package/dist/{generateCodeFromOpenAPIDoc-CZT3sThI.cjs → generateCodeFromOpenAPIDoc-iEa8YAUQ.cjs} +48 -23
  20. package/dist/generator.mjs +4 -3
  21. package/dist/{getDataFromOpenAPIDoc-7RxjULpB.mjs → getDataFromOpenAPIDoc-D8w0QElH.mjs} +1 -1
  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 +8 -159
  25. package/dist/index.mjs +9 -256
  26. package/dist/metro.cjs +2 -2
  27. package/dist/metro.mjs +1 -1
  28. package/dist/{generate.runner-BvSprH6D.mjs → native-bindings-BTQGSGhU.mjs} +5 -208
  29. package/dist/openapi-codegen-native-darwin-arm64.node +0 -0
  30. package/dist/openapi-codegen-native-linux-x64.node +0 -0
  31. package/dist/openapi-codegen-native-win32-x64.node +0 -0
  32. package/dist/{openapi-codegen.runner-C93V7SGj.mjs → openapi-codegen.runner-6Yth6QZC.mjs} +2 -1
  33. package/dist/query.d.mts +3 -0
  34. package/dist/query.mjs +3 -0
  35. package/dist/queryConfig.context-CRJOgf19.d.mts +22 -0
  36. package/dist/queryConfig.context-CldQ5YL9.mjs +34 -0
  37. package/dist/rest-client-CQyFvqYC.d.mts +55 -0
  38. package/dist/rest-interceptor-D5NCNTm1.mjs +115 -0
  39. package/dist/rest.utils-rezWAIYL.d.mts +10 -0
  40. package/dist/router.context-EPlMBk3G.mjs +21 -0
  41. package/dist/sh.mjs +4 -3
  42. package/dist/useMutationEffects-DIdL8tlx.d.mts +29 -0
  43. package/dist/useMutationEffects-PB1fvKWM.mjs +68 -0
  44. package/dist/vite.mjs +1 -1
  45. package/dist/workspace.context-XWvQ_7Hg.mjs +26 -0
  46. package/dist/workspace.context-isVY9ves.d.mts +23 -0
  47. package/dist/zod.d.mts +1 -1
  48. package/dist/zod.mjs +1 -1
  49. package/package.json +39 -2
@@ -0,0 +1,55 @@
1
+ import { a as ErrorHandler, s as GeneralErrorCodes$1 } from "./error-handling-LPEPQV1V.mjs";
2
+ import { AxiosInstance, AxiosRequestConfig, AxiosResponse, CreateAxiosDefaults } from "axios";
3
+ import { z } from "zod";
4
+ //#region src/lib/rest/rest-interceptor.d.ts
5
+ declare class RestInterceptor<T extends any[]> {
6
+ private applyInterceptor;
7
+ private interceptorIdMap;
8
+ constructor(applyInterceptor: (client: AxiosInstance, ...args: T) => number);
9
+ addInterceptor(client: AxiosInstance, ...args: T): void;
10
+ removeInterceptor(client: AxiosInstance): void;
11
+ }
12
+ //#endregion
13
+ //#region src/lib/rest/rest-client.types.d.ts
14
+ type GeneralErrorCodes = string;
15
+ interface RequestInfo<ZOutput, ECodes extends string> {
16
+ resSchema: z.ZodType<ZOutput>;
17
+ errorHandler?: ErrorHandler<ECodes>;
18
+ }
19
+ interface RequestConfig<IsRawRes extends boolean = false> {
20
+ rawResponse?: IsRawRes;
21
+ allowInvalidResponseData?: boolean;
22
+ }
23
+ type Response<ZOutput, IsRawRes extends boolean = false> = IsRawRes extends true ? AxiosResponse<ZOutput> : ZOutput;
24
+ interface RestClient$1 {
25
+ attachInterceptors<T extends any[]>(interceptors?: RestInterceptor<T>[], ...args: T): void;
26
+ attachInterceptor<T extends any[]>(interceptor: RestInterceptor<T>, ...args: T): void;
27
+ ejectInterceptor<T extends any[]>(interceptor: RestInterceptor<T>): void;
28
+ get<ZOutput, ECodes extends string = GeneralErrorCodes, IsRawRes extends boolean = false>(requestInfo: RequestInfo<ZOutput, ECodes>, url: string, requestConfig?: AxiosRequestConfig & RequestConfig<IsRawRes>): Promise<Response<ZOutput, IsRawRes>>;
29
+ post<ZOutput, ECodes extends string = GeneralErrorCodes, IsRawRes extends boolean = false>(requestInfo: RequestInfo<ZOutput, ECodes>, url: string, data?: any, requestConfig?: AxiosRequestConfig & RequestConfig<IsRawRes>): Promise<Response<ZOutput, IsRawRes>>;
30
+ patch<ZOutput, ECodes extends string = GeneralErrorCodes, IsRawRes extends boolean = false>(requestInfo: RequestInfo<ZOutput, ECodes>, url: string, data?: any, requestConfig?: AxiosRequestConfig & RequestConfig<IsRawRes>): Promise<Response<ZOutput, IsRawRes>>;
31
+ put<ZOutput, ECodes extends string = GeneralErrorCodes, IsRawRes extends boolean = false>(requestInfo: RequestInfo<ZOutput, ECodes>, url: string, data?: any, requestConfig?: AxiosRequestConfig & RequestConfig<IsRawRes>): Promise<Response<ZOutput, IsRawRes>>;
32
+ delete<ZOutput, ECodes extends string = GeneralErrorCodes, IsRawRes extends boolean = false>(requestInfo: RequestInfo<ZOutput, ECodes>, url: string, data?: any, requestConfig?: AxiosRequestConfig & RequestConfig<IsRawRes>): Promise<Response<ZOutput, IsRawRes>>;
33
+ }
34
+ //#endregion
35
+ //#region src/lib/rest/rest-client.d.ts
36
+ declare class RestClient implements RestClient$1 {
37
+ private readonly client;
38
+ private readonly errorHandler;
39
+ constructor({ config, interceptors, errorHandler }?: {
40
+ config?: CreateAxiosDefaults;
41
+ interceptors?: RestInterceptor<any[]>[];
42
+ errorHandler?: ErrorHandler<any>;
43
+ });
44
+ attachInterceptors<T extends any[]>(interceptors?: RestInterceptor<T>[], ...args: T): void;
45
+ attachInterceptor<T extends any[]>(interceptor: RestInterceptor<T>, ...args: T): void;
46
+ ejectInterceptor<T extends any[]>(interceptor: RestInterceptor<T>): void;
47
+ get<ZOutput, ECodes extends string = GeneralErrorCodes$1, IsRawRes extends boolean = false>(requestInfo: RequestInfo<ZOutput, ECodes>, url: string, requestConfig?: AxiosRequestConfig & RequestConfig<IsRawRes>): Promise<Response<ZOutput, IsRawRes>>;
48
+ post<ZOutput, ECodes extends string = GeneralErrorCodes$1, IsRawRes extends boolean = false>(requestInfo: RequestInfo<ZOutput, ECodes>, url: string, data?: any, requestConfig?: AxiosRequestConfig & RequestConfig<IsRawRes>): Promise<Response<ZOutput, IsRawRes>>;
49
+ patch<ZOutput, ECodes extends string = GeneralErrorCodes$1, IsRawRes extends boolean = false>(requestInfo: RequestInfo<ZOutput, ECodes>, url: string, data?: any, requestConfig?: AxiosRequestConfig & RequestConfig<IsRawRes>): Promise<Response<ZOutput, IsRawRes>>;
50
+ put<ZOutput, ECodes extends string = GeneralErrorCodes$1, IsRawRes extends boolean = false>(requestInfo: RequestInfo<ZOutput, ECodes>, url: string, data?: any, requestConfig?: AxiosRequestConfig & RequestConfig<IsRawRes>): Promise<Response<ZOutput, IsRawRes>>;
51
+ delete<ZOutput, ECodes extends string = GeneralErrorCodes$1, IsRawRes extends boolean = false>(requestInfo: RequestInfo<ZOutput, ECodes>, url: string, data?: any, requestConfig?: AxiosRequestConfig & RequestConfig<IsRawRes>): Promise<Response<ZOutput, IsRawRes>>;
52
+ private makeRequest;
53
+ }
54
+ //#endregion
55
+ export { RestClient$1 as a, Response as i, RequestConfig as n, RestInterceptor as o, RequestInfo as r, RestClient as t };
@@ -0,0 +1,115 @@
1
+ import { i as SharedErrorHandler } from "./error-handling-BeydPL7s.mjs";
2
+ import axios from "axios";
3
+ import { z } from "zod";
4
+ //#region src/lib/rest/rest-client.ts
5
+ var RestClient = class {
6
+ client;
7
+ errorHandler;
8
+ constructor({ config, interceptors, errorHandler } = {}) {
9
+ this.client = axios.create(config);
10
+ this.errorHandler = errorHandler ?? SharedErrorHandler;
11
+ this.attachInterceptors(interceptors);
12
+ }
13
+ attachInterceptors(interceptors, ...args) {
14
+ if (interceptors != null) interceptors.forEach((interceptor) => this.attachInterceptor(interceptor, ...args));
15
+ }
16
+ attachInterceptor(interceptor, ...args) {
17
+ interceptor.addInterceptor(this.client, ...args);
18
+ }
19
+ ejectInterceptor(interceptor) {
20
+ interceptor.removeInterceptor(this.client);
21
+ }
22
+ async get(requestInfo, url, requestConfig) {
23
+ return this.makeRequest(requestInfo, {
24
+ ...requestConfig,
25
+ method: "get",
26
+ url
27
+ });
28
+ }
29
+ async post(requestInfo, url, data, requestConfig) {
30
+ return this.makeRequest(requestInfo, {
31
+ ...requestConfig,
32
+ method: "post",
33
+ url,
34
+ data
35
+ });
36
+ }
37
+ async patch(requestInfo, url, data, requestConfig) {
38
+ return this.makeRequest(requestInfo, {
39
+ ...requestConfig,
40
+ method: "patch",
41
+ url,
42
+ data
43
+ });
44
+ }
45
+ async put(requestInfo, url, data, requestConfig) {
46
+ return this.makeRequest(requestInfo, {
47
+ ...requestConfig,
48
+ method: "put",
49
+ url,
50
+ data
51
+ });
52
+ }
53
+ async delete(requestInfo, url, data, requestConfig) {
54
+ return this.makeRequest(requestInfo, {
55
+ ...requestConfig,
56
+ method: "delete",
57
+ url,
58
+ data
59
+ });
60
+ }
61
+ async makeRequest(requestInfo, requestConfig) {
62
+ const errorStack = (/* @__PURE__ */ new Error()).stack;
63
+ try {
64
+ const { rawResponse, allowInvalidResponseData, ...config } = requestConfig;
65
+ const res = await this.client(config);
66
+ const responseData = res.status === 204 && res.data === "" ? void 0 : res.data;
67
+ const parseResult = requestInfo.resSchema.safeParse(responseData);
68
+ let resData;
69
+ if (parseResult.success) resData = parseResult.data;
70
+ else if (allowInvalidResponseData && config.method === "get") {
71
+ parseResult.error.name = "BE Response schema mismatch - ZodError";
72
+ parseResult.error.stack = [parseResult.error.stack, ...errorStack?.split("\n").slice(2) ?? []].join("\n");
73
+ console.error(parseResult.error);
74
+ resData = res.data;
75
+ } else throw parseResult.error;
76
+ return rawResponse ? {
77
+ ...res,
78
+ data: resData
79
+ } : resData;
80
+ } catch (error) {
81
+ if (error instanceof z.ZodError) {
82
+ error.name = "BE Response schema mismatch - ZodError";
83
+ error.stack = [error.stack, ...errorStack?.split("\n").slice(2) ?? []].join("\n");
84
+ }
85
+ (requestInfo.errorHandler ?? this.errorHandler).rethrowError(error);
86
+ throw error;
87
+ }
88
+ }
89
+ };
90
+ //#endregion
91
+ //#region src/lib/rest/rest-interceptor.ts
92
+ var RestInterceptor = class {
93
+ applyInterceptor;
94
+ interceptorIdMap = [];
95
+ constructor(applyInterceptor) {
96
+ this.applyInterceptor = applyInterceptor;
97
+ }
98
+ addInterceptor(client, ...args) {
99
+ this.removeInterceptor(client);
100
+ const interceptorId = this.applyInterceptor(client, ...args);
101
+ this.interceptorIdMap.push({
102
+ client,
103
+ interceptorId
104
+ });
105
+ }
106
+ removeInterceptor(client) {
107
+ const interceptorId = this.interceptorIdMap.find((i) => i.client === client)?.interceptorId;
108
+ if (interceptorId != null) {
109
+ client.interceptors.request.eject(interceptorId);
110
+ this.interceptorIdMap = this.interceptorIdMap.filter((i) => i.client !== client);
111
+ }
112
+ }
113
+ };
114
+ //#endregion
115
+ export { RestClient as n, RestInterceptor as t };
@@ -0,0 +1,10 @@
1
+ import { AxiosError, AxiosResponseHeaders } from "axios";
2
+ //#region src/lib/rest/rest.utils.d.ts
3
+ declare namespace RestUtils {
4
+ const extractServerResponseCode: (e: unknown) => string | number | null;
5
+ const doesServerErrorMessageContain: (e: AxiosError, text: string) => boolean;
6
+ const extractServerErrorMessage: (e: unknown) => string | null;
7
+ const extractContentDispositionFilename: (headers: AxiosResponseHeaders) => string | undefined;
8
+ }
9
+ //#endregion
10
+ export { RestUtils as t };
@@ -0,0 +1,21 @@
1
+ import { createContext, use, useMemo } from "react";
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
+ export { OpenApiRouter as t };
package/dist/sh.mjs CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env bun
2
- import { i as VALIDATION_ERROR_TYPE_TITLE, n as groupByType, t as getDataFromOpenAPIDoc } from "./getDataFromOpenAPIDoc-7RxjULpB.mjs";
3
- import { D as getTagFileName, Jn as Profiler, a as resolveConfig, n as runGenerate, o as getOutputFileName, t as getOpenApiDoc } from "./generate.runner-BvSprH6D.mjs";
2
+ import { i as VALIDATION_ERROR_TYPE_TITLE, n as groupByType, t as getDataFromOpenAPIDoc } from "./getDataFromOpenAPIDoc-D8w0QElH.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-D8AYuEFm.mjs";
4
5
  import yargs from "yargs";
5
6
  import { hideBin } from "yargs/helpers";
6
7
  import { styleText } from "node:util";
@@ -31,7 +32,7 @@ function logBanner(message) {
31
32
  * Fetch the version from package.json
32
33
  */
33
34
  function getVersion() {
34
- return "3.2.0-rc.8";
35
+ return "3.2.0-rc.9";
35
36
  }
36
37
  //#endregion
37
38
  //#region src/helpers/yargs.helper.ts
@@ -0,0 +1,29 @@
1
+ import { s as GeneralErrorCodes, t as ApplicationException } from "./error-handling-LPEPQV1V.mjs";
2
+ import { i as QueryModule, t as InvalidationMap } from "./queryConfig.context-CRJOgf19.mjs";
3
+ import { InfiniteData, QueryKey, UseInfiniteQueryOptions, UseMutationOptions, UseQueryOptions } from "@tanstack/react-query";
4
+ //#region src/lib/react-query.types.d.ts
5
+ type Function = (...args: any) => any;
6
+ type IfAny<T, Y, N> = 0 extends 1 & T ? Y : N;
7
+ type IsAny<T> = IfAny<T, true, never>;
8
+ type IsUnknown<T, Y, N = T> = IsAny<T> extends never ? (unknown extends T ? Y : N) : N;
9
+ type AppQueryOptions<TFunction extends Function, TData = Awaited<ReturnType<TFunction>>, TErrorCodes = GeneralErrorCodes> = Omit<UseQueryOptions<Awaited<ReturnType<TFunction>>, ApplicationException<TErrorCodes>, IsUnknown<TData, Awaited<ReturnType<TFunction>>>>, "queryKey" | "queryFn">;
10
+ type AppMutationOptions<TFunction extends Function, TVariables = void, TData = Awaited<ReturnType<TFunction>>, TErrorCodes = GeneralErrorCodes> = Omit<UseMutationOptions<TData, ApplicationException<TErrorCodes>, TVariables>, "mutationKey" | "mutationFn">;
11
+ type AppInfiniteQueryOptions<TFunction extends Function, TData = InfiniteData<Awaited<ReturnType<TFunction>>>, TErrorCodes = GeneralErrorCodes, TQueryKey extends QueryKey = QueryKey, TPageParam = number> = Omit<UseInfiniteQueryOptions<Awaited<ReturnType<TFunction>>, ApplicationException<TErrorCodes>, IsUnknown<TData, InfiniteData<Awaited<ReturnType<TFunction>>>>, TQueryKey, TPageParam>, "queryKey" | "queryFn" | "initialPageParam" | "getNextPageParam">;
12
+ //#endregion
13
+ //#region src/lib/react-query/useMutationEffects.d.ts
14
+ interface MutationEffectsOptions<TQueryModule extends QueryModule = QueryModule> {
15
+ invalidateCurrentModule?: boolean;
16
+ crossTabInvalidation?: boolean;
17
+ invalidationMap?: InvalidationMap<TQueryModule>;
18
+ invalidateModules?: QueryModule[];
19
+ invalidateKeys?: QueryKey[];
20
+ preferUpdate?: boolean;
21
+ }
22
+ interface UseMutationEffectsProps<TQueryModule extends QueryModule = QueryModule> {
23
+ currentModule: TQueryModule;
24
+ }
25
+ declare function useMutationEffects<TQueryModule extends QueryModule = QueryModule>({ currentModule }: UseMutationEffectsProps<TQueryModule>): {
26
+ runMutationEffects: <TData, TVariables>(data: TData, variables: TVariables, options?: MutationEffectsOptions<TQueryModule>, updateKeys?: QueryKey[]) => Promise<void>;
27
+ };
28
+ //#endregion
29
+ export { AppQueryOptions as a, AppMutationOptions as i, useMutationEffects as n, AppInfiniteQueryOptions as r, MutationEffectsOptions as t };
@@ -0,0 +1,68 @@
1
+ import { t as OpenApiQueryConfig } from "./queryConfig.context-CldQ5YL9.mjs";
2
+ import { useCallback, useEffect } from "react";
3
+ import { useQueryClient } from "@tanstack/react-query";
4
+ //#region src/lib/react-query/cross-tab-invalidation.ts
5
+ const CROSS_TAB_INVALIDATE_KEY = "__rq_invalidate__";
6
+ const broadcastQueryInvalidation = (queryKeys) => {
7
+ localStorage.setItem(CROSS_TAB_INVALIDATE_KEY, JSON.stringify({
8
+ keys: queryKeys,
9
+ timestamp: Date.now()
10
+ }));
11
+ };
12
+ let isListenerSetUp = false;
13
+ const setupCrossTabListener = (queryClient) => {
14
+ if (isListenerSetUp) return;
15
+ isListenerSetUp = true;
16
+ window.addEventListener("storage", (e) => {
17
+ if (e.key !== CROSS_TAB_INVALIDATE_KEY || !e.newValue) return;
18
+ try {
19
+ const { keys } = JSON.parse(e.newValue);
20
+ for (const queryKey of keys) queryClient.invalidateQueries({ queryKey });
21
+ } catch {}
22
+ });
23
+ };
24
+ //#endregion
25
+ //#region src/lib/react-query/useMutationEffects.ts
26
+ function useMutationEffects({ currentModule }) {
27
+ const queryClient = useQueryClient();
28
+ const config = OpenApiQueryConfig.useConfig();
29
+ useEffect(() => {
30
+ if (!config.crossTabInvalidation) return;
31
+ setupCrossTabListener(queryClient);
32
+ }, [queryClient, config.crossTabInvalidation]);
33
+ return { runMutationEffects: useCallback(async (data, variables, options = {}, updateKeys) => {
34
+ const { invalidateCurrentModule, invalidationMap, invalidateModules, invalidateKeys, preferUpdate } = options;
35
+ const shouldUpdate = preferUpdate ?? config.preferUpdate ?? false;
36
+ const shouldInvalidateCurrentModule = invalidateCurrentModule ?? config.invalidateCurrentModule ?? true;
37
+ const isQueryKeyEqual = (keyA, keyB) => keyA.length === keyB.length && keyA.every((item, index) => item === keyB[index]);
38
+ const isQueryKeyPrefix = (queryKey, prefixKey) => prefixKey.length <= queryKey.length && prefixKey.every((item, index) => item === queryKey[index]);
39
+ const mappedInvalidationKeys = invalidationMap?.[currentModule]?.(data, variables) ?? config.invalidationMap?.[currentModule]?.(data, variables);
40
+ const shouldInvalidateQuery = (queryKey) => {
41
+ const isUpdateKey = updateKeys?.some((key) => isQueryKeyEqual(queryKey, key));
42
+ if (shouldUpdate && isUpdateKey) return false;
43
+ const isCurrentModule = shouldInvalidateCurrentModule && queryKey[0] === currentModule;
44
+ const isInvalidateModule = !!invalidateModules && invalidateModules.some((module) => queryKey[0] === module);
45
+ const isInvalidateKey = !!invalidateKeys && invalidateKeys.some((key) => isQueryKeyPrefix(queryKey, key));
46
+ const isMappedKey = !!mappedInvalidationKeys && mappedInvalidationKeys.some((key) => isQueryKeyPrefix(queryKey, key));
47
+ return isCurrentModule || isInvalidateModule || isInvalidateKey || isMappedKey;
48
+ };
49
+ const invalidatedQueryKeys = [];
50
+ const shouldBroadcast = options.crossTabInvalidation ?? config.crossTabInvalidation;
51
+ queryClient.invalidateQueries({ predicate: ({ queryKey }) => {
52
+ const shouldInvalidate = shouldInvalidateQuery(queryKey);
53
+ if (shouldInvalidate && shouldBroadcast) invalidatedQueryKeys.push([...queryKey]);
54
+ return shouldInvalidate;
55
+ } });
56
+ if (shouldBroadcast && invalidatedQueryKeys.length > 0) broadcastQueryInvalidation(invalidatedQueryKeys);
57
+ if (shouldUpdate && updateKeys) updateKeys.map((queryKey) => queryClient.setQueryData(queryKey, data));
58
+ }, [
59
+ queryClient,
60
+ currentModule,
61
+ config.preferUpdate,
62
+ config.invalidateCurrentModule,
63
+ config.invalidationMap,
64
+ config.crossTabInvalidation
65
+ ]) };
66
+ }
67
+ //#endregion
68
+ export { useMutationEffects as t };
package/dist/vite.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { t as createOpenApiCodegenRunner } from "./openapi-codegen.runner-C93V7SGj.mjs";
1
+ import { t as createOpenApiCodegenRunner } from "./openapi-codegen.runner-6Yth6QZC.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
@@ -0,0 +1,26 @@
1
+ import { createContext, use, useMemo } from "react";
2
+ import { jsx } from "react/jsx-runtime";
3
+ //#region src/lib/config/workspace.context.tsx
4
+ let OpenApiWorkspaceContext;
5
+ (function(_OpenApiWorkspaceContext) {
6
+ const Context = createContext({});
7
+ _OpenApiWorkspaceContext.Provider = ({ values, children }) => {
8
+ const contextValues = useMemo(() => values ?? {}, [values]);
9
+ return /* @__PURE__ */ jsx(Context.Provider, {
10
+ value: contextValues,
11
+ children
12
+ });
13
+ };
14
+ _OpenApiWorkspaceContext.useContext = () => {
15
+ return use(Context);
16
+ };
17
+ _OpenApiWorkspaceContext.resolveParam = (context, name, value) => {
18
+ if (value != null) return value;
19
+ const workspaceValue = context[name];
20
+ if (workspaceValue == null) throw new Error(`Missing workspace context param "${name}"`);
21
+ return workspaceValue;
22
+ };
23
+ })(OpenApiWorkspaceContext || (OpenApiWorkspaceContext = {}));
24
+ const useWorkspaceContext = () => OpenApiWorkspaceContext.useContext();
25
+ //#endregion
26
+ export { useWorkspaceContext as n, OpenApiWorkspaceContext as t };
@@ -0,0 +1,23 @@
1
+ import { PropsWithChildren } from "react";
2
+ //#region src/lib/config/router.context.d.ts
3
+ interface RouterProviderProps {
4
+ replace: (url: string) => void;
5
+ }
6
+ declare namespace OpenApiRouter {
7
+ const Provider: ({ children, replace }: PropsWithChildren<RouterProviderProps>) => import("react").JSX.Element;
8
+ const useRouter: () => RouterProviderProps;
9
+ }
10
+ //#endregion
11
+ //#region src/lib/config/workspace.context.d.ts
12
+ type WorkspaceValues = Record<string, unknown>;
13
+ interface WorkspaceProviderProps {
14
+ values?: WorkspaceValues;
15
+ }
16
+ declare namespace OpenApiWorkspaceContext {
17
+ const Provider: ({ values, children }: PropsWithChildren<WorkspaceProviderProps>) => import("react").JSX.Element;
18
+ const useContext: <TValues extends WorkspaceValues = WorkspaceValues>() => TValues;
19
+ const resolveParam: <T>(context: WorkspaceValues, name: string, value: T | null | undefined) => T;
20
+ }
21
+ declare const useWorkspaceContext: <TValues extends WorkspaceValues = WorkspaceValues>() => TValues;
22
+ //#endregion
23
+ export { useWorkspaceContext as n, OpenApiRouter as r, OpenApiWorkspaceContext as t };
package/dist/zod.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 { z } from "zod";
3
3
  //#region src/zod.d.ts
4
4
  declare namespace ZodExtended {
package/dist/zod.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { i as SharedErrorHandler } from "./error-handling-BMXC5P08.mjs";
1
+ import { i as SharedErrorHandler } from "./error-handling-BeydPL7s.mjs";
2
2
  import { z } from "zod";
3
3
  //#region src/zod.ts
4
4
  let ZodExtended;
package/package.json CHANGED
@@ -23,7 +23,9 @@
23
23
  "src/assets/**"
24
24
  ],
25
25
  "type": "module",
26
+ "sideEffects": false,
26
27
  "main": "./dist/index.mjs",
28
+ "module": "./dist/index.mjs",
27
29
  "types": "./dist/index.d.mts",
28
30
  "exports": {
29
31
  ".": {
@@ -62,6 +64,26 @@
62
64
  "./rest": {
63
65
  "types": "./dist/rest.d.mts",
64
66
  "import": "./dist/rest.mjs"
67
+ },
68
+ "./axios": {
69
+ "types": "./dist/axios.d.mts",
70
+ "import": "./dist/axios.mjs"
71
+ },
72
+ "./errors": {
73
+ "types": "./dist/errors.d.mts",
74
+ "import": "./dist/errors.mjs"
75
+ },
76
+ "./query": {
77
+ "types": "./dist/query.d.mts",
78
+ "import": "./dist/query.mjs"
79
+ },
80
+ "./config": {
81
+ "types": "./dist/config.d.mts",
82
+ "import": "./dist/config.mjs"
83
+ },
84
+ "./auth": {
85
+ "types": "./dist/auth.d.mts",
86
+ "import": "./dist/auth.mjs"
65
87
  }
66
88
  },
67
89
  "scripts": {
@@ -88,7 +110,8 @@
88
110
  "dev:generate": "rm -rf ./output && bun run start generate --config ./test/config.mjs",
89
111
  "dev:check": "bun run start check --config ./test/config.mjs",
90
112
  "snapshot:openapi-localhost": "bun ./scripts/snapshot-openapi-localhost.mjs",
91
- "bench:vite-codegen": "bun ./scripts/benchmark-vite-codegen.mjs"
113
+ "bench:vite-codegen": "bun ./scripts/benchmark-vite-codegen.mjs",
114
+ "verify:tree-shaking": "bun run build:ts && bun ./scripts/verify-tree-shaking.mjs"
92
115
  },
93
116
  "dependencies": {
94
117
  "@orpc/contract": "^1.14.3",
@@ -110,6 +133,8 @@
110
133
  "@types/react": "^19.2.14",
111
134
  "@types/yargs": "^17.0.35",
112
135
  "@vitejs/plugin-react": "^5.1.4",
136
+ "axios": "^1.13.1",
137
+ "i18next": "^25.8.11",
113
138
  "oxfmt": "^0.34.0",
114
139
  "oxlint": "1.50.0",
115
140
  "oxlint-tsgolint": "^0.15.0",
@@ -140,6 +165,18 @@
140
165
  "@casl/react": {
141
166
  "optional": true
142
167
  },
168
+ "@tanstack/react-query": {
169
+ "optional": true
170
+ },
171
+ "axios": {
172
+ "optional": true
173
+ },
174
+ "i18next": {
175
+ "optional": true
176
+ },
177
+ "react": {
178
+ "optional": true
179
+ },
143
180
  "vite": {
144
181
  "optional": true
145
182
  }
@@ -149,5 +186,5 @@
149
186
  "node": ">= 18"
150
187
  },
151
188
  "packageManager": "bun@1.3.14",
152
- "version": "3.2.0-rc.8"
189
+ "version": "3.2.0-rc.9"
153
190
  }