### String.padStart Examples Source: https://effect-ts.github.io/effect/effect/String.ts.html Pads the current string with another string (repeated, if needed) until the resulting string reaches the given length. The padding is applied from the start of the current string. ```typescript import * as assert from "node:assert" import { pipe, String } from "effect" assert.deepStrictEqual(pipe("a", String.padStart(5)), " a") assert.deepStrictEqual(pipe("a", String.padStart(5, "_")), "____a") ``` -------------------------------- ### Stream onStart Example Source: https://effect-ts.github.io/effect/effect/Stream.ts.html Adds an effect to be executed when the stream starts. This can be used for initialization or logging at the beginning of stream processing. ```typescript import { Console, Effect, Stream } from "effect" const stream = Stream.make(1, 2, 3).pipe( Stream.onStart(Console.log("Stream started")), Stream.map((n) => n * 2), Stream.tap((n) => Console.log(`after mapping: ${n}`)) ) Effect.runPromise(Stream.runCollect(stream)).then(console.log) // Stream started // after mapping: 2 // after mapping: 4 // after mapping: 6 // { _id: 'Chunk', values: [ 2, 4, 6 ] } ``` -------------------------------- ### Column Layout Example Source: https://effect-ts.github.io/effect/printer/Doc.ts.html Demonstrates how to use the `column` combinator to lay out documents based on their starting column position. It's useful for creating dynamic layouts where content alignment depends on the current column. ```typescript import * as assert from "node:assert" import * as Doc from "@effect/printer/Doc" import * as String from "effect/String" // Example 1: const example1 = Doc.column((l) => Doc.hsep([Doc.text("Columns are"), Doc.text(`${l}-based`)])) assert.strictEqual(Doc.render(example1, { style: "pretty" }), "Columns are 0-based") // Example 2: const doc = Doc.hsep([Doc.text("prefix"), Doc.column((l) => Doc.text(`| <- column ${l}`))]) const example2 = Doc.vsep([0, 4, 8].map((n) => Doc.indent(n)(doc))) assert.strictEqual( Doc.render(example2, { style: "pretty" }), String.stripMargin( `|prefix | <- column 7 | prefix | <- column 11 | prefix | <- column 15` ) ) ``` -------------------------------- ### Micro.Do Source: https://effect-ts.github.io/effect/effect/Micro.ts.html Start a do notation block. ```APIDOC ## Micro.Do ### Description Initiates a do-notation block for composing Micro effects. ### Signature ```typescript declare const Do: Micro<{}, never, never> ``` ``` -------------------------------- ### get Source: https://effect-ts.github.io/effect/platform/HttpClientRequest.ts.html Constructor for an HTTP GET request. ```APIDOC ## get ### Description Constructor for an HTTP GET request. ### Signature ```typescript declare const get: (url: string | URL, options?: Options.NoBody) => HttpClientRequest ``` ``` -------------------------------- ### reasoningStartPart Source: https://effect-ts.github.io/effect/ai/ai/Response.ts.html Constructs a new reasoning start part. ```APIDOC ## reasoningStartPart ### Description Constructs a new reasoning start part. ### Signature ```typescript declare const reasoningStartPart: (params: ConstructorParams) => ReasoningStartPart ``` ``` -------------------------------- ### Get the start time of the earliest interval Source: https://effect-ts.github.io/effect/effect/ScheduleIntervals.ts.html The `start` getter returns the start time of the earliest interval within an `Intervals` collection. This helps in identifying the beginning of the overall interval span. ```typescript declare const start: (self: Intervals) => number ``` -------------------------------- ### make Source: https://effect-ts.github.io/effect/platform-bun/BunHttpServer.ts.html Creates an HTTP server instance. It takes ServeOptions which can include Bun.ServeOptions or specific Bun server options, and an optional routes object for defining request handlers. ```APIDOC ## make ### Description Creates an HTTP server instance. It takes ServeOptions which can include Bun.ServeOptions or specific Bun server options, and an optional routes object for defining request handlers. ### Signature ```typescript declare const make: > } = {}>(options: ServeOptions) => Effect.Effect ``` ### Parameters #### Request Body - **options** (ServeOptions) - Required - Options for configuring the HTTP server, including Bun.ServeOptions and custom routes. ``` -------------------------------- ### Get the start of a DateTime part Source: https://effect-ts.github.io/effect/effect/DateTime.ts.html Converts a DateTime to the start of a specified part (e.g., 'day'). Optionally, `weekStartsOn` can be configured for 'week' parts. ```typescript import { DateTime } from "effect" // returns "2024-01-01T00:00:00Z" DateTime.unsafeMake("2024-01-01T12:00:00Z").pipe(DateTime.startOf("day"), DateTime.formatIso) ``` -------------------------------- ### hostStartsWith Source: https://effect-ts.github.io/effect/platform/HttpMultiplex.ts.html Adds an application that matches requests where the request host starts with a given prefix. ```APIDOC ## hostStartsWith ### Description Adds an application to the HttpMultiplex that matches requests if the request host starts with a given prefix. ### Method Signature ```typescript hostStartsWith(prefix: string, app: App.Default): (self: HttpMultiplex) => HttpMultiplex hostStartsWith(self: HttpMultiplex, prefix: string, app: App.Default): HttpMultiplex ``` ### Source Since v1.0.0 ``` -------------------------------- ### Get Trie entries with a specific prefix Source: https://effect-ts.github.io/effect/effect/Trie.ts.html Returns an IterableIterator of key-value pairs from the Trie that start with the specified prefix. Useful for filtering Trie data based on a common starting string. ```typescript import * as assert from "node:assert" import { Trie } from "effect" const trie = Trie.empty().pipe( Trie.insert("she", 0), Trie.insert("shells", 1), Trie.insert("sea", 2), Trie.insert("shore", 3) ) const result = Array.from(Trie.entriesWithPrefix(trie, "she")) assert.deepStrictEqual(result, [ ["she", 0], ["shells", 1] ]) ``` -------------------------------- ### make Source: https://effect-ts.github.io/effect/platform-node/NodeHttpServer.ts.html Creates an HTTP server instance from a given evaluation function and listen options. This function returns an Effect that, when run, will start the HTTP server. ```APIDOC ## make ### Description Creates an HTTP server instance from a given evaluation function and listen options. ### Signature ```typescript declare const make: ( evaluate: LazyArg>, options: Net.ListenOptions ) => Effect.Effect ``` ``` -------------------------------- ### Get the maximum Intervals by start time Source: https://effect-ts.github.io/effect/effect/ScheduleIntervals.ts.html The `max` function returns the `Intervals` collection that has the latest start time between two given `Intervals` collections. This is useful for determining which collection begins later. ```typescript declare const max: { (that: Intervals): (self: Intervals) => Intervals; (self: Intervals, that: Intervals): Intervals } ``` -------------------------------- ### Initialize Source: https://effect-ts.github.io/effect/ai/ai/McpSchema.ts.html This request is sent from the client to the server when it first connects, asking it to begin initialization. ```APIDOC # Initialization ## Initialize (class) This request is sent from the client to the server when it first connects, asking it to begin initialization. **Signature** ```typescript declare class Initialize ``` Source Since v1.0.0 ``` -------------------------------- ### headerStartsWith Source: https://effect-ts.github.io/effect/platform/HttpMultiplex.ts.html Adds an application that matches requests where a specific header value starts with a given prefix. ```APIDOC ## headerStartsWith ### Description Adds an application to the HttpMultiplex that matches requests if a specified header value starts with a given prefix. ### Method Signature ```typescript headerStartsWith( header: string, prefix: string, app: App.Default ): (self: HttpMultiplex) => HttpMultiplex headerStartsWith( self: HttpMultiplex, header: string, prefix: string, app: App.Default ): HttpMultiplex ``` ### Source Since v1.0.0 ``` -------------------------------- ### findFirstIndexWhereFromSTM Source: https://effect-ts.github.io/effect/effect/TArray.ts.html Starting at a specified index, gets the index of the next element that matches a transactional predicate. This operation is transactional. ```APIDOC ## findFirstIndexWhereFromSTM ### Description Starting at specified index, get the index of the next entry that matches a transactional predicate. This operation is transactional. ### Signature ```typescript (predicate: (value: A) => STM.STM, from: number) => (self: TArray) => STM.STM, E, R> (self: TArray, predicate: (value: A) => STM.STM, from: number) => STM.STM, E, R> ``` ### Source Since v2.0.0 ``` -------------------------------- ### ToolUseBlockStart Source: https://effect-ts.github.io/effect/ai/amazon-bedrock/AmazonBedrockSchema.ts.html Represents the start of a tool use block. ```APIDOC ## ToolUseBlockStart (class) **Signature** ```typescript declare class ToolUseBlockStart ``` Source Since v1.0.0 ``` -------------------------------- ### Get the empty RuntimeFlagsPatch Source: https://effect-ts.github.io/effect/effect/RuntimeFlagsPatch.ts.html The `empty` constant represents a RuntimeFlagsPatch with no modifications. Use this as a starting point or when no changes are needed. ```typescript declare const empty: RuntimeFlagsPatch ``` -------------------------------- ### textStartPart Source: https://effect-ts.github.io/effect/ai/ai/Response.ts.html Constructs a new text start part. ```APIDOC ## textStartPart ### Description Constructs a new text start part. ### Signature ```typescript declare const textStartPart: (params: ConstructorParams) => TextStartPart ``` ``` -------------------------------- ### onStart Method Signature Source: https://effect-ts.github.io/effect/effect/Supervisor.ts.html Callback for when a new fiber starts. This method is part of the AbstractSupervisor class. ```typescript declare const onStart: ( _context: Context.Context, _effect: Effect.Effect, _parent: Option.Option>, _fiber: Fiber.RuntimeFiber ) => void ``` -------------------------------- ### findFirstIndexWhereFrom Source: https://effect-ts.github.io/effect/effect/TArray.ts.html Gets the index of the first element in the array that satisfies a given predicate, starting from a specified index. This operation is transactional. ```APIDOC ## findFirstIndexWhereFrom ### Description Get the index of the first entry in the array starting from the specified index, matching a predicate. This is a transactional operation. ### Signature ```typescript (predicate: Predicate, from: number) => (self: TArray) => STM.STM> (self: TArray, predicate: Predicate, from: number) => STM.STM> ``` ### Source Since v2.0.0 ``` -------------------------------- ### make Source: https://effect-ts.github.io/effect/platform/HttpServer.ts.html Constructs a new HttpServer service with the given options, including the serve function and address. ```APIDOC ## make ### Description Constructs a new HttpServer service with the given options, including the serve function and address. ### Method `make: (options: { readonly serve: (httpApp: App.Default, middleware?: Middleware.HttpMiddleware) => Effect.Effect; readonly address: Address }) => HttpServer` ### Parameters - `options` (object): Configuration options for the HttpServer. - `serve` ((httpApp: App.Default, middleware?: Middleware.HttpMiddleware) => Effect.Effect): A function to serve the HTTP application. - `address` (Address): The address for the HTTP server. ``` -------------------------------- ### Get Trie Values with Prefix Source: https://effect-ts.github.io/effect/effect/Trie.ts.html Retrieves values from a Trie that correspond to keys starting with a specified prefix. The prefix itself is included if it exists. ```typescript import * as assert from "node:assert" import { Trie } from "effect" const trie = Trie.empty().pipe( Trie.insert("she", 0), Trie.insert("shells", 1), Trie.insert("sea", 2), Trie.insert("shore", 3) ) const result = Array.from(Trie.valuesWithPrefix(trie, "she")) // 0: "she", 1: "shells" assert.deepStrictEqual(result, [0, 1]) ``` -------------------------------- ### Create a Toolkit from Tools Source: https://effect-ts.github.io/effect/ai/ai/Toolkit.ts.html Shows how to create a new toolkit by providing multiple Tool instances to the `Toolkit.make` constructor. This is the primary way to build a toolkit. ```typescript import { Toolkit, Tool } from "@effect/ai" import { Schema } from "effect" const GetCurrentTime = Tool.make("GetCurrentTime", { description: "Get the current timestamp", success: Schema.Number }) const GetWeather = Tool.make("get_weather", { description: "Get weather information", parameters: { location: Schema.String }, success: Schema.Struct({ temperature: Schema.Number, condition: Schema.String }) }) const toolkit = Toolkit.make(GetCurrentTime, GetWeather) ``` -------------------------------- ### Get Trie Entries with Prefix Source: https://effect-ts.github.io/effect/effect/Trie.ts.html Retrieves all entries from a Trie that start with a given prefix. Ensures the prefix itself is included if it exists as an entry. ```typescript import * as assert from "node:assert" import { Trie } from "effect" const trie = Trie.empty().pipe( Trie.insert("shells", 0), Trie.insert("sells", 1), Trie.insert("sea", 2), Trie.insert("she", 3) ) const result = Trie.toEntriesWithPrefix(trie, "she") assert.deepStrictEqual(result, [ ["she", 3], ["shells", 0] ]) ``` -------------------------------- ### run Source: https://effect-ts.github.io/effect/ai/ai/McpServer.ts.html Initializes and runs the McpServer with the given options. It returns an Effect that, when run, provides the McpServer and an RpcServer protocol. ```APIDOC ## run ### Description Initializes and runs the McpServer with the given options. It returns an Effect that, when run, provides the McpServer and an RpcServer protocol. ### Signature ```typescript declare const run: (options: { readonly name: string readonly version: string }) => Effect.Effect ``` ``` -------------------------------- ### make Source: https://effect-ts.github.io/effect/cli/CliConfig.ts.html Creates a CliConfig instance with partial parameters. ```APIDOC ## make ### Description Creates a CliConfig instance with partial parameters. ### Signature ```typescript declare const make: (params: Partial) => CliConfig ``` ### Parameters #### Path Parameters - **params** (Partial) - Required - Parameters to configure the CliConfig. ``` -------------------------------- ### NodeHttpServer layerTest example Source: https://effect-ts.github.io/effect/platform-node/NodeHttpServer.ts.html A Layer for testing HTTP servers. It starts a server on a random port and provides an HttpClient configured to communicate with it. ```typescript import * as assert from "node:assert" import { HttpClient, HttpRouter, HttpServer } from "@effect/platform" import { NodeHttpServer } from "@effect/platform-node" import { Effect } from "effect" Effect.gen(function* () { yield* HttpServer.serveEffect(HttpRouter.empty) const response = yield* HttpClient.get("/") assert.strictEqual(response.status, 404) }).pipe(Effect.provide(NodeHttpServer.layerTest)) ``` -------------------------------- ### Schedule Elapsed Example Source: https://effect-ts.github.io/effect/effect/Schedule.ts.html Creates a schedule that tracks the total elapsed duration since it started. Useful for monitoring execution time or delays. ```typescript declare const elapsed: Schedule ``` -------------------------------- ### make Source: https://effect-ts.github.io/effect/sql-pg/PgClient.ts.html Creates a new PgClient instance with the provided configuration. This is a primary constructor for setting up a PostgreSQL client. ```APIDOC ## make ### Description Creates a new PgClient instance with the provided configuration. This is a primary constructor for setting up a PostgreSQL client. ### Signature ```typescript declare const make: (options: PgClientConfig) => Effect.Effect ``` ``` -------------------------------- ### make Source: https://effect-ts.github.io/effect/sql-libsql/LibsqlClient.ts.html Creates a new instance of LibsqlClient. This function is used to initialize the client with the provided configuration options. ```APIDOC ## make ### Description Creates a new instance of LibsqlClient with the given configuration. ### Signature ```typescript declare const make: ( options: LibsqlClientConfig ) => Effect.Effect ``` ### Parameters * **options** (LibsqlClientConfig) - The configuration object for the LibsqlClient. ``` -------------------------------- ### findFirstIndexFrom Source: https://effect-ts.github.io/effect/effect/TArray.ts.html Gets the first index of a specific value within the TArray, starting the search from a specified index. Returns an STM effect yielding an Option of a number. ```APIDOC ## findFirstIndexFrom ### Description Get the first index of a specific value in the array starting from the specified index. ### Signature ```typescript { (value: A, from: number): (self: TArray) => STM.STM> (self: TArray, value: A, from: number): STM.STM> } ``` ``` -------------------------------- ### Creating an ExecutionPlan with Multiple Steps Source: https://effect-ts.github.io/effect/effect/ExecutionPlan.ts.html Demonstrates how to create an ExecutionPlan with multiple steps, each specifying different layers, attempt counts, and schedules. This plan first tries a 'bad' layer twice with a 3-second delay, then the same 'bad' layer three times with a 1-second delay, and finally a 'good' layer once. ```typescript import type { LanguageModel } from "@effect/ai" import type { Layer } from "effect" import { Effect, ExecutionPlan, Schedule } from "effect" declare const layerBad: Layer.Layer declare const layerGood: Layer.Layer const ThePlan = ExecutionPlan.make( { // First try with the bad layer 2 times with a 3 second delay between attempts provide: layerBad, attempts: 2, schedule: Schedule.spaced(3000) }, // Then try with the bad layer 3 times with a 1 second delay between attempts { provide: layerBad, attempts: 3, schedule: Schedule.spaced(1000) }, // Finally try with the good layer. // // If `attempts` is omitted, the plan will only attempt once, unless a schedule is provided. { provide: layerGood } ) declare const effect: Effect.Effect const withPlan: Effect.Effect = Effect.withExecutionPlan(effect, ThePlan) ``` -------------------------------- ### Get Trie keys with a specific prefix Source: https://effect-ts.github.io/effect/effect/Trie.ts.html Returns an IterableIterator of keys from the Trie that start with the specified prefix. Efficient for retrieving a subset of keys based on a common prefix. ```typescript import * as assert from "node:assert" import { Trie } from "effect" const trie = Trie.empty().pipe( Trie.insert("she", 0), Trie.insert("shells", 1), Trie.insert("sea", 2), Trie.insert("shore", 3) ) const result = Array.from(Trie.keysWithPrefix(trie, "she")) assert.deepStrictEqual(result, ["she", "shells"]) ``` -------------------------------- ### options Source: https://effect-ts.github.io/effect/platform/HttpClient.ts.html Creates an HTTP client with default options. This is a versatile method for initializing a client. ```APIDOC ## options ### Description Creates an HTTP client with default options. ### Signature ```typescript declare const options: (url: string | URL, options?: ClientRequest.Options.NoUrl | undefined) => Effect.Effect ``` ``` -------------------------------- ### SqlClient.MakeOptions Interface Source: https://effect-ts.github.io/effect/sql/SqlClient.ts.html Configuration options for creating a SqlClient instance. ```APIDOC ## SqlClient.MakeOptions Interface ### Description Configuration options for creating a SqlClient instance. ### Properties - **acquirer**: `Connection.Acquirer` - The connection acquirer. - **compiler**: `Compiler` - The SQL compiler. - **transactionAcquirer?**: `Connection.Acquirer` - Optional transaction acquirer. - **spanAttributes**: `ReadonlyArray` - Attributes for spans. - **beginTransaction?**: `string | undefined` - Optional SQL for beginning a transaction. - **rollback?**: `string | undefined` - Optional SQL for rolling back a transaction. - **commit?**: `string | undefined` - Optional SQL for committing a transaction. - **savepoint?**: `((name: string) => string) | undefined` - Optional function to generate savepoint SQL. - **rollbackSavepoint?**: `((name: string) => string) | undefined` - Optional function to generate rollback savepoint SQL. - **transformRows?**: `(row: ReadonlyArray) => ReadonlyArray` - Optional function to transform rows. - **reactiveMailbox?**: `(keys: ReadonlyArray | ReadonlyRecord>, effect: Effect) => Effect, never, R | Scope>` - Optional function for creating reactive mailboxes. ### Source Since v1.0.0 ``` -------------------------------- ### Calculating the size of MutableHashSet Source: https://effect-ts.github.io/effect/effect/MutableHashSet.ts.html Shows how to get the number of values in a MutableHashSet. Examples include an empty set and a set with duplicate values, demonstrating that only unique values are counted. ```typescript import { MutableHashSet } from "effect" import assert from "node:assert/strict" assert.equal(MutableHashSet.size(MutableHashSet.empty()), 0) assert.equal(MutableHashSet.size(MutableHashSet.make(1, 2, 2, 3, 4, 3)), 4) ``` -------------------------------- ### Get DateTime Part Example Source: https://effect-ts.github.io/effect/effect/DateTime.ts.html Demonstrates how to extract a specific part (e.g., year) from a zoned DateTime object. This function returns the time zone-adjusted value of the requested part. ```typescript import * as assert from "node:assert" import { DateTime } from "effect" const now = DateTime.unsafeMakeZoned({ year: 2024 }, { timeZone: "Europe/London" }) const year = DateTime.getPart(now, "year") assert.strictEqual(year, 2024) ``` -------------------------------- ### Create and Implement a Toolkit with Multiple Tools Source: https://effect-ts.github.io/effect/ai/ai/Toolkit.ts.html Demonstrates how to define individual tools (GetCurrentTime, GetWeather) and then combine them into a toolkit. The toolkit is then converted into a layer for dependency injection, providing implementations for each tool. ```typescript import { Toolkit, Tool } from "@effect/ai" import { Effect, Schema } from "effect" // Create individual tools const GetCurrentTime = Tool.make("GetCurrentTime", { description: "Get the current timestamp", success: Schema.Number }) const GetWeather = Tool.make("GetWeather", { description: "Get weather for a location", parameters: { location: Schema.String }, success: Schema.Struct({ temperature: Schema.Number, condition: Schema.String }) }) // Create a toolkit with multiple tools const MyToolkit = Toolkit.make(GetCurrentTime, GetWeather) const MyToolkitLayer = MyToolkit.toLayer({ GetCurrentTime: () => Effect.succeed(Date.now()), GetWeather: ({ location }) => Effect.succeed({ temperature: 72, condition: "sunny" }) }) ``` -------------------------------- ### ContentBlockStart Source: https://effect-ts.github.io/effect/ai/amazon-bedrock/AmazonBedrockSchema.ts.html Represents the start of a content block. ```APIDOC ## ContentBlockStart (class) **Signature** ```typescript declare class ContentBlockStart ``` ``` -------------------------------- ### Scan Stream Elements Source: https://effect-ts.github.io/effect/effect/Stream.ts.html Statefully maps over stream elements, producing all intermediate results of a given type `S` starting with an initial value. This example calculates the cumulative sum of a range of numbers. ```typescript import { Effect, Stream } from "effect" const stream = Stream.range(1, 6).pipe(Stream.scan(0, (a, b) => a + b)) Effect.runPromise(Stream.runCollect(stream)).then(console.log) // { _id: 'Chunk', values: [ 0, 1, 3, 6, 10, 15, 21 ] } ``` -------------------------------- ### make Source: https://effect-ts.github.io/effect/platform-bun/BunHttpPlatform.ts.html Creates a new instance of the HttpPlatform using Bun's HTTP server capabilities. This constructor returns an Effect that, when run, provides the HttpPlatform service. ```APIDOC ## make ### Description Creates a new instance of the HttpPlatform using Bun's HTTP server capabilities. This constructor returns an Effect that, when run, provides the HttpPlatform service. ### Signature ```typescript declare const make: Effect.Effect ``` ### Source Since v1.0.0 ``` -------------------------------- ### BunHttpPlatform make Constructor Source: https://effect-ts.github.io/effect/platform-bun/BunHttpPlatform.ts.html Creates an instance of the HTTP platform. Requires FileSystem and Etag Generator services. ```typescript declare const make: Effect.Effect ``` -------------------------------- ### Adding multiple routes to HttpRouter Source: https://effect-ts.github.io/effect/platform/HttpLayerRouter.ts.html Use `HttpLayerRouter.addAll` to create a layer that adds multiple routes to an HTTP router. This example shows how to define a collection of routes, including a GET request for '/hello'. ```typescript import * as HttpLayerRouter from "@effect/platform/HttpLayerRouter" import * as HttpServerResponse from "@effect/platform/HttpServerResponse" const Routes = HttpLayerRouter.addAll([ HttpLayerRouter.route("GET", "/hello", HttpServerResponse.text("Hello, World!")) ]) ``` -------------------------------- ### Adding a single route to HttpRouter Source: https://effect-ts.github.io/effect/platform/HttpLayerRouter.ts.html Use `HttpLayerRouter.add` to create a layer that adds a single route to an HTTP router. This example demonstrates adding a GET request for '/hello' that responds with 'Hello, World!'. ```typescript import * as HttpLayerRouter from "@effect/platform/HttpLayerRouter" import * as HttpServerResponse from "@effect/platform/HttpServerResponse" const Route = HttpLayerRouter.add("GET", "/hello", HttpServerResponse.text("Hello, World!")) ``` -------------------------------- ### getHelp Source: https://effect-ts.github.io/effect/cli/Command.ts.html Generates help documentation for a command based on the provided configuration. ```APIDOC ## getHelp ### Description Generates help documentation for a command based on the provided configuration. ### Signature ```typescript declare const getHelp: (self: Command, config: CliConfig) => HelpDoc ``` ``` -------------------------------- ### toolParamsStartPart Source: https://effect-ts.github.io/effect/ai/ai/Response.ts.html Constructs a new tool params start part. ```APIDOC ## toolParamsStartPart ### Description Constructs a new tool params start part. ### Signature ```typescript declare const toolParamsStartPart: (params: ConstructorParams) => ToolParamsStartPart ``` ``` -------------------------------- ### constructors Source: https://effect-ts.github.io/effect/cli/HelpDoc.ts.html Functions for creating HelpDoc instances. ```APIDOC ## blocks ### Description Creates a HelpDoc from an iterable of HelpDoc instances. ### Signature ``` declare const blocks: (helpDocs: Iterable) => HelpDoc ``` ## descriptionList ### Description Creates a HelpDoc representing a description list. ### Signature ``` declare const descriptionList: (definitions: NonEmptyReadonlyArray<[Span, HelpDoc]>) => HelpDoc ``` ## empty ### Description Creates an empty HelpDoc. ### Signature ``` declare const empty: HelpDoc ``` ## enumeration ### Description Creates a HelpDoc representing an enumeration. ### Signature ``` declare const enumeration: (elements: NonEmptyReadonlyArray) => HelpDoc ``` ## h1 ### Description Creates a HelpDoc with a level 1 header. ### Signature ``` declare const h1: (value: string | Span) => HelpDoc ``` ## h2 ### Description Creates a HelpDoc with a level 2 header. ### Signature ``` declare const h2: (value: string | Span) => HelpDoc ``` ## h3 ### Description Creates a HelpDoc with a level 3 header. ### Signature ``` declare const h3: (value: string | Span) => HelpDoc ``` ## p ### Description Creates a HelpDoc representing a paragraph. ### Signature ``` declare const p: (value: string | Span) => HelpDoc ``` ``` -------------------------------- ### make Source: https://effect-ts.github.io/effect/effect/LogSpan.ts.html Creates a new LogSpan with a given label and start time. ```APIDOC ## make ### Description Creates a new LogSpan with a given label and start time. ### Signature ```typescript declare const make: (label: string, startTime: number) => LogSpan ``` ``` -------------------------------- ### Example Usage of Prompt.RawInput Types Source: https://effect-ts.github.io/effect/ai/ai/Prompt.ts.html Demonstrates how to use different input formats for creating a Prompt.RawInput, including strings, message arrays, and existing prompts. ```typescript import { Prompt } from "@effect/ai" // String input - creates a user message const stringInput: Prompt.RawInput = "Hello, world!" // Message array input const messagesInput: Prompt.RawInput = [ { role: "system", content: "You are helpful." }, { role: "user", content: [{ type: "text", text: "Hi!" }] } ] // Existing prompt declare const existingPrompt: Prompt.Prompt const promptInput: Prompt.RawInput = existingPrompt ``` -------------------------------- ### get Source: https://effect-ts.github.io/effect/platform/HttpClient.ts.html Sends a GET request to the specified URL. ```APIDOC ## get ### Description Sends a GET request to the specified URL. ### Method GET ### Endpoint [URL] ### Parameters #### Query Parameters - **url** (string | URL) - Required - The URL to send the request to. - **options** (ClientRequest.Options.NoBody) - Optional - Additional options for the request. ### Signature ```typescript declare const get: ( url: string | URL, options?: ClientRequest.Options.NoBody | undefined ) => Effect.Effect ``` ``` -------------------------------- ### start Source: https://effect-ts.github.io/effect/effect/ScheduleIntervals.ts.html The start of the earliest interval in the specified Intervals. ```APIDOC ## start ### Description The start of the earliest interval in the specified `Intervals`. ### Signature ```typescript declare const start: (self: Intervals) => number ``` ``` -------------------------------- ### make Source: https://effect-ts.github.io/effect/effect/Queue.ts.html Constructs a Queue using a provided BackingQueue and Strategy. ```APIDOC ## make ### Signature ```typescript declare const make: (queue: BackingQueue, strategy: Strategy) => Effect.Effect> ``` ``` -------------------------------- ### Define a GET Route Source: https://effect-ts.github.io/effect/platform/HttpRouter.ts.html Use the `get` function to define a GET HTTP route. It takes a path and a handler, and supports an option to make the route uninterruptible. ```typescript declare const get: { ( path: PathInput, handler: Route.Handler, options?: { readonly uninterruptible?: boolean | undefined } | undefined ): (self: HttpRouter) => HttpRouter> ( self: HttpRouter, path: PathInput, handler: Route.Handler, options?: { readonly uninterruptible?: boolean | undefined } | undefined ): HttpRouter> } ``` -------------------------------- ### SpanStatus Type Alias Source: https://effect-ts.github.io/effect/effect/Tracer.ts.html Type alias defining the possible statuses of a span, either 'Started' with a start time or 'Ended' with start and end times and an exit status. ```typescript type SpanStatus = | { _tag: "Started" startTime: bigint } | { _tag: "Ended" startTime: bigint endTime: bigint exit: Exit.Exit } ``` -------------------------------- ### make FileSystem Source: https://effect-ts.github.io/effect/platform/FileSystem.ts.html Constructs a FileSystem implementation. It requires an implementation that omits certain methods, which will be provided by default. ```APIDOC ## make ### Description Constructs a `FileSystem` implementation. Requires an implementation that omits specific methods, which are then provided by default. ### Signature ```typescript const make: (impl: Omit) => FileSystem ``` ``` -------------------------------- ### make Source: https://effect-ts.github.io/effect/effect/TestSized.ts.html Creates a new TestSized context with a specified initial size. ```APIDOC ## make ### Description Creates a new TestSized context with a specified initial size. ### Signature ```typescript declare const make: (size: number) => TestSized ``` ### Parameters - **size** (number) - The initial size for the TestSized context. ``` -------------------------------- ### get Source: https://effect-ts.github.io/effect/effect/TSubscriptionRef.ts.html Atomically gets the current value of the TSubscriptionRef within a transaction. ```APIDOC ## get ### Description Atomically gets the current value of the `TSubscriptionRef` within a transaction. ### Signature ```typescript declare const get: (self: TSubscriptionRef) => STM.STM ``` ``` -------------------------------- ### make Source: https://effect-ts.github.io/effect/cli/CliApp.ts.html Constructs a new CliApp instance. This function takes constructor arguments that define the application's name, version, command structure, and optional details like executable path, summary, and footer. ```APIDOC ## make ### Description Constructs a new CliApp instance. This function takes constructor arguments that define the application's name, version, command structure, and optional details like executable path, summary, and footer. ### Signature ```typescript declare const make: (config: CliApp.ConstructorArgs) => CliApp ``` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body * **config** (CliApp.ConstructorArgs) - Required - Configuration object for the CliApp. * **name** (string) - Required - The name of the CLI application. * **version** (string) - Required - The version of the CLI application. * **command** (Command) - Required - The command definition for the CLI application. * **executable** (string | undefined) - Optional - The path to the executable file. * **summary** (Span | undefined) - Optional - A brief summary of the CLI application. * **footer** (HelpDoc | undefined) - Optional - Additional documentation displayed at the end of the help message. ### Request Example None ### Response #### Success Response (200) * **CliApp** - A new instance of a CLI application. ``` -------------------------------- ### Create GET Request Source: https://effect-ts.github.io/effect/platform/HttpClientRequest.ts.html Use the `get` constructor to create a new `HttpClientRequest` with the HTTP method set to GET. It takes a URL and optional options, excluding a request body. ```typescript declare const get: (url: string | URL, options?: Options.NoBody) => HttpClientRequest ``` -------------------------------- ### lessThan Source: https://effect-ts.github.io/effect/effect/ScheduleIntervals.ts.html Returns true if the start of this Intervals is before the start of that Intervals, false otherwise. ```APIDOC ## lessThan ### Description Returns `true` if the start of this `Intervals` is before the start of that `Intervals`, `false` otherwise. ### Signature ```typescript declare const lessThan: { (that: Intervals): (self: Intervals) => boolean; (self: Intervals, that: Intervals): boolean } ``` ``` -------------------------------- ### SqlClient.make Source: https://effect-ts.github.io/effect/sql/SqlClient.ts.html Creates a new SqlClient instance with the specified options. This is the primary constructor for the SqlClient service. ```APIDOC ## SqlClient.make ### Description Creates a new SqlClient instance with the specified options. This is the primary constructor for the SqlClient service. ### Signature ```typescript declare const make: (options: SqlClient.MakeOptions) => Effect ``` ``` -------------------------------- ### Perform an HTTP GET Request Source: https://effect-ts.github.io/effect/platform/HttpClient.ts.html The `get` accessor function simplifies performing HTTP GET requests. It takes a URL and optional request options, returning an Effect that yields the response or an error. ```typescript declare const get: ( url: string | URL, options?: ClientRequest.Options.NoBody | undefined ) => Effect.Effect ``` -------------------------------- ### padStart Source: https://effect-ts.github.io/effect/effect/String.ts.html Pads the current string with another string (repeated, if needed) until the resulting string reaches the given length. The padding is applied from the start of the current string. ```APIDOC ## padStart ### Description Pads the current string with another string (repeated, if needed) until the resulting string reaches the given length. The padding is applied from the start of the current string. ### Example ```typescript import * as assert from "node:assert" import { pipe, String } from "effect" assert.deepStrictEqual(pipe("a", String.padStart(5)), " a") assert.deepStrictEqual(pipe("a", String.padStart(5, "_")), "____a") ``` ### Signature ```typescript declare const padStart: (maxLength: number, fillString?: string) => (self: string) => string ``` ``` -------------------------------- ### Compare Intervals by start time (lessThan) Source: https://effect-ts.github.io/effect/effect/ScheduleIntervals.ts.html The `lessThan` function compares two `Intervals` collections based on their earliest start times. It returns `true` if the first collection's start time is before the second's. ```typescript declare const lessThan: { (that: Intervals): (self: Intervals) => boolean; (self: Intervals, that: Intervals): boolean } ``` -------------------------------- ### showHelp Constructor Source: https://effect-ts.github.io/effect/cli/BuiltInOptions.ts.html Creates a ShowHelp option with provided usage and help documentation. ```APIDOC ## showHelp ### Description Creates a `ShowHelp` option that displays command usage and detailed help documentation. ### Signature ```typescript declare const showHelp: (usage: Usage, helpDoc: HelpDoc) => BuiltInOptions ``` ### Parameters * `usage` (Usage) - The usage information for the command. * `helpDoc` (HelpDoc) - The detailed help documentation for the command. ``` -------------------------------- ### get Source: https://effect-ts.github.io/effect/platform/HttpRouter.ts.html Registers a handler for GET requests on a specific path. This is typically used for retrieving data. ```APIDOC ## get ### Description Registers a handler for GET requests on a specific path. This is typically used for retrieving data. ### Method GET ### Endpoint [PathInput] ### Parameters #### Path Parameters - **path** (PathInput) - Required - The path to match. - **handler** (Route.Handler) - Required - The handler function to execute. - **options** (object) - Optional - Options for the route, such as `uninterruptible`. - **uninterruptible** (boolean) - Optional - If true, the handler execution is uninterruptible. ### Parameters (for HttpRouter) #### Path Parameters - **self** (HttpRouter) - Required - The HttpRouter instance to extend. - **path** (PathInput) - Required - The path to match. - **handler** (Route.Handler) - Required - The handler function to execute. - **options** (object) - Optional - Options for the route, such as `uninterruptible`. - **uninterruptible** (boolean) - Optional - If true, the handler execution is uninterruptible. ### Returns HttpRouter> - A new HttpRouter with the added route. ``` -------------------------------- ### showVersion Constructor Source: https://effect-ts.github.io/effect/cli/BuiltInOptions.ts.html Creates a ShowVersion option. ```APIDOC ## showVersion ### Description Creates a `ShowVersion` option, typically used to display the application's version. ### Signature ```typescript declare const showVersion: BuiltInOptions ``` ### Parameters None. ``` -------------------------------- ### get Function Signature Source: https://effect-ts.github.io/effect/effect/FiberHandle.ts.html Defines the signature for `get`, which retrieves the currently running fiber from the FiberHandle. ```typescript declare const get: (self: FiberHandle) => Effect.Effect, NoSuchElementException> ``` -------------------------------- ### Create and Use a File Logger Source: https://effect-ts.github.io/effect/platform/PlatformLogger.ts.html Demonstrates how to create a logger that writes to a file using `PlatformLogger.toFile`. This example utilizes `Logger.logfmtLogger` and `NodeFileSystem` for file operations, and `NodeRuntime` to execute the logging effects. ```typescript import { PlatformLogger } from "@effect/platform" import { NodeFileSystem, NodeRuntime } from "@effect/platform-node" import { Effect, Layer, Logger } from "effect" const fileLogger = Logger.logfmtLogger.pipe(PlatformLogger.toFile("/tmp/log.txt")) const LoggerLive = Logger.replaceScoped(Logger.defaultLogger, fileLogger).pipe(Layer.provide(NodeFileSystem.layer)) Effect.log("a").pipe( Effect.zipRight(Effect.log("b")), Effect.zipRight(Effect.log("c")), Effect.provide(LoggerLive), NodeRuntime.runMain ) ``` -------------------------------- ### make Function Source: https://effect-ts.github.io/effect/effect/TestConfig.ts.html Creates a TestConfig service instance with the specified configuration parameters. ```APIDOC ## make Creates a TestConfig service instance with the specified configuration parameters. ### Parameters - **params** (object) - Required - An object containing the configuration parameters. - **repeats** (number) - Required - The number of times to repeat tests to ensure they are stable. - **retries** (number) - Required - The number of times to retry flaky tests. - **samples** (number) - Required - The number of sufficient samples to check for a random variable. - **shrinks** (number) - Required - The maximum number of shrinkings to minimize large failures. ### Returns - TestConfig - A new instance of the TestConfig service. ``` -------------------------------- ### SpanStatusStarted Schema Definition Source: https://effect-ts.github.io/effect/experimental/DevTools/Domain.ts.html Defines a schema specifically for the 'Started' state of a SpanStatus, including the start time. ```typescript declare const SpanStatusStarted: Schema.Struct<{ _tag: Schema.Literal<["Started"]>; startTime: typeof Schema.BigInt }> ``` -------------------------------- ### Get the current value of TSubscriptionRef Source: https://effect-ts.github.io/effect/effect/TSubscriptionRef.ts.html The `get` function returns an STM effect that yields the current value of the TSubscriptionRef. ```typescript declare const get: (self: TSubscriptionRef) => STM.STM ``` -------------------------------- ### getHelp Source: https://effect-ts.github.io/effect/cli/CommandDescriptor.ts.html Retrieves the help documentation for a given command. It takes a Command object and a CliConfig object and returns a HelpDoc. ```APIDOC ## getHelp ### Description Retrieves the help documentation for a given command. ### Signature ```typescript declare const getHelp: (self: Command, config: CliConfig) => HelpDoc ``` ### Parameters - **self** (Command) - The command to get help for. - **config** (CliConfig) - The CLI configuration. ### Returns HelpDoc - The help documentation for the command. ``` -------------------------------- ### Erase Start of Line Source: https://effect-ts.github.io/effect/printer-ansi/AnsiDoc.ts.html Clears the current line from the cursor position to the start. The cursor position remains unchanged. ```typescript declare const eraseStartLine: AnsiDoc ``` -------------------------------- ### Compact Layout Algorithm Example Source: https://effect-ts.github.io/effect/printer/Layout.ts.html Demonstrates the 'compact' layout algorithm, which renders documents without indentation or annotations, resulting in a fast and concise output suitable for machine readability. It compares the output of 'pretty' and 'compact' styles. ```typescript import * as assert from "node:assert" import * as Doc from "@effect/printer/Doc" import { pipe } from "effect/Function" import * as String from "effect/String" const doc = pipe( Doc.vsep([Doc.text("lorem"), Doc.text("ipsum"), pipe(Doc.vsep([Doc.text("dolor"), Doc.text("sit")]), Doc.hang(4))]), Doc.hang(4) ) assert.strictEqual( Doc.render(doc, { style: "pretty" }), String.stripMargin( `|lorem | ipsum | dolor | sit` ) ) assert.strictEqual( Doc.render(doc, { style: "compact" }), String.stripMargin( `|lorem |ipsum |dolor |sit` ) ) ``` -------------------------------- ### make Source: https://effect-ts.github.io/effect/effect/ConfigProvider.ts.html Creates a new config provider with a specified load function and flattened configuration. ```APIDOC ## make ### Description Creates a new config provider. ### Options * `load`: A function that loads a configuration of type `Config.Config` and returns an `Effect.Effect`. * `flattened`: The flattened configuration provider. ### Signature ```typescript declare const make: (options: { readonly load: (config: Config.Config) => Effect.Effect readonly flattened: ConfigProvider.Flat }) => ConfigProvider ``` ``` -------------------------------- ### get Source: https://effect-ts.github.io/effect/platform/HttpApiEndpoint.ts.html Creates an HttpApiEndpoint constructor for the GET HTTP method. It can be used to define an endpoint with a name or a name and a path segment. ```APIDOC ## get ### Description Creates an HttpApiEndpoint constructor for the GET HTTP method. ### Method GET ### Endpoint (Not specified, depends on usage) ### Parameters #### Path Parameters None explicitly defined in the constructor signature. #### Query Parameters None explicitly defined in the constructor signature. #### Request Body None explicitly defined in the constructor signature. ### Request Example ```typescript // Example of creating a constructor const getUserEndpoint = HttpApiEndpoint.get('getUser'); // Example of creating an endpoint with a path const getUserByIdEndpoint = HttpApiEndpoint.get('getUserById', '/users/:id'); ``` ### Response (Not specified in the constructor signature, handled by the endpoint handler) ``` -------------------------------- ### Create a LogSpan Source: https://effect-ts.github.io/effect/effect/LogSpan.ts.html Constructs a new LogSpan with a given label and start time. Requires the label and start time as arguments. ```typescript declare const make: (label: string, startTime: number) => LogSpan ``` -------------------------------- ### Get the value of a TRef Source: https://effect-ts.github.io/effect/effect/TRef.ts.html Use `get` to retrieve the current value of a TRef within a transactional effect. This is a fundamental read operation. ```typescript declare const get: (self: TRef) => STM.STM ``` -------------------------------- ### HelpDoc Constructor: p Source: https://effect-ts.github.io/effect/cli/HelpDoc.ts.html Creates a paragraph for the documentation. Accepts a string or a Span. ```typescript declare const p: (value: string | Span) => HelpDoc ```