@happyvertical/jobs 0.80.6 → 0.81.1

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.
@@ -1,4 +1,4 @@
1
- import { n as priorityToNumber, t as BaseJobStore } from "../chunks/base-store-DIasEzL0.js";
1
+ import { n as priorityToNumber, t as BaseJobStore } from "../chunks/base-store-Cac1FH1X.js";
2
2
  import { createId } from "@happyvertical/utils";
3
3
  //#region src/adapters/bull.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { n as priorityToNumber, t as BaseJobStore } from "../chunks/base-store-DIasEzL0.js";
1
+ import { n as priorityToNumber, t as BaseJobStore } from "../chunks/base-store-Cac1FH1X.js";
2
2
  import { createId } from "@happyvertical/utils";
3
3
  //#region src/adapters/bullmq.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { n as priorityToNumber, t as BaseJobStore } from "../chunks/base-store-DIasEzL0.js";
1
+ import { n as priorityToNumber, t as BaseJobStore } from "../chunks/base-store-Cac1FH1X.js";
2
2
  import { createId } from "@happyvertical/utils";
3
3
  //#region src/adapters/cloud-tasks.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { r as validateTableName, t as BaseJobStore } from "../chunks/base-store-DIasEzL0.js";
1
+ import { r as validateTableName, t as BaseJobStore } from "../chunks/base-store-Cac1FH1X.js";
2
2
  import { getDatabase } from "@happyvertical/sql";
3
3
  //#region src/adapters/postgres.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { r as validateTableName, t as BaseJobStore } from "../chunks/base-store-DIasEzL0.js";
1
+ import { r as validateTableName, t as BaseJobStore } from "../chunks/base-store-Cac1FH1X.js";
2
2
  import { getDatabase, syncSchema } from "@happyvertical/sql";
3
3
  //#region src/adapters/sqlite.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { n as priorityToNumber, t as BaseJobStore } from "../chunks/base-store-DIasEzL0.js";
1
+ import { n as priorityToNumber, t as BaseJobStore } from "../chunks/base-store-Cac1FH1X.js";
2
2
  import { createId } from "@happyvertical/utils";
3
3
  //#region src/adapters/sqs.ts
4
4
  /**
@@ -42,6 +42,11 @@ export declare abstract class BaseJobStore implements JobStore {
42
42
  };
43
43
  /**
44
44
  * Build ORDER BY clause for filters
45
+ *
46
+ * Both halves are interpolated rather than bound, and `JobFilter`'s literal
47
+ * types are erased at runtime, so both are resolved against an allowlist.
48
+ *
49
+ * @throws Error if the order direction is neither blank nor `asc`/`desc`
45
50
  */
46
51
  protected buildOrderBy(filter: JobFilter): string;
