@pikku/queue-pg-boss 0.12.9 → 0.12.10

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,3 +1,103 @@
1
+ ## 0.12.10
2
+
3
+ ### Patch Changes
4
+
5
+ - 266e3bc: One door per name: `@pikku/core/ecosystem/*` and the package root are gone
6
+
7
+ `@pikku/core` published every module twice. `ecosystem/http` re-exported
8
+ `./http`, `ecosystem/services` re-exported `./services`, and a name was
9
+ reachable through either — so every addition had to be made in two places, and a
10
+ consumer's import said nothing about what it actually used. The package root was
11
+ the same problem at a larger scale: a single barrel of 206 names that no bundler
12
+ could take apart, and the one specifier that revealed nothing at all.
13
+
14
+ Both are deleted. Every name now lives on the subpath that owns it, and every
15
+ import carries that subpath — `@pikku/core/http`, `@pikku/core/services`,
16
+ `@pikku/core/errors`, `@pikku/core/types`.
17
+
18
+ Deleting the facades meant the raw subpaths had to become a superset of them,
19
+ which they were not: the facade tree had accumulated 25 names with no raw home
20
+ and about 26 more filed under a different area than the module they came from.
21
+ Those names moved to the area that owns them, and three areas were published as
22
+ new entry points rather than left on a root that is going away — `./types` (the
23
+ shared type surface, the largest single destination), `./state` and
24
+ `./classification`.
25
+
26
+ `./classification` is one door onto one subject: what a value is and how it must
27
+ be handled. Its three halves would each have been an entry point — the brands
28
+ and manifest types, the stored-form helpers (`hashToken`, `unsafeAsSealed` and
29
+ friends), and `SecretValue` — split by whether a name happens to be a type or a
30
+ value, which is the same defect as the facades. The duration and versioned-id
31
+ helpers went to `./utils`, which already published, and `PikkuRequest` went to
32
+ `./function`: it is the transport-agnostic request base, not an HTTP one — HTTP
33
+ has `PikkuHTTPAbstractRequest`, and the only thing outside core that extends
34
+ `PikkuRequest` is Azure's timer request.
35
+
36
+ `./types` inherited the root barrel's habit before it inherited its contents, so
37
+ the names with an owner elsewhere were moved off it. The middleware types and the
38
+ five middleware factories — `pikkuMiddleware`, `pikkuMiddlewareFactory`,
39
+ `pikkuChannelMiddleware`, `pikkuChannelMiddlewareFactory` and
40
+ `pikkuAgentMiddleware`, runtime values on a types entry point — are now
41
+ `@pikku/core/middleware`; the function meta types are `@pikku/core/function`;
42
+ `SerializedError` is `@pikku/core/errors`; and the generic TypeScript helpers
43
+ (`MakeRequired`, `PickRequired`, `PickOptional`, `RequireAtLeastOne`,
44
+ `JSONPrimitive`, `JSONValue`) are `@pikku/core/utils`. What is left on `./types`
45
+ is the vocabulary the wirings share, which no single module owns.
46
+
47
+ `pikku` was itself a root barrel — `export * from '@pikku/core'` — and
48
+ now exports only the services it bundles.
49
+
50
+ One module survives at the old specifier, and only for the bootstrap:
51
+ `packages/cli` is generated by the _published_ CLI pinned in its `build.sh`, and
52
+ that CLI still writes a bare `@pikku/core` into the files it generates for the
53
+ CLI itself. `bootstrap-compat/root.ts` carries the eight types it names, a test
54
+ in core fails if that list grows, and it goes when the pin moves to a CLI
55
+ released from this branch. The adapter names the pinned CLI reaches for —
56
+ `pikkuState` and `CreateWireServices` — are rewritten to `@pikku/core/state` and
57
+ `@pikku/core/types` by the same `build.sh` patch pass, so no second shim is
58
+ needed for them.
59
+
60
+ A guard test keeps the root shut: it parses imports and rejects a bare
61
+ `@pikku/core` rather than grepping for it, because several tests hold a user's
62
+ file as a template literal, where `import … from '@pikku/core'` is fixture text
63
+ rather than an import this repo makes.
64
+
65
+ An agent scaffold a project generated under an older CLI is refreshed rather
66
+ than left to fail: `pikku all` already deleted one importing an entry point
67
+ `@pikku/core` no longer publishes, and the `#pikku` hub joins that list.
68
+ Without it a project that scaffolds the agent endpoint but
69
+ declares no agents keeps the old file forever — the generator that would rewrite
70
+ it only runs when agents exist, and the file being present is what stops it
71
+ being regenerated as missing.
72
+
73
+ `pikku new addon` also wrote a tsconfig `paths` map naming only the deleted hub.
74
+ An addon's `imports` map points into `dist`, so `paths` is what resolves
75
+ `#pikku/<leaf>` for the addon's own source build — it now names the two leaf
76
+ patterns, in both the addon and its test harness.
77
+
78
+ - 6eef0a0: Bump every dependency to its latest compatible minor/patch across the monorepo.
79
+ - Updated dependencies [7722ceb]
80
+ - Updated dependencies [375c1ff]
81
+ - Updated dependencies [02a70cd]
82
+ - Updated dependencies [aeef159]
83
+ - Updated dependencies [a281de6]
84
+ - Updated dependencies [266e3bc]
85
+ - Updated dependencies [02a70cd]
86
+ - Updated dependencies [786dae5]
87
+ - Updated dependencies [6eef0a0]
88
+ - Updated dependencies [3561d67]
89
+ - Updated dependencies [a91c433]
90
+ - Updated dependencies [02a70cd]
91
+ - Updated dependencies [9537f74]
92
+ - Updated dependencies [2b57ca8]
93
+ - Updated dependencies [266e3bc]
94
+ - Updated dependencies [9fce0f1]
95
+ - Updated dependencies [83683a0]
96
+ - Updated dependencies [456c88b]
97
+ - Updated dependencies [456c88b]
98
+ - Updated dependencies [c127273]
99
+ - @pikku/core@0.12.85
100
+
1
101
  ## 0.12.9
