persona-community-5/.pnpm-store/v3/files/1e/a846f0ad664aeefbf8984cb9476765c70c00f6bc8a68db0af2e2ba8a981921ef27461051dab50c01d1ff0982625dec605ffb8ab7d0c491c657ab8d4221017d
rdev-worker a1d0d1bf1c
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
build: /implement-feature community-ui --requirements 'Build the React commu...
2026-02-24 08:22:30 +00:00

34 lines
1.0 KiB
Plaintext

import { tsEnum } from '../lib/ts.mjs';
import { getEntries } from '../lib/utils.mjs';
function makeApiPathsEnum(pathsObject) {
const enumKeys = [];
const enumMetaData = [];
for (const [url, pathItemObject] of getEntries(pathsObject)) {
for (const [method, operation] of Object.entries(pathItemObject)) {
if (!["get", "put", "post", "delete", "options", "head", "patch", "trace"].includes(method)) {
continue;
}
let pathName;
if (operation.operationId) {
pathName = operation.operationId;
} else {
pathName = (method + url).split("/").map((part) => {
const capitalised = part.charAt(0).toUpperCase() + part.slice(1);
return capitalised.replace(/{.*}|:.*|[^a-zA-Z\d_]+/, "");
}).join("");
}
enumKeys.push(url);
enumMetaData.push({
name: pathName
});
}
}
return tsEnum("ApiPaths", enumKeys, enumMetaData, {
export: true
});
}
export { makeApiPathsEnum as default };
//# sourceMappingURL=paths-enum.mjs.map