@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,34 @@
1
+ import { createContext, use, useMemo } from "react";
2
+ import { jsx } from "react/jsx-runtime";
3
+ //#region src/lib/config/queryConfig.context.tsx
4
+ let OpenApiQueryConfig;
5
+ (function(_OpenApiQueryConfig) {
6
+ const Context = createContext({});
7
+ function Provider({ preferUpdate, invalidateCurrentModule, invalidationMap, crossTabInvalidation, allowInvalidResponseData, onError, children }) {
8
+ const value = useMemo(() => ({
9
+ preferUpdate,
10
+ invalidateCurrentModule,
11
+ invalidationMap,
12
+ crossTabInvalidation,
13
+ allowInvalidResponseData,
14
+ onError
15
+ }), [
16
+ preferUpdate,
17
+ invalidateCurrentModule,
18
+ invalidationMap,
19
+ crossTabInvalidation,
20
+ allowInvalidResponseData,
21
+ onError
22
+ ]);
23
+ return /* @__PURE__ */ jsx(Context.Provider, {
24
+ value,
25
+ children
26
+ });
27
+ }
28
+ _OpenApiQueryConfig.Provider = Provider;
29
+ _OpenApiQueryConfig.useConfig = () => {
30
+ return use(Context) ?? {};
31
+ };
32
+ })(OpenApiQueryConfig || (OpenApiQueryConfig = {}));
33
+ //#endregion
34
+ export { OpenApiQueryConfig as t };
@@ -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,6 @@
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-Cyrm3VKA.mjs";
3
+ import { D as getTagFileName, Wn as Profiler, a as resolveConfig, n as runGenerate, o as getOutputFileName, t as getOpenApiDoc } from "./generate.runner-BD9BbYIx.mjs";
4
4
  import yargs from "yargs";
5
5
  import { hideBin } from "yargs/helpers";
6
6
  import { styleText } from "node:util";