47
52
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"base-store.d.ts","sourceRoot":"","sources":["../src/base-store.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,cAAc,EACd,GAAG,EACH,gBAAgB,EAEhB,gBAAgB,EAChB,YAAY,EACZ,SAAS,EACT,WAAW,EACX,QAAQ,EACR,UAAU,EAEX,MAAM,YAAY,CAAC;AAOpB;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAa3D;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,WAAW,GAAG,MAAM,GAAG,SAAS,GACzC,MAAM,CAcR;AAED;;GAEG;AACH,8BAAsB,YAAa,YAAW,QAAQ;IACpD,SAAS,CAAC,SAAS,EAAE,GAAG,CAAC,gBAAgB,CAAC,CAAa;IACvD,SAAS,CAAC,WAAW,UAAS;IAE9B;;OAEG;IACH,QAAQ,CAAC,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAEpC;;OAEG;IACH,SAAS,CAAC,eAAe,CAAC,OAAO,EAAE,gBAAgB,GAAG,GAAG;IA+BzD;;OAEG;cACa,SAAS,CACvB,IAAI,EAAE,YAAY,EAClB,GAAG,EAAE,GAAG,EACR,KAAK,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,aAAa,CAAC,EAAE,MAAM,CAAA;KAAE,GACjD,OAAO,CAAC,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C;IAClE,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IACnD,QAAQ,CAAC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAChC"}
@@ -202,6 +202,10 @@ var DEFAULT_RETRY_STRATEGY = exponential({
202
202
  */
203
203
  var TABLE_NAME_PATTERN = /^[a-zA-Z_][a-zA-Z0-9_]*$/;
204
204
  /**
205
+ * Directions accepted in an ORDER BY clause
206
+ */
207
+ var VALID_DIRECTIONS = /* @__PURE__ */ new Set(["ASC", "DESC"]);
208
+ /**
205
209
  * Validate table name to prevent SQL injection
206
210
  * @throws Error if table name contains invalid characters
207
211
  */
@@ -323,16 +327,27 @@ var BaseJobStore = class {
323
327
  }
324
328
  /**
325
329
  * Build ORDER BY clause for filters
330
+ *
331
+ * Both halves are interpolated rather than bound, and `JobFilter`'s literal
332
+ * types are erased at runtime, so both are resolved against an allowlist.
333
+ *
334
+ * @throws Error if the order direction is neither blank nor `asc`/`desc`
326
335
  */
327
336
  buildOrderBy(filter) {
328
337
  const field = filter.orderBy ?? "createdAt";
329
338
  const dir = filter.orderDir ?? "desc";
330
- return `ORDER BY ${{
339
+ const fieldMap = {
331
340
  createdAt: "created_at",
332
341
  runAt: "run_at",
333
342
  priority: "priority",
334
343
  attempts: "attempts"
335
- }[field] ?? "created_at"} ${dir.toUpperCase()}`;
344
+ };
345
+ const column = typeof field === "string" && Object.hasOwn(fieldMap, field) ? fieldMap[field] : "created_at";
346
+ if (typeof dir !== "string") throw new Error(`Invalid job order direction: ${typeof dir}`);
347
+ const trimmedDir = dir.trim();
348
+ const normalizedDir = trimmedDir === "" ? "DESC" : trimmedDir.toUpperCase();
349
+ if (!VALID_DIRECTIONS.has(normalizedDir)) throw new Error(`Invalid job order direction: ${JSON.stringify(trimmedDir.slice(0, 32))}`);
350
+ return `ORDER BY ${column} ${normalizedDir}`;
336
351
  }
337
352
  /**
338
353
  * Build LIMIT/OFFSET clause
@@ -383,4 +398,4 @@ var BaseJobStore = class {
383
398
  //#endregion
384
399
  export { custom as a, linear as c, DEFAULT_RETRY_STRATEGY as i, noRetry as l, priorityToNumber as n, exponential as o, validateTableName as r, fromConfig as s, BaseJobStore as t };
385
400
 
386
- //# sourceMappingURL=base-store-DIasEzL0.js.map
401
+ //# sourceMappingURL=base-store-Cac1FH1X.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base-store-Cac1FH1X.js","names":[],"sources":["../../src/retry.ts","../../src/base-store.ts"],"sourcesContent":["import type {\n RetryDecision,\n RetryStrategy,\n RetryStrategyConfig,\n} from './types.js';\n\n/**\n * Options for exponential backoff retry strategy\n */\nexport interface ExponentialBackoffOptions {\n /** Initial delay in milliseconds (default: 1000) */\n initialDelay?: number;\n /** Maximum delay in milliseconds (default: 300000 = 5 minutes) */\n maxDelay?: number;\n /** Multiplier for each attempt (default: 2) */\n multiplier?: number;\n /** Add random jitter to prevent thundering herd (default: true) */\n jitter?: boolean;\n /** Maximum attempts (optional, can also be set on job) */\n maxAttempts?: number;\n}\n\n/**\n * Exponential backoff retry strategy\n *\n * Delay increases exponentially: initialDelay * multiplier^(attempt-1)\n * With optional jitter to prevent thundering herd problem.\n */\nclass ExponentialBackoffStrategy implements RetryStrategy {\n private readonly initialDelay: number;\n private readonly maxDelay: number;\n private readonly multiplier: number;\n private readonly jitter: boolean;\n private readonly maxAttempts: number | null;\n\n constructor(options: ExponentialBackoffOptions = {}) {\n this.initialDelay = options.initialDelay ?? 1000;\n this.maxDelay = options.maxDelay ?? 300000;\n this.multiplier = options.multiplier ?? 2;\n this.jitter = options.jitter ?? true;\n this.maxAttempts = options.maxAttempts ?? null;\n }\n\n shouldRetry(attempt: number, _error: Error): RetryDecision {\n // Check max attempts if configured\n if (this.maxAttempts !== null && attempt >= this.maxAttempts) {\n return { shouldRetry: false, delay: 0 };\n }\n\n // Calculate base delay: initialDelay * multiplier^(attempt-1)\n let delay = this.initialDelay * this.multiplier ** (attempt - 1);\n\n // Cap at maxDelay\n delay = Math.min(delay, this.maxDelay);\n\n // Add jitter (±25% randomization)\n if (this.jitter) {\n const jitterRange = delay * 0.25;\n delay = delay - jitterRange + Math.random() * jitterRange * 2;\n }\n\n return { shouldRetry: true, delay: Math.round(delay) };\n }\n\n toConfig(): RetryStrategyConfig {\n return {\n type: 'exponential',\n config: {\n initialDelay: this.initialDelay,\n maxDelay: this.maxDelay,\n multiplier: this.multiplier,\n jitter: this.jitter,\n maxAttempts: this.maxAttempts,\n },\n };\n }\n}\n\n/**\n * Options for linear retry strategy\n */\nexport interface LinearBackoffOptions {\n /** Fixed delay between retries in milliseconds (default: 5000) */\n delay?: number;\n /** Maximum attempts (optional) */\n maxAttempts?: number;\n}\n\n/**\n * Linear retry strategy\n *\n * Uses a fixed delay between all retry attempts.\n */\nclass LinearBackoffStrategy implements RetryStrategy {\n private readonly delay: number;\n private readonly maxAttempts: number | null;\n\n constructor(options: LinearBackoffOptions = {}) {\n this.delay = options.delay ?? 5000;\n this.maxAttempts = options.maxAttempts ?? null;\n }\n\n shouldRetry(attempt: number, _error: Error): RetryDecision {\n if (this.maxAttempts !== null && attempt >= this.maxAttempts) {\n return { shouldRetry: false, delay: 0 };\n }\n\n return { shouldRetry: true, delay: this.delay };\n }\n\n toConfig(): RetryStrategyConfig {\n return {\n type: 'linear',\n config: {\n delay: this.delay,\n maxAttempts: this.maxAttempts,\n },\n };\n }\n}\n\n/**\n * Custom retry decision function\n */\nexport type CustomRetryFn = (attempt: number, error: Error) => RetryDecision;\n\n/**\n * Custom retry strategy\n *\n * Allows full control over retry logic via a custom function.\n */\nclass CustomRetryStrategy implements RetryStrategy {\n private readonly fn: CustomRetryFn;\n private readonly fnString: string;\n\n constructor(fn: CustomRetryFn) {\n this.fn = fn;\n // Store string representation for serialization\n this.fnString = fn.toString();\n }\n\n shouldRetry(attempt: number, error: Error): RetryDecision {\n return this.fn(attempt, error);\n }\n\n toConfig(): RetryStrategyConfig {\n return {\n type: 'custom',\n config: {\n fn: this.fnString,\n },\n };\n }\n}\n\n/**\n * No retry strategy - never retry\n */\nclass NoRetryStrategy implements RetryStrategy {\n shouldRetry(_attempt: number, _error: Error): RetryDecision {\n return { shouldRetry: false, delay: 0 };\n }\n\n toConfig(): RetryStrategyConfig {\n return {\n type: 'linear',\n config: { maxAttempts: 1 },\n };\n }\n}\n\n// Factory functions\n\n/**\n * Create an exponential backoff retry strategy\n *\n * @example\n * ```typescript\n * const strategy = exponential({\n * initialDelay: 1000,\n * maxDelay: 300000,\n * multiplier: 2,\n * jitter: true,\n * });\n * ```\n */\nexport function exponential(\n options?: ExponentialBackoffOptions,\n): RetryStrategy {\n return new ExponentialBackoffStrategy(options);\n}\n\n/**\n * Create a linear retry strategy with fixed delay\n *\n * @example\n * ```typescript\n * const strategy = linear({ delay: 5000 });\n * ```\n */\nexport function linear(options?: LinearBackoffOptions): RetryStrategy {\n return new LinearBackoffStrategy(options);\n}\n\n/**\n * Create a custom retry strategy\n *\n * @example\n * ```typescript\n * const strategy = custom((attempt, error) => {\n * if (error.message.includes('RATE_LIMITED')) {\n * return { shouldRetry: true, delay: 60000 };\n * }\n * return { shouldRetry: attempt < 3, delay: attempt * 1000 };\n * });\n * ```\n */\nexport function custom(fn: CustomRetryFn): RetryStrategy {\n return new CustomRetryStrategy(fn);\n}\n\n/**\n * Create a no-retry strategy\n *\n * @example\n * ```typescript\n * const strategy = noRetry();\n * ```\n */\nexport function noRetry(): RetryStrategy {\n return new NoRetryStrategy();\n}\n\n/**\n * Reconstruct a retry strategy from its config\n */\nexport function fromConfig(config: RetryStrategyConfig): RetryStrategy {\n switch (config.type) {\n case 'exponential':\n return new ExponentialBackoffStrategy(\n config.config as ExponentialBackoffOptions,\n );\n case 'linear':\n return new LinearBackoffStrategy(config.config as LinearBackoffOptions);\n case 'custom':\n // For custom strategies loaded from config, we can't reconstruct the function\n // So we fall back to exponential\n console.warn(\n 'Custom retry strategy cannot be reconstructed from config, using exponential',\n );\n return new ExponentialBackoffStrategy();\n default:\n return new ExponentialBackoffStrategy();\n }\n}\n\n/**\n * Default retry strategy\n */\nexport const DEFAULT_RETRY_STRATEGY = exponential({\n initialDelay: 1000,\n maxDelay: 300000,\n multiplier: 2,\n jitter: true,\n});\n","import { createId } from '@happyvertical/utils';\nimport { DEFAULT_RETRY_STRATEGY } from './retry.js';\nimport type {\n CleanupOptions,\n Job,\n JobCreateOptions,\n JobEvent,\n JobEventListener,\n JobEventType,\n JobFilter,\n JobPriority,\n JobStore,\n QueueStats,\n RetryStrategyConfig,\n} from './types.js';\n\n/**\n * Valid table name pattern: alphanumeric and underscores, must start with letter or underscore\n */\nconst TABLE_NAME_PATTERN = /^[a-zA-Z_][a-zA-Z0-9_]*$/;\n\n/**\n * Directions accepted in an ORDER BY clause\n */\nconst VALID_DIRECTIONS = new Set(['ASC', 'DESC']);\n\n/**\n * Validate table name to prevent SQL injection\n * @throws Error if table name contains invalid characters\n */\nexport function validateTableName(tableName: string): string {\n if (!tableName || tableName.length === 0) {\n throw new Error('Table name cannot be empty');\n }\n if (tableName.length > 128) {\n throw new Error('Table name cannot exceed 128 characters');\n }\n if (!TABLE_NAME_PATTERN.test(tableName)) {\n throw new Error(\n `Invalid table name \"${tableName}\": must contain only alphanumeric characters and underscores, and must start with a letter or underscore`,\n );\n }\n return tableName;\n}\n\n/**\n * Convert priority string to number\n */\nexport function priorityToNumber(\n priority: JobPriority | number | undefined,\n): number {\n if (typeof priority === 'number') return priority;\n switch (priority) {\n case 'critical':\n return 100;\n case 'high':\n return 75;\n case 'normal':\n return 50;\n case 'low':\n return 25;\n default:\n return 50;\n }\n}\n\n/**\n * Base job store with common functionality\n */\nexport abstract class BaseJobStore implements JobStore {\n protected listeners: Set<JobEventListener> = new Set();\n protected initialized = false;\n\n /**\n * Initialize the store - must be implemented by subclasses\n */\n abstract initialize(): Promise<void>;\n\n /**\n * Create a new job record\n */\n protected createJobRecord(options: JobCreateOptions): Job {\n const now = new Date();\n const retryConfig: RetryStrategyConfig =\n options.retryStrategy && 'toConfig' in options.retryStrategy\n ? options.retryStrategy.toConfig()\n : ((options.retryStrategy as RetryStrategyConfig) ??\n DEFAULT_RETRY_STRATEGY.toConfig());\n\n return {\n id: createId(),\n queue: options.queue ?? 'default',\n payload: options.payload,\n status: 'pending',\n priority: priorityToNumber(options.priority),\n attempts: 0,\n maxAttempts: options.maxAttempts ?? 3,\n runAt: options.runAt ?? now,\n startedAt: null,\n completedAt: null,\n timeout: options.timeout ?? 300000,\n timeoutBehavior: options.timeoutBehavior ?? 'fail',\n lastError: null,\n resultPointer: null,\n retryStrategy: retryConfig,\n workerId: null,\n workerHeartbeat: null,\n createdAt: now,\n updatedAt: now,\n };\n }\n\n /**\n * Emit a job event to all listeners\n */\n protected async emitEvent(\n type: JobEventType,\n job: Job,\n extra?: { error?: string; resultPointer?: string },\n ): Promise<void> {\n const event: JobEvent = {\n type,\n job,\n timestamp: new Date(),\n ...extra,\n };\n\n const promises = Array.from(this.listeners).map((listener) =>\n Promise.resolve(listener(event)).catch((err) => {\n console.error('Job event listener error:', err);\n }),\n );\n\n await Promise.allSettled(promises);\n }\n\n /**\n * Subscribe to job events\n */\n subscribe(listener: JobEventListener): () => void {\n this.listeners.add(listener);\n return () => {\n this.listeners.delete(listener);\n };\n }\n\n /**\n * Build WHERE clause for filters\n */\n protected buildFilterWhere(filter: JobFilter): {\n where: string;\n params: unknown[];\n } {\n const conditions: string[] = [];\n const params: unknown[] = [];\n\n if (filter.queue) {\n conditions.push('queue = ?');\n params.push(filter.queue);\n }\n\n if (filter.status) {\n if (Array.isArray(filter.status)) {\n const placeholders = filter.status.map(() => '?').join(', ');\n conditions.push(`status IN (${placeholders})`);\n params.push(...filter.status);\n } else {\n conditions.push('status = ?');\n params.push(filter.status);\n }\n }\n\n if (filter.objectType) {\n conditions.push(\"json_extract(payload, '$.objectType') = ?\");\n params.push(filter.objectType);\n }\n\n if (filter.method) {\n conditions.push(\"json_extract(payload, '$.method') = ?\");\n params.push(filter.method);\n }\n\n if (filter.createdAfter) {\n conditions.push('created_at > ?');\n params.push(filter.createdAfter.toISOString());\n }\n\n if (filter.createdBefore) {\n conditions.push('created_at < ?');\n params.push(filter.createdBefore.toISOString());\n }\n\n return {\n where: conditions.length > 0 ? `WHERE ${conditions.join(' AND ')}` : '',\n params,\n };\n }\n\n /**\n * Build ORDER BY clause for filters\n *\n * Both halves are interpolated rather than bound, and `JobFilter`'s literal\n * types are erased at runtime, so both are resolved against an allowlist.\n *\n * @throws Error if the order direction is neither blank nor `asc`/`desc`\n */\n protected buildOrderBy(filter: JobFilter): string {\n const field = filter.orderBy ?? 'createdAt';\n const dir = filter.orderDir ?? 'desc';\n\n const fieldMap: Record<string, string> = {\n createdAt: 'created_at',\n runAt: 'run_at',\n priority: 'priority',\n attempts: 'attempts',\n };\n\n // `hasOwn`, not `fieldMap[field] ?? …`: a plain object literal inherits\n // from Object.prototype, so 'constructor' and friends resolve to a truthy\n // inherited value and never reach the fallback. The `typeof` conjunct\n // keeps the check and the read from coercing a non-string key twice — a\n // stateful `toString` could otherwise return a different key to each.\n const column =\n typeof field === 'string' && Object.hasOwn(fieldMap, field)\n ? fieldMap[field]\n : 'created_at';\n\n if (typeof dir !== 'string') {\n // Report the type, not the value: interpolating a symbol or a\n // null-prototype object would itself throw a TypeError.\n throw new Error(`Invalid job order direction: ${typeof dir}`);\n }\n\n // A blank direction — `?orderDir=` from an unfilled field — means\n // unspecified, not hostile; the `??` above only catches null/undefined.\n const trimmedDir = dir.trim();\n const normalizedDir = trimmedDir === '' ? 'DESC' : trimmedDir.toUpperCase();\n if (!VALID_DIRECTIONS.has(normalizedDir)) {\n // Quoted and bounded: the raw value reaches logs, where an unescaped\n // newline would let a caller forge a log line.\n throw new Error(\n `Invalid job order direction: ${JSON.stringify(trimmedDir.slice(0, 32))}`,\n );\n }\n\n return `ORDER BY ${column} ${normalizedDir}`;\n }\n\n /**\n * Build LIMIT/OFFSET clause\n */\n protected buildLimitOffset(filter: JobFilter): {\n clause: string;\n params: unknown[];\n } {\n const params: unknown[] = [];\n let clause = '';\n\n if (filter.limit) {\n clause = 'LIMIT ?';\n params.push(filter.limit);\n\n if (filter.offset) {\n clause += ' OFFSET ?';\n params.push(filter.offset);\n }\n }\n\n return { clause, params };\n }\n\n /**\n * Parse a job row from the database\n */\n protected parseJobRow(row: Record<string, unknown>): Job {\n return {\n id: row.id as string,\n queue: row.queue as string,\n payload:\n typeof row.payload === 'string' ? JSON.parse(row.payload) : row.payload,\n status: row.status as Job['status'],\n priority: row.priority as number,\n attempts: row.attempts as number,\n maxAttempts: row.max_attempts as number,\n runAt: new Date(row.run_at as string),\n startedAt: row.started_at ? new Date(row.started_at as string) : null,\n completedAt: row.completed_at\n ? new Date(row.completed_at as string)\n : null,\n timeout: row.timeout as number,\n timeoutBehavior: row.timeout_behavior as Job['timeoutBehavior'],\n lastError: row.last_error as string | null,\n resultPointer: row.result_pointer as string | null,\n retryStrategy:\n typeof row.retry_strategy === 'string'\n ? JSON.parse(row.retry_strategy)\n : row.retry_strategy,\n workerId: row.worker_id as string | null,\n workerHeartbeat: row.worker_heartbeat\n ? new Date(row.worker_heartbeat as string)\n : null,\n createdAt: new Date(row.created_at as string),\n updatedAt: new Date(row.updated_at as string),\n };\n }\n\n // Abstract methods that must be implemented by subclasses\n abstract enqueue(options: JobCreateOptions): Promise<Job>;\n abstract dequeue(\n queues: string[],\n limit: number,\n workerId: string,\n ): Promise<Job[]>;\n abstract update(id: string, updates: Partial<Job>): Promise<Job>;\n abstract get(id: string): Promise<Job | null>;\n abstract list(filter: JobFilter): Promise<Job[]>;\n abstract cancel(id: string): Promise<void>;\n abstract cleanup(options: CleanupOptions): Promise<number>;\n abstract heartbeat(jobId: string, workerId: string): Promise<void>;\n abstract stats(queue?: string): Promise<QueueStats>;\n abstract close(): Promise<void>;\n}\n"],"mappings":";;;;;;;;AA4BA,IAAM,6BAAN,MAA0D;CACxD;CACA;CACA;CACA;CACA;CAEA,YAAY,UAAqC,CAAC,GAAG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IAAI,UAAoB;EAC9C;CACF;AAiBF"}
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a as custom, c as linear, i as DEFAULT_RETRY_STRATEGY, l as noRetry, n as priorityToNumber, o as exponential, s as fromConfig, t as BaseJobStore } from "./chunks/base-store-DIasEzL0.js";
1
+ import { a as custom, c as linear, i as DEFAULT_RETRY_STRATEGY, l as noRetry, n as priorityToNumber, o as exponential, s as fromConfig, t as BaseJobStore } from "./chunks/base-store-Cac1FH1X.js";
2
2
  import { BullJobStore } from "./adapters/bull.js";
3
3
  import { BullMQJobStore } from "./adapters/bullmq.js";
4
4
  import { CloudTasksJobStore } from "./adapters/cloud-tasks.js";
package/dist/types.d.ts CHANGED
@@ -136,9 +136,12 @@ export interface JobFilter {
136
136
  limit?: number;
137
137
  /** Offset for pagination */
138
138
  offset?: number;
139
- /** Order by field */
139
+ /** Order by field; an unrecognized field falls back to `createdAt` */
140
140
  orderBy?: 'createdAt' | 'runAt' | 'priority' | 'attempts';
141
- /** Order direction */
141
+ /**
142
+ * Order direction, case-insensitive and trimmed; omitted or blank means
143
+ * `desc`. Any other value throws.
144
+ */
142
145
  orderDir?: 'asc' | 'desc';
143
146
  }
144
147
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,SAAS,GACjB,SAAS,GACT,SAAS,GACT,WAAW,GACX,QAAQ,GACR,WAAW,CAAC;AAEhB;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;AAEvD;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,UAAU,CAAC;AAEjE;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,aAAa,GAAG,QAAQ,GAAG,QAAQ,CAAC;IAC1C,MAAM,EAAE,MAAM,CAAC,MA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CAA4C;IAC5C,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,6CAA6C;IAC7C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,8BAA8B;IAC9B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,4BAA4B;IAC5B,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,CACvB,GAAG,EAAE,GAAG,KACL,OAAO,CAAC;IAAE,MAAM,CAAC,EAAE,OAAO,CAAC;IAAC,aAAa,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAE3D;;GAEG;AACH,MAAM,WAAW,MAAM;IACrB,gBAAgB;IAChB,EAAE,EAAE,MAAM,CAAC;IACX,4BAA4B;IAC5B,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,+CAA+C;IAC/C,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACtB,iCAAiC;IACjC,SAAS,IAAI,OAAO,CAAC;IACrB,8BAA8B;IAC9B,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,GAAG,IAAI,CAAC;IAChE,4BAA4B;IAC5B,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,GAAG,IAAI,CAAC;CAClE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@happyvertical/jobs",
3
- "version": "0.80.6",
3
+ "version": "0.81.1",
4
4
  "description": "Job queue abstraction with multiple backend adapters (SQLite, PostgreSQL, Bull, SQS)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -68,8 +68,8 @@
68
68
  "author": "willgriffin@gmail.com",
69
69
  "license": "ISC",
70
70
  "dependencies": {
71
- "@happyvertical/sql": "0.80.6",
72
- "@happyvertical/utils": "0.80.6"
71
+ "@happyvertical/sql": "0.81.1",
72
+ "@happyvertical/utils": "0.81.1"
73
73
  },
74
74
  "devDependencies": {
75
75
  "@aws-sdk/client-sqs": "^3.1034.0",
@@ -1 +0,0 @@
1
- {"version":3,"file":"base-store-DIasEzL0.js","names":[],"sources":["../../src/retry.ts","../../src/base-store.ts"],"sourcesContent":["import type {\n RetryDecision,\n RetryStrategy,\n RetryStrategyConfig,\n} from './types.js';\n\n/**\n * Options for exponential backoff retry strategy\n */\nexport interface ExponentialBackoffOptions {\n /** Initial delay in milliseconds (default: 1000) */\n initialDelay?: number;\n /** Maximum delay in milliseconds (default: 300000 = 5 minutes) */\n maxDelay?: number;\n /** Multiplier for each attempt (default: 2) */\n multiplier?: number;\n /** Add random jitter to prevent thundering herd (default: true) */\n jitter?: boolean;\n /** Maximum attempts (optional, can also be set on job) */\n maxAttempts?: number;\n}\n\n/**\n * Exponential backoff retry strategy\n *\n * Delay increases exponentially: initialDelay * multiplier^(attempt-1)\n * With optional jitter to prevent thundering herd problem.\n */\nclass ExponentialBackoffStrategy implements RetryStrategy {\n private readonly initialDelay: number;\n private readonly maxDelay: number;\n private readonly multiplier: number;\n private readonly jitter: boolean;\n private readonly maxAttempts: number | null;\n\n constructor(options: ExponentialBackoffOptions = {}) {\n this.initialDelay = options.initialDelay ?? 1000;\n this.maxDelay = options.maxDelay ?? 300000;\n this.multiplier = options.multiplier ?? 2;\n this.jitter = options.jitter ?? true;\n this.maxAttempts = options.maxAttempts ?? null;\n }\n\n shouldRetry(attempt: number, _error: Error): RetryDecision {\n // Check max attempts if configured\n if (this.maxAttempts !== null && attempt >= this.maxAttempts) {\n return { shouldRetry: false, delay: 0 };\n }\n\n // Calculate base delay: initialDelay * multiplier^(attempt-1)\n let delay = this.initialDelay * this.multiplier ** (attempt - 1);\n\n // Cap at maxDelay\n delay = Math.min(delay, this.maxDelay);\n\n // Add jitter (±25% randomization)\n if (this.jitter) {\n const jitterRange = delay * 0.25;\n delay = delay - jitterRange + Math.random() * jitterRange * 2;\n }\n\n return { shouldRetry: true, delay: Math.round(delay) };\n }\n\n toConfig(): RetryStrategyConfig {\n return {\n type: 'exponential',\n config: {\n initialDelay: this.initialDelay,\n maxDelay: this.maxDelay,\n multiplier: this.multiplier,\n jitter: this.jitter,\n maxAttempts: this.maxAttempts,\n },\n };\n }\n}\n\n/**\n * Options for linear retry strategy\n */\nexport interface LinearBackoffOptions {\n /** Fixed delay between retries in milliseconds (default: 5000) */\n delay?: number;\n /** Maximum attempts (optional) */\n maxAttempts?: number;\n}\n\n/**\n * Linear retry strategy\n *\n * Uses a fixed delay between all retry attempts.\n */\nclass LinearBackoffStrategy implements RetryStrategy {\n private readonly delay: number;\n private readonly maxAttempts: number | null;\n\n constructor(options: LinearBackoffOptions = {}) {\n this.delay = options.delay ?? 5000;\n this.maxAttempts = options.maxAttempts ?? null;\n }\n\n shouldRetry(attempt: number, _error: Error): RetryDecision {\n if (this.maxAttempts !== null && attempt >= this.maxAttempts) {\n return { shouldRetry: false, delay: 0 };\n }\n\n return { shouldRetry: true, delay: this.delay };\n }\n\n toConfig(): RetryStrategyConfig {\n return {\n type: 'linear',\n config: {\n delay: this.delay,\n maxAttempts: this.maxAttempts,\n },\n };\n }\n}\n\n/**\n * Custom retry decision function\n */\nexport type CustomRetryFn = (attempt: number, error: Error) => RetryDecision;\n\n/**\n * Custom retry strategy\n *\n * Allows full control over retry logic via a custom function.\n */\nclass CustomRetryStrategy implements RetryStrategy {\n private readonly fn: CustomRetryFn;\n private readonly fnString: string;\n\n constructor(fn: CustomRetryFn) {\n this.fn = fn;\n // Store string representation for serialization\n this.fnString = fn.toString();\n }\n\n shouldRetry(attempt: number, error: Error): RetryDecision {\n return this.fn(attempt, error);\n }\n\n toConfig(): RetryStrategyConfig {\n return {\n type: 'custom',\n config: {\n fn: this.fnString,\n },\n };\n }\n}\n\n/**\n * No retry strategy - never retry\n */\nclass NoRetryStrategy implements RetryStrategy {\n shouldRetry(_attempt: number, _error: Error): RetryDecision {\n return { shouldRetry: false, delay: 0 };\n }\n\n toConfig(): RetryStrategyConfig {\n return {\n type: 'linear',\n config: { maxAttempts: 1 },\n };\n }\n}\n\n// Factory functions\n\n/**\n * Create an exponential backoff retry strategy\n *\n * @example\n * ```typescript\n * const strategy = exponential({\n * initialDelay: 1000,\n * maxDelay: 300000,\n * multiplier: 2,\n * jitter: true,\n * });\n * ```\n */\nexport function exponential(\n options?: ExponentialBackoffOptions,\n): RetryStrategy {\n return new ExponentialBackoffStrategy(options);\n}\n\n/**\n * Create a linear retry strategy with fixed delay\n *\n * @example\n * ```typescript\n * const strategy = linear({ delay: 5000 });\n * ```\n */\nexport function linear(options?: LinearBackoffOptions): RetryStrategy {\n return new LinearBackoffStrategy(options);\n}\n\n/**\n * Create a custom retry strategy\n *\n * @example\n * ```typescript\n * const strategy = custom((attempt, error) => {\n * if (error.message.includes('RATE_LIMITED')) {\n * return { shouldRetry: true, delay: 60000 };\n * }\n * return { shouldRetry: attempt < 3, delay: attempt * 1000 };\n * });\n * ```\n */\nexport function custom(fn: CustomRetryFn): RetryStrategy {\n return new CustomRetryStrategy(fn);\n}\n\n/**\n * Create a no-retry strategy\n *\n * @example\n * ```typescript\n * const strategy = noRetry();\n * ```\n */\nexport function noRetry(): RetryStrategy {\n return new NoRetryStrategy();\n}\n\n/**\n * Reconstruct a retry strategy from its config\n */\nexport function fromConfig(config: RetryStrategyConfig): RetryStrategy {\n switch (config.type) {\n case 'exponential':\n return new ExponentialBackoffStrategy(\n config.config as ExponentialBackoffOptions,\n );\n case 'linear':\n return new LinearBackoffStrategy(config.config as LinearBackoffOptions);\n case 'custom':\n // For custom strategies loaded from config, we can't reconstruct the function\n // So we fall back to exponential\n console.warn(\n 'Custom retry strategy cannot be reconstructed from config, using exponential',\n );\n return new ExponentialBackoffStrategy();\n default:\n return new ExponentialBackoffStrategy();\n }\n}\n\n/**\n * Default retry strategy\n */\nexport const DEFAULT_RETRY_STRATEGY = exponential({\n initialDelay: 1000,\n maxDelay: 300000,\n multiplier: 2,\n jitter: true,\n});\n","import { createId } from '@happyvertical/utils';\nimport { DEFAULT_RETRY_STRATEGY } from './retry.js';\nimport type {\n CleanupOptions,\n Job,\n JobCreateOptions,\n JobEvent,\n JobEventListener,\n JobEventType,\n JobFilter,\n JobPriority,\n JobStore,\n QueueStats,\n RetryStrategyConfig,\n} from './types.js';\n\n/**\n * Valid table name pattern: alphanumeric and underscores, must start with letter or underscore\n */\nconst TABLE_NAME_PATTERN = /^[a-zA-Z_][a-zA-Z0-9_]*$/;\n\n/**\n * Validate table name to prevent SQL injection\n * @throws Error if table name contains invalid characters\n */\nexport function validateTableName(tableName: string): string {\n if (!tableName || tableName.length === 0) {\n throw new Error('Table name cannot be empty');\n }\n if (tableName.length > 128) {\n throw new Error('Table name cannot exceed 128 characters');\n }\n if (!TABLE_NAME_PATTERN.test(tableName)) {\n throw new Error(\n `Invalid table name \"${tableName}\": must contain only alphanumeric characters and underscores, and must start with a letter or underscore`,\n );\n }\n return tableName;\n}\n\n/**\n * Convert priority string to number\n */\nexport function priorityToNumber(\n priority: JobPriority | number | undefined,\n): number {\n if (typeof priority === 'number') return priority;\n switch (priority) {\n case 'critical':\n return 100;\n case 'high':\n return 75;\n case 'normal':\n return 50;\n case 'low':\n return 25;\n default:\n return 50;\n }\n}\n\n/**\n * Base job store with common functionality\n */\nexport abstract class BaseJobStore implements JobStore {\n protected listeners: Set<JobEventListener> = new Set();\n protected initialized = false;\n\n /**\n * Initialize the store - must be implemented by subclasses\n */\n abstract initialize(): Promise<void>;\n\n /**\n * Create a new job record\n */\n protected createJobRecord(options: JobCreateOptions): Job {\n const now = new Date();\n const retryConfig: RetryStrategyConfig =\n options.retryStrategy && 'toConfig' in options.retryStrategy\n ? options.retryStrategy.toConfig()\n : ((options.retryStrategy as RetryStrategyConfig) ??\n DEFAULT_RETRY_STRATEGY.toConfig());\n\n return {\n id: createId(),\n queue: options.queue ?? 'default',\n payload: options.payload,\n status: 'pending',\n priority: priorityToNumber(options.priority),\n attempts: 0,\n maxAttempts: options.maxAttempts ?? 3,\n runAt: options.runAt ?? now,\n startedAt: null,\n completedAt: null,\n timeout: options.timeout ?? 300000,\n timeoutBehavior: options.timeoutBehavior ?? 'fail',\n lastError: null,\n resultPointer: null,\n retryStrategy: retryConfig,\n workerId: null,\n workerHeartbeat: null,\n createdAt: now,\n updatedAt: now,\n };\n }\n\n /**\n * Emit a job event to all listeners\n */\n protected async emitEvent(\n type: JobEventType,\n job: Job,\n extra?: { error?: string; resultPointer?: string },\n ): Promise<void> {\n const event: JobEvent = {\n type,\n job,\n timestamp: new Date(),\n ...extra,\n };\n\n const promises = Array.from(this.listeners).map((listener) =>\n Promise.resolve(listener(event)).catch((err) => {\n console.error('Job event listener error:', err);\n }),\n );\n\n await Promise.allSettled(promises);\n }\n\n /**\n * Subscribe to job events\n */\n subscribe(listener: JobEventListener): () => void {\n this.listeners.add(listener);\n return () => {\n this.listeners.delete(listener);\n };\n }\n\n /**\n * Build WHERE clause for filters\n */\n protected buildFilterWhere(filter: JobFilter): {\n where: string;\n params: unknown[];\n } {\n const conditions: string[] = [];\n const params: unknown[] = [];\n\n if (filter.queue) {\n conditions.push('queue = ?');\n params.push(filter.queue);\n }\n\n if (filter.status) {\n if (Array.isArray(filter.status)) {\n const placeholders = filter.status.map(() => '?').join(', ');\n conditions.push(`status IN (${placeholders})`);\n params.push(...filter.status);\n } else {\n conditions.push('status = ?');\n params.push(filter.status);\n }\n }\n\n if (filter.objectType) {\n conditions.push(\"json_extract(payload, '$.objectType') = ?\");\n params.push(filter.objectType);\n }\n\n if (filter.method) {\n conditions.push(\"json_extract(payload, '$.method') = ?\");\n params.push(filter.method);\n }\n\n if (filter.createdAfter) {\n conditions.push('created_at > ?');\n params.push(filter.createdAfter.toISOString());\n }\n\n if (filter.createdBefore) {\n conditions.push('created_at < ?');\n params.push(filter.createdBefore.toISOString());\n }\n\n return {\n where: conditions.length > 0 ? `WHERE ${conditions.join(' AND ')}` : '',\n params,\n };\n }\n\n /**\n * Build ORDER BY clause for filters\n */\n protected buildOrderBy(filter: JobFilter): string {\n const field = filter.orderBy ?? 'createdAt';\n const dir = filter.orderDir ?? 'desc';\n\n const fieldMap: Record<string, string> = {\n createdAt: 'created_at',\n runAt: 'run_at',\n priority: 'priority',\n attempts: 'attempts',\n };\n\n return `ORDER BY ${fieldMap[field] ?? 'created_at'} ${dir.toUpperCase()}`;\n }\n\n /**\n * Build LIMIT/OFFSET clause\n */\n protected buildLimitOffset(filter: JobFilter): {\n clause: string;\n params: unknown[];\n } {\n const params: unknown[] = [];\n let clause = '';\n\n if (filter.limit) {\n clause = 'LIMIT ?';\n params.push(filter.limit);\n\n if (filter.offset) {\n clause += ' OFFSET ?';\n params.push(filter.offset);\n }\n }\n\n return { clause, params };\n }\n\n /**\n * Parse a job row from the database\n */\n protected parseJobRow(row: Record<string, unknown>): Job {\n return {\n id: row.id as string,\n queue: row.queue as string,\n payload:\n typeof row.payload === 'string' ? JSON.parse(row.payload) : row.payload,\n status: row.status as Job['status'],\n priority: row.priority as number,\n attempts: row.attempts as number,\n maxAttempts: row.max_attempts as number,\n runAt: new Date(row.run_at as string),\n startedAt: row.started_at ? new Date(row.started_at as string) : null,\n completedAt: row.completed_at\n ? new Date(row.completed_at as string)\n : null,\n timeout: row.timeout as number,\n timeoutBehavior: row.timeout_behavior as Job['timeoutBehavior'],\n lastError: row.last_error as string | null,\n resultPointer: row.result_pointer as string | null,\n retryStrategy:\n typeof row.retry_strategy === 'string'\n ? JSON.parse(row.retry_strategy)\n : row.retry_strategy,\n workerId: row.worker_id as string | null,\n workerHeartbeat: row.worker_heartbeat\n ? new Date(row.worker_heartbeat as string)\n : null,\n createdAt: new Date(row.created_at as string),\n updatedAt: new Date(row.updated_at as string),\n };\n }\n\n // Abstract methods that must be implemented by subclasses\n abstract enqueue(options: JobCreateOptions): Promise<Job>;\n abstract dequeue(\n queues: string[],\n limit: number,\n workerId: string,\n ): Promise<Job[]>;\n abstract update(id: string, updates: Partial<Job>): Promise<Job>;\n abstract get(id: string): Promise<Job | null>;\n abstract list(filter: JobFilter): Promise<Job[]>;\n abstract cancel(id: string): Promise<void>;\n abstract cleanup(options: CleanupOptions): Promise<number>;\n abstract heartbeat(jobId: string, workerId: string): Promise<void>;\n abstract stats(queue?: string): Promise<QueueStats>;\n abstract close(): Promise<void>;\n}\n"],"mappings":";;;;;;;;AA4BA,IAAM,6BAAN,MAA0D;CACxD;CACA;CACA;CACA;CACA;CAEA,YAAY,UAAqC,CAAC,GAAG;EACnD,KAAK,eAAe,QAAQ,gBAAgB;EAC5C,KAAK,WAAW,QAAQ,YAAY;EACpC,KAAK,aAAa,QAAQ,cAAc;EACxC,KAAK,SAAS,QAAQ,UAAU;EAChC,KAAK,cAAc,QAAQ,eAAe;CAC5C;CAEA,YAAY,SAAiB,QAA8B;EAEzD,IAAI,KAAK,gBAAgB,QAAQ,WAAW,KAAK,aAC/C,OAAO;GAAE,aAAa;GAAO,OAAO;EAAE;EAIxC,IAAI,QAAQ,KAAK,eAAe,KAAK,eAAe,UAAU;EAG9D,QAAQ,KAAK,IAAI,OAAO,KAAK,QAAQ;EAGrC,IAAI,KAAK,QAAQ;GACf,MAAM,cAAc,QAAQ;GAC5B,QAAQ,QAAQ,cAAc,KAAK,OAAO,IAAI,cAAc;EAC9D;EAEA,OAAO;GAAE,aAAa;GAAM,OAAO,KAAK,MAAM,KAAK;EAAE;CACvD;CAEA,WAAgC;EAC9B,OAAO;GACL,MAAM;GACN,QAAQ;IACN,cAAc,KAAK;IACnB,UAAU,KAAK;IACf,YAAY,KAAK;IACjB,QAAQ,KAAK;IACb,aAAa,KAAK;GACpB;EACF;CACF;AACF;;;;;;AAiBA,IAAM,wBAAN,MAAqD;CACnD;CACA;CAEA,YAAY,UAAgC,CAAC,GAAG;EAC9C,KAAK,QAAQ,QAAQ,SAAS;EAC9B,KAAK,cAAc,QAAQ,eAAe;CAC5C;CAEA,YAAY,SAAiB,QAA8B;E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