@pikku/queue-pg-boss 0.12.2 → 0.12.3

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,29 @@
1
1
  ## 0.12.0
2
2
 
3
+ ## 0.12.3
4
+
5
+ ### Patch Changes
6
+
7
+ - 8b9b2e9: Accept optional logger parameter in `registerQueues()` instead of reaching into pikku state directly. Falls back to `getSingletonServices()` for backwards compatibility.
8
+ - 8b9b2e9: Fix child workflow completion in queued execution mode. When a sub-workflow completes, the parent step is now marked as succeeded and the parent orchestrator resumes automatically via `onChildWorkflowCompleted`. Adds `parentStepId` to `WorkflowRunWire` to track the parent step without querying. Retains advisory locks in PgKyselyWorkflowService for concurrency safety. Fixes pgboss `registerQueues` to accept an optional logger parameter.
9
+ - Updated dependencies [e412b4d]
10
+ - Updated dependencies [53dc8c8]
11
+ - Updated dependencies [0a1cc51]
12
+ - Updated dependencies [0a1cc51]
13
+ - Updated dependencies [0a1cc51]
14
+ - Updated dependencies [0a1cc51]
15
+ - Updated dependencies [0a1cc51]
16
+ - Updated dependencies [0a1cc51]
17
+ - Updated dependencies [0a1cc51]
18
+ - Updated dependencies [0a1cc51]
19
+ - Updated dependencies [0a1cc51]
20
+ - Updated dependencies [8b9b2e9]
21
+ - Updated dependencies [8b9b2e9]
22
+ - Updated dependencies [b973d44]
23
+ - Updated dependencies [8b9b2e9]
24
+ - Updated dependencies [8b9b2e9]
25
+ - @pikku/core@0.12.9
26
+
3
27
  ## 0.12.2
4
28
 
5
29
  ### Patch Changes
@@ -1,5 +1,6 @@
1
1
  import type { PgBoss, WorkOptions } from 'pg-boss';
2
2
  import type { QueueWorkers, PikkuWorkerConfig, QueueConfigMapping, ConfigValidationResult } from '@pikku/core/queue';
3
+ import type { Logger } from '@pikku/core/services';
3
4
  export declare const mapPikkuWorkerToPgBoss: (workerConfig?: PikkuWorkerConfig) => WorkOptions;
4
5
  /**
5
6
  * pg-boss/PostgreSQL queue worker implementation
@@ -19,5 +20,5 @@ export declare class PgBossQueueWorkers implements QueueWorkers {
19
20
  /**
20
21
  * Scan state and register all compatible processors
21
22
  */
22
- registerQueues(): Promise<Record<string, ConfigValidationResult[]>>;
23
+ registerQueues(logger?: Logger): Promise<Record<string, ConfigValidationResult[]>>;
23
24
  }
@@ -90,8 +90,13 @@ export class PgBossQueueWorkers {
90
90
  /**
91
91
  * Scan state and register all compatible processors
92
92
  */
93
- async registerQueues() {
94
- const logger = pikkuState(null, 'package', 'singletonServices').logger;
93
+ async registerQueues(logger) {
94
+ if (!logger) {
95
+ logger = pikkuState(null, 'package', 'singletonServices')?.logger;
96
+ }
97
+ if (!logger) {
98
+ throw new Error('Logger is required for registerQueues — pass it explicitly or ensure singleton services are initialized first');
99
+ }
95
100
  return await registerQueueWorkers(this.configMappings, logger, async (queueName, processor) => {
96
101
  await this.pgBoss.createQueue(queueName);
97
102
  const workerId = await this.pgBoss.work(processor.name, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pikku/queue-pg-boss",
3
- "version": "0.12.2",
3
+ "version": "0.12.3",
4
4
  "author": "yasser.fadl@gmail.com",
5
5
  "license": "MIT",
6
6
  "module": "dist/index.js",
@@ -10,10 +10,11 @@
10
10
  "tsc": "tsc",
11
11
  "ncu": "npx npm-check-updates",
12
12
  "build": "tsc -b",
13
- "release": "npm run build && npm test"
13
+ "release": "npm run build && npm test",
14
+ "prepublishOnly": "yarn build"
14
15
  },
15
16
  "peerDependencies": {
16
- "@pikku/core": "^0.12.2"
17
+ "@pikku/core": "^0.12.9"
17
18
  },
18
19
  "dependencies": {
19
20
  "pg-boss": "^12.14.0"
@@ -12,6 +12,7 @@ import {
12
12
  QueueJobDiscardedError,
13
13
  } from '@pikku/core/queue'
14
14
  import { pikkuState } from '@pikku/core/internal'
15
+ import type { Logger } from '@pikku/core/services'
15
16
  import { mapPgBossJobToQueueJob } from './utils.js'
16
17
 
17
18
  export const mapPikkuWorkerToPgBoss = (
@@ -128,8 +129,17 @@ export class PgBossQueueWorkers implements QueueWorkers {
128
129
  /**
129
130
  * Scan state and register all compatible processors
130
131
  */
131
- async registerQueues(): Promise<Record<string, ConfigValidationResult[]>> {
132
- const logger = pikkuState(null, 'package', 'singletonServices')!.logger
132
+ async registerQueues(
133
+ logger?: Logger
134
+ ): Promise<Record<string, ConfigValidationResult[]>> {
135
+ if (!logger) {
136
+ logger = pikkuState(null, 'package', 'singletonServices')?.logger
137
+ }
138
+ if (!logger) {
139
+ throw new Error(
140
+ 'Logger is required for registerQueues — pass it explicitly or ensure singleton services are initialized first'
141
+ )
142
+ }
133
143
 
134
144
  return await registerQueueWorkers(
135
145
  this.configMappings,