@povio/openapi-codegen-cli 2.0.3-rc.0 → 2.0.3
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/acl.d.ts +4 -4
- package/dist/acl.mjs +8 -0
- package/dist/commands/check.command.d.ts +1 -1
- package/dist/commands/check.d.ts +1 -1
- package/dist/commands/generate.command.d.ts +1 -1
- package/dist/commands/generate.d.ts +1 -1
- package/dist/generator.d.ts +3 -3
- package/dist/generators/checkOpenAPIDoc.d.ts +3 -3
- package/dist/generators/const/acl.const.d.ts +1 -1
- package/dist/generators/const/deps.const.d.ts +1 -1
- package/dist/generators/const/endpoints.const.d.ts +1 -1
- package/dist/generators/const/openapi.const.d.ts +1 -1
- package/dist/generators/const/options.const.d.ts +1 -1
- package/dist/generators/const/queries.const.d.ts +1 -1
- package/dist/generators/const/validation.const.d.ts +1 -1
- package/dist/generators/const/zod.const.d.ts +1 -1
- package/dist/generators/core/SchemaResolver.class.d.ts +6 -6
- package/dist/generators/core/endpoints/getEndpointAcl.d.ts +3 -3
- package/dist/generators/core/endpoints/getEndpointBody.d.ts +3 -3
- package/dist/generators/core/endpoints/getEndpointParameter.d.ts +4 -4
- package/dist/generators/core/endpoints/getEndpointsFromOpenAPIDoc.d.ts +2 -2
- package/dist/generators/core/getDataFromOpenAPIDoc.d.ts +4 -4
- package/dist/generators/core/getMetadataFromOpenAPIDoc.d.ts +3 -3
- package/dist/generators/core/openapi/getOpenAPISchemaComplexity.d.ts +1 -1
- package/dist/generators/core/openapi/getOpenAPISchemaDependencyGraph.d.ts +1 -1
- package/dist/generators/core/openapi/getSchemaRefObjs.d.ts +2 -2
- package/dist/generators/core/openapi/iterateSchema.d.ts +1 -1
- package/dist/generators/core/resolveConfig.d.ts +1 -1
- package/dist/generators/core/zod/ZodSchema.class.d.ts +4 -4
- package/dist/generators/core/zod/enumExtraction/resolveExtractedEnumZodSchemaNames.d.ts +1 -1
- package/dist/generators/core/zod/enumExtraction/resolveExtractedEnumZodSchemaTags.d.ts +1 -1
- package/dist/generators/core/zod/enumExtraction/updateExtractedEnumZodSchemaData.d.ts +2 -2
- package/dist/generators/core/zod/getZodChain.d.ts +3 -3
- package/dist/generators/core/zod/getZodSchema.d.ts +3 -3
- package/dist/generators/core/zod/getZodSchemaRefs.d.ts +2 -2
- package/dist/generators/core/zod/getZodSchemasFromOpenAPIDoc.d.ts +1 -1
- package/dist/generators/core/zod/resolveZodSchemaName.d.ts +3 -3
- package/dist/generators/core/zod/sortZodSchemasByTopology.d.ts +1 -1
- package/dist/generators/generate/generateAcl.d.ts +1 -1
- package/dist/generators/generate/generateAclCheck.d.ts +1 -1
- package/dist/generators/generate/generateAppRestClient.d.ts +1 -1
- package/dist/generators/generate/generateConfigs.d.ts +1 -1
- package/dist/generators/generate/generateEndpoints.d.ts +1 -1
- package/dist/generators/generate/generateModels.d.ts +1 -1
- package/dist/generators/generate/generateQueries.d.ts +1 -1
- package/dist/generators/generate/generateQueryModules.d.ts +1 -1
- package/dist/generators/generate/generateZodExtended.d.ts +1 -1
- package/dist/generators/generateCodeFromOpenAPIDoc.d.ts +3 -3
- package/dist/generators/types/config.d.ts +1 -1
- package/dist/generators/types/endpoint.d.ts +2 -2
- package/dist/generators/types/generate.d.ts +3 -3
- package/dist/generators/types/metadata.d.ts +2 -2
- package/dist/generators/types/openapi.d.ts +1 -1
- package/dist/generators/types/options.d.ts +1 -1
- package/dist/generators/utils/endpoint.utils.d.ts +2 -2
- package/dist/generators/utils/file.utils.d.ts +1 -1
- package/dist/generators/utils/generate/generate.acl.utils.d.ts +4 -4
- package/dist/generators/utils/generate/generate.configs.utils.d.ts +5 -5
- package/dist/generators/utils/generate/generate.endpoints.utils.d.ts +7 -7
- package/dist/generators/utils/generate/generate.imports.utils.d.ts +4 -4
- package/dist/generators/utils/generate/generate.openapi.utils.d.ts +1 -1
- package/dist/generators/utils/generate/generate.query.utils.d.ts +2 -2
- package/dist/generators/utils/generate/generate.utils.d.ts +2 -2
- package/dist/generators/utils/generate/generate.zod.utils.d.ts +4 -4
- package/dist/generators/utils/generate-files.utils.d.ts +2 -2
- package/dist/generators/utils/hbs/hbs-template.utils.d.ts +1 -1
- package/dist/generators/utils/hbs/hbs.acl.utils.d.ts +1 -1
- package/dist/generators/utils/hbs/hbs.endpoints.utils.d.ts +1 -1
- package/dist/generators/utils/hbs/hbs.partials.utils.d.ts +1 -1
- package/dist/generators/utils/hbs/hbs.query.utils.d.ts +1 -1
- package/dist/generators/utils/hbs/hbs.zod.utils.d.ts +1 -1
- package/dist/generators/utils/namespace.utils.d.ts +2 -2
- package/dist/generators/utils/object.utils.d.ts +2 -2
- package/dist/generators/utils/openapi-schema.utils.d.ts +1 -1
- package/dist/generators/utils/openapi.utils.d.ts +2 -2
- package/dist/generators/utils/operation.utils.d.ts +3 -3
- package/dist/generators/utils/query.utils.d.ts +3 -3
- package/dist/generators/utils/sort.utils.d.ts +1 -1
- package/dist/generators/utils/tag.utils.d.ts +3 -3
- package/dist/generators/utils/ts.utils.d.ts +4 -4
- package/dist/generators/utils/validation.utils.d.ts +4 -4
- package/dist/helpers/config.helper.d.ts +1 -1
- package/dist/helpers/yargs.helper.d.ts +1 -2
- package/dist/index.d.ts +14 -16
- package/dist/index.mjs +23 -0
- package/dist/lib/acl/AclGuard.d.ts +3 -3
- package/dist/lib/acl/AclGuard.mjs +14 -0
- package/dist/lib/acl/Can.d.ts +3 -3
- package/dist/lib/acl/Can.mjs +11 -0
- package/dist/lib/acl/ability.context.d.ts +4 -4
- package/dist/lib/acl/ability.context.mjs +37 -0
- package/dist/lib/acl/appAbility.types.d.ts +1 -1
- package/dist/lib/assets/locales/en/translation.json.mjs +8 -0
- package/dist/lib/assets/locales/sl/translation.json.mjs +8 -0
- package/dist/lib/auth/AuthGuard.d.ts +2 -2
- package/dist/lib/auth/AuthGuard.mjs +26 -0
- package/dist/lib/auth/auth.context.d.ts +1 -1
- package/dist/lib/auth/auth.context.mjs +41 -0
- package/dist/lib/config/i18n.d.ts +1 -1
- package/dist/lib/config/i18n.mjs +31 -0
- package/dist/lib/config/queryConfig.context.mjs +17 -0
- package/dist/lib/config/router.context.d.ts +1 -1
- package/dist/lib/config/router.context.mjs +20 -0
- package/dist/lib/react-query.types.d.ts +2 -2
- package/dist/lib/rest/error-handling.d.ts +1 -1
- package/dist/lib/rest/error-handling.mjs +129 -0
- package/dist/lib/rest/rest-client.d.ts +4 -4
- package/dist/lib/rest/rest-client.mjs +62 -0
- package/dist/lib/rest/rest-client.types.d.ts +4 -4
- package/dist/lib/rest/rest-interceptor.d.ts +1 -1
- package/dist/lib/rest/rest-interceptor.mjs +21 -0
- package/dist/lib/rest/rest.utils.d.ts +1 -1
- package/dist/lib/rest/rest.utils.mjs +51 -0
- package/dist/sh.js +1 -1
- package/package.json +12 -8
- package/dist/acl.js +0 -1
- package/dist/index.js +0 -3
- package/dist/tsconfig.tsbuildinfo +0 -1
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { isAxiosError, isCancel } from "axios";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { defaultT } from "../config/i18n.mjs";
|
|
4
|
+
import { RestUtils } from "./rest.utils.mjs";
|
|
5
|
+
class ApplicationException extends Error {
|
|
6
|
+
code;
|
|
7
|
+
serverMessage = null;
|
|
8
|
+
constructor(message, code, serverMessage) {
|
|
9
|
+
super(message);
|
|
10
|
+
this.code = code;
|
|
11
|
+
this.serverMessage = serverMessage;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
class ErrorHandler {
|
|
15
|
+
entries = [];
|
|
16
|
+
t;
|
|
17
|
+
onRethrowError;
|
|
18
|
+
constructor({ entries, t = defaultT, onRethrowError }) {
|
|
19
|
+
this.t = t;
|
|
20
|
+
this.onRethrowError = onRethrowError;
|
|
21
|
+
const dataValidationError = {
|
|
22
|
+
code: "DATA_VALIDATION_ERROR",
|
|
23
|
+
condition: (e) => {
|
|
24
|
+
return e instanceof z.ZodError;
|
|
25
|
+
},
|
|
26
|
+
getMessage: () => this.t("openapi.sharedErrors.dataValidation")
|
|
27
|
+
};
|
|
28
|
+
const internalError = {
|
|
29
|
+
code: "INTERNAL_ERROR",
|
|
30
|
+
condition: (e) => {
|
|
31
|
+
if (isAxiosError(e)) {
|
|
32
|
+
return e.response?.status != null && e.response.status >= 500 && e.response.status < 600;
|
|
33
|
+
}
|
|
34
|
+
return false;
|
|
35
|
+
},
|
|
36
|
+
getMessage: () => this.t("openapi.sharedErrors.internalError")
|
|
37
|
+
};
|
|
38
|
+
const networkError = {
|
|
39
|
+
code: "NETWORK_ERROR",
|
|
40
|
+
condition: (e) => {
|
|
41
|
+
if (isAxiosError(e)) {
|
|
42
|
+
return e.code === "ERR_NETWORK";
|
|
43
|
+
}
|
|
44
|
+
return false;
|
|
45
|
+
},
|
|
46
|
+
getMessage: () => this.t("openapi.sharedErrors.networkError")
|
|
47
|
+
};
|
|
48
|
+
const canceledError = {
|
|
49
|
+
code: "CANCELED_ERROR",
|
|
50
|
+
condition: (e) => {
|
|
51
|
+
if (isCancel(e)) {
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
54
|
+
if (isAxiosError(e) && e.code === "ECONNABORTED") {
|
|
55
|
+
return true;
|
|
56
|
+
}
|
|
57
|
+
return false;
|
|
58
|
+
},
|
|
59
|
+
getMessage: () => this.t("openapi.sharedErrors.canceledError")
|
|
60
|
+
};
|
|
61
|
+
const unknownError = {
|
|
62
|
+
code: "UNKNOWN_ERROR",
|
|
63
|
+
condition: () => true,
|
|
64
|
+
getMessage: (_, e) => {
|
|
65
|
+
const code = RestUtils.extractServerResponseCode(e);
|
|
66
|
+
const serverMessage = RestUtils.extractServerErrorMessage(e);
|
|
67
|
+
if (code) {
|
|
68
|
+
let message = `Unknown error, message from server: ${code}`;
|
|
69
|
+
if (serverMessage) {
|
|
70
|
+
message += ` ${serverMessage}`;
|
|
71
|
+
}
|
|
72
|
+
return message;
|
|
73
|
+
}
|
|
74
|
+
return this.t("openapi.sharedErrors.unknownError");
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
this.entries = [...entries, dataValidationError, internalError, networkError, canceledError, unknownError];
|
|
78
|
+
}
|
|
79
|
+
matchesEntry(error, entry, code) {
|
|
80
|
+
if (entry.condition) {
|
|
81
|
+
return entry.condition(error);
|
|
82
|
+
}
|
|
83
|
+
return code === entry.code;
|
|
84
|
+
}
|
|
85
|
+
setTranslateFunction(t) {
|
|
86
|
+
this.t = t;
|
|
87
|
+
}
|
|
88
|
+
rethrowError(error) {
|
|
89
|
+
const code = RestUtils.extractServerResponseCode(error);
|
|
90
|
+
const errorEntry = this.entries.find((entry) => this.matchesEntry(error, entry, code));
|
|
91
|
+
const serverMessage = RestUtils.extractServerErrorMessage(error);
|
|
92
|
+
const exception = new ApplicationException(errorEntry.getMessage(this.t, error), errorEntry.code, serverMessage);
|
|
93
|
+
this.onRethrowError?.(error, exception);
|
|
94
|
+
throw exception;
|
|
95
|
+
}
|
|
96
|
+
getError(error) {
|
|
97
|
+
if (error instanceof ApplicationException) {
|
|
98
|
+
return error;
|
|
99
|
+
}
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
getErrorCode(error) {
|
|
103
|
+
if (error instanceof ApplicationException) {
|
|
104
|
+
return error.code;
|
|
105
|
+
}
|
|
106
|
+
return null;
|
|
107
|
+
}
|
|
108
|
+
static getErrorMessage(error, fallbackToUnknown = true) {
|
|
109
|
+
if (typeof error === "string") {
|
|
110
|
+
return error;
|
|
111
|
+
}
|
|
112
|
+
if (error instanceof Error) {
|
|
113
|
+
return error.message;
|
|
114
|
+
}
|
|
115
|
+
if (error instanceof ApplicationException) {
|
|
116
|
+
return error.message;
|
|
117
|
+
}
|
|
118
|
+
if (fallbackToUnknown) {
|
|
119
|
+
return defaultT("openapi.sharedErrors.unknownError");
|
|
120
|
+
}
|
|
121
|
+
return null;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
const SharedErrorHandler = new ErrorHandler({ entries: [] });
|
|
125
|
+
export {
|
|
126
|
+
ApplicationException,
|
|
127
|
+
ErrorHandler,
|
|
128
|
+
SharedErrorHandler
|
|
129
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { AxiosRequestConfig, CreateAxiosDefaults } from
|
|
2
|
-
import { ErrorHandler, GeneralErrorCodes } from
|
|
3
|
-
import { RestClient as IRestClient, RequestConfig, RequestInfo, Response } from
|
|
4
|
-
import { RestInterceptor } from
|
|
1
|
+
import { AxiosRequestConfig, CreateAxiosDefaults } from 'axios';
|
|
2
|
+
import { ErrorHandler, GeneralErrorCodes } from './error-handling';
|
|
3
|
+
import { RestClient as IRestClient, RequestConfig, RequestInfo, Response } from './rest-client.types';
|
|
4
|
+
import { RestInterceptor } from './rest-interceptor';
|
|
5
5
|
export declare class RestClient implements IRestClient {
|
|
6
6
|
private readonly client;
|
|
7
7
|
private readonly errorHandler;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import axios from "axios";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { SharedErrorHandler } from "./error-handling.mjs";
|
|
4
|
+
class RestClient {
|
|
5
|
+
client;
|
|
6
|
+
errorHandler;
|
|
7
|
+
constructor({
|
|
8
|
+
config,
|
|
9
|
+
interceptors,
|
|
10
|
+
errorHandler
|
|
11
|
+
} = {}) {
|
|
12
|
+
this.client = axios.create(config);
|
|
13
|
+
this.errorHandler = errorHandler ?? SharedErrorHandler;
|
|
14
|
+
this.attachInterceptors(interceptors);
|
|
15
|
+
}
|
|
16
|
+
attachInterceptors(interceptors, ...args) {
|
|
17
|
+
if (interceptors != null) {
|
|
18
|
+
interceptors.forEach((interceptor) => this.attachInterceptor(interceptor, ...args));
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
attachInterceptor(interceptor, ...args) {
|
|
22
|
+
interceptor.addInterceptor(this.client, ...args);
|
|
23
|
+
}
|
|
24
|
+
ejectInterceptor(interceptor) {
|
|
25
|
+
interceptor.removeInterceptor(this.client);
|
|
26
|
+
}
|
|
27
|
+
async get(requestInfo, url, requestConfig) {
|
|
28
|
+
return this.makeRequest(requestInfo, { ...requestConfig, method: "get", url });
|
|
29
|
+
}
|
|
30
|
+
async post(requestInfo, url, data, requestConfig) {
|
|
31
|
+
return this.makeRequest(requestInfo, { ...requestConfig, method: "post", url, data });
|
|
32
|
+
}
|
|
33
|
+
async patch(requestInfo, url, data, requestConfig) {
|
|
34
|
+
return this.makeRequest(requestInfo, { ...requestConfig, method: "patch", url, data });
|
|
35
|
+
}
|
|
36
|
+
async put(requestInfo, url, data, requestConfig) {
|
|
37
|
+
return this.makeRequest(requestInfo, { ...requestConfig, method: "put", url, data });
|
|
38
|
+
}
|
|
39
|
+
async delete(requestInfo, url, data, requestConfig) {
|
|
40
|
+
return this.makeRequest(requestInfo, { ...requestConfig, method: "delete", url, data });
|
|
41
|
+
}
|
|
42
|
+
async makeRequest(requestInfo, requestConfig) {
|
|
43
|
+
const errorStack = new Error().stack;
|
|
44
|
+
try {
|
|
45
|
+
const { rawResponse, ...config } = requestConfig;
|
|
46
|
+
const res = await this.client(config);
|
|
47
|
+
const resData = requestInfo.resSchema.parse(res.data);
|
|
48
|
+
return rawResponse ? { ...res, data: resData } : resData;
|
|
49
|
+
} catch (error) {
|
|
50
|
+
if (error instanceof z.ZodError) {
|
|
51
|
+
error.name = "BE Response schema mismatch - ZodError";
|
|
52
|
+
error.stack = [error.stack, ...errorStack?.split("\n").slice(2) ?? []].join("\n");
|
|
53
|
+
}
|
|
54
|
+
const errorHandler = requestInfo.errorHandler ?? this.errorHandler;
|
|
55
|
+
errorHandler.rethrowError(error);
|
|
56
|
+
throw error;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
export {
|
|
61
|
+
RestClient
|
|
62
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { AxiosRequestConfig, AxiosResponse } from
|
|
2
|
-
import { z } from
|
|
3
|
-
import { ErrorHandler } from
|
|
4
|
-
import { RestInterceptor } from
|
|
1
|
+
import { AxiosRequestConfig, AxiosResponse } from 'axios';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { ErrorHandler } from './error-handling';
|
|
4
|
+
import { RestInterceptor } from './rest-interceptor';
|
|
5
5
|
export type GeneralErrorCodes = string;
|
|
6
6
|
export interface RequestInfo<ZOutput, ECodes extends string> {
|
|
7
7
|
resSchema: z.ZodType<ZOutput>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
class RestInterceptor {
|
|
2
|
+
constructor(applyInterceptor) {
|
|
3
|
+
this.applyInterceptor = applyInterceptor;
|
|
4
|
+
}
|
|
5
|
+
interceptorIdMap = [];
|
|
6
|
+
addInterceptor(client, ...args) {
|
|
7
|
+
this.removeInterceptor(client);
|
|
8
|
+
const interceptorId = this.applyInterceptor(client, ...args);
|
|
9
|
+
this.interceptorIdMap.push({ client, interceptorId });
|
|
10
|
+
}
|
|
11
|
+
removeInterceptor(client) {
|
|
12
|
+
const interceptorId = this.interceptorIdMap.find((i) => i.client === client)?.interceptorId;
|
|
13
|
+
if (interceptorId != null) {
|
|
14
|
+
client.interceptors.request.eject(interceptorId);
|
|
15
|
+
this.interceptorIdMap = this.interceptorIdMap.filter((i) => i.client !== client);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
export {
|
|
20
|
+
RestInterceptor
|
|
21
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AxiosError, AxiosResponseHeaders } from
|
|
1
|
+
import { AxiosError, AxiosResponseHeaders } from 'axios';
|
|
2
2
|
export declare namespace RestUtils {
|
|
3
3
|
const extractServerResponseCode: (e: unknown) => string | null;
|
|
4
4
|
const doesServerErrorMessageContain: (e: AxiosError, text: string) => boolean;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { isAxiosError } from "axios";
|
|
3
|
+
var RestUtils;
|
|
4
|
+
((RestUtils2) => {
|
|
5
|
+
RestUtils2.extractServerResponseCode = (e) => {
|
|
6
|
+
if (e instanceof z.ZodError) {
|
|
7
|
+
return "validation-exception";
|
|
8
|
+
}
|
|
9
|
+
if (!isAxiosError(e)) {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
if (!e.response) {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
const data = e.response.data;
|
|
16
|
+
if (typeof data?.code === "string") {
|
|
17
|
+
return data.code;
|
|
18
|
+
}
|
|
19
|
+
return null;
|
|
20
|
+
};
|
|
21
|
+
RestUtils2.doesServerErrorMessageContain = (e, text) => {
|
|
22
|
+
const message = (0, RestUtils2.extractServerErrorMessage)(e);
|
|
23
|
+
if (message === null || message === void 0) {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
return message.toLowerCase().includes(text.toLowerCase());
|
|
27
|
+
};
|
|
28
|
+
RestUtils2.extractServerErrorMessage = (e) => {
|
|
29
|
+
if (e instanceof z.ZodError) {
|
|
30
|
+
return e.message;
|
|
31
|
+
}
|
|
32
|
+
if (!isAxiosError(e)) {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
if (!e.response) {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
const data = e.response.data;
|
|
39
|
+
if (typeof data?.message === "string") {
|
|
40
|
+
return data.message;
|
|
41
|
+
}
|
|
42
|
+
return null;
|
|
43
|
+
};
|
|
44
|
+
RestUtils2.extractContentDispositionFilename = (headers) => {
|
|
45
|
+
const contentDisposition = headers["content-disposition"];
|
|
46
|
+
return contentDisposition ? /filename=["']?([^"';]+)/i.exec(contentDisposition)?.[1] : void 0;
|
|
47
|
+
};
|
|
48
|
+
})(RestUtils || (RestUtils = {}));
|
|
49
|
+
export {
|
|
50
|
+
RestUtils
|
|
51
|
+
};
|
package/dist/sh.js
CHANGED
|
@@ -565,7 +565,7 @@ ${ot.join(`
|
|
|
565
565
|
`;_e.forEach(ot=>{Lt+=ot}),f.fail(Lt)}},"implications");let oe={};A.conflicts=t(function(Ae,_e){ho("<string|object> [array|string]",[Ae,_e],arguments.length),typeof Ae=="object"?Object.keys(Ae).forEach(Lt=>{A.conflicts(Lt,Ae[Lt])}):(l.global(Ae),oe[Ae]||(oe[Ae]=[]),Array.isArray(_e)?_e.forEach(Lt=>A.conflicts(Ae,Lt)):oe[Ae].push(_e))},"conflicts"),A.getConflicting=()=>oe,A.conflicting=t(function(Ae){Object.keys(Ae).forEach(_e=>{oe[_e]&&oe[_e].forEach(Lt=>{Lt&&Ae[_e]!==void 0&&Ae[Lt]!==void 0&&f.fail(S("Arguments %s and %s are mutually exclusive",_e,Lt))})}),l.getInternalMethods().getParserConfiguration()["strip-dashed"]&&Object.keys(oe).forEach(_e=>{oe[_e].forEach(Lt=>{Lt&&Ae[h.Parser.camelCase(_e)]!==void 0&&Ae[h.Parser.camelCase(Lt)]!==void 0&&f.fail(S("Arguments %s and %s are mutually exclusive",_e,Lt))})})},"conflictingFn"),A.recommendCommands=t(function(Ae,_e){_e=_e.sort((Ht,jr)=>jr.length-Ht.length);let ot=null,tt=1/0;for(let Ht=0,jr;(jr=_e[Ht])!==void 0;Ht++){let Gn=LQe(Ae,jr);Gn<=3&&Gn<tt&&(tt=Gn,ot=jr)}ot&&f.fail(S("Did you mean %s?",ot))},"recommendCommands"),A.reset=t(function(Ae){return j=J6(j,_e=>!Ae[_e]),oe=J6(oe,_e=>!Ae[_e]),A},"reset");let ge=[];return A.freeze=t(function(){ge.push({implied:j,conflicting:oe})},"freeze"),A.unfreeze=t(function(){let Ae=ge.pop();p1(Ae,void 0,h),{implied:j,conflicting:oe}=Ae},"unfreeze"),A}t(BQe,"validation");var nke=[],WV;function HV(l,f,h,S){WV=S;let C={};if(Object.prototype.hasOwnProperty.call(l,"extends")){if(typeof l.extends!="string")return C;let A=/\.json|\..*rc$/.test(l.extends),j=null;if(A)j=z5t(f,l.extends);else try{j=require.resolve(l.extends)}catch{return l}q5t(j),nke.push(j),C=A?JSON.parse(WV.readFileSync(j,"utf8")):require(l.extends),delete l.extends,C=HV(C,WV.path.dirname(j),h,WV)}return nke=[],h?JQe(C,l):Object.assign({},C,l)}t(HV,"applyExtends");function q5t(l){if(nke.indexOf(l)>-1)throw new Up(`Circular extended configurations: '${l}'.`)}t(q5t,"checkForCircularExtends");function z5t(l,f){return WV.path.resolve(l,f)}t(z5t,"getPathToDefaultConfig");function JQe(l,f){let h={};function S(C){return C&&typeof C=="object"&&!Array.isArray(C)}t(S,"isObject"),Object.assign(h,l);for(let C of Object.keys(f))S(f[C])&&S(h[C])?h[C]=JQe(l[C],f[C]):h[C]=f[C];return h}t(JQe,"mergeDeep");var xo=function(l,f,h,S,C){if(S==="m")throw new TypeError("Private method is not writable");if(S==="a"&&!C)throw new TypeError("Private accessor was defined without a setter");if(typeof f=="function"?l!==f||!C:!f.has(l))throw new TypeError("Cannot write private member to an object whose class did not declare it");return S==="a"?C.call(l,h):C?C.value=h:f.set(l,h),h},Zt=function(l,f,h,S){if(h==="a"&&!S)throw new TypeError("Private accessor was defined without a getter");if(typeof f=="function"?l!==f||!S:!f.has(l))throw new TypeError("Cannot read private member from an object whose class did not declare it");return h==="m"?S:h==="a"?S.call(l):S?S.value:f.get(l)},Om,y8,GV,jS,Qb,Kie,q6,v8,ese,BS,tse,JS,Hk,Zb,$S,rse,oR,Dg,Bo,nse,ise,Xb,b8,cR,S8,z6,sse,Bc,x8,T8,C8,il,ase,Gk,sm;function aZe(l){return(f=[],h=l.process.cwd(),S)=>{let C=new dke(f,h,S,l);return Object.defineProperty(C,"argv",{get:t(()=>C.parse(),"get"),enumerable:!0}),C.help(),C.version(),C}}t(aZe,"YargsFactory");var $Qe=Symbol("copyDoubleDash"),qQe=Symbol("copyDoubleDash"),ike=Symbol("deleteFromParserHintObject"),zQe=Symbol("emitWarning"),VQe=Symbol("freeze"),UQe=Symbol("getDollarZero"),k8=Symbol("getParserConfiguration"),WQe=Symbol("getUsageConfiguration"),ske=Symbol("guessLocale"),HQe=Symbol("guessVersion"),GQe=Symbol("parsePositionalNumbers"),ake=Symbol("pkgUp"),V6=Symbol("populateParserHintArray"),lR=Symbol("populateParserHintSingleValueDictionary"),oke=Symbol("populateParserHintArrayDictionary"),cke=Symbol("populateParserHintDictionary"),lke=Symbol("sanitizeKey"),uke=Symbol("setKey"),fke=Symbol("unfreeze"),QQe=Symbol("validateAsync"),ZQe=Symbol("getCommandInstance"),XQe=Symbol("getContext"),YQe=Symbol("getHasOutput"),KQe=Symbol("getLoggerInstance"),eZe=Symbol("getParseContext"),tZe=Symbol("getUsageInstance"),rZe=Symbol("getValidationInstance"),ose=Symbol("hasParseCallback"),nZe=Symbol("isGlobalContext"),E8=Symbol("postProcess"),iZe=Symbol("rebase"),_ke=Symbol("reset"),QV=Symbol("runYargsParserAndExecuteCommands"),pke=Symbol("runValidation"),sZe=Symbol("setHasOutput"),P8=Symbol("kTrackManuallySetKeys"),mke=class mke{constructor(f=[],h,S,C){this.customScriptName=!1,this.parsed=!1,Om.set(this,void 0),y8.set(this,void 0),GV.set(this,{commands:[],fullCommands:[]}),jS.set(this,null),Qb.set(this,null),Kie.set(this,"show-hidden"),q6.set(this,null),v8.set(this,!0),ese.set(this,{}),BS.set(this,!0),tse.set(this,[]),JS.set(this,void 0),Hk.set(this,{}),Zb.set(this,!1),$S.set(this,null),rse.set(this,!0),oR.set(this,void 0),Dg.set(this,""),Bo.set(this,void 0),nse.set(this,void 0),ise.set(this,{}),Xb.set(this,null),b8.set(this,null),cR.set(this,{}),S8.set(this,{}),z6.set(this,void 0),sse.set(this,!1),Bc.set(this,void 0),x8.set(this,!1),T8.set(this,!1),C8.set(this,!1),il.set(this,void 0),ase.set(this,{}),Gk.set(this,null),sm.set(this,void 0),xo(this,Bc,C,"f"),xo(this,z6,f,"f"),xo(this,y8,h,"f"),xo(this,nse,S,"f"),xo(this,JS,new Zie(this),"f"),this.$0=this[UQe](),this[_ke](),xo(this,Om,Zt(this,Om,"f"),"f"),xo(this,il,Zt(this,il,"f"),"f"),xo(this,sm,Zt(this,sm,"f"),"f"),xo(this,Bo,Zt(this,Bo,"f"),"f"),Zt(this,Bo,"f").showHiddenOpt=Zt(this,Kie,"f"),xo(this,oR,this[qQe](),"f")}addHelpOpt(f,h){let S="help";return ho("[string|boolean] [string]",[f,h],arguments.length),Zt(this,$S,"f")&&(this[ike](Zt(this,$S,"f")),xo(this,$S,null,"f")),f===!1&&h===void 0?this:(xo(this,$S,typeof f=="string"?f:S,"f"),this.boolean(Zt(this,$S,"f")),this.describe(Zt(this,$S,"f"),h||Zt(this,il,"f").deferY18nLookup("Show help")),this)}help(f,h){return this.addHelpOpt(f,h)}addShowHiddenOpt(f,h){if(ho("[string|boolean] [string]",[f,h],arguments.length),f===!1&&h===void 0)return this;let S=typeof f=="string"?f:Zt(this,Kie,"f");return this.boolean(S),this.describe(S,h||Zt(this,il,"f").deferY18nLookup("Show hidden options")),Zt(this,Bo,"f").showHiddenOpt=S,this}showHidden(f,h){return this.addShowHiddenOpt(f,h)}alias(f,h){return ho("<object|string|array> [string|array]",[f,h],arguments.length),this[oke](this.alias.bind(this),"alias",f,h),this}array(f){return ho("<array|string>",[f],arguments.length),this[V6]("array",f),this[P8](f),this}boolean(f){return ho("<array|string>",[f],arguments.length),this[V6]("boolean",f),this[P8](f),this}check(f,h){return ho("<function> [boolean]",[f,h],arguments.length),this.middleware((S,C)=>g8(()=>f(S,C.getOptions()),A=>(A?(typeof A=="string"||A instanceof Error)&&Zt(this,il,"f").fail(A.toString(),A):Zt(this,il,"f").fail(Zt(this,Bc,"f").y18n.__("Argument check failed: %s",f.toString())),S),A=>(Zt(this,il,"f").fail(A.message?A.message:A.toString(),A),S)),!1,h),this}choices(f,h){return ho("<object|string|array> [string|array]",[f,h],arguments.length),this[oke](this.choices.bind(this),"choices",f,h),this}coerce(f,h){if(ho("<object|string|array> [function]",[f,h],arguments.length),Array.isArray(f)){if(!h)throw new Up("coerce callback must be provided");for(let S of f)this.coerce(S,h);return this}else if(typeof f=="object"){for(let S of Object.keys(f))this.coerce(S,f[S]);return this}if(!h)throw new Up("coerce callback must be provided");return Zt(this,Bo,"f").key[f]=!0,Zt(this,JS,"f").addCoerceMiddleware((S,C)=>{let A;return Object.prototype.hasOwnProperty.call(S,f)?g8(()=>(A=C.getAliases(),h(S[f])),Z=>{S[f]=Z;let oe=C.getInternalMethods().getParserConfiguration()["strip-aliased"];if(A[f]&&oe!==!0)for(let ge of A[f])S[ge]=Z;return S},Z=>{throw new Up(Z.message)}):S},f),this}conflicts(f,h){return ho("<string|object> [string|array]",[f,h],arguments.length),Zt(this,sm,"f").conflicts(f,h),this}config(f="config",h,S){return ho("[object|string] [string|function] [function]",[f,h,S],arguments.length),typeof f=="object"&&!Array.isArray(f)?(f=HV(f,Zt(this,y8,"f"),this[k8]()["deep-merge-config"]||!1,Zt(this,Bc,"f")),Zt(this,Bo,"f").configObjects=(Zt(this,Bo,"f").configObjects||[]).concat(f),this):(typeof h=="function"&&(S=h,h=void 0),this.describe(f,h||Zt(this,il,"f").deferY18nLookup("Path to JSON config file")),(Array.isArray(f)?f:[f]).forEach(C=>{Zt(this,Bo,"f").config[C]=S||!0}),this)}completion(f,h,S){return ho("[string] [string|boolean|function] [function]",[f,h,S],arguments.length),typeof h=="function"&&(S=h,h=void 0),xo(this,Qb,f||Zt(this,Qb,"f")||"completion","f"),!h&&h!==!1&&(h="generate completion script"),this.command(Zt(this,Qb,"f"),h),S&&Zt(this,jS,"f").registerFunction(S),this}command(f,h,S,C,A,j){return ho("<string|array|object> [string|boolean] [function|object] [function] [array] [boolean|string]",[f,h,S,C,A,j],arguments.length),Zt(this,Om,"f").addHandler(f,h,S,C,A,j),this}commands(f,h,S,C,A,j){return this.command(f,h,S,C,A,j)}commandDir(f,h){ho("<string> [object]",[f,h],arguments.length);let S=Zt(this,nse,"f")||Zt(this,Bc,"f").require;return Zt(this,Om,"f").addDirectory(f,S,Zt(this,Bc,"f").getCallerFile(),h),this}count(f){return ho("<array|string>",[f],arguments.length),this[V6]("count",f),this[P8](f),this}default(f,h,S){return ho("<object|string|array> [*] [string]",[f,h,S],arguments.length),S&&(QCe(f,Zt(this,Bc,"f")),Zt(this,Bo,"f").defaultDescription[f]=S),typeof h=="function"&&(QCe(f,Zt(this,Bc,"f")),Zt(this,Bo,"f").defaultDescription[f]||(Zt(this,Bo,"f").defaultDescription[f]=Zt(this,il,"f").functionDescription(h)),h=h.call()),this[lR](this.default.bind(this),"default",f,h),this}defaults(f,h,S){return this.default(f,h,S)}demandCommand(f=1,h,S,C){return ho("[number] [number|string] [string|null|undefined] [string|null|undefined]",[f,h,S,C],arguments.length),typeof h!="number"&&(S=h,h=1/0),this.global("_",!1),Zt(this,Bo,"f").demandedCommands._={min:f,max:h,minMsg:S,maxMsg:C},this}demand(f,h,S){return Array.isArray(h)?(h.forEach(C=>{p1(S,!0,Zt(this,Bc,"f")),this.demandOption(C,S)}),h=1/0):typeof h!="number"&&(S=h,h=1/0),typeof f=="number"?(p1(S,!0,Zt(this,Bc,"f")),this.demandCommand(f,h,S,S)):Array.isArray(f)?f.forEach(C=>{p1(S,!0,Zt(this,Bc,"f")),this.demandOption(C,S)}):typeof S=="string"?this.demandOption(f,S):(S===!0||typeof S>"u")&&this.demandOption(f),this}demandOption(f,h){return ho("<object|string|array> [string]",[f,h],arguments.length),this[lR](this.demandOption.bind(this),"demandedOptions",f,h),this}deprecateOption(f,h){return ho("<string> [string|boolean]",[f,h],arguments.length),Zt(this,Bo,"f").deprecatedOptions[f]=h,this}describe(f,h){return ho("<object|string|array> [string]",[f,h],arguments.length),this[uke](f,!0),Zt(this,il,"f").describe(f,h),this}detectLocale(f){return ho("<boolean>",[f],arguments.length),xo(this,v8,f,"f"),this}env(f){return ho("[string|boolean]",[f],arguments.length),f===!1?delete Zt(this,Bo,"f").envPrefix:Zt(this,Bo,"f").envPrefix=f||"",this}epilogue(f){return ho("<string>",[f],arguments.length),Zt(this,il,"f").epilog(f),this}epilog(f){return this.epilogue(f)}example(f,h){return ho("<string|array> [string]",[f,h],arguments.length),Array.isArray(f)?f.forEach(S=>this.example(...S)):Zt(this,il,"f").example(f,h),this}exit(f,h){xo(this,Zb,!0,"f"),xo(this,q6,h,"f"),Zt(this,BS,"f")&&Zt(this,Bc,"f").process.exit(f)}exitProcess(f=!0){return ho("[boolean]",[f],arguments.length),xo(this,BS,f,"f"),this}fail(f){if(ho("<function|boolean>",[f],arguments.length),typeof f=="boolean"&&f!==!1)throw new Up("Invalid first argument. Expected function or boolean 'false'");return Zt(this,il,"f").failFn(f),this}getAliases(){return this.parsed?this.parsed.aliases:{}}async getCompletion(f,h){return ho("<array> [function]",[f,h],arguments.length),h?Zt(this,jS,"f").getCompletion(f,h):new Promise((S,C)=>{Zt(this,jS,"f").getCompletion(f,(A,j)=>{A?C(A):S(j)})})}getDemandedOptions(){return ho([],0),Zt(this,Bo,"f").demandedOptions}getDemandedCommands(){return ho([],0),Zt(this,Bo,"f").demandedCommands}getDeprecatedOptions(){return ho([],0),Zt(this,Bo,"f").deprecatedOptions}getDetectLocale(){return Zt(this,v8,"f")}getExitProcess(){return Zt(this,BS,"f")}getGroups(){return Object.assign({},Zt(this,Hk,"f"),Zt(this,S8,"f"))}getHelp(){if(xo(this,Zb,!0,"f"),!Zt(this,il,"f").hasCachedHelpMessage()){if(!this.parsed){let h=this[QV](Zt(this,z6,"f"),void 0,void 0,0,!0);if(Wp(h))return h.then(()=>Zt(this,il,"f").help())}let f=Zt(this,Om,"f").runDefaultBuilderOn(this);if(Wp(f))return f.then(()=>Zt(this,il,"f").help())}return Promise.resolve(Zt(this,il,"f").help())}getOptions(){return Zt(this,Bo,"f")}getStrict(){return Zt(this,x8,"f")}getStrictCommands(){return Zt(this,T8,"f")}getStrictOptions(){return Zt(this,C8,"f")}global(f,h){return ho("<string|array> [boolean]",[f,h],arguments.length),f=[].concat(f),h!==!1?Zt(this,Bo,"f").local=Zt(this,Bo,"f").local.filter(S=>f.indexOf(S)===-1):f.forEach(S=>{Zt(this,Bo,"f").local.includes(S)||Zt(this,Bo,"f").local.push(S)}),this}group(f,h){ho("<string|array> <string>",[f,h],arguments.length);let S=Zt(this,S8,"f")[h]||Zt(this,Hk,"f")[h];Zt(this,S8,"f")[h]&&delete Zt(this,S8,"f")[h];let C={};return Zt(this,Hk,"f")[h]=(S||[]).concat(f).filter(A=>C[A]?!1:C[A]=!0),this}hide(f){return ho("<string>",[f],arguments.length),Zt(this,Bo,"f").hiddenOptions.push(f),this}implies(f,h){return ho("<string|object> [number|string|array]",[f,h],arguments.length),Zt(this,sm,"f").implies(f,h),this}locale(f){return ho("[string]",[f],arguments.length),f===void 0?(this[ske](),Zt(this,Bc,"f").y18n.getLocale()):(xo(this,v8,!1,"f"),Zt(this,Bc,"f").y18n.setLocale(f),this)}middleware(f,h,S){return Zt(this,JS,"f").addMiddleware(f,!!h,S)}nargs(f,h){return ho("<string|object|array> [number]",[f,h],arguments.length),this[lR](this.nargs.bind(this),"narg",f,h),this}normalize(f){return ho("<array|string>",[f],arguments.length),this[V6]("normalize",f),this}number(f){return ho("<array|string>",[f],arguments.length),this[V6]("number",f),this[P8](f),this}option(f,h){if(ho("<string|object> [object]",[f,h],arguments.length),typeof f=="object")Object.keys(f).forEach(S=>{this.options(S,f[S])});else{typeof h!="object"&&(h={}),this[P8](f),Zt(this,Gk,"f")&&(f==="version"||(h==null?void 0:h.alias)==="version")&&this[zQe](['"version" is a reserved word.',"Please do one of the following:",'- Disable version with `yargs.version(false)` if using "version" as an option',"- Use the built-in `yargs.version` method instead (if applicable)","- Use a different option key","https://yargs.js.org/docs/#api-reference-version"].join(`
|
|
566
566
|
`),void 0,"versionWarning"),Zt(this,Bo,"f").key[f]=!0,h.alias&&this.alias(f,h.alias);let S=h.deprecate||h.deprecated;S&&this.deprecateOption(f,S);let C=h.demand||h.required||h.require;C&&this.demand(f,C),h.demandOption&&this.demandOption(f,typeof h.demandOption=="string"?h.demandOption:void 0),h.conflicts&&this.conflicts(f,h.conflicts),"default"in h&&this.default(f,h.default),h.implies!==void 0&&this.implies(f,h.implies),h.nargs!==void 0&&this.nargs(f,h.nargs),h.config&&this.config(f,h.configParser),h.normalize&&this.normalize(f),h.choices&&this.choices(f,h.choices),h.coerce&&this.coerce(f,h.coerce),h.group&&this.group(f,h.group),(h.boolean||h.type==="boolean")&&(this.boolean(f),h.alias&&this.boolean(h.alias)),(h.array||h.type==="array")&&(this.array(f),h.alias&&this.array(h.alias)),(h.number||h.type==="number")&&(this.number(f),h.alias&&this.number(h.alias)),(h.string||h.type==="string")&&(this.string(f),h.alias&&this.string(h.alias)),(h.count||h.type==="count")&&this.count(f),typeof h.global=="boolean"&&this.global(f,h.global),h.defaultDescription&&(Zt(this,Bo,"f").defaultDescription[f]=h.defaultDescription),h.skipValidation&&this.skipValidation(f);let A=h.describe||h.description||h.desc,j=Zt(this,il,"f").getDescriptions();(!Object.prototype.hasOwnProperty.call(j,f)||typeof A=="string")&&this.describe(f,A),h.hidden&&this.hide(f),h.requiresArg&&this.requiresArg(f)}return this}options(f,h){return this.option(f,h)}parse(f,h,S){ho("[string|array] [function|boolean|object] [function]",[f,h,S],arguments.length),this[VQe](),typeof f>"u"&&(f=Zt(this,z6,"f")),typeof h=="object"&&(xo(this,b8,h,"f"),h=S),typeof h=="function"&&(xo(this,Xb,h,"f"),h=!1),h||xo(this,z6,f,"f"),Zt(this,Xb,"f")&&xo(this,BS,!1,"f");let C=this[QV](f,!!h),A=this.parsed;return Zt(this,jS,"f").setParsed(this.parsed),Wp(C)?C.then(j=>(Zt(this,Xb,"f")&&Zt(this,Xb,"f").call(this,Zt(this,q6,"f"),j,Zt(this,Dg,"f")),j)).catch(j=>{throw Zt(this,Xb,"f")&&Zt(this,Xb,"f")(j,this.parsed.argv,Zt(this,Dg,"f")),j}).finally(()=>{this[fke](),this.parsed=A}):(Zt(this,Xb,"f")&&Zt(this,Xb,"f").call(this,Zt(this,q6,"f"),C,Zt(this,Dg,"f")),this[fke](),this.parsed=A,C)}parseAsync(f,h,S){let C=this.parse(f,h,S);return Wp(C)?C:Promise.resolve(C)}parseSync(f,h,S){let C=this.parse(f,h,S);if(Wp(C))throw new Up(".parseSync() must not be used with asynchronous builders, handlers, or middleware");return C}parserConfiguration(f){return ho("<object>",[f],arguments.length),xo(this,ise,f,"f"),this}pkgConf(f,h){ho("<string> [string]",[f,h],arguments.length);let S=null,C=this[ake](h||Zt(this,y8,"f"));return C[f]&&typeof C[f]=="object"&&(S=HV(C[f],h||Zt(this,y8,"f"),this[k8]()["deep-merge-config"]||!1,Zt(this,Bc,"f")),Zt(this,Bo,"f").configObjects=(Zt(this,Bo,"f").configObjects||[]).concat(S)),this}positional(f,h){ho("<string> <object>",[f,h],arguments.length);let S=["default","defaultDescription","implies","normalize","choices","conflicts","coerce","type","describe","desc","description","alias"];h=J6(h,(j,Z)=>j==="type"&&!["string","number","boolean"].includes(Z)?!1:S.includes(j));let C=Zt(this,GV,"f").fullCommands[Zt(this,GV,"f").fullCommands.length-1],A=C?Zt(this,Om,"f").cmdToParseOptions(C):{array:[],alias:{},default:{},demand:{}};return sR(A).forEach(j=>{let Z=A[j];Array.isArray(Z)?Z.indexOf(f)!==-1&&(h[j]=!0):Z[f]&&!(j in h)&&(h[j]=Z[f])}),this.group(f,Zt(this,il,"f").getPositionalGroupName()),this.option(f,h)}recommendCommands(f=!0){return ho("[boolean]",[f],arguments.length),xo(this,sse,f,"f"),this}required(f,h,S){return this.demand(f,h,S)}require(f,h,S){return this.demand(f,h,S)}requiresArg(f){return ho("<array|string|object> [number]",[f],arguments.length),typeof f=="string"&&Zt(this,Bo,"f").narg[f]?this:(this[lR](this.requiresArg.bind(this),"narg",f,NaN),this)}showCompletionScript(f,h){return ho("[string] [string]",[f,h],arguments.length),f=f||this.$0,Zt(this,oR,"f").log(Zt(this,jS,"f").generateCompletionScript(f,h||Zt(this,Qb,"f")||"completion")),this}showHelp(f){if(ho("[string|function]",[f],arguments.length),xo(this,Zb,!0,"f"),!Zt(this,il,"f").hasCachedHelpMessage()){if(!this.parsed){let S=this[QV](Zt(this,z6,"f"),void 0,void 0,0,!0);if(Wp(S))return S.then(()=>{Zt(this,il,"f").showHelp(f)}),this}let h=Zt(this,Om,"f").runDefaultBuilderOn(this);if(Wp(h))return h.then(()=>{Zt(this,il,"f").showHelp(f)}),this}return Zt(this,il,"f").showHelp(f),this}scriptName(f){return this.customScriptName=!0,this.$0=f,this}showHelpOnFail(f,h){return ho("[boolean|string] [string]",[f,h],arguments.length),Zt(this,il,"f").showHelpOnFail(f,h),this}showVersion(f){return ho("[string|function]",[f],arguments.length),Zt(this,il,"f").showVersion(f),this}skipValidation(f){return ho("<array|string>",[f],arguments.length),this[V6]("skipValidation",f),this}strict(f){return ho("[boolean]",[f],arguments.length),xo(this,x8,f!==!1,"f"),this}strictCommands(f){return ho("[boolean]",[f],arguments.length),xo(this,T8,f!==!1,"f"),this}strictOptions(f){return ho("[boolean]",[f],arguments.length),xo(this,C8,f!==!1,"f"),this}string(f){return ho("<array|string>",[f],arguments.length),this[V6]("string",f),this[P8](f),this}terminalWidth(){return ho([],0),Zt(this,Bc,"f").process.stdColumns}updateLocale(f){return this.updateStrings(f)}updateStrings(f){return ho("<object>",[f],arguments.length),xo(this,v8,!1,"f"),Zt(this,Bc,"f").y18n.updateLocale(f),this}usage(f,h,S,C){if(ho("<string|null|undefined> [string|boolean] [function|object] [function]",[f,h,S,C],arguments.length),h!==void 0){if(p1(f,null,Zt(this,Bc,"f")),(f||"").match(/^\$0( |$)/))return this.command(f,h,S,C);throw new Up(".usage() description must start with $0 if being used as alias for .command()")}else return Zt(this,il,"f").usage(f),this}usageConfiguration(f){return ho("<object>",[f],arguments.length),xo(this,ase,f,"f"),this}version(f,h,S){let C="version";if(ho("[boolean|string] [string] [string]",[f,h,S],arguments.length),Zt(this,Gk,"f")&&(this[ike](Zt(this,Gk,"f")),Zt(this,il,"f").version(void 0),xo(this,Gk,null,"f")),arguments.length===0)S=this[HQe](),f=C;else if(arguments.length===1){if(f===!1)return this;S=f,f=C}else arguments.length===2&&(S=h,h=void 0);return xo(this,Gk,typeof f=="string"?f:C,"f"),h=h||Zt(this,il,"f").deferY18nLookup("Show version number"),Zt(this,il,"f").version(S||void 0),this.boolean(Zt(this,Gk,"f")),this.describe(Zt(this,Gk,"f"),h),this}wrap(f){return ho("<number|null|undefined>",[f],arguments.length),Zt(this,il,"f").wrap(f),this}[(Om=new WeakMap,y8=new WeakMap,GV=new WeakMap,jS=new WeakMap,Qb=new WeakMap,Kie=new WeakMap,q6=new WeakMap,v8=new WeakMap,ese=new WeakMap,BS=new WeakMap,tse=new WeakMap,JS=new WeakMap,Hk=new WeakMap,Zb=new WeakMap,$S=new WeakMap,rse=new WeakMap,oR=new WeakMap,Dg=new WeakMap,Bo=new WeakMap,nse=new WeakMap,ise=new WeakMap,Xb=new WeakMap,b8=new WeakMap,cR=new WeakMap,S8=new WeakMap,z6=new WeakMap,sse=new WeakMap,Bc=new WeakMap,x8=new WeakMap,T8=new WeakMap,C8=new WeakMap,il=new WeakMap,ase=new WeakMap,Gk=new WeakMap,sm=new WeakMap,$Qe)](f){if(!f._||!f["--"])return f;f._.push.apply(f._,f["--"]);try{delete f["--"]}catch{}return f}[qQe](){return{log:t((...f)=>{this[ose]()||console.log(...f),xo(this,Zb,!0,"f"),Zt(this,Dg,"f").length&&xo(this,Dg,Zt(this,Dg,"f")+`
|
|
567
567
|
`,"f"),xo(this,Dg,Zt(this,Dg,"f")+f.join(" "),"f")},"log"),error:t((...f)=>{this[ose]()||console.error(...f),xo(this,Zb,!0,"f"),Zt(this,Dg,"f").length&&xo(this,Dg,Zt(this,Dg,"f")+`
|
|
568
|
-
`,"f"),xo(this,Dg,Zt(this,Dg,"f")+f.join(" "),"f")},"error")}}[ike](f){sR(Zt(this,Bo,"f")).forEach(h=>{if((C=>C==="configObjects")(h))return;let S=Zt(this,Bo,"f")[h];Array.isArray(S)?S.includes(f)&&S.splice(S.indexOf(f),1):typeof S=="object"&&delete S[f]}),delete Zt(this,il,"f").getDescriptions()[f]}[zQe](f,h,S){Zt(this,ese,"f")[S]||(Zt(this,Bc,"f").process.emitWarning(f,h),Zt(this,ese,"f")[S]=!0)}[VQe](){Zt(this,tse,"f").push({options:Zt(this,Bo,"f"),configObjects:Zt(this,Bo,"f").configObjects.slice(0),exitProcess:Zt(this,BS,"f"),groups:Zt(this,Hk,"f"),strict:Zt(this,x8,"f"),strictCommands:Zt(this,T8,"f"),strictOptions:Zt(this,C8,"f"),completionCommand:Zt(this,Qb,"f"),output:Zt(this,Dg,"f"),exitError:Zt(this,q6,"f"),hasOutput:Zt(this,Zb,"f"),parsed:this.parsed,parseFn:Zt(this,Xb,"f"),parseContext:Zt(this,b8,"f")}),Zt(this,il,"f").freeze(),Zt(this,sm,"f").freeze(),Zt(this,Om,"f").freeze(),Zt(this,JS,"f").freeze()}[UQe](){let f="",h;return/\b(node|iojs|electron)(\.exe)?$/.test(Zt(this,Bc,"f").process.argv()[0])?h=Zt(this,Bc,"f").process.argv().slice(1,2):h=Zt(this,Bc,"f").process.argv().slice(0,1),f=h.map(S=>{let C=this[iZe](Zt(this,y8,"f"),S);return S.match(/^(\/|([a-zA-Z]:)?\\)/)&&C.length<S.length?C:S}).join(" ").trim(),Zt(this,Bc,"f").getEnv("_")&&Zt(this,Bc,"f").getProcessArgvBin()===Zt(this,Bc,"f").getEnv("_")&&(f=Zt(this,Bc,"f").getEnv("_").replace(`${Zt(this,Bc,"f").path.dirname(Zt(this,Bc,"f").process.execPath())}/`,"")),f}[k8](){return Zt(this,ise,"f")}[WQe](){return Zt(this,ase,"f")}[ske](){if(!Zt(this,v8,"f"))return;let f=Zt(this,Bc,"f").getEnv("LC_ALL")||Zt(this,Bc,"f").getEnv("LC_MESSAGES")||Zt(this,Bc,"f").getEnv("LANG")||Zt(this,Bc,"f").getEnv("LANGUAGE")||"en_US";this.locale(f.replace(/[.:].*/,""))}[HQe](){return this[ake]().version||"unknown"}[GQe](f){let h=f["--"]?f["--"]:f._;for(let S=0,C;(C=h[S])!==void 0;S++)Zt(this,Bc,"f").Parser.looksLikeNumber(C)&&Number.isSafeInteger(Math.floor(parseFloat(`${C}`)))&&(h[S]=Number(C));return f}[ake](f){let h=f||"*";if(Zt(this,cR,"f")[h])return Zt(this,cR,"f")[h];let S={};try{let C=f||Zt(this,Bc,"f").mainFilename;!f&&Zt(this,Bc,"f").path.extname(C)&&(C=Zt(this,Bc,"f").path.dirname(C));let A=Zt(this,Bc,"f").findUp(C,(j,Z)=>{if(Z.includes("package.json"))return"package.json"});p1(A,void 0,Zt(this,Bc,"f")),S=JSON.parse(Zt(this,Bc,"f").readFileSync(A,"utf8"))}catch{}return Zt(this,cR,"f")[h]=S||{},Zt(this,cR,"f")[h]}[V6](f,h){h=[].concat(h),h.forEach(S=>{S=this[lke](S),Zt(this,Bo,"f")[f].push(S)})}[lR](f,h,S,C){this[cke](f,h,S,C,(A,j,Z)=>{Zt(this,Bo,"f")[A][j]=Z})}[oke](f,h,S,C){this[cke](f,h,S,C,(A,j,Z)=>{Zt(this,Bo,"f")[A][j]=(Zt(this,Bo,"f")[A][j]||[]).concat(Z)})}[cke](f,h,S,C,A){if(Array.isArray(S))S.forEach(j=>{f(j,C)});else if((j=>typeof j=="object")(S))for(let j of sR(S))f(j,S[j]);else A(h,this[lke](S),C)}[lke](f){return f==="__proto__"?"___proto___":f}[uke](f,h){return this[lR](this[uke].bind(this),"key",f,h),this}[fke](){var f,h,S,C,A,j,Z,oe,ge,je,Ae,_e;let Lt=Zt(this,tse,"f").pop();p1(Lt,void 0,Zt(this,Bc,"f"));let ot;f=this,h=this,S=this,C=this,A=this,j=this,Z=this,oe=this,ge=this,je=this,Ae=this,_e=this,{options:{set value(tt){xo(f,Bo,tt,"f")}}.value,configObjects:ot,exitProcess:{set value(tt){xo(h,BS,tt,"f")}}.value,groups:{set value(tt){xo(S,Hk,tt,"f")}}.value,output:{set value(tt){xo(C,Dg,tt,"f")}}.value,exitError:{set value(tt){xo(A,q6,tt,"f")}}.value,hasOutput:{set value(tt){xo(j,Zb,tt,"f")}}.value,parsed:this.parsed,strict:{set value(tt){xo(Z,x8,tt,"f")}}.value,strictCommands:{set value(tt){xo(oe,T8,tt,"f")}}.value,strictOptions:{set value(tt){xo(ge,C8,tt,"f")}}.value,completionCommand:{set value(tt){xo(je,Qb,tt,"f")}}.value,parseFn:{set value(tt){xo(Ae,Xb,tt,"f")}}.value,parseContext:{set value(tt){xo(_e,b8,tt,"f")}}.value}=Lt,Zt(this,Bo,"f").configObjects=ot,Zt(this,il,"f").unfreeze(),Zt(this,sm,"f").unfreeze(),Zt(this,Om,"f").unfreeze(),Zt(this,JS,"f").unfreeze()}[QQe](f,h){return g8(h,S=>(f(S),S))}getInternalMethods(){return{getCommandInstance:this[ZQe].bind(this),getContext:this[XQe].bind(this),getHasOutput:this[YQe].bind(this),getLoggerInstance:this[KQe].bind(this),getParseContext:this[eZe].bind(this),getParserConfiguration:this[k8].bind(this),getUsageConfiguration:this[WQe].bind(this),getUsageInstance:this[tZe].bind(this),getValidationInstance:this[rZe].bind(this),hasParseCallback:this[ose].bind(this),isGlobalContext:this[nZe].bind(this),postProcess:this[E8].bind(this),reset:this[_ke].bind(this),runValidation:this[pke].bind(this),runYargsParserAndExecuteCommands:this[QV].bind(this),setHasOutput:this[sZe].bind(this)}}[ZQe](){return Zt(this,Om,"f")}[XQe](){return Zt(this,GV,"f")}[YQe](){return Zt(this,Zb,"f")}[KQe](){return Zt(this,oR,"f")}[eZe](){return Zt(this,b8,"f")||{}}[tZe](){return Zt(this,il,"f")}[rZe](){return Zt(this,sm,"f")}[ose](){return!!Zt(this,Xb,"f")}[nZe](){return Zt(this,rse,"f")}[E8](f,h,S,C){return S||Wp(f)||(h||(f=this[$Qe](f)),(this[k8]()["parse-positional-numbers"]||this[k8]()["parse-positional-numbers"]===void 0)&&(f=this[GQe](f)),C&&(f=h8(f,this,Zt(this,JS,"f").getMiddleware(),!1))),f}[_ke](f={}){xo(this,Bo,Zt(this,Bo,"f")||{},"f");let h={};h.local=Zt(this,Bo,"f").local||[],h.configObjects=Zt(this,Bo,"f").configObjects||[];let S={};h.local.forEach(j=>{S[j]=!0,(f[j]||[]).forEach(Z=>{S[Z]=!0})}),Object.assign(Zt(this,S8,"f"),Object.keys(Zt(this,Hk,"f")).reduce((j,Z)=>{let oe=Zt(this,Hk,"f")[Z].filter(ge=>!(ge in S));return oe.length>0&&(j[Z]=oe),j},{})),xo(this,Hk,{},"f");let C=["array","boolean","string","skipValidation","count","normalize","number","hiddenOptions"],A=["narg","key","alias","default","defaultDescription","config","choices","demandedOptions","demandedCommands","deprecatedOptions"];return C.forEach(j=>{h[j]=(Zt(this,Bo,"f")[j]||[]).filter(Z=>!S[Z])}),A.forEach(j=>{h[j]=J6(Zt(this,Bo,"f")[j],Z=>!S[Z])}),h.envPrefix=Zt(this,Bo,"f").envPrefix,xo(this,Bo,h,"f"),xo(this,il,Zt(this,il,"f")?Zt(this,il,"f").reset(S):OQe(this,Zt(this,Bc,"f")),"f"),xo(this,sm,Zt(this,sm,"f")?Zt(this,sm,"f").reset(S):BQe(this,Zt(this,il,"f"),Zt(this,Bc,"f")),"f"),xo(this,Om,Zt(this,Om,"f")?Zt(this,Om,"f").reset():AQe(Zt(this,il,"f"),Zt(this,sm,"f"),Zt(this,JS,"f"),Zt(this,Bc,"f")),"f"),Zt(this,jS,"f")||xo(this,jS,RQe(this,Zt(this,il,"f"),Zt(this,Om,"f"),Zt(this,Bc,"f")),"f"),Zt(this,JS,"f").reset(),xo(this,Qb,null,"f"),xo(this,Dg,"","f"),xo(this,q6,null,"f"),xo(this,Zb,!1,"f"),this.parsed=!1,this}[iZe](f,h){return Zt(this,Bc,"f").path.relative(f,h)}[QV](f,h,S,C=0,A=!1){let j=!!S||A;f=f||Zt(this,z6,"f"),Zt(this,Bo,"f").__=Zt(this,Bc,"f").y18n.__,Zt(this,Bo,"f").configuration=this[k8]();let Z=!!Zt(this,Bo,"f").configuration["populate--"],oe=Object.assign({},Zt(this,Bo,"f").configuration,{"populate--":!0}),ge=Zt(this,Bc,"f").Parser.detailed(f,Object.assign({},Zt(this,Bo,"f"),{configuration:{"parse-positional-numbers":!1,...oe}})),je=Object.assign(ge.argv,Zt(this,b8,"f")),Ae,_e=ge.aliases,Lt=!1,ot=!1;Object.keys(je).forEach(tt=>{tt===Zt(this,$S,"f")&&je[tt]?Lt=!0:tt===Zt(this,Gk,"f")&&je[tt]&&(ot=!0)}),je.$0=this.$0,this.parsed=ge,C===0&&Zt(this,il,"f").clearCachedHelpMessage();try{if(this[ske](),h)return this[E8](je,Z,!!S,!1);Zt(this,$S,"f")&&[Zt(this,$S,"f")].concat(_e[Zt(this,$S,"f")]||[]).filter($i=>$i.length>1).includes(""+je._[je._.length-1])&&(je._.pop(),Lt=!0),xo(this,rse,!1,"f");let tt=Zt(this,Om,"f").getCommands(),Ht=Zt(this,jS,"f").completionKey in je,jr=Lt||Ht||A;if(je._.length){if(tt.length){let Gn;for(let $i=C||0,is;je._[$i]!==void 0;$i++)if(is=String(je._[$i]),tt.includes(is)&&is!==Zt(this,Qb,"f")){let xi=Zt(this,Om,"f").runCommand(is,this,ge,$i+1,A,Lt||ot||A);return this[E8](xi,Z,!!S,!1)}else if(!Gn&&is!==Zt(this,Qb,"f")){Gn=is;break}!Zt(this,Om,"f").hasDefaultCommand()&&Zt(this,sse,"f")&&Gn&&!jr&&Zt(this,sm,"f").recommendCommands(Gn,tt)}Zt(this,Qb,"f")&&je._.includes(Zt(this,Qb,"f"))&&!Ht&&(Zt(this,BS,"f")&&$6(!0),this.showCompletionScript(),this.exit(0))}if(Zt(this,Om,"f").hasDefaultCommand()&&!jr){let Gn=Zt(this,Om,"f").runCommand(null,this,ge,0,A,Lt||ot||A);return this[E8](Gn,Z,!!S,!1)}if(Ht){Zt(this,BS,"f")&&$6(!0),f=[].concat(f);let Gn=f.slice(f.indexOf(`--${Zt(this,jS,"f").completionKey}`)+1);return Zt(this,jS,"f").getCompletion(Gn,($i,is)=>{if($i)throw new Up($i.message);(is||[]).forEach(xi=>{Zt(this,oR,"f").log(xi)}),this.exit(0)}),this[E8](je,!Z,!!S,!1)}if(Zt(this,Zb,"f")||(Lt?(Zt(this,BS,"f")&&$6(!0),j=!0,this.showHelp("log"),this.exit(0)):ot&&(Zt(this,BS,"f")&&$6(!0),j=!0,Zt(this,il,"f").showVersion("log"),this.exit(0))),!j&&Zt(this,Bo,"f").skipValidation.length>0&&(j=Object.keys(je).some(Gn=>Zt(this,Bo,"f").skipValidation.indexOf(Gn)>=0&&je[Gn]===!0)),!j){if(ge.error)throw new Up(ge.error.message);if(!Ht){let Gn=this[pke](_e,{},ge.error);S||(Ae=h8(je,this,Zt(this,JS,"f").getMiddleware(),!0)),Ae=this[QQe](Gn,Ae??je),Wp(Ae)&&!S&&(Ae=Ae.then(()=>h8(je,this,Zt(this,JS,"f").getMiddleware(),!1)))}}}catch(tt){if(tt instanceof Up)Zt(this,il,"f").fail(tt.message,tt);else throw tt}return this[E8](Ae??je,Z,!!S,!0)}[pke](f,h,S,C){let A={...this.getDemandedOptions()};return j=>{if(S)throw new Up(S.message);Zt(this,sm,"f").nonOptionCount(j),Zt(this,sm,"f").requiredArguments(j,A);let Z=!1;Zt(this,T8,"f")&&(Z=Zt(this,sm,"f").unknownCommands(j)),Zt(this,x8,"f")&&!Z?Zt(this,sm,"f").unknownArguments(j,f,h,!!C):Zt(this,C8,"f")&&Zt(this,sm,"f").unknownArguments(j,f,{},!1,!1),Zt(this,sm,"f").limitedChoices(j),Zt(this,sm,"f").implications(j),Zt(this,sm,"f").conflicting(j)}}[sZe](){xo(this,Zb,!0,"f")}[P8](f){if(typeof f=="string")Zt(this,Bo,"f").key[f]=!0;else for(let h of f)Zt(this,Bo,"f").key[h]=!0}};t(mke,"YargsInstance");var dke=mke;function IQe(l){return!!l&&typeof l.getInternalMethods=="function"}t(IQe,"isYargsInstance");var V5t=aZe(GCe),oZe=V5t;var ZV=require("util");function hke(l){console.log(l)}t(hke,"log");function qS(l){console.log(`[INFO] ${l}`)}t(qS,"logInfo");function XV(l){console.log((0,ZV.styleText)("green",`[SUCCESS] ${l}`))}t(XV,"logSuccess");function w8(l,f){l instanceof Error?console.log((0,ZV.styleText)("red",`[ERROR] ${f||l.message}`)):console.log((0,ZV.styleText)("red",`[ERROR] ${l}`))}t(w8,"logError");function cse(l){console.log((0,ZV.styleText)("bgYellow",`==== ${l} ====`))}t(cse,"logBanner");var cZe=Lh(require("fs"));function uR(){return"2.0.3-rc.0"}t(uR,"getVersion");var VXt=Lh(uZe());var gke=Symbol("options_key");function Gu(l){return(f,h)=>{var S,C;if(l!=null){let A={...Reflect.getMetadata(gke,f),[h]:{...l,describe:l.envAlias?`${l.describe||""} [${l.envAlias}]`:l.describe,type:l.type||((C=(S=Reflect.getMetadata("design:type",f,h))==null?void 0:S.name)==null?void 0:C.toLowerCase())}};Reflect.defineMetadata(gke,A,f)}}}t(Gu,"YargOption");function fZe(l){let f=Reflect.getMetadata(gke,l.prototype);if(!f)throw new Error(`Options for ${l.name} were not defined`);return f}t(fZe,"getYargsOption");function lse(l){return async f=>f.options(U5t(l)).middleware(async h=>await W5t(l,h),!0)}t(lse,"getBuilder");function U5t(l){return Object.entries(fZe(l)).reduce((f,[h,S])=>(f[h]=Object.fromEntries(Object.entries(S).filter(([C])=>!["envAlias","default"].includes(C))),f),{})}t(U5t,"getYargsOptions");async function W5t(l,f){let h=new l;for(let[S,C]of Object.entries(fZe(l)))h[S]=f[S]??C.default;return h}t(W5t,"loadYargsConfig");var eEe=require("util");var _Ze={100:"Continue",101:"Switching Protocols",102:"Processing",103:"Early Hints",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",300:"Ambiguous",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Requested Range Not Satisfiable",417:"Expectation Failed",418:"I Am a Teapot",421:"Misdirected Request",422:"Unprocessable Entity",424:"Failed Dependency",428:"Precondition Required",429:"Too Many Requests",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported"},pZe={"invalid-schema":"Invalid OpenAPI Schemas","invalid-operation-id":"Invalid Operation IDs","missing-path-parameter":"Missing Path Parameters","not-allowed-inline-enum":"Not Allowed Inline Enums","not-allowed-circular-schema":"Not Allowed Circular Schemas","missing-acl-condition-property":"Missing x-acl Condition Properties","missing-status-code":"Missing HTTP Status Codes","invalid-status-code":"Invalid HTTP Status Codes","multiple-success-status-codes":"Multiple Success HTTP Status Codes"};var y_=t(l=>l.charAt(0).toUpperCase()+l.slice(1),"capitalize"),U6=t(l=>l.charAt(0).toLowerCase()+l.slice(1),"decapitalize"),YV=t(l=>l.replace(/(-\w)/g,f=>f[1].toUpperCase()),"kebabToCamel"),fy=t(l=>l.replace(/(_\w)/g,f=>f[1].toUpperCase()),"snakeToCamel"),dZe=t(l=>l.replace(/[\W_]+(\w)?/g,(f,h)=>(h==null?void 0:h.toUpperCase())??""),"nonWordCharactersToCamel"),yke=t((l,f="")=>l.endsWith(f)?l:`${l}${f}`,"suffixIfNeeded"),mZe=t((l,f)=>l.replace(new RegExp(`${f}$`),""),"removeSuffix"),H5t=t(l=>{var S;let f=l.reduce((C,A)=>({...C,[A]:(C[A]??0)+1}),{});return(S=Object.entries(f).toSorted((C,A)=>C[1]===A[1]?A[0].length-C[0].length:A[1]-C[1])[0])==null?void 0:S[0]},"getLongestMostCommon"),vke=t(l=>{let f=l.flatMap(h=>G5t(hZe(y_(h))));return H5t(f)},"getMostCommonAdjacentCombinationSplit"),hZe=t(l=>l.split(/(?<![A-Z])(?=[A-Z])/).filter(Boolean),"splitByUppercase"),use=t(l=>hZe(l).join(" "),"camelToSpaceSeparated"),G5t=t((l,f=["dto","by","for","of","in","to","and","with"])=>{var S;let h=[];for(let C=0;C<l.length;C++)if(!f.includes(l[C].toLowerCase()))for(let A=C+1;A<=l.length;A++)f.includes((S=l[A-1])==null?void 0:S.toLowerCase())||h.push(l.slice(C,A).join(""));return h},"getAdjacentStringCombinations"),gZe=t((l,f)=>{let h=f.replace(/es$|s$/g,""),S=new RegExp(`(${U6(h)}|${y_(h)})[a-z]*(?=$|[A-Z])`,"g");return l.replace(S,"")},"removeWord");function D8(l){return dZe(l)}t(D8,"formatTag");function W6(l,f){var S;let h=(S=l.tags)==null?void 0:S[0];return D8(h??f.defaultTag)}t(W6,"getOperationTag");function yv(l,f){var S;let h=f.splitByTags?(S=l.tags)==null?void 0:S[0]:f.defaultTag;return D8(h??f.defaultTag)}t(yv,"getEndpointTag");function yZe(l,f){return f.excludeTags.some(h=>h.toLowerCase()===l.toLowerCase())}t(yZe,"isTagExcluded");var A8="application/json",bke={"Content-Type":A8,Accept:A8},fse="data",Ske="axios",H6="config",Qk="AxiosRequestConfig",_se={defaultImport:Ske,bindings:[Qk],from:"axios"};var $w=Lh(pse()),xke=2,vZe=["application/octet-stream","multipart/form-data","application/x-www-form-urlencoded","*/*"],bZe=["query","header","path"],I8=[$w.OpenAPIV3.HttpMethods.GET,$w.OpenAPIV3.HttpMethods.PUT,$w.OpenAPIV3.HttpMethods.POST,$w.OpenAPIV3.HttpMethods.DELETE,$w.OpenAPIV3.HttpMethods.OPTIONS,$w.OpenAPIV3.HttpMethods.HEAD,$w.OpenAPIV3.HttpMethods.PATCH,$w.OpenAPIV3.HttpMethods.TRACE],SZe=["string","number","integer","boolean"],KV=["allOf","anyOf","oneOf"];var xZe="Schema",TZe="Enum",CZe="Body",kZe="Param",EZe="Response",PZe="ErrorResponse",eU="z.void()",fR="z.any()",dse="z.instanceof(Blob)",tU="z.enum",wZe="z.int()",DZe="z.number()",mse="z.string()",AZe="z.email()",IZe="z.url()",NZe="z.uuid()",OZe="z.iso.datetime({ offset: true })",Q6={bindings:["z"],from:"zod"};var qw=Symbol.for("@ts-pattern/matcher"),X5t=Symbol.for("@ts-pattern/isVariadic"),gse="@ts-pattern/anonymous-select-key",Tke=t(l=>!!(l&&typeof l=="object"),"r"),hse=t(l=>l&&!!l[qw],"i"),Yk=t((l,f,h)=>{if(hse(l)){let S=l[qw](),{matched:C,selections:A}=S.match(f);return C&&A&&Object.keys(A).forEach(j=>h(j,A[j])),C}if(Tke(l)){if(!Tke(f))return!1;if(Array.isArray(l)){if(!Array.isArray(f))return!1;let S=[],C=[],A=[];for(let j of l.keys()){let Z=l[j];hse(Z)&&Z[X5t]?A.push(Z):A.length?C.push(Z):S.push(Z)}if(A.length){if(A.length>1)throw new Error("Pattern error: Using `...P.array(...)` several times in a single pattern is not allowed.");if(f.length<S.length+C.length)return!1;let j=f.slice(0,S.length),Z=C.length===0?[]:f.slice(-C.length),oe=f.slice(S.length,C.length===0?1/0:-C.length);return S.every((ge,je)=>Yk(ge,j[je],h))&&C.every((ge,je)=>Yk(ge,Z[je],h))&&(A.length===0||Yk(A[0],oe,h))}return l.length===f.length&&l.every((j,Z)=>Yk(j,f[Z],h))}return Reflect.ownKeys(l).every(S=>{let C=l[S];return(S in f||hse(A=C)&&A[qw]().matcherType==="optional")&&Yk(C,f[S],h);var A})}return Object.is(f,l)},"s"),e4=t(l=>{var f,h,S;return Tke(l)?hse(l)?(f=(h=(S=l[qw]()).getSelectionKeys)==null?void 0:h.call(S))!=null?f:[]:Array.isArray(l)?nU(l,e4):nU(Object.values(l),e4):[]},"o"),nU=t((l,f)=>l.reduce((h,S)=>h.concat(f(S)),[]),"c");function zS(l){return Object.assign(l,{optional:t(()=>Y5t(l),"optional"),and:t(f=>id(l,f),"and"),or:t(f=>K5t(l,f),"or"),select:t(f=>f===void 0?FZe(l):FZe(f,l),"select")})}t(zS,"u");function Y5t(l){return zS({[qw]:()=>({match:t(f=>{let h={},S=t((C,A)=>{h[C]=A},"r");return f===void 0?(e4(l).forEach(C=>S(C,void 0)),{matched:!0,selections:h}):{matched:Yk(l,f,S),selections:h}},"match"),getSelectionKeys:t(()=>e4(l),"getSelectionKeys"),matcherType:"optional"})})}t(Y5t,"h");function id(...l){return zS({[qw]:()=>({match:t(f=>{let h={},S=t((C,A)=>{h[C]=A},"r");return{matched:l.every(C=>Yk(C,f,S)),selections:h}},"match"),getSelectionKeys:t(()=>nU(l,e4),"getSelectionKeys"),matcherType:"and"})})}t(id,"m");function K5t(...l){return zS({[qw]:()=>({match:t(f=>{let h={},S=t((C,A)=>{h[C]=A},"r");return nU(l,e4).forEach(C=>S(C,void 0)),{matched:l.some(C=>Yk(C,f,S)),selections:h}},"match"),getSelectionKeys:t(()=>nU(l,e4),"getSelectionKeys"),matcherType:"or"})})}t(K5t,"d");function Lf(l){return{[qw]:()=>({match:t(f=>({matched:!!l(f)}),"match")})}}t(Lf,"p");function FZe(...l){let f=typeof l[0]=="string"?l[0]:void 0,h=l.length===2?l[1]:typeof l[0]=="string"?void 0:l[0];return zS({[qw]:()=>({match:t(S=>{let C={[f??gse]:S};return{matched:h===void 0||Yk(h,S,(A,j)=>{C[A]=j}),selections:C}},"match"),getSelectionKeys:t(()=>[f??gse].concat(h===void 0?[]:e4(h)),"getSelectionKeys")})})}t(FZe,"y");function Zk(l){return typeof l=="number"}t(Zk,"v");function Z6(l){return typeof l=="string"}t(Z6,"b");function X6(l){return typeof l=="bigint"}t(X6,"w");var nYt=zS(Lf(function(l){return!0}));var Y6=t(l=>Object.assign(zS(l),{startsWith:t(f=>{return Y6(id(l,(h=f,Lf(S=>Z6(S)&&S.startsWith(h)))));var h},"startsWith"),endsWith:t(f=>{return Y6(id(l,(h=f,Lf(S=>Z6(S)&&S.endsWith(h)))));var h},"endsWith"),minLength:t(f=>Y6(id(l,(h=>Lf(S=>Z6(S)&&S.length>=h))(f))),"minLength"),length:t(f=>Y6(id(l,(h=>Lf(S=>Z6(S)&&S.length===h))(f))),"length"),maxLength:t(f=>Y6(id(l,(h=>Lf(S=>Z6(S)&&S.length<=h))(f))),"maxLength"),includes:t(f=>{return Y6(id(l,(h=f,Lf(S=>Z6(S)&&S.includes(h)))));var h},"includes"),regex:t(f=>{return Y6(id(l,(h=f,Lf(S=>Z6(S)&&!!S.match(h)))));var h},"regex")}),"j"),iYt=Y6(Lf(Z6)),Xk=t(l=>Object.assign(zS(l),{between:t((f,h)=>Xk(id(l,((S,C)=>Lf(A=>Zk(A)&&S<=A&&C>=A))(f,h))),"between"),lt:t(f=>Xk(id(l,(h=>Lf(S=>Zk(S)&&S<h))(f))),"lt"),gt:t(f=>Xk(id(l,(h=>Lf(S=>Zk(S)&&S>h))(f))),"gt"),lte:t(f=>Xk(id(l,(h=>Lf(S=>Zk(S)&&S<=h))(f))),"lte"),gte:t(f=>Xk(id(l,(h=>Lf(S=>Zk(S)&&S>=h))(f))),"gte"),int:t(()=>Xk(id(l,Lf(f=>Zk(f)&&Number.isInteger(f)))),"int"),finite:t(()=>Xk(id(l,Lf(f=>Zk(f)&&Number.isFinite(f)))),"finite"),positive:t(()=>Xk(id(l,Lf(f=>Zk(f)&&f>0))),"positive"),negative:t(()=>Xk(id(l,Lf(f=>Zk(f)&&f<0))),"negative")}),"x"),sYt=Xk(Lf(Zk)),K6=t(l=>Object.assign(zS(l),{between:t((f,h)=>K6(id(l,((S,C)=>Lf(A=>X6(A)&&S<=A&&C>=A))(f,h))),"between"),lt:t(f=>K6(id(l,(h=>Lf(S=>X6(S)&&S<h))(f))),"lt"),gt:t(f=>K6(id(l,(h=>Lf(S=>X6(S)&&S>h))(f))),"gt"),lte:t(f=>K6(id(l,(h=>Lf(S=>X6(S)&&S<=h))(f))),"lte"),gte:t(f=>K6(id(l,(h=>Lf(S=>X6(S)&&S>=h))(f))),"gte"),positive:t(()=>K6(id(l,Lf(f=>X6(f)&&f>0))),"positive"),negative:t(()=>K6(id(l,Lf(f=>X6(f)&&f<0))),"negative")}),"A"),aYt=K6(Lf(X6)),oYt=zS(Lf(function(l){return typeof l=="boolean"})),cYt=zS(Lf(function(l){return typeof l=="symbol"})),lYt=zS(Lf(function(l){return l==null})),uYt=zS(Lf(function(l){return l!=null}));var Pke=class Pke extends Error{constructor(f){let h;try{h=JSON.stringify(f)}catch{h=f}super(`Pattern matching error: no pattern matches value ${h}`),this.input=void 0,this.input=f}};t(Pke,"W");var Cke=Pke,kke={matched:!1,value:void 0};function l0(l){return new Eke(l,kke)}t(l0,"z");var rU=class rU{constructor(f,h){this.input=void 0,this.state=void 0,this.input=f,this.state=h}with(...f){if(this.state.matched)return this;let h=f[f.length-1],S=[f[0]],C;f.length===3&&typeof f[1]=="function"?C=f[1]:f.length>2&&S.push(...f.slice(1,f.length-1));let A=!1,j={},Z=t((ge,je)=>{A=!0,j[ge]=je},"a"),oe=!S.some(ge=>Yk(ge,this.input,Z))||C&&!C(this.input)?kke:{matched:!0,value:h(A?gse in j?j[gse]:j:this.input,this.input)};return new rU(this.input,oe)}when(f,h){if(this.state.matched)return this;let S=!!f(this.input);return new rU(this.input,S?{matched:!0,value:h(this.input,this.input)}:kke)}otherwise(f){return this.state.matched?this.state.value:f(this.input)}exhaustive(){if(this.state.matched)return this.state.value;throw new Cke(this.input)}run(){return this.exhaustive()}returnType(){return this}};t(rU,"I");var Eke=rU;function xf(l){return l!=null&&Object.prototype.hasOwnProperty.call(l,"$ref")}t(xf,"isReferenceObject");function _y(l){return!xf(l)}t(_y,"isSchemaObject");function yse(l){return l.type==="array"}t(yse,"isArraySchemaObject");function MZe(l){if(!l.allOf)throw new Error("Function inferRequiredSchema is specialized to handle item with required only in an allOf array.");let[f,h]=l.allOf.reduce((C,A)=>{if(eFt(A)){let j=A.required;C[0].push(...j??[])}else C[1].push(A);return C},[[],[]]),S={properties:f.reduce((C,A)=>(C[A]={},C),{}),type:"object",required:f};return{noRequiredOnlyAllof:h,composedRequiredSchema:S,patchRequiredSchemaInLoop:t((C,A)=>{if(xf(C)){let j=A(C.$ref);j&&S.required.forEach(Z=>{var oe;S.properties[Z]=((oe=j==null?void 0:j.properties)==null?void 0:oe[Z])??{}})}else{let j=C.properties??{};S.required.forEach(Z=>{j[Z]&&(S.properties[Z]=j[Z]??{})})}},"patchRequiredSchemaInLoop")}}t(MZe,"inferRequiredSchema");var eFt=t(l=>!xf(l)&&!!l.required&&!l.type&&!l.properties&&!(l!=null&&l.allOf)&&!(l!=null&&l.anyOf)&&!l.oneOf,"isBrokenAllOfItem");var LZe=t(l=>`#/components/schemas/${l}`,"getSchemaRef"),N8=t(l=>l[1]==="/"?l:"#/"+l.slice(1),"autocorrectRef"),_R=t(l=>N8(l).split("/").at(-1),"getSchemaNameByRef");function Dke(l){let f=tFt(l).normalize("NFKD").trim().replace(/\s+/g,"_").replace(/--+/g,"-").replace(/-+/g,"_").replace(/[^\w-]+/g,"_");return fy(f)}t(Dke,"normalizeString");function Ake(l){return/^[a-zA-Z]\w*$/.test(l)?l:`"${l}"`}t(Ake,"wrapWithQuotesIfNeeded");function jZe(l){return typeof l=="string"&&l.startsWith('"')&&l.endsWith('"')?l.slice(1,-1):l}t(jZe,"unwrapQuotesIfNeeded");function tFt(l){let f=Number(l[0]);return typeof f=="number"&&!Number.isNaN(f)?"_"+l:l}t(tFt,"prefixStringStartingWithNumberIfNeeded");function Ike(l){let f=l.replaceAll("_","#");return fy(f.replaceAll("-","_")).replaceAll("#","_")}t(Ike,"pathParamToVariableName");var O8=t(l=>SZe.includes(l),"isPrimitiveType");function BZe(l){return l.replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/([\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F-\u009F\uFFFE\uFFFF])/g,(f,h)=>{let S=h.codePointAt(),C=S.toString(16);return S<=255?`\\x${`00${C}`.slice(-2)}`:`\\u${`0000${C}`.slice(-4)}`}).replace(/\//g,"\\/")}t(BZe,"escapeControlCharacters");function Kk(l){return l.includes("application/")&&l.includes("json")||vZe.includes(l)||l.includes("text/")}t(Kk,"isParamMediaTypeAllowed");function iU(l){return l>=200&&l<300}t(iU,"isMainResponseStatus");function vse(l){return!(l>=200&&l<300)}t(vse,"isErrorStatus");function bse(l){return l.startsWith("application/")}t(bse,"isMediaTypeAllowed");var RZe=/({\w+})/g,rFt=/[^\w\-]+/g;function JZe(l){l=y_(YV(l.replaceAll("/","-")).replaceAll("-",""));let f=[...l.matchAll(RZe)];if(f.length>0){let h=f.toSorted((S,C)=>S.index-C.index)[f.length-1][0];l=`${l.replace(RZe,"")}By${y_(h.slice(1,-1))}`}return l.replace(rFt,"_")}t(JZe,"pathToVariableName");var wke=/{(\b\w+(?:-\w+)*\b)}/g;function $Ze(l){let f=l.match(wke);return f===null?l.replaceAll(wke,":$1"):(f.forEach(h=>{let S=Ike(h.replaceAll(wke,":$1"));l=l.replaceAll(h,S)}),l)}t($Ze,"replaceHyphenatedPath");var Sse=t(l=>{let f=l["x-enumNames"],h=Array.isArray(f)&&f.length>0,S=!!l.schema&&_y(l.schema)&&l.schema.type==="string";return h&&S},"isSortingParameterObject"),F8=t((l,f)=>f.excludePathRegex?new RegExp(f.excludePathRegex).test(l):!1,"isPathExcluded");function eE({schema:l,meta:f,options:h}){let S=[];l0(l.type).with("string",()=>S.push(sFt(l))).with("number","integer",()=>S.push(oFt(l))).with("array",()=>S.push(cFt(l))).otherwise(()=>{}),typeof l.description=="string"&&l.description!==""&&h.withDescription&&([`
|
|
568
|
+
`,"f"),xo(this,Dg,Zt(this,Dg,"f")+f.join(" "),"f")},"error")}}[ike](f){sR(Zt(this,Bo,"f")).forEach(h=>{if((C=>C==="configObjects")(h))return;let S=Zt(this,Bo,"f")[h];Array.isArray(S)?S.includes(f)&&S.splice(S.indexOf(f),1):typeof S=="object"&&delete S[f]}),delete Zt(this,il,"f").getDescriptions()[f]}[zQe](f,h,S){Zt(this,ese,"f")[S]||(Zt(this,Bc,"f").process.emitWarning(f,h),Zt(this,ese,"f")[S]=!0)}[VQe](){Zt(this,tse,"f").push({options:Zt(this,Bo,"f"),configObjects:Zt(this,Bo,"f").configObjects.slice(0),exitProcess:Zt(this,BS,"f"),groups:Zt(this,Hk,"f"),strict:Zt(this,x8,"f"),strictCommands:Zt(this,T8,"f"),strictOptions:Zt(this,C8,"f"),completionCommand:Zt(this,Qb,"f"),output:Zt(this,Dg,"f"),exitError:Zt(this,q6,"f"),hasOutput:Zt(this,Zb,"f"),parsed:this.parsed,parseFn:Zt(this,Xb,"f"),parseContext:Zt(this,b8,"f")}),Zt(this,il,"f").freeze(),Zt(this,sm,"f").freeze(),Zt(this,Om,"f").freeze(),Zt(this,JS,"f").freeze()}[UQe](){let f="",h;return/\b(node|iojs|electron)(\.exe)?$/.test(Zt(this,Bc,"f").process.argv()[0])?h=Zt(this,Bc,"f").process.argv().slice(1,2):h=Zt(this,Bc,"f").process.argv().slice(0,1),f=h.map(S=>{let C=this[iZe](Zt(this,y8,"f"),S);return S.match(/^(\/|([a-zA-Z]:)?\\)/)&&C.length<S.length?C:S}).join(" ").trim(),Zt(this,Bc,"f").getEnv("_")&&Zt(this,Bc,"f").getProcessArgvBin()===Zt(this,Bc,"f").getEnv("_")&&(f=Zt(this,Bc,"f").getEnv("_").replace(`${Zt(this,Bc,"f").path.dirname(Zt(this,Bc,"f").process.execPath())}/`,"")),f}[k8](){return Zt(this,ise,"f")}[WQe](){return Zt(this,ase,"f")}[ske](){if(!Zt(this,v8,"f"))return;let f=Zt(this,Bc,"f").getEnv("LC_ALL")||Zt(this,Bc,"f").getEnv("LC_MESSAGES")||Zt(this,Bc,"f").getEnv("LANG")||Zt(this,Bc,"f").getEnv("LANGUAGE")||"en_US";this.locale(f.replace(/[.:].*/,""))}[HQe](){return this[ake]().version||"unknown"}[GQe](f){let h=f["--"]?f["--"]:f._;for(let S=0,C;(C=h[S])!==void 0;S++)Zt(this,Bc,"f").Parser.looksLikeNumber(C)&&Number.isSafeInteger(Math.floor(parseFloat(`${C}`)))&&(h[S]=Number(C));return f}[ake](f){let h=f||"*";if(Zt(this,cR,"f")[h])return Zt(this,cR,"f")[h];let S={};try{let C=f||Zt(this,Bc,"f").mainFilename;!f&&Zt(this,Bc,"f").path.extname(C)&&(C=Zt(this,Bc,"f").path.dirname(C));let A=Zt(this,Bc,"f").findUp(C,(j,Z)=>{if(Z.includes("package.json"))return"package.json"});p1(A,void 0,Zt(this,Bc,"f")),S=JSON.parse(Zt(this,Bc,"f").readFileSync(A,"utf8"))}catch{}return Zt(this,cR,"f")[h]=S||{},Zt(this,cR,"f")[h]}[V6](f,h){h=[].concat(h),h.forEach(S=>{S=this[lke](S),Zt(this,Bo,"f")[f].push(S)})}[lR](f,h,S,C){this[cke](f,h,S,C,(A,j,Z)=>{Zt(this,Bo,"f")[A][j]=Z})}[oke](f,h,S,C){this[cke](f,h,S,C,(A,j,Z)=>{Zt(this,Bo,"f")[A][j]=(Zt(this,Bo,"f")[A][j]||[]).concat(Z)})}[cke](f,h,S,C,A){if(Array.isArray(S))S.forEach(j=>{f(j,C)});else if((j=>typeof j=="object")(S))for(let j of sR(S))f(j,S[j]);else A(h,this[lke](S),C)}[lke](f){return f==="__proto__"?"___proto___":f}[uke](f,h){return this[lR](this[uke].bind(this),"key",f,h),this}[fke](){var f,h,S,C,A,j,Z,oe,ge,je,Ae,_e;let Lt=Zt(this,tse,"f").pop();p1(Lt,void 0,Zt(this,Bc,"f"));let ot;f=this,h=this,S=this,C=this,A=this,j=this,Z=this,oe=this,ge=this,je=this,Ae=this,_e=this,{options:{set value(tt){xo(f,Bo,tt,"f")}}.value,configObjects:ot,exitProcess:{set value(tt){xo(h,BS,tt,"f")}}.value,groups:{set value(tt){xo(S,Hk,tt,"f")}}.value,output:{set value(tt){xo(C,Dg,tt,"f")}}.value,exitError:{set value(tt){xo(A,q6,tt,"f")}}.value,hasOutput:{set value(tt){xo(j,Zb,tt,"f")}}.value,parsed:this.parsed,strict:{set value(tt){xo(Z,x8,tt,"f")}}.value,strictCommands:{set value(tt){xo(oe,T8,tt,"f")}}.value,strictOptions:{set value(tt){xo(ge,C8,tt,"f")}}.value,completionCommand:{set value(tt){xo(je,Qb,tt,"f")}}.value,parseFn:{set value(tt){xo(Ae,Xb,tt,"f")}}.value,parseContext:{set value(tt){xo(_e,b8,tt,"f")}}.value}=Lt,Zt(this,Bo,"f").configObjects=ot,Zt(this,il,"f").unfreeze(),Zt(this,sm,"f").unfreeze(),Zt(this,Om,"f").unfreeze(),Zt(this,JS,"f").unfreeze()}[QQe](f,h){return g8(h,S=>(f(S),S))}getInternalMethods(){return{getCommandInstance:this[ZQe].bind(this),getContext:this[XQe].bind(this),getHasOutput:this[YQe].bind(this),getLoggerInstance:this[KQe].bind(this),getParseContext:this[eZe].bind(this),getParserConfiguration:this[k8].bind(this),getUsageConfiguration:this[WQe].bind(this),getUsageInstance:this[tZe].bind(this),getValidationInstance:this[rZe].bind(this),hasParseCallback:this[ose].bind(this),isGlobalContext:this[nZe].bind(this),postProcess:this[E8].bind(this),reset:this[_ke].bind(this),runValidation:this[pke].bind(this),runYargsParserAndExecuteCommands:this[QV].bind(this),setHasOutput:this[sZe].bind(this)}}[ZQe](){return Zt(this,Om,"f")}[XQe](){return Zt(this,GV,"f")}[YQe](){return Zt(this,Zb,"f")}[KQe](){return Zt(this,oR,"f")}[eZe](){return Zt(this,b8,"f")||{}}[tZe](){return Zt(this,il,"f")}[rZe](){return Zt(this,sm,"f")}[ose](){return!!Zt(this,Xb,"f")}[nZe](){return Zt(this,rse,"f")}[E8](f,h,S,C){return S||Wp(f)||(h||(f=this[$Qe](f)),(this[k8]()["parse-positional-numbers"]||this[k8]()["parse-positional-numbers"]===void 0)&&(f=this[GQe](f)),C&&(f=h8(f,this,Zt(this,JS,"f").getMiddleware(),!1))),f}[_ke](f={}){xo(this,Bo,Zt(this,Bo,"f")||{},"f");let h={};h.local=Zt(this,Bo,"f").local||[],h.configObjects=Zt(this,Bo,"f").configObjects||[];let S={};h.local.forEach(j=>{S[j]=!0,(f[j]||[]).forEach(Z=>{S[Z]=!0})}),Object.assign(Zt(this,S8,"f"),Object.keys(Zt(this,Hk,"f")).reduce((j,Z)=>{let oe=Zt(this,Hk,"f")[Z].filter(ge=>!(ge in S));return oe.length>0&&(j[Z]=oe),j},{})),xo(this,Hk,{},"f");let C=["array","boolean","string","skipValidation","count","normalize","number","hiddenOptions"],A=["narg","key","alias","default","defaultDescription","config","choices","demandedOptions","demandedCommands","deprecatedOptions"];return C.forEach(j=>{h[j]=(Zt(this,Bo,"f")[j]||[]).filter(Z=>!S[Z])}),A.forEach(j=>{h[j]=J6(Zt(this,Bo,"f")[j],Z=>!S[Z])}),h.envPrefix=Zt(this,Bo,"f").envPrefix,xo(this,Bo,h,"f"),xo(this,il,Zt(this,il,"f")?Zt(this,il,"f").reset(S):OQe(this,Zt(this,Bc,"f")),"f"),xo(this,sm,Zt(this,sm,"f")?Zt(this,sm,"f").reset(S):BQe(this,Zt(this,il,"f"),Zt(this,Bc,"f")),"f"),xo(this,Om,Zt(this,Om,"f")?Zt(this,Om,"f").reset():AQe(Zt(this,il,"f"),Zt(this,sm,"f"),Zt(this,JS,"f"),Zt(this,Bc,"f")),"f"),Zt(this,jS,"f")||xo(this,jS,RQe(this,Zt(this,il,"f"),Zt(this,Om,"f"),Zt(this,Bc,"f")),"f"),Zt(this,JS,"f").reset(),xo(this,Qb,null,"f"),xo(this,Dg,"","f"),xo(this,q6,null,"f"),xo(this,Zb,!1,"f"),this.parsed=!1,this}[iZe](f,h){return Zt(this,Bc,"f").path.relative(f,h)}[QV](f,h,S,C=0,A=!1){let j=!!S||A;f=f||Zt(this,z6,"f"),Zt(this,Bo,"f").__=Zt(this,Bc,"f").y18n.__,Zt(this,Bo,"f").configuration=this[k8]();let Z=!!Zt(this,Bo,"f").configuration["populate--"],oe=Object.assign({},Zt(this,Bo,"f").configuration,{"populate--":!0}),ge=Zt(this,Bc,"f").Parser.detailed(f,Object.assign({},Zt(this,Bo,"f"),{configuration:{"parse-positional-numbers":!1,...oe}})),je=Object.assign(ge.argv,Zt(this,b8,"f")),Ae,_e=ge.aliases,Lt=!1,ot=!1;Object.keys(je).forEach(tt=>{tt===Zt(this,$S,"f")&&je[tt]?Lt=!0:tt===Zt(this,Gk,"f")&&je[tt]&&(ot=!0)}),je.$0=this.$0,this.parsed=ge,C===0&&Zt(this,il,"f").clearCachedHelpMessage();try{if(this[ske](),h)return this[E8](je,Z,!!S,!1);Zt(this,$S,"f")&&[Zt(this,$S,"f")].concat(_e[Zt(this,$S,"f")]||[]).filter($i=>$i.length>1).includes(""+je._[je._.length-1])&&(je._.pop(),Lt=!0),xo(this,rse,!1,"f");let tt=Zt(this,Om,"f").getCommands(),Ht=Zt(this,jS,"f").completionKey in je,jr=Lt||Ht||A;if(je._.length){if(tt.length){let Gn;for(let $i=C||0,is;je._[$i]!==void 0;$i++)if(is=String(je._[$i]),tt.includes(is)&&is!==Zt(this,Qb,"f")){let xi=Zt(this,Om,"f").runCommand(is,this,ge,$i+1,A,Lt||ot||A);return this[E8](xi,Z,!!S,!1)}else if(!Gn&&is!==Zt(this,Qb,"f")){Gn=is;break}!Zt(this,Om,"f").hasDefaultCommand()&&Zt(this,sse,"f")&&Gn&&!jr&&Zt(this,sm,"f").recommendCommands(Gn,tt)}Zt(this,Qb,"f")&&je._.includes(Zt(this,Qb,"f"))&&!Ht&&(Zt(this,BS,"f")&&$6(!0),this.showCompletionScript(),this.exit(0))}if(Zt(this,Om,"f").hasDefaultCommand()&&!jr){let Gn=Zt(this,Om,"f").runCommand(null,this,ge,0,A,Lt||ot||A);return this[E8](Gn,Z,!!S,!1)}if(Ht){Zt(this,BS,"f")&&$6(!0),f=[].concat(f);let Gn=f.slice(f.indexOf(`--${Zt(this,jS,"f").completionKey}`)+1);return Zt(this,jS,"f").getCompletion(Gn,($i,is)=>{if($i)throw new Up($i.message);(is||[]).forEach(xi=>{Zt(this,oR,"f").log(xi)}),this.exit(0)}),this[E8](je,!Z,!!S,!1)}if(Zt(this,Zb,"f")||(Lt?(Zt(this,BS,"f")&&$6(!0),j=!0,this.showHelp("log"),this.exit(0)):ot&&(Zt(this,BS,"f")&&$6(!0),j=!0,Zt(this,il,"f").showVersion("log"),this.exit(0))),!j&&Zt(this,Bo,"f").skipValidation.length>0&&(j=Object.keys(je).some(Gn=>Zt(this,Bo,"f").skipValidation.indexOf(Gn)>=0&&je[Gn]===!0)),!j){if(ge.error)throw new Up(ge.error.message);if(!Ht){let Gn=this[pke](_e,{},ge.error);S||(Ae=h8(je,this,Zt(this,JS,"f").getMiddleware(),!0)),Ae=this[QQe](Gn,Ae??je),Wp(Ae)&&!S&&(Ae=Ae.then(()=>h8(je,this,Zt(this,JS,"f").getMiddleware(),!1)))}}}catch(tt){if(tt instanceof Up)Zt(this,il,"f").fail(tt.message,tt);else throw tt}return this[E8](Ae??je,Z,!!S,!0)}[pke](f,h,S,C){let A={...this.getDemandedOptions()};return j=>{if(S)throw new Up(S.message);Zt(this,sm,"f").nonOptionCount(j),Zt(this,sm,"f").requiredArguments(j,A);let Z=!1;Zt(this,T8,"f")&&(Z=Zt(this,sm,"f").unknownCommands(j)),Zt(this,x8,"f")&&!Z?Zt(this,sm,"f").unknownArguments(j,f,h,!!C):Zt(this,C8,"f")&&Zt(this,sm,"f").unknownArguments(j,f,{},!1,!1),Zt(this,sm,"f").limitedChoices(j),Zt(this,sm,"f").implications(j),Zt(this,sm,"f").conflicting(j)}}[sZe](){xo(this,Zb,!0,"f")}[P8](f){if(typeof f=="string")Zt(this,Bo,"f").key[f]=!0;else for(let h of f)Zt(this,Bo,"f").key[h]=!0}};t(mke,"YargsInstance");var dke=mke;function IQe(l){return!!l&&typeof l.getInternalMethods=="function"}t(IQe,"isYargsInstance");var V5t=aZe(GCe),oZe=V5t;var ZV=require("util");function hke(l){console.log(l)}t(hke,"log");function qS(l){console.log(`[INFO] ${l}`)}t(qS,"logInfo");function XV(l){console.log((0,ZV.styleText)("green",`[SUCCESS] ${l}`))}t(XV,"logSuccess");function w8(l,f){l instanceof Error?console.log((0,ZV.styleText)("red",`[ERROR] ${f||l.message}`)):console.log((0,ZV.styleText)("red",`[ERROR] ${l}`))}t(w8,"logError");function cse(l){console.log((0,ZV.styleText)("bgYellow",`==== ${l} ====`))}t(cse,"logBanner");var cZe=Lh(require("fs"));function uR(){return"2.0.3"}t(uR,"getVersion");var VXt=Lh(uZe());var gke=Symbol("options_key");function Gu(l){return(f,h)=>{var S,C;if(l!=null){let A={...Reflect.getMetadata(gke,f),[h]:{...l,describe:l.envAlias?`${l.describe||""} [${l.envAlias}]`:l.describe,type:l.type||((C=(S=Reflect.getMetadata("design:type",f,h))==null?void 0:S.name)==null?void 0:C.toLowerCase())}};Reflect.defineMetadata(gke,A,f)}}}t(Gu,"YargOption");function fZe(l){let f=Reflect.getMetadata(gke,l.prototype);if(!f)throw new Error(`Options for ${l.name} were not defined`);return f}t(fZe,"getYargsOption");function lse(l){return async f=>f.options(U5t(l)).middleware(async h=>await W5t(l,h),!0)}t(lse,"getBuilder");function U5t(l){return Object.entries(fZe(l)).reduce((f,[h,S])=>(f[h]=Object.fromEntries(Object.entries(S).filter(([C])=>!["envAlias","default"].includes(C))),f),{})}t(U5t,"getYargsOptions");async function W5t(l,f){let h=new l;for(let[S,C]of Object.entries(fZe(l)))h[S]=f[S]??C.default;return h}t(W5t,"loadYargsConfig");var eEe=require("util");var _Ze={100:"Continue",101:"Switching Protocols",102:"Processing",103:"Early Hints",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",300:"Ambiguous",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Requested Range Not Satisfiable",417:"Expectation Failed",418:"I Am a Teapot",421:"Misdirected Request",422:"Unprocessable Entity",424:"Failed Dependency",428:"Precondition Required",429:"Too Many Requests",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported"},pZe={"invalid-schema":"Invalid OpenAPI Schemas","invalid-operation-id":"Invalid Operation IDs","missing-path-parameter":"Missing Path Parameters","not-allowed-inline-enum":"Not Allowed Inline Enums","not-allowed-circular-schema":"Not Allowed Circular Schemas","missing-acl-condition-property":"Missing x-acl Condition Properties","missing-status-code":"Missing HTTP Status Codes","invalid-status-code":"Invalid HTTP Status Codes","multiple-success-status-codes":"Multiple Success HTTP Status Codes"};var y_=t(l=>l.charAt(0).toUpperCase()+l.slice(1),"capitalize"),U6=t(l=>l.charAt(0).toLowerCase()+l.slice(1),"decapitalize"),YV=t(l=>l.replace(/(-\w)/g,f=>f[1].toUpperCase()),"kebabToCamel"),fy=t(l=>l.replace(/(_\w)/g,f=>f[1].toUpperCase()),"snakeToCamel"),dZe=t(l=>l.replace(/[\W_]+(\w)?/g,(f,h)=>(h==null?void 0:h.toUpperCase())??""),"nonWordCharactersToCamel"),yke=t((l,f="")=>l.endsWith(f)?l:`${l}${f}`,"suffixIfNeeded"),mZe=t((l,f)=>l.replace(new RegExp(`${f}$`),""),"removeSuffix"),H5t=t(l=>{var S;let f=l.reduce((C,A)=>({...C,[A]:(C[A]??0)+1}),{});return(S=Object.entries(f).toSorted((C,A)=>C[1]===A[1]?A[0].length-C[0].length:A[1]-C[1])[0])==null?void 0:S[0]},"getLongestMostCommon"),vke=t(l=>{let f=l.flatMap(h=>G5t(hZe(y_(h))));return H5t(f)},"getMostCommonAdjacentCombinationSplit"),hZe=t(l=>l.split(/(?<![A-Z])(?=[A-Z])/).filter(Boolean),"splitByUppercase"),use=t(l=>hZe(l).join(" "),"camelToSpaceSeparated"),G5t=t((l,f=["dto","by","for","of","in","to","and","with"])=>{var S;let h=[];for(let C=0;C<l.length;C++)if(!f.includes(l[C].toLowerCase()))for(let A=C+1;A<=l.length;A++)f.includes((S=l[A-1])==null?void 0:S.toLowerCase())||h.push(l.slice(C,A).join(""));return h},"getAdjacentStringCombinations"),gZe=t((l,f)=>{let h=f.replace(/es$|s$/g,""),S=new RegExp(`(${U6(h)}|${y_(h)})[a-z]*(?=$|[A-Z])`,"g");return l.replace(S,"")},"removeWord");function D8(l){return dZe(l)}t(D8,"formatTag");function W6(l,f){var S;let h=(S=l.tags)==null?void 0:S[0];return D8(h??f.defaultTag)}t(W6,"getOperationTag");function yv(l,f){var S;let h=f.splitByTags?(S=l.tags)==null?void 0:S[0]:f.defaultTag;return D8(h??f.defaultTag)}t(yv,"getEndpointTag");function yZe(l,f){return f.excludeTags.some(h=>h.toLowerCase()===l.toLowerCase())}t(yZe,"isTagExcluded");var A8="application/json",bke={"Content-Type":A8,Accept:A8},fse="data",Ske="axios",H6="config",Qk="AxiosRequestConfig",_se={defaultImport:Ske,bindings:[Qk],from:"axios"};var $w=Lh(pse()),xke=2,vZe=["application/octet-stream","multipart/form-data","application/x-www-form-urlencoded","*/*"],bZe=["query","header","path"],I8=[$w.OpenAPIV3.HttpMethods.GET,$w.OpenAPIV3.HttpMethods.PUT,$w.OpenAPIV3.HttpMethods.POST,$w.OpenAPIV3.HttpMethods.DELETE,$w.OpenAPIV3.HttpMethods.OPTIONS,$w.OpenAPIV3.HttpMethods.HEAD,$w.OpenAPIV3.HttpMethods.PATCH,$w.OpenAPIV3.HttpMethods.TRACE],SZe=["string","number","integer","boolean"],KV=["allOf","anyOf","oneOf"];var xZe="Schema",TZe="Enum",CZe="Body",kZe="Param",EZe="Response",PZe="ErrorResponse",eU="z.void()",fR="z.any()",dse="z.instanceof(Blob)",tU="z.enum",wZe="z.int()",DZe="z.number()",mse="z.string()",AZe="z.email()",IZe="z.url()",NZe="z.uuid()",OZe="z.iso.datetime({ offset: true })",Q6={bindings:["z"],from:"zod"};var qw=Symbol.for("@ts-pattern/matcher"),X5t=Symbol.for("@ts-pattern/isVariadic"),gse="@ts-pattern/anonymous-select-key",Tke=t(l=>!!(l&&typeof l=="object"),"r"),hse=t(l=>l&&!!l[qw],"i"),Yk=t((l,f,h)=>{if(hse(l)){let S=l[qw](),{matched:C,selections:A}=S.match(f);return C&&A&&Object.keys(A).forEach(j=>h(j,A[j])),C}if(Tke(l)){if(!Tke(f))return!1;if(Array.isArray(l)){if(!Array.isArray(f))return!1;let S=[],C=[],A=[];for(let j of l.keys()){let Z=l[j];hse(Z)&&Z[X5t]?A.push(Z):A.length?C.push(Z):S.push(Z)}if(A.length){if(A.length>1)throw new Error("Pattern error: Using `...P.array(...)` several times in a single pattern is not allowed.");if(f.length<S.length+C.length)return!1;let j=f.slice(0,S.length),Z=C.length===0?[]:f.slice(-C.length),oe=f.slice(S.length,C.length===0?1/0:-C.length);return S.every((ge,je)=>Yk(ge,j[je],h))&&C.every((ge,je)=>Yk(ge,Z[je],h))&&(A.length===0||Yk(A[0],oe,h))}return l.length===f.length&&l.every((j,Z)=>Yk(j,f[Z],h))}return Reflect.ownKeys(l).every(S=>{let C=l[S];return(S in f||hse(A=C)&&A[qw]().matcherType==="optional")&&Yk(C,f[S],h);var A})}return Object.is(f,l)},"s"),e4=t(l=>{var f,h,S;return Tke(l)?hse(l)?(f=(h=(S=l[qw]()).getSelectionKeys)==null?void 0:h.call(S))!=null?f:[]:Array.isArray(l)?nU(l,e4):nU(Object.values(l),e4):[]},"o"),nU=t((l,f)=>l.reduce((h,S)=>h.concat(f(S)),[]),"c");function zS(l){return Object.assign(l,{optional:t(()=>Y5t(l),"optional"),and:t(f=>id(l,f),"and"),or:t(f=>K5t(l,f),"or"),select:t(f=>f===void 0?FZe(l):FZe(f,l),"select")})}t(zS,"u");function Y5t(l){return zS({[qw]:()=>({match:t(f=>{let h={},S=t((C,A)=>{h[C]=A},"r");return f===void 0?(e4(l).forEach(C=>S(C,void 0)),{matched:!0,selections:h}):{matched:Yk(l,f,S),selections:h}},"match"),getSelectionKeys:t(()=>e4(l),"getSelectionKeys"),matcherType:"optional"})})}t(Y5t,"h");function id(...l){return zS({[qw]:()=>({match:t(f=>{let h={},S=t((C,A)=>{h[C]=A},"r");return{matched:l.every(C=>Yk(C,f,S)),selections:h}},"match"),getSelectionKeys:t(()=>nU(l,e4),"getSelectionKeys"),matcherType:"and"})})}t(id,"m");function K5t(...l){return zS({[qw]:()=>({match:t(f=>{let h={},S=t((C,A)=>{h[C]=A},"r");return nU(l,e4).forEach(C=>S(C,void 0)),{matched:l.some(C=>Yk(C,f,S)),selections:h}},"match"),getSelectionKeys:t(()=>nU(l,e4),"getSelectionKeys"),matcherType:"or"})})}t(K5t,"d");function Lf(l){return{[qw]:()=>({match:t(f=>({matched:!!l(f)}),"match")})}}t(Lf,"p");function FZe(...l){let f=typeof l[0]=="string"?l[0]:void 0,h=l.length===2?l[1]:typeof l[0]=="string"?void 0:l[0];return zS({[qw]:()=>({match:t(S=>{let C={[f??gse]:S};return{matched:h===void 0||Yk(h,S,(A,j)=>{C[A]=j}),selections:C}},"match"),getSelectionKeys:t(()=>[f??gse].concat(h===void 0?[]:e4(h)),"getSelectionKeys")})})}t(FZe,"y");function Zk(l){return typeof l=="number"}t(Zk,"v");function Z6(l){return typeof l=="string"}t(Z6,"b");function X6(l){return typeof l=="bigint"}t(X6,"w");var nYt=zS(Lf(function(l){return!0}));var Y6=t(l=>Object.assign(zS(l),{startsWith:t(f=>{return Y6(id(l,(h=f,Lf(S=>Z6(S)&&S.startsWith(h)))));var h},"startsWith"),endsWith:t(f=>{return Y6(id(l,(h=f,Lf(S=>Z6(S)&&S.endsWith(h)))));var h},"endsWith"),minLength:t(f=>Y6(id(l,(h=>Lf(S=>Z6(S)&&S.length>=h))(f))),"minLength"),length:t(f=>Y6(id(l,(h=>Lf(S=>Z6(S)&&S.length===h))(f))),"length"),maxLength:t(f=>Y6(id(l,(h=>Lf(S=>Z6(S)&&S.length<=h))(f))),"maxLength"),includes:t(f=>{return Y6(id(l,(h=f,Lf(S=>Z6(S)&&S.includes(h)))));var h},"includes"),regex:t(f=>{return Y6(id(l,(h=f,Lf(S=>Z6(S)&&!!S.match(h)))));var h},"regex")}),"j"),iYt=Y6(Lf(Z6)),Xk=t(l=>Object.assign(zS(l),{between:t((f,h)=>Xk(id(l,((S,C)=>Lf(A=>Zk(A)&&S<=A&&C>=A))(f,h))),"between"),lt:t(f=>Xk(id(l,(h=>Lf(S=>Zk(S)&&S<h))(f))),"lt"),gt:t(f=>Xk(id(l,(h=>Lf(S=>Zk(S)&&S>h))(f))),"gt"),lte:t(f=>Xk(id(l,(h=>Lf(S=>Zk(S)&&S<=h))(f))),"lte"),gte:t(f=>Xk(id(l,(h=>Lf(S=>Zk(S)&&S>=h))(f))),"gte"),int:t(()=>Xk(id(l,Lf(f=>Zk(f)&&Number.isInteger(f)))),"int"),finite:t(()=>Xk(id(l,Lf(f=>Zk(f)&&Number.isFinite(f)))),"finite"),positive:t(()=>Xk(id(l,Lf(f=>Zk(f)&&f>0))),"positive"),negative:t(()=>Xk(id(l,Lf(f=>Zk(f)&&f<0))),"negative")}),"x"),sYt=Xk(Lf(Zk)),K6=t(l=>Object.assign(zS(l),{between:t((f,h)=>K6(id(l,((S,C)=>Lf(A=>X6(A)&&S<=A&&C>=A))(f,h))),"between"),lt:t(f=>K6(id(l,(h=>Lf(S=>X6(S)&&S<h))(f))),"lt"),gt:t(f=>K6(id(l,(h=>Lf(S=>X6(S)&&S>h))(f))),"gt"),lte:t(f=>K6(id(l,(h=>Lf(S=>X6(S)&&S<=h))(f))),"lte"),gte:t(f=>K6(id(l,(h=>Lf(S=>X6(S)&&S>=h))(f))),"gte"),positive:t(()=>K6(id(l,Lf(f=>X6(f)&&f>0))),"positive"),negative:t(()=>K6(id(l,Lf(f=>X6(f)&&f<0))),"negative")}),"A"),aYt=K6(Lf(X6)),oYt=zS(Lf(function(l){return typeof l=="boolean"})),cYt=zS(Lf(function(l){return typeof l=="symbol"})),lYt=zS(Lf(function(l){return l==null})),uYt=zS(Lf(function(l){return l!=null}));var Pke=class Pke extends Error{constructor(f){let h;try{h=JSON.stringify(f)}catch{h=f}super(`Pattern matching error: no pattern matches value ${h}`),this.input=void 0,this.input=f}};t(Pke,"W");var Cke=Pke,kke={matched:!1,value:void 0};function l0(l){return new Eke(l,kke)}t(l0,"z");var rU=class rU{constructor(f,h){this.input=void 0,this.state=void 0,this.input=f,this.state=h}with(...f){if(this.state.matched)return this;let h=f[f.length-1],S=[f[0]],C;f.length===3&&typeof f[1]=="function"?C=f[1]:f.length>2&&S.push(...f.slice(1,f.length-1));let A=!1,j={},Z=t((ge,je)=>{A=!0,j[ge]=je},"a"),oe=!S.some(ge=>Yk(ge,this.input,Z))||C&&!C(this.input)?kke:{matched:!0,value:h(A?gse in j?j[gse]:j:this.input,this.input)};return new rU(this.input,oe)}when(f,h){if(this.state.matched)return this;let S=!!f(this.input);return new rU(this.input,S?{matched:!0,value:h(this.input,this.input)}:kke)}otherwise(f){return this.state.matched?this.state.value:f(this.input)}exhaustive(){if(this.state.matched)return this.state.value;throw new Cke(this.input)}run(){return this.exhaustive()}returnType(){return this}};t(rU,"I");var Eke=rU;function xf(l){return l!=null&&Object.prototype.hasOwnProperty.call(l,"$ref")}t(xf,"isReferenceObject");function _y(l){return!xf(l)}t(_y,"isSchemaObject");function yse(l){return l.type==="array"}t(yse,"isArraySchemaObject");function MZe(l){if(!l.allOf)throw new Error("Function inferRequiredSchema is specialized to handle item with required only in an allOf array.");let[f,h]=l.allOf.reduce((C,A)=>{if(eFt(A)){let j=A.required;C[0].push(...j??[])}else C[1].push(A);return C},[[],[]]),S={properties:f.reduce((C,A)=>(C[A]={},C),{}),type:"object",required:f};return{noRequiredOnlyAllof:h,composedRequiredSchema:S,patchRequiredSchemaInLoop:t((C,A)=>{if(xf(C)){let j=A(C.$ref);j&&S.required.forEach(Z=>{var oe;S.properties[Z]=((oe=j==null?void 0:j.properties)==null?void 0:oe[Z])??{}})}else{let j=C.properties??{};S.required.forEach(Z=>{j[Z]&&(S.properties[Z]=j[Z]??{})})}},"patchRequiredSchemaInLoop")}}t(MZe,"inferRequiredSchema");var eFt=t(l=>!xf(l)&&!!l.required&&!l.type&&!l.properties&&!(l!=null&&l.allOf)&&!(l!=null&&l.anyOf)&&!l.oneOf,"isBrokenAllOfItem");var LZe=t(l=>`#/components/schemas/${l}`,"getSchemaRef"),N8=t(l=>l[1]==="/"?l:"#/"+l.slice(1),"autocorrectRef"),_R=t(l=>N8(l).split("/").at(-1),"getSchemaNameByRef");function Dke(l){let f=tFt(l).normalize("NFKD").trim().replace(/\s+/g,"_").replace(/--+/g,"-").replace(/-+/g,"_").replace(/[^\w-]+/g,"_");return fy(f)}t(Dke,"normalizeString");function Ake(l){return/^[a-zA-Z]\w*$/.test(l)?l:`"${l}"`}t(Ake,"wrapWithQuotesIfNeeded");function jZe(l){return typeof l=="string"&&l.startsWith('"')&&l.endsWith('"')?l.slice(1,-1):l}t(jZe,"unwrapQuotesIfNeeded");function tFt(l){let f=Number(l[0]);return typeof f=="number"&&!Number.isNaN(f)?"_"+l:l}t(tFt,"prefixStringStartingWithNumberIfNeeded");function Ike(l){let f=l.replaceAll("_","#");return fy(f.replaceAll("-","_")).replaceAll("#","_")}t(Ike,"pathParamToVariableName");var O8=t(l=>SZe.includes(l),"isPrimitiveType");function BZe(l){return l.replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/([\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F-\u009F\uFFFE\uFFFF])/g,(f,h)=>{let S=h.codePointAt(),C=S.toString(16);return S<=255?`\\x${`00${C}`.slice(-2)}`:`\\u${`0000${C}`.slice(-4)}`}).replace(/\//g,"\\/")}t(BZe,"escapeControlCharacters");function Kk(l){return l.includes("application/")&&l.includes("json")||vZe.includes(l)||l.includes("text/")}t(Kk,"isParamMediaTypeAllowed");function iU(l){return l>=200&&l<300}t(iU,"isMainResponseStatus");function vse(l){return!(l>=200&&l<300)}t(vse,"isErrorStatus");function bse(l){return l.startsWith("application/")}t(bse,"isMediaTypeAllowed");var RZe=/({\w+})/g,rFt=/[^\w\-]+/g;function JZe(l){l=y_(YV(l.replaceAll("/","-")).replaceAll("-",""));let f=[...l.matchAll(RZe)];if(f.length>0){let h=f.toSorted((S,C)=>S.index-C.index)[f.length-1][0];l=`${l.replace(RZe,"")}By${y_(h.slice(1,-1))}`}return l.replace(rFt,"_")}t(JZe,"pathToVariableName");var wke=/{(\b\w+(?:-\w+)*\b)}/g;function $Ze(l){let f=l.match(wke);return f===null?l.replaceAll(wke,":$1"):(f.forEach(h=>{let S=Ike(h.replaceAll(wke,":$1"));l=l.replaceAll(h,S)}),l)}t($Ze,"replaceHyphenatedPath");var Sse=t(l=>{let f=l["x-enumNames"],h=Array.isArray(f)&&f.length>0,S=!!l.schema&&_y(l.schema)&&l.schema.type==="string";return h&&S},"isSortingParameterObject"),F8=t((l,f)=>f.excludePathRegex?new RegExp(f.excludePathRegex).test(l):!1,"isPathExcluded");function eE({schema:l,meta:f,options:h}){let S=[];l0(l.type).with("string",()=>S.push(sFt(l))).with("number","integer",()=>S.push(oFt(l))).with("array",()=>S.push(cFt(l))).otherwise(()=>{}),typeof l.description=="string"&&l.description!==""&&h.withDescription&&([`
|
|
569
569
|
`,"\r",`\r
|
|
570
570
|
`].some(A=>String.prototype.includes.call(l.description,A))?S.push(`describe(\`${l.description}\`)`):S.push(`describe("${l.description}")`));let C=S.concat(nFt({schema:l,meta:f,options:h}),h.withDefaultValues!==!1?iFt(l):[]).filter(Boolean).join(".");return C?`.${C}`:""}t(eE,"getZodChain");function nFt({schema:l,meta:f,options:h}){return l.nullable&&!(f!=null&&f.isRequired)?"nullish()":l.nullable||h.replaceOptionalWithNullish&&(f!=null&&f.isParentPartial)?"nullable()":f!=null&&f.isRequired?"":h.replaceOptionalWithNullish?"nullish()":"optional()"}t(nFt,"getZodChainablePresence");function iFt(l){return l.default!==void 0?`default(${l0(l.type).with("number","integer",()=>jZe(l.default)).otherwise(()=>JSON.stringify(l.default))})`:""}t(iFt,"getZodChainableDefault");function sFt(l){let f=[];return l.enum||(l.minLength!==void 0&&f.push(`min(${l.minLength})`),l.maxLength!==void 0&&f.push(`max(${l.maxLength})`)),l.pattern&&f.push(`regex(${aFt(l.pattern)})`),f.join(".")}t(sFt,"getZodChainableStringValidations");function aFt(l){return l.startsWith("/")&&l.endsWith("/")&&(l=l.slice(1,-1)),l=BZe(l),`/${l}/`}t(aFt,"formatPatternIfNeeded");function oFt(l){let f=[];return l.enum?"":(l.minimum!==void 0?l.exclusiveMinimum===!0?f.push(`gt(${l.minimum})`):f.push(`gte(${l.minimum})`):typeof l.exclusiveMinimum=="number"&&f.push(`gt(${l.exclusiveMinimum})`),l.maximum!==void 0?l.exclusiveMaximum===!0?f.push(`lt(${l.maximum})`):f.push(`lte(${l.maximum})`):typeof l.exclusiveMaximum=="number"&&f.push(`lt(${l.exclusiveMaximum})`),l.multipleOf&&f.push(`multipleOf(${l.multipleOf})`),f.join("."))}t(oFt,"getZodChainableNumberValidations");function cFt(l){let f=[];return l.minItems&&f.push(`min(${l.minItems})`),l.maxItems&&f.push(`max(${l.maxItems})`),f.join(".")}t(cFt,"getZodChainableArrayValidations");var R_=t(({type:l,tag:f,options:h})=>`${y_(f)}${h.configs[l].namespaceSuffix}`,"getNamespaceName");function qZe(l,f){let h=l.getRefByZodSchemaName(f);if(h){let C=Array.from(l.dependencyGraph.refsDependencyGraph[h]??[]).map(j=>l.getZodSchemaNameByRef(j)),A=l.getExtractedEnumZodSchemaNamesReferencedBySchemaRef(h);return[...C,...A]}let S=l.getCompositeZodSchemaByZodSchemaName(f);return S?Array.from(xse(S)).map(C=>l.getZodSchemaNameByRef(C)):[]}t(qZe,"getZodSchemaRefs");function xse(l,{skipObjectSchema:f=!1}={}){return l.children.reduce((S,C)=>{let A=C.ref??C.enumRef;return A&&S.add(A),C.children.length>0&&(!f||!_y(C.schema)||C.schema.type!=="object")&&xse(C).forEach(j=>S.add(j)),S},new Set)}t(xse,"getSchemaRefs");var M8=t(l=>l.reduce((f,h)=>f+h,0),"sum");function Ag(l,f){if(!f)return l;if(xf(f))return l+2;if(Array.isArray(f.type))return f.type.length===1?Yb("oneOf")+Ag(l,{...f,type:f.type[0]}):l+Yb("oneOf")+M8(f.type.map(h=>Ag(0,{...f,type:h})));if(f.oneOf)return f.oneOf.length===1?Yb("oneOf")+Ag(l,f.oneOf[0]):l+Yb("oneOf")+M8(f.oneOf.map(h=>Ag(0,h)));if(f.anyOf)return f.anyOf.length===1?Yb("anyOf")+Ag(l,f.anyOf[0]):l+Yb("anyOf")+M8(f.anyOf.map(h=>Ag(0,h)));if(f.allOf)return f.allOf.length===1?Yb("allOf")+Ag(l,f.allOf[0]):l+Yb("allOf")+M8(f.allOf.map(h=>Ag(0,h)));if(!f.type)return l;if(O8(f.type))return f.enum?l+zZe(f)+Yb("enum")+M8(f.enum.map(h=>Ag(0,h))):l+zZe(f);if(f.type==="array")return f.items?Yb("array")+Ag(l,f.items):Yb("array")+Ag(l);if(f.type==="object"||f.properties||f.additionalProperties){if(f.properties){let h=Object.values(f.properties);l+=Yb("object")+M8(h.map(S=>Ag(0,S)))}else l+=Yb("empty-object");f.additionalProperties&&(typeof f.additionalProperties=="object"?l+=Ag(0,f.additionalProperties):l+=Ag(1))}return l}t(Ag,"getOpenAPISchemaComplexity");function zZe(l){return l0(l.type).with("string","number","integer","boolean",()=>1).otherwise(()=>0)}t(zZe,"complexityByType");function Yb(l){return l0(l).with("oneOf",()=>2).with("anyOf",()=>3).with("allOf",()=>2).with("enum","array","empty-object",()=>1).with("object",()=>2).otherwise(()=>0)}t(Yb,"complexityByComposite");var Oke=class Oke{constructor(f,h,S={referencedBy:[]},C){this.schema=f;this.resolver=h;xf(f)&&(this.ref=f.$ref),C&&(this.enumRef=C),this.meta={...S,referencedBy:[...(S==null?void 0:S.referencedBy)??[]]},this.ref&&this.meta.referencedBy.push(this)}code;ref;enumRef;children=[];meta;getCodeString(f,h){var A,j;if(!this.ref&&this.code)return this.code;if(!this.ref)throw new Error("Zod schema is missing both ref and code");let S=(A=this.resolver)==null?void 0:A.getZodSchemaNameByRef(this.ref);if(!S)return this.ref;let C=(j=this.resolver)==null?void 0:j.getTagByZodSchemaName(S);return h!=null&&h.tsNamespaces&&C&&C!==f?`${R_({type:"models",tag:C,options:h})}.${S}`:S}get complexity(){return Ag(0,this.schema)}assign(f){return this.code=f,this}inherit(f){return f&&f.children.push(this),this}};t(Oke,"ZodSchema");var sU=Oke;function Nke(l){var f,h;if(l)return(f=l.parent)!=null&&f.ref?l.parent.ref:Nke((h=l.parent)==null?void 0:h.meta)}t(Nke,"getParentRef");function am({schema:l,resolver:f,meta:h,tag:S}){var ot;let C=new sU(l,f,h),A={parent:C.inherit(h==null?void 0:h.parent),referencedBy:[...C.meta.referencedBy]},j={resolver:f,meta:A,tag:S};if(xf(l))return lFt({schema:l,zodSchema:C,resolver:f,meta:A,tag:S});let Z=fFt({schema:l,zodSchema:C,resolver:f,meta:A,tag:S});if(Z)return Z;let oe=uFt({schema:l,zodSchema:C,resolver:f,meta:A,tag:S});if(oe)return oe;let ge=_Ft({schema:l,zodSchema:C,resolver:f,meta:A,tag:S});if(ge)return ge;let je=pFt({schema:l,zodSchema:C,resolver:f,meta:A,tag:S});if(je)return je;let Ae=dFt({schema:l,zodSchema:C,resolver:f,meta:A,tag:S});if(Ae)return Ae;let _e=f.options.allReadonly?".readonly()":"";if(yse(l))return l.items?C.assign(`z.array(${am({...j,schema:l.items}).getCodeString(S,f.options)}${eE({schema:l.items,meta:{...A,isRequired:!0},options:f.options})})${_e}`):C.assign(`z.array(${fR})${_e}`);let Lt=l.type?l.type.toLowerCase():void 0;if(Lt==="object"||l.properties||l.additionalProperties){let tt=l.required&&l.required.length>0,Ht=f.options.withImplicitRequiredProps?!1:l.properties&&!((ot=l.required)!=null&&ot.length),jr="{}";l.properties&&(jr=`{ ${Object.entries(l.properties).map(([Nn,Wr])=>{var zr;let dl={...A,isRequired:Ht?!0:tt?(zr=l.required)==null?void 0:zr.includes(Nn):f.options.withImplicitRequiredProps,name:Nn,isParentPartial:Ht},pa=Wr;if(xf(Wr)&&f&&(pa=f.getSchemaByRef(Wr.$ref),!pa))throw new Error(`Schema ${Wr.$ref} not found`);let Fa=am({...j,schema:Wr,meta:dl}),Xr=Fa.getCodeString(S,f.options)+eE({schema:pa,meta:dl,options:f.options}),Ps=!1,Us=Nke(h);return Us&&(Ps=[...xf(Wr)?[Wr.$ref]:[],...xse(Fa,{skipObjectSchema:!0})].some($o=>{var gr;return(gr=f.dependencyGraph.deepDependencyGraph[$o])==null?void 0:gr.has(Us)})),[Nn,Xr,Ps]}).map(([Nn,Wr,dl])=>dl?`get ${Ake(Nn)}() { return ${Wr} }`:`${Ake(Nn)}: ${Wr}`).join(", ")} }`);let Gn="";l.additionalProperties&&(Gn=`.catchall(${typeof l.additionalProperties=="object"&&Object.keys(l.additionalProperties).length>0?am({...j,schema:l.additionalProperties}).getCodeString(S,f.options)+eE({schema:l.additionalProperties,meta:{...A,isRequired:!0},options:f.options}):fR})`);let is=`z.object(${jr})${Ht?".partial()":""}${Gn}${_e}`;return C.assign(is)}if(Lt==="any")return C.assign(fR);if(!Lt)return C.assign("z.unknown()");throw new Error(`Unsupported schema type: ${Lt}`)}t(am,"getZodSchema");function lFt({schema:l,zodSchema:f,resolver:h,meta:S,tag:C}){if(!xf(l))return;let A=f.meta.referencedBy.slice(0,-1).map(oe=>oe.ref?h.getZodSchemaNameByRef(oe.ref)??oe.ref:void 0).filter(Boolean),j=h.getZodSchemaNameByRef(l.$ref);if(A.length>1&&A.includes(j))return f.assign(h.getCodeByZodSchemaName(f.ref));let Z=h.getCodeByZodSchemaName(l.$ref);if(!Z){let oe=h.getSchemaByRef(l.$ref);if(!oe)throw new Error(`Schema ${l.$ref} not found`);Z=am({schema:oe,resolver:h,meta:S,tag:C}).getCodeString(C,h.options)}return h.getCodeByZodSchemaName(j)||h.setZodSchema(j,Z,C),f}t(lFt,"getReferenceZodSchema");function uFt({schema:l,zodSchema:f,resolver:h,meta:S,tag:C}){var j;if(!_y(l)||!l.oneOf)return;if(l.oneOf.length===1){let Z=am({schema:l.oneOf[0],resolver:h,meta:S,tag:C});return f.assign(Z.getCodeString(C,h.options))}let A=(j=l.oneOf)==null?void 0:j.some(Z=>_y(Z)&&((Z==null?void 0:Z.allOf)||[]).length>1);if(l.discriminator&&!A){let Z=l.discriminator.propertyName;return f.assign(`
|
|
571
571
|
z.discriminatedUnion("${Z}", [${l.oneOf.map(oe=>am({schema:oe,resolver:h,meta:S,tag:C}).getCodeString(C,h.options)).join(", ")}])
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@povio/openapi-codegen-cli",
|
|
3
|
-
"version": "2.0.3
|
|
3
|
+
"version": "2.0.3",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"codegen",
|
|
6
6
|
"openapi",
|
|
@@ -24,13 +24,13 @@
|
|
|
24
24
|
"src/assets/**",
|
|
25
25
|
"src/generators/templates/**"
|
|
26
26
|
],
|
|
27
|
-
"main": "./dist/index.
|
|
27
|
+
"main": "./dist/index.mjs",
|
|
28
28
|
"types": "./dist/index.d.ts",
|
|
29
29
|
"exports": {
|
|
30
30
|
".": {
|
|
31
31
|
"types": "./dist/index.d.ts",
|
|
32
|
-
"import": "./dist/index.
|
|
33
|
-
"require": "./dist/index.
|
|
32
|
+
"import": "./dist/index.mjs",
|
|
33
|
+
"require": "./dist/index.mjs"
|
|
34
34
|
},
|
|
35
35
|
"./generator": {
|
|
36
36
|
"types": "./dist/generator.d.ts",
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
},
|
|
40
40
|
"./acl": {
|
|
41
41
|
"types": "./dist/acl.d.ts",
|
|
42
|
-
"import": "./dist/acl.
|
|
43
|
-
"require": "./dist/acl.
|
|
42
|
+
"import": "./dist/acl.mjs",
|
|
43
|
+
"require": "./dist/acl.mjs"
|
|
44
44
|
}
|
|
45
45
|
},
|
|
46
46
|
"scripts": {
|
|
@@ -48,8 +48,9 @@
|
|
|
48
48
|
"test": "vitest run",
|
|
49
49
|
"test:watch": "vitest",
|
|
50
50
|
"build:clean": "rm -rf ./dist",
|
|
51
|
-
"build:
|
|
52
|
-
"build": "
|
|
51
|
+
"build:client": "vite build",
|
|
52
|
+
"build:cli": "node ./esbuild.mjs && chmod +x ./dist/sh.js",
|
|
53
|
+
"build": "yarn build:clean && yarn build:cli && yarn build:client",
|
|
53
54
|
"start:dist": "node ./dist/sh.js",
|
|
54
55
|
"typecheck": "tsc --noEmit",
|
|
55
56
|
"lint": "oxlint --type-aware --fix",
|
|
@@ -74,6 +75,7 @@
|
|
|
74
75
|
"@types/prompt-sync": "^4.2.3",
|
|
75
76
|
"@types/react": "^19.1.0",
|
|
76
77
|
"@types/yargs": "^17.0.32",
|
|
78
|
+
"@vitejs/plugin-react": "^5.1.3",
|
|
77
79
|
"axios": "^1.13.1",
|
|
78
80
|
"esbuild": "0.25.0",
|
|
79
81
|
"handlebars": "^4.7.8",
|
|
@@ -89,6 +91,8 @@
|
|
|
89
91
|
"tsx": "^4.10.5",
|
|
90
92
|
"type-fest": "^4.26.0",
|
|
91
93
|
"typescript": "^5.9.3",
|
|
94
|
+
"vite": "^7.3.1",
|
|
95
|
+
"vite-plugin-dts": "^4.5.4",
|
|
92
96
|
"vitest": "^2.0.5",
|
|
93
97
|
"yargs": "^17.7.2",
|
|
94
98
|
"zod": "^4.1.12"
|
package/dist/acl.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var h=Object.defineProperty;var t=(e,o)=>h(e,"name",{value:o,configurable:!0});import{createContext as w,useEffect as g,useState as W}from"react";import{AbilityBuilder as B,createMongoAbility as G}from"@casl/ability";import{unpackRules as E}from"@casl/ability/extra";import{useAbility as M}from"@casl/react";import{createContext as v,use as R,useMemo as U}from"react";import{jsx as k}from"react/jsx-runtime";var d;(r=>{let e=v({});r.Provider=t(({isAuthenticated:i,isInitializing:A,logout:s,updateTokens:u,accessToken:a,user:c,userPromise:l,routes:b,loadingState:y,children:m})=>{let f=U(()=>({isAuthenticated:i,isInitializing:A,logout:s,updateTokens:u,accessToken:a,user:c,userPromise:l,routes:b,loadingState:y}),[i,A,s,u,a,c,l,b,y]);return k(e.Provider,{value:f,children:m})},"Provider"),r.useAuth=t(()=>R(e),"useAuth")})(d||(d={}));import{jsx as O}from"react/jsx-runtime";var n;(s=>{let e=t(()=>new B(G),"createAppAbilityBuilder"),o=e().build(),p=w({});({Consumer:s.Consumer}=p),s.Provider=t(({children:u})=>{let[a,c]=W(o),{user:l}=d.useAuth();return g(()=>{if(!l||!("aclRules"in l))return;let{can:b,build:y}=e(),m=l.aclRules;E(m).forEach(({action:C,subject:T,conditions:x})=>{b(C,T,x)}),c(y())},[l]),O(p.Provider,{value:a,children:u})},"Provider"),s.useAbility=t(()=>M(p),"useAbility")})(n||(n={}));import{createContext as N,use as I,useMemo as S}from"react";import{jsx as q}from"react/jsx-runtime";var P;(r=>{let e=N(null);r.Provider=t(({children:i,replace:A})=>{let s=S(()=>({replace:A}),[A]);return q(e,{value:s,children:i})},"Provider"),r.useRouter=t(()=>{let i=I(e);if(!i)throw new Error("useRouter must be used within an OpenApiRouter.Provider");return i},"useRouter")})(P||(P={}));var z=t(()=>({canUse:e,redirectTo:o="/",children:p})=>{let r=n.useAbility(),{replace:i}=P.useRouter();return r.can(e[0],e[1])?p:(i(o),null)},"createAclGuard");import{createContextualCan as D}from"@casl/react";import{jsx as J}from"react/jsx-runtime";var F=D(n.Consumer),H=t(({use:e,...o})=>{let[p,r]=e;return J(F,{...o,do:p,on:r})},"Can");export{n as AbilityContext,H as Can,z as createAclGuard};
|
package/dist/index.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
var Z=Object.defineProperty;var L=(a,e,r)=>e in a?Z(a,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):a[e]=r;var n=(a,e)=>Z(a,"name",{value:e,configurable:!0});var c=(a,e,r)=>L(a,typeof e!="symbol"?e+"":e,r);import K from"axios";import{z as B}from"zod";import{isAxiosError as v,isCancel as V}from"axios";import{z}from"zod";import U from"i18next";var G={openapi:{sharedErrors:{dataValidation:"An error occurred while validating the data",internalError:"An internal error occurred. This is most likely a bug on our end. Please try again later.",networkError:"A network error occurred. Are you connected to the internet?",canceledError:"The request was canceled.",unknownError:"An unknown error occurred. Please try again later.",unknownErrorWithCode:'An unknown error occurred. Error code: "{{code}}"'}}};var S={openapi:{sharedErrors:{dataValidation:"Pri preverjanju podatkov je pri\u0161lo do napake",internalError:"Pri\u0161lo je do notranje napake.",networkError:"Pri\u0161lo je do napake v omre\u017Eju.",canceledError:"Zahteva je bila preklicana.",unknownError:"Pri\u0161lo je do neznane napake.",unknownErrorWithCode:'Pri\u0161lo je do neznane napake. Koda napake: "{{code}}"'}}};var C="openapi",T={en:{[C]:G},sl:{[C]:S}},H="en",w=U.createInstance();w.init({compatibilityJSON:"v4",lng:H,fallbackLng:H,resources:T,ns:Object.keys(T.en),defaultNS:C,interpolation:{escapeValue:!1}});var y=w.t.bind(w);import{z as D}from"zod";import{isAxiosError as W}from"axios";var d;(t=>(t.extractServerResponseCode=n(s=>{if(s instanceof D.ZodError)return"validation-exception";if(!W(s)||!s.response)return null;let i=s.response.data;return typeof i?.code=="string"?i.code:null},"extractServerResponseCode"),t.doesServerErrorMessageContain=n((s,i)=>{let p=(0,t.extractServerErrorMessage)(s);return p==null?!1:p.toLowerCase().includes(i.toLowerCase())},"doesServerErrorMessageContain"),t.extractServerErrorMessage=n(s=>{if(s instanceof D.ZodError)return s.message;if(!W(s)||!s.response)return null;let i=s.response.data;return typeof i?.message=="string"?i.message:null},"extractServerErrorMessage"),t.extractContentDispositionFilename=n(s=>{let i=s["content-disposition"];return i?/filename=["']?([^"';]+)/i.exec(i)?.[1]:void 0},"extractContentDispositionFilename")))(d||(d={}));var k=class k extends Error{constructor(r,o,t){super(r);c(this,"code");c(this,"serverMessage",null);this.code=o,this.serverMessage=t}};n(k,"ApplicationException");var l=k,b=class b{constructor({entries:e,t:r=y,onRethrowError:o}){c(this,"entries",[]);c(this,"t");c(this,"onRethrowError");this.t=r,this.onRethrowError=o;let t={code:"DATA_VALIDATION_ERROR",condition:n(u=>u instanceof z.ZodError,"condition"),getMessage:n(()=>this.t("openapi.sharedErrors.dataValidation"),"getMessage")},s={code:"INTERNAL_ERROR",condition:n(u=>v(u)?u.response?.status!=null&&u.response.status>=500&&u.response.status<600:!1,"condition"),getMessage:n(()=>this.t("openapi.sharedErrors.internalError"),"getMessage")},i={code:"NETWORK_ERROR",condition:n(u=>v(u)?u.code==="ERR_NETWORK":!1,"condition"),getMessage:n(()=>this.t("openapi.sharedErrors.networkError"),"getMessage")},p={code:"CANCELED_ERROR",condition:n(u=>!!(V(u)||v(u)&&u.code==="ECONNABORTED"),"condition"),getMessage:n(()=>this.t("openapi.sharedErrors.canceledError"),"getMessage")},f={code:"UNKNOWN_ERROR",condition:n(()=>!0,"condition"),getMessage:n((u,E)=>{let R=d.extractServerResponseCode(E),m=d.extractServerErrorMessage(E);if(R){let g=`Unknown error, message from server: ${R}`;return m&&(g+=` ${m}`),g}return this.t("openapi.sharedErrors.unknownError")},"getMessage")};this.entries=[...e,t,s,i,p,f]}matchesEntry(e,r,o){return r.condition?r.condition(e):o===r.code}setTranslateFunction(e){this.t=e}rethrowError(e){let r=d.extractServerResponseCode(e),o=this.entries.find(i=>this.matchesEntry(e,i,r)),t=d.extractServerErrorMessage(e),s=new l(o.getMessage(this.t,e),o.code,t);throw this.onRethrowError?.(e,s),s}getError(e){return e instanceof l?e:null}getErrorCode(e){return e instanceof l?e.code:null}static getErrorMessage(e,r=!0){return typeof e=="string"?e:e instanceof Error||e instanceof l?e.message:r?y("openapi.sharedErrors.unknownError"):null}};n(b,"ErrorHandler");var I=b,A=new I({entries:[]});var O=class O{constructor({config:e,interceptors:r,errorHandler:o}={}){c(this,"client");c(this,"errorHandler");this.client=K.create(e),this.errorHandler=o??A,this.attachInterceptors(r)}attachInterceptors(e,...r){e?.forEach(o=>this.attachInterceptor(o,...r))}attachInterceptor(e,...r){e.addInterceptor(this.client,...r)}ejectInterceptor(e){e.removeInterceptor(this.client)}async get(e,r,o){return this.makeRequest(e,{...o,method:"get",url:r})}async post(e,r,o,t){return this.makeRequest(e,{...t,method:"post",url:r,data:o})}async patch(e,r,o,t){return this.makeRequest(e,{...t,method:"patch",url:r,data:o})}async put(e,r,o,t){return this.makeRequest(e,{...t,method:"put",url:r,data:o})}async delete(e,r,o,t){return this.makeRequest(e,{...t,method:"delete",url:r,data:o})}async makeRequest(e,r){let o=new Error().stack;try{let{rawResponse:t,...s}=r,i=await this.client(s),p=e.resSchema.parse(i.data);return t?{...i,data:p}:p}catch(t){throw t instanceof B.ZodError&&(t.name="BE Response schema mismatch - ZodError",t.stack=[t.stack,...o?.split(`
|
|
2
|
-
`).slice(2)??[]].join(`
|
|
3
|
-
`)),(e.errorHandler??this.errorHandler).rethrowError(t),t}}};n(O,"RestClient");var P=O;var M=class M{constructor(e){this.applyInterceptor=e;c(this,"interceptorIdMap",[])}addInterceptor(e,...r){this.removeInterceptor(e);let o=this.applyInterceptor(e,...r);this.interceptorIdMap.push({client:e,interceptorId:o})}removeInterceptor(e){let r=this.interceptorIdMap.find(o=>o.client===e)?.interceptorId;r!=null&&(e.interceptors.request.eject(r),this.interceptorIdMap=this.interceptorIdMap.filter(o=>o.client!==e))}};n(M,"RestInterceptor");var q=M;import{createContext as $,use as J,useMemo as Q}from"react";import{jsx as X}from"react/jsx-runtime";var h;(o=>{let a=$(null);o.Provider=n(({children:t,replace:s})=>{let i=Q(()=>({replace:s}),[s]);return X(a,{value:i,children:t})},"Provider"),o.useRouter=n(()=>{let t=J(a);if(!t)throw new Error("useRouter must be used within an OpenApiRouter.Provider");return t},"useRouter")})(h||(h={}));import{createContext as Y,use as ee,useMemo as re}from"react";import{jsx as te}from"react/jsx-runtime";var N;(o=>{let a=Y({});o.Provider=n(({preferUpdate:t=!0,children:s})=>{let i=re(()=>({preferUpdate:t}),[t]);return te(a.Provider,{value:i,children:s})},"Provider"),o.useConfig=n(()=>ee(a)??{},"useConfig")})(N||(N={}));import{createContext as oe,use as ne,useMemo as se}from"react";import{jsx as ie}from"react/jsx-runtime";var x;(o=>{let a=oe({});o.Provider=n(({isAuthenticated:t,isInitializing:s,logout:i,updateTokens:p,accessToken:f,user:u,userPromise:E,routes:R,loadingState:m,children:g})=>{let j=se(()=>({isAuthenticated:t,isInitializing:s,logout:i,updateTokens:p,accessToken:f,user:u,userPromise:E,routes:R,loadingState:m}),[t,s,i,p,f,u,E,R,m]);return ie(a.Provider,{value:j,children:g})},"Provider"),o.useAuth=n(()=>ne(a),"useAuth")})(x||(x={}));import{useEffect as ae,useState as ue}from"react";var pe=n(({type:a,redirectTo:e,children:r})=>{let{isAuthenticated:o,routes:t,loadingState:s}=x.useAuth(),{replace:i}=h.useRouter(),[p,f]=ue(!1);return ae(()=>{f(!0)},[]),p?a==="private"&&!o?(i(e||t?.unauthenticated||"/"),null):a==="public-only"&&o?(i(e||t?.authenticated||"/"),null):r:s},"AuthGuard");export{l as ApplicationException,x as AuthContext,pe as AuthGuard,I as ErrorHandler,N as OpenApiQueryConfig,h as OpenApiRouter,P as RestClient,q as RestInterceptor,d as RestUtils,A as SharedErrorHandler,C as ns,T as resources};
|