(stub: MyAppDO, title: string, content: string)
| 34 | |
| 35 | // Effect-based UserDO operations |
| 36 | function createPostEffect(stub: MyAppDO, title: string, content: string) { |
| 37 | return Effect.tryPromise({ |
| 38 | try: () => stub.createPost(title, content), |
| 39 | catch: (error: unknown) => new Error(`Failed to create post: ${error}`) |
| 40 | }); |
| 41 | } |
| 42 | |
| 43 | function listPostsEffect(stub: MyAppDO) { |
| 44 | return Effect.tryPromise({ |