@lovable.dev/workflows-sdk 0.0.0-dev.1 → 0.0.0-dev.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/README.md CHANGED
@@ -15,11 +15,11 @@ from [`@tanstack/workflow-core`](https://github.com/TanStack/workflow).
15
15
  Schema validation libraries implementing Standard Schema, such as Zod, provide
16
16
  input and output inference.
17
17
 
18
- Keep the app's workflow collection in `app/workflows/index.ts`. Each workflow
19
- lives in `app/workflows/{workflow-name}/index.ts`, with its helpers alongside it:
18
+ Keep the app's workflow collection in `src/lib/workflows/index.ts`. Each workflow
19
+ lives in `src/lib/workflows/{workflow-name}/index.ts`, with its helpers alongside it:
20
20
 
21
21
  ```text
22
- app/workflows/
22
+ src/lib/workflows/
23
23
  ├── index.ts
24
24
  └── greet/
25
25
  ├── index.ts
@@ -43,8 +43,8 @@ names. An empty collection is valid. Registration copies the list, retains the
43
43
  definitions, and does not execute handlers or register global state. Treat
44
44
  definitions as immutable after registration.
45
45
 
46
- See [the authoring example](examples/workflows.ts) for schemas, typed middleware,
47
- and a durable step. The package typecheck includes this example.
46
+ See [the authoring example](examples/src/lib/workflows/greet/index.ts) for schemas,
47
+ typed middleware, and a durable step. The package typecheck includes this example.
48
48
 
49
49
  ## Schedules
50
50
 
@@ -60,12 +60,12 @@ calendar semantics remain the engine's responsibility. This API declares
60
60
  schedules but does not install timers or start runs. Periodic intervals,
61
61
  catch-up, and overlap policies remain follow-ups.
62
62
 
63
- The [example](examples/workflows.ts) declares a daily greeting at 09:00 in
63
+ The [example](examples/src/lib/workflows/index.ts) declares a daily greeting at 09:00 in
64
64
  Europe/Stockholm with static workflow input.
65
65
 
66
66
  ## Manifest generation
67
67
 
68
- Add `workflowsManifest({ entry: "app/workflows/index.ts" })` from
68
+ Add `workflowsManifest({ entry: "src/lib/workflows/index.ts" })` from
69
69
  `@lovable.dev/workflows-sdk/vite` to the app's Vite plugins. The entry must
70
70
  default-export its `registerWorkflows()` collection. Each production build writes
71
71
  one manifest per workflow to `.lovable/workflows/{workflow-name}.json` relative
@@ -103,6 +103,12 @@ synchronizing the returned manifests to `.lovable/workflows/` a required build s
103
103
 
104
104
  Each manifest's `graph` contains `nodes` and directed `edges`. The SDK parses the
105
105
  handler's function source without executing it. No additional registration is needed.
106
+
107
+ Graph inference reads the app's own `typescript`, an optional peer. Apps built
108
+ from a Lovable template already have it. Without it — or with a copy exposing no
109
+ stable JS API, as TypeScript 7 does before 7.1 — the build still succeeds and
110
+ every graph carries one `unknown` node and the diagnostic
111
+ `Install typescript to infer step graphs`.
106
112
  Sequential awaited `ctx.step("name", callback)` calls produce order edges;
107
113
  `await Promise.all([ctx.step(...), ctx.step(...)])` produces parallel branches
108
114
  that join at the next step. Returned step promises work too. Keep step IDs literal.
@@ -138,15 +144,16 @@ Define support for TanStack primitives, version routing, and schedule policies.
138
144
  ## Publishing dev builds
139
145
 
140
146
  The [publishing workflow](../../.github/workflows/publish-workflows-sdk.yml)
141
- publishes the version committed in `package.json` to npm's `dev` tag when SDK
147
+ publishes the version committed in `package.json` to npm's `latest` tag when SDK
142
148
  changes land on `main`. Manage versions manually: `0.0.0-dev`, `0.0.0-dev.1`,
143
149
  `0.0.0-dev.2`, and so on. The workflow rejects versions outside this series and
144
150
  skips versions already published. Manual runs default to a dry run.
145
151
  See [the setup guide](PUBLISHING.md) for the
146
152
  one-time bootstrap and npm trusted-publisher configuration.
147
153
 
148
- Install a published build with `npm install @lovable.dev/workflows-sdk@dev`,
149
- or pin the exact version shown in the workflow run's summary.
154
+ Install the newest build with `npm install @lovable.dev/workflows-sdk`, or pin
155
+ the exact version shown in the workflow run's summary. `latest` tracks every dev
156
+ publish while the SDK is pre-1.0; the older `dev` tag is frozen at `0.0.0-dev.2`.
150
157
 
151
158
  The existing internal [`@lovable/workflow-sdk`](../../packages/workflow-sdk)
152
159
  provides the engine contract. Use [`mcp-js`](../lovable-mcp-js) as the reference
@@ -1,9 +1,10 @@
1
- //#region src/validation.ts
1
+ import { createMiddleware, createWorkflow } from "@tanstack/workflow-core";
2
+ //#region src/core/identifier.ts
2
3
  function assertIdentifier(kind, id) {
3
4
  if (typeof id !== "string" || id.trim() === "" || id !== id.trim()) throw new Error(`@lovable.dev/workflows-sdk: ${kind} IDs must be non-empty and have no surrounding whitespace`);
4
5
  }
5
6
  //#endregion
6
- //#region src/schedule.ts
7
+ //#region src/core/schedule.ts
7
8
  function defineSchedule(schedule) {
8
9
  assertIdentifier("schedule", schedule.id);
9
10
  if (typeof schedule.cron !== "string" || schedule.cron.trim().split(/\s+/).length !== 5) throw new Error(`@lovable.dev/workflows-sdk: schedule "${schedule.id}" requires a five-field cron expression`);
@@ -15,7 +16,7 @@ function defineSchedule(schedule) {
15
16
  };
16
17
  }
17
18
  //#endregion
18
- //#region src/register.ts
19
+ //#region src/core/workflow.ts
19
20
  function registerWorkflows({ workflows, schedules = [] }) {
20
21
  const ids = /* @__PURE__ */ new Set();
21
22
  for (const workflow of workflows) {
@@ -39,27 +40,27 @@ function registerWorkflows({ workflows, schedules = [] }) {
39
40
  };
40
41
  }
41
42
  //#endregion
42
- //#region src/json.ts
43
- function toJson(value, path, ancestors = /* @__PURE__ */ new Set()) {
43
+ //#region src/manifests/json.ts
44
+ function toJson(value, jsonPath, ancestors = /* @__PURE__ */ new Set()) {
44
45
  if (value === null || typeof value === "string" || typeof value === "boolean") return value;
45
46
  if (typeof value === "number" && Number.isFinite(value)) return value;
46
- if (typeof value !== "object" || ancestors.has(value)) throw new Error(`@lovable.dev/workflows-sdk: ${path} must contain finite, acyclic JSON values`);
47
+ if (typeof value !== "object" || ancestors.has(value)) throw new Error(`@lovable.dev/workflows-sdk: ${jsonPath} must contain finite, acyclic JSON values`);
47
48
  ancestors.add(value);
48
49
  try {
49
- if (Object.getOwnPropertySymbols(value).length > 0) throw new Error(`@lovable.dev/workflows-sdk: ${path} must not contain symbol keys`);
50
+ if (Object.getOwnPropertySymbols(value).length > 0) throw new Error(`@lovable.dev/workflows-sdk: ${jsonPath} must not contain symbol keys`);
50
51
  if (Array.isArray(value)) {
51
- if (Object.keys(value).length !== value.length) throw new Error(`@lovable.dev/workflows-sdk: ${path} must be a dense JSON array without extra properties`);
52
- return Array.from(value, (item, index) => toJson(item, `${path}[${index}]`, ancestors));
52
+ if (Object.keys(value).length !== value.length) throw new Error(`@lovable.dev/workflows-sdk: ${jsonPath} must be a dense JSON array without extra properties`);
53
+ return Array.from(value, (item, index) => toJson(item, `${jsonPath}[${index}]`, ancestors));
53
54
  }
54
- if (Object.getPrototypeOf(value) !== Object.prototype && Object.getPrototypeOf(value) !== null) throw new Error(`@lovable.dev/workflows-sdk: ${path} must contain plain JSON objects`);
55
- return Object.fromEntries(Object.keys(value).sort().map((key) => [key, toJson(value[key], `${path}.${key}`, ancestors)]));
55
+ if (Object.getPrototypeOf(value) !== Object.prototype && Object.getPrototypeOf(value) !== null) throw new Error(`@lovable.dev/workflows-sdk: ${jsonPath} must contain plain JSON objects`);
56
+ return Object.fromEntries(Object.keys(value).sort().map((key) => [key, toJson(value[key], `${jsonPath}.${key}`, ancestors)]));
56
57
  } finally {
57
58
  ancestors.delete(value);
58
59
  }
59
60
  }
60
61
  //#endregion
61
- //#region src/manifest.ts
62
- function jsonSchema(schema, direction, label) {
62
+ //#region src/manifests/generate.ts
63
+ function serializeSchema(schema, direction, label) {
63
64
  if (!schema) return void 0;
64
65
  const standard = schema["~standard"];
65
66
  if (typeof standard.jsonSchema?.[direction] !== "function") throw new Error(`@lovable.dev/workflows-sdk: ${label} must support Standard JSON Schema conversion`);
@@ -70,7 +71,7 @@ function jsonSchema(schema, direction, label) {
70
71
  }
71
72
  }
72
73
  async function generateManifests(definition) {
73
- const { extractWorkflowGraph } = await import("./graph-extract-SXSdcip0.js");
74
+ const { extractWorkflowGraph } = await import("./graph-BgdiEUHq.js");
74
75
  const collection = registerWorkflows(definition);
75
76
  const manifests = [];
76
77
  for (const workflow of collection.workflows) {
@@ -79,9 +80,9 @@ async function generateManifests(definition) {
79
80
  id: workflow.id,
80
81
  ...workflow.description === void 0 ? {} : { description: workflow.description },
81
82
  ...workflow.version === void 0 ? {} : { version: workflow.version },
82
- ...workflow.inputSchema ? { inputSchema: jsonSchema(workflow.inputSchema, "input", `${workflow.id}.input`) } : {},
83
- ...workflow.outputSchema ? { outputSchema: jsonSchema(workflow.outputSchema, "output", `${workflow.id}.output`) } : {},
84
- ...workflow.stateSchema ? { stateSchema: jsonSchema(workflow.stateSchema, "output", `${workflow.id}.state`) } : {}
83
+ ...workflow.inputSchema ? { inputSchema: serializeSchema(workflow.inputSchema, "input", `${workflow.id}.input`) } : {},
84
+ ...workflow.outputSchema ? { outputSchema: serializeSchema(workflow.outputSchema, "output", `${workflow.id}.output`) } : {},
85
+ ...workflow.stateSchema ? { stateSchema: serializeSchema(workflow.stateSchema, "output", `${workflow.id}.state`) } : {}
85
86
  };
86
87
  const schedules = [];
87
88
  for (const schedule of collection.schedules.filter((schedule) => schedule.workflow === workflow)) {
@@ -103,7 +104,7 @@ async function generateManifests(definition) {
103
104
  version: 1,
104
105
  workflow: metadata,
105
106
  schedules,
106
- graph: extractWorkflowGraph(workflow.handler)
107
+ graph: await extractWorkflowGraph(workflow.handler)
107
108
  };
108
109
  toJson(manifest, "manifest");
109
110
  manifests.push(manifest);
@@ -111,4 +112,4 @@ async function generateManifests(definition) {
111
112
  return manifests.sort((a, b) => a.workflow.id < b.workflow.id ? -1 : a.workflow.id > b.workflow.id ? 1 : 0);
112
113
  }
113
114
  //#endregion
114
- export { registerWorkflows as n, defineSchedule as r, generateManifests as t };
115
+ export { defineSchedule as a, registerWorkflows as i, createMiddleware as n, createWorkflow as r, generateManifests as t };
@@ -1,6 +1,24 @@
1
- import * as ts from "typescript";
2
- //#region src/graph-extract.ts
3
- function extractWorkflowGraph(handler) {
1
+ //#region src/manifests/graph.ts
2
+ const durableMethods = {
3
+ step: 0,
4
+ approve: 0,
5
+ waitForEvent: 0,
6
+ sleep: 0,
7
+ sleepUntil: 0
8
+ };
9
+ let loaded;
10
+ async function loadTypeScript() {
11
+ if (loaded !== void 0) return loaded;
12
+ try {
13
+ const module = await import("typescript");
14
+ const api = module.default ?? module;
15
+ loaded = typeof api?.createSourceFile === "function" ? api : null;
16
+ } catch {
17
+ loaded = null;
18
+ }
19
+ return loaded;
20
+ }
21
+ async function extractWorkflowGraph(handler) {
4
22
  const graph = {
5
23
  source: "inferred",
6
24
  scope: "handler",
@@ -9,7 +27,6 @@ function extractWorkflowGraph(handler) {
9
27
  edges: [],
10
28
  diagnostics: []
11
29
  };
12
- const source = ts.createSourceFile("handler.js", `const handler = ${Function.prototype.toString.call(handler)};`, ts.ScriptTarget.ESNext, true, ts.ScriptKind.JS);
13
30
  function addNode(node, parents) {
14
31
  const id = `node-${graph.nodes.length}`;
15
32
  graph.nodes.push({
@@ -23,14 +40,24 @@ function extractWorkflowGraph(handler) {
23
40
  });
24
41
  return [id];
25
42
  }
26
- function unknown(reason, parents) {
43
+ function degrade(reason) {
27
44
  graph.complete = false;
28
45
  if (!graph.diagnostics.includes(reason)) graph.diagnostics.push(reason);
46
+ }
47
+ function unknown(reason, parents) {
48
+ degrade(reason);
29
49
  return addNode({
30
50
  kind: "unknown",
31
51
  label: reason
32
52
  }, parents);
33
53
  }
54
+ const api = await loadTypeScript();
55
+ if (!api) {
56
+ unknown("Install typescript to infer step graphs", []);
57
+ return graph;
58
+ }
59
+ const ts = api;
60
+ const source = ts.createSourceFile("handler.js", `const handler = ${Function.prototype.toString.call(handler)};`, ts.ScriptTarget.ESNext, true, ts.ScriptKind.JS);
34
61
  const declaration = source.statements[0];
35
62
  const fn = declaration && ts.isVariableStatement(declaration) ? declaration.declarationList.declarations[0]?.initializer : void 0;
36
63
  if (!fn || !ts.isArrowFunction(fn) && !ts.isFunctionExpression(fn) || source.text.includes("[native code]")) {
@@ -47,22 +74,94 @@ function extractWorkflowGraph(handler) {
47
74
  if (skipFunctions && ts.isFunctionLike(node)) return false;
48
75
  return predicate(node) || Boolean(ts.forEachChild(node, (child) => contains(child, predicate, skipFunctions) || void 0));
49
76
  }
50
- function contextStep(node) {
51
- return ts.isCallExpression(node) && ts.isPropertyAccessExpression(node.expression) && ts.isIdentifier(node.expression.expression) && node.expression.expression.text === context && node.expression.name.text === "step";
77
+ function durableCall(node) {
78
+ return ts.isCallExpression(node) && ts.isPropertyAccessExpression(node.expression) && ts.isIdentifier(node.expression.expression) && node.expression.expression.text === context && node.expression.name.text in durableMethods;
79
+ }
80
+ function stringLiteral(node) {
81
+ return node && (ts.isStringLiteral(node) || ts.isNoSubstitutionTemplateLiteral(node)) ? node.text : void 0;
82
+ }
83
+ function numberLiteral(node) {
84
+ if (!node || !ts.isNumericLiteral(node)) return void 0;
85
+ const value = Number(node.text);
86
+ return Number.isFinite(value) ? value : void 0;
87
+ }
88
+ function readableOptions(node) {
89
+ return node && ts.isObjectLiteralExpression(node) && node.properties.every(ts.isPropertyAssignment) ? node : void 0;
90
+ }
91
+ function option(options, name) {
92
+ for (const property of options?.properties ?? []) {
93
+ if (!ts.isPropertyAssignment(property)) continue;
94
+ if ((ts.isIdentifier(property.name) || ts.isStringLiteral(property.name) ? property.name.text : void 0) === name) return property.initializer;
95
+ }
96
+ }
97
+ function durableNode(call, parents) {
98
+ const method = call.expression.name.text;
99
+ if (method === "step") {
100
+ const stepId = stringLiteral(call.arguments[0]);
101
+ if (stepId === void 0) return unknown("Dynamic step IDs are not supported yet", parents);
102
+ return addNode({
103
+ kind: "step",
104
+ stepId,
105
+ label: stepId
106
+ }, parents);
107
+ }
108
+ if (method === "approve") {
109
+ const options = readableOptions(call.arguments[0]);
110
+ const title = stringLiteral(option(options, "title"));
111
+ if (title === void 0) return unknown("Dynamic approval titles are not supported yet", parents);
112
+ const given = option(options, "description");
113
+ const description = stringLiteral(given);
114
+ if (given && description === void 0) degrade("Dynamic approval descriptions are not recorded");
115
+ return addNode({
116
+ kind: "approve",
117
+ config: {
118
+ title,
119
+ ...description === void 0 ? {} : { description }
120
+ },
121
+ label: title
122
+ }, parents);
123
+ }
124
+ if (method === "waitForEvent") {
125
+ const event = stringLiteral(call.arguments[0]);
126
+ if (event === void 0) return unknown("Dynamic event names are not supported yet", parents);
127
+ const options = readableOptions(call.arguments[1]);
128
+ if (call.arguments[1] && !options) degrade("Dynamic waitForEvent options are not recorded");
129
+ const given = option(options, "deadline");
130
+ const deadline = numberLiteral(given);
131
+ if (given && deadline === void 0) degrade("Dynamic waitForEvent deadlines are not recorded");
132
+ return addNode({
133
+ kind: "wait-for-event",
134
+ config: {
135
+ event,
136
+ ...deadline === void 0 ? {} : { deadline }
137
+ },
138
+ label: event
139
+ }, parents);
140
+ }
141
+ if (method === "sleep") {
142
+ const ms = numberLiteral(call.arguments[0]);
143
+ if (ms === void 0) return unknown("Dynamic sleep durations are not supported yet", parents);
144
+ return addNode({
145
+ kind: "sleep",
146
+ config: { ms },
147
+ label: `sleep ${ms}ms`
148
+ }, parents);
149
+ }
150
+ const timestamp = numberLiteral(call.arguments[0]);
151
+ if (timestamp === void 0) return unknown("Dynamic sleepUntil timestamps are not supported yet", parents);
152
+ return addNode({
153
+ kind: "sleep-until",
154
+ config: { timestamp },
155
+ label: `sleep until ${timestamp}`
156
+ }, parents);
52
157
  }
53
158
  function expression(node, parents, awaited = false) {
54
159
  if (ts.isParenthesizedExpression(node)) return expression(node.expression, parents, awaited);
55
160
  if (ts.isAwaitExpression(node)) return expression(node.expression, parents, true);
56
- if (contextStep(node)) {
57
- if (!awaited) return unknown("Unawaited steps are not supported yet", parents);
58
- const stepId = node.arguments[0];
59
- if (!stepId || !ts.isStringLiteral(stepId) && !ts.isNoSubstitutionTemplateLiteral(stepId)) return unknown("Dynamic step IDs are not supported yet", parents);
60
- const tails = addNode({
61
- kind: "step",
62
- stepId: stepId.text,
63
- label: stepId.text
64
- }, parents);
65
- if (node.arguments.slice(1).some((argument) => contains(argument, contextStep))) return unknown("Nested steps are not supported yet", tails);
161
+ if (durableCall(node)) {
162
+ if (!awaited) return unknown("Unawaited durable calls are not supported yet", parents);
163
+ const tails = durableNode(node, parents);
164
+ if (node.arguments.some((argument) => contains(argument, durableCall))) return unknown("Nested durable calls are not supported yet", tails);
66
165
  return tails;
67
166
  }
68
167
  if (awaited && ts.isCallExpression(node) && ts.isPropertyAccessExpression(node.expression) && ts.isIdentifier(node.expression.expression) && node.expression.expression.text === "Promise" && node.expression.name.text === "all" && node.arguments.length === 1 && ts.isArrayLiteralExpression(node.arguments[0])) {
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { AnyWorkflowDefinition, AnyWorkflowDefinition as AnyWorkflowDefinition$1, Ctx, StepContext, StepOptions, WorkflowDefinition, WorkflowInput, WorkflowInput as WorkflowInput$1, WorkflowOutput, WorkflowState, createMiddleware, createWorkflow } from "@tanstack/workflow-core";
2
- //#region src/schedule.d.ts
2
+ //#region src/core/schedule.d.ts
3
3
  interface ScheduleDefinition<TWorkflow extends AnyWorkflowDefinition$1 = AnyWorkflowDefinition$1> {
4
4
  readonly id: string;
5
5
  readonly workflow: TWorkflow;
@@ -9,7 +9,7 @@ interface ScheduleDefinition<TWorkflow extends AnyWorkflowDefinition$1 = AnyWork
9
9
  }
10
10
  declare function defineSchedule<TWorkflow extends AnyWorkflowDefinition$1>(schedule: ScheduleDefinition<TWorkflow>): ScheduleDefinition<TWorkflow>;
11
11
  //#endregion
12
- //#region src/register.d.ts
12
+ //#region src/core/workflow.d.ts
13
13
  interface WorkflowsDefinition<TWorkflow extends AnyWorkflowDefinition$1 = AnyWorkflowDefinition$1> {
14
14
  readonly workflows: readonly TWorkflow[];
15
15
  readonly schedules: readonly ScheduleDefinition[];
@@ -19,17 +19,44 @@ declare function registerWorkflows<const TWorkflows extends readonly AnyWorkflow
19
19
  schedules?: readonly ScheduleDefinition[];
20
20
  }): WorkflowsDefinition<TWorkflows[number]>;
21
21
  //#endregion
22
- //#region src/graph.d.ts
22
+ //#region src/manifests/graph.d.ts
23
+ type WorkflowGraphNodeDetails = {
24
+ kind: "step";
25
+ stepId: string;
26
+ } | {
27
+ kind: "approve";
28
+ config: {
29
+ title: string;
30
+ description?: string;
31
+ };
32
+ } | {
33
+ kind: "wait-for-event";
34
+ config: {
35
+ event: string;
36
+ deadline?: number;
37
+ };
38
+ } | {
39
+ kind: "sleep";
40
+ config: {
41
+ ms: number;
42
+ };
43
+ } | {
44
+ kind: "sleep-until";
45
+ config: {
46
+ timestamp: number;
47
+ };
48
+ } | {
49
+ kind: "unknown";
50
+ };
51
+ type WorkflowGraphNode = {
52
+ id: string;
53
+ label: string;
54
+ } & WorkflowGraphNodeDetails;
23
55
  interface WorkflowGraph {
24
56
  source: "inferred";
25
57
  scope: "handler";
26
58
  complete: boolean;
27
- nodes: {
28
- id: string;
29
- kind: "step" | "unknown";
30
- label: string;
31
- stepId?: string;
32
- }[];
59
+ nodes: WorkflowGraphNode[];
33
60
  edges: {
34
61
  source: string;
35
62
  target: string;
@@ -38,12 +65,12 @@ interface WorkflowGraph {
38
65
  diagnostics: string[];
39
66
  }
40
67
  //#endregion
41
- //#region src/json.d.ts
68
+ //#region src/manifests/json.d.ts
42
69
  type JsonValue = null | boolean | number | string | JsonValue[] | {
43
70
  [key: string]: JsonValue;
44
71
  };
45
72
  //#endregion
46
- //#region src/manifest.d.ts
73
+ //#region src/manifests/generate.d.ts
47
74
  interface WorkflowManifest {
48
75
  version: 1;
49
76
  workflow: {
@@ -64,4 +91,4 @@ interface WorkflowManifest {
64
91
  }
65
92
  declare function generateManifests(definition: WorkflowsDefinition): Promise<WorkflowManifest[]>;
66
93
  //#endregion
67
- export { type AnyWorkflowDefinition, type Ctx, type ScheduleDefinition, type StepContext, type StepOptions, type WorkflowDefinition, type WorkflowGraph, type WorkflowInput, type WorkflowManifest, type WorkflowOutput, type WorkflowState, type WorkflowsDefinition, createMiddleware, createWorkflow, defineSchedule, generateManifests, registerWorkflows };
94
+ export { type AnyWorkflowDefinition, type Ctx, type ScheduleDefinition, type StepContext, type StepOptions, type WorkflowDefinition, type WorkflowGraph, type WorkflowGraphNode, type WorkflowGraphNodeDetails, type WorkflowInput, type WorkflowManifest, type WorkflowOutput, type WorkflowState, type WorkflowsDefinition, createMiddleware, createWorkflow, defineSchedule, generateManifests, registerWorkflows };
package/dist/index.js CHANGED
@@ -1,3 +1,2 @@
1
- import { n as registerWorkflows, r as defineSchedule, t as generateManifests } from "./manifest-DYEhsHr3.js";
2
- import { createMiddleware, createWorkflow } from "@tanstack/workflow-core";
1
+ import { a as defineSchedule, i as registerWorkflows, n as createMiddleware, r as createWorkflow, t as generateManifests } from "./generate-DFS-ezZy.js";
3
2
  export { createMiddleware, createWorkflow, defineSchedule, generateManifests, registerWorkflows };
package/dist/vite.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Plugin } from "vite";
2
- //#region src/vite.d.ts
2
+ //#region src/vite/plugin.d.ts
3
3
  declare function workflowsManifest({ entry }: {
4
4
  entry: string;
5
5
  }): Plugin;
package/dist/vite.js CHANGED
@@ -1,8 +1,8 @@
1
- import { t as generateManifests } from "./manifest-DYEhsHr3.js";
1
+ import { t as generateManifests } from "./generate-DFS-ezZy.js";
2
2
  import { join, resolve } from "node:path";
3
3
  import { createServer } from "vite";
4
4
  import { lstat, mkdir, mkdtemp, readdir, rename, rm, writeFile } from "node:fs/promises";
5
- //#region src/manifest-files.ts
5
+ //#region src/vite/manifest-files.ts
6
6
  async function ensureDirectory(path) {
7
7
  try {
8
8
  await mkdir(path);
@@ -30,7 +30,7 @@ async function writeManifests(root, manifests) {
30
30
  }
31
31
  }
32
32
  //#endregion
33
- //#region src/vite.ts
33
+ //#region src/vite/plugin.ts
34
34
  function workflowsManifest({ entry }) {
35
35
  let config;
36
36
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lovable.dev/workflows-sdk",
3
- "version": "0.0.0-dev.1",
3
+ "version": "0.0.0-dev.3",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "tag": "dev",
@@ -28,7 +28,6 @@
28
28
  "dist"
29
29
  ],
30
30
  "dependencies": {
31
- "typescript": "npm:@typescript/typescript6@6.0.2",
32
31
  "@standard-schema/spec": "^1.1.0",
33
32
  "@tanstack/workflow-core": "0.0.4"
34
33
  },
@@ -36,20 +35,25 @@
36
35
  "@types/node": "22.13.13",
37
36
  "vite": "^7.3.1",
38
37
  "zod": "^4.1.13",
39
- "tsdown": "^0.22.5"
38
+ "tsdown": "^0.22.5",
39
+ "typescript": "npm:@typescript/typescript6@6.0.2"
40
40
  },
41
41
  "peerDependencies": {
42
- "vite": ">=7.3.1 <9"
42
+ "vite": ">=7.3.1 <9",
43
+ "typescript": ">=5.4"
43
44
  },
44
45
  "peerDependenciesMeta": {
45
46
  "vite": {
46
47
  "optional": true
48
+ },
49
+ "typescript": {
50
+ "optional": true
47
51
  }
48
52
  },
49
53
  "scripts": {
50
54
  "build": "tsdown",
51
- "test": "node --test src/graph.test.mjs",
52
- "typecheck": "tsgo -p tsconfig.typecheck.json",
53
- "check:package": "tmp=$(mktemp -d) && pnpm pack --out \"$tmp/pkg.tgz\" && tar -xzf \"$tmp/pkg.tgz\" -C \"$tmp\" && publint \"$tmp/package\" --strict && attw \"$tmp/pkg.tgz\""
55
+ "test": "node --test tests/graph.test.mjs",
56
+ "typecheck": "tsc -p tsconfig.typecheck.json",
57
+ "check:package": "tmp=$(mktemp -d) && pnpm pack --out \"$tmp/pkg.tgz\" && tar -xzf \"$tmp/pkg.tgz\" -C \"$tmp\" && publint \"$tmp/package\" --strict && attw \"$tmp/pkg.tgz\" && node scripts/check-deps.mjs \"$tmp/package/package.json\""
54
58
  }
55
59
  }