UNPKG

@lucidcms/core

Version:

The core of the Lucid CMS. It's responsible for spinning up the API and serving the CMS.

1 lines 1 kB
{"version":3,"file":"build-index-name.mjs","names":["constants"],"sources":["../../../../src/libs/collection/helpers/build-index-name.ts"],"sourcesContent":["import constants from \"../../../constants/constants.js\";\nimport toSafeTableName from \"./to-safe-table-name.js\";\n\n/**\n * Builds deterministic Lucid-owned index names from the table and indexed\n * columns, using the reserved prefix so migrations can safely auto-remove them.\n */\nconst buildIndexName = (props: {\n\ttableName: string;\n\tcolumns: string[];\n\ttableNameByteLimit: number | null;\n}) => {\n\tconst safeName = toSafeTableName(\n\t\t`${constants.db.generatedIndexPrefix}${[\n\t\t\tprops.tableName,\n\t\t\t...props.columns,\n\t\t].join(constants.db.nameSeparator)}`,\n\t\tprops.tableNameByteLimit,\n\t);\n\n\treturn safeName.name;\n};\n\nexport default buildIndexName;\n"],"mappings":"wFAOA,MAAM,EAAkB,GAKN,EAChB,GAAGA,EAAU,GAAG,uBAAuB,CACtC,EAAM,UACN,GAAG,EAAM,OACV,CAAC,CAAC,KAAKA,EAAU,GAAG,aAAa,IACjC,EAAM,kBAGO,CAAC,CAAC"}