@lucidcms/core
Version:
The core of the Lucid CMS. It's responsible for spinning up the API and serving the CMS.
1 lines • 1.22 kB
Source Map (JSON)
{"version":3,"file":"check-feature-enabled.mjs","names":[],"sources":["../../../../src/services/ai/checks/check-feature-enabled.ts"],"sourcesContent":["import { copy } from \"../../../libs/i18n/index.js\";\nimport type { ServiceFn } from \"../../../utils/services/types.js\";\n\nconst checkFeatureEnabled: ServiceFn<\n\t[\n\t\t{\n\t\t\tfeature: \"imageGeneration\" | \"altGeneration\" | \"customFieldGeneration\";\n\t\t},\n\t],\n\tundefined\n> = async (context, data) => {\n\tif (\n\t\tcontext.config.ai.enabled === false ||\n\t\tcontext.config.ai.features[data.feature] === false\n\t) {\n\t\treturn {\n\t\t\terror: {\n\t\t\t\ttype: \"basic\",\n\t\t\t\tstatus: 403,\n\t\t\t\tname: copy(\"server:core.ai.config.feature.disabled.name\"),\n\t\t\t\tmessage: copy(\"server:core.ai.config.feature.disabled.message\"),\n\t\t\t},\n\t\t\tdata: undefined,\n\t\t};\n\t}\n\n\treturn {\n\t\terror: undefined,\n\t\tdata: undefined,\n\t};\n};\n\nexport default checkFeatureEnabled;\n"],"mappings":"mDAGA,MAAM,EAOF,MAAO,EAAS,IAElB,EAAQ,OAAO,GAAG,UAAY,IAC9B,EAAQ,OAAO,GAAG,SAAS,EAAK,WAAa,GAEtC,CACN,MAAO,CACN,KAAM,QACN,OAAQ,IACR,KAAM,EAAK,6CAA6C,EACxD,QAAS,EAAK,gDAAgD,CAC/D,EACA,KAAM,IAAA,EACP,EAGM,CACN,MAAO,IAAA,GACP,KAAM,IAAA,EACP"}