@lovable.dev/workflows-sdk 0.0.0-dev.14 → 0.0.0-dev.15

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 CHANGED
@@ -282,7 +282,7 @@ this mapped form.
282
282
  | --- | --- |
283
283
  | `nodes[].id` | Unique occurrence ID within this graph; use as the UI node key |
284
284
  | `nodes[].kind` | Durable operation, `parallel`, or `unknown` |
285
- | `nodes[].stepId` | Literal step name, present for statically named steps |
285
+ | `nodes[].stepId` | Runtime durable ID for every statically known operation |
286
286
  | `nodes[].cardinality` | `dynamic` for a runtime-sized parallel fan-out |
287
287
  | `nodes[].operation.kind` | Durable operation repeated by a parallel node |
288
288
  | `nodes[].operation.stepIdTemplate` | Display template for steps in a dynamic parallel node |
@@ -296,6 +296,10 @@ For example, `read` followed by parallel `transform-a` and `transform-b`, then
296
296
  Node IDs are deterministic for the same source, but may change when the handler
297
297
  is edited.
298
298
 
299
+ Known durable nodes use the same `stepId` as runtime progress records. An
300
+ explicit `{ id }` wins; otherwise the graph and runtime share the operation's
301
+ derived default. `label` remains the display name.
302
+
299
303
  Graphs have `source: "inferred"` and `scope: "handler"`. They describe source
300
304
  structure, not run history or data dependencies, and exclude middleware and
301
305
  initialization. A mapped `Promise.all` is complete when its callback directly
@@ -1,5 +1,5 @@
1
1
  import { t as defaultDurableId } from "./durable-ids-LsygHSZC.js";
2
- import { loadTypeScript } from "./graph-CZDg07_0.js";
2
+ import { loadTypeScript } from "./graph-Bt-31WQT.js";
3
3
  //#region src/manifests/duplicate-ids.ts
4
4
  /** Where an explicit `{ id }` would sit for each operation. */
5
5
  const optionsArgument = {
@@ -183,9 +183,9 @@ function serializeSchema(schema, direction, label) {
183
183
  }
184
184
  }
