@vite-hub/workflow 0.3.1 → 0.5.0

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.
Files changed (45) hide show
  1. package/README.md +79 -44
  2. package/dist/{app-CmMq8l4t.js → app-2Y7sBAG6.js} +1 -1
  3. package/dist/{client-CU5rELC0.js → client-CgBcDlGn.js} +155 -80
  4. package/dist/{cloudflare-BfFnNWB0.js → cloudflare-Datj_znU.js} +1 -1
  5. package/dist/{config-DCvRDlxA.js → config-z1651xc2.js} +1 -1
  6. package/dist/definition.d.ts +10 -11
  7. package/dist/definition.js +24 -22
  8. package/dist/{delay--ESDybVT.js → delay-CHN4tv3i.js} +6 -42
  9. package/dist/durability.d.ts +1 -1
  10. package/dist/{error-diagnostics-DSkCJC_L.js → error-diagnostics-C0KyI408.js} +10 -2
  11. package/dist/{error-diagnostics-8YNJ37rP.js → error-diagnostics-DMeaFmQD.js} +68 -19
  12. package/dist/{errors-DCqRnZpN.js → errors-BNxEeeCO.js} +0 -4
  13. package/dist/{errors-DVwFb6Fd.d.ts → errors-D-fNDVg0.d.ts} +12 -6
  14. package/dist/index.d.ts +32 -11
  15. package/dist/index.js +13 -6
  16. package/dist/{openworkflow-TEaNk0LV.d.ts → openworkflow-BoaENgh9.d.ts} +8 -7
  17. package/dist/{operation-definition-8gOe-ubD.d.ts → operation-definition-CI2PJGqu.d.ts} +13 -2
  18. package/dist/{operations-B0L8kV5s.js → operations-CYntpf-T.js} +34 -41
  19. package/dist/operations.d.ts +5 -8
  20. package/dist/operations.js +27 -32
  21. package/dist/{out-fRNaVslw.js → out-DxLKolA0.js} +1 -1
  22. package/dist/{rolldown-runtime-CMFfr-1z.js → rolldown-runtime-B4iAMlE-.js} +10 -1
  23. package/dist/{run-error-DBWqiJHH.js → run-error-Ctn50EYz.js} +1 -2
  24. package/dist/run-failed-gVGo1BaF.js +18 -0
  25. package/dist/runtime/cloudflare-runner.d.ts +12 -2
  26. package/dist/runtime/cloudflare-runner.js +28 -9
  27. package/dist/runtime/cloudflare-vite.d.ts +1 -1
  28. package/dist/runtime/cloudflare-vite.js +2 -2
  29. package/dist/runtime/dev-runs.js +1 -0
  30. package/dist/runtime/execute.d.ts +25 -4
  31. package/dist/runtime/execute.js +168 -43
  32. package/dist/runtime/openworkflow-worker.d.ts +2 -2
  33. package/dist/runtime/openworkflow-worker.js +4 -9
  34. package/dist/runtime/openworkflow.d.ts +2 -2
  35. package/dist/runtime/openworkflow.js +60 -49
  36. package/dist/runtime/state.d.ts +1 -1
  37. package/dist/runtime/state.js +4 -6
  38. package/dist/runtime/vercel-vite.d.ts +1 -1
  39. package/dist/runtime/vercel-vite.js +2 -2
  40. package/dist/signals-C1iolifd.js +80 -0
  41. package/dist/{types-CnKVDnEp.d.ts → types-BWPHeugk.d.ts} +99 -28
  42. package/dist/{vercel-BZU_O6ay.js → vercel-BIkBFrQQ.js} +6 -14
  43. package/dist/vite.d.ts +27 -16
  44. package/dist/vite.js +3404 -961
  45. package/package.json +4 -4
@@ -1,17 +1,13 @@
1
- import { t as workflowErrorDiagnostics } from "./error-diagnostics-8YNJ37rP.js";
2
- import { n as createWorkflowError } from "./errors-DCqRnZpN.js";
3
- import { a as workflowStartAtKey } from "./delay--ESDybVT.js";
4
- import { a as safeWorkflowName, i as runWorkflowProviderOperation, r as isWorkflowBoundaryError, t as toWorkflowRunError } from "./run-error-DBWqiJHH.js";
1
+ import { t as workflowErrorDiagnostics } from "./error-diagnostics-DMeaFmQD.js";
2
+ import { n as createWorkflowError } from "./errors-BNxEeeCO.js";
3
+ import { a as workflowStartAtKey } from "./delay-CHN4tv3i.js";
4
+ import { a as safeWorkflowName, i as runWorkflowProviderOperation, r as isWorkflowBoundaryError, t as toWorkflowRunError } from "./run-error-Ctn50EYz.js";
5
5
  //#region src/runtime/vercel.ts
