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.42 kB
{"version":3,"file":"get-single.mjs","names":["mediaServices.client.getSingle"],"sources":["../../../../src/libs/toolkit/media/get-single.ts"],"sourcesContent":["import { mediaServices } from \"../../../services/index.js\";\nimport type { Media } from \"../../../types/response.js\";\nimport type {\n\tServiceContext,\n\tServiceResponse,\n} from \"../../../utils/services/types.js\";\nimport type { ToolkitTenantOptions } from \"../types.js\";\nimport { runToolkitService, withToolkitTenant } from \"../utils.js\";\n\nexport type ToolkitMediaGetSingleInput = ToolkitTenantOptions & {\n\tid: number;\n};\n\nconst getSingle = async (\n\tcontext: ServiceContext,\n\tinput: ToolkitMediaGetSingleInput,\n): ServiceResponse<Media> =>\n\trunToolkitService(\n\t\t() =>\n\t\t\tmediaServices.client.getSingle(withToolkitTenant(context, input), {\n\t\t\t\tid: input.id,\n\t\t\t}),\n\t\t{\n\t\t\tname: {\n\t\t\t\tkey: \"core.toolkit.media.get.single.error.name\",\n\t\t\t\tdefaultMessage: \"Media Toolkit Error\",\n\t\t\t},\n\t\t\tmessage: {\n\t\t\t\tkey: \"core.toolkit.media.get.single.error.message\",\n\t\t\t\tdefaultMessage: \"Lucid toolkit could not fetch a media item.\",\n\t\t\t},\n\t\t},\n\t);\n\nexport default getSingle;\n"],"mappings":"qIAaA,MAAM,EAAY,MACjB,EACA,IAEA,MAEEA,EAA+B,EAAkB,EAAS,CAAK,EAAG,CACjE,GAAI,EAAM,EACX,CAAC,EACF,CACC,KAAM,CACL,IAAK,2CACL,eAAgB,qBACjB,EACA,QAAS,CACR,IAAK,8CACL,eAAgB,6CACjB,CACD,CACD"}