@@ -31,7 +31,7 @@ function logBanner(message) {
31
31
  * Fetch the version from package.json
32
32
  */
33
33
  function getVersion() {
34
- return "3.2.0-rc.8";
34
+ return "3.2.0";
35
35
  }
36
36
  //#endregion
37
37
  //#region src/helpers/yargs.helper.ts
@@ -157,12 +157,12 @@ async function check({ verbose, config: configParam, includeTags: _includeTagsPa
157
157
  else throw new Error(`Found ${errorMessages.length} issues. Time: ${Date.now() - start}ms`);
158
158
  }
159
159
  //#endregion
160
- //#region \0@oxc-project+runtime@0.142.0/helpers/esm/decorateMetadata.js
160
+ //#region \0@oxc-project+runtime@0.148.0/helpers/esm/decorateMetadata.js
161
161
  function __decorateMetadata(k, v) {
162
162
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
163
163
  }
164
164
  //#endregion
165
- //#region \0@oxc-project+runtime@0.142.0/helpers/esm/decorate.js
165
+ //#region \0@oxc-project+runtime@0.148.0/helpers/esm/decorate.js
166
166
  function __decorate(decorators, target, key, desc) {
167
167
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
168
168
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -240,8 +240,10 @@ async function generate({ prettier, verbose, config: configParam, ...params }) {
240
240
  function execPrettier({ output, verbose }) {
241
241
  if (verbose) logInfo("Running Prettier...");
242
242
  exec(`prettier --write ${output} `, (error) => {
243
- if (verbose) if (error) logError(error, "Prettier error");
244
- else logSuccess("Prettier finished.");
243
+ if (verbose) {
244
+ if (error) logError(error, "Prettier error");
245
+ else logSuccess("Prettier finished.");
246
+ }
245
247
  });
246
248
  }
247
249
  //#endregion
package/dist/tiny.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { $ as namedControllerActionInputDtoSchema, A as generateORPCOpenAPISpec, B as getOperationController, C as collectReachableModelSchemas, D as defineOpenApiSchemas, E as createModelSchemaNameGetter, F as getModuleOpenApiController, G as isContractProcedure, H as getProcedureInputSchemaRole, I as getModuleOpenApiTag, J as isObject, K as isNullSchema, L as getObjectPropertySchema, M as getComponentSchemas, N as getContractProcedureData, O as findComponentEnumNames, P as getDerivedOperationId, Q as modelSchemaNameEntries, R as getOpenApiSchemaName, S as collectOperationTags, T as compactTagName, U as getRobodevModuleRoles, V as getPaginatedItemSchema, W as getStringEnumValues, X as isZodSchema, Y as isProcedureMeta, Z as modelSchemaExportName, _ as collectDbTableModelSchemaExports, _t as visitZodSchema, a as addContractSchema, at as operationKey, b as collectModuleModelSchemaExports, c as applyPaginatedItemSchemas, ct as routeHasPathParameters, d as applyRobodevUserRolesExtension, dt as sharedSchemaExportName, et as namedControllerActionSchema, f as asStringArray, ft as stripNoContentResponseBodies, g as collectDbTableModelSchemaExport, gt as toPascalCase, h as collectContractSchemas, ht as toOpenAPIAclRule, i as normalizeWatchFolders, it as namedOpenApiSchema, j as generateOpenApiFile, k as findEnumNames, l as applyParameterExtensions, lt as schemaComponentRef, m as collectContractSchemaRoots, mt as toOpenAPI30Schema, n as getLocalInputPath, nt as namedOpenApiRequestSchema, o as applyEnumExtensions, ot as procedureSchemaName, p as collectApiModelSchemaExports, pt as toOpenAPI30Document, q as isNullableOnlySchema, r as isTinyOpenApiFakeMode, rt as namedOpenApiResponseSchema, s as applyOperationMeta, st as resolveOpenApiOutputPath, t as createTinyOpenApiSourceRunner, tt as namedOpenApiOutputSchema, u as applyRobodevModuleExtensions, ut as schemaExportName, v as collectExtraSchemas, w as collectSchemaRegistryRoots, x as collectOperationMeta, y as collectModelSchemaExports, z as getOperationAction } from "./openapi-source.runner-BZ6ZLgRO.mjs";
1
+ import { $ as namedControllerActionInputDtoSchema, A as generateORPCOpenAPISpec, B as getOperationController, C as collectReachableModelSchemas, D as defineOpenApiSchemas, E as createModelSchemaNameGetter, F as getModuleOpenApiController, G as isContractProcedure, H as getProcedureInputSchemaRole, I as getModuleOpenApiTag, J as isObject, K as isNullSchema, L as getObjectPropertySchema, M as getComponentSchemas, N as getContractProcedureData, O as findComponentEnumNames, P as getDerivedOperationId, Q as modelSchemaNameEntries, R as getOpenApiSchemaName, S as collectOperationTags, T as compactTagName, U as getRobodevModuleRoles, V as getPaginatedItemSchema, W as getStringEnumValues, X as isZodSchema, Y as isProcedureMeta, Z as modelSchemaExportName, _ as collectDbTableModelSchemaExports, _t as visitZodSchema, a as addContractSchema, at as operationKey, b as collectModuleModelSchemaExports, c as applyPaginatedItemSchemas, ct as routeHasPathParameters, d as applyRobodevUserRolesExtension, dt as sharedSchemaExportName, et as namedControllerActionSchema, f as asStringArray, ft as stripNoContentResponseBodies, g as collectDbTableModelSchemaExport, gt as toPascalCase, h as collectContractSchemas, ht as toOpenAPIAclRule, i as normalizeWatchFolders, it as namedOpenApiSchema, j as generateOpenApiFile, k as findEnumNames, l as applyParameterExtensions, lt as schemaComponentRef, m as collectContractSchemaRoots, mt as toOpenAPI30Schema, n as getLocalInputPath, nt as namedOpenApiRequestSchema, o as applyEnumExtensions, ot as procedureSchemaName, p as collectApiModelSchemaExports, pt as toOpenAPI30Document, q as isNullableOnlySchema, r as isTinyOpenApiFakeMode, rt as namedOpenApiResponseSchema, s as applyOperationMeta, st as resolveOpenApiOutputPath, t as createTinyOpenApiSourceRunner, tt as namedOpenApiOutputSchema, u as applyRobodevModuleExtensions, ut as schemaExportName, v as collectExtraSchemas, w as collectSchemaRegistryRoots, x as collectOperationMeta, y as collectModelSchemaExports, z as getOperationAction } from "./openapi-source.runner-DPUNTduQ.mjs";
2
2
  export { addContractSchema, applyEnumExtensions, applyOperationMeta, applyPaginatedItemSchemas, applyParameterExtensions, applyRobodevModuleExtensions, applyRobodevUserRolesExtension, asStringArray, collectApiModelSchemaExports, collectContractSchemaRoots, collectContractSchemas, collectDbTableModelSchemaExport, collectDbTableModelSchemaExports, collectExtraSchemas, collectModelSchemaExports, collectModuleModelSchemaExports, collectOperationMeta, collectOperationTags, collectReachableModelSchemas, collectSchemaRegistryRoots, compactTagName, createModelSchemaNameGetter, createTinyOpenApiSourceRunner, defineOpenApiSchemas, findComponentEnumNames, findEnumNames, generateORPCOpenAPISpec, generateOpenApiFile, getComponentSchemas, getContractProcedureData, getDerivedOperationId, getModuleOpenApiController, getModuleOpenApiTag, getObjectPropertySchema, getOpenApiSchemaName, getOperationAction, getOperationController, getPaginatedItemSchema, getProcedureInputSchemaRole, getRobodevModuleRoles, getStringEnumValues, getLocalInputPath as getTinyOpenApiLocalInputPath, isContractProcedure, isNullSchema, isNullableOnlySchema, isObject, isProcedureMeta, isTinyOpenApiFakeMode, isZodSchema, modelSchemaExportName, modelSchemaNameEntries, namedControllerActionInputDtoSchema, namedControllerActionSchema, namedOpenApiOutputSchema, namedOpenApiRequestSchema, namedOpenApiResponseSchema, namedOpenApiSchema, normalizeWatchFolders as normalizeTinyOpenApiWatchFolders, operationKey, procedureSchemaName, resolveOpenApiOutputPath, routeHasPathParameters, schemaComponentRef, schemaExportName, sharedSchemaExportName, stripNoContentResponseBodies, toOpenAPI30Document, toOpenAPI30Schema, toOpenAPIAclRule, toPascalCase, visitZodSchema };
@@ -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,5 +1,5 @@
1
- import { t as createOpenApiCodegenRunner } from "./openapi-codegen.runner-C93V7SGj.mjs";
2
- import { i as normalizeWatchFolders, r as isTinyOpenApiFakeMode, t as createTinyOpenApiSourceRunner } from "./openapi-source.runner-BZ6ZLgRO.mjs";
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 path from "path";
4
4
  //#region src/vite/openapi-codegen.plugin.ts
5
5
  function openApiCodegen(config) {
@@ -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",
@@ -104,12 +127,14 @@
104
127
  "@casl/ability": "6.8.0",
105
128
  "@casl/react": "5.0.1",
106
129
  "@tanstack/react-query": "~5.90.21",
107
- "@types/bun": "1.3.14",
130
+ "@types/bun": "1.4.1",
108
131
  "@types/node": "^25.3.0",
109
132
  "@types/prompt-sync": "^4.2.3",
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",
@@ -121,7 +146,7 @@
121
146
  "vite": "npm:rolldown-vite@^7.3.1",
122
147
  "vite-plugin-dts": "^4.5.4",
123
148
  "vitest": "4.0.18",
124
- "zod": "^4.3.6"
149
+ "zod": "^4.5.0"
125
150
  },
126
151
  "peerDependencies": {
127
152
  "@casl/ability": "^6.7.3",
@@ -131,7 +156,7 @@
131
156
  "i18next": "^25.8.11",
132
157
  "react": "^19.1.0",
133
158
  "vite": "^6.0.0 || ^7.0.0 || ^8.0.0",
134
- "zod": "^4.1.12"
159
+ "zod": "^4.5.0"
135
160
  },
136
161
  "peerDependenciesMeta": {
137
162
  "@casl/ability": {
@@ -140,14 +165,26 @@
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
  }
146
183
  },
147
184
  "engines": {
148
- "bun": ">= 1.3.14",
185
+ "bun": ">= 1.4",
149
186
  "node": ">= 18"
150
187
  },
151
- "packageManager": "bun@1.3.14",
152
- "version": "3.2.0-rc.8"
188
+ "packageManager": "bun@1.4.1",
189
+ "version": "3.2.0"
153
190
  }