@pikku/mongodb 0.12.10 → 0.12.11

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/CHANGELOG.md CHANGED
@@ -1,5 +1,34 @@
1
1
  # @pikku/mongodb
2
2
 
3
+ ## 0.12.11
4
+
5
+ ### Patch Changes
6
+
7
+ - e3d4454: Add job groups, so one shared queue can stay fair without splitting into one
8
+ queue per producer.
9
+
10
+ A job may now carry `group: { id, tier }`, and a worker may cap how many jobs
11
+ of any one group run at once via `groupConcurrency`. On pg-boss this maps to
12
+ `localGroupConcurrency`, which excludes at-capacity groups from the fetch query
13
+ itself, so a capped group costs nothing rather than being fetched and restored.
14
+ BullMQ declares it unsupported (groups are a BullMQ Pro feature) — being
15
+ push-based, it can simply use a queue per group at no polling cost.
16
+
17
+ Workflow services accept a `queueStrategy`. The default `'per-workflow'` is
18
+ unchanged: every workflow gets its own `wf-orchestrator-*` / `wf-step-*` queue,
19
+ which is also what lets serverless providers deploy one unit per workflow. The
20
+ new `'shared-groups'` routes every workflow through the shared
21
+ orchestrator/step-worker queues and isolates them by group instead, so a
22
+ monolith runs one set of pollers rather than one per workflow — on a
23
+ pull-based backend with dozens of workflows that is the difference between
24
+ hundreds of poll loops and twenty. It is for single-process runtimes only; a
25
+ per-unit serverless deploy still needs the per-workflow queues to route to its
26
+ units.
27
+
28
+ - Updated dependencies [24252b8]
29
+ - Updated dependencies [e3d4454]
30
+ - @pikku/core@0.12.69
31
+
3
32
  ## 0.12.10
4
33
 
5
34
  ### Patch Changes
@@ -1,5 +1,5 @@
1
1
  import type { SerializedError } from '@pikku/core';
2
- import { PikkuWorkflowService, type WorkflowPlannedStep, type WorkflowRun, type WorkflowRunWire, type StepState, type StepStatus, type WorkflowStatus, type WorkflowVersionStatus } from '@pikku/core/workflow';
2
+ import { PikkuWorkflowService, type WorkflowPlannedStep, type WorkflowQueueOptions, type WorkflowRun, type WorkflowRunWire, type StepState, type StepStatus, type WorkflowStatus, type WorkflowVersionStatus } from '@pikku/core/workflow';
3
3
  import type { Db } from 'mongodb';
4
4
  export declare class MongoDBWorkflowService extends PikkuWorkflowService {
5
5
  private initialized;
@@ -8,7 +8,7 @@ export declare class MongoDBWorkflowService extends PikkuWorkflowService {
8
8
  private steps;
9
9
  private stepHistory;
10
10
  private versions;
11
- constructor(db: Db);
11
+ constructor(db: Db, options?: WorkflowQueueOptions);
12
12
  init(): Promise<void>;
13
13
  protected createRunImpl(workflowName: string, input: any, inline: boolean, graphHash: string, wire: WorkflowRunWire, options?: {
14
14
  deterministic?: boolean;
@@ -7,8 +7,8 @@ export class MongoDBWorkflowService extends PikkuWorkflowService {
7
7
  steps;
8
8
  stepHistory;
9
9
  versions;
10
- constructor(db) {
11
- super();
10
+ constructor(db, options = {}) {
11
+ super(options);
12
12
  this.runService = new MongoDBWorkflowRunService(db);
13
13
  this.runs = db.collection('workflow_runs');
14
14
  this.steps = db.collection('workflow_step');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pikku/mongodb",
3
- "version": "0.12.10",
3
+ "version": "0.12.11",
4
4
  "author": "yasser.fadl@gmail.com",
5
5
  "license": "MIT",
6
6
  "module": "dist/src/index.js",
@@ -17,7 +17,7 @@
17
17
  "prepublishOnly": "yarn build"
18
18
  },
19
19
  "peerDependencies": {
20
- "@pikku/core": "^0.12.66"
20
+ "@pikku/core": "^0.12.69"
21
21
  },
22
22
  "dependencies": {
23
23
  "mongodb": "^6.12.0"
@@ -2,6 +2,7 @@ import type { SerializedError } from '@pikku/core'
2
2
  import {
3
3
  PikkuWorkflowService,
4
4
  type WorkflowPlannedStep,
5
+ type WorkflowQueueOptions,
5
6
  type WorkflowRun,
6
7
  type WorkflowRunWire,
7
8
  type StepState,
@@ -77,8 +78,8 @@ export class MongoDBWorkflowService extends PikkuWorkflowService {
77
78
  private stepHistory: Collection<WorkflowStepHistoryDoc>
78
79
  private versions: Collection<WorkflowVersionDoc>
79
80
 
80
- constructor(db: Db) {
81
- super()
81
+ constructor(db: Db, options: WorkflowQueueOptions = {}) {
82
+ super(options)
82
83
  this.runService = new MongoDBWorkflowRunService(db)
83
84
  this.runs = db.collection<WorkflowRunDoc>('workflow_runs')
84
85
  this.steps = db.collection<WorkflowStepDoc>('workflow_step')