target-supabase-sdk 0.3.1 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/browser.js +2 -2
- package/dist/chunks/{config-aBbuDpyt.js → config-t31awPWL.js} +20 -10
- package/dist/chunks/config-t31awPWL.js.map +1 -0
- package/dist/chunks/{enable-BTFwzWHc.js → enable-BKsBzEqS.js} +2 -2
- package/dist/chunks/{enable-BTFwzWHc.js.map → enable-BKsBzEqS.js.map} +1 -1
- package/dist/chunks/{task-queue-D8CraGI8.js → task-queue-BpLJ8skY.js} +18 -19
- package/dist/chunks/{task-queue-D8CraGI8.js.map → task-queue-BpLJ8skY.js.map} +1 -1
- package/dist/config/config.api.d.ts.map +1 -1
- package/dist/core.api.d.ts +15 -5
- package/dist/core.api.d.ts.map +1 -1
- package/dist/core.interface.d.ts +5 -0
- package/dist/core.interface.d.ts.map +1 -1
- package/dist/core.schema.d.ts +7 -0
- package/dist/core.schema.d.ts.map +1 -1
- package/dist/node.d.ts +0 -3
- package/dist/node.d.ts.map +1 -1
- package/dist/node.js +12 -186
- package/dist/node.js.map +1 -1
- package/dist/parcel/parcel.api.d.ts.map +1 -1
- package/dist/preload.js +2 -2
- package/dist/service/service.api.d.ts.map +1 -1
- package/dist/task/task.api.d.ts +1 -1
- package/dist/task/task.api.d.ts.map +1 -1
- package/dist/task/task.interface.d.ts +2 -1
- package/dist/task/task.interface.d.ts.map +1 -1
- package/dist/trigger/trigger-node.d.ts +1 -1
- package/dist/trigger/trigger.interface.d.ts +0 -42
- package/dist/trigger/trigger.interface.d.ts.map +1 -1
- package/package.json +1 -2
- package/src/core.api.ts +32 -12
- package/src/core.interface.ts +5 -0
- package/src/core.schema.ts +2 -0
- package/src/node.ts +0 -3
- package/src/task/task-node.ts +1 -1
- package/src/task/task-post.api.ts +1 -1
- package/src/task/task-queue.ts +2 -2
- package/src/task/task.api.ts +15 -13
- package/src/task/task.interface.ts +2 -1
- package/src/trigger/trigger-node.ts +1 -1
- package/src/trigger/trigger.interface.ts +0 -52
- package/dist/chunks/config-aBbuDpyt.js.map +0 -1
- package/dist/trigger/trigger.api.d.ts +0 -145
- package/dist/trigger/trigger.api.d.ts.map +0 -1
- package/dist/trigger/trigger.utils.d.ts +0 -6
- package/dist/trigger/trigger.utils.d.ts.map +0 -1
- package/src/trigger/trigger.api.ts +0 -171
- package/src/trigger/trigger.utils.ts +0 -56
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enable-BTFwzWHc.js","sources":["../../src/node/env/load-env.ts","../../src/node/env/project-root.ts","../../src/shared/log/upload/env.ts","../../src/shared/log/upload/logger.ts","../../src/shared/log/spool/paths.ts","../../src/shared/log/spool/process-roles.ts","../../src/shared/log/upload/flush.ts","../../src/shared/log/spool/writer.ts","../../src/shared/log/spool/enable.ts"],"sourcesContent":["import { existsSync, readFileSync } from \"node:fs\";\nimport { resolve } from \"node:path\";\n\nconst DEFAULT_ENV_FILES = [\".env.local\", \".env\"] as const;\nconst PROD_ENV_FILES = [\".env.prod\"] as const;\n\nexport const SERVICE_ENV_PROFILE_ENV_KEY = \"SERVICE_ENV_PROFILE\" as const;\nexport const SERVICE_ENV_PROFILE_PROD = \"prod\" as const;\nexport const CLI_PROD_FLAG = \"--prod\" as const;\n\nexport interface EnvProfileFromProcessOptions {\n env?: NodeJS.ProcessEnv;\n argv?: readonly string[];\n}\n\n/** Resolve active env profile from `SERVICE_ENV_PROFILE` or `--prod` on argv. */\nexport function envProfileFromProcess(options?: EnvProfileFromProcessOptions): string | undefined {\n const env = options?.env ?? process.env;\n const argv = options?.argv ?? process.argv;\n const fromEnv = env[SERVICE_ENV_PROFILE_ENV_KEY]?.trim();\n if (fromEnv != null && fromEnv !== \"\") {\n return fromEnv;\n }\n if (argv.includes(CLI_PROD_FLAG)) {\n return SERVICE_ENV_PROFILE_PROD;\n }\n return undefined;\n}\n\n/** Default env file list for a profile (`prod` → `.env.prod`; otherwise `.env.local` → `.env`). */\nexport function resolveDefaultEnvFiles(profile?: string): readonly string[] {\n if (profile === SERVICE_ENV_PROFILE_PROD) {\n return PROD_ENV_FILES;\n }\n return DEFAULT_ENV_FILES;\n}\n\n/** Pin `SERVICE_ENV_PROFILE=prod` when `--prod` is on argv (for child process inheritance). */\nexport function pinEnvProfileFromArgv(\n env: NodeJS.ProcessEnv = process.env,\n argv: readonly string[] = process.argv,\n): void {\n if (env[SERVICE_ENV_PROFILE_ENV_KEY]?.trim()) {\n return;\n }\n if (argv.includes(CLI_PROD_FLAG)) {\n env[SERVICE_ENV_PROFILE_ENV_KEY] = SERVICE_ENV_PROFILE_PROD;\n }\n}\n\nexport interface LoadEnvFilesOptions {\n /** Files to load in order (later files do not override existing env). */\n files?: readonly string[];\n env?: NodeJS.ProcessEnv;\n /** Called after all files are merged (e.g. legacy alias normalization). */\n afterLoad?: () => void;\n}\n\nfunction stripQuotes(value: string): string {\n return value.replace(/^[\"']|[\"']$/g, \"\");\n}\n\n/** Parse one KEY=VALUE line; returns null if line should be skipped. */\nexport function parseEnvLine(line: string): { key: string; value: string } | null {\n const trimmed = line.trim();\n if (trimmed === \"\" || trimmed.startsWith(\"#\")) {\n return null;\n }\n\n const eq = trimmed.indexOf(\"=\");\n if (eq === -1) {\n return null;\n }\n\n const key = trimmed.slice(0, eq).trim();\n const raw = trimmed.slice(eq + 1).trim();\n return { key, value: stripQuotes(raw) };\n}\n\nexport function parseEnvFileContent(content: string, env: NodeJS.ProcessEnv): void {\n for (const line of content.split(\"\\n\")) {\n const parsed = parseEnvLine(line);\n if (parsed == null) {\n continue;\n }\n if (env[parsed.key] == null || env[parsed.key] === \"\") {\n env[parsed.key] = parsed.value;\n }\n }\n}\n\nexport function parseEnvFile(filePath: string, env: NodeJS.ProcessEnv): void {\n if (!existsSync(filePath)) {\n return;\n }\n parseEnvFileContent(readFileSync(filePath, \"utf8\"), env);\n}\n\n/**\n * Load env files into `process.env` (or `options.env`).\n * Default files: `.env.local` → `.env`, or `.env.prod` when profile is `prod` / `--prod`.\n * Existing non-empty env values are not overwritten.\n */\nexport function loadEnvFiles(root: string, options?: LoadEnvFilesOptions): void {\n const env = options?.env ?? process.env;\n const files = options?.files ?? resolveDefaultEnvFiles(envProfileFromProcess({ env }));\n\n for (const name of files) {\n parseEnvFile(resolve(root, name), env);\n }\n\n options?.afterLoad?.();\n}\n","import { existsSync, readFileSync } from \"node:fs\";\nimport { dirname, resolve } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\n/**\n * Resolve project root from a module URL (typically `import.meta.url`).\n * @param relativePath Path relative to the module file (default `\"..\"` = parent directory).\n */\nexport function resolveProjectRootFromModule(importMetaUrl: string, relativePath = \"..\"): string {\n return resolve(fileURLToPath(new URL(relativePath, importMetaUrl)));\n}\n\n/**\n * Walk upward from `importMetaUrl` until a `package.json` with matching `name` is found.\n * Use for esbuild bundles under `dist/` where a single `..` hop lands in `dist/`, not repo root.\n */\nexport function resolveProjectRootByPackageName(importMetaUrl: string, packageName: string): string {\n let dir = dirname(fileURLToPath(importMetaUrl));\n for (;;) {\n const packageJsonPath = resolve(dir, \"package.json\");\n if (existsSync(packageJsonPath)) {\n const pkg = JSON.parse(readFileSync(packageJsonPath, \"utf8\")) as { name?: string };\n if (pkg.name === packageName) {\n return dir;\n }\n }\n const parent = dirname(dir);\n if (parent === dir) {\n break;\n }\n dir = parent;\n }\n throw new Error(`Could not find package root for \"${packageName}\" from ${importMetaUrl}`);\n}\n","import { envBool } from \"../../../node/env/env-parsers\";\n\n/** Master switch — env name kept for compatibility (`LOG_PERSIST_ENABLED`). */\nexport function logSpoolEnabledFromEnv(env: NodeJS.ProcessEnv = process.env): boolean {\n return envBool(\"LOG_PERSIST_ENABLED\", false, env);\n}\n\nexport function logPersistServiceFromEnv(env: NodeJS.ProcessEnv = process.env): string | undefined {\n const raw = env.LOG_PERSIST_SERVICE?.trim();\n return raw != null && raw !== \"\" ? raw : undefined;\n}\n\nexport function logPersistProcessFromEnv(env: NodeJS.ProcessEnv = process.env): string | undefined {\n const raw = env.LOG_PERSIST_PROCESS?.trim();\n return raw != null && raw !== \"\" ? raw : undefined;\n}\n\n/** `LOG_PERSIST_REGISTRY_DIR` or `RUNTIME_DATA_DIR`. */\nexport function runtimeDataDirFromEnv(env: NodeJS.ProcessEnv = process.env): string | undefined {\n const configured = env.LOG_PERSIST_REGISTRY_DIR?.trim();\n if (configured != null && configured !== \"\") {\n return configured;\n }\n const runtime = env.RUNTIME_DATA_DIR?.trim();\n return runtime != null && runtime !== \"\" ? runtime : undefined;\n}\n","import { createLogger } from \"../core/create-logger\";\n\n/** User-facing / lifecycle logs — may be persisted like normal app logs. */\nexport const LOG_PERSIST_TOPIC = \"log-persist\";\n\n/** Operational logs from the persist pipeline — never re-offered to avoid feedback loops. */\nexport const LOG_PERSIST_INTERNAL_TOPIC = \"log-persist-internal\";\n\ntype PipelineLogData = Record<string, unknown>;\n\nfunction createPipelineLogger(module: string) {\n const logger = createLogger({ module });\n\n function write(level: \"debug\" | \"info\" | \"warn\" | \"error\", message: string, data?: PipelineLogData): void {\n logger[level](message, {\n topic: LOG_PERSIST_INTERNAL_TOPIC,\n ...(data != null ? { data } : {}),\n });\n }\n\n return {\n debug: (message: string, data?: PipelineLogData) => write(\"debug\", message, data),\n info: (message: string, data?: PipelineLogData) => write(\"info\", message, data),\n warn: (message: string, data?: PipelineLogData) => write(\"warn\", message, data),\n error: (message: string, data?: PipelineLogData) => write(\"error\", message, data),\n };\n}\n\n/** Supabase upload path (`postLogBatch`). */\nexport const persistLogger = createPipelineLogger(\"log-upload\");\n\n/** File spool writer + collector. */\nexport const spoolLogger = createPipelineLogger(\"log-spool\");\n\nexport function isLogPersistInternalTopic(topic: string | undefined): boolean {\n return topic === LOG_PERSIST_INTERNAL_TOPIC;\n}\n","import { join } from \"node:path\";\nimport { runtimeDataDirFromEnv } from \"../upload/env\";\nimport type { LogSpoolProcessRole } from \"./interface\";\n\nexport const LOG_SPOOL_DIR_NAME = \"log-spool\";\n\nexport function resolveLogSpoolRoot(explicit?: string): string {\n if (explicit != null && explicit.trim() !== \"\") {\n return explicit;\n }\n const configured = process.env.LOG_SPOOL_DIR?.trim();\n if (configured != null && configured !== \"\") {\n return configured;\n }\n const runtimeDir = runtimeDataDirFromEnv();\n if (runtimeDir == null) {\n throw new Error(\n \"[LogSpool] spool root required: set LOG_SPOOL_DIR or LOG_PERSIST_REGISTRY_DIR / RUNTIME_DATA_DIR\",\n );\n }\n return join(runtimeDir, LOG_SPOOL_DIR_NAME);\n}\n\nexport function logSpoolServiceDir(spoolRoot: string, serviceId: string): string {\n return join(spoolRoot, serviceId);\n}\n\nexport function logSpoolProcessDir(spoolRoot: string, serviceId: string, processRole: LogSpoolProcessRole): string {\n return join(spoolRoot, serviceId, processRole);\n}\n","/** Four-process L3 blueprint roles — always scanned by collect-log. */\nexport const LOG_SPOOL_CORE_PROCESS_ROLES = [\"main\", \"guard\", \"scheduler\", \"worker\"] as const;\n\nexport type LogSpoolCoreProcessRole = (typeof LOG_SPOOL_CORE_PROCESS_ROLES)[number];\n\n/** Spool directory / `LOG_PERSIST_PROCESS` name — core or service-specific extra. */\nexport type LogSpoolProcessRole = LogSpoolCoreProcessRole | string;\n\nexport const LOG_SPOOL_EXTRA_PROCESS_ROLES_ENV = \"LOG_SPOOL_EXTRA_PROCESS_ROLES\";\n\nconst EXTRA_ROLE_PATTERN = /^[a-z][a-z0-9-]*$/;\n\nfunction parseRoleList(raw: string | undefined): string[] {\n if (raw == null || raw.trim() === \"\") {\n return [];\n }\n return raw\n .split(\",\")\n .map((part) => part.trim())\n .filter((part) => part !== \"\");\n}\n\n/** Parse comma-separated extra roles from env (e.g. `chrome-sidecar`). */\nexport function logSpoolExtraProcessRolesFromEnv(env: NodeJS.ProcessEnv = process.env): string[] {\n return parseRoleList(env[LOG_SPOOL_EXTRA_PROCESS_ROLES_ENV]);\n}\n\n/** Core + extras, deduped, stable order (core first). */\nexport function resolveAllLogSpoolProcessRoles(env: NodeJS.ProcessEnv = process.env): LogSpoolProcessRole[] {\n const extras = logSpoolExtraProcessRolesFromEnv(env);\n const seen = new Set<string>(LOG_SPOOL_CORE_PROCESS_ROLES);\n const all: LogSpoolProcessRole[] = [...LOG_SPOOL_CORE_PROCESS_ROLES];\n for (const role of extras) {\n if (!seen.has(role)) {\n seen.add(role);\n all.push(role);\n }\n }\n return all;\n}\n\nexport function isLogSpoolCoreProcessRole(value: string): value is LogSpoolCoreProcessRole {\n return (LOG_SPOOL_CORE_PROCESS_ROLES as readonly string[]).includes(value);\n}\n\n/** Whether `value` is a known spool role (core or configured extra). */\nexport function isKnownLogSpoolProcessRole(value: string, env: NodeJS.ProcessEnv = process.env): boolean {\n if (isLogSpoolCoreProcessRole(value)) {\n return true;\n }\n return logSpoolExtraProcessRolesFromEnv(env).includes(value);\n}\n\n/** Validate extra role token — lowercase alphanumeric + hyphen, not a duplicate core name. */\nexport function assertValidLogSpoolExtraProcessRole(role: string): void {\n if (role === \"\" || !EXTRA_ROLE_PATTERN.test(role)) {\n throw new Error(\n `[LogSpool] invalid extra process role \"${role}\" — use lowercase letters, digits, hyphen (e.g. chrome-sidecar)`,\n );\n }\n if (isLogSpoolCoreProcessRole(role)) {\n throw new Error(`[LogSpool] extra process role \"${role}\" duplicates a core role`);\n }\n}\n\nexport function mergeLogSpoolExtraProcessRolesEnv(env: NodeJS.ProcessEnv, extraRoles: readonly string[]): void {\n if (extraRoles.length === 0) {\n return;\n }\n for (const role of extraRoles) {\n assertValidLogSpoolExtraProcessRole(role);\n }\n const merged = new Set([...logSpoolExtraProcessRolesFromEnv(env), ...extraRoles]);\n env[LOG_SPOOL_EXTRA_PROCESS_ROLES_ENV] = [...merged].join(\",\");\n}\n","import { postListCreate } from \"../../../list/list.api\";\nimport { CategoryList } from \"../../../list/list.interface\";\nimport type { LogEntry } from \"../core/log-manager\";\nimport type { BuildLogListDraftInput, LogListDraft } from \"./interface\";\nimport { LOG_BATCH_LIST_VALUE } from \"./interface\";\nimport { persistLogger } from \"./logger\";\n\nexport function estimateEntriesBytes(entries: LogEntry[]): number {\n if (entries.length === 0) {\n return 0;\n }\n try {\n return Buffer.byteLength(JSON.stringify(entries), \"utf8\");\n } catch {\n return entries.length * 512;\n }\n}\n\nexport function buildLogListDraft(input: BuildLogListDraftInput): LogListDraft {\n const { service, process, lane, entries } = input;\n const first = entries[0];\n const last = entries[entries.length - 1];\n\n return {\n name: service,\n value: LOG_BATCH_LIST_VALUE,\n category: CategoryList.LIST,\n tagList: [\"log\", lane, service],\n details: {\n manifestVersion: 0,\n loaderKey: LOG_BATCH_LIST_VALUE,\n meta: {\n service,\n process,\n pid: globalThis.process.pid,\n lane,\n count: entries.length,\n from: first?.timestamp ?? null,\n to: last?.timestamp ?? null,\n flushedAt: Date.now(),\n },\n preview: first?.message ?? \"\",\n items: entries,\n },\n };\n}\n\nasync function withTimeout<T>(promise: Promise<T>, timeoutMs: number, label: string): Promise<T> {\n let timer: ReturnType<typeof setTimeout> | null = null;\n try {\n return await Promise.race([\n promise,\n new Promise<T>((_resolve, reject) => {\n timer = setTimeout(() => {\n reject(new Error(`${label} timed out after ${timeoutMs}ms`));\n }, timeoutMs);\n }),\n ]);\n } finally {\n if (timer != null) {\n clearTimeout(timer);\n }\n }\n}\n\nexport async function postLogBatch(draft: LogListDraft, postTimeoutMs: number): Promise<void> {\n const result = await withTimeout(\n postListCreate({\n name: draft.name,\n value: draft.value,\n category: draft.category,\n details: draft.details,\n }),\n postTimeoutMs,\n \"postListCreate\",\n );\n\n if (!result.success) {\n const message = result.error?.message ?? \"postListCreate failed\";\n persistLogger.error(\"post log batch failed\", {\n name: draft.name,\n error: message,\n });\n throw new Error(message);\n }\n}\n\n/** Take a prefix of entries that fits within maxBytes. */\nexport function takeEntriesWithinBytes(entries: LogEntry[], maxBytes: number): LogEntry[] {\n if (entries.length === 0) {\n return [];\n }\n\n const taken: LogEntry[] = [];\n for (const entry of entries) {\n const candidate = [...taken, entry];\n if (taken.length > 0 && estimateEntriesBytes(candidate) > maxBytes) {\n break;\n }\n taken.push(entry);\n }\n\n const result = taken.length > 0 ? taken : [entries[0]];\n if (result.length < entries.length) {\n persistLogger.warn(\"trimmed batch to maxBytes\", {\n requested: entries.length,\n taken: result.length,\n maxBytes,\n takenBytes: estimateEntriesBytes(result),\n });\n }\n\n return result;\n}\n","import { mkdir, rename, writeFile } from \"node:fs/promises\";\nimport { join } from \"node:path\";\nimport type { LogEntry } from \"../core/log-manager\";\nimport { estimateEntriesBytes, takeEntriesWithinBytes } from \"../upload/flush\";\nimport { registerLogPersistOffer } from \"../upload/hook\";\nimport { isLogPersistInternalTopic, spoolLogger } from \"../upload/logger\";\nimport { DEFAULT_LOG_SPOOL_CONFIG, resolveLogSpoolConfig } from \"./config\";\nimport { buildLogSpoolBatchBaseName, randomLogSpoolShortId } from \"./file\";\nimport type { EnableLogSpoolOptions, LogSpoolBatchFile, LogSpoolProcessRole, LogSpoolWriterStats } from \"./interface\";\nimport { logSpoolProcessDir, resolveLogSpoolRoot } from \"./paths\";\n\nclass LogSpoolWriter {\n private static instance: LogSpoolWriter | null = null;\n\n private enabled = false;\n private buffer: LogEntry[] = [];\n private flushInProgress = false;\n private debounceTimer: ReturnType<typeof setTimeout> | null = null;\n private ageTimer: ReturnType<typeof setTimeout> | null = null;\n private serviceId: string | null = null;\n private processRole: LogSpoolProcessRole | null = null;\n private serviceValue: string | null = null;\n private spoolRoot: string | null = null;\n private config = DEFAULT_LOG_SPOOL_CONFIG.writer;\n\n static getInstance(): LogSpoolWriter {\n LogSpoolWriter.instance ??= new LogSpoolWriter();\n return LogSpoolWriter.instance;\n }\n\n async enable(options: EnableLogSpoolOptions): Promise<void> {\n if (this.enabled) {\n spoolLogger.warn(\"log spool writer already enabled\", {\n serviceId: this.serviceId,\n processRole: this.processRole,\n });\n return;\n }\n\n this.serviceId = options.serviceId;\n this.processRole = options.processRole;\n this.serviceValue = options.serviceValue;\n this.spoolRoot = options.spoolRoot ?? resolveLogSpoolRoot();\n this.config = resolveLogSpoolConfig(options.config).writer;\n this.enabled = true;\n\n registerLogPersistOffer((entry) => this.offer(entry));\n\n spoolLogger.info(\"log spool writer enabled\", {\n serviceId: options.serviceId,\n processRole: options.processRole,\n serviceValue: options.serviceValue,\n spoolRoot: this.spoolRoot,\n config: this.config,\n });\n }\n\n async shutdown(): Promise<void> {\n this.cancelDebounce();\n this.cancelAgeFlush();\n registerLogPersistOffer(null);\n this.enabled = false;\n\n while (this.buffer.length > 0) {\n await this.flushChunk({ reason: \"shutdown\" });\n }\n\n spoolLogger.info(\"log spool writer shutdown complete\", {\n serviceId: this.serviceId,\n processRole: this.processRole,\n });\n }\n\n getStats(): LogSpoolWriterStats {\n return {\n enabled: this.enabled,\n bufferedEntries: this.buffer.length,\n bufferedBytes: estimateEntriesBytes(this.buffer),\n flushInProgress: this.flushInProgress,\n debouncePending: this.debounceTimer != null,\n ageFlushPending: this.ageTimer != null,\n serviceId: this.serviceId,\n processRole: this.processRole,\n };\n }\n\n offer(entry: LogEntry): void {\n if (isLogPersistInternalTopic(entry.topic)) {\n return;\n }\n\n if (!this.enabled) {\n return;\n }\n\n if (this.buffer.length === 0) {\n this.scheduleAgeFlush();\n }\n\n this.buffer.push(entry);\n\n if (this.shouldScheduleDebouncedFlush()) {\n this.scheduleDebouncedFlush();\n }\n }\n\n private shouldScheduleDebouncedFlush(): boolean {\n return (\n this.buffer.length >= this.config.maxEntries || estimateEntriesBytes(this.buffer) >= this.config.maxBytes\n );\n }\n\n private scheduleDebouncedFlush(): void {\n if (this.debounceTimer != null) {\n return;\n }\n\n spoolLogger.debug(\"log spool flush debounce scheduled\", {\n debounceMs: this.config.flushDebounceMs,\n bufferedEntries: this.buffer.length,\n });\n\n this.debounceTimer = setTimeout(() => {\n this.debounceTimer = null;\n void this.flushChunk({ reason: \"debounce\" });\n }, this.config.flushDebounceMs);\n this.debounceTimer.unref?.();\n }\n\n private scheduleAgeFlush(): void {\n if (this.ageTimer != null) {\n return;\n }\n\n spoolLogger.debug(\"log spool age flush scheduled\", {\n maxAgeMs: this.config.maxAgeMs,\n });\n\n this.ageTimer = setTimeout(() => {\n this.ageTimer = null;\n void this.flushChunk({ reason: \"maxAge\" });\n }, this.config.maxAgeMs);\n this.ageTimer.unref?.();\n }\n\n private cancelDebounce(): void {\n if (this.debounceTimer != null) {\n clearTimeout(this.debounceTimer);\n this.debounceTimer = null;\n }\n }\n\n private cancelAgeFlush(): void {\n if (this.ageTimer != null) {\n clearTimeout(this.ageTimer);\n this.ageTimer = null;\n }\n }\n\n private async flushChunk(input: { reason: string }): Promise<void> {\n if (this.flushInProgress || this.buffer.length === 0) {\n return;\n }\n if (this.serviceId == null || this.processRole == null || this.serviceValue == null || this.spoolRoot == null) {\n return;\n }\n\n this.cancelDebounce();\n this.cancelAgeFlush();\n this.flushInProgress = true;\n try {\n const byCount = this.buffer.slice(0, this.config.maxEntries);\n const entries = takeEntriesWithinBytes(byCount, this.config.maxBytes);\n this.buffer = this.buffer.slice(entries.length);\n\n if (entries.length === 0) {\n if (this.buffer.length > 0) {\n this.scheduleAgeFlush();\n } else {\n this.cancelAgeFlush();\n }\n return;\n }\n\n const batchFile = await this.writeBatchTmp({\n entries,\n serviceId: this.serviceId,\n processRole: this.processRole,\n serviceValue: this.serviceValue,\n spoolRoot: this.spoolRoot,\n });\n\n spoolLogger.info(\"log spool flushed to tmp\", {\n reason: input.reason,\n fileName: batchFile.fileName,\n entryCount: entries.length,\n remainingBuffered: this.buffer.length,\n });\n\n if (this.buffer.length > 0) {\n this.scheduleAgeFlush();\n if (this.shouldScheduleDebouncedFlush()) {\n this.scheduleDebouncedFlush();\n }\n } else {\n this.cancelAgeFlush();\n }\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n spoolLogger.error(\"log spool flush failed\", { reason: input.reason, error: message });\n if (this.buffer.length > 0) {\n this.scheduleAgeFlush();\n }\n } finally {\n this.flushInProgress = false;\n }\n }\n\n private async writeBatchTmp(input: {\n entries: LogEntry[];\n serviceId: string;\n processRole: LogSpoolProcessRole;\n serviceValue: string;\n spoolRoot: string;\n }): Promise<{ fileName: string; tmpPath: string }> {\n const first = input.entries[0];\n const shortHash = randomLogSpoolShortId();\n const baseName = buildLogSpoolBatchBaseName({\n processRole: input.processRole,\n firstEntryTimestamp: first.timestamp,\n shortHash,\n });\n const fileName = `${baseName}.tmp`;\n const processDir = logSpoolProcessDir(input.spoolRoot, input.serviceId, input.processRole);\n await mkdir(processDir, { recursive: true });\n\n const tmpPath = join(processDir, fileName);\n const partPath = `${tmpPath}.part`;\n const payload: LogSpoolBatchFile = {\n entries: input.entries,\n meta: {\n serviceId: input.serviceId,\n processRole: input.processRole,\n serviceValue: input.serviceValue,\n },\n };\n const content = `${JSON.stringify(payload)}\\n`;\n\n await writeFile(partPath, content, \"utf8\");\n await rename(partPath, tmpPath);\n\n return { fileName, tmpPath };\n }\n}\n\nexport { LogSpoolWriter };\n\nexport async function enableLogSpoolWriter(options: EnableLogSpoolOptions): Promise<void> {\n await LogSpoolWriter.getInstance().enable(options);\n}\n\nexport async function shutdownLogSpoolWriter(): Promise<void> {\n await LogSpoolWriter.getInstance().shutdown();\n}\n\nexport function getLogSpoolWriterStats(): LogSpoolWriterStats {\n return LogSpoolWriter.getInstance().getStats();\n}\n","import { createLogger } from \"../core/create-logger\";\nimport { logPersistProcessFromEnv, logPersistServiceFromEnv, logSpoolEnabledFromEnv } from \"../upload/env\";\nimport { registerLogPersistOffer } from \"../upload/hook\";\nimport { LOG_PERSIST_TOPIC } from \"../upload/logger\";\nimport { LOG_SPOOL_SERVICE_ID_ENV, logSpoolConfigFromEnv, logSpoolServiceIdFromEnv } from \"./config\";\nimport type { EnsureLogSpoolFromEnvOptions, LogSpoolProcessRole } from \"./interface\";\nimport { resolveLogSpoolRoot } from \"./paths\";\nimport {\n assertValidLogSpoolExtraProcessRole,\n isKnownLogSpoolProcessRole,\n LOG_SPOOL_EXTRA_PROCESS_ROLES_ENV,\n} from \"./process-roles\";\nimport { enableLogSpoolWriter, getLogSpoolWriterStats, shutdownLogSpoolWriter } from \"./writer\";\n\nexport { logSpoolEnabledFromEnv };\n\nexport function resolveLogSpoolProcessRole(explicit?: string): LogSpoolProcessRole {\n const raw = explicit ?? logPersistProcessFromEnv();\n if (raw == null || raw === \"\") {\n throw new Error(\"[LogSpool] LOG_PERSIST_PROCESS is required when LOG_PERSIST_ENABLED=true\");\n }\n if (!isKnownLogSpoolProcessRole(raw)) {\n throw new Error(\n `[LogSpool] invalid LOG_PERSIST_PROCESS: ${raw} (not a core role and not listed in ${LOG_SPOOL_EXTRA_PROCESS_ROLES_ENV})`,\n );\n }\n return raw;\n}\n\n/**\n * Env vars for child spawn after main claims registry slot.\n * Optional when using {@link ManagedChildProcesses.spawn} — auto-injected from parent env.\n */\nexport function buildLogSpoolSpawnEnv(input: {\n serviceId: string;\n processRole: LogSpoolProcessRole;\n}): Record<string, string> {\n return {\n [LOG_SPOOL_SERVICE_ID_ENV]: input.serviceId,\n LOG_PERSIST_PROCESS: input.processRole,\n };\n}\n\n/**\n * When persistence is enabled and parent has `LOG_SPOOL_SERVICE_ID`, map spawn `label`\n * to spool env when `label` is a known core or extra process role.\n */\nexport function resolveLogSpoolSpawnEnvForLabel(\n label: string,\n env: NodeJS.ProcessEnv = process.env,\n): Record<string, string> {\n if (!logSpoolEnabledFromEnv(env)) {\n return {};\n }\n const serviceId = env[LOG_SPOOL_SERVICE_ID_ENV]?.trim();\n if (serviceId == null || serviceId === \"\") {\n return {};\n }\n if (!isKnownLogSpoolProcessRole(label, env)) {\n return {};\n }\n return buildLogSpoolSpawnEnv({ serviceId, processRole: label });\n}\n\nexport async function ensureLogSpoolFromEnv(options: EnsureLogSpoolFromEnvOptions = {}): Promise<boolean> {\n if (!logSpoolEnabledFromEnv()) {\n registerLogPersistOffer(null);\n return false;\n }\n\n const serviceId = options.serviceId ?? logSpoolServiceIdFromEnv();\n const serviceValue = options.serviceValue ?? logPersistServiceFromEnv();\n const processRole = resolveLogSpoolProcessRole(options.processRole);\n\n if (serviceId == null || serviceId === \"\") {\n throw new Error(\n \"[LogSpool] LOG_SPOOL_SERVICE_ID is required when LOG_PERSIST_ENABLED=true (set after registry claim or pass serviceId)\",\n );\n }\n if (serviceValue == null || serviceValue === \"\") {\n throw new Error(\"[LogSpool] LOG_PERSIST_SERVICE is required when LOG_PERSIST_ENABLED=true\");\n }\n\n const spoolRoot = options.spoolRoot ?? resolveLogSpoolRoot();\n\n await enableLogSpoolWriter({\n serviceId,\n processRole,\n serviceValue,\n spoolRoot,\n config: options.config ?? logSpoolConfigFromEnv(),\n });\n\n const lifecycleLogger = createLogger({ module: \"log-spool\" });\n lifecycleLogger.info(\"log spool enabled from env\", {\n topic: LOG_PERSIST_TOPIC,\n data: { serviceId, processRole, serviceValue, spoolRoot },\n });\n\n return true;\n}\n\nexport async function shutdownLogSpoolFromEnv(): Promise<void> {\n await shutdownLogSpoolWriter();\n}\n\nexport function getLogSpoolStats(): ReturnType<typeof getLogSpoolWriterStats> {\n return getLogSpoolWriterStats();\n}\n\nexport function validateLogSpoolPreloadEnv(env: NodeJS.ProcessEnv = process.env): void {\n if (!logSpoolEnabledFromEnv(env)) {\n return;\n }\n\n const missing: string[] = [];\n if (env.LOG_PERSIST_SERVICE?.trim() == null || env.LOG_PERSIST_SERVICE.trim() === \"\") {\n missing.push(\"LOG_PERSIST_SERVICE\");\n }\n const runtimeDir = env.LOG_PERSIST_REGISTRY_DIR?.trim() || env.RUNTIME_DATA_DIR?.trim();\n if (runtimeDir == null || runtimeDir === \"\") {\n missing.push(\"LOG_PERSIST_REGISTRY_DIR or RUNTIME_DATA_DIR\");\n }\n\n if (missing.length > 0) {\n throw new Error(`[LogSpool] preload env incomplete: ${missing.join(\", \")}`);\n }\n\n for (const role of env[LOG_SPOOL_EXTRA_PROCESS_ROLES_ENV]?.split(\",\") ?? []) {\n const trimmed = role.trim();\n if (trimmed === \"\") {\n continue;\n }\n assertValidLogSpoolExtraProcessRole(trimmed);\n }\n}\n"],"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AAO,GAAa,EAAE;AAC5B,IAAA,IAAI,GAAG,CAAC,mBAAmB,EAAE,IAAI,EAAE,IAAI,IAAI,IAAI,GAAG,CAAC,mBAAmB,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;AAClF,QAAA,OAAO,CAAC,IAAI,CAAC,qBAAqB,CAAC;IACvC;AACA,IAAA,MAAM,UAAU,GAAG,GAAG,CAAC,wBAAwB,EAAE,IAAI,EAAE,IAAI,GAAG,CAAC,gBAAgB,EAAE,IAAI,EAAE;IACvF,IAAI,UAAU,IAAI,IAAI,IAAI,UAAU,KAAK,EAAE,EAAE;AACzC,QAAA,OAAO,CAAC,IAAI,CAAC,8CAA8C,CAAC;IAChE;AAEA,IAAA,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE;AACpB,QAAA,MAAM,IAAI,KAAK,CAAC,CAAA,mCAAA,EAAsC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA,CAAE,CAAC;IAC/E;AAEA,IAAA,KAAK,MAAM,IAAI,IAAI,GAAG,CAAC,iCAAiC,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE;AACzE,QAAA,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE;AAC3B,QAAA,IAAI,OAAO,KAAK,EAAE,EAAE;YAChB;QACJ;QACA,mCAAmC,CAAC,OAAO,CAAC;IAChD;AACJ;;;;"}
|
|
1
|
+
{"version":3,"file":"enable-BKsBzEqS.js","sources":["../../src/node/env/load-env.ts","../../src/node/env/project-root.ts","../../src/shared/log/upload/env.ts","../../src/shared/log/upload/logger.ts","../../src/shared/log/spool/paths.ts","../../src/shared/log/spool/process-roles.ts","../../src/shared/log/upload/flush.ts","../../src/shared/log/spool/writer.ts","../../src/shared/log/spool/enable.ts"],"sourcesContent":["import { existsSync, readFileSync } from \"node:fs\";\nimport { resolve } from \"node:path\";\n\nconst DEFAULT_ENV_FILES = [\".env.local\", \".env\"] as const;\nconst PROD_ENV_FILES = [\".env.prod\"] as const;\n\nexport const SERVICE_ENV_PROFILE_ENV_KEY = \"SERVICE_ENV_PROFILE\" as const;\nexport const SERVICE_ENV_PROFILE_PROD = \"prod\" as const;\nexport const CLI_PROD_FLAG = \"--prod\" as const;\n\nexport interface EnvProfileFromProcessOptions {\n env?: NodeJS.ProcessEnv;\n argv?: readonly string[];\n}\n\n/** Resolve active env profile from `SERVICE_ENV_PROFILE` or `--prod` on argv. */\nexport function envProfileFromProcess(options?: EnvProfileFromProcessOptions): string | undefined {\n const env = options?.env ?? process.env;\n const argv = options?.argv ?? process.argv;\n const fromEnv = env[SERVICE_ENV_PROFILE_ENV_KEY]?.trim();\n if (fromEnv != null && fromEnv !== \"\") {\n return fromEnv;\n }\n if (argv.includes(CLI_PROD_FLAG)) {\n return SERVICE_ENV_PROFILE_PROD;\n }\n return undefined;\n}\n\n/** Default env file list for a profile (`prod` → `.env.prod`; otherwise `.env.local` → `.env`). */\nexport function resolveDefaultEnvFiles(profile?: string): readonly string[] {\n if (profile === SERVICE_ENV_PROFILE_PROD) {\n return PROD_ENV_FILES;\n }\n return DEFAULT_ENV_FILES;\n}\n\n/** Pin `SERVICE_ENV_PROFILE=prod` when `--prod` is on argv (for child process inheritance). */\nexport function pinEnvProfileFromArgv(\n env: NodeJS.ProcessEnv = process.env,\n argv: readonly string[] = process.argv,\n): void {\n if (env[SERVICE_ENV_PROFILE_ENV_KEY]?.trim()) {\n return;\n }\n if (argv.includes(CLI_PROD_FLAG)) {\n env[SERVICE_ENV_PROFILE_ENV_KEY] = SERVICE_ENV_PROFILE_PROD;\n }\n}\n\nexport interface LoadEnvFilesOptions {\n /** Files to load in order (later files do not override existing env). */\n files?: readonly string[];\n env?: NodeJS.ProcessEnv;\n /** Called after all files are merged (e.g. legacy alias normalization). */\n afterLoad?: () => void;\n}\n\nfunction stripQuotes(value: string): string {\n return value.replace(/^[\"']|[\"']$/g, \"\");\n}\n\n/** Parse one KEY=VALUE line; returns null if line should be skipped. */\nexport function parseEnvLine(line: string): { key: string; value: string } | null {\n const trimmed = line.trim();\n if (trimmed === \"\" || trimmed.startsWith(\"#\")) {\n return null;\n }\n\n const eq = trimmed.indexOf(\"=\");\n if (eq === -1) {\n return null;\n }\n\n const key = trimmed.slice(0, eq).trim();\n const raw = trimmed.slice(eq + 1).trim();\n return { key, value: stripQuotes(raw) };\n}\n\nexport function parseEnvFileContent(content: string, env: NodeJS.ProcessEnv): void {\n for (const line of content.split(\"\\n\")) {\n const parsed = parseEnvLine(line);\n if (parsed == null) {\n continue;\n }\n if (env[parsed.key] == null || env[parsed.key] === \"\") {\n env[parsed.key] = parsed.value;\n }\n }\n}\n\nexport function parseEnvFile(filePath: string, env: NodeJS.ProcessEnv): void {\n if (!existsSync(filePath)) {\n return;\n }\n parseEnvFileContent(readFileSync(filePath, \"utf8\"), env);\n}\n\n/**\n * Load env files into `process.env` (or `options.env`).\n * Default files: `.env.local` → `.env`, or `.env.prod` when profile is `prod` / `--prod`.\n * Existing non-empty env values are not overwritten.\n */\nexport function loadEnvFiles(root: string, options?: LoadEnvFilesOptions): void {\n const env = options?.env ?? process.env;\n const files = options?.files ?? resolveDefaultEnvFiles(envProfileFromProcess({ env }));\n\n for (const name of files) {\n parseEnvFile(resolve(root, name), env);\n }\n\n options?.afterLoad?.();\n}\n","import { existsSync, readFileSync } from \"node:fs\";\nimport { dirname, resolve } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\n/**\n * Resolve project root from a module URL (typically `import.meta.url`).\n * @param relativePath Path relative to the module file (default `\"..\"` = parent directory).\n */\nexport function resolveProjectRootFromModule(importMetaUrl: string, relativePath = \"..\"): string {\n return resolve(fileURLToPath(new URL(relativePath, importMetaUrl)));\n}\n\n/**\n * Walk upward from `importMetaUrl` until a `package.json` with matching `name` is found.\n * Use for esbuild bundles under `dist/` where a single `..` hop lands in `dist/`, not repo root.\n */\nexport function resolveProjectRootByPackageName(importMetaUrl: string, packageName: string): string {\n let dir = dirname(fileURLToPath(importMetaUrl));\n for (;;) {\n const packageJsonPath = resolve(dir, \"package.json\");\n if (existsSync(packageJsonPath)) {\n const pkg = JSON.parse(readFileSync(packageJsonPath, \"utf8\")) as { name?: string };\n if (pkg.name === packageName) {\n return dir;\n }\n }\n const parent = dirname(dir);\n if (parent === dir) {\n break;\n }\n dir = parent;\n }\n throw new Error(`Could not find package root for \"${packageName}\" from ${importMetaUrl}`);\n}\n","import { envBool } from \"../../../node/env/env-parsers\";\n\n/** Master switch — env name kept for compatibility (`LOG_PERSIST_ENABLED`). */\nexport function logSpoolEnabledFromEnv(env: NodeJS.ProcessEnv = process.env): boolean {\n return envBool(\"LOG_PERSIST_ENABLED\", false, env);\n}\n\nexport function logPersistServiceFromEnv(env: NodeJS.ProcessEnv = process.env): string | undefined {\n const raw = env.LOG_PERSIST_SERVICE?.trim();\n return raw != null && raw !== \"\" ? raw : undefined;\n}\n\nexport function logPersistProcessFromEnv(env: NodeJS.ProcessEnv = process.env): string | undefined {\n const raw = env.LOG_PERSIST_PROCESS?.trim();\n return raw != null && raw !== \"\" ? raw : undefined;\n}\n\n/** `LOG_PERSIST_REGISTRY_DIR` or `RUNTIME_DATA_DIR`. */\nexport function runtimeDataDirFromEnv(env: NodeJS.ProcessEnv = process.env): string | undefined {\n const configured = env.LOG_PERSIST_REGISTRY_DIR?.trim();\n if (configured != null && configured !== \"\") {\n return configured;\n }\n const runtime = env.RUNTIME_DATA_DIR?.trim();\n return runtime != null && runtime !== \"\" ? runtime : undefined;\n}\n","import { createLogger } from \"../core/create-logger\";\n\n/** User-facing / lifecycle logs — may be persisted like normal app logs. */\nexport const LOG_PERSIST_TOPIC = \"log-persist\";\n\n/** Operational logs from the persist pipeline — never re-offered to avoid feedback loops. */\nexport const LOG_PERSIST_INTERNAL_TOPIC = \"log-persist-internal\";\n\ntype PipelineLogData = Record<string, unknown>;\n\nfunction createPipelineLogger(module: string) {\n const logger = createLogger({ module });\n\n function write(level: \"debug\" | \"info\" | \"warn\" | \"error\", message: string, data?: PipelineLogData): void {\n logger[level](message, {\n topic: LOG_PERSIST_INTERNAL_TOPIC,\n ...(data != null ? { data } : {}),\n });\n }\n\n return {\n debug: (message: string, data?: PipelineLogData) => write(\"debug\", message, data),\n info: (message: string, data?: PipelineLogData) => write(\"info\", message, data),\n warn: (message: string, data?: PipelineLogData) => write(\"warn\", message, data),\n error: (message: string, data?: PipelineLogData) => write(\"error\", message, data),\n };\n}\n\n/** Supabase upload path (`postLogBatch`). */\nexport const persistLogger = createPipelineLogger(\"log-upload\");\n\n/** File spool writer + collector. */\nexport const spoolLogger = createPipelineLogger(\"log-spool\");\n\nexport function isLogPersistInternalTopic(topic: string | undefined): boolean {\n return topic === LOG_PERSIST_INTERNAL_TOPIC;\n}\n","import { join } from \"node:path\";\nimport { runtimeDataDirFromEnv } from \"../upload/env\";\nimport type { LogSpoolProcessRole } from \"./interface\";\n\nexport const LOG_SPOOL_DIR_NAME = \"log-spool\";\n\nexport function resolveLogSpoolRoot(explicit?: string): string {\n if (explicit != null && explicit.trim() !== \"\") {\n return explicit;\n }\n const configured = process.env.LOG_SPOOL_DIR?.trim();\n if (configured != null && configured !== \"\") {\n return configured;\n }\n const runtimeDir = runtimeDataDirFromEnv();\n if (runtimeDir == null) {\n throw new Error(\n \"[LogSpool] spool root required: set LOG_SPOOL_DIR or LOG_PERSIST_REGISTRY_DIR / RUNTIME_DATA_DIR\",\n );\n }\n return join(runtimeDir, LOG_SPOOL_DIR_NAME);\n}\n\nexport function logSpoolServiceDir(spoolRoot: string, serviceId: string): string {\n return join(spoolRoot, serviceId);\n}\n\nexport function logSpoolProcessDir(spoolRoot: string, serviceId: string, processRole: LogSpoolProcessRole): string {\n return join(spoolRoot, serviceId, processRole);\n}\n","/** Four-process L3 blueprint roles — always scanned by collect-log. */\nexport const LOG_SPOOL_CORE_PROCESS_ROLES = [\"main\", \"guard\", \"scheduler\", \"worker\"] as const;\n\nexport type LogSpoolCoreProcessRole = (typeof LOG_SPOOL_CORE_PROCESS_ROLES)[number];\n\n/** Spool directory / `LOG_PERSIST_PROCESS` name — core or service-specific extra. */\nexport type LogSpoolProcessRole = LogSpoolCoreProcessRole | string;\n\nexport const LOG_SPOOL_EXTRA_PROCESS_ROLES_ENV = \"LOG_SPOOL_EXTRA_PROCESS_ROLES\";\n\nconst EXTRA_ROLE_PATTERN = /^[a-z][a-z0-9-]*$/;\n\nfunction parseRoleList(raw: string | undefined): string[] {\n if (raw == null || raw.trim() === \"\") {\n return [];\n }\n return raw\n .split(\",\")\n .map((part) => part.trim())\n .filter((part) => part !== \"\");\n}\n\n/** Parse comma-separated extra roles from env (e.g. `chrome-sidecar`). */\nexport function logSpoolExtraProcessRolesFromEnv(env: NodeJS.ProcessEnv = process.env): string[] {\n return parseRoleList(env[LOG_SPOOL_EXTRA_PROCESS_ROLES_ENV]);\n}\n\n/** Core + extras, deduped, stable order (core first). */\nexport function resolveAllLogSpoolProcessRoles(env: NodeJS.ProcessEnv = process.env): LogSpoolProcessRole[] {\n const extras = logSpoolExtraProcessRolesFromEnv(env);\n const seen = new Set<string>(LOG_SPOOL_CORE_PROCESS_ROLES);\n const all: LogSpoolProcessRole[] = [...LOG_SPOOL_CORE_PROCESS_ROLES];\n for (const role of extras) {\n if (!seen.has(role)) {\n seen.add(role);\n all.push(role);\n }\n }\n return all;\n}\n\nexport function isLogSpoolCoreProcessRole(value: string): value is LogSpoolCoreProcessRole {\n return (LOG_SPOOL_CORE_PROCESS_ROLES as readonly string[]).includes(value);\n}\n\n/** Whether `value` is a known spool role (core or configured extra). */\nexport function isKnownLogSpoolProcessRole(value: string, env: NodeJS.ProcessEnv = process.env): boolean {\n if (isLogSpoolCoreProcessRole(value)) {\n return true;\n }\n return logSpoolExtraProcessRolesFromEnv(env).includes(value);\n}\n\n/** Validate extra role token — lowercase alphanumeric + hyphen, not a duplicate core name. */\nexport function assertValidLogSpoolExtraProcessRole(role: string): void {\n if (role === \"\" || !EXTRA_ROLE_PATTERN.test(role)) {\n throw new Error(\n `[LogSpool] invalid extra process role \"${role}\" — use lowercase letters, digits, hyphen (e.g. chrome-sidecar)`,\n );\n }\n if (isLogSpoolCoreProcessRole(role)) {\n throw new Error(`[LogSpool] extra process role \"${role}\" duplicates a core role`);\n }\n}\n\nexport function mergeLogSpoolExtraProcessRolesEnv(env: NodeJS.ProcessEnv, extraRoles: readonly string[]): void {\n if (extraRoles.length === 0) {\n return;\n }\n for (const role of extraRoles) {\n assertValidLogSpoolExtraProcessRole(role);\n }\n const merged = new Set([...logSpoolExtraProcessRolesFromEnv(env), ...extraRoles]);\n env[LOG_SPOOL_EXTRA_PROCESS_ROLES_ENV] = [...merged].join(\",\");\n}\n","import { postListCreate } from \"../../../list/list.api\";\nimport { CategoryList } from \"../../../list/list.interface\";\nimport type { LogEntry } from \"../core/log-manager\";\nimport type { BuildLogListDraftInput, LogListDraft } from \"./interface\";\nimport { LOG_BATCH_LIST_VALUE } from \"./interface\";\nimport { persistLogger } from \"./logger\";\n\nexport function estimateEntriesBytes(entries: LogEntry[]): number {\n if (entries.length === 0) {\n return 0;\n }\n try {\n return Buffer.byteLength(JSON.stringify(entries), \"utf8\");\n } catch {\n return entries.length * 512;\n }\n}\n\nexport function buildLogListDraft(input: BuildLogListDraftInput): LogListDraft {\n const { service, process, lane, entries } = input;\n const first = entries[0];\n const last = entries[entries.length - 1];\n\n return {\n name: service,\n value: LOG_BATCH_LIST_VALUE,\n category: CategoryList.LIST,\n tagList: [\"log\", lane, service],\n details: {\n manifestVersion: 0,\n loaderKey: LOG_BATCH_LIST_VALUE,\n meta: {\n service,\n process,\n pid: globalThis.process.pid,\n lane,\n count: entries.length,\n from: first?.timestamp ?? null,\n to: last?.timestamp ?? null,\n flushedAt: Date.now(),\n },\n preview: first?.message ?? \"\",\n items: entries,\n },\n };\n}\n\nasync function withTimeout<T>(promise: Promise<T>, timeoutMs: number, label: string): Promise<T> {\n let timer: ReturnType<typeof setTimeout> | null = null;\n try {\n return await Promise.race([\n promise,\n new Promise<T>((_resolve, reject) => {\n timer = setTimeout(() => {\n reject(new Error(`${label} timed out after ${timeoutMs}ms`));\n }, timeoutMs);\n }),\n ]);\n } finally {\n if (timer != null) {\n clearTimeout(timer);\n }\n }\n}\n\nexport async function postLogBatch(draft: LogListDraft, postTimeoutMs: number): Promise<void> {\n const result = await withTimeout(\n postListCreate({\n name: draft.name,\n value: draft.value,\n category: draft.category,\n details: draft.details,\n }),\n postTimeoutMs,\n \"postListCreate\",\n );\n\n if (!result.success) {\n const message = result.error?.message ?? \"postListCreate failed\";\n persistLogger.error(\"post log batch failed\", {\n name: draft.name,\n error: message,\n });\n throw new Error(message);\n }\n}\n\n/** Take a prefix of entries that fits within maxBytes. */\nexport function takeEntriesWithinBytes(entries: LogEntry[], maxBytes: number): LogEntry[] {\n if (entries.length === 0) {\n return [];\n }\n\n const taken: LogEntry[] = [];\n for (const entry of entries) {\n const candidate = [...taken, entry];\n if (taken.length > 0 && estimateEntriesBytes(candidate) > maxBytes) {\n break;\n }\n taken.push(entry);\n }\n\n const result = taken.length > 0 ? taken : [entries[0]];\n if (result.length < entries.length) {\n persistLogger.warn(\"trimmed batch to maxBytes\", {\n requested: entries.length,\n taken: result.length,\n maxBytes,\n takenBytes: estimateEntriesBytes(result),\n });\n }\n\n return result;\n}\n","import { mkdir, rename, writeFile } from \"node:fs/promises\";\nimport { join } from \"node:path\";\nimport type { LogEntry } from \"../core/log-manager\";\nimport { estimateEntriesBytes, takeEntriesWithinBytes } from \"../upload/flush\";\nimport { registerLogPersistOffer } from \"../upload/hook\";\nimport { isLogPersistInternalTopic, spoolLogger } from \"../upload/logger\";\nimport { DEFAULT_LOG_SPOOL_CONFIG, resolveLogSpoolConfig } from \"./config\";\nimport { buildLogSpoolBatchBaseName, randomLogSpoolShortId } from \"./file\";\nimport type { EnableLogSpoolOptions, LogSpoolBatchFile, LogSpoolProcessRole, LogSpoolWriterStats } from \"./interface\";\nimport { logSpoolProcessDir, resolveLogSpoolRoot } from \"./paths\";\n\nclass LogSpoolWriter {\n private static instance: LogSpoolWriter | null = null;\n\n private enabled = false;\n private buffer: LogEntry[] = [];\n private flushInProgress = false;\n private debounceTimer: ReturnType<typeof setTimeout> | null = null;\n private ageTimer: ReturnType<typeof setTimeout> | null = null;\n private serviceId: string | null = null;\n private processRole: LogSpoolProcessRole | null = null;\n private serviceValue: string | null = null;\n private spoolRoot: string | null = null;\n private config = DEFAULT_LOG_SPOOL_CONFIG.writer;\n\n static getInstance(): LogSpoolWriter {\n LogSpoolWriter.instance ??= new LogSpoolWriter();\n return LogSpoolWriter.instance;\n }\n\n async enable(options: EnableLogSpoolOptions): Promise<void> {\n if (this.enabled) {\n spoolLogger.warn(\"log spool writer already enabled\", {\n serviceId: this.serviceId,\n processRole: this.processRole,\n });\n return;\n }\n\n this.serviceId = options.serviceId;\n this.processRole = options.processRole;\n this.serviceValue = options.serviceValue;\n this.spoolRoot = options.spoolRoot ?? resolveLogSpoolRoot();\n this.config = resolveLogSpoolConfig(options.config).writer;\n this.enabled = true;\n\n registerLogPersistOffer((entry) => this.offer(entry));\n\n spoolLogger.info(\"log spool writer enabled\", {\n serviceId: options.serviceId,\n processRole: options.processRole,\n serviceValue: options.serviceValue,\n spoolRoot: this.spoolRoot,\n config: this.config,\n });\n }\n\n async shutdown(): Promise<void> {\n this.cancelDebounce();\n this.cancelAgeFlush();\n registerLogPersistOffer(null);\n this.enabled = false;\n\n while (this.buffer.length > 0) {\n await this.flushChunk({ reason: \"shutdown\" });\n }\n\n spoolLogger.info(\"log spool writer shutdown complete\", {\n serviceId: this.serviceId,\n processRole: this.processRole,\n });\n }\n\n getStats(): LogSpoolWriterStats {\n return {\n enabled: this.enabled,\n bufferedEntries: this.buffer.length,\n bufferedBytes: estimateEntriesBytes(this.buffer),\n flushInProgress: this.flushInProgress,\n debouncePending: this.debounceTimer != null,\n ageFlushPending: this.ageTimer != null,\n serviceId: this.serviceId,\n processRole: this.processRole,\n };\n }\n\n offer(entry: LogEntry): void {\n if (isLogPersistInternalTopic(entry.topic)) {\n return;\n }\n\n if (!this.enabled) {\n return;\n }\n\n if (this.buffer.length === 0) {\n this.scheduleAgeFlush();\n }\n\n this.buffer.push(entry);\n\n if (this.shouldScheduleDebouncedFlush()) {\n this.scheduleDebouncedFlush();\n }\n }\n\n private shouldScheduleDebouncedFlush(): boolean {\n return (\n this.buffer.length >= this.config.maxEntries || estimateEntriesBytes(this.buffer) >= this.config.maxBytes\n );\n }\n\n private scheduleDebouncedFlush(): void {\n if (this.debounceTimer != null) {\n return;\n }\n\n spoolLogger.debug(\"log spool flush debounce scheduled\", {\n debounceMs: this.config.flushDebounceMs,\n bufferedEntries: this.buffer.length,\n });\n\n this.debounceTimer = setTimeout(() => {\n this.debounceTimer = null;\n void this.flushChunk({ reason: \"debounce\" });\n }, this.config.flushDebounceMs);\n this.debounceTimer.unref?.();\n }\n\n private scheduleAgeFlush(): void {\n if (this.ageTimer != null) {\n return;\n }\n\n spoolLogger.debug(\"log spool age flush scheduled\", {\n maxAgeMs: this.config.maxAgeMs,\n });\n\n this.ageTimer = setTimeout(() => {\n this.ageTimer = null;\n void this.flushChunk({ reason: \"maxAge\" });\n }, this.config.maxAgeMs);\n this.ageTimer.unref?.();\n }\n\n private cancelDebounce(): void {\n if (this.debounceTimer != null) {\n clearTimeout(this.debounceTimer);\n this.debounceTimer = null;\n }\n }\n\n private cancelAgeFlush(): void {\n if (this.ageTimer != null) {\n clearTimeout(this.ageTimer);\n this.ageTimer = null;\n }\n }\n\n private async flushChunk(input: { reason: string }): Promise<void> {\n if (this.flushInProgress || this.buffer.length === 0) {\n return;\n }\n if (this.serviceId == null || this.processRole == null || this.serviceValue == null || this.spoolRoot == null) {\n return;\n }\n\n this.cancelDebounce();\n this.cancelAgeFlush();\n this.flushInProgress = true;\n try {\n const byCount = this.buffer.slice(0, this.config.maxEntries);\n const entries = takeEntriesWithinBytes(byCount, this.config.maxBytes);\n this.buffer = this.buffer.slice(entries.length);\n\n if (entries.length === 0) {\n if (this.buffer.length > 0) {\n this.scheduleAgeFlush();\n } else {\n this.cancelAgeFlush();\n }\n return;\n }\n\n const batchFile = await this.writeBatchTmp({\n entries,\n serviceId: this.serviceId,\n processRole: this.processRole,\n serviceValue: this.serviceValue,\n spoolRoot: this.spoolRoot,\n });\n\n spoolLogger.info(\"log spool flushed to tmp\", {\n reason: input.reason,\n fileName: batchFile.fileName,\n entryCount: entries.length,\n remainingBuffered: this.buffer.length,\n });\n\n if (this.buffer.length > 0) {\n this.scheduleAgeFlush();\n if (this.shouldScheduleDebouncedFlush()) {\n this.scheduleDebouncedFlush();\n }\n } else {\n this.cancelAgeFlush();\n }\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n spoolLogger.error(\"log spool flush failed\", { reason: input.reason, error: message });\n if (this.buffer.length > 0) {\n this.scheduleAgeFlush();\n }\n } finally {\n this.flushInProgress = false;\n }\n }\n\n private async writeBatchTmp(input: {\n entries: LogEntry[];\n serviceId: string;\n processRole: LogSpoolProcessRole;\n serviceValue: string;\n spoolRoot: string;\n }): Promise<{ fileName: string; tmpPath: string }> {\n const first = input.entries[0];\n const shortHash = randomLogSpoolShortId();\n const baseName = buildLogSpoolBatchBaseName({\n processRole: input.processRole,\n firstEntryTimestamp: first.timestamp,\n shortHash,\n });\n const fileName = `${baseName}.tmp`;\n const processDir = logSpoolProcessDir(input.spoolRoot, input.serviceId, input.processRole);\n await mkdir(processDir, { recursive: true });\n\n const tmpPath = join(processDir, fileName);\n const partPath = `${tmpPath}.part`;\n const payload: LogSpoolBatchFile = {\n entries: input.entries,\n meta: {\n serviceId: input.serviceId,\n processRole: input.processRole,\n serviceValue: input.serviceValue,\n },\n };\n const content = `${JSON.stringify(payload)}\\n`;\n\n await writeFile(partPath, content, \"utf8\");\n await rename(partPath, tmpPath);\n\n return { fileName, tmpPath };\n }\n}\n\nexport { LogSpoolWriter };\n\nexport async function enableLogSpoolWriter(options: EnableLogSpoolOptions): Promise<void> {\n await LogSpoolWriter.getInstance().enable(options);\n}\n\nexport async function shutdownLogSpoolWriter(): Promise<void> {\n await LogSpoolWriter.getInstance().shutdown();\n}\n\nexport function getLogSpoolWriterStats(): LogSpoolWriterStats {\n return LogSpoolWriter.getInstance().getStats();\n}\n","import { createLogger } from \"../core/create-logger\";\nimport { logPersistProcessFromEnv, logPersistServiceFromEnv, logSpoolEnabledFromEnv } from \"../upload/env\";\nimport { registerLogPersistOffer } from \"../upload/hook\";\nimport { LOG_PERSIST_TOPIC } from \"../upload/logger\";\nimport { LOG_SPOOL_SERVICE_ID_ENV, logSpoolConfigFromEnv, logSpoolServiceIdFromEnv } from \"./config\";\nimport type { EnsureLogSpoolFromEnvOptions, LogSpoolProcessRole } from \"./interface\";\nimport { resolveLogSpoolRoot } from \"./paths\";\nimport {\n assertValidLogSpoolExtraProcessRole,\n isKnownLogSpoolProcessRole,\n LOG_SPOOL_EXTRA_PROCESS_ROLES_ENV,\n} from \"./process-roles\";\nimport { enableLogSpoolWriter, getLogSpoolWriterStats, shutdownLogSpoolWriter } from \"./writer\";\n\nexport { logSpoolEnabledFromEnv };\n\nexport function resolveLogSpoolProcessRole(explicit?: string): LogSpoolProcessRole {\n const raw = explicit ?? logPersistProcessFromEnv();\n if (raw == null || raw === \"\") {\n throw new Error(\"[LogSpool] LOG_PERSIST_PROCESS is required when LOG_PERSIST_ENABLED=true\");\n }\n if (!isKnownLogSpoolProcessRole(raw)) {\n throw new Error(\n `[LogSpool] invalid LOG_PERSIST_PROCESS: ${raw} (not a core role and not listed in ${LOG_SPOOL_EXTRA_PROCESS_ROLES_ENV})`,\n );\n }\n return raw;\n}\n\n/**\n * Env vars for child spawn after main claims registry slot.\n * Optional when using {@link ManagedChildProcesses.spawn} — auto-injected from parent env.\n */\nexport function buildLogSpoolSpawnEnv(input: {\n serviceId: string;\n processRole: LogSpoolProcessRole;\n}): Record<string, string> {\n return {\n [LOG_SPOOL_SERVICE_ID_ENV]: input.serviceId,\n LOG_PERSIST_PROCESS: input.processRole,\n };\n}\n\n/**\n * When persistence is enabled and parent has `LOG_SPOOL_SERVICE_ID`, map spawn `label`\n * to spool env when `label` is a known core or extra process role.\n */\nexport function resolveLogSpoolSpawnEnvForLabel(\n label: string,\n env: NodeJS.ProcessEnv = process.env,\n): Record<string, string> {\n if (!logSpoolEnabledFromEnv(env)) {\n return {};\n }\n const serviceId = env[LOG_SPOOL_SERVICE_ID_ENV]?.trim();\n if (serviceId == null || serviceId === \"\") {\n return {};\n }\n if (!isKnownLogSpoolProcessRole(label, env)) {\n return {};\n }\n return buildLogSpoolSpawnEnv({ serviceId, processRole: label });\n}\n\nexport async function ensureLogSpoolFromEnv(options: EnsureLogSpoolFromEnvOptions = {}): Promise<boolean> {\n if (!logSpoolEnabledFromEnv()) {\n registerLogPersistOffer(null);\n return false;\n }\n\n const serviceId = options.serviceId ?? logSpoolServiceIdFromEnv();\n const serviceValue = options.serviceValue ?? logPersistServiceFromEnv();\n const processRole = resolveLogSpoolProcessRole(options.processRole);\n\n if (serviceId == null || serviceId === \"\") {\n throw new Error(\n \"[LogSpool] LOG_SPOOL_SERVICE_ID is required when LOG_PERSIST_ENABLED=true (set after registry claim or pass serviceId)\",\n );\n }\n if (serviceValue == null || serviceValue === \"\") {\n throw new Error(\"[LogSpool] LOG_PERSIST_SERVICE is required when LOG_PERSIST_ENABLED=true\");\n }\n\n const spoolRoot = options.spoolRoot ?? resolveLogSpoolRoot();\n\n await enableLogSpoolWriter({\n serviceId,\n processRole,\n serviceValue,\n spoolRoot,\n config: options.config ?? logSpoolConfigFromEnv(),\n });\n\n const lifecycleLogger = createLogger({ module: \"log-spool\" });\n lifecycleLogger.info(\"log spool enabled from env\", {\n topic: LOG_PERSIST_TOPIC,\n data: { serviceId, processRole, serviceValue, spoolRoot },\n });\n\n return true;\n}\n\nexport async function shutdownLogSpoolFromEnv(): Promise<void> {\n await shutdownLogSpoolWriter();\n}\n\nexport function getLogSpoolStats(): ReturnType<typeof getLogSpoolWriterStats> {\n return getLogSpoolWriterStats();\n}\n\nexport function validateLogSpoolPreloadEnv(env: NodeJS.ProcessEnv = process.env): void {\n if (!logSpoolEnabledFromEnv(env)) {\n return;\n }\n\n const missing: string[] = [];\n if (env.LOG_PERSIST_SERVICE?.trim() == null || env.LOG_PERSIST_SERVICE.trim() === \"\") {\n missing.push(\"LOG_PERSIST_SERVICE\");\n }\n const runtimeDir = env.LOG_PERSIST_REGISTRY_DIR?.trim() || env.RUNTIME_DATA_DIR?.trim();\n if (runtimeDir == null || runtimeDir === \"\") {\n missing.push(\"LOG_PERSIST_REGISTRY_DIR or RUNTIME_DATA_DIR\");\n }\n\n if (missing.length > 0) {\n throw new Error(`[LogSpool] preload env incomplete: ${missing.join(\", \")}`);\n }\n\n for (const role of env[LOG_SPOOL_EXTRA_PROCESS_ROLES_ENV]?.split(\",\") ?? []) {\n const trimmed = role.trim();\n if (trimmed === \"\") {\n continue;\n }\n assertValidLogSpoolExtraProcessRole(trimmed);\n }\n}\n"],"names":[],"mappings":";;;;;;AAGA,MAAM,iBAAiB,GAAG,CAAC,YAAY,EAAE,MAAM,CAAU;AACzD,MAAM,cAAc,GAAG,CAAC,WAAW,CAAU;AAEtC,MAAM,2BAA2B,GAAG;AACpC,MAAM,wBAAwB,GAAG;AACjC,MAAM,aAAa,GAAG;AAO7B;AACM,SAAU,qBAAqB,CAAC,OAAsC,EAAA;IACxE,MAAM,GAAG,GAAG,OAAO,EAAE,GAAG,IAAI,OAAO,CAAC,GAAG;IACvC,MAAM,IAAI,GAAG,OAAO,EAAE,IAAI,IAAI,OAAO,CAAC,IAAI;IAC1C,MAAM,OAAO,GAAG,GAAG,CAAC,2BAA2B,CAAC,EAAE,IAAI,EAAE;IACxD,IAAI,OAAO,IAAI,IAAI,IAAI,OAAO,KAAK,EAAE,EAAE;AACnC,QAAA,OAAO,OAAO;IAClB;AACA,IAAA,IAAI,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAE;AAC9B,QAAA,OAAO,wBAAwB;IACnC;AACA,IAAA,OAAO,SAAS;AACpB;AAEA;AAC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AAC,EAAE,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE;AACzE,QAAA,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE;AAC3B,QAAA,IAAI,OAAO,KAAK,EAAE,EAAE;YAChB;QACJ;QACA,mCAAmC,CAAC,OAAO,CAAC;IAChD;AACJ;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { W as validateWithSchema, m as getTarget, l as getPossibleTarget, L as LOG_BATCH_LIST_VALUE, k as generateResponse, T as updateTargetDetails, f as createLogger, g as createTarget, q as isCreateTargetAlreadyExistsError, J as scanTargetList, B as BaseValidator, a as CategoryList, a1 as LOG_SPOOL_SERVICE_ID_ENV, h as deleteTarget, s as isOptimisticLockError, n as getTargetList, e as OPTIMISTIC_LOCK_FAILED_MESSAGE, O as OPTIMISTIC_LOCK_ERROR_CODE, K as supabase, w as logManager } from './config-
|
|
1
|
+
import { W as validateWithSchema, m as getTarget, l as getPossibleTarget, L as LOG_BATCH_LIST_VALUE, k as generateResponse, T as updateTargetDetails, f as createLogger, g as createTarget, q as isCreateTargetAlreadyExistsError, J as scanTargetList, B as BaseValidator, a as CategoryList, a1 as LOG_SPOOL_SERVICE_ID_ENV, h as deleteTarget, s as isOptimisticLockError, n as getTargetList, e as OPTIMISTIC_LOCK_FAILED_MESSAGE, O as OPTIMISTIC_LOCK_ERROR_CODE, K as supabase, w as logManager } from './config-t31awPWL.js';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import 'node:crypto';
|
|
4
4
|
|
|
@@ -3413,11 +3413,11 @@ var ResultCode;
|
|
|
3413
3413
|
ResultCode[ResultCode["UNKNOWN_ERROR"] = 9999] = "UNKNOWN_ERROR";
|
|
3414
3414
|
})(ResultCode || (ResultCode = {}));
|
|
3415
3415
|
|
|
3416
|
-
const TASK_STATUS_FIELD = "
|
|
3416
|
+
const TASK_STATUS_FIELD = "status";
|
|
3417
3417
|
const TASK_NODE_ID_FIELD = "details->>nodeId";
|
|
3418
3418
|
// ─── State machine ───────────────────────────────────────────────────────────
|
|
3419
3419
|
/**
|
|
3420
|
-
* Task state machine (field: `
|
|
3420
|
+
* Task state machine (field: top-level `target.status`)
|
|
3421
3421
|
*
|
|
3422
3422
|
* ```text
|
|
3423
3423
|
* publish claim (CLAIM / patchClaimTask) finish
|
|
@@ -3541,12 +3541,13 @@ function clearExecutionState() {
|
|
|
3541
3541
|
return { progress: 0, nodeId: null, result: undefined };
|
|
3542
3542
|
}
|
|
3543
3543
|
// ─── Internal transitions ────────────────────────────────────────────────────
|
|
3544
|
-
async function transitionTask({ id, optimisticLockFilterList, updateFn, updateExtraFn, }) {
|
|
3544
|
+
async function transitionTask({ id, optimisticLockFilterList, updateFn, updateExtraFn, nextStatus, }) {
|
|
3545
3545
|
return updateTargetDetails({
|
|
3546
3546
|
id,
|
|
3547
3547
|
optimisticLockFilterList,
|
|
3548
3548
|
updateFn,
|
|
3549
3549
|
updateExtraFn,
|
|
3550
|
+
updateStatusFn: nextStatus == null ? undefined : () => nextStatus,
|
|
3550
3551
|
});
|
|
3551
3552
|
}
|
|
3552
3553
|
function logTaskTransition(logger, action, task, data) {
|
|
@@ -3556,7 +3557,7 @@ function logTaskTransition(logger, action, task, data) {
|
|
|
3556
3557
|
action,
|
|
3557
3558
|
taskId: task.id,
|
|
3558
3559
|
taskValue: task.value,
|
|
3559
|
-
status: task.
|
|
3560
|
+
status: task.status,
|
|
3560
3561
|
nodeId: task.details.nodeId,
|
|
3561
3562
|
...data,
|
|
3562
3563
|
},
|
|
@@ -3567,9 +3568,9 @@ async function claimTaskById({ taskId, nodeId, updateExtraFn, }) {
|
|
|
3567
3568
|
return transitionTask({
|
|
3568
3569
|
id: taskId,
|
|
3569
3570
|
optimisticLockFilterList: lockOnStatus(TaskStatus.TODO),
|
|
3571
|
+
nextStatus: TaskStatus.DOING,
|
|
3570
3572
|
updateFn: (details) => ({
|
|
3571
3573
|
...details,
|
|
3572
|
-
status: TaskStatus.DOING,
|
|
3573
3574
|
nodeId,
|
|
3574
3575
|
}),
|
|
3575
3576
|
updateExtraFn,
|
|
@@ -3585,10 +3586,10 @@ const patchChangeTaskStatus = validateWithSchema(patchChangeTaskStatusSchema, "p
|
|
|
3585
3586
|
const data = await transitionTask({
|
|
3586
3587
|
id,
|
|
3587
3588
|
optimisticLockFilterList: lockOnStatus(TaskStatus.OPEN),
|
|
3589
|
+
nextStatus: TaskStatus.TODO,
|
|
3588
3590
|
updateFn: (details) => ({
|
|
3589
3591
|
...details,
|
|
3590
3592
|
...clearExecutionState(),
|
|
3591
|
-
status: TaskStatus.TODO,
|
|
3592
3593
|
}),
|
|
3593
3594
|
updateExtraFn,
|
|
3594
3595
|
});
|
|
@@ -3606,10 +3607,10 @@ const patchChangeTaskStatus = validateWithSchema(patchChangeTaskStatusSchema, "p
|
|
|
3606
3607
|
const data = await transitionTask({
|
|
3607
3608
|
id,
|
|
3608
3609
|
optimisticLockFilterList: lockOnReset(nodeId),
|
|
3610
|
+
nextStatus: TaskStatus.OPEN,
|
|
3609
3611
|
updateFn: (details) => ({
|
|
3610
3612
|
...details,
|
|
3611
3613
|
...clearExecutionState(),
|
|
3612
|
-
status: TaskStatus.OPEN,
|
|
3613
3614
|
}),
|
|
3614
3615
|
updateExtraFn,
|
|
3615
3616
|
});
|
|
@@ -3621,10 +3622,10 @@ const patchChangeTaskStatus = validateWithSchema(patchChangeTaskStatusSchema, "p
|
|
|
3621
3622
|
const data = await transitionTask({
|
|
3622
3623
|
id,
|
|
3623
3624
|
optimisticLockFilterList: lockOnDoingOwner(nodeId),
|
|
3625
|
+
nextStatus: TaskStatus.TODO,
|
|
3624
3626
|
updateFn: (details) => ({
|
|
3625
3627
|
...details,
|
|
3626
3628
|
...clearExecutionState(),
|
|
3627
|
-
status: TaskStatus.TODO,
|
|
3628
3629
|
}),
|
|
3629
3630
|
updateExtraFn,
|
|
3630
3631
|
});
|
|
@@ -3635,10 +3636,8 @@ const patchChangeTaskStatus = validateWithSchema(patchChangeTaskStatusSchema, "p
|
|
|
3635
3636
|
const data = await transitionTask({
|
|
3636
3637
|
id,
|
|
3637
3638
|
optimisticLockFilterList: lockOnStatus(TaskStatus.OPEN, TaskStatus.DONE),
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
status: TaskStatus.CLOSED,
|
|
3641
|
-
}),
|
|
3639
|
+
nextStatus: TaskStatus.CLOSED,
|
|
3640
|
+
updateFn: (details) => details,
|
|
3642
3641
|
updateExtraFn,
|
|
3643
3642
|
});
|
|
3644
3643
|
logTaskTransition(logger, action, data);
|
|
@@ -3649,10 +3648,10 @@ const patchChangeTaskStatus = validateWithSchema(patchChangeTaskStatusSchema, "p
|
|
|
3649
3648
|
const data = await transitionTask({
|
|
3650
3649
|
id,
|
|
3651
3650
|
optimisticLockFilterList: lockOnDoingOwner(nodeId),
|
|
3651
|
+
nextStatus: TaskStatus.DONE,
|
|
3652
3652
|
updateFn: (details) => ({
|
|
3653
3653
|
...details,
|
|
3654
3654
|
progress: 100,
|
|
3655
|
-
status: TaskStatus.DONE,
|
|
3656
3655
|
nodeId,
|
|
3657
3656
|
result: {
|
|
3658
3657
|
cost,
|
|
@@ -3691,7 +3690,7 @@ const patchTaskProgress = validateWithSchema(patchTaskProgressSchema, "patchTask
|
|
|
3691
3690
|
/**
|
|
3692
3691
|
* Discover and claim one TODO task for this node.
|
|
3693
3692
|
*
|
|
3694
|
-
* Match criteria (all required): `
|
|
3693
|
+
* Match criteria (all required): `status = TODO`, `value ∈ availableTaskList`, and when
|
|
3695
3694
|
* `namePrefixList` is non-empty, `name` matches any listed prefix. Those filters are independent
|
|
3696
3695
|
* (AND); omitting `namePrefixList` does not relax the `value` constraint.
|
|
3697
3696
|
*
|
|
@@ -3813,9 +3812,9 @@ async function createTaskRow({ name, value, params, taskStatus, tagList, extra,
|
|
|
3813
3812
|
category: CategoryTask.TASK,
|
|
3814
3813
|
tagList,
|
|
3815
3814
|
extra,
|
|
3815
|
+
status: taskStatus,
|
|
3816
3816
|
details: {
|
|
3817
3817
|
manifestVersion: 0,
|
|
3818
|
-
status: taskStatus,
|
|
3819
3818
|
params,
|
|
3820
3819
|
progress: 0,
|
|
3821
3820
|
nodeId: null,
|
|
@@ -3894,14 +3893,14 @@ function countTasksByType(tasks, taskType, statuses) {
|
|
|
3894
3893
|
const filtered = tasks.filter((task) => task.value === taskType);
|
|
3895
3894
|
const counts = {};
|
|
3896
3895
|
for (const status of statuses) {
|
|
3897
|
-
counts[status] = filtered.filter((task) => task.
|
|
3896
|
+
counts[status] = filtered.filter((task) => task.status === status).length;
|
|
3898
3897
|
}
|
|
3899
3898
|
return counts;
|
|
3900
3899
|
}
|
|
3901
3900
|
/** Total tasks of `taskType` whose status is in `statuses`. */
|
|
3902
3901
|
function summarizeTaskQueue(tasks, taskType, statuses) {
|
|
3903
|
-
return tasks.filter((task) => task.value === taskType && statuses.includes(task.
|
|
3902
|
+
return tasks.filter((task) => task.value === taskType && statuses.includes(task.status)).length;
|
|
3904
3903
|
}
|
|
3905
3904
|
|
|
3906
3905
|
export { createClaimedRegistrySlotRuntimeState as $, ApiMethod as A, buildFeedLinkDraft as B, CategoryConfig as C, DEFAULT_SYSTEM_REGISTRY_SEED_SLOTS as D, EMPTY_REGISTRY_SLOT_RUNTIME_STATE as E, FEED_VALUES as F, buildFeedLinkName as G, buildIdeaImageLinkDraft as H, IDEA_IMAGE_LINK_NAME as I, buildIdeaLinkDraft as J, buildLinkTargetDraft as K, LINK_MANIFEST_VERSION as L, MEDIA_CONTENT_HASH_ALGORITHM as M, NodeKind as N, buildListTargetDraft as O, POST_TASK_DEFAULT_MAX_ATTEMPTS as P, buildMediaLinkDraft as Q, ResultCode as R, ServiceLifecycleStatus as S, TARGET_SYSTEM_REGISTRY_KEY as T, buildMediaNameFromLocator as U, buildReviewLinkDraft as V, buildSystemRegistryConfigDetails as W, claimServiceRegistrySlot as X, classifyNetworkError as Y, countTasksByType as Z, createActiveServiceLifecycle as _, CategoryExtraction as a, patchNodeHeartBeat as a$, createStorageProviderRegistry as a0, createUploadTracker as a1, decodeLogBatch as a2, decodeLogBatchList as a3, defaultL3ServiceDetails as a4, deleteParcel as a5, deleteParcelSchema as a6, escapeIlikePattern as a7, evaluateBusyNodeLiveness as a8, feedLinkDedupFilters as a9, isHttpUrl as aA, isIdeaImageLinkName as aB, isLocalFilesystemPath as aC, isLogBatchList as aD, isLogEntry as aE, isMediaValue as aF, isOpaqueChunkUrl as aG, isRetryableHttpStatus as aH, linkDedupFilters as aI, linkTargetDraftBuildInputSchema as aJ, mediaLinkDedupFilters as aK, nodesForTaskLiveness as aL, normalizeStringList as aM, parcelDetailsSchema as aN, parseIdeaOriginal as aO, parseLogBatchMeta as aP, parseProviderPrefixedUrl as aQ, parseServiceSlot as aR, parseServiceSlots as aS, patchChangeNodeStatus as aT, patchChangeNodeStatusSchema as aU, patchChangeTaskStatus as aV, patchChangeTaskStatusSchema as aW, patchClaimTask as aX, patchClaimTaskSchema as aY, patchExtractionObjects as aZ, patchExtractionObjectsSchema as a_, fetchBinaryWithRetry as aa, fetchWithRetry as ab, fieldDefinitionSchema as ac, flattenLogBatch as ad, flattenLogBatches as ae, formatNetworkError as af, getApi as ag, getApiSchema as ah, getConfig as ai, getConfigSchema as aj, getExtraction as ak, getExtractionSchema as al, getParcel as am, getParcelSchema as an, getScanRemoteRepoValues as ao, getScanRemoteRepoValuesSchema as ap, getService as aq, getServiceSchema as ar, getTargetSystemRegistry as as, getValueAtPath as at, guessMediaMime as au, ideaCreateSchema as av, ideaLinkValueFilters as aw, ideaUpdateSchema as ax, installChunkFetchRegistry as ay, isFeedValue as az, CategoryLink as b, createTaskRow as b$, patchNodeHeartBeatSchema as b0, patchServiceRuntime as b1, patchStopNode as b2, patchStopNodeSchema as b3, patchTaskProgress as b4, patchTaskProgressSchema as b5, postApi as b6, postApiSchema as b7, postExtraction as b8, postExtractionSchema as b9, restoreParcel as bA, restoreParcelById as bB, reviewLinksForNameFilters as bC, runRegistrySlotGuardCheck as bD, sanitizeFileName as bE, sanitizeParcelFileName as bF, scanExtractionList as bG, scanExtractionListSchema as bH, schemaDefinitionSchema as bI, serviceDetailsSchema as bJ, serviceLifecycleSchema as bK, serviceNodeSnapshotSchema as bL, serviceRuntimeSchema as bM, sha256Hex as bN, summarizeTaskQueue as bO, systemRegistrySeedSlotSchema as bP, toPostgrestTextArrayLiteral as bQ, unregisterService as bR, unregisterServiceAtShutdown as bS, getErrorMessage as bT, LOG_TOPIC_NODE as bU, isFeedIngestSource as bV, resolveFeedOriginalStorageProvider as bW, buildFeedTagList as bX, LOG_TOPIC_TASK as bY, CRITICAL_UNKNOWN_TASK_TRACE_ID as bZ, toError as b_, postLinkCreate as ba, postParcel as bb, postParcelSchema as bc, postRegisterNode as bd, postRegisterNodeSchema as be, postService as bf, postServiceInstance as bg, postServiceSchema as bh, postSystemRegistryConfig as bi, postSystemRegistryConfigSchema as bj, postTask as bk, postTaskSchema as bl, postTaskWithRetry as bm, publishParcel as bn, registerProviderChunkResolver as bo, registerService as bp, registerServiceAtStartup as bq, registrySlotRuntimePatchFromGuardResult as br, releaseSystemRegistrySlots as bs, releaseSystemRegistrySlotsByServiceId as bt, requestHasBody as bu, requireNodeServiceIdFromEnv as bv, resetSystemRegistryConfig as bw, resetSystemRegistryConfigSchema as bx, resolveActiveRegistryServiceId as by, resolveFetchUrl as bz, CategoryNode as c, FEED_INGEST_SOURCES as c0, CategoryParcel as d, CategoryRepo as e, CategoryService as f, CategoryTask as g, IDEA_IMAGE_TAG_RAW as h, IDEA_IMAGE_TEMP_DIR as i, IDEA_LINK_VALUE as j, LIST_MANIFEST_VERSION as k, MEDIA_CONTENT_HASH_PREFIX_LENGTH as l, MEDIA_VALUES as m, NodeStatus as n, ParcelManager as o, PostLinkValidator as p, ServiceRegistryError as q, ServiceSlotStatus as r, TASK_REPO_USAGE as s, TaskStatus as t, TaskStatusAction as u, apiDetailsSchema as v, appendSystemRegistryEmptySlots as w, assertRegistrySlotAvailable as x, assertRegistrySlotOwner as y, buildEmptyServiceSlots as z };
|
|
3907
|
-
//# sourceMappingURL=task-queue-
|
|
3906
|
+
//# sourceMappingURL=task-queue-BpLJ8skY.js.map
|