@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.
- package/dist/AuthGuard-GbtTDXs0.d.mts +32 -0
- package/dist/AuthGuard-qpAtHaBz.mjs +24 -0
- package/dist/acl.d.mts +1 -1
- package/dist/acl.mjs +3 -2
- package/dist/{auth.context-YFWzkwoN.mjs → auth.context-COWO6ssl.mjs} +1 -19
- package/dist/auth.d.mts +2 -0
- package/dist/auth.mjs +3 -0
- package/dist/axios.d.mts +2 -0
- package/dist/axios.mjs +2 -0
- package/dist/config.d.mts +4 -0
- package/dist/config.mjs +5 -0
- package/dist/{error-handling-BMXC5P08.mjs → error-handling-BeydPL7s.mjs} +2 -36
- package/dist/{error-handling-CNOHs4Fc.d.mts → error-handling-LPEPQV1V.d.mts} +2 -38
- package/dist/errors.d.mts +3 -0
- package/dist/errors.mjs +2 -0
- package/dist/{generate.runner-BvSprH6D.mjs → generate.runner-BD9BbYIx.mjs} +9 -32
- package/dist/{generate.utils-CH2U2Dpr.cjs → generate.utils-BqlgVd-i.cjs} +11 -58
- package/dist/{generateCodeFromOpenAPIDoc-CZT3sThI.cjs → generateCodeFromOpenAPIDoc-CkVgg5Zy.cjs} +111 -41
- package/dist/{generateCodeFromOpenAPIDoc-glAKBEGP.mjs → generateCodeFromOpenAPIDoc-idp1RVDa.mjs} +77 -12
- package/dist/generator.mjs +3 -3
- package/dist/{getDataFromOpenAPIDoc-7RxjULpB.mjs → getDataFromOpenAPIDoc-Cyrm3VKA.mjs} +16 -11
- package/dist/i18n-B_brQh4X.d.mts +38 -0
- package/dist/i18n-D-FesqFb.mjs +36 -0
- package/dist/index.d.mts +9 -160
- package/dist/index.mjs +10 -257
- package/dist/metro.cjs +2 -2
- package/dist/metro.mjs +2 -2
- package/dist/{native-rest-interceptor-CAWR8H5Y.mjs → native-rest-interceptor-Np4Ov54n.mjs} +15 -8
- package/dist/{native-rest-interceptor-Cz6saoq5.d.mts → native-rest-interceptor-PgziZt1f.d.mts} +4 -1
- package/dist/native.d.mts +1 -1
- package/dist/native.mjs +1 -1
- 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/{openapi-codegen.runner-C93V7SGj.mjs → openapi-codegen.runner-BZH4V6rq.mjs} +1 -1
- package/dist/{openapi-source.runner-BZ6ZLgRO.mjs → openapi-source.runner-DPUNTduQ.mjs} +7 -5
- package/dist/query.d.mts +3 -0
- package/dist/query.mjs +3 -0
- package/dist/queryConfig.context-CRJOgf19.d.mts +22 -0
- package/dist/queryConfig.context-CldQ5YL9.mjs +34 -0
- package/dist/rest-client-CQyFvqYC.d.mts +55 -0
- package/dist/rest-interceptor-D5NCNTm1.mjs +115 -0
- package/dist/rest.utils-rezWAIYL.d.mts +10 -0
- package/dist/router.context-EPlMBk3G.mjs +21 -0
- package/dist/sh.mjs +9 -7
- package/dist/tiny.mjs +1 -1
- package/dist/useMutationEffects-DIdL8tlx.d.mts +29 -0
- package/dist/useMutationEffects-PB1fvKWM.mjs +68 -0
- package/dist/vite.mjs +2 -2
- package/dist/workspace.context-XWvQ_7Hg.mjs +26 -0
- package/dist/workspace.context-isVY9ves.d.mts +23 -0
- package/dist/zod.d.mts +1 -1
- package/dist/zod.mjs +1 -1
- package/package.json +44 -7
package/dist/index.d.mts
CHANGED
|
@@ -1,163 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { i as resources, n as configureTranslations, r as ns, t as TranslateFunction } from "./i18n-B_brQh4X.mjs";
|
|
2
|
+
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";
|
|
3
|
+
import { n as AuthGuardProps, r as AuthContext, t as AuthGuard } from "./AuthGuard-GbtTDXs0.mjs";
|
|
4
|
+
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";
|
|
5
|
+
import { n as useWorkspaceContext, r as OpenApiRouter, t as OpenApiWorkspaceContext } from "./workspace.context-isVY9ves.mjs";
|
|
6
|
+
import { i as QueryModule, n as InvalidationMapFunc, r as OpenApiQueryConfig, t as InvalidationMap } from "./queryConfig.context-CRJOgf19.mjs";
|
|
7
|
+
import { t as RestUtils } from "./rest.utils-rezWAIYL.mjs";
|
|
2
8
|
import { t as OpenAPICodegenConfig } from "./config-DgrOddSC.mjs";
|
|
3
9
|
import { d as TransportResponse, l as TransportRequest, n as HttpError, p as UploadProgress, u as TransportRequestConfig } from "./rest-transport.types-DM5-qyOJ.mjs";
|
|
4
|
-
import { n as NativeRestInterceptor, r as NativeRestClient, t as NativeInterceptor } from "./native-rest-interceptor-
|
|
5
|
-
import {
|
|
6
|
-
import { z } from "zod";
|
|
7
|
-
import { PropsWithChildren, ReactNode } from "react";
|
|
8
|
-
import { InfiniteData, QueryKey, UseInfiniteQueryOptions, UseMutationOptions, UseQueryOptions } from "@tanstack/react-query";
|
|
9
|
-
//#region src/lib/rest/rest-interceptor.d.ts
|
|
10
|
-
declare class RestInterceptor<T extends any[]> {
|
|
11
|
-
private applyInterceptor;
|
|
12
|
-
private interceptorIdMap;
|
|
13
|
-
constructor(applyInterceptor: (client: AxiosInstance, ...args: T) => number);
|
|
14
|
-
addInterceptor(client: AxiosInstance, ...args: T): void;
|
|
15
|
-
removeInterceptor(client: AxiosInstance): void;
|
|
16
|
-
}
|
|
17
|
-
//#endregion
|
|
18
|
-
//#region src/lib/rest/rest-client.types.d.ts
|
|
19
|
-
type GeneralErrorCodes$1 = string;
|
|
20
|
-
interface RequestInfo<ZOutput, ECodes extends string> {
|
|
21
|
-
resSchema: z.ZodType<ZOutput>;
|
|
22
|
-
errorHandler?: ErrorHandler<ECodes>;
|
|
23
|
-
}
|
|
24
|
-
interface RequestConfig<IsRawRes extends boolean = false> {
|
|
25
|
-
rawResponse?: IsRawRes;
|
|
26
|
-
allowInvalidResponseData?: boolean;
|
|
27
|
-
}
|
|
28
|
-
type Response<ZOutput, IsRawRes extends boolean = false> = IsRawRes extends true ? AxiosResponse<ZOutput> : ZOutput;
|
|
29
|
-
interface RestClient {
|
|
30
|
-
attachInterceptors<T extends any[]>(interceptors?: RestInterceptor<T>[], ...args: T): void;
|
|
31
|
-
attachInterceptor<T extends any[]>(interceptor: RestInterceptor<T>, ...args: T): void;
|
|
32
|
-
ejectInterceptor<T extends any[]>(interceptor: RestInterceptor<T>): void;
|
|
33
|
-
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>>;
|
|
34
|
-
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>>;
|
|
35
|
-
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>>;
|
|
36
|
-
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>>;
|
|
37
|
-
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>>;
|
|
38
|
-
}
|
|
39
|
-
//#endregion
|
|
40
|
-
//#region src/lib/rest/rest-client.d.ts
|
|
41
|
-
declare class RestClient$1 implements RestClient {
|
|
42
|
-
private readonly client;
|
|
43
|
-
private readonly errorHandler;
|
|
44
|
-
constructor({ config, interceptors, errorHandler }?: {
|
|
45
|
-
config?: CreateAxiosDefaults;
|
|
46
|
-
interceptors?: RestInterceptor<any[]>[];
|
|
47
|
-
errorHandler?: ErrorHandler<any>;
|
|
48
|
-
});
|
|
49
|
-
attachInterceptors<T extends any[]>(interceptors?: RestInterceptor<T>[], ...args: T): void;
|
|
50
|
-
attachInterceptor<T extends any[]>(interceptor: RestInterceptor<T>, ...args: T): void;
|
|
51
|
-
ejectInterceptor<T extends any[]>(interceptor: RestInterceptor<T>): void;
|
|
52
|
-
get<ZOutput, ECodes extends string = GeneralErrorCodes, IsRawRes extends boolean = false>(requestInfo: RequestInfo<ZOutput, ECodes>, url: string, requestConfig?: AxiosRequestConfig & RequestConfig<IsRawRes>): Promise<Response<ZOutput, IsRawRes>>;
|
|
53
|
-
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>>;
|
|
54
|
-
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>>;
|
|
55
|
-
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>>;
|
|
56
|
-
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>>;
|
|
57
|
-
private makeRequest;
|
|
58
|
-
}
|
|
59
|
-
//#endregion
|
|
60
|
-
//#region src/lib/rest/rest.utils.d.ts
|
|
61
|
-
declare namespace RestUtils {
|
|
62
|
-
const extractServerResponseCode: (e: unknown) => string | number | null;
|
|
63
|
-
const doesServerErrorMessageContain: (e: AxiosError, text: string) => boolean;
|
|
64
|
-
const extractServerErrorMessage: (e: unknown) => string | null;
|
|
65
|
-
const extractContentDispositionFilename: (headers: AxiosResponseHeaders) => string | undefined;
|
|
66
|
-
}
|
|
67
|
-
//#endregion
|
|
68
|
-
//#region src/lib/react-query.types.d.ts
|
|
69
|
-
type Function = (...args: any) => any;
|
|
70
|
-
type IfAny<T, Y, N> = 0 extends 1 & T ? Y : N;
|
|
71
|
-
type IsAny<T> = IfAny<T, true, never>;
|
|
72
|
-
type IsUnknown<T, Y, N = T> = IsAny<T> extends never ? (unknown extends T ? Y : N) : N;
|
|
73
|
-
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">;
|
|
74
|
-
type AppMutationOptions<TFunction extends Function, TVariables = void, TData = Awaited<ReturnType<TFunction>>, TErrorCodes = GeneralErrorCodes> = Omit<UseMutationOptions<TData, ApplicationException<TErrorCodes>, TVariables>, "mutationKey" | "mutationFn">;
|
|
75
|
-
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">;
|
|
76
|
-
//#endregion
|
|
77
|
-
//#region src/lib/config/queryConfig.context.d.ts
|
|
78
|
-
type QueryModule = string | number | symbol;
|
|
79
|
-
type InvalidationMapFunc<TData = any, TVariables = any> = (data: TData, variables: TVariables) => QueryKey[];
|
|
80
|
-
type InvalidationMap<TQueryModule extends QueryModule = QueryModule, TData = any, TVariables = any> = Partial<Record<TQueryModule, InvalidationMapFunc<TData, TVariables>>>;
|
|
81
|
-
declare namespace OpenApiQueryConfig {
|
|
82
|
-
export interface Type<TQueryModule extends QueryModule = QueryModule> {
|
|
83
|
-
preferUpdate?: boolean;
|
|
84
|
-
invalidateCurrentModule?: boolean;
|
|
85
|
-
invalidationMap?: InvalidationMap<TQueryModule>;
|
|
86
|
-
crossTabInvalidation?: boolean;
|
|
87
|
-
allowInvalidResponseData?: boolean;
|
|
88
|
-
onError?: (error: unknown) => void;
|
|
89
|
-
}
|
|
90
|
-
type ProviderProps<TQueryModule extends QueryModule = QueryModule> = Type<TQueryModule>;
|
|
91
|
-
export function Provider<TQueryModule extends QueryModule = QueryModule>({ preferUpdate, invalidateCurrentModule, invalidationMap, crossTabInvalidation, allowInvalidResponseData, onError, children }: PropsWithChildren<ProviderProps<TQueryModule>>): import("react").JSX.Element;
|
|
92
|
-
export const useConfig: <TQueryModule extends QueryModule = QueryModule>() => Type<TQueryModule>;
|
|
93
|
-
export {};
|
|
94
|
-
}
|
|
95
|
-
//#endregion
|
|
96
|
-
//#region src/lib/react-query/useMutationEffects.d.ts
|
|
97
|
-
interface MutationEffectsOptions<TQueryModule extends QueryModule = QueryModule> {
|
|
98
|
-
invalidateCurrentModule?: boolean;
|
|
99
|
-
crossTabInvalidation?: boolean;
|
|
100
|
-
invalidationMap?: InvalidationMap<TQueryModule>;
|
|
101
|
-
invalidateModules?: QueryModule[];
|
|
102
|
-
invalidateKeys?: QueryKey[];
|
|
103
|
-
preferUpdate?: boolean;
|
|
104
|
-
}
|
|
105
|
-
interface UseMutationEffectsProps<TQueryModule extends QueryModule = QueryModule> {
|
|
106
|
-
currentModule: TQueryModule;
|
|
107
|
-
}
|
|
108
|
-
declare function useMutationEffects<TQueryModule extends QueryModule = QueryModule>({ currentModule }: UseMutationEffectsProps<TQueryModule>): {
|
|
109
|
-
runMutationEffects: <TData, TVariables>(data: TData, variables: TVariables, options?: MutationEffectsOptions<TQueryModule>, updateKeys?: QueryKey[]) => Promise<void>;
|
|
110
|
-
};
|
|
111
|
-
//#endregion
|
|
112
|
-
//#region src/lib/config/router.context.d.ts
|
|
113
|
-
interface RouterProviderProps {
|
|
114
|
-
replace: (url: string) => void;
|
|
115
|
-
}
|
|
116
|
-
declare namespace OpenApiRouter {
|
|
117
|
-
const Provider: ({ children, replace }: PropsWithChildren<RouterProviderProps>) => import("react").JSX.Element;
|
|
118
|
-
const useRouter: () => RouterProviderProps;
|
|
119
|
-
}
|
|
120
|
-
//#endregion
|
|
121
|
-
//#region src/lib/config/workspace.context.d.ts
|
|
122
|
-
type WorkspaceValues = Record<string, unknown>;
|
|
123
|
-
interface WorkspaceProviderProps {
|
|
124
|
-
values?: WorkspaceValues;
|
|
125
|
-
}
|
|
126
|
-
declare namespace OpenApiWorkspaceContext {
|
|
127
|
-
const Provider: ({ values, children }: PropsWithChildren<WorkspaceProviderProps>) => import("react").JSX.Element;
|
|
128
|
-
const useContext: <TValues extends WorkspaceValues = WorkspaceValues>() => TValues;
|
|
129
|
-
const resolveParam: <T>(context: WorkspaceValues, name: string, value: T | null | undefined) => T;
|
|
130
|
-
}
|
|
131
|
-
declare const useWorkspaceContext: <TValues extends WorkspaceValues = WorkspaceValues>() => TValues;
|
|
132
|
-
//#endregion
|
|
133
|
-
//#region src/lib/auth/auth.context.d.ts
|
|
134
|
-
declare namespace AuthContext {
|
|
135
|
-
export interface Routes {
|
|
136
|
-
authenticated?: string;
|
|
137
|
-
unauthenticated?: string;
|
|
138
|
-
}
|
|
139
|
-
interface Type<TUser = unknown> {
|
|
140
|
-
isAuthenticated: boolean;
|
|
141
|
-
isInitializing: boolean;
|
|
142
|
-
logout: () => void;
|
|
143
|
-
updateTokens?: (accessToken: string | null, refreshToken?: string | null) => void;
|
|
144
|
-
accessToken?: string | null;
|
|
145
|
-
user?: TUser | null;
|
|
146
|
-
userPromise?: () => Promise<TUser | null>;
|
|
147
|
-
routes?: Routes;
|
|
148
|
-
loadingState?: ReactNode;
|
|
149
|
-
}
|
|
150
|
-
type ProviderProps<TUser = unknown> = Type<TUser>;
|
|
151
|
-
export const Provider: <TUser>({ isAuthenticated, isInitializing, logout, updateTokens, accessToken, user, userPromise, routes, loadingState, children }: PropsWithChildren<ProviderProps<TUser>>) => import("react").JSX.Element;
|
|
152
|
-
export const useAuth: <TUser>() => Type<TUser>;
|
|
153
|
-
export {};
|
|
154
|
-
}
|
|
155
|
-
//#endregion
|
|
156
|
-
//#region src/lib/auth/AuthGuard.d.ts
|
|
157
|
-
interface AuthGuardProps {
|
|
158
|
-
type: "public-only" | "private";
|
|
159
|
-
redirectTo?: string;
|
|
160
|
-
}
|
|
161
|
-
declare const AuthGuard: ({ type, redirectTo, children }: PropsWithChildren<AuthGuardProps>) => import("react").ReactNode;
|
|
162
|
-
//#endregion
|
|
10
|
+
import { n as NativeRestInterceptor, r as NativeRestClient, t as NativeInterceptor } from "./native-rest-interceptor-PgziZt1f.mjs";
|
|
11
|
+
import { a as AppQueryOptions, i as AppMutationOptions, n as useMutationEffects, r as AppInfiniteQueryOptions, t as MutationEffectsOptions } from "./useMutationEffects-DIdL8tlx.mjs";
|
|
163
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
|
@@ -1,259 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { i as resources, n as ns, t as configureTranslations } from "./i18n-D-FesqFb.mjs";
|
|
2
|
+
import { a as RestUtils, i as SharedErrorHandler, n as DomainErrorRegistry, r as ErrorHandler, t as ApplicationException } from "./error-handling-BeydPL7s.mjs";
|
|
2
3
|
import { t as HttpError } from "./rest-transport.types-DxitRtsB.mjs";
|
|
3
|
-
import { n as
|
|
4
|
-
import { n as
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
var RestClient = class {
|
|
12
|
-
client;
|
|
13
|
-
errorHandler;
|
|
14
|
-
constructor({ config, interceptors, errorHandler } = {}) {
|
|
15
|
-
this.client = axios.create(config);
|
|
16
|
-
this.errorHandler = errorHandler ?? SharedErrorHandler;
|
|
17
|
-
this.attachInterceptors(interceptors);
|
|
18
|
-
}
|
|
19
|
-
attachInterceptors(interceptors, ...args) {
|
|
20
|
-
if (interceptors != null) interceptors.forEach((interceptor) => this.attachInterceptor(interceptor, ...args));
|
|
21
|
-
}
|
|
22
|
-
attachInterceptor(interceptor, ...args) {
|
|
23
|
-
interceptor.addInterceptor(this.client, ...args);
|
|
24
|
-
}
|
|
25
|
-
ejectInterceptor(interceptor) {
|
|
26
|
-
interceptor.removeInterceptor(this.client);
|
|
27
|
-
}
|
|
28
|
-
async get(requestInfo, url, requestConfig) {
|
|
29
|
-
return this.makeRequest(requestInfo, {
|
|
30
|
-
...requestConfig,
|
|
31
|
-
method: "get",
|
|
32
|
-
url
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
async post(requestInfo, url, data, requestConfig) {
|
|
36
|
-
return this.makeRequest(requestInfo, {
|
|
37
|
-
...requestConfig,
|
|
38
|
-
method: "post",
|
|
39
|
-
url,
|
|
40
|
-
data
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
async patch(requestInfo, url, data, requestConfig) {
|
|
44
|
-
return this.makeRequest(requestInfo, {
|
|
45
|
-
...requestConfig,
|
|
46
|
-
method: "patch",
|
|
47
|
-
url,
|
|
48
|
-
data
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
async put(requestInfo, url, data, requestConfig) {
|
|
52
|
-
return this.makeRequest(requestInfo, {
|
|
53
|
-
...requestConfig,
|
|
54
|
-
method: "put",
|
|
55
|
-
url,
|
|
56
|
-
data
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
async delete(requestInfo, url, data, requestConfig) {
|
|
60
|
-
return this.makeRequest(requestInfo, {
|
|
61
|
-
...requestConfig,
|
|
62
|
-
method: "delete",
|
|
63
|
-
url,
|
|
64
|
-
data
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
async makeRequest(requestInfo, requestConfig) {
|
|
68
|
-
const errorStack = (/* @__PURE__ */ new Error()).stack;
|
|
69
|
-
try {
|
|
70
|
-
const { rawResponse, allowInvalidResponseData, ...config } = requestConfig;
|
|
71
|
-
const res = await this.client(config);
|
|
72
|
-
const responseData = res.status === 204 && res.data === "" ? void 0 : res.data;
|
|
73
|
-
const parseResult = requestInfo.resSchema.safeParse(responseData);
|
|
74
|
-
let resData;
|
|
75
|
-
if (parseResult.success) resData = parseResult.data;
|
|
76
|
-
else if (allowInvalidResponseData && config.method === "get") {
|
|
77
|
-
parseResult.error.name = "BE Response schema mismatch - ZodError";
|
|
78
|
-
parseResult.error.stack = [parseResult.error.stack, ...errorStack?.split("\n").slice(2) ?? []].join("\n");
|
|
79
|
-
console.error(parseResult.error);
|
|
80
|
-
resData = res.data;
|
|
81
|
-
} else throw parseResult.error;
|
|
82
|
-
return rawResponse ? {
|
|
83
|
-
...res,
|
|
84
|
-
data: resData
|
|
85
|
-
} : resData;
|
|
86
|
-
} catch (error) {
|
|
87
|
-
if (error instanceof z.ZodError) {
|
|
88
|
-
error.name = "BE Response schema mismatch - ZodError";
|
|
89
|
-
error.stack = [error.stack, ...errorStack?.split("\n").slice(2) ?? []].join("\n");
|
|
90
|
-
}
|
|
91
|
-
(requestInfo.errorHandler ?? this.errorHandler).rethrowError(error);
|
|
92
|
-
throw error;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
|
-
//#endregion
|
|
97
|
-
//#region src/lib/rest/rest-interceptor.ts
|
|
98
|
-
var RestInterceptor = class {
|
|
99
|
-
applyInterceptor;
|
|
100
|
-
interceptorIdMap = [];
|
|
101
|
-
constructor(applyInterceptor) {
|
|
102
|
-
this.applyInterceptor = applyInterceptor;
|
|
103
|
-
}
|
|
104
|
-
addInterceptor(client, ...args) {
|
|
105
|
-
this.removeInterceptor(client);
|
|
106
|
-
const interceptorId = this.applyInterceptor(client, ...args);
|
|
107
|
-
this.interceptorIdMap.push({
|
|
108
|
-
client,
|
|
109
|
-
interceptorId
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
removeInterceptor(client) {
|
|
113
|
-
const interceptorId = this.interceptorIdMap.find((i) => i.client === client)?.interceptorId;
|
|
114
|
-
if (interceptorId != null) {
|
|
115
|
-
client.interceptors.request.eject(interceptorId);
|
|
116
|
-
this.interceptorIdMap = this.interceptorIdMap.filter((i) => i.client !== client);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
};
|
|
120
|
-
//#endregion
|
|
121
|
-
//#region src/lib/config/queryConfig.context.tsx
|
|
122
|
-
let OpenApiQueryConfig;
|
|
123
|
-
(function(_OpenApiQueryConfig) {
|
|
124
|
-
const Context = createContext({});
|
|
125
|
-
function Provider({ preferUpdate, invalidateCurrentModule, invalidationMap, crossTabInvalidation, allowInvalidResponseData, onError, children }) {
|
|
126
|
-
const value = useMemo(() => ({
|
|
127
|
-
preferUpdate,
|
|
128
|
-
invalidateCurrentModule,
|
|
129
|
-
invalidationMap,
|
|
130
|
-
crossTabInvalidation,
|
|
131
|
-
allowInvalidResponseData,
|
|
132
|
-
onError
|
|
133
|
-
}), [
|
|
134
|
-
preferUpdate,
|
|
135
|
-
invalidateCurrentModule,
|
|
136
|
-
invalidationMap,
|
|
137
|
-
crossTabInvalidation,
|
|
138
|
-
allowInvalidResponseData,
|
|
139
|
-
onError
|
|
140
|
-
]);
|
|
141
|
-
return /* @__PURE__ */ jsx(Context.Provider, {
|
|
142
|
-
value,
|
|
143
|
-
children
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
_OpenApiQueryConfig.Provider = Provider;
|
|
147
|
-
_OpenApiQueryConfig.useConfig = () => {
|
|
148
|
-
return use(Context) ?? {};
|
|
149
|
-
};
|
|
150
|
-
})(OpenApiQueryConfig || (OpenApiQueryConfig = {}));
|
|
151
|
-
//#endregion
|
|
152
|
-
//#region src/lib/react-query/cross-tab-invalidation.ts
|
|
153
|
-
const CROSS_TAB_INVALIDATE_KEY = "__rq_invalidate__";
|
|
154
|
-
const broadcastQueryInvalidation = (queryKeys) => {
|
|
155
|
-
localStorage.setItem(CROSS_TAB_INVALIDATE_KEY, JSON.stringify({
|
|
156
|
-
keys: queryKeys,
|
|
157
|
-
timestamp: Date.now()
|
|
158
|
-
}));
|
|
159
|
-
};
|
|
160
|
-
let isListenerSetUp = false;
|
|
161
|
-
const setupCrossTabListener = (queryClient) => {
|
|
162
|
-
if (isListenerSetUp) return;
|
|
163
|
-
isListenerSetUp = true;
|
|
164
|
-
window.addEventListener("storage", (e) => {
|
|
165
|
-
if (e.key !== CROSS_TAB_INVALIDATE_KEY || !e.newValue) return;
|
|
166
|
-
try {
|
|
167
|
-
const { keys } = JSON.parse(e.newValue);
|
|
168
|
-
for (const queryKey of keys) queryClient.invalidateQueries({ queryKey });
|
|
169
|
-
} catch {}
|
|
170
|
-
});
|
|
171
|
-
};
|
|
172
|
-
//#endregion
|
|
173
|
-
//#region src/lib/react-query/useMutationEffects.ts
|
|
174
|
-
function useMutationEffects({ currentModule }) {
|
|
175
|
-
const queryClient = useQueryClient();
|
|
176
|
-
const config = OpenApiQueryConfig.useConfig();
|
|
177
|
-
useEffect(() => {
|
|
178
|
-
if (!config.crossTabInvalidation) return;
|
|
179
|
-
setupCrossTabListener(queryClient);
|
|
180
|
-
}, [queryClient, config.crossTabInvalidation]);
|
|
181
|
-
return { runMutationEffects: useCallback(async (data, variables, options = {}, updateKeys) => {
|
|
182
|
-
const { invalidateCurrentModule, invalidationMap, invalidateModules, invalidateKeys, preferUpdate } = options;
|
|
183
|
-
const shouldUpdate = preferUpdate ?? config.preferUpdate ?? false;
|
|
184
|
-
const shouldInvalidateCurrentModule = invalidateCurrentModule ?? config.invalidateCurrentModule ?? true;
|
|
185
|
-
const isQueryKeyEqual = (keyA, keyB) => keyA.length === keyB.length && keyA.every((item, index) => item === keyB[index]);
|
|
186
|
-
const isQueryKeyPrefix = (queryKey, prefixKey) => prefixKey.length <= queryKey.length && prefixKey.every((item, index) => item === queryKey[index]);
|
|
187
|
-
const mappedInvalidationKeys = invalidationMap?.[currentModule]?.(data, variables) ?? config.invalidationMap?.[currentModule]?.(data, variables);
|
|
188
|
-
const shouldInvalidateQuery = (queryKey) => {
|
|
189
|
-
const isUpdateKey = updateKeys?.some((key) => isQueryKeyEqual(queryKey, key));
|
|
190
|
-
if (shouldUpdate && isUpdateKey) return false;
|
|
191
|
-
const isCurrentModule = shouldInvalidateCurrentModule && queryKey[0] === currentModule;
|
|
192
|
-
const isInvalidateModule = !!invalidateModules && invalidateModules.some((module) => queryKey[0] === module);
|
|
193
|
-
const isInvalidateKey = !!invalidateKeys && invalidateKeys.some((key) => isQueryKeyPrefix(queryKey, key));
|
|
194
|
-
const isMappedKey = !!mappedInvalidationKeys && mappedInvalidationKeys.some((key) => isQueryKeyPrefix(queryKey, key));
|
|
195
|
-
return isCurrentModule || isInvalidateModule || isInvalidateKey || isMappedKey;
|
|
196
|
-
};
|
|
197
|
-
const invalidatedQueryKeys = [];
|
|
198
|
-
const shouldBroadcast = options.crossTabInvalidation ?? config.crossTabInvalidation;
|
|
199
|
-
queryClient.invalidateQueries({ predicate: ({ queryKey }) => {
|
|
200
|
-
const shouldInvalidate = shouldInvalidateQuery(queryKey);
|
|
201
|
-
if (shouldInvalidate && shouldBroadcast) invalidatedQueryKeys.push([...queryKey]);
|
|
202
|
-
return shouldInvalidate;
|
|
203
|
-
} });
|
|
204
|
-
if (shouldBroadcast && invalidatedQueryKeys.length > 0) broadcastQueryInvalidation(invalidatedQueryKeys);
|
|
205
|
-
if (shouldUpdate && updateKeys) updateKeys.map((queryKey) => queryClient.setQueryData(queryKey, data));
|
|
206
|
-
}, [
|
|
207
|
-
queryClient,
|
|
208
|
-
currentModule,
|
|
209
|
-
config.preferUpdate,
|
|
210
|
-
config.invalidateCurrentModule,
|
|
211
|
-
config.invalidationMap,
|
|
212
|
-
config.crossTabInvalidation
|
|
213
|
-
]) };
|
|
214
|
-
}
|
|
215
|
-
//#endregion
|
|
216
|
-
//#region src/lib/config/workspace.context.tsx
|
|
217
|
-
let OpenApiWorkspaceContext;
|
|
218
|
-
(function(_OpenApiWorkspaceContext) {
|
|
219
|
-
const Context = createContext({});
|
|
220
|
-
_OpenApiWorkspaceContext.Provider = ({ values, children }) => {
|
|
221
|
-
const contextValues = useMemo(() => values ?? {}, [values]);
|
|
222
|
-
return /* @__PURE__ */ jsx(Context.Provider, {
|
|
223
|
-
value: contextValues,
|
|
224
|
-
children
|
|
225
|
-
});
|
|
226
|
-
};
|
|
227
|
-
_OpenApiWorkspaceContext.useContext = () => {
|
|
228
|
-
return use(Context);
|
|
229
|
-
};
|
|
230
|
-
_OpenApiWorkspaceContext.resolveParam = (context, name, value) => {
|
|
231
|
-
if (value != null) return value;
|
|
232
|
-
const workspaceValue = context[name];
|
|
233
|
-
if (workspaceValue == null) throw new Error(`Missing workspace context param "${name}"`);
|
|
234
|
-
return workspaceValue;
|
|
235
|
-
};
|
|
236
|
-
})(OpenApiWorkspaceContext || (OpenApiWorkspaceContext = {}));
|
|
237
|
-
const useWorkspaceContext = () => OpenApiWorkspaceContext.useContext();
|
|
238
|
-
//#endregion
|
|
239
|
-
//#region src/lib/auth/AuthGuard.tsx
|
|
240
|
-
const AuthGuard = ({ type, redirectTo, children }) => {
|
|
241
|
-
const { isAuthenticated, routes, loadingState } = AuthContext.useAuth();
|
|
242
|
-
const { replace } = OpenApiRouter.useRouter();
|
|
243
|
-
const [hasMounted, setHasMounted] = useState(false);
|
|
244
|
-
useEffect(() => {
|
|
245
|
-
setHasMounted(true);
|
|
246
|
-
}, []);
|
|
247
|
-
if (!hasMounted) return loadingState;
|
|
248
|
-
if (type === "private" && !isAuthenticated) {
|
|
249
|
-
replace(redirectTo || routes?.unauthenticated || "/");
|
|
250
|
-
return null;
|
|
251
|
-
}
|
|
252
|
-
if (type === "public-only" && isAuthenticated) {
|
|
253
|
-
replace(redirectTo || routes?.authenticated || "/");
|
|
254
|
-
return null;
|
|
255
|
-
}
|
|
256
|
-
return children;
|
|
257
|
-
};
|
|
258
|
-
//#endregion
|
|
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-Np4Ov54n.mjs";
|
|
6
|
+
import { t as OpenApiQueryConfig } from "./queryConfig.context-CldQ5YL9.mjs";
|
|
7
|
+
import { t as useMutationEffects } from "./useMutationEffects-PB1fvKWM.mjs";
|
|
8
|
+
import { t as OpenApiRouter } from "./router.context-EPlMBk3G.mjs";
|
|
9
|
+
import { n as useWorkspaceContext, t as OpenApiWorkspaceContext } from "./workspace.context-XWvQ_7Hg.mjs";
|
|
10
|
+
import { t as AuthContext } from "./auth.context-COWO6ssl.mjs";
|
|
11
|
+
import { t as AuthGuard } from "./AuthGuard-qpAtHaBz.mjs";
|
|
259
12
|
export { ApplicationException, AuthContext, AuthGuard, DomainErrorRegistry, ErrorHandler, HttpError as NativeHttpError, NativeRestClient, NativeRestInterceptor, OpenApiQueryConfig, OpenApiRouter, OpenApiWorkspaceContext, RestClient, RestInterceptor, RestUtils, SharedErrorHandler, configureTranslations, ns, resources, useMutationEffects, useWorkspaceContext };
|
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-
|
|
2
|
+
const require_generate_utils = require("./generate.utils-BqlgVd-i.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-
|
|
100
|
+
const { generateCodeFromOpenAPIDoc } = await Promise.resolve().then(() => require("./generateCodeFromOpenAPIDoc-CkVgg5Zy.cjs"));
|
|
101
101
|
return generateCodeFromOpenAPIDoc(openApiDoc, config, profiler, {
|
|
102
102
|
source: nativeInput.source,
|
|
103
103
|
yaml: nativeInput.yaml
|
package/dist/metro.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as createOpenApiCodegenRunner } from "./openapi-codegen.runner-
|
|
2
|
-
import { i as normalizeWatchFolders, r as isTinyOpenApiFakeMode, t as createTinyOpenApiSourceRunner } from "./openapi-source.runner-
|
|
1
|
+
import { t as createOpenApiCodegenRunner } from "./openapi-codegen.runner-BZH4V6rq.mjs";
|
|
2
|
+
import { i as normalizeWatchFolders, r as isTinyOpenApiFakeMode, t as createTinyOpenApiSourceRunner } from "./openapi-source.runner-DPUNTduQ.mjs";
|
|
3
3
|
import fs from "fs";
|
|
4
4
|
import path from "path";
|
|
5
5
|
//#region src/metro/openapi-codegen.plugin.ts
|
|
@@ -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
|
-
|
|
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;
|
|
@@ -55,10 +57,12 @@ var NativeRestClient = class {
|
|
|
55
57
|
const headers = new Headers(this.headers);
|
|
56
58
|
new Headers(config.headers).forEach((value, key) => headers.set(key, value));
|
|
57
59
|
let body;
|
|
58
|
-
if (data != null)
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
if (data != null) {
|
|
61
|
+
if (data instanceof FormData || data instanceof Blob || typeof data === "string") body = data;
|
|
62
|
+
else {
|
|
63
|
+
body = JSON.stringify(data);
|
|
64
|
+
if (!headers.has("content-type")) headers.set("content-type", "application/json");
|
|
65
|
+
}
|
|
62
66
|
}
|
|
63
67
|
const request = {
|
|
64
68
|
url: this.resolveUrl(path, config.params),
|
|
@@ -84,7 +88,8 @@ var NativeRestClient = class {
|
|
|
84
88
|
} : dataResult;
|
|
85
89
|
} catch (error) {
|
|
86
90
|
if (error instanceof z.ZodError) error.name = "BE Response schema mismatch - ZodError";
|
|
87
|
-
|
|
91
|
+
const transformed = await this.runErrorInterceptors(error);
|
|
92
|
+
throw this.errorHandler ? this.errorHandler.rethrowError(transformed) : transformed;
|
|
88
93
|
}
|
|
89
94
|
}
|
|
90
95
|
async execute(request, config = {}, applyInterceptors = true) {
|
|
@@ -92,8 +97,10 @@ var NativeRestClient = class {
|
|
|
92
97
|
if (applyInterceptors) for (const interceptor of this.interceptors) next = await interceptor.onRequest?.(next) ?? next;
|
|
93
98
|
const timeoutController = config.timeout ? new AbortController() : void 0;
|
|
94
99
|
const timer = timeoutController ? setTimeout(() => timeoutController.abort(), config.timeout) : void 0;
|
|
95
|
-
if (timeoutController && next.signal)
|
|
96
|
-
|
|
100
|
+
if (timeoutController && next.signal) {
|
|
101
|
+
if (next.signal.aborted) timeoutController.abort(next.signal.reason);
|
|
102
|
+
else next.signal.addEventListener("abort", () => timeoutController.abort(next.signal?.reason), { once: true });
|
|
103
|
+
}
|
|
97
104
|
const signal = timeoutController?.signal ?? next.signal;
|
|
98
105
|
try {
|
|
99
106
|
const res = await this.fetch(next.url, {
|
package/dist/{native-rest-interceptor-Cz6saoq5.d.mts → native-rest-interceptor-PgziZt1f.d.mts}
RENAMED
|
@@ -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
|
-
|
|
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-
|
|
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-
|
|
2
|
+
import { n as NativeRestClient, t as NativeRestInterceptor } from "./native-rest-interceptor-Np4Ov54n.mjs";
|
|
3
3
|
export { HttpError, HttpError as NativeHttpError, NativeRestClient, NativeRestInterceptor };
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Wn as Profiler, n as runGenerate } from "./generate.runner-BD9BbYIx.mjs";
|
|
2
2
|
import path from "path";
|
|
3
3
|
//#region src/plugins/openapi-codegen.runner.ts
|
|
4
4
|
function createOpenApiCodegenRunner(config, options = {}) {
|
|
@@ -314,11 +314,13 @@ function collectContractSchemas(router, routerPath = [], schemas = {}, getSchema
|
|
|
314
314
|
if (procedure) {
|
|
315
315
|
const procedureName = routerPath.map(toPascalCase).join("");
|
|
316
316
|
const { inputSchema, outputSchema, route } = procedure;
|
|
317
|
-
if (inputSchema)
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
317
|
+
if (inputSchema) {
|
|
318
|
+
if (route.inputStructure === "detailed") {
|
|
319
|
+
addContractSchema(schemas, getObjectPropertySchema(inputSchema, "params"), procedureSchemaName(procedureName, "Params"), getSchemaName);
|
|
320
|
+
addContractSchema(schemas, getObjectPropertySchema(inputSchema, "query"), procedureSchemaName(procedureName, "Query"), getSchemaName);
|
|
321
|
+
addContractSchema(schemas, getObjectPropertySchema(inputSchema, "body") ?? inputSchema, procedureSchemaName(procedureName, "Request"), getSchemaName);
|
|
322
|
+
} else addContractSchema(schemas, inputSchema, procedureSchemaName(procedureName, getProcedureInputSchemaRole(route)), getSchemaName);
|
|
323
|
+
}
|
|
322
324
|
if (outputSchema && route.successStatus !== 204) addContractSchema(schemas, outputSchema, procedureSchemaName(procedureName, "Response"), getSchemaName, "output");
|
|
323
325
|
return schemas;
|
|
324
326
|
}
|
package/dist/query.d.mts
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { i as QueryModule, n as InvalidationMapFunc, r as OpenApiQueryConfig, t as InvalidationMap } from "./queryConfig.context-CRJOgf19.mjs";
|
|
2
|
+
import { a as AppQueryOptions, i as AppMutationOptions, n as useMutationEffects, r as AppInfiniteQueryOptions, t as MutationEffectsOptions } from "./useMutationEffects-DIdL8tlx.mjs";
|
|
3
|
+
export { type AppInfiniteQueryOptions, type AppMutationOptions, type AppQueryOptions, type InvalidationMap, type InvalidationMapFunc, type MutationEffectsOptions, OpenApiQueryConfig, type QueryModule, useMutationEffects };
|
package/dist/query.mjs
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { PropsWithChildren } from "react";
|
|
2
|
+
import { QueryKey } from "@tanstack/react-query";
|
|
3
|
+
//#region src/lib/config/queryConfig.context.d.ts
|
|
4
|
+
type QueryModule = string | number | symbol;
|
|
5
|
+
type InvalidationMapFunc<TData = any, TVariables = any> = (data: TData, variables: TVariables) => QueryKey[];
|
|
6
|
+
type InvalidationMap<TQueryModule extends QueryModule = QueryModule, TData = any, TVariables = any> = Partial<Record<TQueryModule, InvalidationMapFunc<TData, TVariables>>>;
|
|
7
|
+
declare namespace OpenApiQueryConfig {
|
|
8
|
+
export interface Type<TQueryModule extends QueryModule = QueryModule> {
|
|
9
|
+
preferUpdate?: boolean;
|
|
10
|
+
invalidateCurrentModule?: boolean;
|
|
11
|
+
invalidationMap?: InvalidationMap<TQueryModule>;
|
|
12
|
+
crossTabInvalidation?: boolean;
|
|
13
|
+
allowInvalidResponseData?: boolean;
|
|
14
|
+
onError?: (error: unknown) => void;
|
|
15
|
+
}
|
|
16
|
+
type ProviderProps<TQueryModule extends QueryModule = QueryModule> = Type<TQueryModule>;
|
|
17
|
+
export function Provider<TQueryModule extends QueryModule = QueryModule>({ preferUpdate, invalidateCurrentModule, invalidationMap, crossTabInvalidation, allowInvalidResponseData, onError, children }: PropsWithChildren<ProviderProps<TQueryModule>>): import("react").JSX.Element;
|
|
18
|
+
export const useConfig: <TQueryModule extends QueryModule = QueryModule>() => Type<TQueryModule>;
|
|
19
|
+
export {};
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
|
+
export { QueryModule as i, InvalidationMapFunc as n, OpenApiQueryConfig as r, InvalidationMap as t };
|