2
102
 
3
103
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -8,5 +8,5 @@ export { PgBossServiceFactory } from './pg-boss-service-factory.js';
8
8
  export { PgBossQueueService } from './pg-boss-queue-service.js';
9
9
  export { PgBossQueueWorkers } from './pg-boss-queue-worker.js';
10
10
  export { PgBossSchedulerService } from './pg-boss-scheduler-service.js';
11
- export type { QueueService, QueueJob } from '@pikku/core/queue';
12
- export type { PikkuWorkerConfig, PikkuJobConfig, JobOptions, } from '@pikku/core/ecosystem/queue';
11
+ export type { QueueJob, QueueService } from '@pikku/core/queue';
12
+ export type { PikkuWorkerConfig, PikkuJobConfig, JobOptions, } from '@pikku/core/queue';
@@ -1,6 +1,6 @@
1
1
  import type { PgBoss, Request as PgBossRequest } from 'pg-boss';
2
- import type { QueueService, QueueJob } from '@pikku/core/queue';
3
- import type { JobOptions } from '@pikku/core/ecosystem/queue';
2
+ import type { QueueJob, QueueService } from '@pikku/core/queue';
3
+ import type { JobOptions } from '@pikku/core/queue';
4
4
  export declare const mapPikkuJobToPgBoss: (options?: JobOptions) => PgBossRequest["options"];
