@workglow/storage 0.2.27 → 0.2.29

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.
Files changed (92) hide show
  1. package/dist/browser.d.ts +0 -10
  2. package/dist/browser.d.ts.map +1 -1
  3. package/dist/browser.js +406 -4207
  4. package/dist/browser.js.map +8 -24
  5. package/dist/bun.js +341 -7235
  6. package/dist/bun.js.map +8 -35
  7. package/dist/common-server.d.ts +0 -21
  8. package/dist/common-server.d.ts.map +1 -1
  9. package/dist/common.d.ts +1 -6
  10. package/dist/common.d.ts.map +1 -1
  11. package/dist/node.js +341 -7236
  12. package/dist/node.js.map +8 -35
  13. package/package.json +5 -71
  14. package/dist/kv/IndexedDbKvStorage.d.ts +0 -27
  15. package/dist/kv/IndexedDbKvStorage.d.ts.map +0 -1
  16. package/dist/kv/PostgresKvStorage.d.ts +0 -28
  17. package/dist/kv/PostgresKvStorage.d.ts.map +0 -1
  18. package/dist/kv/SqliteKvStorage.d.ts +0 -28
  19. package/dist/kv/SqliteKvStorage.d.ts.map +0 -1
  20. package/dist/kv/SupabaseKvStorage.d.ts +0 -33
  21. package/dist/kv/SupabaseKvStorage.d.ts.map +0 -1
  22. package/dist/postgres/browser.d.ts +0 -32
  23. package/dist/postgres/browser.d.ts.map +0 -1
  24. package/dist/postgres/browser.js +0 -150
  25. package/dist/postgres/browser.js.map +0 -11
  26. package/dist/postgres/node-bun.d.ts +0 -26
  27. package/dist/postgres/node-bun.d.ts.map +0 -1
  28. package/dist/postgres/node-bun.js +0 -41
  29. package/dist/postgres/node-bun.js.map +0 -10
  30. package/dist/postgres/pglite-pool.d.ts +0 -21
  31. package/dist/postgres/pglite-pool.d.ts.map +0 -1
  32. package/dist/queue/IQueueStorage.d.ts +0 -229
  33. package/dist/queue/IQueueStorage.d.ts.map +0 -1
  34. package/dist/queue/InMemoryQueueStorage.d.ts +0 -149
  35. package/dist/queue/InMemoryQueueStorage.d.ts.map +0 -1
  36. package/dist/queue/IndexedDbQueueStorage.d.ts +0 -166
  37. package/dist/queue/IndexedDbQueueStorage.d.ts.map +0 -1
  38. package/dist/queue/PostgresQueueStorage.d.ts +0 -154
  39. package/dist/queue/PostgresQueueStorage.d.ts.map +0 -1
  40. package/dist/queue/SqliteQueueStorage.d.ts +0 -149
  41. package/dist/queue/SqliteQueueStorage.d.ts.map +0 -1
  42. package/dist/queue/SupabaseQueueStorage.d.ts +0 -195
  43. package/dist/queue/SupabaseQueueStorage.d.ts.map +0 -1
  44. package/dist/queue/TelemetryQueueStorage.d.ts +0 -33
  45. package/dist/queue/TelemetryQueueStorage.d.ts.map +0 -1
  46. package/dist/queue-limiter/IRateLimiterStorage.d.ts +0 -127
  47. package/dist/queue-limiter/IRateLimiterStorage.d.ts.map +0 -1
  48. package/dist/queue-limiter/InMemoryRateLimiterStorage.d.ts +0 -43
  49. package/dist/queue-limiter/InMemoryRateLimiterStorage.d.ts.map +0 -1
  50. package/dist/queue-limiter/IndexedDbRateLimiterStorage.d.ts +0 -79
  51. package/dist/queue-limiter/IndexedDbRateLimiterStorage.d.ts.map +0 -1
  52. package/dist/queue-limiter/PostgresRateLimiterStorage.d.ts +0 -57
  53. package/dist/queue-limiter/PostgresRateLimiterStorage.d.ts.map +0 -1
  54. package/dist/queue-limiter/SqliteRateLimiterStorage.d.ts +0 -62
  55. package/dist/queue-limiter/SqliteRateLimiterStorage.d.ts.map +0 -1
  56. package/dist/queue-limiter/SupabaseRateLimiterStorage.d.ts +0 -54
  57. package/dist/queue-limiter/SupabaseRateLimiterStorage.d.ts.map +0 -1
  58. package/dist/sqlite/browser.d.ts +0 -37
  59. package/dist/sqlite/browser.d.ts.map +0 -1
  60. package/dist/sqlite/browser.js +0 -125
  61. package/dist/sqlite/browser.js.map +0 -10
  62. package/dist/sqlite/bun.d.ts +0 -32
  63. package/dist/sqlite/bun.d.ts.map +0 -1
  64. package/dist/sqlite/bun.js +0 -84
  65. package/dist/sqlite/bun.js.map +0 -10
  66. package/dist/sqlite/canonical-api.d.ts +0 -34
  67. package/dist/sqlite/canonical-api.d.ts.map +0 -1
  68. package/dist/sqlite/node.d.ts +0 -34
  69. package/dist/sqlite/node.d.ts.map +0 -1
  70. package/dist/sqlite/node.js +0 -65
  71. package/dist/sqlite/node.js.map +0 -10
  72. package/dist/tabular/IndexedDbTabularStorage.d.ts +0 -199
  73. package/dist/tabular/IndexedDbTabularStorage.d.ts.map +0 -1
  74. package/dist/tabular/PostgresTabularStorage.d.ts +0 -196
  75. package/dist/tabular/PostgresTabularStorage.d.ts.map +0 -1
  76. package/dist/tabular/SqliteTabularStorage.d.ts +0 -167
  77. package/dist/tabular/SqliteTabularStorage.d.ts.map +0 -1
  78. package/dist/tabular/SupabaseTabularStorage.d.ts +0 -174
  79. package/dist/tabular/SupabaseTabularStorage.d.ts.map +0 -1
  80. package/dist/util/IndexedDbTable.d.ts +0 -40
  81. package/dist/util/IndexedDbTable.d.ts.map +0 -1
  82. package/dist/util/traced.d.ts +0 -10
  83. package/dist/util/traced.d.ts.map +0 -1
  84. package/dist/vector/IndexedDbVectorStorage.d.ts +0 -53
  85. package/dist/vector/IndexedDbVectorStorage.d.ts.map +0 -1
  86. package/dist/vector/PostgresVectorStorage.d.ts +0 -39
  87. package/dist/vector/PostgresVectorStorage.d.ts.map +0 -1
  88. package/dist/vector/SqliteAiVectorStorage.d.ts +0 -100
  89. package/dist/vector/SqliteAiVectorStorage.d.ts.map +0 -1
  90. package/dist/vector/SqliteVectorStorage.d.ts +0 -49
  91. package/dist/vector/SqliteVectorStorage.d.ts.map +0 -1
  92. package/src/queue/README.md +0 -41
