@vite-hub/workflow 0.6.1 → 0.8.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 +33 -9
- package/dist/{app-DXUHElAz.js → app-Cpa9qCXr.js} +1 -1
- package/dist/{client-CbBg4HlH.js → client-T41cNf3k.js} +41 -52
- package/dist/cloudflare-concurrency-counter-CDHHiMfn.js +136 -0
- package/dist/{config-CizNRTMi.js → config-G0z9jHLM.js} +6 -6
- package/dist/definition.d.ts +1 -1
- package/dist/definition.js +4 -1
- package/dist/{delay-CtT3442d.js → delay-B4azP18B.js} +7 -5
- package/dist/durability.d.ts +3 -1
- package/dist/durability.js +7 -1
- package/dist/{error-diagnostics--2cV_ER1.js → error-diagnostics-35AEmfve.js} +25 -5
- package/dist/{error-diagnostics-kKXseq8d.js → error-diagnostics-CsiNo_oI.js} +3 -3
- package/dist/{errors-CJZuvOcx.d.ts → errors-DwKy5MQ8.d.ts} +1 -1
- package/dist/execute-zu08sWGG.js +353 -0
- package/dist/index.d.ts +12 -10
- package/dist/index.js +3 -3
- package/dist/{openworkflow-defaults-DfQWtSRU.js → invariant-Dj2R1eMr.js} +1 -4
- package/dist/{openworkflow-CdKbUGGa.d.ts → openworkflow-DHuxMJQB.d.ts} +23 -4
- package/dist/openworkflow-defaults-1n0DbLdb.js +4 -0
- package/dist/openworkflow-zD8luED5.js +749 -0
- package/dist/{operation-definition-CqZkx1Rm.d.ts → operations-Blwi3jQF.d.ts} +1 -0
- package/dist/{operations-BBTmDm2H.js → operations-C2XbDDDV.js} +71 -15
- package/dist/operations.d.ts +3 -59
- package/dist/operations.js +5 -5
- package/dist/results-DqbEUMCH.d.ts +60 -0
- package/dist/{run-error-8p4BtTMv.js → run-error-zZh1_IBo.js} +5 -21
- package/dist/runtime/cloudflare-concurrency.d.ts +21 -0
- package/dist/runtime/cloudflare-concurrency.js +21 -0
- package/dist/runtime/cloudflare-runner.d.ts +1 -1
- package/dist/runtime/cloudflare-runner.js +7 -3
- package/dist/runtime/cloudflare-vite.d.ts +1 -1
- package/dist/runtime/cloudflare-vite.js +2 -2
- package/dist/runtime/execute.d.ts +8 -2
- package/dist/runtime/execute.js +1 -278
- package/dist/runtime/openworkflow-worker.d.ts +2 -2
- package/dist/runtime/openworkflow-worker.js +5 -6
- package/dist/runtime/openworkflow.d.ts +2 -2
- package/dist/runtime/openworkflow.js +1 -481
- package/dist/runtime/state.d.ts +1 -1
- package/dist/runtime/state.js +2 -2
- package/dist/runtime/vercel-vite.d.ts +1 -1
- package/dist/runtime/vercel-vite.js +2 -2
- package/dist/{signals-BHQdxoJo.js → signals-CdaxRNjN.js} +1 -1
- package/dist/{types-DvYcvbPG.d.ts → types-DrhUXMsE.d.ts} +34 -4
- package/dist/{vercel-Cw_Z9-j4.js → vercel-DRezYOUp.js} +8 -6
- package/dist/vite.d.ts +19 -4
- package/dist/vite.js +970 -212
- package/package.json +3 -3
- package/dist/cloudflare-Sgywkm1N.js +0 -57
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vite-hub/workflow",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "Workflow primitives and Vite integration for ViteHub.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"background-jobs",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
67
|
"@valibot/to-json-schema": "^1.8.0",
|
|
68
|
-
"@vite-hub/runtime": "0.
|
|
68
|
+
"@vite-hub/runtime": "0.8.0",
|
|
69
69
|
"defu": "^6.1.7",
|
|
70
70
|
"esbuild": "^0.28.2",
|
|
71
71
|
"h3": "^2.0.8",
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
},
|
|
89
89
|
"peerDependencies": {
|
|
90
90
|
"@vercel/functions": "^3.11.3",
|
|
91
|
-
"@vite-hub/database": "0.
|
|
91
|
+
"@vite-hub/database": "0.8.0",
|
|
92
92
|
"@workflow/builders": "^5.1.4",
|
|
93
93
|
"vite": ">=8.0.0",
|
|
94
94
|
"workflow": "^5.7.1"
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { t as workflowErrorDiagnostics } from "./error-diagnostics--2cV_ER1.js";
|
|
2
|
-
// ../internal/src/integrations/hex.ts
|
|
3
|
-
const textEncoder = new TextEncoder();
|
|
4
|
-
new TextDecoder();
|
|
5
|
-
function encodeNameHex(name) {
|
|
6
|
-
return [...textEncoder.encode(name)].map((byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
7
|
-
}
|
|
8
|
-
// src/integrations/cloudflare.ts
|
|
9
|
-
const cloudflareWorkflowNameMaxLength = 64;
|
|
10
|
-
function shortHash(value) {
|
|
11
|
-
let hash = 14695981039346656037n;
|
|
12
|
-
for (const char of value) {
|
|
13
|
-
hash ^= BigInt(char.codePointAt(0) || 0);
|
|
14
|
-
hash = BigInt.asUintN(64, hash * 1099511628211n);
|
|
15
|
-
}
|
|
16
|
-
return hash.toString(16).padStart(16, "0");
|
|
17
|
-
}
|
|
18
|
-
function legacyShortHash(value) {
|
|
19
|
-
let hash = 2166136261;
|
|
20
|
-
for (const char of value) {
|
|
21
|
-
hash ^= char.codePointAt(0) || 0;
|
|
22
|
-
hash = Math.imul(hash, 16777619);
|
|
23
|
-
}
|
|
24
|
-
return (hash >>> 0).toString(16).padStart(8, "0");
|
|
25
|
-
}
|
|
26
|
-
function workflowClassPrefix(name) {
|
|
27
|
-
return name.split(/[^a-z0-9]+/i).filter(Boolean).map((segment) => `${segment.charAt(0).toUpperCase()}${segment.slice(1)}`).join("") || "Default";
|
|
28
|
-
}
|
|
29
|
-
function getCloudflareWorkflowBindingName(name) {
|
|
30
|
-
return `WORKFLOW_${encodeNameHex(name).toUpperCase()}`;
|
|
31
|
-
}
|
|
32
|
-
function getCloudflareWorkflowName(name) {
|
|
33
|
-
const encoded = encodeNameHex(name);
|
|
34
|
-
const fullName = `workflow--${encoded}`;
|
|
35
|
-
if (fullName.length <= cloudflareWorkflowNameMaxLength) return fullName;
|
|
36
|
-
const hash = shortHash(name);
|
|
37
|
-
const prefixLength = 53 - hash.length;
|
|
38
|
-
return `workflow--${encoded.slice(0, prefixLength)}-${hash}`;
|
|
39
|
-
}
|
|
40
|
-
function getCloudflareWorkflowClassName(name) {
|
|
41
|
-
return `ViteHub${workflowClassPrefix(name)}${shortHash(name)}Workflow`;
|
|
42
|
-
}
|
|
43
|
-
/** The pre-64-bit class export kept for existing Cloudflare Workflow instances. */
|
|
44
|
-
function getLegacyCloudflareWorkflowClassName(name) {
|
|
45
|
-
return `ViteHub${workflowClassPrefix(name)}${legacyShortHash(name)}Workflow`;
|
|
46
|
-
}
|
|
47
|
-
function createCloudflareWorkflowBindings(definitions, options) {
|
|
48
|
-
if (!definitions.length) return;
|
|
49
|
-
const configurable = definitions.filter((definition) => definition.source !== "agent-workflow-recovery");
|
|
50
|
-
if (configurable.length > 1 && options && (options.binding || options.name)) throw workflowErrorDiagnostics.WORKFLOW_R0001({ message: "Cloudflare workflow binding and name overrides are only supported when one workflow is discovered." });
|
|
51
|
-
return definitions.map((definition) => ({
|
|
52
|
-
binding: configurable.length === 1 && configurable[0] === definition && options ? options.binding || getCloudflareWorkflowBindingName(definition.name) : getCloudflareWorkflowBindingName(definition.name),
|
|
53
|
-
class_name: getCloudflareWorkflowClassName(definition.name),
|
|
54
|
-
name: configurable.length === 1 && configurable[0] === definition && options ? options.name || getCloudflareWorkflowName(definition.name) : getCloudflareWorkflowName(definition.name)
|
|
55
|
-
}));
|
|
56
|
-
}
|
|
57
|
-
export { encodeNameHex as a, getLegacyCloudflareWorkflowClassName as i, getCloudflareWorkflowBindingName as n, getCloudflareWorkflowClassName as r, createCloudflareWorkflowBindings as t };
|