{"version":3,"file":"runner-config.d.ts","sourceRoot":"","sources":["../../../src/shared/runner-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEpD,eAAO,MAAM,yBAAyB,KAAK,CAAC;AAC5C,eAAO,MAAM,2BAA2B,QAAS,CAAC;AAElD,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,iBAAiB,GAAG,SAAS,CAiCnG","sourcesContent":["import type { RunnerRetryConfig } from \"./types.ts\";\n\nexport const MAX_RUNNER_RETRY_ATTEMPTS = 10;\nexport const MAX_RUNNER_RETRY_BACKOFF_MS = 60_000;\n\nexport function parseRunnerRetryConfig(value: unknown, field: string): RunnerRetryConfig | undefined {\n\tif (value === undefined) return undefined;\n\tif (!value || typeof value !== \"object\" || Array.isArray(value)) {\n\t\tthrow new Error(`${field} must be an object.`);\n\t}\n\tconst retry = value as Record<string, unknown>;\n\tconst unknown = Object.keys(retry).filter((key) => key !== \"maxAttempts\" && key !== \"backoffMs\");\n\tif (unknown.length > 0) throw new Error(`${field} has unsupported fields: ${unknown.join(\", \")}.`);\n\tconst maxAttempts = retry.maxAttempts;\n\tif (\n\t\ttypeof maxAttempts !== \"number\" ||\n\t\t!Number.isInteger(maxAttempts) ||\n\t\tmaxAttempts < 1 ||\n\t\tmaxAttempts > MAX_RUNNER_RETRY_ATTEMPTS\n\t) {\n\t\tthrow new Error(\n\t\t\t`${field}.maxAttempts must be an integer from 1 to ${MAX_RUNNER_RETRY_ATTEMPTS}.`,\n\t\t);\n\t}\n\tconst backoffMs = retry.backoffMs;\n\tif (\n\t\tbackoffMs !== undefined &&\n\t\t(typeof backoffMs !== \"number\" ||\n\t\t\t!Number.isInteger(backoffMs) ||\n\t\t\tbackoffMs < 0 ||\n\t\t\tbackoffMs > MAX_RUNNER_RETRY_BACKOFF_MS)\n\t) {\n\t\tthrow new Error(`${field}.backoffMs must be an integer from 0 to ${MAX_RUNNER_RETRY_BACKOFF_MS}.`);\n\t}\n\treturn {\n\t\tmaxAttempts,\n\t\t...(backoffMs !== undefined ? { backoffMs } : {}),\n\t};\n}\n"]}