UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

3 lines • 912 B
import{t as hasNonEmptyString}from"./string-coerce-CpTFcSwY.mjs";import{_ as resolveDeliveryQueueMediaDir}from"./paths-D_FOvGon.mjs";import path from"node:path"; //!src/infra/outbound/delivery-queue-media-paths.ts const ARTIFACT_NAME_RE=/^(?:(?:g1|c1|r1)-)?[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?:\.[A-Za-z0-9]{1,10})?(?:\.part)?$/;function spoolRelativePath(e,t){const n=path.resolve(resolveDeliveryQueueMediaDir(t));const r=path.resolve(e);const i=path.relative(n,r);return i&&!i.includes(path.sep)&&ARTIFACT_NAME_RE.test(i)?i:null}function payloadMediaSources(e){return[e.mediaUrl,...e.mediaUrls??[]].filter(hasNonEmptyString)}function collectEntrySpoolPaths(e,t){return e.flatMap(payloadMediaSources).filter(e=>path.isAbsolute(e)&&spoolRelativePath(e,t)).map(e=>path.resolve(e))}export{spoolRelativePath as i,collectEntrySpoolPaths as n,payloadMediaSources as r,ARTIFACT_NAME_RE as t};