@povio/openapi-codegen-cli 3.2.0-rc.9 → 3.3.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -51
- package/dist/acl.d.mts +19 -6
- package/dist/acl.mjs +7 -7
- package/dist/{auth.context-COWO6ssl.mjs → auth.context-BAz8frX9.mjs} +18 -1
- package/dist/{config-DgrOddSC.d.mts → config-BQqze8rU.d.mts} +2 -1
- package/dist/{error-handling-BeydPL7s.mjs → error-handling-CsnufAil.mjs} +45 -21
- package/dist/{error-handling-LPEPQV1V.d.mts → error-handling-D6ZYITQ3.d.mts} +42 -3
- package/dist/generate.runner-B0Zm3pIl.mjs +87 -0
- package/dist/{generateCodeFromOpenAPIDoc-iEa8YAUQ.cjs → generateCodeFromOpenAPIDoc-SYuVswEJ.mjs} +2341 -1393
- package/dist/generator.d.mts +10 -3
- package/dist/generator.mjs +4 -7
- package/dist/index.d.mts +198 -12
- package/dist/index.mjs +256 -12
- package/dist/metro.cjs +4862 -112
- package/dist/metro.d.mts +4 -3
- package/dist/metro.mjs +3 -3
- package/dist/{openapi-codegen.runner-6Yth6QZC.mjs → openapi-codegen.runner-CCXQsUum.mjs} +2 -3
- package/dist/{openapi-source.runner-BZ6ZLgRO.mjs → openapi-source.runner-8kCe-g9S.mjs} +6 -18
- package/dist/{openapi-source.runner-ykstqlPC.d.mts → openapi-source.runner-B6KKrXw7.d.mts} +8 -2
- package/dist/{options-KPf-Fti5.d.mts → options-DdQJ9BSc.d.mts} +1 -6
- package/dist/sh.d.mts +1 -1
- package/dist/sh.mjs +53 -37
- package/dist/tiny.d.mts +1 -1
- package/dist/tiny.mjs +1 -1
- package/dist/vite.d.mts +4 -3
- package/dist/vite.mjs +4 -5
- package/dist/zod.d.mts +7 -2
- package/dist/zod.mjs +1 -1
- package/package.json +22 -69
- package/dist/AuthGuard-GbtTDXs0.d.mts +0 -32
- package/dist/AuthGuard-qpAtHaBz.mjs +0 -24
- package/dist/auth.d.mts +0 -2
- package/dist/auth.mjs +0 -3
- package/dist/axios.d.mts +0 -2
- package/dist/axios.mjs +0 -2
- package/dist/config.d.mts +0 -4
- package/dist/config.mjs +0 -5
- package/dist/errors.d.mts +0 -3
- package/dist/errors.mjs +0 -2
- package/dist/generate.runner-D8AYuEFm.mjs +0 -184
- package/dist/generate.utils-CT-LA-gX.cjs +0 -2267
- package/dist/generateCodeFromOpenAPIDoc--ufinTug.mjs +0 -2061
- package/dist/getDataFromOpenAPIDoc-D8w0QElH.mjs +0 -2011
- package/dist/i18n-B_brQh4X.d.mts +0 -38
- package/dist/i18n-D-FesqFb.mjs +0 -36
- package/dist/native-bindings-BTQGSGhU.mjs +0 -1480
- package/dist/native-rest-interceptor-CAWR8H5Y.mjs +0 -208
- package/dist/native-rest-interceptor-Cz6saoq5.d.mts +0 -46
- package/dist/native.d.mts +0 -3
- package/dist/native.mjs +0 -3
- package/dist/openapi-codegen-native-darwin-arm64.node +0 -0
- package/dist/openapi-codegen-native-linux-x64.node +0 -0
- package/dist/openapi-codegen-native-win32-x64.node +0 -0
- package/dist/query.d.mts +0 -3
- package/dist/query.mjs +0 -3
- package/dist/queryConfig.context-CRJOgf19.d.mts +0 -22
- package/dist/queryConfig.context-CldQ5YL9.mjs +0 -34
- package/dist/rest-client-CQyFvqYC.d.mts +0 -55
- package/dist/rest-interceptor-D5NCNTm1.mjs +0 -115
- package/dist/rest-transport.types-DM5-qyOJ.d.mts +0 -66
- package/dist/rest-transport.types-DxitRtsB.mjs +0 -11
- package/dist/rest.d.mts +0 -2
- package/dist/rest.mjs +0 -2
- package/dist/rest.utils-rezWAIYL.d.mts +0 -10
- package/dist/router.context-EPlMBk3G.mjs +0 -21
- package/dist/useMutationEffects-DIdL8tlx.d.mts +0 -29
- package/dist/useMutationEffects-PB1fvKWM.mjs +0 -68
- package/dist/workspace.context-XWvQ_7Hg.mjs +0 -26
- package/dist/workspace.context-isVY9ves.d.mts +0 -23
|
@@ -1,2267 +0,0 @@
|
|
|
1
|
-
//#region \0rolldown/runtime.js
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __copyProps = (to, from, except, desc) => {
|
|
9
|
-
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
10
|
-
key = keys[i];
|
|
11
|
-
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
12
|
-
get: ((k) => from[k]).bind(null, key),
|
|
13
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
|
|
19
|
-
value: mod,
|
|
20
|
-
enumerable: true
|
|
21
|
-
}) : target, mod));
|
|
22
|
-
//#endregion
|
|
23
|
-
let fs = require("fs");
|
|
24
|
-
fs = __toESM(fs, 1);
|
|
25
|
-
let path = require("path");
|
|
26
|
-
path = __toESM(path, 1);
|
|
27
|
-
require("url");
|
|
28
|
-
let node_module = require("node:module");
|
|
29
|
-
let node_fs = require("node:fs");
|
|
30
|
-
let node_url = require("node:url");
|
|
31
|
-
let node_path = require("node:path");
|
|
32
|
-
node_path = __toESM(node_path, 1);
|
|
33
|
-
let openapi_types = require("openapi-types");
|
|
34
|
-
//#region src/generators/const/package.const.ts
|
|
35
|
-
const PACKAGE_IMPORT_PATH = "@povio/openapi-codegen-cli";
|
|
36
|
-
const NATIVE_PACKAGE_IMPORT_PATH = `${PACKAGE_IMPORT_PATH}/native`;
|
|
37
|
-
const REST_PACKAGE_IMPORT_PATH = `${PACKAGE_IMPORT_PATH}/rest`;
|
|
38
|
-
const QUERY_PACKAGE_IMPORT_PATH = `${PACKAGE_IMPORT_PATH}/query`;
|
|
39
|
-
const CONFIG_PACKAGE_IMPORT_PATH = `${PACKAGE_IMPORT_PATH}/config`;
|
|
40
|
-
//#endregion
|
|
41
|
-
//#region src/generators/const/zod.const.ts
|
|
42
|
-
const SCHEMA_SUFFIX = "Schema";
|
|
43
|
-
const ENUM_SUFFIX = "Enum";
|
|
44
|
-
const BODY_SCHEMA_SUFFIX = "Body";
|
|
45
|
-
const PARAM_SCHEMA_SUFFIX = "Param";
|
|
46
|
-
const RESPONSE_SCHEMA_SUFFIX = "Response";
|
|
47
|
-
const ERROR_RESPONSE_SCHEMA_SUFFIX = "ErrorResponse";
|
|
48
|
-
const VOID_SCHEMA = "z.void()";
|
|
49
|
-
const ANY_SCHEMA = "z.any()";
|
|
50
|
-
const BLOB_SCHEMA = "z.instanceof(Blob)";
|
|
51
|
-
const ENUM_SCHEMA = "z.enum";
|
|
52
|
-
const INT_SCHEMA = "z.int()";
|
|
53
|
-
const NUMBER_SCHEMA = "z.number()";
|
|
54
|
-
const STRING_SCHEMA = "z.string()";
|
|
55
|
-
const EMAIL_SCHEMA = "z.email()";
|
|
56
|
-
const URL_SCHEMA = "z.url()";
|
|
57
|
-
const UUID_SCHEMA = "z.uuid()";
|
|
58
|
-
const DATETIME_SCHEMA = "z.iso.datetime({ offset: true })";
|
|
59
|
-
const ZOD_IMPORT = {
|
|
60
|
-
bindings: ["z"],
|
|
61
|
-
from: "zod"
|
|
62
|
-
};
|
|
63
|
-
//#endregion
|
|
64
|
-
//#region src/generators/const/options.const.ts
|
|
65
|
-
const DEFAULT_GENERATE_OPTIONS = {
|
|
66
|
-
input: "http://localhost:4000/docs-json/",
|
|
67
|
-
output: "output",
|
|
68
|
-
clearOutput: false,
|
|
69
|
-
incremental: true,
|
|
70
|
-
splitByTags: true,
|
|
71
|
-
defaultTag: "Common",
|
|
72
|
-
includeTags: [],
|
|
73
|
-
excludeTags: [],
|
|
74
|
-
excludePathRegex: "",
|
|
75
|
-
excludeRedundantZodSchemas: true,
|
|
76
|
-
tsNamespaces: true,
|
|
77
|
-
treeShakeableNamespaces: false,
|
|
78
|
-
tsPath: "@/data",
|
|
79
|
-
importPath: "ts",
|
|
80
|
-
configs: {
|
|
81
|
-
["models"]: {
|
|
82
|
-
outputFileNameSuffix: "models",
|
|
83
|
-
namespaceSuffix: "Models"
|
|
84
|
-
},
|
|
85
|
-
["endpoints"]: {
|
|
86
|
-
outputFileNameSuffix: "api",
|
|
87
|
-
namespaceSuffix: "Api"
|
|
88
|
-
},
|
|
89
|
-
["queries"]: {
|
|
90
|
-
outputFileNameSuffix: "queries",
|
|
91
|
-
namespaceSuffix: "Queries"
|
|
92
|
-
},
|
|
93
|
-
["acl"]: {
|
|
94
|
-
outputFileNameSuffix: "acl",
|
|
95
|
-
namespaceSuffix: "Acl"
|
|
96
|
-
},
|
|
97
|
-
["configs"]: {
|
|
98
|
-
outputFileNameSuffix: "configs",
|
|
99
|
-
namespaceSuffix: "Configs"
|
|
100
|
-
}
|
|
101
|
-
},
|
|
102
|
-
baseUrl: "",
|
|
103
|
-
modelsOnly: false,
|
|
104
|
-
standalone: false,
|
|
105
|
-
schemaSuffix: SCHEMA_SUFFIX,
|
|
106
|
-
enumSuffix: ENUM_SUFFIX,
|
|
107
|
-
modelsInCommon: false,
|
|
108
|
-
modelsInModules: false,
|
|
109
|
-
withDefaultValues: true,
|
|
110
|
-
extractEnums: true,
|
|
111
|
-
replaceOptionalWithNullish: false,
|
|
112
|
-
restClient: "axios",
|
|
113
|
-
restClientImportPath: "",
|
|
114
|
-
zodImportPath: "@povio/openapi-codegen-cli/zod",
|
|
115
|
-
errorHandlingImportPath: "",
|
|
116
|
-
removeOperationPrefixEndingWith: "Controller_",
|
|
117
|
-
parseRequestParams: true,
|
|
118
|
-
inlineEndpoints: false,
|
|
119
|
-
inlineEndpointsExcludeModules: [],
|
|
120
|
-
queryTypesImportPath: QUERY_PACKAGE_IMPORT_PATH,
|
|
121
|
-
mutationEffectsImportPath: QUERY_PACKAGE_IMPORT_PATH,
|
|
122
|
-
axiosRequestConfig: false,
|
|
123
|
-
mutationEffects: true,
|
|
124
|
-
mutationDefaultOnError: false,
|
|
125
|
-
workspaceContext: [],
|
|
126
|
-
prefetchQueries: true,
|
|
127
|
-
mutationScope: false,
|
|
128
|
-
infiniteQueries: false,
|
|
129
|
-
infiniteQueryParamNames: { page: "page" },
|
|
130
|
-
infiniteQueryResponseParamNames: {
|
|
131
|
-
page: "page",
|
|
132
|
-
totalItems: "totalItems",
|
|
133
|
-
limit: "limit"
|
|
134
|
-
},
|
|
135
|
-
acl: true,
|
|
136
|
-
checkAcl: true,
|
|
137
|
-
abilityContextGenericAppAbilities: false,
|
|
138
|
-
abilityContextImportPath: "",
|
|
139
|
-
aclCheckImportPath: "@povio/openapi-codegen-cli/acl",
|
|
140
|
-
builderConfigs: false,
|
|
141
|
-
filterParamName: "filter",
|
|
142
|
-
dataResponseParamNames: ["data", "items"],
|
|
143
|
-
dynamicInputsImportPath: "@povio/ui",
|
|
144
|
-
dynamicColumnsImportPath: "@povio/ui"
|
|
145
|
-
};
|
|
146
|
-
//#endregion
|
|
147
|
-
//#region src/generators/utils/object.utils.ts
|
|
148
|
-
/** Pick given properties in object */
|
|
149
|
-
function pick(obj, paths) {
|
|
150
|
-
const result = {};
|
|
151
|
-
Object.keys(obj).forEach((key) => {
|
|
152
|
-
if (!paths.includes(key)) return;
|
|
153
|
-
result[key] = obj[key];
|
|
154
|
-
});
|
|
155
|
-
return result;
|
|
156
|
-
}
|
|
157
|
-
/**
|
|
158
|
-
* Deep merge two or more objects/arrays recursively.
|
|
159
|
-
* Arrays are concatenated, objects are merged recursively.
|
|
160
|
-
* Later arguments take precedence over earlier ones.
|
|
161
|
-
* Returns a new object/array without mutating the originals.
|
|
162
|
-
*/
|
|
163
|
-
function deepMerge(source, ...sources) {
|
|
164
|
-
if (sources.length === 0) return source;
|
|
165
|
-
let result = source;
|
|
166
|
-
for (const source of sources) result = mergeTwoValues(result, source);
|
|
167
|
-
return result;
|
|
168
|
-
}
|
|
169
|
-
/**
|
|
170
|
-
* Merge two values recursively
|
|
171
|
-
*/
|
|
172
|
-
function mergeTwoValues(target, source) {
|
|
173
|
-
if (source === null || source === void 0) return target;
|
|
174
|
-
if (target === null || target === void 0) return deepClone(source);
|
|
175
|
-
if (Array.isArray(target) && Array.isArray(source)) return [...target, ...source];
|
|
176
|
-
if (isPlainObject(target) && isPlainObject(source)) {
|
|
177
|
-
const result = {};
|
|
178
|
-
for (const [key, targetValue] of Object.entries(target)) result[key] = deepClone(targetValue);
|
|
179
|
-
for (const [key, sourceValue] of Object.entries(source)) {
|
|
180
|
-
const targetValue = result[key];
|
|
181
|
-
if (sourceValue === void 0) continue;
|
|
182
|
-
else if (sourceValue === null) result[key] = sourceValue;
|
|
183
|
-
else if (isPlainObject(targetValue) && isPlainObject(sourceValue)) result[key] = mergeTwoValues(targetValue, sourceValue);
|
|
184
|
-
else if (Array.isArray(targetValue) && Array.isArray(sourceValue)) result[key] = [...targetValue, ...sourceValue];
|
|
185
|
-
else result[key] = deepClone(sourceValue);
|
|
186
|
-
}
|
|
187
|
-
return result;
|
|
188
|
-
}
|
|
189
|
-
return deepClone(source);
|
|
190
|
-
}
|
|
191
|
-
/**
|
|
192
|
-
* Deep clone an object or array to avoid reference sharing.
|
|
193
|
-
* Helper function for deepMerge.
|
|
194
|
-
*/
|
|
195
|
-
function deepClone(obj) {
|
|
196
|
-
if (obj === null || obj === void 0 || typeof obj !== "object") return obj;
|
|
197
|
-
if (Array.isArray(obj)) return obj.map((item) => deepClone(item));
|
|
198
|
-
if (isPlainObject(obj)) {
|
|
199
|
-
const result = {};
|
|
200
|
-
for (const [key, value] of Object.entries(obj)) result[key] = deepClone(value);
|
|
201
|
-
return result;
|
|
202
|
-
}
|
|
203
|
-
return obj;
|
|
204
|
-
}
|
|
205
|
-
/**
|
|
206
|
-
* Check if a value is a plain object (not an array, Date, etc.)
|
|
207
|
-
*/
|
|
208
|
-
function isPlainObject(obj) {
|
|
209
|
-
return obj !== null && typeof obj === "object" && !Array.isArray(obj) && Object.prototype.toString.call(obj) === "[object Object]";
|
|
210
|
-
}
|
|
211
|
-
//#endregion
|
|
212
|
-
//#region src/generators/utils/file.utils.ts
|
|
213
|
-
function getOutputFileName({ output, fileName }) {
|
|
214
|
-
return `${output}/${fileName}`;
|
|
215
|
-
}
|
|
216
|
-
async function writeFileIfChanged(file, data, skipExistingCheck = false) {
|
|
217
|
-
if (skipExistingCheck) {
|
|
218
|
-
await fs.default.promises.writeFile(file, data, "utf-8");
|
|
219
|
-
return;
|
|
220
|
-
}
|
|
221
|
-
try {
|
|
222
|
-
if (await fs.default.promises.readFile(file, "utf-8") === data) return;
|
|
223
|
-
} catch (error) {
|
|
224
|
-
if (error.code !== "ENOENT") throw error;
|
|
225
|
-
}
|
|
226
|
-
await fs.default.promises.writeFile(file, data, "utf-8");
|
|
227
|
-
}
|
|
228
|
-
async function writeFile({ fileName, content }, options) {
|
|
229
|
-
const formattedContent = options?.formatGeneratedFile ? await options.formatGeneratedFile({
|
|
230
|
-
fileName,
|
|
231
|
-
content
|
|
232
|
-
}) : content;
|
|
233
|
-
await fs.default.promises.mkdir(path.default.dirname(fileName), { recursive: true });
|
|
234
|
-
await writeFileIfChanged(fileName, formattedContent, options?.skipExistingCheck);
|
|
235
|
-
}
|
|
236
|
-
async function writeGenerateFileData(filesData, options) {
|
|
237
|
-
if (!options?.formatGeneratedFile) {
|
|
238
|
-
const directories = new Set(filesData.map(({ fileName }) => path.default.dirname(fileName)));
|
|
239
|
-
for (const directory of directories) fs.default.mkdirSync(directory, { recursive: true });
|
|
240
|
-
await Promise.all(filesData.map(({ fileName, content }) => writeFileIfChanged(fileName, content, options?.skipExistingCheck)));
|
|
241
|
-
return;
|
|
242
|
-
}
|
|
243
|
-
for (const file of filesData) await writeFile(file, options);
|
|
244
|
-
}
|
|
245
|
-
function removeStaleGeneratedFiles({ output, filesData, options }) {
|
|
246
|
-
if (!fs.default.existsSync(output)) return;
|
|
247
|
-
const expectedFiles = new Set(filesData.map((file) => path.default.resolve(file.fileName)));
|
|
248
|
-
const generatedSuffixes = new Set(Object.values(options.configs).map((config) => config.outputFileNameSuffix));
|
|
249
|
-
const staleFiles = [];
|
|
250
|
-
const visit = (dirPath) => {
|
|
251
|
-
for (const dirent of fs.default.readdirSync(dirPath, { withFileTypes: true })) {
|
|
252
|
-
const entryPath = path.default.join(dirPath, dirent.name);
|
|
253
|
-
if (dirent.isDirectory()) {
|
|
254
|
-
visit(entryPath);
|
|
255
|
-
continue;
|
|
256
|
-
}
|
|
257
|
-
if (isGeneratedFile(entryPath, output, generatedSuffixes) && !expectedFiles.has(path.default.resolve(entryPath))) staleFiles.push(entryPath);
|
|
258
|
-
}
|
|
259
|
-
};
|
|
260
|
-
visit(output);
|
|
261
|
-
staleFiles.forEach((filePath) => fs.default.rmSync(filePath, { force: true }));
|
|
262
|
-
removeEmptyDirectories(output);
|
|
263
|
-
}
|
|
264
|
-
function isGeneratedFile(filePath, output, generatedSuffixes) {
|
|
265
|
-
const relativePath = path.default.relative(output, filePath);
|
|
266
|
-
if (relativePath === ".openapi-codegen-cache.json") return true;
|
|
267
|
-
const normalizedRelativePath = relativePath.split(path.default.sep).join("/");
|
|
268
|
-
if ([
|
|
269
|
-
"app-rest-client.ts",
|
|
270
|
-
"queryModules.ts",
|
|
271
|
-
"acl/app.ability.ts"
|
|
272
|
-
].includes(normalizedRelativePath)) return true;
|
|
273
|
-
if (path.default.parse(filePath).ext !== ".ts") return false;
|
|
274
|
-
const segments = relativePath.split(path.default.sep).filter(Boolean);
|
|
275
|
-
if (segments.length < 2) return false;
|
|
276
|
-
const moduleName = segments[0];
|
|
277
|
-
const fileName = segments[segments.length - 1];
|
|
278
|
-
if (!fileName.startsWith(`${moduleName}.`)) return false;
|
|
279
|
-
const suffix = fileName.slice(moduleName.length + 1).replace(/\.tsx?$/, "");
|
|
280
|
-
return generatedSuffixes.has(suffix);
|
|
281
|
-
}
|
|
282
|
-
function removeEmptyDirectories(root) {
|
|
283
|
-
if (!fs.default.existsSync(root)) return;
|
|
284
|
-
const removeIfEmpty = (dirPath) => {
|
|
285
|
-
for (const dirent of fs.default.readdirSync(dirPath, { withFileTypes: true })) if (dirent.isDirectory()) removeIfEmpty(path.default.join(dirPath, dirent.name));
|
|
286
|
-
if (dirPath !== root && fs.default.readdirSync(dirPath).length === 0) fs.default.rmdirSync(dirPath);
|
|
287
|
-
};
|
|
288
|
-
removeIfEmpty(root);
|
|
289
|
-
}
|
|
290
|
-
//#endregion
|
|
291
|
-
//#region src/helpers/profile.helper.ts
|
|
292
|
-
function nowMs() {
|
|
293
|
-
return Number(process.hrtime.bigint()) / 1e6;
|
|
294
|
-
}
|
|
295
|
-
var Profiler = class {
|
|
296
|
-
enabled;
|
|
297
|
-
entries = /* @__PURE__ */ new Map();
|
|
298
|
-
constructor(enabled) {
|
|
299
|
-
this.enabled = enabled;
|
|
300
|
-
}
|
|
301
|
-
add(label, elapsedMs) {
|
|
302
|
-
if (!this.enabled) return;
|
|
303
|
-
const prev = this.entries.get(label);
|
|
304
|
-
if (prev) {
|
|
305
|
-
prev.totalMs += elapsedMs;
|
|
306
|
-
prev.count += 1;
|
|
307
|
-
return;
|
|
308
|
-
}
|
|
309
|
-
this.entries.set(label, {
|
|
310
|
-
totalMs: elapsedMs,
|
|
311
|
-
count: 1
|
|
312
|
-
});
|
|
313
|
-
}
|
|
314
|
-
runSync(label, fn) {
|
|
315
|
-
if (!this.enabled) return fn();
|
|
316
|
-
const startMs = nowMs();
|
|
317
|
-
try {
|
|
318
|
-
return fn();
|
|
319
|
-
} finally {
|
|
320
|
-
this.add(label, nowMs() - startMs);
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
async runAsync(label, fn) {
|
|
324
|
-
if (!this.enabled) return await fn();
|
|
325
|
-
const startMs = nowMs();
|
|
326
|
-
try {
|
|
327
|
-
return await fn();
|
|
328
|
-
} finally {
|
|
329
|
-
this.add(label, nowMs() - startMs);
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
formatLines() {
|
|
333
|
-
if (!this.enabled) return [];
|
|
334
|
-
return Array.from(this.entries.entries()).sort((a, b) => b[1].totalMs - a[1].totalMs).map(([label, entry]) => {
|
|
335
|
-
const avgMs = entry.totalMs / entry.count;
|
|
336
|
-
return `${label}: ${entry.totalMs.toFixed(1)}ms (count: ${entry.count}, avg: ${avgMs.toFixed(2)}ms)`;
|
|
337
|
-
});
|
|
338
|
-
}
|
|
339
|
-
};
|
|
340
|
-
//#endregion
|
|
341
|
-
//#region src/native/native-bindings.ts
|
|
342
|
-
let bindings;
|
|
343
|
-
let nativePath;
|
|
344
|
-
function getNativePath() {
|
|
345
|
-
if (nativePath) return nativePath;
|
|
346
|
-
const moduleDir = node_path.default.dirname((0, node_url.fileURLToPath)(require("url").pathToFileURL(__filename).href));
|
|
347
|
-
const binaryName = `openapi-codegen-native-${process.platform}-${process.arch}.node`;
|
|
348
|
-
nativePath = [node_path.default.join(moduleDir, binaryName), node_path.default.resolve(moduleDir, "../../dist", binaryName)].find(node_fs.existsSync);
|
|
349
|
-
if (!nativePath) throw new Error("Native OpenAPI codegen module is not built. Run `bun run build:native`.");
|
|
350
|
-
return nativePath;
|
|
351
|
-
}
|
|
352
|
-
function hasNativeBindings() {
|
|
353
|
-
try {
|
|
354
|
-
getNativeBindings();
|
|
355
|
-
return true;
|
|
356
|
-
} catch {
|
|
357
|
-
return false;
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
function shouldUseNativeCodegen() {
|
|
361
|
-
if (process.env.OPENAPI_CODEGEN_NATIVE === "0") return false;
|
|
362
|
-
if (process.env.OPENAPI_CODEGEN_NATIVE === "1") return true;
|
|
363
|
-
return hasNativeBindings();
|
|
364
|
-
}
|
|
365
|
-
function getNativeBindings() {
|
|
366
|
-
if (!bindings) {
|
|
367
|
-
const require = (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href);
|
|
368
|
-
const resolvedNativePath = getNativePath();
|
|
369
|
-
if (typeof process.dlopen === "function") {
|
|
370
|
-
const nativeModule = { exports: {} };
|
|
371
|
-
process.dlopen(nativeModule, resolvedNativePath);
|
|
372
|
-
bindings = nativeModule.exports;
|
|
373
|
-
} else bindings = require(resolvedNativePath);
|
|
374
|
-
}
|
|
375
|
-
return bindings;
|
|
376
|
-
}
|
|
377
|
-
function compileNativeData(source, yaml, optionsJson) {
|
|
378
|
-
return getNativeBindings().compileData(source, yaml, optionsJson);
|
|
379
|
-
}
|
|
380
|
-
//#endregion
|
|
381
|
-
//#region src/generators/const/deps.const.ts
|
|
382
|
-
const APP_REST_CLIENT_NAME = "AppRestClient";
|
|
383
|
-
const APP_REST_CLIENT_FILE = {
|
|
384
|
-
fileName: "app-rest-client",
|
|
385
|
-
extension: "ts"
|
|
386
|
-
};
|
|
387
|
-
const DOMAIN_ERRORS_FILE = {
|
|
388
|
-
fileName: "domain-errors",
|
|
389
|
-
extension: "ts"
|
|
390
|
-
};
|
|
391
|
-
const QUERY_OPTIONS_TYPES = {
|
|
392
|
-
query: "AppQueryOptions",
|
|
393
|
-
infiniteQuery: "AppInfiniteQueryOptions",
|
|
394
|
-
mutation: "AppMutationOptions"
|
|
395
|
-
};
|
|
396
|
-
const TEMPLATE_DATA_FILE_PATH = "src/data";
|
|
397
|
-
const ERROR_HANDLERS = {
|
|
398
|
-
ErrorHandler: "ErrorHandler",
|
|
399
|
-
SharedErrorHandler: "SharedErrorHandler"
|
|
400
|
-
};
|
|
401
|
-
ERROR_HANDLERS.ErrorHandler, ERROR_HANDLERS.SharedErrorHandler;
|
|
402
|
-
const BUILDERS_UTILS = {
|
|
403
|
-
dynamicInputs: "dynamicInputs",
|
|
404
|
-
dynamicColumns: "dynamicColumns"
|
|
405
|
-
};
|
|
406
|
-
const QUERY_MODULE_ENUM = "QueryModule";
|
|
407
|
-
const QUERY_MODULES_FILE = {
|
|
408
|
-
fileName: "queryModules",
|
|
409
|
-
extension: "ts"
|
|
410
|
-
};
|
|
411
|
-
const MUTATION_EFFECTS = {
|
|
412
|
-
optionsType: "MutationEffectsOptions",
|
|
413
|
-
hookName: "useMutationEffects",
|
|
414
|
-
runFunctionName: "runMutationEffects"
|
|
415
|
-
};
|
|
416
|
-
const ZOD_EXTENDED = {
|
|
417
|
-
namespace: "ZodExtended",
|
|
418
|
-
exports: {
|
|
419
|
-
parse: "parse",
|
|
420
|
-
sortExp: "sortExp"
|
|
421
|
-
}
|
|
422
|
-
};
|
|
423
|
-
//#endregion
|
|
424
|
-
//#region src/generators/utils/string.utils.ts
|
|
425
|
-
const capitalize = (str) => str.charAt(0).toUpperCase() + str.slice(1);
|
|
426
|
-
const decapitalize = (str) => str.charAt(0).toLowerCase() + str.slice(1);
|
|
427
|
-
const kebabToCamel = (str) => str.replace(/(-\w)/g, (group) => group[1].toUpperCase());
|
|
428
|
-
const snakeToCamel = (str) => str.replace(/(_\w)/g, (group) => group[1].toUpperCase());
|
|
429
|
-
const nonWordCharactersToCamel = (str) => str.replace(/[\W_]+(\w)?/g, (_, char) => char?.toUpperCase() ?? "");
|
|
430
|
-
const suffixIfNeeded = (text, suffix = "") => text.endsWith(suffix) ? text : `${text}${suffix}`;
|
|
431
|
-
const removeSuffix = (text, suffix) => text.replace(new RegExp(`${suffix}$`), "");
|
|
432
|
-
const getLongestMostCommon = (strs) => {
|
|
433
|
-
const counter = strs.reduce((acc, str) => ({
|
|
434
|
-
...acc,
|
|
435
|
-
[str]: (acc[str] ?? 0) + 1
|
|
436
|
-
}), {});
|
|
437
|
-
return Object.entries(counter).toSorted((a, b) => {
|
|
438
|
-
if (a[1] === b[1]) return b[0].length - a[0].length;
|
|
439
|
-
return b[1] - a[1];
|
|
440
|
-
})[0]?.[0];
|
|
441
|
-
};
|
|
442
|
-
const getMostCommonAdjacentCombinationSplit = (strs) => {
|
|
443
|
-
const splits = strs.flatMap((str) => getAdjacentStringCombinations(splitByUppercase(capitalize(str))));
|
|
444
|
-
return getLongestMostCommon(splits);
|
|
445
|
-
};
|
|
446
|
-
const splitByUppercase = (str) => {
|
|
447
|
-
return str.split(/(?<![A-Z])(?=[A-Z])/).filter(Boolean);
|
|
448
|
-
};
|
|
449
|
-
const camelToSpaceSeparated = (text) => splitByUppercase(text).join(" ");
|
|
450
|
-
const getAdjacentStringCombinations = (strs, ignoreStrs = [
|
|
451
|
-
"dto",
|
|
452
|
-
"by",
|
|
453
|
-
"for",
|
|
454
|
-
"of",
|
|
455
|
-
"in",
|
|
456
|
-
"to",
|
|
457
|
-
"and",
|
|
458
|
-
"with"
|
|
459
|
-
]) => {
|
|
460
|
-
const combinations = [];
|
|
461
|
-
for (let i = 0; i < strs.length; i++) {
|
|
462
|
-
if (ignoreStrs.includes(strs[i].toLowerCase())) continue;
|
|
463
|
-
for (let j = i + 1; j <= strs.length; j++) {
|
|
464
|
-
if (ignoreStrs.includes(strs[j - 1]?.toLowerCase())) continue;
|
|
465
|
-
combinations.push(strs.slice(i, j).join(""));
|
|
466
|
-
}
|
|
467
|
-
}
|
|
468
|
-
return combinations;
|
|
469
|
-
};
|
|
470
|
-
const removeWord = (source, wordToRemove) => {
|
|
471
|
-
const singularWordToRemove = wordToRemove.replace(/es$|s$/g, "");
|
|
472
|
-
const pattern = new RegExp(`(${decapitalize(singularWordToRemove)}|${capitalize(singularWordToRemove)})[a-z]*(?=$|[A-Z])`, "g");
|
|
473
|
-
return source.replace(pattern, "");
|
|
474
|
-
};
|
|
475
|
-
//#endregion
|
|
476
|
-
//#region src/generators/utils/array.utils.ts
|
|
477
|
-
const getUniqueArray = (...arrs) => [...new Set(arrs.flat())];
|
|
478
|
-
//#endregion
|
|
479
|
-
//#region src/generators/utils/namespace.utils.ts
|
|
480
|
-
const getNamespaceName = ({ type, tag, options }) => `${capitalize(tag)}${options.configs[type].namespaceSuffix}`;
|
|
481
|
-
//#endregion
|
|
482
|
-
//#region src/generators/utils/tag.utils.ts
|
|
483
|
-
const formattedTagCache = /* @__PURE__ */ new Map();
|
|
484
|
-
const tagFilterCache = /* @__PURE__ */ new WeakMap();
|
|
485
|
-
function formatTag(tag) {
|
|
486
|
-
let formattedTag = formattedTagCache.get(tag);
|
|
487
|
-
if (formattedTag === void 0) {
|
|
488
|
-
formattedTag = nonWordCharactersToCamel(tag);
|
|
489
|
-
formattedTagCache.set(tag, formattedTag);
|
|
490
|
-
}
|
|
491
|
-
return formattedTag;
|
|
492
|
-
}
|
|
493
|
-
function getOperationTag(operation, options) {
|
|
494
|
-
const tag = operation.tags?.[0];
|
|
495
|
-
return formatTag(tag ?? options.defaultTag);
|
|
496
|
-
}
|
|
497
|
-
function getEndpointTag(endpoint, options) {
|
|
498
|
-
return formatTag((options.splitByTags ? endpoint.tags?.[0] : options.defaultTag) ?? options.defaultTag);
|
|
499
|
-
}
|
|
500
|
-
function isTagIncluded(tag, options) {
|
|
501
|
-
const normalizedTag = formatTag(tag).toLowerCase();
|
|
502
|
-
let filters = tagFilterCache.get(options);
|
|
503
|
-
if (!filters) {
|
|
504
|
-
filters = {
|
|
505
|
-
include: new Set(options.includeTags.map((includeTag) => formatTag(includeTag).toLowerCase())),
|
|
506
|
-
exclude: new Set(options.excludeTags.map((excludeTag) => formatTag(excludeTag).toLowerCase()))
|
|
507
|
-
};
|
|
508
|
-
tagFilterCache.set(options, filters);
|
|
509
|
-
}
|
|
510
|
-
if (filters.include.has(normalizedTag)) return true;
|
|
511
|
-
if (filters.exclude.has(normalizedTag)) return false;
|
|
512
|
-
return options.includeTags.length === 0;
|
|
513
|
-
}
|
|
514
|
-
function shouldInlineEndpointsForTag(tag, options) {
|
|
515
|
-
if (!options.inlineEndpoints) return false;
|
|
516
|
-
return !(options.inlineEndpointsExcludeModules ?? []).some((moduleName) => formatTag(moduleName).toLowerCase() === tag.toLowerCase());
|
|
517
|
-
}
|
|
518
|
-
//#endregion
|
|
519
|
-
//#region src/generators/utils/js.utils.ts
|
|
520
|
-
const isValidPropertyName = (str) => /^(?:[a-zA-Z_$][a-zA-Z0-9_$]*|[0-9]+)$/.test(str);
|
|
521
|
-
const invalidVariableNameCharactersToCamel = (str) => str.replace(/^[^a-zA-Z_$]*/g, "").replace(/[^a-zA-Z0-9_$]+(\w)?/g, (_, char) => char?.toUpperCase() ?? "");
|
|
522
|
-
//#endregion
|
|
523
|
-
//#region src/generators/const/openapi.const.ts
|
|
524
|
-
const ALLOWED_PARAM_MEDIA_TYPES = [
|
|
525
|
-
"application/octet-stream",
|
|
526
|
-
"multipart/form-data",
|
|
527
|
-
"application/x-www-form-urlencoded",
|
|
528
|
-
"*/*"
|
|
529
|
-
];
|
|
530
|
-
const ALLOWED_PATH_IN = [
|
|
531
|
-
"query",
|
|
532
|
-
"header",
|
|
533
|
-
"path"
|
|
534
|
-
];
|
|
535
|
-
const ALLOWED_METHODS = [
|
|
536
|
-
openapi_types.OpenAPIV3.HttpMethods.GET,
|
|
537
|
-
openapi_types.OpenAPIV3.HttpMethods.PUT,
|
|
538
|
-
openapi_types.OpenAPIV3.HttpMethods.POST,
|
|
539
|
-
openapi_types.OpenAPIV3.HttpMethods.DELETE,
|
|
540
|
-
openapi_types.OpenAPIV3.HttpMethods.OPTIONS,
|
|
541
|
-
openapi_types.OpenAPIV3.HttpMethods.HEAD,
|
|
542
|
-
openapi_types.OpenAPIV3.HttpMethods.PATCH,
|
|
543
|
-
openapi_types.OpenAPIV3.HttpMethods.TRACE
|
|
544
|
-
];
|
|
545
|
-
const PRIMITIVE_TYPE_LIST = [
|
|
546
|
-
"string",
|
|
547
|
-
"number",
|
|
548
|
-
"integer",
|
|
549
|
-
"boolean"
|
|
550
|
-
];
|
|
551
|
-
const COMPOSITE_KEYWORDS = [
|
|
552
|
-
"allOf",
|
|
553
|
-
"anyOf",
|
|
554
|
-
"oneOf"
|
|
555
|
-
];
|
|
556
|
-
//#endregion
|
|
557
|
-
//#region src/generators/utils/openapi-schema.utils.ts
|
|
558
|
-
function isReferenceObject(obj) {
|
|
559
|
-
return obj != null && Object.prototype.hasOwnProperty.call(obj, "$ref");
|
|
560
|
-
}
|
|
561
|
-
function isSchemaObject(schema) {
|
|
562
|
-
return !isReferenceObject(schema);
|
|
563
|
-
}
|
|
564
|
-
function isArraySchemaObject(schema) {
|
|
565
|
-
return schema.type === "array";
|
|
566
|
-
}
|
|
567
|
-
function inferRequiredSchema(schema) {
|
|
568
|
-
if (!schema.allOf) throw new Error("Function inferRequiredSchema is specialized to handle item with required only in an allOf array.");
|
|
569
|
-
const [standaloneRequisites, noRequiredOnlyAllof] = schema.allOf.reduce((acc, cur) => {
|
|
570
|
-
if (isBrokenAllOfItem(cur)) {
|
|
571
|
-
const required = cur.required;
|
|
572
|
-
acc[0].push(...required ?? []);
|
|
573
|
-
} else acc[1].push(cur);
|
|
574
|
-
return acc;
|
|
575
|
-
}, [[], []]);
|
|
576
|
-
const composedRequiredSchema = {
|
|
577
|
-
properties: standaloneRequisites.reduce((acc, cur) => {
|
|
578
|
-
acc[cur] = {};
|
|
579
|
-
return acc;
|
|
580
|
-
}, {}),
|
|
581
|
-
type: "object",
|
|
582
|
-
required: standaloneRequisites
|
|
583
|
-
};
|
|
584
|
-
return {
|
|
585
|
-
noRequiredOnlyAllof,
|
|
586
|
-
composedRequiredSchema,
|
|
587
|
-
patchRequiredSchemaInLoop: (prop, getSchemaByRef) => {
|
|
588
|
-
if (isReferenceObject(prop)) {
|
|
589
|
-
const refType = getSchemaByRef(prop.$ref);
|
|
590
|
-
if (refType) composedRequiredSchema.required.forEach((required) => {
|
|
591
|
-
composedRequiredSchema.properties[required] = refType?.properties?.[required] ?? {};
|
|
592
|
-
});
|
|
593
|
-
} else {
|
|
594
|
-
const properties = prop["properties"] ?? {};
|
|
595
|
-
composedRequiredSchema.required.forEach((required) => {
|
|
596
|
-
if (properties[required]) composedRequiredSchema.properties[required] = properties[required] ?? {};
|
|
597
|
-
});
|
|
598
|
-
}
|
|
599
|
-
}
|
|
600
|
-
};
|
|
601
|
-
}
|
|
602
|
-
const isBrokenAllOfItem = (item) => {
|
|
603
|
-
return !isReferenceObject(item) && !!item.required && !item.type && !item.properties && !item?.allOf && !item?.anyOf && !item.oneOf;
|
|
604
|
-
};
|
|
605
|
-
//#endregion
|
|
606
|
-
//#region src/generators/core/openapi/iterateSchema.ts
|
|
607
|
-
function iterateSchema(schema, options) {
|
|
608
|
-
if (!schema) return;
|
|
609
|
-
const { data, onSchema } = options;
|
|
610
|
-
if (isReferenceObject(schema) && onSchema({
|
|
611
|
-
type: "reference",
|
|
612
|
-
schema,
|
|
613
|
-
data
|
|
614
|
-
}) === true) return;
|
|
615
|
-
const schemaObj = schema;
|
|
616
|
-
if (COMPOSITE_KEYWORDS.some((prop) => prop in schemaObj && schemaObj[prop])) {
|
|
617
|
-
const schemaObjs = schemaObj.allOf ?? schemaObj.anyOf ?? schemaObj.oneOf ?? [];
|
|
618
|
-
for (const compositeObj of schemaObjs) {
|
|
619
|
-
if (onSchema?.({
|
|
620
|
-
type: "composite",
|
|
621
|
-
parentSchema: schema,
|
|
622
|
-
schema: compositeObj,
|
|
623
|
-
data
|
|
624
|
-
}) === true) continue;
|
|
625
|
-
iterateSchema(compositeObj, {
|
|
626
|
-
data,
|
|
627
|
-
onSchema
|
|
628
|
-
});
|
|
629
|
-
}
|
|
630
|
-
}
|
|
631
|
-
if (schemaObj.properties) for (const [propertyName, propertyObj] of Object.entries(schemaObj.properties)) {
|
|
632
|
-
if (onSchema({
|
|
633
|
-
type: "property",
|
|
634
|
-
parentSchema: schema,
|
|
635
|
-
schema: propertyObj,
|
|
636
|
-
data,
|
|
637
|
-
propertyName
|
|
638
|
-
}) === true) continue;
|
|
639
|
-
iterateSchema(propertyObj, options);
|
|
640
|
-
}
|
|
641
|
-
if (schemaObj.additionalProperties && typeof schemaObj.additionalProperties === "object") {
|
|
642
|
-
if (onSchema({
|
|
643
|
-
type: "additionalProperties",
|
|
644
|
-
parentSchema: schema,
|
|
645
|
-
schema: schemaObj.additionalProperties,
|
|
646
|
-
data
|
|
647
|
-
}) === true) return;
|
|
648
|
-
iterateSchema(schemaObj.additionalProperties, options);
|
|
649
|
-
}
|
|
650
|
-
if (schemaObj.type === "array") {
|
|
651
|
-
const arrayObj = schema.items;
|
|
652
|
-
if (onSchema({
|
|
653
|
-
type: "array",
|
|
654
|
-
parentSchema: schema,
|
|
655
|
-
schema: arrayObj,
|
|
656
|
-
data
|
|
657
|
-
}) === true) return;
|
|
658
|
-
iterateSchema(arrayObj, options);
|
|
659
|
-
}
|
|
660
|
-
}
|
|
661
|
-
//#endregion
|
|
662
|
-
//#region src/generators/utils/openapi.utils.ts
|
|
663
|
-
const getSchemaRef = (schemaName) => `#/components/schemas/${schemaName}`;
|
|
664
|
-
const autocorrectRef = (ref) => ref[1] === "/" ? ref : "#/" + ref.slice(1);
|
|
665
|
-
const getSchemaNameByRef = (ref) => autocorrectRef(ref).split("/").at(-1);
|
|
666
|
-
function normalizeString(text) {
|
|
667
|
-
const formatted = prefixStringStartingWithNumberIfNeeded(text).normalize("NFKD").trim().replace(/\s+/g, "_").replace(/--+/g, "-").replace(/-+/g, "_").replace(/[^\w-]+/g, "_");
|
|
668
|
-
return snakeToCamel(formatted);
|
|
669
|
-
}
|
|
670
|
-
function wrapWithQuotesIfNeeded(str) {
|
|
671
|
-
if (/^[a-zA-Z]\w*$/.test(str)) return str;
|
|
672
|
-
return `"${str}"`;
|
|
673
|
-
}
|
|
674
|
-
function unwrapQuotesIfNeeded(value) {
|
|
675
|
-
if (typeof value === "string" && value.startsWith("\"") && value.endsWith("\"")) return value.slice(1, -1);
|
|
676
|
-
return value;
|
|
677
|
-
}
|
|
678
|
-
function prefixStringStartingWithNumberIfNeeded(str) {
|
|
679
|
-
const firstAsNumber = Number(str[0]);
|
|
680
|
-
if (typeof firstAsNumber === "number" && !Number.isNaN(firstAsNumber)) return "_" + str;
|
|
681
|
-
return str;
|
|
682
|
-
}
|
|
683
|
-
function pathParamToVariableName(name) {
|
|
684
|
-
const preserveUnderscore = name.replaceAll("_", "#");
|
|
685
|
-
return snakeToCamel(preserveUnderscore.replaceAll("-", "_")).replaceAll("#", "_");
|
|
686
|
-
}
|
|
687
|
-
const isPrimitiveType = (type) => PRIMITIVE_TYPE_LIST.includes(type);
|
|
688
|
-
function escapeControlCharacters(str) {
|
|
689
|
-
return str.replace(/\t/g, "\\t").replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/([\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F-\u009F\uFFFE\uFFFF])/g, (_m, p1) => {
|
|
690
|
-
const dec = p1.codePointAt();
|
|
691
|
-
const hex = dec.toString(16);
|
|
692
|
-
if (dec <= 255) return `\\x${`00${hex}`.slice(-2)}`;
|
|
693
|
-
return `\\u${`0000${hex}`.slice(-4)}`;
|
|
694
|
-
}).replace(/\//g, "\\/");
|
|
695
|
-
}
|
|
696
|
-
function isParamMediaTypeAllowed(mediaType) {
|
|
697
|
-
return mediaType.includes("application/") && mediaType.includes("json") || ALLOWED_PARAM_MEDIA_TYPES.includes(mediaType) || mediaType.includes("text/");
|
|
698
|
-
}
|
|
699
|
-
function isMainResponseStatus(status) {
|
|
700
|
-
return status >= 200 && status < 300;
|
|
701
|
-
}
|
|
702
|
-
function isErrorStatus(status) {
|
|
703
|
-
return !(status >= 200 && status < 300);
|
|
704
|
-
}
|
|
705
|
-
function isMediaTypeAllowed(mediaType) {
|
|
706
|
-
return mediaType.startsWith("application/");
|
|
707
|
-
}
|
|
708
|
-
const PATH_PARAM_WITH_BRACKETS_REGEX = /({\w+})/g;
|
|
709
|
-
const WORD_PRECEDED_BY_NON_WORD_CHARACTER = /[^\w\-]+/g;
|
|
710
|
-
/** @example turns `/media-objects/{id}` into `MediaObjectsById` */
|
|
711
|
-
function pathToVariableName(path) {
|
|
712
|
-
path = capitalize(kebabToCamel(path.replaceAll("/", "-")).replaceAll("-", ""));
|
|
713
|
-
const pathParams = [...path.matchAll(PATH_PARAM_WITH_BRACKETS_REGEX)];
|
|
714
|
-
if (pathParams.length > 0) {
|
|
715
|
-
const lastPathParam = pathParams.toSorted((a, b) => a.index - b.index)[pathParams.length - 1][0];
|
|
716
|
-
path = `${path.replace(PATH_PARAM_WITH_BRACKETS_REGEX, "")}By${capitalize(lastPathParam.slice(1, -1))}`;
|
|
717
|
-
}
|
|
718
|
-
return path.replace(WORD_PRECEDED_BY_NON_WORD_CHARACTER, "_");
|
|
719
|
-
}
|
|
720
|
-
const MATCHER_REGEX = /{(\b\w+(?:-\w+)*\b)}/g;
|
|
721
|
-
function replaceHyphenatedPath(path) {
|
|
722
|
-
const matches = path.match(MATCHER_REGEX);
|
|
723
|
-
if (matches === null) return path.replaceAll(MATCHER_REGEX, ":$1");
|
|
724
|
-
matches.forEach((match) => {
|
|
725
|
-
const replacement = pathParamToVariableName(match.replaceAll(MATCHER_REGEX, ":$1"));
|
|
726
|
-
path = path.replaceAll(match, replacement);
|
|
727
|
-
});
|
|
728
|
-
return path;
|
|
729
|
-
}
|
|
730
|
-
const isSortingParameterObject = (param, schema = param.schema, resolver) => {
|
|
731
|
-
const enumNames = getParameterEnumNames(param, schema);
|
|
732
|
-
return Array.isArray(enumNames) && enumNames.length > 0 && isStringLikeParameterSchema(schema, resolver);
|
|
733
|
-
};
|
|
734
|
-
function getParameterEnumNames(param, schema = param.schema) {
|
|
735
|
-
return param["x-enumNames"] ?? (schema && isSchemaObject(schema) ? schema["x-enumNames"] : void 0);
|
|
736
|
-
}
|
|
737
|
-
function isStringLikeParameterSchema(schema, resolver) {
|
|
738
|
-
if (!schema) return false;
|
|
739
|
-
if (isReferenceObject(schema)) return resolver ? isStringLikeParameterSchema(resolver.resolveObject(schema), resolver) : true;
|
|
740
|
-
if (schema.type === "string" || Array.isArray(schema.type) && schema.type.includes("string")) return true;
|
|
741
|
-
return [
|
|
742
|
-
...schema.allOf ?? [],
|
|
743
|
-
...schema.oneOf ?? [],
|
|
744
|
-
...schema.anyOf ?? []
|
|
745
|
-
].some((compositeSchema) => isStringLikeParameterSchema(compositeSchema, resolver));
|
|
746
|
-
}
|
|
747
|
-
const isPathExcluded = (path, options) => {
|
|
748
|
-
if (!options.excludePathRegex) return false;
|
|
749
|
-
return new RegExp(options.excludePathRegex).test(path);
|
|
750
|
-
};
|
|
751
|
-
//#endregion
|
|
752
|
-
//#region src/generators/utils/zod-schema.utils.ts
|
|
753
|
-
const getZodSchemaName = (name, schemaSuffix) => suffixIfNeeded(capitalize(normalizeString(name)), schemaSuffix);
|
|
754
|
-
const getEnumZodSchemaName = (name, enumSuffix, schemaSuffix) => suffixIfNeeded(capitalize(normalizeString(name)), `${enumSuffix}${schemaSuffix}`);
|
|
755
|
-
const isNamedZodSchema = (schema) => ["z.", `${ZOD_EXTENDED.namespace}.`].every((searchString) => !schema.startsWith(searchString));
|
|
756
|
-
const isEnumZodSchema = (schema) => schema.startsWith(ENUM_SCHEMA);
|
|
757
|
-
const getZodSchemaOperationName = (operationName, isUniqueOperationName, tag) => isUniqueOperationName ? operationName : `${tag}_${operationName}`;
|
|
758
|
-
const getBodyZodSchemaName = (operationName) => snakeToCamel(`${operationName}_${BODY_SCHEMA_SUFFIX}`);
|
|
759
|
-
const getParamZodSchemaName = (operationName, paramName) => snakeToCamel(`${operationName}_${paramName}${PARAM_SCHEMA_SUFFIX}`);
|
|
760
|
-
const getMainResponseZodSchemaName = (operationName) => snakeToCamel(`${operationName}${RESPONSE_SCHEMA_SUFFIX}`);
|
|
761
|
-
const getErrorResponseZodSchemaName = (operationName, statusCode) => snakeToCamel(`${operationName}_${statusCode}_${ERROR_RESPONSE_SCHEMA_SUFFIX}`);
|
|
762
|
-
function getResponseZodSchemaName({ statusCode, operationName, isUniqueOperationName, tag }) {
|
|
763
|
-
const status = Number(statusCode);
|
|
764
|
-
const zodSchemaOperationName = getZodSchemaOperationName(operationName, isUniqueOperationName, tag);
|
|
765
|
-
if (!isMainResponseStatus(status) && statusCode !== "default" && isErrorStatus(status)) return getErrorResponseZodSchemaName(zodSchemaOperationName, statusCode);
|
|
766
|
-
return getMainResponseZodSchemaName(zodSchemaOperationName);
|
|
767
|
-
}
|
|
768
|
-
//#endregion
|
|
769
|
-
//#region src/generators/utils/generate/generate.openapi.utils.ts
|
|
770
|
-
const schemaDescriptionsCache = /* @__PURE__ */ new WeakMap();
|
|
771
|
-
function getSchemaDescriptions(schemaObj) {
|
|
772
|
-
const cachedSchemaDescriptions = schemaDescriptionsCache.get(schemaObj);
|
|
773
|
-
if (cachedSchemaDescriptions) return cachedSchemaDescriptions;
|
|
774
|
-
const schemaDescriptions = [
|
|
775
|
-
"minimum",
|
|
776
|
-
"exclusiveMinimum",
|
|
777
|
-
"maximum",
|
|
778
|
-
"exclusiveMaximum",
|
|
779
|
-
"minItems",
|
|
780
|
-
"minLength",
|
|
781
|
-
"minProperties",
|
|
782
|
-
"maxItems",
|
|
783
|
-
"maxLength",
|
|
784
|
-
"maxProperties",
|
|
785
|
-
"default",
|
|
786
|
-
"example"
|
|
787
|
-
].filter((key) => schemaObj[key] !== void 0).reduce((acc, key) => [...acc, `${capitalize(camelToSpaceSeparated(key))}: \`${schemaObj[key]}\``], []);
|
|
788
|
-
schemaDescriptionsCache.set(schemaObj, schemaDescriptions);
|
|
789
|
-
return schemaDescriptions;
|
|
790
|
-
}
|
|
791
|
-
//#endregion
|
|
792
|
-
//#region src/generators/utils/generate/generate.zod.utils.ts
|
|
793
|
-
const getZodSchemaInferedTypeName = (zodSchemaName, options) => removeSuffix(zodSchemaName, options.schemaSuffix);
|
|
794
|
-
const getImportedZodSchemaName = (resolver, zodSchemaName, namespaceTag) => {
|
|
795
|
-
if (!isNamedZodSchema(zodSchemaName)) return zodSchemaName;
|
|
796
|
-
const tag = getOwningOrLocalProxyTag(resolver, zodSchemaName, namespaceTag);
|
|
797
|
-
return `${resolver.options.tsNamespaces ? `${getNamespaceName({
|
|
798
|
-
type: "models",
|
|
799
|
-
tag,
|
|
800
|
-
options: resolver.options
|
|
801
|
-
})}.` : ""}${zodSchemaName}`;
|
|
802
|
-
};
|
|
803
|
-
function getOwningOrLocalProxyTag(resolver, zodSchemaName, namespaceTag) {
|
|
804
|
-
if (namespaceTag && (resolver.options.modelsInCommon || resolver.options.modelsInModules) && resolver.options.splitByTags) return namespaceTag;
|
|
805
|
-
return resolver.getTagByZodSchemaName(zodSchemaName) ?? namespaceTag;
|
|
806
|
-
}
|
|
807
|
-
const getImportedZodSchemaInferedTypeName = (resolver, zodSchemaName, currentTag, namespaceTag) => {
|
|
808
|
-
if (!isNamedZodSchema(zodSchemaName)) return zodSchemaName === "z.void()" ? "void" : zodSchemaName;
|
|
809
|
-
const tag = getOwningOrLocalProxyTag(resolver, zodSchemaName, namespaceTag);
|
|
810
|
-
return `${resolver.options.tsNamespaces && (Boolean(namespaceTag) || tag !== currentTag) ? `${getNamespaceName({
|
|
811
|
-
type: "models",
|
|
812
|
-
tag,
|
|
813
|
-
options: resolver.options
|
|
814
|
-
})}.` : ""}${getZodSchemaInferedTypeName(zodSchemaName, resolver.options)}`;
|
|
815
|
-
};
|
|
816
|
-
function getZodSchemaType(data) {
|
|
817
|
-
return data.isEnum ? "enum" : data.schemaObj?.type ?? "object";
|
|
818
|
-
}
|
|
819
|
-
function getZodSchemaDescription(data) {
|
|
820
|
-
if (!data.schemaObj) return;
|
|
821
|
-
return [data.schemaObj.description, ...getSchemaDescriptions(data.schemaObj)].filter(Boolean).join(". ");
|
|
822
|
-
}
|
|
823
|
-
function getType(resolver, schemaObj, tag) {
|
|
824
|
-
if (isReferenceObject(schemaObj)) {
|
|
825
|
-
const zodSchemaName = resolver.getZodSchemaNameByRef(schemaObj.$ref);
|
|
826
|
-
return zodSchemaName ? getImportedZodSchemaInferedTypeName(resolver, zodSchemaName, tag) : void 0;
|
|
827
|
-
}
|
|
828
|
-
if (isArraySchemaObject(schemaObj)) {
|
|
829
|
-
if (!isReferenceObject(schemaObj.items)) return `${schemaObj.items?.type ?? "unknown"}[]`;
|
|
830
|
-
const zodSchemaName = resolver.getZodSchemaNameByRef(schemaObj.items.$ref);
|
|
831
|
-
return zodSchemaName ? `${getImportedZodSchemaInferedTypeName(resolver, zodSchemaName, tag)}[]` : void 0;
|
|
832
|
-
}
|
|
833
|
-
if (COMPOSITE_KEYWORDS.some((prop) => prop in schemaObj && schemaObj[prop])) {
|
|
834
|
-
const schemaObjs = schemaObj.allOf ?? schemaObj.anyOf ?? schemaObj.oneOf ?? [];
|
|
835
|
-
if (schemaObjs.length > 0) return getType(resolver, schemaObjs[0], tag);
|
|
836
|
-
}
|
|
837
|
-
return schemaObj.type;
|
|
838
|
-
}
|
|
839
|
-
function getZodSchemaPropertyDescriptions(resolver, data, tag) {
|
|
840
|
-
if (!data.schemaObj) return [];
|
|
841
|
-
const ARRAY_INDEX = "[0]";
|
|
842
|
-
const ADDITIONAL_PROPERTIES_KEY = "[key]";
|
|
843
|
-
const properties = {};
|
|
844
|
-
const onSchema = (schemaData) => {
|
|
845
|
-
if (schemaData.type === "reference") return true;
|
|
846
|
-
if (schemaData.type === "composite") return;
|
|
847
|
-
const segments = [...schemaData.data?.pathSegments ?? []];
|
|
848
|
-
if (schemaData.type === "array") segments.push(ARRAY_INDEX);
|
|
849
|
-
else if (schemaData.type === "property") segments.push(schemaData.propertyName);
|
|
850
|
-
else if (schemaData.type === "additionalProperties") segments.push(ADDITIONAL_PROPERTIES_KEY);
|
|
851
|
-
if (schemaData.schema && segments[segments.length - 1] !== ARRAY_INDEX) {
|
|
852
|
-
const resolvedSchema = resolver.resolveObject(schemaData.schema);
|
|
853
|
-
const schemaDescriptions = [resolvedSchema?.description, ...getSchemaDescriptions(resolvedSchema)].filter(Boolean);
|
|
854
|
-
const propertyKey = segments.join(".");
|
|
855
|
-
if (!(properties[propertyKey] && "type" in schemaData.schema && schemaData.schema.type === "object")) {
|
|
856
|
-
delete properties[propertyKey];
|
|
857
|
-
properties[propertyKey] = {
|
|
858
|
-
type: getType(resolver, schemaData.schema, tag) ?? "unknown",
|
|
859
|
-
description: schemaDescriptions.join(". ")
|
|
860
|
-
};
|
|
861
|
-
}
|
|
862
|
-
}
|
|
863
|
-
iterateSchema(schemaData.schema, {
|
|
864
|
-
data: { pathSegments: [...segments] },
|
|
865
|
-
onSchema
|
|
866
|
-
});
|
|
867
|
-
return true;
|
|
868
|
-
};
|
|
869
|
-
if ("allOf" in data.schemaObj && data.schemaObj.allOf) data.schemaObj.allOf.forEach((schemaObj) => {
|
|
870
|
-
if (isReferenceObject(schemaObj)) iterateSchema(resolver.resolveObject(schemaObj), {
|
|
871
|
-
data: { pathSegments: [] },
|
|
872
|
-
onSchema
|
|
873
|
-
});
|
|
874
|
-
});
|
|
875
|
-
iterateSchema(data.schemaObj, {
|
|
876
|
-
data: { pathSegments: [] },
|
|
877
|
-
onSchema
|
|
878
|
-
});
|
|
879
|
-
return properties;
|
|
880
|
-
}
|
|
881
|
-
//#endregion
|
|
882
|
-
//#region src/generators/utils/generate/generate.acl.utils.ts
|
|
883
|
-
const getAbilityFunctionName = (endpoint) => `canUse${capitalize(snakeToCamel(endpoint.operationName))}`;
|
|
884
|
-
const getImportedAbilityFunctionName = (endpoint, options) => {
|
|
885
|
-
return `${options.tsNamespaces ? `${getNamespaceName({
|
|
886
|
-
type: "acl",
|
|
887
|
-
tag: getEndpointTag(endpoint, options),
|
|
888
|
-
options
|
|
889
|
-
})}.` : ""}${getAbilityFunctionName(endpoint)}`;
|
|
890
|
-
};
|
|
891
|
-
const getAbilityAction = (endpoint) => endpoint.acl?.[0].action;
|
|
892
|
-
const getAbilitySubject = (endpoint) => endpoint.acl?.[0].subject;
|
|
893
|
-
const hasAbilityConditions = (endpoint) => !!getAbilityConditionsTypes(endpoint)?.length;
|
|
894
|
-
const getAbilityConditionsTypes = (endpoint) => endpoint.acl?.[0].conditionsTypes?.sort((a, b) => a.name.localeCompare(b.name));
|
|
895
|
-
const getAbilityDescription = (endpoint) => endpoint.acl?.[0]?.description;
|
|
896
|
-
const getAbilitySubjectTypes = (endpoint, resolver, tag) => {
|
|
897
|
-
const abilitySubject = getAbilitySubject(endpoint);
|
|
898
|
-
const types = [`"${abilitySubject ?? ""}"`];
|
|
899
|
-
if (hasAbilityConditions(endpoint)) types.push(`ForcedSubject<"${abilitySubject}"> & { ${getAbilityConditionsTypes(endpoint)?.map((conditionType) => `${conditionType.name}${conditionType.required ? "" : "?"}: ${getAbilityConditionType(conditionType, resolver, tag)},`).join(" ")} }`);
|
|
900
|
-
return types;
|
|
901
|
-
};
|
|
902
|
-
function getAbilityConditionType(conditionType, resolver, tag) {
|
|
903
|
-
if (!conditionType.zodSchemaName) return conditionType.type ?? "";
|
|
904
|
-
if (!resolver) return `${conditionType.type ?? ""}${conditionType.zodSchemaName}`;
|
|
905
|
-
return getImportedZodSchemaInferedTypeName(resolver, conditionType.zodSchemaName, tag, tag);
|
|
906
|
-
}
|
|
907
|
-
function getAclData({ resolver, data, tag }) {
|
|
908
|
-
const endpoints = data.get(tag)?.endpoints.filter(({ acl }) => acl && acl.length > 0);
|
|
909
|
-
if (!endpoints || endpoints.length === 0) return;
|
|
910
|
-
const hasAdditionalAbilityImports = endpoints.some(({ acl }) => acl?.[0].conditions && Object.keys(acl[0].conditions).length > 0);
|
|
911
|
-
const aclZodSchemas = endpoints.reduce((acc, endpoint) => {
|
|
912
|
-
const zodSchemas = endpoint.acl?.[0].conditionsTypes?.reduce((acc, propertyType) => [...acc, ...propertyType?.zodSchemaName ? [propertyType.zodSchemaName] : []], []);
|
|
913
|
-
return [...acc, ...zodSchemas ?? []];
|
|
914
|
-
}, []);
|
|
915
|
-
return {
|
|
916
|
-
endpoints,
|
|
917
|
-
hasAdditionalAbilityImports,
|
|
918
|
-
modelsImports: getModelsImports({
|
|
919
|
-
resolver,
|
|
920
|
-
tag,
|
|
921
|
-
zodSchemasAsTypes: getUniqueArray(aclZodSchemas)
|
|
922
|
-
})
|
|
923
|
-
};
|
|
924
|
-
}
|
|
925
|
-
const getAppAbilitiesType = ({ resolver, data }) => {
|
|
926
|
-
const appAbilitiesTypeMap = /* @__PURE__ */ new Map();
|
|
927
|
-
const modelsImportsArr = [];
|
|
928
|
-
let hasAdditionalAbilityImports = false;
|
|
929
|
-
data.forEach((_, tag) => {
|
|
930
|
-
const aclData = getAclData({
|
|
931
|
-
resolver,
|
|
932
|
-
data,
|
|
933
|
-
tag
|
|
934
|
-
});
|
|
935
|
-
if (!aclData) return;
|
|
936
|
-
const { modelsImports: tagModelsImports, hasAdditionalAbilityImports: tagHasAdditionalAbilityImports, endpoints } = aclData;
|
|
937
|
-
modelsImportsArr.push(tagModelsImports);
|
|
938
|
-
hasAdditionalAbilityImports = hasAdditionalAbilityImports || tagHasAdditionalAbilityImports;
|
|
939
|
-
endpoints.forEach((endpoint) => {
|
|
940
|
-
const abilityAction = getAbilityAction(endpoint);
|
|
941
|
-
if (abilityAction) appAbilitiesTypeMap.set(abilityAction, /* @__PURE__ */ new Set([...appAbilitiesTypeMap.get(abilityAction) ?? [], ...getAbilitySubjectTypes(endpoint, resolver, tag)]));
|
|
942
|
-
});
|
|
943
|
-
});
|
|
944
|
-
const modelsImports = mergeImports(resolver.options, ...modelsImportsArr);
|
|
945
|
-
return {
|
|
946
|
-
appAbilitiesType: appAbilitiesTypeMap.size > 0 ? Object.fromEntries(Array.from(appAbilitiesTypeMap.entries()).map(([key, valueSet]) => [key, Array.from(valueSet)])) : void 0,
|
|
947
|
-
modelsImports,
|
|
948
|
-
hasAdditionalAbilityImports
|
|
949
|
-
};
|
|
950
|
-
};
|
|
951
|
-
/** Renders a `checkAcl(...)` call, passing the ability's conditions object only when the
|
|
952
|
-
* ability function actually expects one (i.e. the endpoint declares matching conditions). */
|
|
953
|
-
function renderAclCheckCall(resolver, endpoint, replacements, indent = "") {
|
|
954
|
-
const checkParams = getAbilityConditionsTypes(endpoint)?.map((condition) => invalidVariableNameCharactersToCamel(condition.name));
|
|
955
|
-
const paramNames = new Set(endpoint.parameters.map((param) => invalidVariableNameCharactersToCamel(param.name)));
|
|
956
|
-
const hasAllCheckParams = checkParams?.every((param) => paramNames.has(param));
|
|
957
|
-
const args = hasAbilityConditions(endpoint) && hasAllCheckParams ? `{ ${(checkParams ?? []).map((param) => {
|
|
958
|
-
const resolvedParam = replacements?.[param] ?? param;
|
|
959
|
-
return resolvedParam === param ? param : `${param}: ${resolvedParam}`;
|
|
960
|
-
}).join(", ")} } ` : "";
|
|
961
|
-
return `${indent}checkAcl(${getImportedAbilityFunctionName(endpoint, resolver.options)}(${args}));`;
|
|
962
|
-
}
|
|
963
|
-
//#endregion
|
|
964
|
-
//#region src/generators/const/endpoints.const.ts
|
|
965
|
-
const JSON_APPLICATION_FORMAT = "application/json";
|
|
966
|
-
const DEFAULT_HEADERS = {
|
|
967
|
-
"Content-Type": JSON_APPLICATION_FORMAT,
|
|
968
|
-
Accept: JSON_APPLICATION_FORMAT
|
|
969
|
-
};
|
|
970
|
-
const BODY_PARAMETER_NAME = "data";
|
|
971
|
-
const AXIOS_DEFAULT_IMPORT_NAME = "axios";
|
|
972
|
-
const AXIOS_REQUEST_CONFIG_NAME = "config";
|
|
973
|
-
const AXIOS_REQUEST_CONFIG_TYPE = "AxiosRequestConfig";
|
|
974
|
-
const NATIVE_REQUEST_CONFIG_TYPE = "TransportRequestConfig";
|
|
975
|
-
const NATIVE_RESPONSE_TYPE = "TransportResponse";
|
|
976
|
-
const AXIOS_IMPORT = {
|
|
977
|
-
defaultImport: AXIOS_DEFAULT_IMPORT_NAME,
|
|
978
|
-
bindings: [],
|
|
979
|
-
typeBindings: [AXIOS_REQUEST_CONFIG_TYPE],
|
|
980
|
-
from: "axios"
|
|
981
|
-
};
|
|
982
|
-
function getRequestConfigTypeName(restClient) {
|
|
983
|
-
return restClient === "native" ? NATIVE_REQUEST_CONFIG_TYPE : AXIOS_REQUEST_CONFIG_TYPE;
|
|
984
|
-
}
|
|
985
|
-
//#endregion
|
|
986
|
-
//#region src/generators/utils/endpoint.utils.ts
|
|
987
|
-
const isGetEndpoint = (endpoint) => endpoint.method === openapi_types.OpenAPIV3.HttpMethods.GET;
|
|
988
|
-
const isPaginatedGetEndpoint = (endpoint, options) => isGetEndpoint(endpoint) && Object.values(options.infiniteQueryParamNames).every((infiniteQueryParam) => endpoint.parameters.some((param) => param.name === infiniteQueryParam && param.type === "Query"));
|
|
989
|
-
const isReadAllEndpoint = (endpoint, options) => endpoint.method === openapi_types.OpenAPIV3.HttpMethods.GET && !isPathSegmentParam(endpoint.pathSegments.at(-1)) && isPaginatedGetEndpoint(endpoint, options);
|
|
990
|
-
const isReadEndpoint = (endpoint, readAllEndpoint) => endpoint.method === openapi_types.OpenAPIV3.HttpMethods.GET && hasMatchingPathWithTrailingParam(endpoint, readAllEndpoint);
|
|
991
|
-
const isCreateEndpoint = (endpoint, readAllEndpoint) => endpoint.method === openapi_types.OpenAPIV3.HttpMethods.POST && hasMatchingPathWithoutTrailingParam(endpoint, readAllEndpoint);
|
|
992
|
-
const isUpdateEndpoint = (endpoint, readAllEndpoint) => [openapi_types.OpenAPIV3.HttpMethods.PUT, openapi_types.OpenAPIV3.HttpMethods.PATCH].includes(endpoint.method) && hasMatchingPathWithTrailingParam(endpoint, readAllEndpoint);
|
|
993
|
-
const isDeleteEndpoint = (endpoint, readAllEndpoint) => endpoint.method === openapi_types.OpenAPIV3.HttpMethods.DELETE && hasMatchingPathWithTrailingParam(endpoint, readAllEndpoint);
|
|
994
|
-
const isBulkDeleteEndpoint = (endpoint, readAllEndpoint) => endpoint.method === openapi_types.OpenAPIV3.HttpMethods.DELETE && hasMatchingPathWithoutTrailingParam(endpoint, readAllEndpoint);
|
|
995
|
-
const getPathSegments = (path) => path.split("/").filter(Boolean);
|
|
996
|
-
const isPathSegmentParam = (pathSegment) => pathSegment?.startsWith(":");
|
|
997
|
-
const hasMatchingPath = (endpoint, readAllEndpoint) => readAllEndpoint.pathSegments.every((segment, index) => isPathSegmentParam(segment) && isPathSegmentParam(endpoint.pathSegments[index]) || segment === endpoint.pathSegments[index]);
|
|
998
|
-
const hasMatchingPathWithoutTrailingParam = (endpoint, readAllEndpoint) => endpoint.pathSegments.length === readAllEndpoint.pathSegments.length && hasMatchingPath(endpoint, readAllEndpoint);
|
|
999
|
-
const hasMatchingPathWithTrailingParam = (endpoint, readAllEndpoint) => endpoint.pathSegments.length - 1 === readAllEndpoint.pathSegments.length && isPathSegmentParam(endpoint.pathSegments.at(-1)) && hasMatchingPath(endpoint, readAllEndpoint);
|
|
1000
|
-
//#endregion
|
|
1001
|
-
//#region src/generators/utils/query.utils.ts
|
|
1002
|
-
const isQuery = (endpoint) => isGetEndpoint(endpoint);
|
|
1003
|
-
const isMutation = (endpoint) => !isGetEndpoint(endpoint) || !!endpoint.mediaDownload;
|
|
1004
|
-
const isInfiniteQuery = (endpoint, options) => isPaginatedGetEndpoint(endpoint, options);
|
|
1005
|
-
const getDestructuredVariables = (resolver, endpoint, updateQueryEndpoints) => {
|
|
1006
|
-
const requiredUpdateQueryParams = updateQueryEndpoints.reduce((acc, updateEndpoint) => [...acc, ...mapEndpointParamsToFunctionParams(resolver, updateEndpoint, { includeOnlyRequiredParams: true }).map((param) => param.name)], []);
|
|
1007
|
-
return mapEndpointParamsToFunctionParams(resolver, endpoint, {
|
|
1008
|
-
includeOnlyRequiredParams: true,
|
|
1009
|
-
excludeBodyParam: true
|
|
1010
|
-
}).filter((param) => requiredUpdateQueryParams.includes(param.name)).map((param) => param.name);
|
|
1011
|
-
};
|
|
1012
|
-
//#endregion
|
|
1013
|
-
//#region src/generators/utils/ts.utils.ts
|
|
1014
|
-
function primitiveTypeToTsType(type) {
|
|
1015
|
-
switch (type) {
|
|
1016
|
-
case "string": return "string";
|
|
1017
|
-
case "number":
|
|
1018
|
-
case "integer": return "number";
|
|
1019
|
-
case "boolean": return "boolean";
|
|
1020
|
-
}
|
|
1021
|
-
}
|
|
1022
|
-
//#endregion
|
|
1023
|
-
//#region src/generators/utils/generate/generate.endpoints.utils.ts
|
|
1024
|
-
const endpointNameCache = /* @__PURE__ */ new WeakMap();
|
|
1025
|
-
const endpointPathCache = /* @__PURE__ */ new WeakMap();
|
|
1026
|
-
const endpointBodyCache = /* @__PURE__ */ new WeakMap();
|
|
1027
|
-
const endpointConfigCache = /* @__PURE__ */ new WeakMap();
|
|
1028
|
-
const getEndpointName = (endpoint) => {
|
|
1029
|
-
let name = endpointNameCache.get(endpoint);
|
|
1030
|
-
if (name === void 0) {
|
|
1031
|
-
name = decapitalize(snakeToCamel(endpoint.operationName));
|
|
1032
|
-
endpointNameCache.set(endpoint, name);
|
|
1033
|
-
}
|
|
1034
|
-
return name;
|
|
1035
|
-
};
|
|
1036
|
-
function getImportedEndpointName(endpoint, options) {
|
|
1037
|
-
return `${options.tsNamespaces ? `${getNamespaceName({
|
|
1038
|
-
type: "endpoints",
|
|
1039
|
-
tag: getEndpointTag(endpoint, options),
|
|
1040
|
-
options
|
|
1041
|
-
})}.` : ""}${getEndpointName(endpoint)}`;
|
|
1042
|
-
}
|
|
1043
|
-
const requiresBody = (endpoint) => endpoint.method !== openapi_types.OpenAPIV3.HttpMethods.GET;
|
|
1044
|
-
const findEndpointBody = (endpoint) => endpoint.parameters.find((param) => param.type === "Body");
|
|
1045
|
-
const getEndpointBody = (endpoint) => {
|
|
1046
|
-
if (!endpointBodyCache.has(endpoint)) endpointBodyCache.set(endpoint, findEndpointBody(endpoint));
|
|
1047
|
-
return endpointBodyCache.get(endpoint);
|
|
1048
|
-
};
|
|
1049
|
-
const hasEndpointConfig = (endpoint, resolver) => {
|
|
1050
|
-
const endpointConfig = getEndpointConfig(endpoint);
|
|
1051
|
-
const hasAxiosRequestConfig = resolver.options.axiosRequestConfig;
|
|
1052
|
-
const needsBlobConfig = endpoint.mediaDownload || endpoint.response === "z.instanceof(Blob)";
|
|
1053
|
-
return Object.keys(endpointConfig).length > 0 || hasAxiosRequestConfig || needsBlobConfig;
|
|
1054
|
-
};
|
|
1055
|
-
const getEndpointPath = (endpoint) => {
|
|
1056
|
-
let endpointPath = endpointPathCache.get(endpoint);
|
|
1057
|
-
if (endpointPath === void 0) {
|
|
1058
|
-
endpointPath = endpoint.path.replace(/:([a-zA-Z0-9_]+)/g, "${$1}");
|
|
1059
|
-
endpointPathCache.set(endpoint, endpointPath);
|
|
1060
|
-
}
|
|
1061
|
-
return endpointPath;
|
|
1062
|
-
};
|
|
1063
|
-
function mapEndpointParamsToFunctionParams(resolver, endpoint, options) {
|
|
1064
|
-
const optionalPathParams = options?.optionalPathParams ? new Set(options.optionalPathParams) : void 0;
|
|
1065
|
-
const params = endpoint.parameters.map((param) => {
|
|
1066
|
-
let type = "string";
|
|
1067
|
-
if (isNamedZodSchema(param.zodSchema)) type = getImportedZodSchemaInferedTypeName(resolver, param.zodSchema, void 0, options?.modelNamespaceTag);
|
|
1068
|
-
else if (param.parameterObject?.schema && isSchemaObject(param.parameterObject.schema)) {
|
|
1069
|
-
const openApiSchemaType = (param.parameterObject?.schema)?.type;
|
|
1070
|
-
if (openApiSchemaType && isPrimitiveType(openApiSchemaType)) type = primitiveTypeToTsType(openApiSchemaType);
|
|
1071
|
-
}
|
|
1072
|
-
return {
|
|
1073
|
-
name: invalidVariableNameCharactersToCamel(param.name),
|
|
1074
|
-
type,
|
|
1075
|
-
paramType: param.type,
|
|
1076
|
-
required: param.parameterObject?.required ?? true,
|
|
1077
|
-
parameterObject: param.parameterObject,
|
|
1078
|
-
bodyObject: param.bodyObject
|
|
1079
|
-
};
|
|
1080
|
-
});
|
|
1081
|
-
if (options?.includeFileParam && endpoint.mediaUpload) params.push({
|
|
1082
|
-
name: "file",
|
|
1083
|
-
type: "File",
|
|
1084
|
-
paramType: "Body",
|
|
1085
|
-
required: false,
|
|
1086
|
-
parameterObject: void 0,
|
|
1087
|
-
bodyObject: void 0
|
|
1088
|
-
});
|
|
1089
|
-
return params.toSorted((a, b) => {
|
|
1090
|
-
if (a.required === b.required) {
|
|
1091
|
-
const sortedParamTypes = [
|
|
1092
|
-
"Path",
|
|
1093
|
-
"Body",
|
|
1094
|
-
"Query",
|
|
1095
|
-
"Header"
|
|
1096
|
-
];
|
|
1097
|
-
return sortedParamTypes.indexOf(a.paramType) - sortedParamTypes.indexOf(b.paramType);
|
|
1098
|
-
}
|
|
1099
|
-
return a.required ? -1 : 1;
|
|
1100
|
-
}).filter((param) => (!options?.excludeBodyParam || param.name !== "data") && (!options?.excludePageParam || param.name !== resolver.options.infiniteQueryParamNames.page) && (!options?.includeOnlyRequiredParams || param.required) && (!options?.excludePathParams || param.paramType !== "Path")).map((param) => ({
|
|
1101
|
-
...param,
|
|
1102
|
-
name: options?.replacePageParam && param.name === resolver.options.infiniteQueryParamNames.page ? "pageParam" : param.name,
|
|
1103
|
-
required: param.paramType === "Path" && optionalPathParams?.has(param.name) ? false : param.required && (param.paramType === "Path" || !options?.pathParamsRequiredOnly)
|
|
1104
|
-
}));
|
|
1105
|
-
}
|
|
1106
|
-
function getEndpointConfig(endpoint) {
|
|
1107
|
-
let config = endpointConfigCache.get(endpoint);
|
|
1108
|
-
if (!config) {
|
|
1109
|
-
config = createEndpointConfig(endpoint);
|
|
1110
|
-
endpointConfigCache.set(endpoint, config);
|
|
1111
|
-
}
|
|
1112
|
-
return config;
|
|
1113
|
-
}
|
|
1114
|
-
function createEndpointConfig(endpoint) {
|
|
1115
|
-
const params = endpoint.parameters.filter((param) => param.type === "Query").map((param) => {
|
|
1116
|
-
const paramPropertyName = isValidPropertyName(param.name) ? param.name : `"${param.name}"`;
|
|
1117
|
-
const paramVariableName = invalidVariableNameCharactersToCamel(param.name);
|
|
1118
|
-
return {
|
|
1119
|
-
...param,
|
|
1120
|
-
name: paramPropertyName,
|
|
1121
|
-
value: paramVariableName
|
|
1122
|
-
};
|
|
1123
|
-
});
|
|
1124
|
-
const headers = {};
|
|
1125
|
-
if (endpoint.requestFormat !== DEFAULT_HEADERS["Content-Type"]) headers["Content-Type"] = `'${endpoint.requestFormat}'`;
|
|
1126
|
-
if (endpoint.responseFormat && endpoint.responseFormat !== DEFAULT_HEADERS.Accept) headers.Accept = `'${endpoint.responseFormat}'`;
|
|
1127
|
-
endpoint.parameters.filter((param) => param.type === "Header").forEach((param) => {
|
|
1128
|
-
headers[param.name] = invalidVariableNameCharactersToCamel(param.name);
|
|
1129
|
-
});
|
|
1130
|
-
return {
|
|
1131
|
-
...params.length > 0 ? { params } : {},
|
|
1132
|
-
...Object.keys(headers).length ? { headers } : {}
|
|
1133
|
-
};
|
|
1134
|
-
}
|
|
1135
|
-
/** Renders the body of a media-upload mutationFn: call the endpoint (without the file arg) to
|
|
1136
|
-
* get upload instructions, then upload the file itself to the returned URL. Shared between
|
|
1137
|
-
* renderMutation (*.queries.ts) and renderMutationContent (*.configs.ts / builderConfigs) so
|
|
1138
|
-
* both mutation paths stay in sync. Lines are relative to the caller's own indent. */
|
|
1139
|
-
function renderMediaUploadMutationBody({ resolver, endpointFunction, resolvedEndpointArgs }) {
|
|
1140
|
-
return [
|
|
1141
|
-
`const uploadInstructions = await ${endpointFunction}(${resolvedEndpointArgs}${resolver.options.axiosRequestConfig ? `${resolvedEndpointArgs ? ", " : ""}${AXIOS_REQUEST_CONFIG_NAME}` : ""});`,
|
|
1142
|
-
"",
|
|
1143
|
-
"if (file && uploadInstructions.url) {",
|
|
1144
|
-
` const method = (uploadInstructions.method?.toLowerCase() ?? "put") as "put" | "post";`,
|
|
1145
|
-
" let dataToSend: File | FormData = file;",
|
|
1146
|
-
" if (method === \"post\") {",
|
|
1147
|
-
" dataToSend = new FormData();",
|
|
1148
|
-
" if (uploadInstructions.fields) {",
|
|
1149
|
-
" for (const [key, value] of uploadInstructions.fields) {",
|
|
1150
|
-
" dataToSend.append(key, value);",
|
|
1151
|
-
" }",
|
|
1152
|
-
" }",
|
|
1153
|
-
" dataToSend.append(\"file\", file);",
|
|
1154
|
-
" }",
|
|
1155
|
-
resolver.options.restClient === "native" ? " await AppRestClient.upload(uploadInstructions.url, dataToSend, {" : " await axios[method](uploadInstructions.url, dataToSend, {",
|
|
1156
|
-
resolver.options.restClient === "native" ? " headers: method === \"put\" ? { \"Content-Type\": file.type } : undefined," : " headers: {",
|
|
1157
|
-
...resolver.options.restClient === "native" ? [] : [" \"Content-Type\": file.type,", " },"],
|
|
1158
|
-
" signal: abortController?.signal,",
|
|
1159
|
-
" onUploadProgress: onUploadProgress",
|
|
1160
|
-
" ? (progressEvent) => onUploadProgress({ loaded: progressEvent.loaded, total: progressEvent.total ?? 0 })",
|
|
1161
|
-
" : undefined,",
|
|
1162
|
-
resolver.options.restClient === "native" ? " }, method);" : " });",
|
|
1163
|
-
"}",
|
|
1164
|
-
"",
|
|
1165
|
-
"return uploadInstructions;"
|
|
1166
|
-
];
|
|
1167
|
-
}
|
|
1168
|
-
//#endregion
|
|
1169
|
-
//#region src/generators/utils/generate/generate.query.utils.ts
|
|
1170
|
-
const operationNameByEndpoint = /* @__PURE__ */ new WeakMap();
|
|
1171
|
-
const capitalizedOperationNameByEndpoint = /* @__PURE__ */ new WeakMap();
|
|
1172
|
-
function getOperationName(endpoint) {
|
|
1173
|
-
let name = operationNameByEndpoint.get(endpoint);
|
|
1174
|
-
if (name === void 0) {
|
|
1175
|
-
name = snakeToCamel(endpoint.operationName);
|
|
1176
|
-
operationNameByEndpoint.set(endpoint, name);
|
|
1177
|
-
}
|
|
1178
|
-
return name;
|
|
1179
|
-
}
|
|
1180
|
-
function getCapitalizedOperationName(endpoint) {
|
|
1181
|
-
let name = capitalizedOperationNameByEndpoint.get(endpoint);
|
|
1182
|
-
if (name === void 0) {
|
|
1183
|
-
name = capitalize(getOperationName(endpoint));
|
|
1184
|
-
capitalizedOperationNameByEndpoint.set(endpoint, name);
|
|
1185
|
-
}
|
|
1186
|
-
return name;
|
|
1187
|
-
}
|
|
1188
|
-
const getQueryName = (endpoint, mutation) => {
|
|
1189
|
-
const addMutationSuffix = isQuery(endpoint) && isMutation(endpoint) && mutation;
|
|
1190
|
-
return `use${getCapitalizedOperationName(endpoint)}${addMutationSuffix ? "Mutation" : ""}`;
|
|
1191
|
-
};
|
|
1192
|
-
const getInfiniteQueryName = (endpoint) => `use${getCapitalizedOperationName(endpoint)}Infinite`;
|
|
1193
|
-
const getQueryOptionsName = (endpoint) => `${getOperationName(endpoint)}QueryOptions`;
|
|
1194
|
-
const getInfiniteQueryOptionsName = (endpoint) => `${getOperationName(endpoint)}InfiniteQueryOptions`;
|
|
1195
|
-
const getPrefetchQueryName = (endpoint) => `prefetch${getCapitalizedOperationName(endpoint)}`;
|
|
1196
|
-
const getPrefetchInfiniteQueryName = (endpoint) => `prefetch${getCapitalizedOperationName(endpoint)}Infinite`;
|
|
1197
|
-
const getImportedQueryName = (endpoint, options) => {
|
|
1198
|
-
return `${options.tsNamespaces ? `${getNamespaceName({
|
|
1199
|
-
type: "queries",
|
|
1200
|
-
tag: getEndpointTag(endpoint, options),
|
|
1201
|
-
options
|
|
1202
|
-
})}.` : ""}${getQueryName(endpoint)}`;
|
|
1203
|
-
};
|
|
1204
|
-
const getImportedInfiniteQueryName = (endpoint, options) => {
|
|
1205
|
-
return `${options.tsNamespaces ? `${getNamespaceName({
|
|
1206
|
-
type: "queries",
|
|
1207
|
-
tag: getEndpointTag(endpoint, options),
|
|
1208
|
-
options
|
|
1209
|
-
})}.` : ""}${getInfiniteQueryName(endpoint)}`;
|
|
1210
|
-
};
|
|
1211
|
-
//#endregion
|
|
1212
|
-
//#region src/generators/utils/generate/generate.imports.utils.ts
|
|
1213
|
-
function getModelsImports({ resolver, tag, zodSchemas = [], zodSchemasAsTypes = [] }) {
|
|
1214
|
-
const type = "models";
|
|
1215
|
-
const getTag = (zodSchemaName) => resolver.getTagByZodSchemaName(zodSchemaName);
|
|
1216
|
-
const zodSchemaImports = getImports({
|
|
1217
|
-
type,
|
|
1218
|
-
tag,
|
|
1219
|
-
entities: zodSchemas,
|
|
1220
|
-
getTag,
|
|
1221
|
-
getEntityName: (zodSchema) => zodSchema,
|
|
1222
|
-
options: resolver.options
|
|
1223
|
-
});
|
|
1224
|
-
const zodSchemaTypeImports = getImports({
|
|
1225
|
-
type,
|
|
1226
|
-
tag,
|
|
1227
|
-
entities: zodSchemasAsTypes,
|
|
1228
|
-
getTag,
|
|
1229
|
-
getEntityName: (zodSchema) => getZodSchemaInferedTypeName(zodSchema, resolver.options),
|
|
1230
|
-
options: resolver.options
|
|
1231
|
-
}).map((importData) => ({
|
|
1232
|
-
...importData,
|
|
1233
|
-
...resolver.options.tsNamespaces ? {} : { typeOnly: true }
|
|
1234
|
-
}));
|
|
1235
|
-
return mergeImports(resolver.options, zodSchemaImports, zodSchemaTypeImports);
|
|
1236
|
-
}
|
|
1237
|
-
function getEndpointsImports({ tag, endpoints, options }) {
|
|
1238
|
-
return getImports({
|
|
1239
|
-
type: "endpoints",
|
|
1240
|
-
tag,
|
|
1241
|
-
entities: endpoints,
|
|
1242
|
-
getTag: (endpoint) => getEndpointTag(endpoint, options),
|
|
1243
|
-
getEntityName: getEndpointName,
|
|
1244
|
-
options
|
|
1245
|
-
});
|
|
1246
|
-
}
|
|
1247
|
-
function getQueriesImports({ tag, endpoints, options }) {
|
|
1248
|
-
return getImports({
|
|
1249
|
-
type: "queries",
|
|
1250
|
-
tag,
|
|
1251
|
-
entities: endpoints,
|
|
1252
|
-
getTag: (endpoint) => getEndpointTag(endpoint, options),
|
|
1253
|
-
getEntityName: getQueryName,
|
|
1254
|
-
options
|
|
1255
|
-
});
|
|
1256
|
-
}
|
|
1257
|
-
function getInfiniteQueriesImports({ tag, endpoints, options }) {
|
|
1258
|
-
return getImports({
|
|
1259
|
-
type: "queries",
|
|
1260
|
-
tag,
|
|
1261
|
-
entities: endpoints,
|
|
1262
|
-
getTag: (endpoint) => getEndpointTag(endpoint, options),
|
|
1263
|
-
getEntityName: getInfiniteQueryName,
|
|
1264
|
-
options
|
|
1265
|
-
});
|
|
1266
|
-
}
|
|
1267
|
-
function getAclImports({ tag, endpoints, options }) {
|
|
1268
|
-
return getImports({
|
|
1269
|
-
type: "acl",
|
|
1270
|
-
tag,
|
|
1271
|
-
entities: endpoints,
|
|
1272
|
-
getTag: (endpoint) => getEndpointTag(endpoint, options),
|
|
1273
|
-
getEntityName: getAbilityFunctionName,
|
|
1274
|
-
options
|
|
1275
|
-
});
|
|
1276
|
-
}
|
|
1277
|
-
function getImportPath(options, fromRoot = false) {
|
|
1278
|
-
let importPath = options.tsPath;
|
|
1279
|
-
if (options.importPath === "relative") importPath = fromRoot ? "./" : "../";
|
|
1280
|
-
else if (options.importPath === "absolute") importPath = options.output;
|
|
1281
|
-
else if (new RegExp(`src/data`, "g").test(options.output)) importPath = options.output.replace(new RegExp(`.*${TEMPLATE_DATA_FILE_PATH}`, "g"), options.tsPath);
|
|
1282
|
-
return `${importPath}/`.replace(/\/\//g, "/");
|
|
1283
|
-
}
|
|
1284
|
-
function getImports({ type = "models", tag: currentTag, entities, getTag, getEntityName, options }) {
|
|
1285
|
-
const imports = /* @__PURE__ */ new Map();
|
|
1286
|
-
entities.forEach((entity) => {
|
|
1287
|
-
const tag = type === "models" && (options.modelsInCommon || options.modelsInModules) && options.splitByTags ? currentTag : getTag(entity);
|
|
1288
|
-
if (!imports.has(tag)) {
|
|
1289
|
-
const sameTagDir = currentTag === tag;
|
|
1290
|
-
imports.set(tag, {
|
|
1291
|
-
bindings: [options.tsNamespaces ? getNamespaceName({
|
|
1292
|
-
type,
|
|
1293
|
-
tag,
|
|
1294
|
-
options
|
|
1295
|
-
}) : getEntityName(entity)],
|
|
1296
|
-
from: `${sameTagDir ? "./" : getImportPath(options)}${getTagImportPath({
|
|
1297
|
-
type,
|
|
1298
|
-
tag,
|
|
1299
|
-
includeTagDir: !sameTagDir,
|
|
1300
|
-
options
|
|
1301
|
-
})}`
|
|
1302
|
-
});
|
|
1303
|
-
} else if (!options.tsNamespaces) imports.get(tag).bindings.push(getEntityName(entity));
|
|
1304
|
-
});
|
|
1305
|
-
return Array.from(imports.values());
|
|
1306
|
-
}
|
|
1307
|
-
function mergeImports(options, ...importArrs) {
|
|
1308
|
-
const merged = /* @__PURE__ */ new Map();
|
|
1309
|
-
importArrs.forEach((imports) => {
|
|
1310
|
-
imports.forEach((importItem) => {
|
|
1311
|
-
if (!merged.has(importItem.from)) merged.set(importItem.from, {
|
|
1312
|
-
...importItem,
|
|
1313
|
-
bindings: importItem.typeOnly ? [] : [...importItem.bindings],
|
|
1314
|
-
typeBindings: [...importItem.typeBindings ?? [], ...importItem.typeOnly ? importItem.bindings : []]
|
|
1315
|
-
});
|
|
1316
|
-
else {
|
|
1317
|
-
const existing = merged.get(importItem.from);
|
|
1318
|
-
if (!options.tsNamespaces && !importItem.typeOnly) existing.bindings.push(...importItem.bindings);
|
|
1319
|
-
existing.typeBindings = [
|
|
1320
|
-
...existing.typeBindings ?? [],
|
|
1321
|
-
...importItem.typeBindings ?? [],
|
|
1322
|
-
...importItem.typeOnly ? importItem.bindings : []
|
|
1323
|
-
];
|
|
1324
|
-
existing.typeOnly = false;
|
|
1325
|
-
}
|
|
1326
|
-
});
|
|
1327
|
-
});
|
|
1328
|
-
return Array.from(merged.values()).map((importItem) => ({
|
|
1329
|
-
...importItem,
|
|
1330
|
-
bindings: getUniqueArray(importItem.bindings),
|
|
1331
|
-
typeBindings: getUniqueArray(importItem.typeBindings ?? []).filter((binding) => !importItem.bindings.includes(binding)),
|
|
1332
|
-
typeOnly: Boolean(importItem.typeOnly && importItem.bindings.length === 0 && (importItem.typeBindings?.length ?? 0) > 0)
|
|
1333
|
-
}));
|
|
1334
|
-
}
|
|
1335
|
-
//#endregion
|
|
1336
|
-
//#region src/generators/utils/generate/generate.utils.ts
|
|
1337
|
-
function getFileNameWithExtension({ fileName, extension }) {
|
|
1338
|
-
return `${fileName}.${extension}`;
|
|
1339
|
-
}
|
|
1340
|
-
function getTagFileNameWithoutExtension({ type, tag, options, includeTagDir = true }) {
|
|
1341
|
-
const outputFileNameSuffix = options.configs[type].outputFileNameSuffix;
|
|
1342
|
-
if (!tag) return outputFileNameSuffix;
|
|
1343
|
-
return `${includeTagDir ? `${decapitalize(tag)}/` : ""}${decapitalize(tag)}.${outputFileNameSuffix}`;
|
|
1344
|
-
}
|
|
1345
|
-
function getTagImportPath(...args) {
|
|
1346
|
-
return getTagFileNameWithoutExtension(...args);
|
|
1347
|
-
}
|
|
1348
|
-
function getTagFileName(...args) {
|
|
1349
|
-
return `${getTagFileNameWithoutExtension(...args)}.ts`;
|
|
1350
|
-
}
|
|
1351
|
-
function getAppRestClientImportPath(options) {
|
|
1352
|
-
if (options.restClientImportPath === DEFAULT_GENERATE_OPTIONS.restClientImportPath) return `${getImportPath(options)}${APP_REST_CLIENT_FILE.fileName}`;
|
|
1353
|
-
return options.restClientImportPath;
|
|
1354
|
-
}
|
|
1355
|
-
function getQueryModulesImportPath(options) {
|
|
1356
|
-
return `${getImportPath(options)}${QUERY_MODULES_FILE.fileName}`;
|
|
1357
|
-
}
|
|
1358
|
-
function getQueryTypesImportPath(options) {
|
|
1359
|
-
return options.queryTypesImportPath;
|
|
1360
|
-
}
|
|
1361
|
-
//#endregion
|
|
1362
|
-
Object.defineProperty(exports, "ALLOWED_METHODS", {
|
|
1363
|
-
enumerable: true,
|
|
1364
|
-
get: function() {
|
|
1365
|
-
return ALLOWED_METHODS;
|
|
1366
|
-
}
|
|
1367
|
-
});
|
|
1368
|
-
Object.defineProperty(exports, "ALLOWED_PATH_IN", {
|
|
1369
|
-
enumerable: true,
|
|
1370
|
-
get: function() {
|
|
1371
|
-
return ALLOWED_PATH_IN;
|
|
1372
|
-
}
|
|
1373
|
-
});
|
|
1374
|
-
Object.defineProperty(exports, "ANY_SCHEMA", {
|
|
1375
|
-
enumerable: true,
|
|
1376
|
-
get: function() {
|
|
1377
|
-
return ANY_SCHEMA;
|
|
1378
|
-
}
|
|
1379
|
-
});
|
|
1380
|
-
Object.defineProperty(exports, "APP_REST_CLIENT_FILE", {
|
|
1381
|
-
enumerable: true,
|
|
1382
|
-
get: function() {
|
|
1383
|
-
return APP_REST_CLIENT_FILE;
|
|
1384
|
-
}
|
|
1385
|
-
});
|
|
1386
|
-
Object.defineProperty(exports, "APP_REST_CLIENT_NAME", {
|
|
1387
|
-
enumerable: true,
|
|
1388
|
-
get: function() {
|
|
1389
|
-
return APP_REST_CLIENT_NAME;
|
|
1390
|
-
}
|
|
1391
|
-
});
|
|
1392
|
-
Object.defineProperty(exports, "AXIOS_DEFAULT_IMPORT_NAME", {
|
|
1393
|
-
enumerable: true,
|
|
1394
|
-
get: function() {
|
|
1395
|
-
return AXIOS_DEFAULT_IMPORT_NAME;
|
|
1396
|
-
}
|
|
1397
|
-
});
|
|
1398
|
-
Object.defineProperty(exports, "AXIOS_IMPORT", {
|
|
1399
|
-
enumerable: true,
|
|
1400
|
-
get: function() {
|
|
1401
|
-
return AXIOS_IMPORT;
|
|
1402
|
-
}
|
|
1403
|
-
});
|
|
1404
|
-
Object.defineProperty(exports, "AXIOS_REQUEST_CONFIG_NAME", {
|
|
1405
|
-
enumerable: true,
|
|
1406
|
-
get: function() {
|
|
1407
|
-
return AXIOS_REQUEST_CONFIG_NAME;
|
|
1408
|
-
}
|
|
1409
|
-
});
|
|
1410
|
-
Object.defineProperty(exports, "AXIOS_REQUEST_CONFIG_TYPE", {
|
|
1411
|
-
enumerable: true,
|
|
1412
|
-
get: function() {
|
|
1413
|
-
return AXIOS_REQUEST_CONFIG_TYPE;
|
|
1414
|
-
}
|
|
1415
|
-
});
|
|
1416
|
-
Object.defineProperty(exports, "BLOB_SCHEMA", {
|
|
1417
|
-
enumerable: true,
|
|
1418
|
-
get: function() {
|
|
1419
|
-
return BLOB_SCHEMA;
|
|
1420
|
-
}
|
|
1421
|
-
});
|
|
1422
|
-
Object.defineProperty(exports, "BODY_PARAMETER_NAME", {
|
|
1423
|
-
enumerable: true,
|
|
1424
|
-
get: function() {
|
|
1425
|
-
return BODY_PARAMETER_NAME;
|
|
1426
|
-
}
|
|
1427
|
-
});
|
|
1428
|
-
Object.defineProperty(exports, "BUILDERS_UTILS", {
|
|
1429
|
-
enumerable: true,
|
|
1430
|
-
get: function() {
|
|
1431
|
-
return BUILDERS_UTILS;
|
|
1432
|
-
}
|
|
1433
|
-
});
|
|
1434
|
-
Object.defineProperty(exports, "CONFIG_PACKAGE_IMPORT_PATH", {
|
|
1435
|
-
enumerable: true,
|
|
1436
|
-
get: function() {
|
|
1437
|
-
return CONFIG_PACKAGE_IMPORT_PATH;
|
|
1438
|
-
}
|
|
1439
|
-
});
|
|
1440
|
-
Object.defineProperty(exports, "DATETIME_SCHEMA", {
|
|
1441
|
-
enumerable: true,
|
|
1442
|
-
get: function() {
|
|
1443
|
-
return DATETIME_SCHEMA;
|
|
1444
|
-
}
|
|
1445
|
-
});
|
|
1446
|
-
Object.defineProperty(exports, "DEFAULT_GENERATE_OPTIONS", {
|
|
1447
|
-
enumerable: true,
|
|
1448
|
-
get: function() {
|
|
1449
|
-
return DEFAULT_GENERATE_OPTIONS;
|
|
1450
|
-
}
|
|
1451
|
-
});
|
|
1452
|
-
Object.defineProperty(exports, "DOMAIN_ERRORS_FILE", {
|
|
1453
|
-
enumerable: true,
|
|
1454
|
-
get: function() {
|
|
1455
|
-
return DOMAIN_ERRORS_FILE;
|
|
1456
|
-
}
|
|
1457
|
-
});
|
|
1458
|
-
Object.defineProperty(exports, "EMAIL_SCHEMA", {
|
|
1459
|
-
enumerable: true,
|
|
1460
|
-
get: function() {
|
|
1461
|
-
return EMAIL_SCHEMA;
|
|
1462
|
-
}
|
|
1463
|
-
});
|
|
1464
|
-
Object.defineProperty(exports, "ENUM_SCHEMA", {
|
|
1465
|
-
enumerable: true,
|
|
1466
|
-
get: function() {
|
|
1467
|
-
return ENUM_SCHEMA;
|
|
1468
|
-
}
|
|
1469
|
-
});
|
|
1470
|
-
Object.defineProperty(exports, "INT_SCHEMA", {
|
|
1471
|
-
enumerable: true,
|
|
1472
|
-
get: function() {
|
|
1473
|
-
return INT_SCHEMA;
|
|
1474
|
-
}
|
|
1475
|
-
});
|
|
1476
|
-
Object.defineProperty(exports, "JSON_APPLICATION_FORMAT", {
|
|
1477
|
-
enumerable: true,
|
|
1478
|
-
get: function() {
|
|
1479
|
-
return JSON_APPLICATION_FORMAT;
|
|
1480
|
-
}
|
|
1481
|
-
});
|
|
1482
|
-
Object.defineProperty(exports, "MUTATION_EFFECTS", {
|
|
1483
|
-
enumerable: true,
|
|
1484
|
-
get: function() {
|
|
1485
|
-
return MUTATION_EFFECTS;
|
|
1486
|
-
}
|
|
1487
|
-
});
|
|
1488
|
-
Object.defineProperty(exports, "NATIVE_PACKAGE_IMPORT_PATH", {
|
|
1489
|
-
enumerable: true,
|
|
1490
|
-
get: function() {
|
|
1491
|
-
return NATIVE_PACKAGE_IMPORT_PATH;
|
|
1492
|
-
}
|
|
1493
|
-
});
|
|
1494
|
-
Object.defineProperty(exports, "NATIVE_RESPONSE_TYPE", {
|
|
1495
|
-
enumerable: true,
|
|
1496
|
-
get: function() {
|
|
1497
|
-
return NATIVE_RESPONSE_TYPE;
|
|
1498
|
-
}
|
|
1499
|
-
});
|
|
1500
|
-
Object.defineProperty(exports, "NUMBER_SCHEMA", {
|
|
1501
|
-
enumerable: true,
|
|
1502
|
-
get: function() {
|
|
1503
|
-
return NUMBER_SCHEMA;
|
|
1504
|
-
}
|
|
1505
|
-
});
|
|
1506
|
-
Object.defineProperty(exports, "PACKAGE_IMPORT_PATH", {
|
|
1507
|
-
enumerable: true,
|
|
1508
|
-
get: function() {
|
|
1509
|
-
return PACKAGE_IMPORT_PATH;
|
|
1510
|
-
}
|
|
1511
|
-
});
|
|
1512
|
-
Object.defineProperty(exports, "Profiler", {
|
|
1513
|
-
enumerable: true,
|
|
1514
|
-
get: function() {
|
|
1515
|
-
return Profiler;
|
|
1516
|
-
}
|
|
1517
|
-
});
|
|
1518
|
-
Object.defineProperty(exports, "QUERY_MODULES_FILE", {
|
|
1519
|
-
enumerable: true,
|
|
1520
|
-
get: function() {
|
|
1521
|
-
return QUERY_MODULES_FILE;
|
|
1522
|
-
}
|
|
1523
|
-
});
|
|
1524
|
-
Object.defineProperty(exports, "QUERY_MODULE_ENUM", {
|
|
1525
|
-
enumerable: true,
|
|
1526
|
-
get: function() {
|
|
1527
|
-
return QUERY_MODULE_ENUM;
|
|
1528
|
-
}
|
|
1529
|
-
});
|
|
1530
|
-
Object.defineProperty(exports, "QUERY_OPTIONS_TYPES", {
|
|
1531
|
-
enumerable: true,
|
|
1532
|
-
get: function() {
|
|
1533
|
-
return QUERY_OPTIONS_TYPES;
|
|
1534
|
-
}
|
|
1535
|
-
});
|
|
1536
|
-
Object.defineProperty(exports, "REST_PACKAGE_IMPORT_PATH", {
|
|
1537
|
-
enumerable: true,
|
|
1538
|
-
get: function() {
|
|
1539
|
-
return REST_PACKAGE_IMPORT_PATH;
|
|
1540
|
-
}
|
|
1541
|
-
});
|
|
1542
|
-
Object.defineProperty(exports, "STRING_SCHEMA", {
|
|
1543
|
-
enumerable: true,
|
|
1544
|
-
get: function() {
|
|
1545
|
-
return STRING_SCHEMA;
|
|
1546
|
-
}
|
|
1547
|
-
});
|
|
1548
|
-
Object.defineProperty(exports, "URL_SCHEMA", {
|
|
1549
|
-
enumerable: true,
|
|
1550
|
-
get: function() {
|
|
1551
|
-
return URL_SCHEMA;
|
|
1552
|
-
}
|
|
1553
|
-
});
|
|
1554
|
-
Object.defineProperty(exports, "UUID_SCHEMA", {
|
|
1555
|
-
enumerable: true,
|
|
1556
|
-
get: function() {
|
|
1557
|
-
return UUID_SCHEMA;
|
|
1558
|
-
}
|
|
1559
|
-
});
|
|
1560
|
-
Object.defineProperty(exports, "VOID_SCHEMA", {
|
|
1561
|
-
enumerable: true,
|
|
1562
|
-
get: function() {
|
|
1563
|
-
return VOID_SCHEMA;
|
|
1564
|
-
}
|
|
1565
|
-
});
|
|
1566
|
-
Object.defineProperty(exports, "ZOD_EXTENDED", {
|
|
1567
|
-
enumerable: true,
|
|
1568
|
-
get: function() {
|
|
1569
|
-
return ZOD_EXTENDED;
|
|
1570
|
-
}
|
|
1571
|
-
});
|
|
1572
|
-
Object.defineProperty(exports, "ZOD_IMPORT", {
|
|
1573
|
-
enumerable: true,
|
|
1574
|
-
get: function() {
|
|
1575
|
-
return ZOD_IMPORT;
|
|
1576
|
-
}
|
|
1577
|
-
});
|
|
1578
|
-
Object.defineProperty(exports, "__toESM", {
|
|
1579
|
-
enumerable: true,
|
|
1580
|
-
get: function() {
|
|
1581
|
-
return __toESM;
|
|
1582
|
-
}
|
|
1583
|
-
});
|
|
1584
|
-
Object.defineProperty(exports, "autocorrectRef", {
|
|
1585
|
-
enumerable: true,
|
|
1586
|
-
get: function() {
|
|
1587
|
-
return autocorrectRef;
|
|
1588
|
-
}
|
|
1589
|
-
});
|
|
1590
|
-
Object.defineProperty(exports, "camelToSpaceSeparated", {
|
|
1591
|
-
enumerable: true,
|
|
1592
|
-
get: function() {
|
|
1593
|
-
return camelToSpaceSeparated;
|
|
1594
|
-
}
|
|
1595
|
-
});
|
|
1596
|
-
Object.defineProperty(exports, "capitalize", {
|
|
1597
|
-
enumerable: true,
|
|
1598
|
-
get: function() {
|
|
1599
|
-
return capitalize;
|
|
1600
|
-
}
|
|
1601
|
-
});
|
|
1602
|
-
Object.defineProperty(exports, "compileNativeData", {
|
|
1603
|
-
enumerable: true,
|
|
1604
|
-
get: function() {
|
|
1605
|
-
return compileNativeData;
|
|
1606
|
-
}
|
|
1607
|
-
});
|
|
1608
|
-
Object.defineProperty(exports, "decapitalize", {
|
|
1609
|
-
enumerable: true,
|
|
1610
|
-
get: function() {
|
|
1611
|
-
return decapitalize;
|
|
1612
|
-
}
|
|
1613
|
-
});
|
|
1614
|
-
Object.defineProperty(exports, "deepMerge", {
|
|
1615
|
-
enumerable: true,
|
|
1616
|
-
get: function() {
|
|
1617
|
-
return deepMerge;
|
|
1618
|
-
}
|
|
1619
|
-
});
|
|
1620
|
-
Object.defineProperty(exports, "escapeControlCharacters", {
|
|
1621
|
-
enumerable: true,
|
|
1622
|
-
get: function() {
|
|
1623
|
-
return escapeControlCharacters;
|
|
1624
|
-
}
|
|
1625
|
-
});
|
|
1626
|
-
Object.defineProperty(exports, "formatTag", {
|
|
1627
|
-
enumerable: true,
|
|
1628
|
-
get: function() {
|
|
1629
|
-
return formatTag;
|
|
1630
|
-
}
|
|
1631
|
-
});
|
|
1632
|
-
Object.defineProperty(exports, "getAbilityAction", {
|
|
1633
|
-
enumerable: true,
|
|
1634
|
-
get: function() {
|
|
1635
|
-
return getAbilityAction;
|
|
1636
|
-
}
|
|
1637
|
-
});
|
|
1638
|
-
Object.defineProperty(exports, "getAbilityConditionType", {
|
|
1639
|
-
enumerable: true,
|
|
1640
|
-
get: function() {
|
|
1641
|
-
return getAbilityConditionType;
|
|
1642
|
-
}
|
|
1643
|
-
});
|
|
1644
|
-
Object.defineProperty(exports, "getAbilityConditionsTypes", {
|
|
1645
|
-
enumerable: true,
|
|
1646
|
-
get: function() {
|
|
1647
|
-
return getAbilityConditionsTypes;
|
|
1648
|
-
}
|
|
1649
|
-
});
|
|
1650
|
-
Object.defineProperty(exports, "getAbilityDescription", {
|
|
1651
|
-
enumerable: true,
|
|
1652
|
-
get: function() {
|
|
1653
|
-
return getAbilityDescription;
|
|
1654
|
-
}
|
|
1655
|
-
});
|
|
1656
|
-
Object.defineProperty(exports, "getAbilityFunctionName", {
|
|
1657
|
-
enumerable: true,
|
|
1658
|
-
get: function() {
|
|
1659
|
-
return getAbilityFunctionName;
|
|
1660
|
-
}
|
|
1661
|
-
});
|
|
1662
|
-
Object.defineProperty(exports, "getAbilitySubject", {
|
|
1663
|
-
enumerable: true,
|
|
1664
|
-
get: function() {
|
|
1665
|
-
return getAbilitySubject;
|
|
1666
|
-
}
|
|
1667
|
-
});
|
|
1668
|
-
Object.defineProperty(exports, "getAbilitySubjectTypes", {
|
|
1669
|
-
enumerable: true,
|
|
1670
|
-
get: function() {
|
|
1671
|
-
return getAbilitySubjectTypes;
|
|
1672
|
-
}
|
|
1673
|
-
});
|
|
1674
|
-
Object.defineProperty(exports, "getAclData", {
|
|
1675
|
-
enumerable: true,
|
|
1676
|
-
get: function() {
|
|
1677
|
-
return getAclData;
|
|
1678
|
-
}
|
|
1679
|
-
});
|
|
1680
|
-
Object.defineProperty(exports, "getAclImports", {
|
|
1681
|
-
enumerable: true,
|
|
1682
|
-
get: function() {
|
|
1683
|
-
return getAclImports;
|
|
1684
|
-
}
|
|
1685
|
-
});
|
|
1686
|
-
Object.defineProperty(exports, "getAppAbilitiesType", {
|
|
1687
|
-
enumerable: true,
|
|
1688
|
-
get: function() {
|
|
1689
|
-
return getAppAbilitiesType;
|
|
1690
|
-
}
|
|
1691
|
-
});
|
|
1692
|
-
Object.defineProperty(exports, "getAppRestClientImportPath", {
|
|
1693
|
-
enumerable: true,
|
|
1694
|
-
get: function() {
|
|
1695
|
-
return getAppRestClientImportPath;
|
|
1696
|
-
}
|
|
1697
|
-
});
|
|
1698
|
-
Object.defineProperty(exports, "getBodyZodSchemaName", {
|
|
1699
|
-
enumerable: true,
|
|
1700
|
-
get: function() {
|
|
1701
|
-
return getBodyZodSchemaName;
|
|
1702
|
-
}
|
|
1703
|
-
});
|
|
1704
|
-
Object.defineProperty(exports, "getDestructuredVariables", {
|
|
1705
|
-
enumerable: true,
|
|
1706
|
-
get: function() {
|
|
1707
|
-
return getDestructuredVariables;
|
|
1708
|
-
}
|
|
1709
|
-
});
|
|
1710
|
-
Object.defineProperty(exports, "getEndpointBody", {
|
|
1711
|
-
enumerable: true,
|
|
1712
|
-
get: function() {
|
|
1713
|
-
return getEndpointBody;
|
|
1714
|
-
}
|
|
1715
|
-
});
|
|
1716
|
-
Object.defineProperty(exports, "getEndpointConfig", {
|
|
1717
|
-
enumerable: true,
|
|
1718
|
-
get: function() {
|
|
1719
|
-
return getEndpointConfig;
|
|
1720
|
-
}
|
|
1721
|
-
});
|
|
1722
|
-
Object.defineProperty(exports, "getEndpointName", {
|
|
1723
|
-
enumerable: true,
|
|
1724
|
-
get: function() {
|
|
1725
|
-
return getEndpointName;
|
|
1726
|
-
}
|
|
1727
|
-
});
|
|
1728
|
-
Object.defineProperty(exports, "getEndpointPath", {
|
|
1729
|
-
enumerable: true,
|
|
1730
|
-
get: function() {
|
|
1731
|
-
return getEndpointPath;
|
|
1732
|
-
}
|
|
1733
|
-
});
|
|
1734
|
-
Object.defineProperty(exports, "getEndpointTag", {
|
|
1735
|
-
enumerable: true,
|
|
1736
|
-
get: function() {
|
|
1737
|
-
return getEndpointTag;
|
|
1738
|
-
}
|
|
1739
|
-
});
|
|
1740
|
-
Object.defineProperty(exports, "getEndpointsImports", {
|
|
1741
|
-
enumerable: true,
|
|
1742
|
-
get: function() {
|
|
1743
|
-
return getEndpointsImports;
|
|
1744
|
-
}
|
|
1745
|
-
});
|
|
1746
|
-
Object.defineProperty(exports, "getEnumZodSchemaName", {
|
|
1747
|
-
enumerable: true,
|
|
1748
|
-
get: function() {
|
|
1749
|
-
return getEnumZodSchemaName;
|
|
1750
|
-
}
|
|
1751
|
-
});
|
|
1752
|
-
Object.defineProperty(exports, "getFileNameWithExtension", {
|
|
1753
|
-
enumerable: true,
|
|
1754
|
-
get: function() {
|
|
1755
|
-
return getFileNameWithExtension;
|
|
1756
|
-
}
|
|
1757
|
-
});
|
|
1758
|
-
Object.defineProperty(exports, "getImportPath", {
|
|
1759
|
-
enumerable: true,
|
|
1760
|
-
get: function() {
|
|
1761
|
-
return getImportPath;
|
|
1762
|
-
}
|
|
1763
|
-
});
|
|
1764
|
-
Object.defineProperty(exports, "getImportedAbilityFunctionName", {
|
|
1765
|
-
enumerable: true,
|
|
1766
|
-
get: function() {
|
|
1767
|
-
return getImportedAbilityFunctionName;
|
|
1768
|
-
}
|
|
1769
|
-
});
|
|
1770
|
-
Object.defineProperty(exports, "getImportedEndpointName", {
|
|
1771
|
-
enumerable: true,
|
|
1772
|
-
get: function() {
|
|
1773
|
-
return getImportedEndpointName;
|
|
1774
|
-
}
|
|
1775
|
-
});
|
|
1776
|
-
Object.defineProperty(exports, "getImportedInfiniteQueryName", {
|
|
1777
|
-
enumerable: true,
|
|
1778
|
-
get: function() {
|
|
1779
|
-
return getImportedInfiniteQueryName;
|
|
1780
|
-
}
|
|
1781
|
-
});
|
|
1782
|
-
Object.defineProperty(exports, "getImportedQueryName", {
|
|
1783
|
-
enumerable: true,
|
|
1784
|
-
get: function() {
|
|
1785
|
-
return getImportedQueryName;
|
|
1786
|
-
}
|
|
1787
|
-
});
|
|
1788
|
-
Object.defineProperty(exports, "getImportedZodSchemaInferedTypeName", {
|
|
1789
|
-
enumerable: true,
|
|
1790
|
-
get: function() {
|
|
1791
|
-
return getImportedZodSchemaInferedTypeName;
|
|
1792
|
-
}
|
|
1793
|
-
});
|
|
1794
|
-
Object.defineProperty(exports, "getImportedZodSchemaName", {
|
|
1795
|
-
enumerable: true,
|
|
1796
|
-
get: function() {
|
|
1797
|
-
return getImportedZodSchemaName;
|
|
1798
|
-
}
|
|
1799
|
-
});
|
|
1800
|
-
Object.defineProperty(exports, "getInfiniteQueriesImports", {
|
|
1801
|
-
enumerable: true,
|
|
1802
|
-
get: function() {
|
|
1803
|
-
return getInfiniteQueriesImports;
|
|
1804
|
-
}
|
|
1805
|
-
});
|
|
1806
|
-
Object.defineProperty(exports, "getInfiniteQueryName", {
|
|
1807
|
-
enumerable: true,
|
|
1808
|
-
get: function() {
|
|
1809
|
-
return getInfiniteQueryName;
|
|
1810
|
-
}
|
|
1811
|
-
});
|
|
1812
|
-
Object.defineProperty(exports, "getInfiniteQueryOptionsName", {
|
|
1813
|
-
enumerable: true,
|
|
1814
|
-
get: function() {
|
|
1815
|
-
return getInfiniteQueryOptionsName;
|
|
1816
|
-
}
|
|
1817
|
-
});
|
|
1818
|
-
Object.defineProperty(exports, "getModelsImports", {
|
|
1819
|
-
enumerable: true,
|
|
1820
|
-
get: function() {
|
|
1821
|
-
return getModelsImports;
|
|
1822
|
-
}
|
|
1823
|
-
});
|
|
1824
|
-
Object.defineProperty(exports, "getMostCommonAdjacentCombinationSplit", {
|
|
1825
|
-
enumerable: true,
|
|
1826
|
-
get: function() {
|
|
1827
|
-
return getMostCommonAdjacentCombinationSplit;
|
|
1828
|
-
}
|
|
1829
|
-
});
|
|
1830
|
-
Object.defineProperty(exports, "getNamespaceName", {
|
|
1831
|
-
enumerable: true,
|
|
1832
|
-
get: function() {
|
|
1833
|
-
return getNamespaceName;
|
|
1834
|
-
}
|
|
1835
|
-
});
|
|
1836
|
-
Object.defineProperty(exports, "getOperationTag", {
|
|
1837
|
-
enumerable: true,
|
|
1838
|
-
get: function() {
|
|
1839
|
-
return getOperationTag;
|
|
1840
|
-
}
|
|
1841
|
-
});
|
|
1842
|
-
Object.defineProperty(exports, "getOutputFileName", {
|
|
1843
|
-
enumerable: true,
|
|
1844
|
-
get: function() {
|
|
1845
|
-
return getOutputFileName;
|
|
1846
|
-
}
|
|
1847
|
-
});
|
|
1848
|
-
Object.defineProperty(exports, "getParamZodSchemaName", {
|
|
1849
|
-
enumerable: true,
|
|
1850
|
-
get: function() {
|
|
1851
|
-
return getParamZodSchemaName;
|
|
1852
|
-
}
|
|
1853
|
-
});
|
|
1854
|
-
Object.defineProperty(exports, "getParameterEnumNames", {
|
|
1855
|
-
enumerable: true,
|
|
1856
|
-
get: function() {
|
|
1857
|
-
return getParameterEnumNames;
|
|
1858
|
-
}
|
|
1859
|
-
});
|
|
1860
|
-
Object.defineProperty(exports, "getPathSegments", {
|
|
1861
|
-
enumerable: true,
|
|
1862
|
-
get: function() {
|
|
1863
|
-
return getPathSegments;
|
|
1864
|
-
}
|
|
1865
|
-
});
|
|
1866
|
-
Object.defineProperty(exports, "getPrefetchInfiniteQueryName", {
|
|
1867
|
-
enumerable: true,
|
|
1868
|
-
get: function() {
|
|
1869
|
-
return getPrefetchInfiniteQueryName;
|
|
1870
|
-
}
|
|
1871
|
-
});
|
|
1872
|
-
Object.defineProperty(exports, "getPrefetchQueryName", {
|
|
1873
|
-
enumerable: true,
|
|
1874
|
-
get: function() {
|
|
1875
|
-
return getPrefetchQueryName;
|
|
1876
|
-
}
|
|
1877
|
-
});
|
|
1878
|
-
Object.defineProperty(exports, "getQueriesImports", {
|
|
1879
|
-
enumerable: true,
|
|
1880
|
-
get: function() {
|
|
1881
|
-
return getQueriesImports;
|
|
1882
|
-
}
|
|
1883
|
-
});
|
|
1884
|
-
Object.defineProperty(exports, "getQueryModulesImportPath", {
|
|
1885
|
-
enumerable: true,
|
|
1886
|
-
get: function() {
|
|
1887
|
-
return getQueryModulesImportPath;
|
|
1888
|
-
}
|
|
1889
|
-
});
|
|
1890
|
-
Object.defineProperty(exports, "getQueryName", {
|
|
1891
|
-
enumerable: true,
|
|
1892
|
-
get: function() {
|
|
1893
|
-
return getQueryName;
|
|
1894
|
-
}
|
|
1895
|
-
});
|
|
1896
|
-
Object.defineProperty(exports, "getQueryOptionsName", {
|
|
1897
|
-
enumerable: true,
|
|
1898
|
-
get: function() {
|
|
1899
|
-
return getQueryOptionsName;
|
|
1900
|
-
}
|
|
1901
|
-
});
|
|
1902
|
-
Object.defineProperty(exports, "getQueryTypesImportPath", {
|
|
1903
|
-
enumerable: true,
|
|
1904
|
-
get: function() {
|
|
1905
|
-
return getQueryTypesImportPath;
|
|
1906
|
-
}
|
|
1907
|
-
});
|
|
1908
|
-
Object.defineProperty(exports, "getRequestConfigTypeName", {
|
|
1909
|
-
enumerable: true,
|
|
1910
|
-
get: function() {
|
|
1911
|
-
return getRequestConfigTypeName;
|
|
1912
|
-
}
|
|
1913
|
-
});
|
|
1914
|
-
Object.defineProperty(exports, "getResponseZodSchemaName", {
|
|
1915
|
-
enumerable: true,
|
|
1916
|
-
get: function() {
|
|
1917
|
-
return getResponseZodSchemaName;
|
|
1918
|
-
}
|
|
1919
|
-
});
|
|
1920
|
-
Object.defineProperty(exports, "getSchemaDescriptions", {
|
|
1921
|
-
enumerable: true,
|
|
1922
|
-
get: function() {
|
|
1923
|
-
return getSchemaDescriptions;
|
|
1924
|
-
}
|
|
1925
|
-
});
|
|
1926
|
-
Object.defineProperty(exports, "getSchemaNameByRef", {
|
|
1927
|
-
enumerable: true,
|
|
1928
|
-
get: function() {
|
|
1929
|
-
return getSchemaNameByRef;
|
|
1930
|
-
}
|
|
1931
|
-
});
|
|
1932
|
-
Object.defineProperty(exports, "getSchemaRef", {
|
|
1933
|
-
enumerable: true,
|
|
1934
|
-
get: function() {
|
|
1935
|
-
return getSchemaRef;
|
|
1936
|
-
}
|
|
1937
|
-
});
|
|
1938
|
-
Object.defineProperty(exports, "getTagFileName", {
|
|
1939
|
-
enumerable: true,
|
|
1940
|
-
get: function() {
|
|
1941
|
-
return getTagFileName;
|
|
1942
|
-
}
|
|
1943
|
-
});
|
|
1944
|
-
Object.defineProperty(exports, "getTagImportPath", {
|
|
1945
|
-
enumerable: true,
|
|
1946
|
-
get: function() {
|
|
1947
|
-
return getTagImportPath;
|
|
1948
|
-
}
|
|
1949
|
-
});
|
|
1950
|
-
Object.defineProperty(exports, "getUniqueArray", {
|
|
1951
|
-
enumerable: true,
|
|
1952
|
-
get: function() {
|
|
1953
|
-
return getUniqueArray;
|
|
1954
|
-
}
|
|
1955
|
-
});
|
|
1956
|
-
Object.defineProperty(exports, "getZodSchemaDescription", {
|
|
1957
|
-
enumerable: true,
|
|
1958
|
-
get: function() {
|
|
1959
|
-
return getZodSchemaDescription;
|
|
1960
|
-
}
|
|
1961
|
-
});
|
|
1962
|
-
Object.defineProperty(exports, "getZodSchemaInferedTypeName", {
|
|
1963
|
-
enumerable: true,
|
|
1964
|
-
get: function() {
|
|
1965
|
-
return getZodSchemaInferedTypeName;
|
|
1966
|
-
}
|
|
1967
|
-
});
|
|
1968
|
-
Object.defineProperty(exports, "getZodSchemaName", {
|
|
1969
|
-
enumerable: true,
|
|
1970
|
-
get: function() {
|
|
1971
|
-
return getZodSchemaName;
|
|
1972
|
-
}
|
|
1973
|
-
});
|
|
1974
|
-
Object.defineProperty(exports, "getZodSchemaOperationName", {
|
|
1975
|
-
enumerable: true,
|
|
1976
|
-
get: function() {
|
|
1977
|
-
return getZodSchemaOperationName;
|
|
1978
|
-
}
|
|
1979
|
-
});
|
|
1980
|
-
Object.defineProperty(exports, "getZodSchemaPropertyDescriptions", {
|
|
1981
|
-
enumerable: true,
|
|
1982
|
-
get: function() {
|
|
1983
|
-
return getZodSchemaPropertyDescriptions;
|
|
1984
|
-
}
|
|
1985
|
-
});
|
|
1986
|
-
Object.defineProperty(exports, "getZodSchemaType", {
|
|
1987
|
-
enumerable: true,
|
|
1988
|
-
get: function() {
|
|
1989
|
-
return getZodSchemaType;
|
|
1990
|
-
}
|
|
1991
|
-
});
|
|
1992
|
-
Object.defineProperty(exports, "hasAbilityConditions", {
|
|
1993
|
-
enumerable: true,
|
|
1994
|
-
get: function() {
|
|
1995
|
-
return hasAbilityConditions;
|
|
1996
|
-
}
|
|
1997
|
-
});
|
|
1998
|
-
Object.defineProperty(exports, "hasEndpointConfig", {
|
|
1999
|
-
enumerable: true,
|
|
2000
|
-
get: function() {
|
|
2001
|
-
return hasEndpointConfig;
|
|
2002
|
-
}
|
|
2003
|
-
});
|
|
2004
|
-
Object.defineProperty(exports, "inferRequiredSchema", {
|
|
2005
|
-
enumerable: true,
|
|
2006
|
-
get: function() {
|
|
2007
|
-
return inferRequiredSchema;
|
|
2008
|
-
}
|
|
2009
|
-
});
|
|
2010
|
-
Object.defineProperty(exports, "invalidVariableNameCharactersToCamel", {
|
|
2011
|
-
enumerable: true,
|
|
2012
|
-
get: function() {
|
|
2013
|
-
return invalidVariableNameCharactersToCamel;
|
|
2014
|
-
}
|
|
2015
|
-
});
|
|
2016
|
-
Object.defineProperty(exports, "isArraySchemaObject", {
|
|
2017
|
-
enumerable: true,
|
|
2018
|
-
get: function() {
|
|
2019
|
-
return isArraySchemaObject;
|
|
2020
|
-
}
|
|
2021
|
-
});
|
|
2022
|
-
Object.defineProperty(exports, "isBulkDeleteEndpoint", {
|
|
2023
|
-
enumerable: true,
|
|
2024
|
-
get: function() {
|
|
2025
|
-
return isBulkDeleteEndpoint;
|
|
2026
|
-
}
|
|
2027
|
-
});
|
|
2028
|
-
Object.defineProperty(exports, "isCreateEndpoint", {
|
|
2029
|
-
enumerable: true,
|
|
2030
|
-
get: function() {
|
|
2031
|
-
return isCreateEndpoint;
|
|
2032
|
-
}
|
|
2033
|
-
});
|
|
2034
|
-
Object.defineProperty(exports, "isDeleteEndpoint", {
|
|
2035
|
-
enumerable: true,
|
|
2036
|
-
get: function() {
|
|
2037
|
-
return isDeleteEndpoint;
|
|
2038
|
-
}
|
|
2039
|
-
});
|
|
2040
|
-
Object.defineProperty(exports, "isEnumZodSchema", {
|
|
2041
|
-
enumerable: true,
|
|
2042
|
-
get: function() {
|
|
2043
|
-
return isEnumZodSchema;
|
|
2044
|
-
}
|
|
2045
|
-
});
|
|
2046
|
-
Object.defineProperty(exports, "isErrorStatus", {
|
|
2047
|
-
enumerable: true,
|
|
2048
|
-
get: function() {
|
|
2049
|
-
return isErrorStatus;
|
|
2050
|
-
}
|
|
2051
|
-
});
|
|
2052
|
-
Object.defineProperty(exports, "isInfiniteQuery", {
|
|
2053
|
-
enumerable: true,
|
|
2054
|
-
get: function() {
|
|
2055
|
-
return isInfiniteQuery;
|
|
2056
|
-
}
|
|
2057
|
-
});
|
|
2058
|
-
Object.defineProperty(exports, "isMainResponseStatus", {
|
|
2059
|
-
enumerable: true,
|
|
2060
|
-
get: function() {
|
|
2061
|
-
return isMainResponseStatus;
|
|
2062
|
-
}
|
|
2063
|
-
});
|
|
2064
|
-
Object.defineProperty(exports, "isMediaTypeAllowed", {
|
|
2065
|
-
enumerable: true,
|
|
2066
|
-
get: function() {
|
|
2067
|
-
return isMediaTypeAllowed;
|
|
2068
|
-
}
|
|
2069
|
-
});
|
|
2070
|
-
Object.defineProperty(exports, "isMutation", {
|
|
2071
|
-
enumerable: true,
|
|
2072
|
-
get: function() {
|
|
2073
|
-
return isMutation;
|
|
2074
|
-
}
|
|
2075
|
-
});
|
|
2076
|
-
Object.defineProperty(exports, "isNamedZodSchema", {
|
|
2077
|
-
enumerable: true,
|
|
2078
|
-
get: function() {
|
|
2079
|
-
return isNamedZodSchema;
|
|
2080
|
-
}
|
|
2081
|
-
});
|
|
2082
|
-
Object.defineProperty(exports, "isParamMediaTypeAllowed", {
|
|
2083
|
-
enumerable: true,
|
|
2084
|
-
get: function() {
|
|
2085
|
-
return isParamMediaTypeAllowed;
|
|
2086
|
-
}
|
|
2087
|
-
});
|
|
2088
|
-
Object.defineProperty(exports, "isPathExcluded", {
|
|
2089
|
-
enumerable: true,
|
|
2090
|
-
get: function() {
|
|
2091
|
-
return isPathExcluded;
|
|
2092
|
-
}
|
|
2093
|
-
});
|
|
2094
|
-
Object.defineProperty(exports, "isPathSegmentParam", {
|
|
2095
|
-
enumerable: true,
|
|
2096
|
-
get: function() {
|
|
2097
|
-
return isPathSegmentParam;
|
|
2098
|
-
}
|
|
2099
|
-
});
|
|
2100
|
-
Object.defineProperty(exports, "isPrimitiveType", {
|
|
2101
|
-
enumerable: true,
|
|
2102
|
-
get: function() {
|
|
2103
|
-
return isPrimitiveType;
|
|
2104
|
-
}
|
|
2105
|
-
});
|
|
2106
|
-
Object.defineProperty(exports, "isQuery", {
|
|
2107
|
-
enumerable: true,
|
|
2108
|
-
get: function() {
|
|
2109
|
-
return isQuery;
|
|
2110
|
-
}
|
|
2111
|
-
});
|
|
2112
|
-
Object.defineProperty(exports, "isReadAllEndpoint", {
|
|
2113
|
-
enumerable: true,
|
|
2114
|
-
get: function() {
|
|
2115
|
-
return isReadAllEndpoint;
|
|
2116
|
-
}
|
|
2117
|
-
});
|
|
2118
|
-
Object.defineProperty(exports, "isReadEndpoint", {
|
|
2119
|
-
enumerable: true,
|
|
2120
|
-
get: function() {
|
|
2121
|
-
return isReadEndpoint;
|
|
2122
|
-
}
|
|
2123
|
-
});
|
|
2124
|
-
Object.defineProperty(exports, "isReferenceObject", {
|
|
2125
|
-
enumerable: true,
|
|
2126
|
-
get: function() {
|
|
2127
|
-
return isReferenceObject;
|
|
2128
|
-
}
|
|
2129
|
-
});
|
|
2130
|
-
Object.defineProperty(exports, "isSchemaObject", {
|
|
2131
|
-
enumerable: true,
|
|
2132
|
-
get: function() {
|
|
2133
|
-
return isSchemaObject;
|
|
2134
|
-
}
|
|
2135
|
-
});
|
|
2136
|
-
Object.defineProperty(exports, "isSortingParameterObject", {
|
|
2137
|
-
enumerable: true,
|
|
2138
|
-
get: function() {
|
|
2139
|
-
return isSortingParameterObject;
|
|
2140
|
-
}
|
|
2141
|
-
});
|
|
2142
|
-
Object.defineProperty(exports, "isTagIncluded", {
|
|
2143
|
-
enumerable: true,
|
|
2144
|
-
get: function() {
|
|
2145
|
-
return isTagIncluded;
|
|
2146
|
-
}
|
|
2147
|
-
});
|
|
2148
|
-
Object.defineProperty(exports, "isUpdateEndpoint", {
|
|
2149
|
-
enumerable: true,
|
|
2150
|
-
get: function() {
|
|
2151
|
-
return isUpdateEndpoint;
|
|
2152
|
-
}
|
|
2153
|
-
});
|
|
2154
|
-
Object.defineProperty(exports, "iterateSchema", {
|
|
2155
|
-
enumerable: true,
|
|
2156
|
-
get: function() {
|
|
2157
|
-
return iterateSchema;
|
|
2158
|
-
}
|
|
2159
|
-
});
|
|
2160
|
-
Object.defineProperty(exports, "kebabToCamel", {
|
|
2161
|
-
enumerable: true,
|
|
2162
|
-
get: function() {
|
|
2163
|
-
return kebabToCamel;
|
|
2164
|
-
}
|
|
2165
|
-
});
|
|
2166
|
-
Object.defineProperty(exports, "mapEndpointParamsToFunctionParams", {
|
|
2167
|
-
enumerable: true,
|
|
2168
|
-
get: function() {
|
|
2169
|
-
return mapEndpointParamsToFunctionParams;
|
|
2170
|
-
}
|
|
2171
|
-
});
|
|
2172
|
-
Object.defineProperty(exports, "mergeImports", {
|
|
2173
|
-
enumerable: true,
|
|
2174
|
-
get: function() {
|
|
2175
|
-
return mergeImports;
|
|
2176
|
-
}
|
|
2177
|
-
});
|
|
2178
|
-
Object.defineProperty(exports, "pathParamToVariableName", {
|
|
2179
|
-
enumerable: true,
|
|
2180
|
-
get: function() {
|
|
2181
|
-
return pathParamToVariableName;
|
|
2182
|
-
}
|
|
2183
|
-
});
|
|
2184
|
-
Object.defineProperty(exports, "pathToVariableName", {
|
|
2185
|
-
enumerable: true,
|
|
2186
|
-
get: function() {
|
|
2187
|
-
return pathToVariableName;
|
|
2188
|
-
}
|
|
2189
|
-
});
|
|
2190
|
-
Object.defineProperty(exports, "pick", {
|
|
2191
|
-
enumerable: true,
|
|
2192
|
-
get: function() {
|
|
2193
|
-
return pick;
|
|
2194
|
-
}
|
|
2195
|
-
});
|
|
2196
|
-
Object.defineProperty(exports, "removeStaleGeneratedFiles", {
|
|
2197
|
-
enumerable: true,
|
|
2198
|
-
get: function() {
|
|
2199
|
-
return removeStaleGeneratedFiles;
|
|
2200
|
-
}
|
|
2201
|
-
});
|
|
2202
|
-
Object.defineProperty(exports, "removeWord", {
|
|
2203
|
-
enumerable: true,
|
|
2204
|
-
get: function() {
|
|
2205
|
-
return removeWord;
|
|
2206
|
-
}
|
|
2207
|
-
});
|
|
2208
|
-
Object.defineProperty(exports, "renderAclCheckCall", {
|
|
2209
|
-
enumerable: true,
|
|
2210
|
-
get: function() {
|
|
2211
|
-
return renderAclCheckCall;
|
|
2212
|
-
}
|
|
2213
|
-
});
|
|
2214
|
-
Object.defineProperty(exports, "renderMediaUploadMutationBody", {
|
|
2215
|
-
enumerable: true,
|
|
2216
|
-
get: function() {
|
|
2217
|
-
return renderMediaUploadMutationBody;
|
|
2218
|
-
}
|
|
2219
|
-
});
|
|
2220
|
-
Object.defineProperty(exports, "replaceHyphenatedPath", {
|
|
2221
|
-
enumerable: true,
|
|
2222
|
-
get: function() {
|
|
2223
|
-
return replaceHyphenatedPath;
|
|
2224
|
-
}
|
|
2225
|
-
});
|
|
2226
|
-
Object.defineProperty(exports, "requiresBody", {
|
|
2227
|
-
enumerable: true,
|
|
2228
|
-
get: function() {
|
|
2229
|
-
return requiresBody;
|
|
2230
|
-
}
|
|
2231
|
-
});
|
|
2232
|
-
Object.defineProperty(exports, "shouldInlineEndpointsForTag", {
|
|
2233
|
-
enumerable: true,
|
|
2234
|
-
get: function() {
|
|
2235
|
-
return shouldInlineEndpointsForTag;
|
|
2236
|
-
}
|
|
2237
|
-
});
|
|
2238
|
-
Object.defineProperty(exports, "shouldUseNativeCodegen", {
|
|
2239
|
-
enumerable: true,
|
|
2240
|
-
get: function() {
|
|
2241
|
-
return shouldUseNativeCodegen;
|
|
2242
|
-
}
|
|
2243
|
-
});
|
|
2244
|
-
Object.defineProperty(exports, "snakeToCamel", {
|
|
2245
|
-
enumerable: true,
|
|
2246
|
-
get: function() {
|
|
2247
|
-
return snakeToCamel;
|
|
2248
|
-
}
|
|
2249
|
-
});
|
|
2250
|
-
Object.defineProperty(exports, "unwrapQuotesIfNeeded", {
|
|
2251
|
-
enumerable: true,
|
|
2252
|
-
get: function() {
|
|
2253
|
-
return unwrapQuotesIfNeeded;
|
|
2254
|
-
}
|
|
2255
|
-
});
|
|
2256
|
-
Object.defineProperty(exports, "wrapWithQuotesIfNeeded", {
|
|
2257
|
-
enumerable: true,
|
|
2258
|
-
get: function() {
|
|
2259
|
-
return wrapWithQuotesIfNeeded;
|
|
2260
|
-
}
|
|
2261
|
-
});
|
|
2262
|
-
Object.defineProperty(exports, "writeGenerateFileData", {
|
|
2263
|
-
enumerable: true,
|
|
2264
|
-
get: function() {
|
|
2265
|
-
return writeGenerateFileData;
|
|
2266
|
-
}
|
|
2267
|
-
});
|