5
5
  /**
6
6
  * pg-boss/PostgreSQL queue service implementation
@@ -1,5 +1,5 @@
1
1
  import type { PgBoss, WorkOptions } from 'pg-boss';
2
- import type { QueueWorkers, PikkuWorkerConfig, QueueConfigMapping, ConfigValidationResult } from '@pikku/core/ecosystem/queue';
2
+ import type { QueueWorkers, PikkuWorkerConfig, QueueConfigMapping, ConfigValidationResult } from '@pikku/core/queue';
3
3
  import type { Logger } from '@pikku/core/services';
4
4
  export declare const mapPikkuWorkerToPgBoss: (workerConfig?: PikkuWorkerConfig) => WorkOptions;
5
5
  /**
@@ -1,6 +1,6 @@
1
1
  import { runQueueJob } from '@pikku/core/queue';
2
- import { registerQueueWorkers, QueueJobFailedError, QueueJobDiscardedError, } from '@pikku/core/ecosystem/queue';
3
- import { pikkuState } from '@pikku/core/ecosystem';
2
+ import { registerQueueWorkers, QueueJobFailedError, QueueJobDiscardedError, } from '@pikku/core/queue';
3
+ import { pikkuState } from '@pikku/core/state';
4
4
  import { mapPgBossJobToQueueJob } from './utils.js';
5
5
  export const mapPikkuWorkerToPgBoss = (workerConfig) => {
6
6
  // Map the requested parallelism to pg-boss `localConcurrency` (independent
@@ -1,7 +1,7 @@
1
1
  import type { PgBoss } from 'pg-boss';
2
- import type { CoreUserSession } from '@pikku/core';
3
- import type { ScheduledTaskInfo, ScheduledTaskSummary } from '@pikku/core/ecosystem/services';
4
- import { SchedulerService } from '@pikku/core';
2
+ import { SchedulerService } from '@pikku/core/services';
3
+ import type { CoreUserSession } from '@pikku/core/types';
4
+ import type { ScheduledTaskInfo, ScheduledTaskSummary } from '@pikku/core/services';
5
5
  /**
6
6
  * pg-boss scheduler service implementation
7
7
  * Uses pg-boss's schedule() API to store recurring jobs in PostgreSQL.
@@ -1,8 +1,8 @@
1
- import { SchedulerService } from '@pikku/core';
2
- import { parseDurationString } from '@pikku/core/ecosystem/types';
3
- import { pikkuState } from '@pikku/core/ecosystem';
4
1
  import { runScheduledTask } from '@pikku/core/scheduler';
5
- import { getScheduledTasks } from '@pikku/core/ecosystem/scheduler';
2
+ import { SchedulerService } from '@pikku/core/services';
3
+ import { parseDurationString } from '@pikku/core/utils';
4
+ import { pikkuState } from '@pikku/core/state';
5
+ import { getScheduledTasks } from '@pikku/core/scheduler';
6
6
  /** Prefix for pg-boss queues/schedules backing recurring scheduled tasks. */
7
7
  const RECURRING_TASK_PREFIX = 'pikku-recurring-scheduled-task_';
8
8
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pikku/queue-pg-boss",
3
- "version": "0.12.9",
3
+ "version": "0.12.10",
4
4
  "description": "pg-boss queue, worker and scheduler services for Pikku, backed by Postgres",
5
5
  "author": "yasser.fadl@gmail.com",
6
6
  "license": "MIT",
@@ -16,10 +16,10 @@
16
16
  "prepublishOnly": "yarn build"
17
17
  },
18
18
  "peerDependencies": {
19
- "@pikku/core": "^0.12.84"
19
+ "@pikku/core": "^0.12.85"
20
20
  },
21
21
  "dependencies": {
22
- "pg-boss": "^12.14.0"
22
+ "pg-boss": "^12.27.0"
23
23
  },
24
24
  "devDependencies": {
25
25
  "typescript": "^6.0.3"
@@ -27,4 +27,4 @@
27
27
  "exports": {
28
28
  ".": "./dist/index.js"
29
29
  }
30
- }
30
+ }
package/run-tests.sh CHANGED
File without changes
package/src/index.ts CHANGED
@@ -11,9 +11,9 @@ export { PgBossQueueWorkers } from './pg-boss-queue-worker.js'
11
11
  export { PgBossSchedulerService } from './pg-boss-scheduler-service.js'
12
12
 
13
13
  // Re-export core queue types for convenience