@@ -1,154 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2025 Steven Roussey <sroussey@gmail.com>
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- import type { Pool } from "@workglow/storage/postgres";
7
- import { IQueueStorage, JobStatus, JobStorageFormat, PrefixColumn, QueueChangePayload, QueueStorageOptions, QueueSubscribeOptions } from "./IQueueStorage";
8
- export declare const POSTGRES_QUEUE_STORAGE: import("@workglow/util").ServiceToken<IQueueStorage<any, any>>;
9
- /**
10
- * PostgreSQL implementation of a job queue.
11
- * Provides storage and retrieval for job execution states using PostgreSQL.
12
- */
13
- export declare class PostgresQueueStorage<Input, Output> implements IQueueStorage<Input, Output> {
14
- protected readonly db: Pool;
15
- protected readonly queueName: string;
16
- readonly scope: "cluster";
17
- /** The prefix column definitions */
18
- protected readonly prefixes: readonly PrefixColumn[];
19
- /** The prefix values for filtering */
20
- protected readonly prefixValues: Readonly<Record<string, string | number>>;
21
- /** The table name for the job queue */
22
- protected readonly tableName: string;
23
- constructor(db: Pool, queueName: string, options?: QueueStorageOptions);
24
- /**
25
- * Gets the SQL column type for a prefix column
26
- */
27
- private getPrefixColumnType;
28
- /**
29
- * Builds the prefix columns SQL for CREATE TABLE
30
- */
31
- private buildPrefixColumnsSql;
32
- /**
33
- * Builds prefix column names for use in queries
34
- */
35
- private getPrefixColumnNames;
36
- /**
37
- * Builds WHERE clause conditions for prefix filtering
38
- * @param startParam - The starting parameter number for parameterized queries
39
- * @returns Object with conditions string and parameter values
40
- */
41
- private buildPrefixWhereClause;
42
- /**
43
- * Gets prefix values as an array in column order
44
- */
45
- private getPrefixParamValues;
46
- setupDatabase(): Promise<void>;
47
- /**
48
- * Channel name for this storage's LISTEN/NOTIFY. Mirrors the trigger's
49
- * computation so subscriber and notifier agree.
50
- */
51
- private notifyChannelName;
52
- /**
53
- * Adds a new job to the queue.
54
- * @param job - The job to add
55
- * @returns The ID of the added job
56
- */
57
- add(job: JobStorageFormat<Input, Output>): Promise<unknown>;
58
- /**
59
- * Retrieves a job by its ID.
60
- * @param id - The ID of the job to retrieve
61
- * @returns The job if found, undefined otherwise
62
- */
63
- get(id: unknown): Promise<JobStorageFormat<Input, Output> | undefined>;
64
- /**
65
- * Retrieves a slice of jobs from the queue.
66
- * @param num - Maximum number of jobs to return
67
- * @returns An array of jobs
68
- */
69
- peek(status?: JobStatus, num?: number): Promise<Array<JobStorageFormat<Input, Output>>>;
70
- /**
71
- * Retrieves the next available job that is ready to be processed.
72
- * @param workerId - Worker ID to associate with the job (required)
73
- * @returns The next job or undefined if no job is available
74
- */
75
- next(workerId: string): Promise<JobStorageFormat<Input, Output> | undefined>;
76
- /**
77
- * Retrieves the number of jobs in the queue with a specific status.
78
- * @param status - The status of the jobs to count
79
- * @returns The count of jobs with the specified status
80
- */
81
- size(status?: "PENDING"): Promise<number>;
82
- /**
83
- * Marks a job as complete with its output or error.
84
- * Enhanced error handling:
85
- * - For a retryable error, increments run_attempts and updates run_after.
86
- * - Marks a job as FAILED immediately for permanent or generic errors.
87
- */
88
- complete(jobDetails: JobStorageFormat<Input, Output>): Promise<void>;
89
- /**
90
- * Clears all jobs from the queue.
91
- */
92
- deleteAll(): Promise<void>;
93
- /**
94
- * Looks up cached output for a given input
95
- * Uses input fingerprinting for efficient matching
96
- * @returns The cached output or null if not found
97
- */
98
- outputForInput(input: Input): Promise<Output | null>;
99
- /**
100
- * Aborts a job by setting its status to "ABORTING".
101
- * This method will signal the corresponding AbortController so that
102
- * the job's execute() method (if it supports an AbortSignal parameter)
103
- * can clean up and exit.
104
- */
105
- abort(jobId: unknown): Promise<void>;
106
- /**
107
- * Releases a claimed job back to PENDING without incrementing run_attempts.
108
- * @param jobId - The id of the claimed job to release.
109
- */
110
- release(jobId: unknown): Promise<void>;
111
- /**
112
- * Retrieves all jobs for a given job run ID.
113
- * @param job_run_id - The ID of the job run to retrieve
114
- * @returns An array of jobs
115
- */
116
- getByRunId(job_run_id: string): Promise<Array<JobStorageFormat<Input, Output>>>;
117
- /**
118
- * Implements the abstract saveProgress method from JobQueue
119
- */
120
- saveProgress(jobId: unknown, progress: number, message: string, details: Record<string, any>): Promise<void>;
121
- /**
122
- * Deletes a job by its ID
123
- */
124
- delete(jobId: unknown): Promise<void>;
125
- /**
126
- * Delete jobs with a specific status older than a cutoff date
127
- * @param status - Status of jobs to delete
128
- * @param olderThanMs - Delete jobs completed more than this many milliseconds ago
129
- */
130
- deleteJobsByStatusAndAge(status: JobStatus, olderThanMs: number): Promise<void>;
131
- /**
132
- * Subscribe to INSERT/UPDATE notifications via PostgreSQL LISTEN/NOTIFY.
133
- * Replaces 100ms-poll fallback for cluster Postgres deployments — workers
134
- * wake within network-latency of an actual change rather than on a timer.
135
- *
136
- * Acquires a dedicated client from the pool (LISTEN occupies a connection
137
- * for its lifetime). On unsubscribe, runs UNLISTEN and releases the client.
138
- * On connection loss, attempts to reconnect with bounded backoff and
139
- * re-LISTEN. After every successful (re)connect — including the initial
140
- * one — emits a synthetic `{ type: "RESYNC" }` event so subscribers can
141
- * re-poll state and pick up any rows inserted during the disconnect window
142
- * (or between subscribe and the first NOTIFY landing).
143
- *
144
- * Throws synchronously when the underlying pool lacks `connect()`
145
- * (single-connection wrappers like PGLite) so the caller's try/catch can
146
- * fall back to polling. JobQueueServer.start does this and logs at debug.
147
- *
148
- * `options.prefixFilter` follows {@link QueueSubscribeOptions.prefixFilter}:
149
- * `undefined` means "use the storage instance's configured prefixValues",
150
- * `{}` means "receive all changes regardless of prefix".
151
- */
152
- subscribeToChanges(callback: (change: QueueChangePayload<Input, Output>) => void, options?: QueueSubscribeOptions): () => void;
153
- }
154
- //# sourceMappingURL=PostgresQueueStorage.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PostgresQueueStorage.d.ts","sourceRoot":"","sources":["../../src/queue/PostgresQueueStorage.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAEvD,OAAO,EACL,aAAa,EACb,SAAS,EACT,gBAAgB,EAChB,YAAY,EACZ,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,EACtB,MAAM,iBAAiB,CAAC;AAEzB,eAAO,MAAM,sBAAsB,gEAElC,CAAC;AAgBF;;;GAGG;AACH,qBAAa,oBAAoB,CAAC,KAAK,EAAE,MAAM,CAAE,YAAW,aAAa,CAAC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OAoBG;IACI,kBAAkB,CACvB,QAAQ,EAAE,CAAC,MAAM,EAAE,kBAAkB,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,IAAI,EAC7D,OAAO,CAAC,EAAE,qBAAqB,GAC9B,MAAM,IAAI,CAiKZ;CACF"}
@@ -1,149 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2025 Steven Roussey <sroussey@gmail.com>
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- import type { Sqlite } from "@workglow/storage/sqlite";
7
- import { IQueueStorage, JobStatus, JobStorageFormat, PrefixColumn, QueueChangePayload, QueueStorageOptions, QueueSubscribeOptions } from "./IQueueStorage";
8
- export declare const SQLITE_QUEUE_STORAGE: import("@workglow/util").ServiceToken<IQueueStorage<any, any>>;
9
- /**
10
- * Extended options for SQLite queue storage including prefix support
11
- */
12
- export interface SqliteQueueStorageOptions extends QueueStorageOptions {
13
- readonly deleteAfterCompletionMs?: number;
14
- readonly deleteAfterFailureMs?: number;
15
- }
16
- /**
17
- * SQLite implementation of a job queue.
18
- * Provides storage and retrieval for job execution states using SQLite.
19
- */
20
- export declare class SqliteQueueStorage<Input, Output> implements IQueueStorage<Input, Output> {
21
- protected db: Sqlite.Database;
22
- protected queueName: string;
23
- protected options?: SqliteQueueStorageOptions | undefined;
24
- /**
25
- * SQLite is in-process only at the application layer (no LISTEN/NOTIFY,
26
- * no shared client across processes). Even if the underlying file is
27
- * shared via NFS, the queue contract requires cross-process change
28
- * notification we don't provide here, so callers must treat it as
29
- * `"process"` scope.
30
- */
31
- readonly scope: "process";
32
- /** The prefix column definitions */
33
- protected readonly prefixes: readonly PrefixColumn[];
34
- /** The prefix values for filtering */
35
- protected readonly prefixValues: Readonly<Record<string, string | number>>;
36
- /** The table name for the job queue */
37
- protected readonly tableName: string;
38
- constructor(db: Sqlite.Database, queueName: string, options?: SqliteQueueStorageOptions | undefined);
39
- /**
40
- * Gets the SQL column type for a prefix column (SQLite uses TEXT for uuid)
41
- */
42
- private getPrefixColumnType;
43
- /**
44
- * Builds the prefix columns SQL for CREATE TABLE
45
- */
46
- private buildPrefixColumnsSql;
47
- /**
48
- * Builds prefix column names for use in queries
49
- */
50
- private getPrefixColumnNames;
51
- /**
52
- * Builds WHERE clause conditions for prefix filtering
53
- * @returns The conditions string with placeholders
54
- */
55
- private buildPrefixWhereClause;
56
- /**
57
- * Gets prefix values as an array in column order
58
- */
59
- private getPrefixParamValues;
60
- setupDatabase(): Promise<void>;
61
- /**
62
- * Adds a new job to the queue.
63
- * @param job - The job to add
64
- * @returns The ID of the added job
65
- */
66
- add(job: JobStorageFormat<Input, Output>): Promise<unknown>;
67
- /**
68
- * Retrieves a job by its ID.
69
- * @param id - The ID of the job to retrieve
70
- * @returns The job if found, undefined otherwise
71
- */
72
- get(id: unknown): Promise<JobStorageFormat<Input, Output> | undefined>;
73
- /**
74
- * Retrieves a slice of jobs from the queue.
75
- * @param num - Maximum number of jobs to return
76
- * @returns An array of jobs
77
- */
78
- peek(status?: JobStatus, num?: number): Promise<Array<JobStorageFormat<Input, Output>>>;
79
- /**
80
- * Aborts a job by setting its status to "ABORTING".
81
- * This method will signal the corresponding AbortController so that
82
- * the job's execute() method (if it supports an AbortSignal parameter)
83
- * can clean up and exit.
84
- */
85
- abort(jobId: unknown): Promise<void>;
86
- /**
87
- * Releases a claimed job back to PENDING without incrementing run_attempts.
88
- * @param jobId - The id of the claimed job to release.
89
- */
90
- release(jobId: unknown): Promise<void>;
91
- /**
92
- * Retrieves all jobs for a given job run ID.
93
- * @param job_run_id - The ID of the job run to retrieve
94
- * @returns An array of jobs
95
- */
96
- getByRunId(job_run_id: string): Promise<Array<JobStorageFormat<Input, Output>>>;
97
- /**
98
- * Retrieves the next available job that is ready to be processed,
99
- * and updates its status to PROCESSING.
100
- *
101
- * @param workerId - Worker ID to associate with the job
102
- * @returns The next job or undefined if no job is available
103
- */
104
- next(workerId: string): Promise<JobStorageFormat<Input, Output> | undefined>;
105
- /**
106
- * Retrieves the number of jobs in the queue with a specific status.
107
- * @param status - The status of the jobs to count
108
- * @returns The count of jobs with the specified status
109
- */
110
- size(status?: "PENDING"): Promise<number>;
111
- /**
112
- * Marks a job as complete with its output or error.
113
- * Enhanced error handling:
114
- * - Increments the retry count.
115
- * - For a retryable error, updates run_after with the retry date.
116
- * - Marks the job as FAILED for permanent or generic errors.
117
- * - Marks the job as DISABLED for disabled jobs.
118
- */
119
- complete(job: JobStorageFormat<Input, Output>): Promise<void>;
120
- deleteAll(): Promise<void>;
121
- /**
122
- * Looks up cached output for a given input
123
- * Uses input fingerprinting for efficient matching
124
- * @returns The cached output or null if not found
125
- */
126
- outputForInput(input: Input): Promise<Output | null>;
127
- /**
128
- * Implements the abstract saveProgress method from JobQueue
129
- */
130
- saveProgress(jobId: unknown, progress: number, message: string, details: Record<string, any>): Promise<void>;
131
- /**
132
- * Deletes a job by its ID
133
- */
134
- delete(jobId: unknown): Promise<void>;
135
- /**
136
- * Delete jobs with a specific status older than a cutoff date
137
- * @param status - Status of jobs to delete
138
- * @param olderThanMs - Delete jobs completed more than this many milliseconds ago
139
- */
140
- deleteJobsByStatusAndAge(status: JobStatus, olderThanMs: number): Promise<void>;
141
- /**
142
- * Subscribes to changes in the queue.
143
- * NOT IMPLEMENTED for SQLite storage.
144
- *
145
- * @throws Error always - subscribeToChanges is not supported for SQLite storage
146
- */
147
- subscribeToChanges(callback: (change: QueueChangePayload<Input, Output>) => void, options?: QueueSubscribeOptions): () => void;
148
- }
149
- //# sourceMappingURL=SqliteQueueStorage.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SqliteQueueStorage.d.ts","sourceRoot":"","sources":["../../src/queue/SqliteQueueStorage.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAEvD,OAAO,EACL,aAAa,EACb,SAAS,EACT,gBAAgB,EAChB,YAAY,EACZ,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,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EAChB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAC3B,OAAO,CAAC,IAAI,CAAC,CAoBf;IAED;;OAEG;IACU,MAAM,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CASjD;IAED;;;;OAIG;IACU,wBAAwB,CAAC,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAa3F;IAED;;;;;OAKG;IACI,kBAAkB,CACvB,QAAQ,EAAE,CAAC,MAAM,EAAE,kBAAkB,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,IAAI,EAC7D,OAAO,CAAC,EAAE,qBAAqB,GAC9B,MAAM,IAAI,CAEZ;CACF"}
@@ -1,195 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2025 Steven Roussey <sroussey@gmail.com>
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- import type { SupabaseClient } from "@supabase/supabase-js";
7
- import { IQueueStorage, JobStatus, JobStorageFormat, PrefixColumn, QueueChangePayload, QueueStorageOptions, QueueSubscribeOptions } from "./IQueueStorage";
8
- export declare const SUPABASE_QUEUE_STORAGE: import("@workglow/util").ServiceToken<IQueueStorage<any, any>>;
9
- /**
10
- * Supabase implementation of a job queue.
11
- * Provides storage and retrieval for job execution states using Supabase.
12
- */
13
- export declare class SupabaseQueueStorage<Input, Output> implements IQueueStorage<Input, Output> {
14
- protected readonly queueName: string;
15
- readonly scope: "cluster";
16
- protected readonly client: SupabaseClient;
17
- protected readonly prefixes: readonly PrefixColumn[];
18
- protected readonly prefixValues: Readonly<Record<string, string | number>>;
19
- protected readonly tableName: string;
20
- private realtimeChannel;
21
- private pollingManager;
22
- constructor(client: SupabaseClient, queueName: string, options?: QueueStorageOptions);
23
- /**
24
- * Gets the SQL column type for a prefix column (Supabase supports UUID natively)
25
- */
26
- private getPrefixColumnType;
27
- /**
28
- * Builds the prefix columns SQL for CREATE TABLE
29
- */
30
- private buildPrefixColumnsSql;
31
- /**
32
- * Builds prefix column names for use in queries
33
- */
34
- private getPrefixColumnNames;
35
- /**
36
- * Applies prefix filters to a Supabase query builder
37
- */
38
- private applyPrefixFilters;
39
- /**
40
- * Gets prefix values as an object for inserts
41
- */
42
- private getPrefixInsertValues;
43
- /**
44
- * Builds WHERE clause conditions for prefix filtering with inline values (for raw SQL)
45
- * @returns SQL conditions string with values inlined
46
- */
47
- private buildPrefixWhereSql;
48
- /**
49
- * Regex for validating SQL literal-safe strings.
50
- * Used for quoted values (e.g. queue names/IDs) and only allows alphanumeric
51
- * characters, underscores, hyphens, colons, and periods.
52
- */
53
- private static readonly SAFE_SQL_VALUE_RE;
54
- /**
55
- * Validates that a string value is safe for use as a quoted SQL literal.
56
- * Throws an error if the value contains characters outside SAFE_SQL_VALUE_RE.
57
- */
58
- private validateSqlValue;
59
- /**
60
- * Escapes a string value for use in SQL
61
- */
62
- private escapeSqlString;
63
- setupDatabase(): Promise<void>;
64
- /**
65
- * Adds a new job to the queue.
66
- * @param job - The job to add
67
- * @returns The ID of the added job
68
- */
69
- add(job: JobStorageFormat<Input, Output>): Promise<unknown>;
70
- /**
71
- * Retrieves a job by its ID.
72
- * @param id - The ID of the job to retrieve
73
- * @returns The job if found, undefined otherwise
74
- */
75
- get(id: unknown): Promise<JobStorageFormat<Input, Output> | undefined>;
76
- /**
77
- * Retrieves a slice of jobs from the queue.
78
- * @param status - The status to filter by
79
- * @param num - Maximum number of jobs to return
80
- * @returns An array of jobs
81
- */
82
- peek(status?: JobStatus, num?: number): Promise<JobStorageFormat<Input, Output>[]>;
83
- /**
84
- * Retrieves the next available job that is ready to be processed.
85
- * Uses atomic UPDATE with subquery SELECT FOR UPDATE SKIP LOCKED to prevent race conditions.
86
- * @param workerId - Worker ID to associate with the job (required)
87
- * @returns The next job or undefined if no job is available
88
- */
89
- next(workerId: string): Promise<JobStorageFormat<Input, Output> | undefined>;
90
- /**
91
- * Retrieves the number of jobs in the queue with a specific status.
92
- * @param status - The status of the jobs to count
93
- * @returns The count of jobs with the specified status
94
- */
95
- size(status?: "PENDING"): Promise<number>;
96
- private getAllJobs;
97
- /**
98
- * Marks a job as complete with its output or error.
99
- * Enhanced error handling:
100
- * - For a retryable error, increments run_attempts and updates run_after.
101
- * - Marks a job as FAILED immediately for permanent or generic errors.
102
- */
103
- complete(jobDetails: JobStorageFormat<Input, Output>): Promise<void>;
104
- /**
105
- * Releases a claimed job without consuming a retry attempt.
106
- */
107
- release(jobId: unknown): Promise<void>;
108
- /**
109
- * Clears all jobs from the queue.
110
- */
111
- deleteAll(): Promise<void>;
112
- /**
113
- * Looks up cached output for a given input
114
- * Uses input fingerprinting for efficient matching
115
- * @returns The cached output or null if not found
116
- */
117
- outputForInput(input: Input): Promise<Output | null>;
118
- /**
119
- * Aborts a job by setting its status to "ABORTING".
120
- * This method will signal the corresponding AbortController so that
121
- * the job's execute() method (if it supports an AbortSignal parameter)
122
- * can clean up and exit.
123
- */
124
- abort(jobId: unknown): Promise<void>;
125
- /**
126
- * Retrieves all jobs for a given job run ID.
127
- * @param job_run_id - The ID of the job run to retrieve
128
- * @returns An array of jobs
129
- */
130
- getByRunId(job_run_id: string): Promise<Array<JobStorageFormat<Input, Output>>>;
131
- /**
132
- * Implements the saveProgress method
133
- */
134
- saveProgress(jobId: unknown, progress: number, message: string, details: Record<string, any>): Promise<void>;
135
- /**
136
- * Deletes a job by its ID
137
- */
138
- delete(jobId: unknown): Promise<void>;
139
- /**
140
- * Delete jobs with a specific status older than a cutoff date
141
- * @param status - Status of jobs to delete
142
- * @param olderThanMs - Delete jobs completed more than this many milliseconds ago
143
- */
144
- deleteJobsByStatusAndAge(status: JobStatus, olderThanMs: number): Promise<void>;
145
- /**
146
- * Checks if a job from a realtime payload matches the specified prefix filter
147
- * @param job - The job record from the realtime payload
148
- * @param prefixFilter - The prefix filter to match against (undefined = use instance prefixes, {} = no filter)
149
- */
150
- private matchesPrefixFilter;
151
- /**
152
- * Checks if a prefix filter is custom (different from instance's prefixes).
153
- */
154
- private isCustomPrefixFilter;
155
- private getAllJobsWithFilter;
156
- /**
157
- * Subscribes to changes in the queue.
158
- * Uses Supabase realtime by default.
159
- *
160
- * @param callback - Function called when a change occurs
161
- * @param options - Subscription options including prefix filter
162
- * @returns Unsubscribe function
163
- */
164
- subscribeToChanges(callback: (change: QueueChangePayload<Input, Output>) => void, options?: QueueSubscribeOptions): () => void;
165
- /**
166
- * Subscribe using Supabase realtime (protected).
167
- *
168
- * @param callback - Function called when a change occurs
169
- * @param prefixFilter - Optional prefix filter (undefined = use instance prefixes, {} = no filter)
170
- * @returns Unsubscribe function
171
- */
172
- protected subscribeToChangesWithRealtime(callback: (change: QueueChangePayload<Input, Output>) => void, prefixFilter?: Readonly<Record<string, string | number>>): () => void;
173
- /**
174
- * Gets or creates the shared polling subscription manager for normal subscriptions (fallback).
175
- * This ensures all normal subscriptions share a single polling loop per interval.
176
- */
177
- private getPollingManager;
178
- /**
179
- * Creates a dedicated polling subscription for custom prefix filters (fallback).
180
- * This runs separately from the normal polling manager with DB-level filtering.
181
- */
182
- private subscribeWithCustomPrefixFilterPolling;
183
- /**
184
- * Subscribe using polling (protected, available as fallback).
185
- *
186
- * Normal subscriptions (no custom prefix filter) share a single polling loop for efficiency.
187
- * Custom prefix filter subscriptions get their own dedicated polling loop with DB-level filtering.
188
- *
189
- * @param callback - Function called when a change occurs
190
- * @param options - Subscription options including interval and prefix filter
191
- * @returns Unsubscribe function
192
- */
193
- protected subscribeToChangesWithPolling(callback: (change: QueueChangePayload<Input, Output>) => void, options?: QueueSubscribeOptions): () => void;
194
- }
195
- //# sourceMappingURL=SupabaseQueueStorage.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SupabaseQueueStorage.d.ts","sourceRoot":"","sources":["../../src/queue/SupabaseQueueStorage.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAmB,cAAc,EAAE,MAAM,uB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@@ -1,33 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2025 Steven Roussey <sroussey@gmail.com>
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- import type { IQueueStorage, JobStatus, JobStorageFormat, QueueChangePayload, QueueStorageScope, QueueSubscribeOptions } from "./IQueueStorage";
7
- /**
8
- * Telemetry wrapper for any IQueueStorage implementation.
9
- * Creates spans for all queue storage operations.
10
- */
11
- export declare class TelemetryQueueStorage<Input, Output> implements IQueueStorage<Input, Output> {
12
- private readonly storageName;
13
- private readonly inner;
14
- constructor(storageName: string, inner: IQueueStorage<Input, Output>);
15
- get scope(): QueueStorageScope;
16
- add(job: JobStorageFormat<Input, Output>): Promise<unknown>;
17
- get(id: unknown): Promise<JobStorageFormat<Input, Output> | undefined>;
18
- next(workerId: string): Promise<JobStorageFormat<Input, Output> | undefined>;
19
- peek(status?: JobStatus, num?: number): Promise<Array<JobStorageFormat<Input, Output>>>;
20
- size(status?: JobStatus): Promise<number>;
21
- complete(job: JobStorageFormat<Input, Output>): Promise<void>;
22
- release(id: unknown): Promise<void>;
23
- deleteAll(): Promise<void>;
24
- outputForInput(input: Input): Promise<Output | null>;
25
- abort(id: unknown): Promise<void>;
26
- getByRunId(runId: string): Promise<Array<JobStorageFormat<Input, Output>>>;
27
- saveProgress(id: unknown, progress: number, message: string, details: Record<string, any> | null): Promise<void>;
28
- delete(id: unknown): Promise<void>;
29
- deleteJobsByStatusAndAge(status: JobStatus, olderThanMs: number): Promise<void>;
30
- setupDatabase(): Promise<void>;
31
- subscribeToChanges(callback: (change: QueueChangePayload<Input, Output>) => void, options?: QueueSubscribeOptions): () => void;
32
- }
33
- //# sourceMappingURL=TelemetryQueueStorage.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TelemetryQueueStorage.d.ts","sourceRoot":"","sources":["../../src/queue/TelemetryQueueStorage.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EACV,aAAa,EACb,SAAS,EACT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