persona-community-5/.pnpm-store/v3/files/ec/8afa5412d775b38dac20d86c8727e594710214076f947fa99812dcc4b7bd14ed1de4550116b861f36d7777e054bc6cda87a88a6e9a603be24e638685357822
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

36 lines
1.0 KiB
Plaintext

'use strict';
const ts = require('../lib/ts.cjs');
const utils = require('../lib/utils.cjs');
function makeApiPathsEnum(pathsObject) {
const enumKeys = [];
const enumMetaData = [];
for (const [url, pathItemObject] of utils.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 ts.tsEnum("ApiPaths", enumKeys, enumMetaData, {
export: true
});
}
module.exports = makeApiPathsEnum;
//# sourceMappingURL=paths-enum.cjs.map