6
6
  async function loadVercelWorkflowRuntime() {
7
7
  const importVercelWorkflow = new Function("specifier", "return import(specifier)");
8
8
  const [api, runtime] = await Promise.all([importVercelWorkflow("workflow/api"), importVercelWorkflow("workflow/runtime")]);
9
9
  return createVercelWorkflowRuntime(api, runtime);
10
10
  }
11
- /**
12
- * The largest step page that Vercel's step listing accepts. A larger page fails with HTTP 400. Workflow DevKit's own
13
- * CLI uses the same bound (`packages/cli/src/lib/inspect/flag-bounds.ts` in vercel/workflow).
14
- */
15
11
  const vercelStepPageLimit = 100;
16
12
  function createVercelWorkflowRuntime(api, runtime) {
17
13
  const { getRun, resumeHook, start } = api;
@@ -151,10 +147,6 @@ async function readRunIdentity(run) {
151
147
  workflowName
152
148
  };
153
149
  }
154
- /**
155
- * The error of a failed native run. Workflow DevKit rejects `returnValue` of a failed run with
156
- * `WorkflowRunFailedError`, which keeps the thrown value in `cause`.
157
- */
158
150
  async function readVercelRunError(run) {
159
151
  try {
160
152
  await run.returnValue;
@@ -165,7 +157,7 @@ async function readVercelRunError(run) {
165
157
  return toWorkflowRunError(void 0);
166
158
  }
167
159
  function getNativeWorkflowName(name, definition) {
168
- const workflowName = (definition.options?.native)?.workflowId;
160
+ const workflowName = definition.native?.workflowId;
169
161
  if (!workflowName) throw createWorkflowError({
170
162
  code: "WORKFLOW_NATIVE_ENTRY_INVALID",
171
163
  details: {
@@ -215,7 +207,7 @@ async function inspectVercelWorkflowRun(name, definition, id, payload) {
215
207
  };
216
208
  }
217
209
  async function startVercelWorkflow(name, definition, payload, observeSettlement, onDispatch, startAt) {
218
- const native = definition.options?.native;
210
+ const native = definition.native;
219
211
  if (!native) throw createWorkflowError({
220
212
  code: "WORKFLOW_NATIVE_ENTRY_REQUIRED",
221
213
  details: {
package/dist/vite.d.ts CHANGED
@@ -1,7 +1,6 @@
1
- import { C as WorkflowOptions, i as DiscoveredWorkflowDefinition } from "./types-CnKVDnEp.js";
2
- import { n as OperationContributionEntry } from "./operation-definition-8gOe-ubD.js";
3
- import { Plugin, ResolvedConfig, UserConfig } from "vite";
4
- import { Plugin as Plugin$1 } from "esbuild";
1
+ import { i as DiscoveredWorkflowDefinition, w as WorkflowOptions } from "./types-BWPHeugk.js";
2
+ import { n as OperationContributionEntry } from "./operation-definition-CI2PJGqu.js";
3
+ import { Plugin, ResolvedConfig, Rolldown, UserConfig } from "vite";
5
4
  //#region src/internal/runtime-modules.d.ts
6
5
  type WorkflowRuntimeModuleName = "cloudflare-runner" | "cloudflare-vite" | "dev-runs" | "execute" | "openworkflow-worker" | "state" | "vercel-vite";
7
6
  /**
@@ -64,6 +63,8 @@ interface ViteHubResourceSummary {
64
63
  owner: string;
65
64
  /** Absent when no id is known yet. */
66
65
  source?: ViteHubResourceIdSource;
66
+ /** The resource is in the Wrangler config of a standalone Provider Output Worker, not in Nitro's. */
67
+ standalone?: boolean;
67
68
  }
68
69
  interface ViteHubInspectionContributor {
69
70
  definitions?: readonly ViteHubDefinitionInspector[];
@@ -142,7 +143,7 @@ interface ProviderOutputEnvironmentOwner {
142
143
  nitro: {
143
144
  name: string;
144
145
  setup: (nitro: {
145
- options: {
146
+ options: NitroPackageLoadingOptions & {
146
147
  static?: boolean;
147
148
  };
148
149
  }) => void;
@@ -152,6 +153,11 @@ interface ProviderOutputEnvironmentOwner {
152
153
  environment?: object;
153
154
  } | undefined) => boolean;
154
155
  }
156
+ type NitroPackageLoadingOptions = {
157
+ devServer?: {
158
+ runner?: string;
159
+ };
160
+ };
155
161
  //#endregion
156
162
  //#region src/discovery.d.ts
157
163
  export declare function discoverWorkflowDefinitions(options: {
@@ -165,7 +171,10 @@ export declare function discoverWorkflowDefinitions(options: {
165
171
  }): DiscoveredWorkflowDefinition[];
166
172
  //#endregion
167
173
  //#region src/internal/registry-types.d.ts
168
- /** Types `steps` in `defineWorkflow(name, handler)` with the step files of each folder Workflow. */
174
+ /**
175
+ * Types `startWorkflow()` with the name and payload of each Workflow Definition (`WorkflowRegistry`), and `steps` with
176
+ * the step files of each folder Workflow (`WorkflowStepRegistry`).
177
+ */
169
178
  export declare function createWorkflowTypes(file: string, definitions: DiscoveredWorkflowDefinition[], importBase?: string): string;
170
179
  //#endregion
171
180
  //#region ../internal/src/console.d.ts
@@ -481,6 +490,8 @@ interface ViteHubConsoleDocumentHint {
481
490
  * failing without a reason.
482
491
  */
483
492
  interface ViteHubConsoleDocumentSetup {
493
+ /** The project has GitHub Sources but no document collections. */
494
+ sourceHeadsOnly?: true;
484
495
  /** Present when no user can read anything because the owner has no access policy. */
485
496
  access?: ViteHubConsoleDocumentHint;
486
497
  /**
@@ -507,6 +518,14 @@ interface WorkflowInspectionOptions {
507
518
  }
508
519
  /** Lists user-facing Workflow Definitions. Generated Agent recovery Workflows are internal and stay hidden. */
509
520
  export declare function inspectWorkflowDefinitions(options: WorkflowInspectionOptions): ViteHubDefinitionSummary[];
521
+ /**
522
+ * Lists the Cloudflare Workflows that the build binds, with the same binding and Workflow names as the generated Wrangler
523
+ * config. Agent recovery Workflows are listed too, since the Worker needs their bindings. Reads local files only.
524
+ */
525
+ export declare function inspectWorkflowResources(options: WorkflowInspectionOptions & {
526
+ binding?: string;
527
+ name?: string;
528
+ }): ViteHubResourceSummary[];
510
529
  /** Console section that lists discovered Workflow Definitions. `vitehub inspect definitions` reads the same data. */
511
530
  export declare const workflowConsoleSection: ViteHubConsoleSectionContribution<WorkflowInspectionOptions>;
512
531
  //#endregion
@@ -529,7 +548,7 @@ export type WorkflowVitePlugin = Plugin & Partial<Pick<ProviderOutputEnvironment
529
548
  createNitroConfig?: (options: WorkflowNitroConfigOptions) => Promise<Record<string, unknown>>;
530
549
  prepareScheduleRuntime?: (artifactDir?: string, config?: ResolvedConfig) => Promise<{
531
550
  bundleAlias: Record<string, string>;
532
- bundlePlugins?: Plugin$1[];
551
+ bundlePlugins?: Rolldown.Plugin[];
533
552
  native: boolean;
534
553
  registryFile: string;
535
554
  runtimeModules: {
@@ -541,24 +560,16 @@ export type WorkflowVitePlugin = Plugin & Partial<Pick<ProviderOutputEnvironment
541
560
  };
542
561
  };
543
562
  interface InternalWorkflowModuleOptions {
544
- /** The module that exports `getPostgresConnectionUrl()`. Default `@vite-hub/database`. */
545
563
  databaseImport?: string;
546
564
  hosting?: string;
547
- implicitlyEnabled?: boolean;
548
565
  importBase?: string;
549
566
  providerImportAliases?: Record<string, string>;
550
- /**
551
- * The app that the Workflow Provider Output serves next to the Workflows. `true` finds `src/server.ts` or
552
- * `src/worker.ts`, a file name such as `"server-workflow.ts"` picks that file in `src`, and `false` serves no app.
553
- */
554
567
  includeUserAppEntry?: boolean | string;
555
568
  workspaceDependencyRuntimeImports?: {
556
- sandboxTask?: string;
557
- sandboxTaskRuntimeState?: string;
558
569
  shellWorkspace?: string;
559
570
  };
560
571
  workspaceRuntimeModule?: string;
561
572
  }
562
- export declare function hubWorkflow(options?: WorkflowOptions, internalOptions?: InternalWorkflowModuleOptions): WorkflowVitePlugin;
573
+ export declare function hubWorkflow(workflow?: WorkflowOptions, internalOptions?: InternalWorkflowModuleOptions): WorkflowVitePlugin;
563
574
  //#endregion
564
575
  export type { WorkflowInspectionOptions };