UNPKG

durable-execution

Version:

A durable task engine for running tasks durably and resiliently

30 lines 788 B
// src/utils.ts import { getDotPath } from "@standard-schema/utils"; import { customAlphabet } from "nanoid"; import { sleep } from "@gpahal/std/promises"; function sleepWithJitter(ms) { return sleep(ms * (0.5 + Math.random())); } var _ALPHABET = "0123456789ABCDEFGHJKMNPQRSTUVWXYZabcdefghjkmnpqrstuvwxyz"; var generateId = customAlphabet(_ALPHABET, 24); function summarizeStandardSchemaIssues(issues) { let summary = ""; for (const issue of issues) { if (summary) { summary += "\n"; } summary += `\xD7 ${issue.message}`; const dotPath = getDotPath(issue); if (dotPath) { summary += ` \u2192 at ${dotPath}`; } } return summary; } export { generateId, sleepWithJitter, summarizeStandardSchemaIssues }; //# sourceMappingURL=utils.js.map