@vite-hub/workflow 0.4.1 → 0.5.1

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 (60) hide show
  1. package/README.md +28 -10
  2. package/dist/{app-He0GTrYZ.js → app-DXUHElAz.js} +2 -3
  3. package/dist/{app-BojnC_yf.d.ts → app-wkVFd7m-.d.ts} +0 -2
  4. package/dist/{client-DkwOxEiT.js → client-CbBg4HlH.js} +88 -67
  5. package/dist/{cloudflare-BHfClPvT.js → cloudflare-Sgywkm1N.js} +3 -5
  6. package/dist/{cloudflare-env-CGLx7lUd.js → cloudflare-env-DHhzRZOs.js} +2 -4
  7. package/dist/cloudflare-env-lookup-BqomAHN5.d.ts +2 -0
  8. package/dist/{cloudflare-shared-CTqh_a2s.d.ts → cloudflare-shared-B9cY3-jD.d.ts} +1 -3
  9. package/dist/{config-C3DvtjfJ.js → config-CizNRTMi.js} +4 -7
  10. package/dist/definition.d.ts +2 -4
  11. package/dist/definition.js +3 -4
  12. package/dist/{delay-D1-nq_VE.js → delay-CtT3442d.js} +2 -4
  13. package/dist/{dev-recorder-CTN5Fkao.js → dev-recorder-Dltdmlkv.js} +1 -2
  14. package/dist/durability.d.ts +2 -4
  15. package/dist/durability.js +2 -3
  16. package/dist/{error-diagnostics-0V2T3JFw.js → error-diagnostics--2cV_ER1.js} +24 -7
  17. package/dist/{error-diagnostics-CQ4BUqRe.js → error-diagnostics-kKXseq8d.js} +10 -3
  18. package/dist/{errors-uhP8DZTi.d.ts → errors-CJZuvOcx.d.ts} +0 -7
  19. package/dist/{errors-DCqRnZpN.js → errors-CZf7oz4k.js} +1 -6
  20. package/dist/index.d.ts +7 -11
  21. package/dist/index.js +5 -6
  22. package/dist/{inspect-B72iFyj-.js → inspect-NBCAwsxi.js} +1 -2
  23. package/dist/{object-Da1zyPCR.js → object-CAK6UYR5.js} +1 -2
  24. package/dist/{openworkflow-BhzxV_Y3.d.ts → openworkflow-CdKbUGGa.d.ts} +7 -10
  25. package/dist/{openworkflow-defaults-DDig2M4s.js → openworkflow-defaults-DfQWtSRU.js} +2 -4
  26. package/dist/{openworkflow-storage-Dj9zUAsk.js → openworkflow-storage-Dde_f0es.js} +1 -2
  27. package/dist/openworkflow.js +1 -2
  28. package/dist/{operation-definition-nmRu_O3V.d.ts → operation-definition-CqZkx1Rm.d.ts} +8 -6
  29. package/dist/{operations-D_WJwjrS.js → operations-BBTmDm2H.js} +31 -44
  30. package/dist/operations.d.ts +5 -12
  31. package/dist/operations.js +33 -43
  32. package/dist/{out-DxLKolA0.js → out-r9T3bhTE.js} +2933 -2301
  33. package/dist/{rolldown-runtime-B4iAMlE-.js → rolldown-runtime-DYf_mQCB.js} +2 -3
  34. package/dist/{run-error-DBWqiJHH.js → run-error-8p4BtTMv.js} +5 -8
  35. package/dist/{run-failed-gVGo1BaF.js → run-failed-BcSjSU2t.js} +1 -2
  36. package/dist/runtime/cloudflare-runner.d.ts +14 -6
  37. package/dist/runtime/cloudflare-runner.js +16 -10
  38. package/dist/runtime/cloudflare-shared.d.ts +2 -2
  39. package/dist/runtime/cloudflare-shared.js +1 -2
  40. package/dist/runtime/cloudflare-vite.d.ts +5 -7
  41. package/dist/runtime/cloudflare-vite.js +5 -7
  42. package/dist/runtime/dev-runs.d.ts +1 -3
  43. package/dist/runtime/dev-runs.js +3 -3
  44. package/dist/runtime/execute.d.ts +3 -5
  45. package/dist/runtime/execute.js +66 -35
  46. package/dist/runtime/openworkflow-worker.d.ts +3 -4
  47. package/dist/runtime/openworkflow-worker.js +4 -10
  48. package/dist/runtime/openworkflow.d.ts +2 -2
  49. package/dist/runtime/openworkflow.js +37 -53
  50. package/dist/runtime/state.d.ts +2 -4
  51. package/dist/runtime/state.js +5 -4
  52. package/dist/runtime/vercel-vite.d.ts +3 -6
  53. package/dist/runtime/vercel-vite.js +4 -6
  54. package/dist/signals-BHQdxoJo.js +79 -0
  55. package/dist/{types-Dsmwsdlv.d.ts → types-DvYcvbPG.d.ts} +34 -6
  56. package/dist/{vercel-DTvm61iY.js → vercel-Cw_Z9-j4.js} +5 -14
  57. package/dist/vite.d.ts +12 -29
  58. package/dist/vite.js +4492 -2125
  59. package/package.json +13 -13
  60. package/dist/cloudflare-env-lookup-CfX6wZKb.d.ts +0 -4
