@povio/openapi-codegen-cli 3.2.0-rc.9 → 3.3.0-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/README.md +2 -51
- package/dist/acl.d.mts +19 -6
- package/dist/acl.mjs +7 -7
- package/dist/{auth.context-COWO6ssl.mjs → auth.context-BAz8frX9.mjs} +18 -1
- package/dist/{config-DgrOddSC.d.mts → config-BQqze8rU.d.mts} +2 -1
- package/dist/{error-handling-BeydPL7s.mjs → error-handling-CsnufAil.mjs} +45 -21
- package/dist/{error-handling-LPEPQV1V.d.mts → error-handling-D6ZYITQ3.d.mts} +42 -3
- package/dist/generate.runner-BeCGJ1ar.mjs +87 -0
- package/dist/{generateCodeFromOpenAPIDoc-iEa8YAUQ.cjs → generateCodeFromOpenAPIDoc-KQT4kYxY.mjs} +2340 -1393
- package/dist/generator.d.mts +10 -3
- package/dist/generator.mjs +4 -7
- package/dist/index.d.mts +198 -12
- package/dist/index.mjs +256 -12
- package/dist/metro.cjs +4861 -112
- package/dist/metro.d.mts +4 -3
- package/dist/metro.mjs +3 -3
- package/dist/{openapi-codegen.runner-6Yth6QZC.mjs → openapi-codegen.runner-nPBssrBL.mjs} +2 -3
- package/dist/{openapi-source.runner-BZ6ZLgRO.mjs → openapi-source.runner-8kCe-g9S.mjs} +6 -18
- package/dist/{openapi-source.runner-ykstqlPC.d.mts → openapi-source.runner-B6KKrXw7.d.mts} +8 -2
- package/dist/{options-KPf-Fti5.d.mts → options-DdQJ9BSc.d.mts} +1 -6
- package/dist/sh.d.mts +1 -1
- package/dist/sh.mjs +53 -37
- package/dist/tiny.d.mts +1 -1
- package/dist/tiny.mjs +1 -1
- package/dist/vite.d.mts +4 -3
- package/dist/vite.mjs +4 -5
- package/dist/zod.d.mts +7 -2
- package/dist/zod.mjs +1 -1
- package/package.json +22 -69
- package/dist/AuthGuard-GbtTDXs0.d.mts +0 -32
- package/dist/AuthGuard-qpAtHaBz.mjs +0 -24
- package/dist/auth.d.mts +0 -2
- package/dist/auth.mjs +0 -3
- package/dist/axios.d.mts +0 -2
- package/dist/axios.mjs +0 -2
- package/dist/config.d.mts +0 -4
- package/dist/config.mjs +0 -5
- package/dist/errors.d.mts +0 -3
- package/dist/errors.mjs +0 -2
- package/dist/generate.runner-D8AYuEFm.mjs +0 -184
- package/dist/generate.utils-CT-LA-gX.cjs +0 -2267
- package/dist/generateCodeFromOpenAPIDoc--ufinTug.mjs +0 -2061
- package/dist/getDataFromOpenAPIDoc-D8w0QElH.mjs +0 -2011
- package/dist/i18n-B_brQh4X.d.mts +0 -38
- package/dist/i18n-D-FesqFb.mjs +0 -36
- package/dist/native-bindings-BTQGSGhU.mjs +0 -1480
- package/dist/native-rest-interceptor-CAWR8H5Y.mjs +0 -208
- package/dist/native-rest-interceptor-Cz6saoq5.d.mts +0 -46
- package/dist/native.d.mts +0 -3
- package/dist/native.mjs +0 -3
- package/dist/openapi-codegen-native-darwin-arm64.node +0 -0
- package/dist/openapi-codegen-native-linux-x64.node +0 -0
- package/dist/openapi-codegen-native-win32-x64.node +0 -0
- package/dist/query.d.mts +0 -3
- package/dist/query.mjs +0 -3
- package/dist/queryConfig.context-CRJOgf19.d.mts +0 -22
- package/dist/queryConfig.context-CldQ5YL9.mjs +0 -34
- package/dist/rest-client-CQyFvqYC.d.mts +0 -55
- package/dist/rest-interceptor-D5NCNTm1.mjs +0 -115
- package/dist/rest-transport.types-DM5-qyOJ.d.mts +0 -66
- package/dist/rest-transport.types-DxitRtsB.mjs +0 -11
- package/dist/rest.d.mts +0 -2
- package/dist/rest.mjs +0 -2
- package/dist/rest.utils-rezWAIYL.d.mts +0 -10
- package/dist/router.context-EPlMBk3G.mjs +0 -21
- package/dist/useMutationEffects-DIdL8tlx.d.mts +0 -29
- package/dist/useMutationEffects-PB1fvKWM.mjs +0 -68
- package/dist/workspace.context-XWvQ_7Hg.mjs +0 -26
- package/dist/workspace.context-isVY9ves.d.mts +0 -23
|
@@ -1,29 +0,0 @@
|
|
|
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 };
|
|
@@ -1,68 +0,0 @@
|
|
|
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 };
|
|
@@ -1,26 +0,0 @@
|
|
|
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 };
|
|
@@ -1,23 +0,0 @@
|
|
|
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 };
|