@lucidcms/core
Version:
The core of the Lucid CMS. It's responsible for spinning up the API and serving the CMS.
1 lines • 1.1 kB
Source Map (JSON)
{"version":3,"file":"merge-email-context-data.mjs","names":[],"sources":["../../../../src/services/email/helpers/merge-email-context-data.ts"],"sourcesContent":["import type {\n\tEmailContextData,\n\tEmailTemplateData,\n} from \"../../../libs/email/types.js\";\nimport deepMerge from \"../../../utils/helpers/deep-merge.js\";\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n\ttypeof value === \"object\" && value !== null && !Array.isArray(value);\n\nconst mergeEmailContextData = (props: {\n\tdata: Record<string, unknown>;\n\tcontext: EmailContextData;\n}) => {\n\tconst data = {\n\t\t...props.data,\n\t\tcontext: isRecord(props.data.context) ? props.data.context : undefined,\n\t};\n\n\treturn deepMerge(\n\t\t{\n\t\t\tcontext: props.context,\n\t\t},\n\t\tdata,\n\t) as EmailTemplateData;\n};\n\nexport default mergeEmailContextData;\n"],"mappings":"qDAMA,MAAM,EAAY,GACjB,OAAO,GAAU,YAAY,GAAkB,CAAC,MAAM,QAAQ,CAAK,EAE9D,EAAyB,GAGzB,CACL,IAAM,EAAO,CACZ,GAAG,EAAM,KACT,QAAS,EAAS,EAAM,KAAK,OAAO,EAAI,EAAM,KAAK,QAAU,IAAA,EAC9D,EAEA,OAAO,EACN,CACC,QAAS,EAAM,OAChB,EACA,CACD,CACD"}