mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-03 17:51:58 +01:00
Retain Cloud event replay through durable enrollment and signed tenant hints. Save credential binding changes and retry deadlines in existing grant metadata. Preserve receipt idempotency, lifecycle admission and mixed-version fallback. Co-Authored-By: Paperclip <noreply@paperclip.ing>
7 lines
407 B
TypeScript
7 lines
407 B
TypeScript
export function providerRetryAt(value: string | null, now = Date.now()): number | undefined {
|
|
if (!value?.trim()) return undefined;
|
|
const seconds = /^\d+$/.test(value.trim()) ? Number(value) : Number.NaN;
|
|
const deadline = Number.isFinite(seconds) ? now + seconds * 1000 : Date.parse(value);
|
|
return Number.isFinite(deadline) && deadline > now ? Math.min(deadline, now + 24 * 3600_000) : undefined;
|
|
}
|