@vite-hub/workflow 0.0.4 → 0.1.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 +34 -14
- package/dist/{_app-DgwN4ulW.d.ts → app-BojnC_yf.d.ts} +1 -4
- package/dist/{app-BZpq2cwC.js → app-CzPoP84f.js} +2 -1
- package/dist/client-DsGM3M4U.js +389 -0
- package/dist/cloudflare-env-BNrYo29x.js +113 -0
- package/dist/{cloudflare-D0Di-QYL.js → cloudflare-nF4abPd4.js} +20 -4
- package/dist/cloudflare-shared-CaxrMD1A.d.ts +1 -0
- package/dist/{cloudflare-vite-BkDgB6Sr.js → cloudflare-vite-B3IabBsv.js} +5 -4
- package/dist/{config-BHknO_rT.js → config-IJMb0eeZ.js} +38 -30
- package/dist/error-diagnostics-A_8Kp-48.js +116 -0
- package/dist/error-diagnostics-pwNFvAHP.js +67 -0
- package/dist/index.d.ts +20 -21
- package/dist/index.js +25 -369
- package/dist/inspect-B72iFyj-.js +70 -0
- package/dist/operations-B_rYG71W.js +230 -0
- package/dist/operations-tNUdj3G4.d.ts +212 -0
- package/dist/operations.d.ts +37 -0
- package/dist/operations.js +887 -0
- package/dist/out-CsaJxg8m.js +21755 -0
- package/dist/rolldown-runtime-CMFfr-1z.js +26 -0
- package/dist/runtime/cloudflare-runner.d.ts +5 -15
- package/dist/runtime/cloudflare-runner.js +40 -5
- package/dist/runtime/cloudflare-shared.d.ts +1 -0
- package/dist/runtime/cloudflare-shared.js +1 -1
- package/dist/runtime/cloudflare-vite.d.ts +8 -10
- package/dist/runtime/cloudflare-vite.js +1 -1
- package/dist/runtime/execute.d.ts +8 -7
- package/dist/runtime/execute.js +28 -5
- package/dist/runtime/openworkflow-worker.d.ts +6 -8
- package/dist/runtime/openworkflow-worker.js +5 -4
- package/dist/runtime/openworkflow.d.ts +8 -10
- package/dist/runtime/openworkflow.js +23 -17
- package/dist/runtime/state.d.ts +20 -21
- package/dist/runtime/state.js +90 -20
- package/dist/runtime/vercel-vite.d.ts +10 -12
- package/dist/runtime/vercel-vite.js +2 -2
- package/dist/runtime-type-DBCvIh5x.js +7 -0
- package/dist/{types-B9RdRkKh.d.ts → types-D82WmfZa.d.ts} +23 -12
- package/dist/{vercel-B0MuIVgJ.js → vercel-D-ZNtB_u.js} +34 -9
- package/dist/vite.d.ts +325 -11
- package/dist/vite.js +1267 -691
- package/package.json +79 -29
- package/dist/cloudflare-env-DjxQNbrx.js +0 -58
- package/dist/cloudflare-shared-BVVgDSdq.d.ts +0 -1
- package/dist/runtime-type-DGUn8Ple.js +0 -37
package/package.json
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vite-hub/workflow",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "Workflow primitives and Vite integration for ViteHub.",
|
|
5
5
|
"keywords": [
|
|
6
|
+
"background-jobs",
|
|
6
7
|
"cloudflare",
|
|
7
8
|
"docker",
|
|
9
|
+
"durable-execution",
|
|
8
10
|
"openworkflow",
|
|
11
|
+
"typescript",
|
|
9
12
|
"vercel",
|
|
10
13
|
"vite",
|
|
11
14
|
"vitehub",
|
|
12
15
|
"workflow"
|
|
13
16
|
],
|
|
14
|
-
"homepage": "https://
|
|
17
|
+
"homepage": "https://vitehub.dev",
|
|
15
18
|
"bugs": "https://github.com/vite-hub/vitehub/issues",
|
|
16
19
|
"license": "Apache-2.0",
|
|
17
20
|
"author": "onmax <maximogarciamtnez@gmail.com>",
|
|
@@ -28,42 +31,89 @@
|
|
|
28
31
|
"sideEffects": false,
|
|
29
32
|
"types": "./dist/index.d.ts",
|
|
30
33
|
"exports": {
|
|
31
|
-
".":
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
"./
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
34
|
+
".": {
|
|
35
|
+
"types": "./dist/index.d.ts",
|
|
36
|
+
"import": "./dist/index.js",
|
|
37
|
+
"default": "./dist/index.js"
|
|
38
|
+
},
|
|
39
|
+
"./operations": {
|
|
40
|
+
"types": "./dist/operations.d.ts",
|
|
41
|
+
"import": "./dist/operations.js",
|
|
42
|
+
"default": "./dist/operations.js"
|
|
43
|
+
},
|
|
44
|
+
"./runtime/cloudflare-runner": {
|
|
45
|
+
"types": "./dist/runtime/cloudflare-runner.d.ts",
|
|
46
|
+
"import": "./dist/runtime/cloudflare-runner.js",
|
|
47
|
+
"default": "./dist/runtime/cloudflare-runner.js"
|
|
48
|
+
},
|
|
49
|
+
"./runtime/cloudflare-shared": {
|
|
50
|
+
"types": "./dist/runtime/cloudflare-shared.d.ts",
|
|
51
|
+
"import": "./dist/runtime/cloudflare-shared.js",
|
|
52
|
+
"default": "./dist/runtime/cloudflare-shared.js"
|
|
53
|
+
},
|
|
54
|
+
"./runtime/cloudflare-vite": {
|
|
55
|
+
"types": "./dist/runtime/cloudflare-vite.d.ts",
|
|
56
|
+
"import": "./dist/runtime/cloudflare-vite.js",
|
|
57
|
+
"default": "./dist/runtime/cloudflare-vite.js"
|
|
58
|
+
},
|
|
59
|
+
"./runtime/execute": {
|
|
60
|
+
"types": "./dist/runtime/execute.d.ts",
|
|
61
|
+
"import": "./dist/runtime/execute.js",
|
|
62
|
+
"default": "./dist/runtime/execute.js"
|
|
63
|
+
},
|
|
64
|
+
"./runtime/openworkflow": {
|
|
65
|
+
"types": "./dist/runtime/openworkflow.d.ts",
|
|
66
|
+
"import": "./dist/runtime/openworkflow.js",
|
|
67
|
+
"default": "./dist/runtime/openworkflow.js"
|
|
68
|
+
},
|
|
69
|
+
"./runtime/openworkflow-worker": {
|
|
70
|
+
"types": "./dist/runtime/openworkflow-worker.d.ts",
|
|
71
|
+
"import": "./dist/runtime/openworkflow-worker.js",
|
|
72
|
+
"default": "./dist/runtime/openworkflow-worker.js"
|
|
73
|
+
},
|
|
74
|
+
"./runtime/state": {
|
|
75
|
+
"types": "./dist/runtime/state.d.ts",
|
|
76
|
+
"import": "./dist/runtime/state.js",
|
|
77
|
+
"default": "./dist/runtime/state.js"
|
|
78
|
+
},
|
|
79
|
+
"./runtime/vercel-vite": {
|
|
80
|
+
"types": "./dist/runtime/vercel-vite.d.ts",
|
|
81
|
+
"import": "./dist/runtime/vercel-vite.js",
|
|
82
|
+
"default": "./dist/runtime/vercel-vite.js"
|
|
83
|
+
},
|
|
84
|
+
"./vite": {
|
|
85
|
+
"types": "./dist/vite.d.ts",
|
|
86
|
+
"import": "./dist/vite.js",
|
|
87
|
+
"default": "./dist/vite.js"
|
|
88
|
+
},
|
|
41
89
|
"./package.json": "./package.json"
|
|
42
90
|
},
|
|
43
91
|
"dependencies": {
|
|
44
|
-
"@vercel/functions": "^3.
|
|
45
|
-
"@vite-hub/runtime": "0.0
|
|
92
|
+
"@vercel/functions": "^3.9.11",
|
|
93
|
+
"@vite-hub/runtime": "0.1.0",
|
|
46
94
|
"defu": "^6.1.7",
|
|
47
|
-
"esbuild": "^0.28.
|
|
48
|
-
"h3": "2.0.1-rc.
|
|
49
|
-
"
|
|
95
|
+
"esbuild": "^0.28.2",
|
|
96
|
+
"h3": "2.0.1-rc.33",
|
|
97
|
+
"nostics": "1.3.0",
|
|
98
|
+
"pathe": "^2.0.3",
|
|
99
|
+
"valibot": "^1.5.0"
|
|
50
100
|
},
|
|
51
101
|
"devDependencies": {
|
|
52
|
-
"@types/node": "^24.
|
|
53
|
-
"openworkflow": "^0.9.
|
|
54
|
-
"publint": "^0.3.
|
|
102
|
+
"@types/node": "^24.19.1",
|
|
103
|
+
"openworkflow": "^0.9.2",
|
|
104
|
+
"publint": "^0.3.25",
|
|
55
105
|
"typescript": "^6.0.3",
|
|
56
|
-
"vite": "^8.
|
|
57
|
-
"vite-plus": "^0.
|
|
58
|
-
"vitest": "^4.1.
|
|
106
|
+
"vite": "^8.2.2",
|
|
107
|
+
"vite-plus": "^0.3.3",
|
|
108
|
+
"vitest": "^4.1.11",
|
|
59
109
|
"@vite-hub/internal": "0.0.1"
|
|
60
110
|
},
|
|
61
111
|
"peerDependencies": {
|
|
62
|
-
"@vite-hub/database": "0.0
|
|
63
|
-
"@workflow/builders": "5.0.
|
|
64
|
-
"openworkflow": "^0.9.
|
|
112
|
+
"@vite-hub/database": "0.1.0",
|
|
113
|
+
"@workflow/builders": "5.0.1",
|
|
114
|
+
"openworkflow": "^0.9.2",
|
|
65
115
|
"vite": ">=8.0.0",
|
|
66
|
-
"workflow": "5.0.
|
|
116
|
+
"workflow": "5.0.1"
|
|
67
117
|
},
|
|
68
118
|
"peerDependenciesMeta": {
|
|
69
119
|
"@vite-hub/database": {
|
|
@@ -88,7 +138,7 @@
|
|
|
88
138
|
"scripts": {
|
|
89
139
|
"build": "vp pack",
|
|
90
140
|
"dev": "vp pack --watch",
|
|
91
|
-
"typecheck": "
|
|
92
|
-
"test": "vp run -t @vite-hub/workflow#build && vp test"
|
|
141
|
+
"typecheck": "vp run --cache -t @vite-hub/workflow#build && node ../../test/package-typecheck.mjs --noEmit -p ./tsconfig.json",
|
|
142
|
+
"test": "vp run -t @vite-hub/workflow#build && vp run -t @vite-hub/agent#build && vp test"
|
|
93
143
|
}
|
|
94
144
|
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { AsyncLocalStorage } from "node:async_hooks";
|
|
2
|
-
//#region ../internal/src/runtime/cloudflare-env.ts
|
|
3
|
-
let activeEnv;
|
|
4
|
-
const activeEnvStorageKey = Symbol.for("vitehub.cloudflare.env-storage");
|
|
5
|
-
const runtimeGlobal = globalThis;
|
|
6
|
-
const activeEnvStorage = runtimeGlobal[activeEnvStorageKey] ||= new AsyncLocalStorage();
|
|
7
|
-
function setActiveCloudflareEnv(env) {
|
|
8
|
-
activeEnv = env;
|
|
9
|
-
globalThis.__env__ = env;
|
|
10
|
-
try {
|
|
11
|
-
activeEnvStorage.enterWith({ env });
|
|
12
|
-
} catch {}
|
|
13
|
-
}
|
|
14
|
-
function runWithActiveCloudflareEnv(env, callback) {
|
|
15
|
-
return activeEnvStorage.run({ env }, callback);
|
|
16
|
-
}
|
|
17
|
-
function getActiveCloudflareEnv() {
|
|
18
|
-
const scoped = activeEnvStorage.getStore();
|
|
19
|
-
return scoped ? scoped.env : activeEnv ?? globalThis.__env__;
|
|
20
|
-
}
|
|
21
|
-
function getCloudflareEnv(event) {
|
|
22
|
-
const target = event;
|
|
23
|
-
return target?.env || target?.context?.cloudflare?.env || target?.context?._platform?.cloudflare?.env || target?.req?.runtime?.cloudflare?.env || target?.node?.req?.runtime?.cloudflare?.env || getActiveCloudflareEnv();
|
|
24
|
-
}
|
|
25
|
-
function resolveWaitUntil(event) {
|
|
26
|
-
const target = event;
|
|
27
|
-
const owners = [
|
|
28
|
-
target,
|
|
29
|
-
target?.context,
|
|
30
|
-
target?.context?.cloudflare,
|
|
31
|
-
target?.context?.cloudflare?.context,
|
|
32
|
-
target?.context?._platform?.cloudflare,
|
|
33
|
-
target?.context?._platform?.cloudflare?.context,
|
|
34
|
-
target?.req,
|
|
35
|
-
target?.req?.runtime?.cloudflare,
|
|
36
|
-
target?.req?.runtime?.cloudflare?.context,
|
|
37
|
-
target?.node?.req,
|
|
38
|
-
target?.node?.req?.runtime?.cloudflare,
|
|
39
|
-
target?.node?.req?.runtime?.cloudflare?.context
|
|
40
|
-
];
|
|
41
|
-
for (const owner of owners) if (typeof owner?.waitUntil === "function") return owner.waitUntil.bind(owner);
|
|
42
|
-
}
|
|
43
|
-
function createCloudflareRuntimeEvent(env, context) {
|
|
44
|
-
const waitUntil = typeof context?.waitUntil === "function" ? context.waitUntil.bind(context) : void 0;
|
|
45
|
-
return {
|
|
46
|
-
context: {
|
|
47
|
-
cloudflare: {
|
|
48
|
-
env,
|
|
49
|
-
context
|
|
50
|
-
},
|
|
51
|
-
waitUntil
|
|
52
|
-
},
|
|
53
|
-
env,
|
|
54
|
-
waitUntil
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
//#endregion
|
|
58
|
-
export { setActiveCloudflareEnv as a, runWithActiveCloudflareEnv as i, getCloudflareEnv as n, resolveWaitUntil as r, createCloudflareRuntimeEvent as t };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { };
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
//#region src/internal/runtime-type.ts
|
|
2
|
-
function isCallableRepresentation(value) {
|
|
3
|
-
if (value === null || value === void 0 || Object(value) !== value) return false;
|
|
4
|
-
try {
|
|
5
|
-
Function.prototype.toString.call(value);
|
|
6
|
-
return true;
|
|
7
|
-
} catch {
|
|
8
|
-
return false;
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
/** Parses JavaScript runtime representation categories at Workflow boundaries. */
|
|
12
|
-
function hasRuntimeType(value, expected) {
|
|
13
|
-
if (expected === "undefined") return value === void 0;
|
|
14
|
-
if (expected === "object" && value === null) return true;
|
|
15
|
-
if (value === null || value === void 0) return false;
|
|
16
|
-
const isPrimitive = Object(value) !== value;
|
|
17
|
-
if (!isPrimitive) {
|
|
18
|
-
if (expected === "function") return isCallableRepresentation(value);
|
|
19
|
-
return expected === "object" && !isCallableRepresentation(value);
|
|
20
|
-
}
|
|
21
|
-
const tag = Object.prototype.toString.call(value);
|
|
22
|
-
switch (expected) {
|
|
23
|
-
case "bigint": return isPrimitive && tag === "[object BigInt]";
|
|
24
|
-
case "boolean": return isPrimitive && tag === "[object Boolean]";
|
|
25
|
-
case "function": return false;
|
|
26
|
-
case "number": return isPrimitive && tag === "[object Number]";
|
|
27
|
-
case "object": return false;
|
|
28
|
-
case "string": return isPrimitive && tag === "[object String]";
|
|
29
|
-
case "symbol": return isPrimitive && tag === "[object Symbol]";
|
|
30
|
-
}
|
|
31
|
-
throw new TypeError(`Unsupported runtime type: ${expected}`);
|
|
32
|
-
}
|
|
33
|
-
function isRuntimeRecord(value) {
|
|
34
|
-
return value !== null && hasRuntimeType(value, "object") && !Array.isArray(value);
|
|
35
|
-
}
|
|
36
|
-
//#endregion
|
|
37
|
-
export { isRuntimeRecord as n, hasRuntimeType as t };
|