Data Flow: Configuration → C++ → JavaScript
workerd.capnp config → server.c++ (parsing) → WorkerdApi::Global → createBindingValue() → v8::Object (env)
| import { describe, expect, it } from "vitest"; | |
| import { AsyncResult, Result } from "./result"; | |
| describe("Ok", () => { | |
| it("isOk returns true", () => { | |
| expect(Result.ok(1).isOk()).toBe(true); | |
| }); | |
| it("isErr returns false", () => { | |
| expect(Result.ok(1).isErr()).toBe(false); |
| /** | |
| * Mixin factory for discriminated error classes with typed props. | |
| * | |
| * Props become readonly fields; `message`/`cause` auto-wire to Error; `cause.stack` chains. | |
| * | |
| * @see [TypeScript Mixins](https://www.typescriptlang.org/docs/handbook/mixins.html) | |
| * @typeParam Tag - Literal string for `_tag` discriminant | |
| * @returns Base class to extend with optional generic props | |
| * | |
| * @example |
| import { describe, expect, it } from "vitest"; | |
| import { Result } from "./result"; | |
| describe("Ok", () => { | |
| it("isOk returns true", () => { | |
| expect(Result.ok(1).isOk()).toBe(true); | |
| }); | |
| it("isErr returns false", () => { | |
| expect(Result.ok(1).isErr()).toBe(false); |
A complete guide to durable workflow execution with Effect
A complete guide to reactive state management with Effect
| /** | |
| * Utility functions for creating `PromiseSettledResult` instances. | |
| * | |
| * Provides methods to construct fulfilled and rejected promise results, | |
| * ensuring they resolve asynchronously. | |
| */ | |
| const PromiseSettledResult = { | |
| /** | |
| * Creates a fulfilled `PromiseSettledResult`. | |
| * |
| import { Effect, Layer, Stream } from "effect"; | |
| import { handleOntraportCreateContact } from "./handle-ontraport-create-contact"; | |
| import { handleProccesMetricsUpload } from "./handle-process-metrics-upload"; | |
| import { handleSendVerificationEmail } from "./handle-send-verification-email"; | |
| import { Message } from "./message"; | |
| import { Postgres } from "./postgres"; | |
| import { RetryPolicy } from "./retry-policy"; | |
| import { flatten } from "flat"; | |
| export type JobStatus = "new" | "locked" | "completed" | "error"; |
| import { Schedule } from 'effect'; | |
| import type { Duration, DurationInput } from 'effect/Duration'; | |
| /** | |
| * Configuration options for exponential backoff retry strategy | |
| * | |
| * Defines the parameters for configuring a retry mechanism with exponential backoff | |
| * | |
| * @property {DurationInput} delay - Initial delay between retry attempts. Defaults to 100ms. | |
| * @property {number} [growthFactor=2.0] - Factor by which the delay increases exponentially. |
| /** | |
| * Utility functions for creating `PromiseSettledResult` instances. | |
| * | |
| * Provides methods to construct fulfilled and rejected promise results, | |
| * ensuring they resolve asynchronously. | |
| */ | |
| const PromiseSettledResult = { | |
| /** | |
| * Creates a fulfilled `PromiseSettledResult`. | |
| * |