workerflow 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.
@@ -0,0 +1,11 @@
1
+ {
2
+ "extends": "../tsconfig.json",
3
+ "compilerOptions": {
4
+ "types": [
5
+ "@cloudflare/vitest-pool-workers",
6
+ "@cloudflare/workers-types/experimental"
7
+ ]
8
+ },
9
+ "include": ["./**/*.ts"],
10
+ "exclude": []
11
+ }
package/test/worker.ts ADDED
@@ -0,0 +1,21 @@
1
+ import { WorkflowDefinition } from "../src/definition";
2
+ import { WorkflowRuntime } from "../src/runtime";
3
+
4
+ export type Env = {
5
+ TEST_WORKFLOW_RUNTIME: DurableObjectNamespace<TestWorkflowRuntime>;
6
+ };
7
+
8
+ export class TestWorkflowRuntime extends WorkflowRuntime {
9
+ protected getDefinition() {
10
+ return this.ctx.exports.TestWorkflowDefinition;
11
+ }
12
+ }
13
+ export class TestWorkflowDefinition extends WorkflowDefinition {
14
+ async execute(): Promise<void> {}
15
+ }
16
+
17
+ export default {
18
+ fetch() {
19
+ return new Response(null);
20
+ }
21
+ } satisfies ExportedHandler;
package/tsconfig.json ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "compilerOptions": {
3
+ "noEmit": true,
4
+ "strict": true,
5
+ "skipLibCheck": true,
6
+ "target": "es2024",
7
+ "module": "esnext",
8
+ "moduleResolution": "bundler",
9
+ "esModuleInterop": true,
10
+ "stripInternal": true,
11
+ "allowUnreachableCode": false,
12
+ "allowUnusedLabels": false,
13
+ "forceConsistentCasingInFileNames": true,
14
+ "noImplicitReturns": true,
15
+ "verbatimModuleSyntax": true,
16
+ "noUncheckedIndexedAccess": true,
17
+ "noUnusedLocals": true,
18
+ "noUnusedParameters": true,
19
+ "types": ["@cloudflare/workers-types/experimental"]
20
+ },
21
+ "include": ["src/**/*", "vitest.config.mts"],
22
+ "exclude": ["node_modules", "dist", "**/tests", "**/*.test.ts"]
23
+ }
package/turbo.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "$schema": "https://turborepo.com/schema.json",
3
+ "ui": "tui",
4
+ "tasks": {
5
+ "build": {
6
+ "dependsOn": ["^build"],
7
+ "inputs": ["$TURBO_DEFAULT$", ".env*"],
8
+ "outputs": ["dist/**", "src/generated/**", ".next/**", "!.next/cache/**"]
9
+ },
10
+ "dev": {
11
+ "cache": false,
12
+ "persistent": true
13
+ },
14
+ "compose:up": { "cache": false },
15
+ "compose:down": { "cache": false },
16
+ "compose:reset": { "cache": false }
17
+ }
18
+ }
@@ -0,0 +1,28 @@
1
+ import { cloudflareTest } from "@cloudflare/vitest-pool-workers";
2
+ import { defineConfig } from "vitest/config";
3
+
4
+ export default defineConfig({
5
+ plugins: [
6
+ cloudflareTest({
7
+ main: "test/worker.ts",
8
+ miniflare: {
9
+ compatibilityDate: "2026-01-28",
10
+ compatibilityFlags: [
11
+ "nodejs_compat",
12
+ "enable_nodejs_tty_module",
13
+ "enable_nodejs_fs_module",
14
+ "enable_nodejs_http_modules",
15
+ "enable_nodejs_perf_hooks_module",
16
+ "enable_nodejs_v8_module",
17
+ "enable_nodejs_process_v2"
18
+ ],
19
+ durableObjects: {
20
+ TEST_WORKFLOW_RUNTIME: {
21
+ className: "TestWorkflowRuntime",
22
+ useSQLite: true
23
+ }
24
+ }
25
+ }
26
+ })
27
+ ]
28
+ });