bunqueue 2.8.49 → 2.8.51
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 +62 -9
- package/dist/application/backgroundTasks.js +21 -4
- package/dist/application/cleanupTasks.js +7 -3
- package/dist/application/contextFactory.d.ts +6 -3
- package/dist/application/contextFactory.js +8 -0
- package/dist/application/dependencyCompletions.d.ts +53 -0
- package/dist/application/dependencyCompletions.js +123 -0
- package/dist/application/dependencyProcessor.d.ts +5 -0
- package/dist/application/dependencyProcessor.js +25 -13
- package/dist/application/flowFailureRecovery.d.ts +20 -0
- package/dist/application/flowFailureRecovery.js +94 -0
- package/dist/application/flowParentBackpatch.d.ts +27 -0
- package/dist/application/flowParentBackpatch.js +120 -0
- package/dist/application/operations/ack.d.ts +6 -3
- package/dist/application/operations/ack.js +36 -10
- package/dist/application/operations/ackHelpers.d.ts +5 -4
- package/dist/application/operations/ackHelpers.js +4 -10
- package/dist/application/operations/customId.d.ts +3 -0
- package/dist/application/operations/customId.js +10 -0
- package/dist/application/operations/flowPush.d.ts +9 -0
- package/dist/application/operations/flowPush.js +112 -0
- package/dist/application/operations/flowTopologyValidation.d.ts +3 -0
- package/dist/application/operations/flowTopologyValidation.js +101 -0
- package/dist/application/operations/flowValidation.d.ts +3 -0
- package/dist/application/operations/flowValidation.js +166 -0
- package/dist/application/operations/jobManagement.d.ts +3 -0
- package/dist/application/operations/jobManagement.js +10 -4
- package/dist/application/operations/push.d.ts +6 -1
- package/dist/application/operations/push.js +2 -2
- package/dist/application/operations/pushInsert.d.ts +11 -2
- package/dist/application/operations/pushInsert.js +20 -8
- package/dist/application/operations/pushLocks.d.ts +1 -0
- package/dist/application/operations/pushLocks.js +5 -1
- package/dist/application/operations/queryOperations.js +7 -6
- package/dist/application/queueManager.d.ts +7 -0
- package/dist/application/queueManager.js +261 -67
- package/dist/application/types.d.ts +3 -1
- package/dist/cli/commandRouter.d.ts +1 -1
- package/dist/client/flow.d.ts +3 -6
- package/dist/client/flow.js +71 -210
- package/dist/client/flowAtomic.d.ts +9 -0
- package/dist/client/flowAtomic.js +24 -0
- package/dist/client/flowJobCoreMethods.d.ts +28 -0
- package/dist/client/flowJobCoreMethods.js +151 -0
- package/dist/client/flowJobDependencies.d.ts +7 -0
- package/dist/client/flowJobDependencies.js +64 -0
- package/dist/client/flowJobFactory.d.ts +11 -24
- package/dist/client/flowJobFactory.js +91 -360
- package/dist/client/flowJobMoveMethods.d.ts +16 -0
- package/dist/client/flowJobMoveMethods.js +112 -0
- package/dist/client/flowJobTypes.d.ts +29 -0
- package/dist/client/flowJobTypes.js +6 -0
- package/dist/client/flowLegacyPlan.d.ts +16 -0
- package/dist/client/flowLegacyPlan.js +118 -0
- package/dist/client/flowOptions.d.ts +10 -0
- package/dist/client/flowOptions.js +44 -0
- package/dist/client/flowPlan.d.ts +16 -0
- package/dist/client/flowPlan.js +101 -0
- package/dist/client/flowPush.js +4 -1
- package/dist/client/flowReader.d.ts +10 -0
- package/dist/client/flowReader.js +147 -0
- package/dist/client/flowTypes.d.ts +2 -2
- package/dist/client/jobHelpers.js +2 -0
- package/dist/client/workflow/clock.d.ts +3 -1
- package/dist/client/workflow/clock.js +18 -1
- package/dist/client/workflow/compensationChild.d.ts +30 -0
- package/dist/client/workflow/compensationChild.js +65 -0
- package/dist/client/workflow/compensationPass.d.ts +16 -0
- package/dist/client/workflow/compensationPass.js +96 -0
- package/dist/client/workflow/compensationSupport.d.ts +24 -0
- package/dist/client/workflow/compensationSupport.js +57 -0
- package/dist/client/workflow/compensator.d.ts +11 -50
- package/dist/client/workflow/compensator.js +22 -374
- package/dist/client/workflow/definitionGuard.d.ts +11 -0
- package/dist/client/workflow/definitionGuard.js +22 -0
- package/dist/client/workflow/engine.d.ts +2 -2
- package/dist/client/workflow/engine.js +8 -8
- package/dist/client/workflow/eventTypes.d.ts +44 -0
- package/dist/client/workflow/eventTypes.js +2 -0
- package/dist/client/workflow/executionTypes.d.ts +133 -0
- package/dist/client/workflow/executionTypes.js +2 -0
- package/dist/client/workflow/executor.d.ts +4 -17
- package/dist/client/workflow/executor.js +50 -208
- package/dist/client/workflow/executorLifecycle.d.ts +18 -0
- package/dist/client/workflow/executorLifecycle.js +69 -0
- package/dist/client/workflow/executorNodes.d.ts +17 -0
- package/dist/client/workflow/executorNodes.js +138 -0
- package/dist/client/workflow/identity.d.ts +2 -0
- package/dist/client/workflow/identity.js +8 -0
- package/dist/client/workflow/index.d.ts +1 -1
- package/dist/client/workflow/loops.d.ts +3 -5
- package/dist/client/workflow/loops.js +25 -23
- package/dist/client/workflow/mapRunner.d.ts +4 -0
- package/dist/client/workflow/mapRunner.js +45 -0
- package/dist/client/workflow/recovery.js +10 -3
- package/dist/client/workflow/runner.d.ts +2 -21
- package/dist/client/workflow/runner.js +39 -104
- package/dist/client/workflow/runnerTiming.d.ts +14 -0
- package/dist/client/workflow/runnerTiming.js +66 -0
- package/dist/client/workflow/stepTypes.d.ts +171 -0
- package/dist/client/workflow/stepTypes.js +3 -0
- package/dist/client/workflow/store.d.ts +17 -17
- package/dist/client/workflow/store.js +65 -100
- package/dist/client/workflow/storeExecutionCodec.d.ts +11 -0
- package/dist/client/workflow/storeExecutionCodec.js +34 -0
- package/dist/client/workflow/storeListing.d.ts +11 -0
- package/dist/client/workflow/storeListing.js +45 -0
- package/dist/client/workflow/storeMaintenance.d.ts +4 -0
- package/dist/client/workflow/storeMaintenance.js +40 -0
- package/dist/client/workflow/storeSignals.d.ts +9 -0
- package/dist/client/workflow/storeSignals.js +38 -2
- package/dist/client/workflow/subWorkflowRunner.d.ts +13 -0
- package/dist/client/workflow/subWorkflowRunner.js +40 -0
- package/dist/client/workflow/types.d.ts +4 -356
- package/dist/client/workflow/types.js +1 -3
- package/dist/client/workflow/waitFor.js +39 -26
- package/dist/client/workflow/workflow.d.ts +16 -59
- package/dist/client/workflow/workflow.js +53 -179
- package/dist/client/workflow/workflowDecisions.d.ts +11 -0
- package/dist/client/workflow/workflowDecisions.js +27 -0
- package/dist/client/workflow/workflowDefinition.d.ts +16 -0
- package/dist/client/workflow/workflowDefinition.js +123 -0
- package/dist/client/workflow/workflowIntrospection.d.ts +5 -0
- package/dist/client/workflow/workflowIntrospection.js +46 -0
- package/dist/client/workflow/workflowValidation.d.ts +44 -0
- package/dist/client/workflow/workflowValidation.js +143 -0
- package/dist/domain/types/command.d.ts +7 -1
- package/dist/domain/types/flow.d.ts +25 -0
- package/dist/domain/types/flow.js +1 -0
- package/dist/infrastructure/persistence/dependencyCompletionSchema.d.ts +6 -0
- package/dist/infrastructure/persistence/dependencyCompletionSchema.js +16 -0
- package/dist/infrastructure/persistence/dependencyCompletionStore.d.ts +38 -0
- package/dist/infrastructure/persistence/dependencyCompletionStore.js +105 -0
- package/dist/infrastructure/persistence/schema.d.ts +2 -5
- package/dist/infrastructure/persistence/schema.js +57 -3
- package/dist/infrastructure/persistence/sqlite.d.ts +35 -0
- package/dist/infrastructure/persistence/sqlite.js +238 -12
- package/dist/infrastructure/persistence/sqliteBatch.js +10 -4
- package/dist/infrastructure/persistence/sqliteSerializer.d.ts +5 -0
- package/dist/infrastructure/persistence/sqliteSerializer.js +28 -5
- package/dist/infrastructure/persistence/statements.d.ts +4 -0
- package/dist/infrastructure/persistence/statements.js +8 -2
- package/dist/infrastructure/server/handlerRoutes.js +3 -0
- package/dist/infrastructure/server/handlers/advanced.js +2 -2
- package/dist/infrastructure/server/handlers/flow.d.ts +7 -0
- package/dist/infrastructure/server/handlers/flow.js +11 -0
- package/dist/infrastructure/server/handlers/index.d.ts +1 -0
- package/dist/infrastructure/server/handlers/index.js +1 -0
- package/package.json +4 -2
|
@@ -15,12 +15,14 @@ export const SQL_STATEMENTS = {
|
|
|
15
15
|
id, queue, data, priority, created_at, run_at, attempts,
|
|
16
16
|
max_attempts, backoff, ttl, timeout, unique_key, custom_id,
|
|
17
17
|
depends_on, parent_id, children_ids, tags, state, lifo, group_id,
|
|
18
|
-
remove_on_complete, remove_on_fail,
|
|
18
|
+
remove_on_complete, remove_on_fail, fail_parent_on_failure,
|
|
19
|
+
remove_dependency_on_failure, continue_parent_on_failure,
|
|
20
|
+
ignore_dependency_on_failure, stall_timeout, stall_count, timeline
|
|
19
21
|
) VALUES (
|
|
20
22
|
?, ?, ?, ?, ?, ?, ?,
|
|
21
23
|
?, ?, ?, ?, ?, ?,
|
|
22
24
|
?, ?, ?, ?, ?, ?, ?,
|
|
23
|
-
?, ?, ?, ?, ?
|
|
25
|
+
?, ?, ?, ?, ?, ?, ?, ?, ?
|
|
24
26
|
)
|
|
25
27
|
ON CONFLICT(id) DO UPDATE SET
|
|
26
28
|
queue=excluded.queue, data=excluded.data, priority=excluded.priority,
|
|
@@ -30,6 +32,10 @@ export const SQL_STATEMENTS = {
|
|
|
30
32
|
depends_on=excluded.depends_on, parent_id=excluded.parent_id, children_ids=excluded.children_ids,
|
|
31
33
|
tags=excluded.tags, state=excluded.state, lifo=excluded.lifo, group_id=excluded.group_id,
|
|
32
34
|
remove_on_complete=excluded.remove_on_complete, remove_on_fail=excluded.remove_on_fail,
|
|
35
|
+
fail_parent_on_failure=excluded.fail_parent_on_failure,
|
|
36
|
+
remove_dependency_on_failure=excluded.remove_dependency_on_failure,
|
|
37
|
+
continue_parent_on_failure=excluded.continue_parent_on_failure,
|
|
38
|
+
ignore_dependency_on_failure=excluded.ignore_dependency_on_failure,
|
|
33
39
|
stall_timeout=excluded.stall_timeout, stall_count=excluded.stall_count,
|
|
34
40
|
timeline=excluded.timeline,
|
|
35
41
|
-- Per-execution columns are NOT in the INSERT column list, so excluded.<col>
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
// Import handlers
|
|
5
5
|
import { handlePush, handlePushBatch, handlePull, handlePullBatch, handleAck, handleAckBatch, handleFail, } from './handlers/core';
|
|
6
|
+
import { handlePushFlow } from './handlers/flow';
|
|
6
7
|
import { handleGetJob, handleGetState, handleGetResult, handleGetJobCounts, handleGetCountsPerPriority, handleGetJobByCustomId, handleGetJobs, handleGetChildrenValues, } from './handlers/query';
|
|
7
8
|
import { handleCancel, handleProgress, handleGetProgress, handlePause, handleResume, handleDrain, handleStats, handleMetrics, handleStorageStatus, } from './handlers/management';
|
|
8
9
|
import { handleDlq, handleRetryDlq, handlePurgeDlq, handleRetryCompleted } from './handlers/dlq';
|
|
@@ -18,6 +19,8 @@ export async function routeCoreCommand(cmd, ctx, reqId) {
|
|
|
18
19
|
return handlePush(cmd, ctx, reqId);
|
|
19
20
|
case 'PUSHB':
|
|
20
21
|
return handlePushBatch(cmd, ctx, reqId);
|
|
22
|
+
case 'PUSHF':
|
|
23
|
+
return handlePushFlow(cmd, ctx, reqId);
|
|
21
24
|
case 'PULL':
|
|
22
25
|
return handlePull(cmd, ctx, reqId);
|
|
23
26
|
case 'PULLB':
|
|
@@ -78,8 +78,8 @@ export async function handleUpdateParent(cmd, ctx, reqId) {
|
|
|
78
78
|
await ctx.queueManager.updateJobParent(jobId(cmd.childId), jobId(cmd.parentId));
|
|
79
79
|
return resp.ok(undefined, reqId);
|
|
80
80
|
}
|
|
81
|
-
catch {
|
|
82
|
-
return resp.error('Failed to update parent', reqId);
|
|
81
|
+
catch (error) {
|
|
82
|
+
return resp.error(error instanceof Error ? error.message : 'Failed to update parent', reqId);
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
/** Handle MoveToDelayed command */
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Command } from '../../../domain/types/command';
|
|
2
|
+
import type { Response } from '../../../domain/types/response';
|
|
3
|
+
import type { HandlerContext } from '../types';
|
|
4
|
+
/** Commit the whole graph in one broker operation; validation happens pre-mutation. */
|
|
5
|
+
export declare function handlePushFlow(cmd: Extract<Command, {
|
|
6
|
+
cmd: 'PUSHF';
|
|
7
|
+
}>, ctx: HandlerContext, reqId?: string): Promise<Response>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as resp from '../../../domain/types/response';
|
|
2
|
+
/** Commit the whole graph in one broker operation; validation happens pre-mutation. */
|
|
3
|
+
export async function handlePushFlow(cmd, ctx, reqId) {
|
|
4
|
+
try {
|
|
5
|
+
const result = await ctx.queueManager.pushFlow({ jobs: cmd.jobs });
|
|
6
|
+
return resp.data(result, reqId);
|
|
7
|
+
}
|
|
8
|
+
catch (error) {
|
|
9
|
+
return resp.error(error instanceof Error ? error.message : String(error), reqId);
|
|
10
|
+
}
|
|
11
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bunqueue",
|
|
3
|
-
"version": "2.8.
|
|
3
|
+
"version": "2.8.51",
|
|
4
4
|
"description": "High-performance job queue for Bun & AI agents. SQLite persistence, cron scheduling, priorities, retries, DLQ, webhooks, native MCP server. Zero external infrastructure.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -59,13 +59,15 @@
|
|
|
59
59
|
"docs:api": "bun run scripts/build-api-reference.ts",
|
|
60
60
|
"check:docs-data": "bun run scripts/check-docs-data.ts",
|
|
61
61
|
"test": "BUNQUEUE_EMBEDDED=1 bun test",
|
|
62
|
-
"test:model": "BUNQUEUE_EMBEDDED=1 bun test test/model-based/queue-model.test.ts test/model-based/workflow-model.test.ts test/model-based/backup-model.test.ts test/model-based/monitoring-model.test.ts test/model-based/enterprise-telemetry-model.test.ts",
|
|
62
|
+
"test:model": "BUNQUEUE_EMBEDDED=1 bun test test/model-based/queue-model.test.ts test/model-based/workflow-model.test.ts test/model-based/flow-producer-model.test.ts test/model-based/backup-model.test.ts test/model-based/monitoring-model.test.ts test/model-based/enterprise-telemetry-model.test.ts",
|
|
63
63
|
"test:sandbox": "bun run scripts/test-sandbox.ts",
|
|
64
64
|
"test:sandbox:sdk": "bun run scripts/test-sdk-sandbox.ts",
|
|
65
65
|
"bench": "bun run bench/comprehensive.ts",
|
|
66
66
|
"bench:tcp": "bun run bench/tcp-bench.ts",
|
|
67
67
|
"bench:autobatch": "bun run bench/local-autobatch.ts",
|
|
68
68
|
"bench:pushbulk": "bun run bench/pushbulk-delta.ts",
|
|
69
|
+
"bench:workflow": "bun run bench/workflow-engine.ts",
|
|
70
|
+
"bench:workflow:scale": "bun run bench/workflow-engine/scale.ts",
|
|
69
71
|
"bench:joblist": "bun run bench/job-list-perf.ts",
|
|
70
72
|
"bench:compare": "bun run bench/comparison/run.ts",
|
|
71
73
|
"lint": "biome lint src",
|