@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.
- package/README.md +79 -44
- package/dist/{app-CmMq8l4t.js → app-2Y7sBAG6.js} +1 -1
- package/dist/{client-CU5rELC0.js → client-CgBcDlGn.js} +155 -80
- package/dist/{cloudflare-BfFnNWB0.js → cloudflare-Datj_znU.js} +1 -1
- package/dist/{config-DCvRDlxA.js → config-z1651xc2.js} +1 -1
- package/dist/definition.d.ts +10 -11
- package/dist/definition.js +24 -22
- package/dist/{delay--ESDybVT.js → delay-CHN4tv3i.js} +6 -42
- package/dist/durability.d.ts +1 -1
- package/dist/{error-diagnostics-DSkCJC_L.js → error-diagnostics-C0KyI408.js} +10 -2
- package/dist/{error-diagnostics-8YNJ37rP.js → error-diagnostics-DMeaFmQD.js} +68 -19
- package/dist/{errors-DCqRnZpN.js → errors-BNxEeeCO.js} +0 -4
- package/dist/{errors-DVwFb6Fd.d.ts → errors-D-fNDVg0.d.ts} +12 -6
- package/dist/index.d.ts +32 -11
- package/dist/index.js +13 -6
- package/dist/{openworkflow-TEaNk0LV.d.ts → openworkflow-BoaENgh9.d.ts} +8 -7
- package/dist/{operation-definition-8gOe-ubD.d.ts → operation-definition-CI2PJGqu.d.ts} +13 -2
- package/dist/{operations-B0L8kV5s.js → operations-CYntpf-T.js} +34 -41
- package/dist/operations.d.ts +5 -8
- package/dist/operations.js +27 -32
- package/dist/{out-fRNaVslw.js → out-DxLKolA0.js} +1 -1
- package/dist/{rolldown-runtime-CMFfr-1z.js → rolldown-runtime-B4iAMlE-.js} +10 -1
- package/dist/{run-error-DBWqiJHH.js → run-error-Ctn50EYz.js} +1 -2
- package/dist/run-failed-gVGo1BaF.js +18 -0
- package/dist/runtime/cloudflare-runner.d.ts +12 -2
- package/dist/runtime/cloudflare-runner.js +28 -9
- package/dist/runtime/cloudflare-vite.d.ts +1 -1
- package/dist/runtime/cloudflare-vite.js +2 -2
- package/dist/runtime/dev-runs.js +1 -0
- package/dist/runtime/execute.d.ts +25 -4
- package/dist/runtime/execute.js +168 -43
- package/dist/runtime/openworkflow-worker.d.ts +2 -2
- package/dist/runtime/openworkflow-worker.js +4 -9
- package/dist/runtime/openworkflow.d.ts +2 -2
- package/dist/runtime/openworkflow.js +60 -49
- package/dist/runtime/state.d.ts +1 -1
- package/dist/runtime/state.js +4 -6
- package/dist/runtime/vercel-vite.d.ts +1 -1
- package/dist/runtime/vercel-vite.js +2 -2
- package/dist/signals-C1iolifd.js +80 -0
- package/dist/{types-CnKVDnEp.d.ts → types-BWPHeugk.d.ts} +99 -28
- package/dist/{vercel-BZU_O6ay.js → vercel-BIkBFrQQ.js} +6 -14
- package/dist/vite.d.ts +27 -16
- package/dist/vite.js +3404 -961
- package/package.json +4 -4
|
@@ -1,17 +1,13 @@
|
|
|
1
|
-
import { t as workflowErrorDiagnostics } from "./error-diagnostics-
|
|
2
|
-
import { n as createWorkflowError } from "./errors-
|
|
3
|
-
import { a as workflowStartAtKey } from "./delay
|
|
4
|
-
import { a as safeWorkflowName, i as runWorkflowProviderOperation, r as isWorkflowBoundaryError, t as toWorkflowRunError } from "./run-error-
|
|
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 =
|
|
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.
|
|
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 {
|
|
2
|
-
import { n as OperationContributionEntry } from "./operation-definition-
|
|
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
|
-
/**
|
|
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
|
|
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(
|
|
573
|
+
export declare function hubWorkflow(workflow?: WorkflowOptions, internalOptions?: InternalWorkflowModuleOptions): WorkflowVitePlugin;
|
|
563
574
|
//#endregion
|
|
564
575
|
export type { WorkflowInspectionOptions };
|