@pikku/mongodb 0.12.4 → 0.12.5

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,11 +1,23 @@
1
1
  # @pikku/mongodb
2
2
 
3
+ ## 0.12.5
4
+
5
+ ### Patch Changes
6
+
7
+ - b9ed73e: Add deterministic workflow planned-step metadata support and SSE init stream payload generation.
8
+ - Persist `deterministic` and `plannedSteps` on workflow runs in core and service adapters.
9
+ - Expose planned-step metadata on workflow run status responses.
10
+ - Emit an initial `type: 'init'` SSE event for deterministic workflow streams before incremental updates.
11
+ - Add CLI tests covering serialized stream route output for init/update/done event behavior.
12
+
13
+ - Updated dependencies [b9ed73e]
14
+ - @pikku/core@0.12.19
15
+
3
16
  ## 0.12.4
4
17
 
5
18
  ### Patch Changes
6
19
 
7
20
  - 311c0c4: Unify session persistence through SessionStore, remove session blob from ChannelStore
8
-
9
21
  - PikkuSessionService now persists sessions via SessionStore on set()/clear() instead of every function call
10
22
  - ChannelStore no longer stores session data — maps channelId to pikkuUserId only
11
23
  - ChannelStore API: setUserSession/getChannelAndSession replaced with setPikkuUserId/getChannel
@@ -138,6 +138,8 @@ export class MongoDBWorkflowRunService {
138
138
  error: row.error ?? undefined,
139
139
  inline: row.inline,
140
140
  graphHash: row.graphHash ?? undefined,
141
+ deterministic: row.deterministic ?? undefined,
142
+ plannedSteps: row.plannedSteps ?? undefined,
141
143
  wire: row.wire ?? { type: 'unknown' },
142
144
  createdAt: new Date(row.createdAt),
143
145
  updatedAt: new Date(row.updatedAt),
@@ -1,5 +1,5 @@
1
1
  import type { SerializedError } from '@pikku/core';
2
- import { PikkuWorkflowService, type WorkflowRun, type WorkflowRunWire, type StepState, type WorkflowStatus, type WorkflowVersionStatus } from '@pikku/core/workflow';
2
+ import { PikkuWorkflowService, type WorkflowPlannedStep, type WorkflowRun, type WorkflowRunWire, type StepState, 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;
@@ -10,7 +10,10 @@ export declare class MongoDBWorkflowService extends PikkuWorkflowService {
10
10
  private versions;
11
11
  constructor(db: Db);
12
12
  init(): Promise<void>;
13
- createRun(workflowName: string, input: any, inline: boolean, graphHash: string, wire: WorkflowRunWire): Promise<string>;
13
+ createRun(workflowName: string, input: any, inline: boolean, graphHash: string, wire: WorkflowRunWire, options?: {
14
+ deterministic?: boolean;
15
+ plannedSteps?: WorkflowPlannedStep[];
16
+ }): Promise<string>;
14
17
  getRun(id: string): Promise<WorkflowRun | null>;
15
18
  updateRunStatus(id: string, status: WorkflowStatus, output?: any, error?: SerializedError): Promise<void>;
16
19
  insertStepState(runId: string, stepName: string, rpcName: string | null, data: any, stepOptions?: {
@@ -28,7 +28,7 @@ export class MongoDBWorkflowService extends PikkuWorkflowService {
28
28
  await this.versions.createIndex({ workflowName: 1, graphHash: 1 }, { unique: true });
29
29
  this.initialized = true;
30
30
  }
31
- async createRun(workflowName, input, inline, graphHash, wire) {
31
+ async createRun(workflowName, input, inline, graphHash, wire, options) {
32
32
  const id = crypto.randomUUID();
33
33
  const now = new Date();
34
34
  await this.runs.insertOne({
@@ -41,6 +41,8 @@ export class MongoDBWorkflowService extends PikkuWorkflowService {
41
41
  state: {},
42
42
  inline,
43
43
  graphHash,
44
+ deterministic: options?.deterministic ?? false,
45
+ plannedSteps: options?.plannedSteps ?? [],
44
46
  wire,
45
47
  createdAt: now,
46
48
  updatedAt: now,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pikku/mongodb",
3
- "version": "0.12.4",
3
+ "version": "0.12.5",
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.18"
20
+ "@pikku/core": "^0.12.19"
21
21
  },
22
22
  "dependencies": {
23
23
  "mongodb": "^6.12.0"
@@ -1,4 +1,5 @@
1
1
  import type {
2
+ WorkflowPlannedStep,
2
3
  WorkflowRun,
3
4
  StepState,
4
5
  WorkflowStatus,
@@ -16,6 +17,8 @@ interface WorkflowRunDoc {
16
17
  state: Record<string, unknown>
17
18
  inline: boolean
18
19
  graphHash: string | null
20
+ deterministic?: boolean
21
+ plannedSteps?: WorkflowPlannedStep[]
19
22
  wire: any | null
20
23
  createdAt: Date
21
24
  updatedAt: Date
@@ -238,6 +241,8 @@ export class MongoDBWorkflowRunService implements WorkflowRunService {
238
241
  error: row.error ?? undefined,
239
242
  inline: row.inline,
240
243
  graphHash: row.graphHash ?? undefined,
244
+ deterministic: row.deterministic ?? undefined,
245
+ plannedSteps: row.plannedSteps ?? undefined,
241
246
  wire: row.wire ?? { type: 'unknown' },
242
247
  createdAt: new Date(row.createdAt),
243
248
  updatedAt: new Date(row.updatedAt),
@@ -1,6 +1,7 @@
1
1
  import type { SerializedError } from '@pikku/core'
2
2
  import {
3
3
  PikkuWorkflowService,
4
+ type WorkflowPlannedStep,
4
5
  type WorkflowRun,
5
6
  type WorkflowRunWire,
6
7
  type StepState,
@@ -20,6 +21,8 @@ interface WorkflowRunDoc {
20
21
  state: Record<string, unknown>
21
22
  inline: boolean
22
23
  graphHash: string | null
24
+ deterministic?: boolean
25
+ plannedSteps?: WorkflowPlannedStep[]
23
26
  wire: any | null
24
27
  createdAt: Date
25
28
  updatedAt: Date
@@ -112,7 +115,11 @@ export class MongoDBWorkflowService extends PikkuWorkflowService {
112
115
  input: any,
113
116
  inline: boolean,
114
117
  graphHash: string,
115
- wire: WorkflowRunWire
118
+ wire: WorkflowRunWire,
119
+ options?: {
120
+ deterministic?: boolean
121
+ plannedSteps?: WorkflowPlannedStep[]
122
+ }
116
123
  ): Promise<string> {
117
124
  const id = crypto.randomUUID()
118
125
  const now = new Date()
@@ -127,6 +134,8 @@ export class MongoDBWorkflowService extends PikkuWorkflowService {
127
134
  state: {},
128
135
  inline,
129
136
  graphHash,
137
+ deterministic: options?.deterministic ?? false,
138
+ plannedSteps: options?.plannedSteps ?? [],
130
139
  wire,
131
140
  createdAt: now,
132
141
  updatedAt: now,