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.
- package/.oxfmtrc.json +11 -0
- package/.oxlintrc.json +19 -0
- package/LICENSE +21 -0
- package/README.md +248 -0
- package/demo/README.md +73 -0
- package/demo/index.html +13 -0
- package/demo/package.json +33 -0
- package/demo/public/vite.svg +1 -0
- package/demo/src/App.css +0 -0
- package/demo/src/App.tsx +9 -0
- package/demo/src/assets/Cloudflare_Logo.svg +51 -0
- package/demo/src/assets/react.svg +1 -0
- package/demo/src/index.css +1 -0
- package/demo/src/main.tsx +10 -0
- package/demo/tsconfig.app.json +28 -0
- package/demo/tsconfig.json +14 -0
- package/demo/tsconfig.node.json +25 -0
- package/demo/tsconfig.worker.json +13 -0
- package/demo/vite.config.ts +9 -0
- package/demo/worker/index.ts +16 -0
- package/demo/worker-configuration.d.ts +12851 -0
- package/demo/wrangler.jsonc +32 -0
- package/package.json +35 -0
- package/scripts/build.ts +29 -0
- package/src/brand.ts +2 -0
- package/src/definition.ts +413 -0
- package/src/index.ts +2 -0
- package/src/json.ts +14 -0
- package/src/migrations/0000_initial.ts +559 -0
- package/src/node-async-hooks.d.ts +16 -0
- package/src/runtime.ts +1705 -0
- package/test/env.d.ts +12 -0
- package/test/runtime.spec.ts +2837 -0
- package/test/tsconfig.json +11 -0
- package/test/worker.ts +21 -0
- package/tsconfig.json +23 -0
- package/turbo.json +18 -0
- package/vitest.config.mts +28 -0
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
|
+
});
|