UNPKG

@lucidcms/core

Version:

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

1 lines 875 B
{"version":3,"file":"get-retention-days.mjs","names":[],"sources":["../../../../src/services/crons/helpers/get-retention-days.ts"],"sourcesContent":["import { subDays } from \"date-fns\";\nimport type { Config } from \"../../../types.js\";\n\nexport type RetentionDaysTypes = keyof NonNullable<\n\tConfig[\"retention\"][\"purgeAfterDays\"]\n>;\n\n/**\n * Gets the retention days for a given data type\n */\nconst getRetentionDays = (\n\tretentionConfig: Config[\"retention\"],\n\ttype: RetentionDaysTypes,\n) => {\n\tconst purgeAfterDays = retentionConfig.purgeAfterDays?.[type];\n\treturn subDays(\n\t\tnew Date(),\n\t\tpurgeAfterDays ?? retentionConfig.defaultPurgeAfterDays,\n\t).toISOString();\n};\n\nexport default getRetentionDays;\n"],"mappings":"mCAUA,MAAM,GACL,EACA,IACI,CACJ,IAAM,EAAiB,EAAgB,iBAAiB,GACxD,OAAO,EACN,IAAI,KACJ,GAAkB,EAAgB,qBACnC,CAAC,CAAC,YAAY,CACf"}