185
185
  async function generateManifests(definition) {
186
- const { extractWorkflowGraph } = await import("./graph-CZDg07_0.js");
187
- const { findDuplicateOperationIds } = await import("./duplicate-ids-DFD8TO2y.js");
188
- const { findNestedDurableOperations } = await import("./nested-operations-OEvIJ3AZ.js");
186
+ const { extractWorkflowGraph } = await import("./graph-Bt-31WQT.js");
187
+ const { findDuplicateOperationIds } = await import("./duplicate-ids-ClNLIwAz.js");
188
+ const { findNestedDurableOperations } = await import("./nested-operations-Cpzs_PHo.js");
189
189
  const collection = registerWorkflows(definition);
190
190
  const manifests = [];
191
191
  for (const workflow of collection.workflows) {
@@ -1,3 +1,4 @@
1
+ import { t as defaultDurableId } from "./durable-ids-LsygHSZC.js";
1
2
  //#region src/manifests/graph.ts
2
3
  const durableMethods = {
3
4
  step: 0,
@@ -127,6 +128,11 @@ async function extractWorkflowGraph(handler) {
127
128
  if ((ts.isIdentifier(property.name) || ts.isStringLiteral(property.name) ? property.name.text : void 0) === name) return property.initializer;
128
129
  }
129
130
  }
131
+ function durableStepId(argument, options, fallback) {
132
+ if (argument && !options) return void 0;
133
+ const given = option(options, "id");
134
+ return given ? stringLiteral(given) : fallback;
135
+ }
130
136
  function durableNode(call, parents) {
131
137
  const method = call.expression.name.text;
132
138
  if (method === "step") {
@@ -142,11 +148,17 @@ async function extractWorkflowGraph(handler) {
142
148
  const options = readableOptions(call.arguments[0]);
143
149
  const title = stringLiteral(option(options, "title"));
144
150
  if (title === void 0) return unknown("Dynamic approval titles are not supported yet", parents);
151
+ const stepId = durableStepId(call.arguments[0], options, defaultDurableId({
152
+ kind: "approve",
153
+ title
154
+ }));
155
+ if (stepId === void 0) return unknown("Dynamic approval IDs are not supported yet", parents);
145
156
  const given = option(options, "description");
146
157
  const description = stringLiteral(given);
147
158
  if (given && description === void 0) degrade("Dynamic approval descriptions are not recorded");
148
159
  return addNode({
149
160
  kind: "approve",
161
+ stepId,
150
162
  config: {
151
163
  title,
152
164
  ...description === void 0 ? {} : { description }
@@ -158,12 +170,17 @@ async function extractWorkflowGraph(handler) {
158
170
  const event = stringLiteral(call.arguments[0]);
159
171
  if (event === void 0) return unknown("Dynamic event names are not supported yet", parents);
160
172
  const options = readableOptions(call.arguments[1]);
161
- if (call.arguments[1] && !options) degrade("Dynamic waitForEvent options are not recorded");
173
+ const stepId = durableStepId(call.arguments[1], options, defaultDurableId({
174
+ kind: "waitForEvent",
175
+ name: event
176
+ }));
177
+ if (stepId === void 0) return unknown("Dynamic waitForEvent IDs are not supported yet", parents);
162
178
  const given = option(options, "deadline");
163
179
  const deadline = numberLiteral(given);
164
180
  if (given && deadline === void 0) degrade("Dynamic waitForEvent deadlines are not recorded");
165
181
  return addNode({
166
182
  kind: "wait-for-event",
183
+ stepId,
167
184
  config: {
168
185
  event,
169
186
  ...deadline === void 0 ? {} : { deadline }
@@ -174,16 +191,30 @@ async function extractWorkflowGraph(handler) {
174
191
  if (method === "sleep") {
175
192
  const ms = numberLiteral(call.arguments[0]);
176
193
  if (ms === void 0) return unknown("Dynamic sleep durations are not supported yet", parents);
194
+ const options = readableOptions(call.arguments[1]);
195
+ const stepId = durableStepId(call.arguments[1], options, defaultDurableId({
196
+ kind: "sleep",
197
+ ms
198
+ }));
199
+ if (stepId === void 0) return unknown("Dynamic sleep IDs are not supported yet", parents);
177
200
  return addNode({
178
201
  kind: "sleep",
202
+ stepId,
179
203
  config: { ms },
180
204
  label: `sleep ${ms}ms`
181
205
  }, parents);
182
206
  }
183
207
  const timestamp = numberLiteral(call.arguments[0]);
184
208
  if (timestamp === void 0) return unknown("Dynamic sleepUntil timestamps are not supported yet", parents);
209
+ const options = readableOptions(call.arguments[1]);
210
+ const stepId = durableStepId(call.arguments[1], options, defaultDurableId({
211
+ kind: "sleepUntil",
212
+ timestamp
213
+ }));
214
+ if (stepId === void 0) return unknown("Dynamic sleepUntil IDs are not supported yet", parents);
185
215
  return addNode({
186
216
  kind: "sleep-until",
217
+ stepId,
187
218
  config: { timestamp },
188
219
  label: `sleep until ${timestamp}`
189
220
  }, parents);
package/dist/index.d.ts CHANGED
@@ -64,23 +64,27 @@ type WorkflowGraphNodeDetails = {
64
64
  };
65
65
  } | {
66
66
  kind: "approve";
67
+ stepId: string;
67
68
  config: {
68
69
  title: string;
69
70
  description?: string;
70
71
  };
71
72
  } | {
72
73
  kind: "wait-for-event";
74
+ stepId: string;
73
75
  config: {
74
76
  event: string;
75
77
  deadline?: number;
76
78
  };
77
79
  } | {
78
80
  kind: "sleep";
81
+ stepId: string;
79
82
  config: {
80
83
  ms: number;
81
84
  };
82
85
  } | {
83
86
  kind: "sleep-until";
87
+ stepId: string;
84
88
  config: {
85
89
  timestamp: number;
86
90
  };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a as defineSchedule, c as weekly, i as registerWorkflows, n as createMiddleware, o as daily, r as createWorkflow, s as hourly, t as generateManifests } from "./generate-CUlH7Z2x.js";
1
+ import { a as defineSchedule, c as weekly, i as registerWorkflows, n as createMiddleware, o as daily, r as createWorkflow, s as hourly, t as generateManifests } from "./generate-CVoNE4Kn.js";
2
2
  import { t as defaultDurableId } from "./durable-ids-LsygHSZC.js";
3
3
  import { WorkflowRequestParseError, inMemoryRunStore, parseWorkflowRequest, runWorkflow } from "@tanstack/workflow-core";
4
4
  //#region src/stacks/tanstack/sse.ts
@@ -1,4 +1,4 @@
1
- import { loadTypeScript } from "./graph-CZDg07_0.js";
1
+ import { loadTypeScript } from "./graph-Bt-31WQT.js";
2
2
  //#region src/manifests/nested-operations.ts
3
3
  const durableMethods = [
4
4
  "step",
package/dist/vite.js CHANGED
@@ -1,4 +1,4 @@
1
- import { t as generateManifests } from "./generate-CUlH7Z2x.js";
1
+ import { t as generateManifests } from "./generate-CVoNE4Kn.js";
2
2
  import { dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
3
3
  import { createServer } from "vite";
4
4
  import { lstat, mkdir, mkdtemp, readdir, rename, rm, writeFile } from "node:fs/promises";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lovable.dev/workflows-sdk",
3
- "version": "0.0.0-dev.14",
3
+ "version": "0.0.0-dev.15",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "tag": "dev",