@povio/openapi-codegen-cli 3.3.0-rc.2 → 3.3.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 +132 -9
- package/dist/AuthGuard-GbtTDXs0.d.mts +32 -0
- package/dist/AuthGuard-qpAtHaBz.mjs +24 -0
- package/dist/acl.d.mts +14 -27
- package/dist/acl.mjs +17 -14
- package/dist/{auth.context-BAz8frX9.mjs → auth.context-COWO6ssl.mjs} +1 -18
- 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-BQqze8rU.d.mts → config-BYiBd1QI.d.mts} +1 -2
- package/dist/config.d.mts +4 -0
- package/dist/config.mjs +5 -0
- package/dist/{error-handling-D6ZYITQ3.d.mts → error-handling-LPEPQV1V.d.mts} +3 -42
- package/dist/{error-handling-CsnufAil.mjs → error-handling-uS0DgYUR.mjs} +23 -47
- package/dist/errors.d.mts +3 -0
- package/dist/errors.mjs +2 -0
- package/dist/generate.runner-CxlaA4c5.mjs +1670 -0
- package/dist/generate.utils-SfgYwPe7.cjs +2271 -0
- package/dist/generateCodeFromOpenAPIDoc-CmN4bFjv.mjs +2246 -0
- package/dist/{generateCodeFromOpenAPIDoc-SYuVswEJ.mjs → generateCodeFromOpenAPIDoc-Dv-hqKhh.cjs} +1511 -2269
- package/dist/generator.d.mts +3 -10
- package/dist/generator.mjs +6 -4
- package/dist/getDataFromOpenAPIDoc-DzeHecv2.mjs +2016 -0
- package/dist/i18n-B_brQh4X.d.mts +38 -0
- package/dist/i18n-D-FesqFb.mjs +36 -0
- package/dist/index.d.mts +12 -198
- package/dist/index.mjs +12 -256
- package/dist/metro.cjs +118 -4862
- package/dist/metro.d.mts +3 -4
- package/dist/metro.mjs +3 -3
- package/dist/native-rest-interceptor-Np4Ov54n.mjs +215 -0
- package/dist/native-rest-interceptor-PgziZt1f.d.mts +49 -0
- package/dist/native.d.mts +3 -0
- package/dist/native.mjs +3 -0
- 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-CCXQsUum.mjs → openapi-codegen.runner-DDd4AXRT.mjs} +2 -2
- package/dist/{openapi-source.runner-8kCe-g9S.mjs → openapi-source.runner-DPUNTduQ.mjs} +25 -11
- package/dist/{openapi-source.runner-B6KKrXw7.d.mts → openapi-source.runner-lmK-P6HE.d.mts} +2 -8
- package/dist/{options-DdQJ9BSc.d.mts → options-DH-fAG0w.d.mts} +12 -1
- 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-Dm9DFErh.mjs +115 -0
- package/dist/rest-transport.types-DM5-qyOJ.d.mts +66 -0
- package/dist/rest-transport.types-DxitRtsB.mjs +11 -0
- package/dist/rest.d.mts +2 -0
- package/dist/rest.mjs +2 -0
- package/dist/rest.utils-DpiFIdhF.d.mts +9 -0
- package/dist/router.context-EPlMBk3G.mjs +21 -0
- package/dist/sh.d.mts +1 -1
- package/dist/sh.mjs +55 -55
- package/dist/tiny.d.mts +1 -1
- package/dist/tiny.mjs +1 -1
- package/dist/useMutationEffects-DIdL8tlx.d.mts +29 -0
- package/dist/useMutationEffects-PB1fvKWM.mjs +68 -0
- package/dist/vite.d.mts +3 -4
- package/dist/vite.mjs +5 -4
- package/dist/workspace.context-XWvQ_7Hg.mjs +26 -0
- package/dist/workspace.context-isVY9ves.d.mts +23 -0
- package/dist/zod.d.mts +2 -7
- package/dist/zod.mjs +1 -1
- package/package.json +71 -21
- package/dist/generate.runner-B0Zm3pIl.mjs +0 -87
|
@@ -1,48 +1,26 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as ns, r as resolveT } from "./i18n-D-FesqFb.mjs";
|
|
2
|
+
import { t as HttpError } from "./rest-transport.types-DxitRtsB.mjs";
|
|
2
3
|
import { z } from "zod";
|
|
3
|
-
//#region src/lib/
|
|
4
|
-
|
|
5
|
-
"
|
|
6
|
-
"internalError": "An internal error occurred. This is most likely a bug on our end. Please try again later.",
|
|
7
|
-
"networkError": "A network error occurred. Are you connected to the internet?",
|
|
8
|
-
"canceledError": "The request was canceled.",
|
|
9
|
-
"unknownError": "An unknown error occurred. Please try again later.",
|
|
10
|
-
"unknownErrorWithCode": "An unknown error occurred. Error code: \"{{code}}\""
|
|
11
|
-
} } };
|
|
12
|
-
//#endregion
|
|
13
|
-
//#region src/lib/assets/locales/sl/translation.json
|
|
14
|
-
var translation_default = { openapi: { "sharedErrors": {
|
|
15
|
-
"dataValidation": "Pri preverjanju podatkov je prišlo do napake",
|
|
16
|
-
"internalError": "Prišlo je do notranje napake.",
|
|
17
|
-
"networkError": "Prišlo je do napake v omrežju.",
|
|
18
|
-
"canceledError": "Zahteva je bila preklicana.",
|
|
19
|
-
"unknownError": "Prišlo je do neznane napake.",
|
|
20
|
-
"unknownErrorWithCode": "Prišlo je do neznane napake. Koda napake: \"{{code}}\""
|
|
21
|
-
} } };
|
|
22
|
-
//#endregion
|
|
23
|
-
//#region src/lib/config/i18n.ts
|
|
24
|
-
const ns = "openapi";
|
|
25
|
-
const resources = {
|
|
26
|
-
en: { [ns]: translation_default$1 },
|
|
27
|
-
sl: { [ns]: translation_default }
|
|
28
|
-
};
|
|
29
|
-
let getT = null;
|
|
30
|
-
function configureTranslations(getter) {
|
|
31
|
-
getT = () => getter();
|
|
4
|
+
//#region src/lib/rest/http-error.utils.ts
|
|
5
|
+
function isAxiosErrorLike(error) {
|
|
6
|
+
return typeof error === "object" && error !== null && "isAxiosError" in error;
|
|
32
7
|
}
|
|
33
|
-
function
|
|
34
|
-
if (
|
|
35
|
-
|
|
8
|
+
function isCanceledRequest(error) {
|
|
9
|
+
if (error instanceof DOMException && ["AbortError", "TimeoutError"].includes(error.name)) return true;
|
|
10
|
+
if (isAxiosErrorLike(error)) return error.code === "ERR_CANCELED" || error.code === "ECONNABORTED";
|
|
11
|
+
return false;
|
|
36
12
|
}
|
|
37
13
|
//#endregion
|
|
38
14
|
//#region src/lib/rest/rest.utils.ts
|
|
15
|
+
function getResponseData(error) {
|
|
16
|
+
if (error instanceof HttpError) return error.response.data;
|
|
17
|
+
return isAxiosErrorLike(error) ? error.response?.data : void 0;
|
|
18
|
+
}
|
|
39
19
|
let RestUtils;
|
|
40
20
|
(function(_RestUtils) {
|
|
41
21
|
_RestUtils.extractServerResponseCode = (e) => {
|
|
42
22
|
if (e instanceof z.ZodError) return "validation-exception";
|
|
43
|
-
|
|
44
|
-
if (!e.response) return null;
|
|
45
|
-
const data = e.response.data;
|
|
23
|
+
const data = getResponseData(e);
|
|
46
24
|
if (typeof data?.code === "string") return data.code;
|
|
47
25
|
if (typeof data?.code === "number") return data.code;
|
|
48
26
|
return null;
|
|
@@ -54,15 +32,13 @@ let RestUtils;
|
|
|
54
32
|
};
|
|
55
33
|
const extractServerErrorMessage = _RestUtils.extractServerErrorMessage = (e) => {
|
|
56
34
|
if (e instanceof z.ZodError) return e.message;
|
|
57
|
-
|
|
58
|
-
if (!e.response) return null;
|
|
59
|
-
const data = e.response.data;
|
|
35
|
+
const data = getResponseData(e);
|
|
60
36
|
if (typeof data?.message === "string") return data.message;
|
|
61
37
|
return null;
|
|
62
38
|
};
|
|
63
39
|
_RestUtils.extractContentDispositionFilename = (headers) => {
|
|
64
|
-
const contentDisposition = headers["content-disposition"];
|
|
65
|
-
return contentDisposition ? /filename=["']?([^"';]+)/i.exec(contentDisposition)?.[1] : void 0;
|
|
40
|
+
const contentDisposition = headers instanceof Headers ? headers.get("content-disposition") : headers["content-disposition"];
|
|
41
|
+
return typeof contentDisposition === "string" ? /filename=["']?([^"';]+)/i.exec(contentDisposition)?.[1] : void 0;
|
|
66
42
|
};
|
|
67
43
|
})(RestUtils || (RestUtils = {}));
|
|
68
44
|
//#endregion
|
|
@@ -109,7 +85,8 @@ var ErrorHandler = class ErrorHandler {
|
|
|
109
85
|
const internalError = {
|
|
110
86
|
code: "INTERNAL_ERROR",
|
|
111
87
|
condition: (e) => {
|
|
112
|
-
if (
|
|
88
|
+
if (isAxiosErrorLike(e)) return e.response?.status != null && e.response.status >= 500 && e.response.status < 600;
|
|
89
|
+
if (e instanceof HttpError) return e.response.status >= 500 && e.response.status < 600;
|
|
113
90
|
return false;
|
|
114
91
|
},
|
|
115
92
|
getMessage: () => resolveT()("openapi.sharedErrors.internalError", { ns })
|
|
@@ -117,7 +94,8 @@ var ErrorHandler = class ErrorHandler {
|
|
|
117
94
|
const networkError = {
|
|
118
95
|
code: "NETWORK_ERROR",
|
|
119
96
|
condition: (e) => {
|
|
120
|
-
if (
|
|
97
|
+
if (isAxiosErrorLike(e)) return e.code === "ERR_NETWORK";
|
|
98
|
+
if (e instanceof TypeError) return true;
|
|
121
99
|
return false;
|
|
122
100
|
},
|
|
123
101
|
getMessage: () => resolveT()("openapi.sharedErrors.networkError", { ns })
|
|
@@ -125,9 +103,7 @@ var ErrorHandler = class ErrorHandler {
|
|
|
125
103
|
const canceledError = {
|
|
126
104
|
code: "CANCELED_ERROR",
|
|
127
105
|
condition: (e) => {
|
|
128
|
-
|
|
129
|
-
if (isAxiosError(e) && e.code === "ECONNABORTED") return true;
|
|
130
|
-
return false;
|
|
106
|
+
return isCanceledRequest(e);
|
|
131
107
|
},
|
|
132
108
|
getMessage: () => resolveT()("openapi.sharedErrors.canceledError", { ns })
|
|
133
109
|
};
|
|
@@ -205,4 +181,4 @@ var ErrorHandler = class ErrorHandler {
|
|
|
205
181
|
};
|
|
206
182
|
const SharedErrorHandler = new ErrorHandler({ entries: [] });
|
|
207
183
|
//#endregion
|
|
208
|
-
export { RestUtils as a,
|
|
184
|
+
export { RestUtils as a, SharedErrorHandler as i, DomainErrorRegistry as n, ErrorHandler as r, ApplicationException as t };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { a as ErrorHandler, c as SharedErrorHandler, i as ErrorEntry, n as DomainErrorEntry, o as ErrorHandlerOptions, r as DomainErrorRegistry, s as GeneralErrorCodes, t as ApplicationException } from "./error-handling-LPEPQV1V.mjs";
|
|
2
|
+
import { t as RestUtils } from "./rest.utils-DpiFIdhF.mjs";
|
|
3
|
+
export { ApplicationException, type DomainErrorEntry, DomainErrorRegistry, type ErrorEntry, ErrorHandler, type ErrorHandlerOptions, type GeneralErrorCodes, RestUtils, SharedErrorHandler };
|
package/dist/errors.mjs
ADDED