@@ -1,8 +1,8 @@
1
- import { n as isRecordOrFunction } from "./object-Da1zyPCR.js";
2
- import { t as internalErrorDiagnostics } from "./error-diagnostics-CQ4BUqRe.js";
1
+ import { n as isRecordOrFunction } from "./object-CAK6UYR5.js";
2
+ import { t as internalErrorDiagnostics } from "./error-diagnostics-kKXseq8d.js";
3
3
  import { toJsonSchema } from "@valibot/to-json-schema";
4
4
  import * as v from "valibot";
5
- //#region ../internal/src/standard-schema.ts
5
+ // ../internal/src/standard-schema.ts
6
6
  function readOwn(value, key) {
7
7
  if (value === null || Object(value) !== value) return;
8
8
  try {
@@ -31,8 +31,7 @@ function standardJsonSchema(schema, direction, target = "draft-2020-12", library
31
31
  return;
32
32
  }
33
33
  }
34
- //#endregion
35
- //#region ../internal/src/valibot.ts
34
+ // ../internal/src/valibot.ts
36
35
  const valibotTargets = /* @__PURE__ */ new Set([
37
36
  "draft-07",
38
37
  "draft-2020-12",
@@ -73,8 +72,7 @@ function withValibotJsonSchema(schema, options = {}) {
73
72
  }
74
73
  };
75
74
  }
76
- //#endregion
77
- //#region ../internal/src/operation-definition.ts
75
+ // ../internal/src/operation-definition.ts
78
76
  const nameFormat = /^[a-z][a-z0-9-]*\.[a-z][a-z0-9-]*$/;
79
77
  const kinds = /* @__PURE__ */ new Set([
80
78
  "read",
@@ -134,16 +132,14 @@ function isSectionId(section) {
134
132
  function operationInputJsonSchema(operation) {
135
133
  return standardJsonSchema(operation.input, "input") ?? { type: "object" };
136
134
  }
137
- //#endregion
138
- //#region ../internal/src/operations.ts
135
+ // ../internal/src/operations.ts
139
136
  /** Align rows of text cells in columns for CLI output. The last column is not padded. */
140
137
  function table(rows) {
141
138
  const widths = rows[0].map((_, column) => Math.max(...rows.map((row) => row[column].length)));
142
139
  return rows.map((row) => row.map((cell, column) => column === row.length - 1 ? cell : cell.padEnd(widths[column])).join(" ")).join("\n");
143
140
  }
144
- //#endregion
145
- //#region src/operations.ts
146
- const runtime = () => import("./operations-D_WJwjrS.js");
141
+ // src/operations.ts
142
+ const runtime = () => import("./operations-BBTmDm2H.js");
147
143
  const name = v.pipe(v.string(), v.check((value) => value.trim() !== "", "Name a Workflow."));
148
144
  const runId = v.pipe(v.string(), v.check((value) => value.trim() !== "", "Pass the id of a run."));
149
145
  const maxRequestBytes = 1048576;
@@ -172,8 +168,12 @@ const start = defineWorkflowOperation({
172
168
  run: async (input) => (await runtime()).runWorkflowOperation("start", input)
173
169
  });
174
170
  const get = defineWorkflowOperation({
175
- cli: { positional: ["runId"] },
176
- description: "Show the status and result of a Workflow run. Pass `workflow` for a run that this runtime did not start.",
171
+ cli: {
172
+ command: "runs get",
173
+ format: formatRun,
174
+ positional: ["runId"]
175
+ },
176
+ description: "Show the status and result of a Workflow run, with its steps when `vite dev` recorded it. Pass `workflow` for a run that this runtime did not start.",
177
177
  input: v.object({
178
178
  runId,
179
179
  workflow: v.optional(name)
@@ -227,6 +227,24 @@ function formatRuns({ runs }) {
227
227
  function json(value) {
228
228
  return JSON.stringify(value ?? null, null, 2);
229
229
  }
230
+ /** The steps of a run that `vite dev` recorded. A run of another runtime has no steps. */
231
+ function stepLines(steps) {
232
+ if (!steps) return [];
233
+ if (!steps.length) return ["Steps: none"];
234
+ return ["Steps:", table([[
235
+ "STEP",
236
+ "STATUS",
237
+ "STARTED AT",
238
+ "COMPLETED AT",
239
+ "ERROR"
240
+ ], ...steps.map((step) => [
241
+ step.name,
242
+ step.status,
243
+ step.startedAt,
244
+ step.completedAt ?? "-",
245
+ step.error?.message ?? "-"
246
+ ])])];
247
+ }
230
248
  function formatRun({ run }) {
231
249
  return [
232
250
  `Run: ${run.id}`,
@@ -237,19 +255,7 @@ function formatRun({ run }) {
237
255
  ...run.startedAt ? [`Started at: ${run.startedAt}`] : [],
238
256
  ...run.completedAt ? [`Completed at: ${run.completedAt}`] : [],
239
257
  ...run.error ? [`Error: ${run.error.code ? `${run.error.code} ` : ""}${run.error.message}`] : [],
240
- ...run.steps.length ? ["Steps:", table([[
241
- "STEP",
242
- "STATUS",
243
- "STARTED AT",
244
- "COMPLETED AT",
245
- "ERROR"
246
- ], ...run.steps.map((step) => [
247
- step.name,
248
- step.status,
249
- step.startedAt,
250
- step.completedAt ?? "-",
251
- step.error?.message ?? "-"
252
- ])])] : ["Steps: none"],
258
+ ...stepLines(run.steps),
253
259
  ...run.status === "completed" ? ["Result:", json(run.result)] : [],
254
260
  ""
255
261
  ].join("\n");
@@ -283,21 +289,6 @@ const workflowOperations = [
283
289
  name: "workflow.runs-list",
284
290
  run: async (input) => (await runtime()).listWorkflowRuns(input)
285
291
  }),
286
- defineWorkflowOperation({
287
- cli: {
288
- command: "runs show",
289
- format: formatRun,
290
- positional: ["id"]
291
- },
292
- description: "Show one Workflow run that `vite dev` recorded, with its steps, status, result, and error.",
293
- input: v.strictObject({
294
- id: runId,
295
- workflow: v.optional(name)
296
- }),
297
- kind: "read",
298
- name: "workflow.runs-show",
299
- run: async (input) => (await runtime()).showWorkflowRun(input)
300
- }),
301
292
  defineWorkflowOperation({
302
293
  cli: {
303
294
  command: "runs clear",
@@ -310,5 +301,4 @@ const workflowOperations = [
310
301
  run: async () => (await runtime()).clearWorkflowRuns()
311
302
  })
312
303
  ];
313
- //#endregion
314
304
  export { workflowOperations };