14
- export type { QueueService, QueueJob } from '@pikku/core/queue'
14
+ export type { QueueJob, QueueService } from '@pikku/core/queue'
15
15
  export type {
16
16
  PikkuWorkerConfig,
17
17
  PikkuJobConfig,
18
18
  JobOptions,
19
- } from '@pikku/core/ecosystem/queue'
19
+ } from '@pikku/core/queue'
@@ -60,8 +60,10 @@ describe('mapPikkuJobToPgBoss — retry mapping', () => {
60
60
 
61
61
  describe('mapPikkuJobToPgBoss — group mapping', () => {
62
62
  test('group id is forwarded so the worker can enforce a per-group limit', () => {
63
- assert.deepEqual(mapPikkuJobToPgBoss({ group: { id: 'deployWorkflow' } })
64
- .group, { id: 'deployWorkflow' })
63
+ assert.deepEqual(
64
+ mapPikkuJobToPgBoss({ group: { id: 'deployWorkflow' } }).group,
65
+ { id: 'deployWorkflow' }
66
+ )
65
67
  })
66
68
 
67
69
  test('tier is only set when provided', () => {
@@ -69,7 +71,10 @@ describe('mapPikkuJobToPgBoss — group mapping', () => {
69
71
  group: { id: 'deployWorkflow', tier: 'slow' },
70
72
  })
71
73
  assert.deepEqual(opts.group, { id: 'deployWorkflow', tier: 'slow' })
72
- assert.equal('tier' in mapPikkuJobToPgBoss({ group: { id: 'a' } }).group!, false)
74
+ assert.equal(
75
+ 'tier' in mapPikkuJobToPgBoss({ group: { id: 'a' } }).group!,
76
+ false
77
+ )
73
78
  })
74
79
 
75
80
  test('no group → no group field', () => {
@@ -1,6 +1,6 @@
1
1
  import type { PgBoss, Request as PgBossRequest } from 'pg-boss'
2
- import type { QueueService, QueueJob } from '@pikku/core/queue'
3
- import type { JobOptions } from '@pikku/core/ecosystem/queue'
2
+ import type { QueueJob, QueueService } from '@pikku/core/queue'
3
+ import type { JobOptions } from '@pikku/core/queue'
4
4
  import { mapPgBossJobToQueueJob } from './utils.js'
5
5
 
6
6
  export const mapPikkuJobToPgBoss = (
@@ -4,15 +4,15 @@ import type {
4
4
  PikkuWorkerConfig,
5
5
  QueueConfigMapping,
6
6
  ConfigValidationResult,
7
- } from '@pikku/core/ecosystem/queue'
7
+ } from '@pikku/core/queue'
8
8
  import { runQueueJob } from '@pikku/core/queue'
9
+ import type { Logger } from '@pikku/core/services'
9
10
  import {
10
11
  registerQueueWorkers,
11
12
  QueueJobFailedError,
12
13
  QueueJobDiscardedError,
13
- } from '@pikku/core/ecosystem/queue'
14
- import { pikkuState } from '@pikku/core/ecosystem'
15
- import type { Logger } from '@pikku/core/services'
14
+ } from '@pikku/core/queue'
15
+ import { pikkuState } from '@pikku/core/state'
16
16
  import { mapPgBossJobToQueueJob } from './utils.js'
17
17
 
18
18
  export const mapPikkuWorkerToPgBoss = (
@@ -180,7 +180,7 @@ export class PgBossQueueWorkers implements QueueWorkers {
180
180
  logger,
181
181
  async (queueName, processor) => {
182
182
  await this.pgBoss.createQueue(queueName)
183
- const workerId = await this.pgBoss.work<any>(
183
+ const workerId = await this.pgBoss.work(
184
184
  processor.name,
185
185
  {
186
186
  ...mapPikkuWorkerToPgBoss(processor.config),
@@ -1,14 +1,14 @@
1
1
  import type { PgBoss } from 'pg-boss'
2
- import type { CoreUserSession } from '@pikku/core'
2
+ import { runScheduledTask } from '@pikku/core/scheduler'
3
+ import { SchedulerService } from '@pikku/core/services'
4
+ import type { CoreUserSession } from '@pikku/core/types'
3
5
  import type {
4
6
  ScheduledTaskInfo,
5
7
  ScheduledTaskSummary,
6
- } from '@pikku/core/ecosystem/services'
7
- import { SchedulerService } from '@pikku/core'
8
- import { parseDurationString } from '@pikku/core/ecosystem/types'
9
- import { pikkuState } from '@pikku/core/ecosystem'
10
- import { runScheduledTask } from '@pikku/core/scheduler'
11
- import { getScheduledTasks } from '@pikku/core/ecosystem/scheduler'
8
+ } from '@pikku/core/services'
9
+ import { parseDurationString } from '@pikku/core/utils'
10
+ import { pikkuState } from '@pikku/core/state'
11
+ import { getScheduledTasks } from '@pikku/core/scheduler'
12
12
 
13
13
  /**
14
14
  * Data stored in scheduled job