@effect/platform 0.64.0 → 0.64.1
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/README.md +2 -416
- package/dist/cjs/Command.js +3 -3
- package/dist/cjs/Command.js.map +1 -1
- package/dist/cjs/internal/command.js +2 -2
- package/dist/cjs/internal/command.js.map +1 -1
- package/dist/dts/Command.d.ts +4 -4
- package/dist/dts/Command.d.ts.map +1 -1
- package/dist/esm/Command.js +3 -3
- package/dist/esm/Command.js.map +1 -1
- package/dist/esm/internal/command.js +2 -2
- package/dist/esm/internal/command.js.map +1 -1
- package/package.json +3 -3
- package/src/Command.ts +7 -8
- package/src/internal/command.ts +4 -3
package/README.md
CHANGED
|
@@ -2,23 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Welcome to the documentation for `@effect/platform`, a library designed for creating platform-independent abstractions (Node.js, Bun, browsers).
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
This package empowers you to perform various operations, such as:
|
|
8
|
-
|
|
9
|
-
| **Operation** | **Description** |
|
|
10
|
-
| -------------- | ------------------------------------------------------------------------------------------------ |
|
|
11
|
-
| HTTP API | Declarative HTTP API servers & clients |
|
|
12
|
-
| HTTP Client | Sending HTTP requests and receiving responses |
|
|
13
|
-
| HTTP Server | Creating HTTP servers to handle incoming requests |
|
|
14
|
-
| HTTP Router | Routing HTTP requests to specific handlers |
|
|
15
|
-
| Terminal | Reading and writing from/to standard input/output |
|
|
16
|
-
| Command | Creating and running a command with the specified process name and an optional list of arguments |
|
|
17
|
-
| FileSystem | Reading and writing from/to the file system |
|
|
18
|
-
| KeyValueStore | Storing and retrieving key-value pairs |
|
|
19
|
-
| PlatformLogger | Creating a logger that writes to a specified file from another string logger |
|
|
20
|
-
|
|
21
|
-
By utilizing `@effect/platform`, you can write code that remains platform-agnostic, ensuring compatibility across different environments.
|
|
5
|
+
> [!WARNING]
|
|
6
|
+
> This documentation focuses on **unstable modules**. For stable modules, refer to the [official website documentation](https://effect.website/docs/guides/platform/introduction).
|
|
22
7
|
|
|
23
8
|
# HTTP API
|
|
24
9
|
|
|
@@ -2345,402 +2330,3 @@ const handler = HttpApp.toWebHandler(router)
|
|
|
2345
2330
|
const response = await handler(new Request("http://localhost:3000/foo"))
|
|
2346
2331
|
console.log(await response.text()) // Output: content 2
|
|
2347
2332
|
```
|
|
2348
|
-
|
|
2349
|
-
# Terminal
|
|
2350
|
-
|
|
2351
|
-
The `@effect/platform/Terminal` module exports a single `Terminal` tag, which serves as the entry point to reading from and writing to standard input and standard output.
|
|
2352
|
-
|
|
2353
|
-
## Writing to standard output
|
|
2354
|
-
|
|
2355
|
-
```ts
|
|
2356
|
-
import { Terminal } from "@effect/platform"
|
|
2357
|
-
import { NodeRuntime, NodeTerminal } from "@effect/platform-node"
|
|
2358
|
-
import { Effect } from "effect"
|
|
2359
|
-
|
|
2360
|
-
// const displayMessage: Effect.Effect<void, PlatformError, Terminal.Terminal>
|
|
2361
|
-
const displayMessage = Effect.gen(function* (_) {
|
|
2362
|
-
const terminal = yield* _(Terminal.Terminal)
|
|
2363
|
-
yield* _(terminal.display("a message\n"))
|
|
2364
|
-
})
|
|
2365
|
-
|
|
2366
|
-
NodeRuntime.runMain(displayMessage.pipe(Effect.provide(NodeTerminal.layer)))
|
|
2367
|
-
// Output: "a message"
|
|
2368
|
-
```
|
|
2369
|
-
|
|
2370
|
-
## Reading from standard input
|
|
2371
|
-
|
|
2372
|
-
```ts
|
|
2373
|
-
import { Terminal } from "@effect/platform"
|
|
2374
|
-
import { NodeRuntime, NodeTerminal } from "@effect/platform-node"
|
|
2375
|
-
import { Console, Effect } from "effect"
|
|
2376
|
-
|
|
2377
|
-
// const readLine: Effect.Effect<void, Terminal.QuitException, Terminal.Terminal>
|
|
2378
|
-
const readLine = Effect.gen(function* (_) {
|
|
2379
|
-
const terminal = yield* _(Terminal.Terminal)
|
|
2380
|
-
const input = yield* _(terminal.readLine)
|
|
2381
|
-
yield* _(Console.log(`input: ${input}`))
|
|
2382
|
-
})
|
|
2383
|
-
|
|
2384
|
-
NodeRuntime.runMain(readLine.pipe(Effect.provide(NodeTerminal.layer)))
|
|
2385
|
-
// Input: "hello"
|
|
2386
|
-
// Output: "input: hello"
|
|
2387
|
-
```
|
|
2388
|
-
|
|
2389
|
-
These simple examples illustrate how to utilize the `Terminal` module for handling standard input and output in your programs. Let's use this knowledge to build a number guessing game:
|
|
2390
|
-
|
|
2391
|
-
```ts
|
|
2392
|
-
import { Terminal } from "@effect/platform"
|
|
2393
|
-
import type { PlatformError } from "@effect/platform/Error"
|
|
2394
|
-
import { Effect, Option, Random } from "effect"
|
|
2395
|
-
|
|
2396
|
-
export const secret = Random.nextIntBetween(1, 100)
|
|
2397
|
-
|
|
2398
|
-
const parseGuess = (input: string) => {
|
|
2399
|
-
const n = parseInt(input, 10)
|
|
2400
|
-
return isNaN(n) || n < 1 || n > 100 ? Option.none() : Option.some(n)
|
|
2401
|
-
}
|
|
2402
|
-
|
|
2403
|
-
const display = (message: string) =>
|
|
2404
|
-
Effect.gen(function* (_) {
|
|
2405
|
-
const terminal = yield* _(Terminal.Terminal)
|
|
2406
|
-
yield* _(terminal.display(`${message}\n`))
|
|
2407
|
-
})
|
|
2408
|
-
|
|
2409
|
-
const prompt = Effect.gen(function* (_) {
|
|
2410
|
-
const terminal = yield* _(Terminal.Terminal)
|
|
2411
|
-
yield* _(terminal.display("Enter a guess: "))
|
|
2412
|
-
return yield* _(terminal.readLine)
|
|
2413
|
-
})
|
|
2414
|
-
|
|
2415
|
-
const answer: Effect.Effect<
|
|
2416
|
-
number,
|
|
2417
|
-
Terminal.QuitException | PlatformError,
|
|
2418
|
-
Terminal.Terminal
|
|
2419
|
-
> = Effect.gen(function* (_) {
|
|
2420
|
-
const input = yield* _(prompt)
|
|
2421
|
-
const guess = parseGuess(input)
|
|
2422
|
-
if (Option.isNone(guess)) {
|
|
2423
|
-
yield* _(display("You must enter an integer from 1 to 100"))
|
|
2424
|
-
return yield* _(answer)
|
|
2425
|
-
}
|
|
2426
|
-
return guess.value
|
|
2427
|
-
})
|
|
2428
|
-
|
|
2429
|
-
const check = <A, E, R>(
|
|
2430
|
-
secret: number,
|
|
2431
|
-
guess: number,
|
|
2432
|
-
ok: Effect.Effect<A, E, R>,
|
|
2433
|
-
ko: Effect.Effect<A, E, R>
|
|
2434
|
-
): Effect.Effect<A, E | PlatformError, R | Terminal.Terminal> =>
|
|
2435
|
-
Effect.gen(function* (_) {
|
|
2436
|
-
if (guess > secret) {
|
|
2437
|
-
yield* _(display("Too high"))
|
|
2438
|
-
return yield* _(ko)
|
|
2439
|
-
} else if (guess < secret) {
|
|
2440
|
-
yield* _(display("Too low"))
|
|
2441
|
-
return yield* _(ko)
|
|
2442
|
-
} else {
|
|
2443
|
-
return yield* _(ok)
|
|
2444
|
-
}
|
|
2445
|
-
})
|
|
2446
|
-
|
|
2447
|
-
const end = display("You guessed it!")
|
|
2448
|
-
|
|
2449
|
-
const loop = (
|
|
2450
|
-
secret: number
|
|
2451
|
-
): Effect.Effect<
|
|
2452
|
-
void,
|
|
2453
|
-
Terminal.QuitException | PlatformError,
|
|
2454
|
-
Terminal.Terminal
|
|
2455
|
-
> =>
|
|
2456
|
-
Effect.gen(function* (_) {
|
|
2457
|
-
const guess = yield* _(answer)
|
|
2458
|
-
return yield* _(
|
|
2459
|
-
check(
|
|
2460
|
-
secret,
|
|
2461
|
-
guess,
|
|
2462
|
-
end,
|
|
2463
|
-
Effect.suspend(() => loop(secret))
|
|
2464
|
-
)
|
|
2465
|
-
)
|
|
2466
|
-
})
|
|
2467
|
-
|
|
2468
|
-
export const game = Effect.gen(function* (_) {
|
|
2469
|
-
yield* _(
|
|
2470
|
-
display(
|
|
2471
|
-
"We have selected a random number between 1 and 100. See if you can guess it in 10 turns or fewer. We'll tell you if your guess was too high or too low."
|
|
2472
|
-
)
|
|
2473
|
-
)
|
|
2474
|
-
yield* _(loop(yield* _(secret)))
|
|
2475
|
-
})
|
|
2476
|
-
```
|
|
2477
|
-
|
|
2478
|
-
Let's run the game in Node.js:
|
|
2479
|
-
|
|
2480
|
-
```ts
|
|
2481
|
-
import { NodeRuntime, NodeTerminal } from "@effect/platform-node"
|
|
2482
|
-
import * as Effect from "effect/Effect"
|
|
2483
|
-
import { game } from "./game.js"
|
|
2484
|
-
|
|
2485
|
-
NodeRuntime.runMain(game.pipe(Effect.provide(NodeTerminal.layer)))
|
|
2486
|
-
```
|
|
2487
|
-
|
|
2488
|
-
Let's run the game in Bun:
|
|
2489
|
-
|
|
2490
|
-
```ts
|
|
2491
|
-
import { BunRuntime, BunTerminal } from "@effect/platform-bun"
|
|
2492
|
-
import * as Effect from "effect/Effect"
|
|
2493
|
-
import { game } from "./game.js"
|
|
2494
|
-
|
|
2495
|
-
BunRuntime.runMain(game.pipe(Effect.provide(BunTerminal.layer)))
|
|
2496
|
-
```
|
|
2497
|
-
|
|
2498
|
-
# Command
|
|
2499
|
-
|
|
2500
|
-
As an example of using the `@effect/platform/Command` module, let's see how to run the TypeScript compiler `tsc`:
|
|
2501
|
-
|
|
2502
|
-
```ts
|
|
2503
|
-
import { Command, CommandExecutor } from "@effect/platform"
|
|
2504
|
-
import {
|
|
2505
|
-
NodeCommandExecutor,
|
|
2506
|
-
NodeFileSystem,
|
|
2507
|
-
NodeRuntime
|
|
2508
|
-
} from "@effect/platform-node"
|
|
2509
|
-
import { Effect } from "effect"
|
|
2510
|
-
|
|
2511
|
-
// const program: Effect.Effect<string, PlatformError, CommandExecutor.CommandExecutor>
|
|
2512
|
-
const program = Effect.gen(function* (_) {
|
|
2513
|
-
const executor = yield* _(CommandExecutor.CommandExecutor)
|
|
2514
|
-
|
|
2515
|
-
// Creating a command to run the TypeScript compiler
|
|
2516
|
-
const command = Command.make("tsc", "--noEmit")
|
|
2517
|
-
console.log("Running tsc...")
|
|
2518
|
-
|
|
2519
|
-
// Executing the command and capturing the output
|
|
2520
|
-
const output = yield* _(executor.string(command))
|
|
2521
|
-
console.log(output)
|
|
2522
|
-
return output
|
|
2523
|
-
})
|
|
2524
|
-
|
|
2525
|
-
// Running the program with the necessary runtime and executor layers
|
|
2526
|
-
NodeRuntime.runMain(
|
|
2527
|
-
program.pipe(
|
|
2528
|
-
Effect.provide(NodeCommandExecutor.layer),
|
|
2529
|
-
Effect.provide(NodeFileSystem.layer)
|
|
2530
|
-
)
|
|
2531
|
-
)
|
|
2532
|
-
```
|
|
2533
|
-
|
|
2534
|
-
## Obtaining Information About the Running Process
|
|
2535
|
-
|
|
2536
|
-
Here, we'll explore how to retrieve information about a running process.
|
|
2537
|
-
|
|
2538
|
-
```ts
|
|
2539
|
-
import { Command, CommandExecutor } from "@effect/platform"
|
|
2540
|
-
import {
|
|
2541
|
-
NodeCommandExecutor,
|
|
2542
|
-
NodeFileSystem,
|
|
2543
|
-
NodeRuntime
|
|
2544
|
-
} from "@effect/platform-node"
|
|
2545
|
-
import { Effect, Stream, String } from "effect"
|
|
2546
|
-
|
|
2547
|
-
const runString = <E, R>(
|
|
2548
|
-
stream: Stream.Stream<Uint8Array, E, R>
|
|
2549
|
-
): Effect.Effect<string, E, R> =>
|
|
2550
|
-
stream.pipe(Stream.decodeText(), Stream.runFold(String.empty, String.concat))
|
|
2551
|
-
|
|
2552
|
-
const program = Effect.gen(function* (_) {
|
|
2553
|
-
const executor = yield* _(CommandExecutor.CommandExecutor)
|
|
2554
|
-
|
|
2555
|
-
const command = Command.make("ls")
|
|
2556
|
-
|
|
2557
|
-
const [exitCode, stdout, stderr] = yield* _(
|
|
2558
|
-
// Start running the command and return a handle to the running process.
|
|
2559
|
-
executor.start(command),
|
|
2560
|
-
Effect.flatMap((process) =>
|
|
2561
|
-
Effect.all(
|
|
2562
|
-
[
|
|
2563
|
-
// Waits for the process to exit and returns the ExitCode of the command that was run.
|
|
2564
|
-
process.exitCode,
|
|
2565
|
-
// The standard output stream of the process.
|
|
2566
|
-
runString(process.stdout),
|
|
2567
|
-
// The standard error stream of the process.
|
|
2568
|
-
runString(process.stderr)
|
|
2569
|
-
],
|
|
2570
|
-
{ concurrency: 3 }
|
|
2571
|
-
)
|
|
2572
|
-
)
|
|
2573
|
-
)
|
|
2574
|
-
console.log({ exitCode, stdout, stderr })
|
|
2575
|
-
})
|
|
2576
|
-
|
|
2577
|
-
NodeRuntime.runMain(
|
|
2578
|
-
Effect.scoped(program).pipe(
|
|
2579
|
-
Effect.provide(NodeCommandExecutor.layer),
|
|
2580
|
-
Effect.provide(NodeFileSystem.layer)
|
|
2581
|
-
)
|
|
2582
|
-
)
|
|
2583
|
-
```
|
|
2584
|
-
|
|
2585
|
-
## Running a Platform Command with stdout Streamed to process.stdout
|
|
2586
|
-
|
|
2587
|
-
To run a command (for example `cat`) and stream its `stdout` to `process.stdout` follow these steps:
|
|
2588
|
-
|
|
2589
|
-
```ts
|
|
2590
|
-
import { Command } from "@effect/platform"
|
|
2591
|
-
import { NodeContext, NodeRuntime } from "@effect/platform-node"
|
|
2592
|
-
import { Effect } from "effect"
|
|
2593
|
-
|
|
2594
|
-
// Create a command to run `cat` on a file and inherit stdout
|
|
2595
|
-
const program = Command.make("cat", "./some-file.txt").pipe(
|
|
2596
|
-
Command.stdout("inherit"),
|
|
2597
|
-
Command.exitCode
|
|
2598
|
-
)
|
|
2599
|
-
|
|
2600
|
-
// Run the command using NodeRuntime with the NodeContext layer
|
|
2601
|
-
NodeRuntime.runMain(program.pipe(Effect.provide(NodeContext.layer)))
|
|
2602
|
-
```
|
|
2603
|
-
|
|
2604
|
-
# FileSystem
|
|
2605
|
-
|
|
2606
|
-
The `@effect/platform/FileSystem` module provides a single `FileSystem` tag, which acts as the gateway for interacting with the filesystem.
|
|
2607
|
-
|
|
2608
|
-
Here's a list of operations that can be performed using the `FileSystem` tag:
|
|
2609
|
-
|
|
2610
|
-
| **Name** | **Arguments** | **Return** | **Description** |
|
|
2611
|
-
| --------------------------- | ---------------------------------------------------------------- | ---------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
2612
|
-
| **access** | `path: string`, `options?: AccessFileOptions` | `Effect<void, PlatformError>` | Check if a file can be accessed. You can optionally specify the level of access to check for. |
|
|
2613
|
-
| **copy** | `fromPath: string`, `toPath: string`, `options?: CopyOptions` | `Effect<void, PlatformError>` | Copy a file or directory from `fromPath` to `toPath`. Equivalent to `cp -r`. |
|
|
2614
|
-
| **copyFile** | `fromPath: string`, `toPath: string` | `Effect<void, PlatformError>` | Copy a file from `fromPath` to `toPath`. |
|
|
2615
|
-
| **chmod** | `path: string`, `mode: number` | `Effect<void, PlatformError>` | Change the permissions of a file. |
|
|
2616
|
-
| **chown** | `path: string`, `uid: number`, `gid: number` | `Effect<void, PlatformError>` | Change the owner and group of a file. |
|
|
2617
|
-
| **exists** | `path: string` | `Effect<boolean, PlatformError>` | Check if a path exists. |
|
|
2618
|
-
| **link** | `fromPath: string`, `toPath: string` | `Effect<void, PlatformError>` | Create a hard link from `fromPath` to `toPath`. |
|
|
2619
|
-
| **makeDirectory** | `path: string`, `options?: MakeDirectoryOptions` | `Effect<void, PlatformError>` | Create a directory at `path`. You can optionally specify the mode and whether to recursively create nested directories. |
|
|
2620
|
-
| **makeTempDirectory** | `options?: MakeTempDirectoryOptions` | `Effect<string, PlatformError>` | Create a temporary directory. By default, the directory will be created inside the system's default temporary directory. |
|
|
2621
|
-
| **makeTempDirectoryScoped** | `options?: MakeTempDirectoryOptions` | `Effect<string, PlatformError, Scope>` | Create a temporary directory inside a scope. Functionally equivalent to `makeTempDirectory`, but the directory will be automatically deleted when the scope is closed. |
|
|
2622
|
-
| **makeTempFile** | `options?: MakeTempFileOptions` | `Effect<string, PlatformError>` | Create a temporary file. The directory creation is functionally equivalent to `makeTempDirectory`. The file name will be a randomly generated string. |
|
|
2623
|
-
| **makeTempFileScoped** | `options?: MakeTempFileOptions` | `Effect<string, PlatformError, Scope>` | Create a temporary file inside a scope. Functionally equivalent to `makeTempFile`, but the file will be automatically deleted when the scope is closed. |
|
|
2624
|
-
| **open** | `path: string`, `options?: OpenFileOptions` | `Effect<File, PlatformError, Scope>` | Open a file at `path` with the specified `options`. The file handle will be automatically closed when the scope is closed. |
|
|
2625
|
-
| **readDirectory** | `path: string`, `options?: ReadDirectoryOptions` | `Effect<Array<string>, PlatformError>` | List the contents of a directory. You can recursively list the contents of nested directories by setting the `recursive` option. |
|
|
2626
|
-
| **readFile** | `path: string` | `Effect<Uint8Array, PlatformError>` | Read the contents of a file. |
|
|
2627
|
-
| **readFileString** | `path: string`, `encoding?: string` | `Effect<string, PlatformError>` | Read the contents of a file as a string. |
|
|
2628
|
-
| **readLink** | `path: string` | `Effect<string, PlatformError>` | Read the destination of a symbolic link. |
|
|
2629
|
-
| **realPath** | `path: string` | `Effect<string, PlatformError>` | Resolve a path to its canonicalized absolute pathname. |
|
|
2630
|
-
| **remove** | `path: string`, `options?: RemoveOptions` | `Effect<void, PlatformError>` | Remove a file or directory. By setting the `recursive` option to `true`, you can recursively remove nested directories. |
|
|
2631
|
-
| **rename** | `oldPath: string`, `newPath: string` | `Effect<void, PlatformError>` | Rename a file or directory. |
|
|
2632
|
-
| **sink** | `path: string`, `options?: SinkOptions` | `Sink<void, Uint8Array, never, PlatformError>` | Create a writable `Sink` for the specified `path`. |
|
|
2633
|
-
| **stat** | `path: string` | `Effect<File.Info, PlatformError>` | Get information about a file at `path`. |
|
|
2634
|
-
| **stream** | `path: string`, `options?: StreamOptions` | `Stream<Uint8Array, PlatformError>` | Create a readable `Stream` for the specified `path`. |
|
|
2635
|
-
| **symlink** | `fromPath: string`, `toPath: string` | `Effect<void, PlatformError>` | Create a symbolic link from `fromPath` to `toPath`. |
|
|
2636
|
-
| **truncate** | `path: string`, `length?: SizeInput` | `Effect<void, PlatformError>` | Truncate a file to a specified length. If the `length` is not specified, the file will be truncated to length `0`. |
|
|
2637
|
-
| **utimes** | `path: string`, `atime: Date \| number`, `mtime: Date \| number` | `Effect<void, PlatformError>` | Change the file system timestamps of the file at `path`. |
|
|
2638
|
-
| **watch** | `path: string` | `Stream<WatchEvent, PlatformError>` | Watch a directory or file for changes. |
|
|
2639
|
-
|
|
2640
|
-
Let's explore a simple example using `readFileString`:
|
|
2641
|
-
|
|
2642
|
-
```ts
|
|
2643
|
-
import { FileSystem } from "@effect/platform"
|
|
2644
|
-
import { NodeFileSystem, NodeRuntime } from "@effect/platform-node"
|
|
2645
|
-
import { Effect } from "effect"
|
|
2646
|
-
|
|
2647
|
-
// const readFileString: Effect.Effect<void, PlatformError, FileSystem.FileSystem>
|
|
2648
|
-
const readFileString = Effect.gen(function* (_) {
|
|
2649
|
-
const fs = yield* _(FileSystem.FileSystem)
|
|
2650
|
-
|
|
2651
|
-
// Reading the content of the same file where this code is written
|
|
2652
|
-
const content = yield* _(fs.readFileString("./index.ts", "utf8"))
|
|
2653
|
-
console.log(content)
|
|
2654
|
-
})
|
|
2655
|
-
|
|
2656
|
-
NodeRuntime.runMain(readFileString.pipe(Effect.provide(NodeFileSystem.layer)))
|
|
2657
|
-
```
|
|
2658
|
-
|
|
2659
|
-
# KeyValueStore
|
|
2660
|
-
|
|
2661
|
-
## Overview
|
|
2662
|
-
|
|
2663
|
-
The `KeyValueStore` module provides a robust and effectful interface for managing key-value pairs. It supports asynchronous operations, ensuring data integrity and consistency, and includes built-in implementations for in-memory, file system-based, and schema-validated stores.
|
|
2664
|
-
|
|
2665
|
-
## Basic Usage
|
|
2666
|
-
|
|
2667
|
-
The `KeyValueStore` interface includes the following operations:
|
|
2668
|
-
|
|
2669
|
-
- **get**: Retrieve a value by key.
|
|
2670
|
-
- **set**: Store a key-value pair.
|
|
2671
|
-
- **remove**: Delete a key-value pair.
|
|
2672
|
-
- **clear**: Remove all key-value pairs.
|
|
2673
|
-
- **size**: Get the number of stored pairs.
|
|
2674
|
-
- **modify**: Atomically modify a value.
|
|
2675
|
-
- **has**: Check if a key exists.
|
|
2676
|
-
- **isEmpty**: Check if the store is empty.
|
|
2677
|
-
|
|
2678
|
-
**Example**
|
|
2679
|
-
|
|
2680
|
-
```ts
|
|
2681
|
-
import { KeyValueStore, layerMemory } from "@effect/platform/KeyValueStore"
|
|
2682
|
-
import { Effect } from "effect"
|
|
2683
|
-
|
|
2684
|
-
const program = Effect.gen(function* () {
|
|
2685
|
-
const store = yield* KeyValueStore
|
|
2686
|
-
console.log(yield* store.size) // Outputs: 0
|
|
2687
|
-
|
|
2688
|
-
yield* store.set("key", "value")
|
|
2689
|
-
console.log(yield* store.size) // Outputs: 1
|
|
2690
|
-
|
|
2691
|
-
const value = yield* store.get("key")
|
|
2692
|
-
console.log(value) // Outputs: { _id: 'Option', _tag: 'Some', value: 'value' }
|
|
2693
|
-
|
|
2694
|
-
yield* store.remove("key")
|
|
2695
|
-
console.log(yield* store.size) // Outputs: 0
|
|
2696
|
-
})
|
|
2697
|
-
|
|
2698
|
-
Effect.runPromise(program.pipe(Effect.provide(layerMemory)))
|
|
2699
|
-
```
|
|
2700
|
-
|
|
2701
|
-
## Built-in Implementations
|
|
2702
|
-
|
|
2703
|
-
The module provides several built-in implementations to suit different needs:
|
|
2704
|
-
|
|
2705
|
-
- **In-Memory Store**: `layerMemory` provides a simple, in-memory key-value store, ideal for lightweight or testing scenarios.
|
|
2706
|
-
- **File System Store**: `layerFileSystem` offers a file-based store for persistent storage needs.
|
|
2707
|
-
- **Schema Store**: `layerSchema` enables schema-based validation for stored values, ensuring data integrity and type safety.
|
|
2708
|
-
|
|
2709
|
-
## Schema Store
|
|
2710
|
-
|
|
2711
|
-
The `SchemaStore` implementation allows you to validate and parse values according to a defined schema. This ensures that all data stored in the key-value store adheres to the specified structure, enhancing data integrity and type safety.
|
|
2712
|
-
|
|
2713
|
-
**Example**
|
|
2714
|
-
|
|
2715
|
-
```ts
|
|
2716
|
-
import { KeyValueStore, layerMemory } from "@effect/platform/KeyValueStore"
|
|
2717
|
-
import { Schema } from "@effect/schema"
|
|
2718
|
-
import { Effect } from "effect"
|
|
2719
|
-
|
|
2720
|
-
// Define a schema for the values
|
|
2721
|
-
const Person = Schema.Struct({
|
|
2722
|
-
name: Schema.String,
|
|
2723
|
-
age: Schema.Number
|
|
2724
|
-
})
|
|
2725
|
-
|
|
2726
|
-
const program = Effect.gen(function* () {
|
|
2727
|
-
const store = (yield* KeyValueStore).forSchema(Person)
|
|
2728
|
-
|
|
2729
|
-
// Create a value that adheres to the schema
|
|
2730
|
-
const value = { name: "Alice", age: 30 }
|
|
2731
|
-
yield* store.set("user1", value)
|
|
2732
|
-
console.log(yield* store.size) // Outputs: 1
|
|
2733
|
-
|
|
2734
|
-
// Retrieve and validate the value
|
|
2735
|
-
const retrievedValue = yield* store.get("user1")
|
|
2736
|
-
console.log(retrievedValue) // Outputs: { _id: 'Option', _tag: 'Some', value: { name: 'Alice', age: 30 } }
|
|
2737
|
-
})
|
|
2738
|
-
|
|
2739
|
-
Effect.runPromise(program.pipe(Effect.provide(layerMemory)))
|
|
2740
|
-
```
|
|
2741
|
-
|
|
2742
|
-
In this example:
|
|
2743
|
-
|
|
2744
|
-
- **Person**: Defines the structure for the values stored in the key-value store.
|
|
2745
|
-
- **store.set**: Stores a value adhering to `Person`.
|
|
2746
|
-
- **store.get**: Retrieves and validates the stored value against `Person`.
|
package/dist/cjs/Command.js
CHANGED
|
@@ -44,9 +44,9 @@ const feed = exports.feed = internal.feed;
|
|
|
44
44
|
/**
|
|
45
45
|
* Flatten this command to a non-empty array of standard commands.
|
|
46
46
|
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
47
|
+
* For a `StandardCommand`, this simply returns a `1` element array
|
|
48
|
+
* For a `PipedCommand`, all commands in the pipe will be extracted out into
|
|
49
|
+
* a array from left to right
|
|
50
50
|
*
|
|
51
51
|
* @since 1.0.0
|
|
52
52
|
* @category combinators
|
package/dist/cjs/Command.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Command.js","names":["internal","_interopRequireWildcard","require","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","CommandTypeId","exports","isCommand","env","exitCode","feed","flatten","lines","make","pipeTo","runInShell","start","stream","streamLines","string","stderr","stdin","stdout","workingDirectory"],"sources":["../../src/Command.ts"],"sourcesContent":[null],"mappings":";;;;;;AAcA,IAAAA,QAAA,GAAAC,uBAAA,CAAAC,OAAA;AAAiD,SAAAC,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAH,wBAAAG,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,OAAAC,cAAA,CAAAC,IAAA,CAAAhB,CAAA,EAAAc,CAAA,SAAAG,CAAA,GAAAP,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAG,CAAA,KAAAA,CAAA,CAAAV,GAAA,IAAAU,CAAA,CAAAC,GAAA,IAAAP,MAAA,CAAAC,cAAA,CAAAJ,CAAA,EAAAM,CAAA,EAAAG,CAAA,IAAAT,CAAA,CAAAM,CAAA,IAAAd,CAAA,CAAAc,CAAA,YAAAN,CAAA,CAAAH,OAAA,GAAAL,CAAA,EAAAG,CAAA,IAAAA,CAAA,CAAAe,GAAA,CAAAlB,CAAA,EAAAQ,CAAA,GAAAA,CAAA;AAEjD;;;AAGO,MAAMW,aAAa,GAAAC,OAAA,CAAAD,aAAA,GAAkBvB,QAAQ,CAACuB,aAAa;AA6FlE;;;;;;;AAOO,MAAME,SAAS,GAAAD,OAAA,CAAAC,SAAA,GAAiCzB,QAAQ,CAACyB,SAAS;AAEzE;;;;;;AAMO,MAAMC,GAAG,GAAAF,OAAA,CAAAE,GAAA,GAGZ1B,QAAQ,CAAC0B,GAAG;AAEhB;;;;;;;AAOO,MAAMC,QAAQ,GAAAH,OAAA,CAAAG,QAAA,GAAwE3B,QAAQ,CAAC2B,QAAQ;AAE9G;;;;;;AAMO,MAAMC,IAAI,GAAAJ,OAAA,CAAAI,IAAA,GAGb5B,QAAQ,CAAC4B,IAAI;AAEjB;;;;;;;;;;AAUO,MAAMC,OAAO,GAAAL,OAAA,CAAAK,OAAA,GAA8D7B,QAAQ,CAAC6B,OAAO;AAElG;;;;;;;AAOO,MAAMC,KAAK,GAAAN,OAAA,CAAAM,KAAA,
|
|
1
|
+
{"version":3,"file":"Command.js","names":["internal","_interopRequireWildcard","require","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","CommandTypeId","exports","isCommand","env","exitCode","feed","flatten","lines","make","pipeTo","runInShell","start","stream","streamLines","string","stderr","stdin","stdout","workingDirectory"],"sources":["../../src/Command.ts"],"sourcesContent":[null],"mappings":";;;;;;AAcA,IAAAA,QAAA,GAAAC,uBAAA,CAAAC,OAAA;AAAiD,SAAAC,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAH,wBAAAG,CAAA,EAAAE,CAAA,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,CAACyC,gBAAgB","ignoreList":[]}
|
|
@@ -200,10 +200,10 @@ const stdout = exports.stdout = /*#__PURE__*/(0, _Function.dual)(2, (self, outpu
|
|
|
200
200
|
const start = command => Effect.flatMap(commandExecutor.CommandExecutor, executor => executor.start(command));
|
|
201
201
|
/** @internal */
|
|
202
202
|
exports.start = start;
|
|
203
|
-
const stream = command => Stream.flatMap(commandExecutor.CommandExecutor,
|
|
203
|
+
const stream = command => Stream.flatMap(commandExecutor.CommandExecutor, executor => executor.stream(command));
|
|
204
204
|
/** @internal */
|
|
205
205
|
exports.stream = stream;
|
|
206
|
-
const streamLines = command => Stream.flatMap(commandExecutor.CommandExecutor,
|
|
206
|
+
const streamLines = (command, encoding) => Stream.flatMap(commandExecutor.CommandExecutor, executor => executor.streamLines(command, encoding));
|
|
207
207
|
/** @internal */
|
|
208
208
|
exports.streamLines = streamLines;
|
|
209
209
|
const string = exports.string = /*#__PURE__*/(0, _Function.dual)(args => isCommand(args[0]), (command, encoding) => Effect.flatMap(commandExecutor.CommandExecutor, executor => executor.string(command, encoding)));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.js","names":["Chunk","_interopRequireWildcard","require","Effect","_Function","HashMap","Inspectable","Option","_Pipeable","Stream","commandExecutor","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","CommandTypeId","exports","Symbol","for","isCommand","env","dual","self","environment","_tag","makeStandard","union","fromIterable","entries","filter","v","undefined","pipeTo","left","right","exitCode","flatMap","CommandExecutor","executor","feed","input","stdin","fromChunk","of","TextEncoder","encode","flatten","Array","from","flattenLoop","appendAll","runInShell","shell","lines","command","encoding","Proto","pipe","pipeArguments","arguments","BaseProto","StandardProto","toJSON","_id","args","fromEntries","cwd","gid","uid","options","assign","create","PipedProto","makePiped","make","empty","none","stdout","stderr","into","output","start","stream","
|
|
1
|
+
{"version":3,"file":"command.js","names":["Chunk","_interopRequireWildcard","require","Effect","_Function","HashMap","Inspectable","Option","_Pipeable","Stream","commandExecutor","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","CommandTypeId","exports","Symbol","for","isCommand","env","dual","self","environment","_tag","makeStandard","union","fromIterable","entries","filter","v","undefined","pipeTo","left","right","exitCode","flatMap","CommandExecutor","executor","feed","input","stdin","fromChunk","of","TextEncoder","encode","flatten","Array","from","flattenLoop","appendAll","runInShell","shell","lines","command","encoding","Proto","pipe","pipeArguments","arguments","BaseProto","StandardProto","toJSON","_id","args","fromEntries","cwd","gid","uid","options","assign","create","PipedProto","makePiped","make","empty","none","stdout","stderr","into","output","start","stream","streamLines","string","workingDirectory","some"],"sources":["../../../src/internal/command.ts"],"sourcesContent":[null],"mappings":";;;;;;AACA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAF,uBAAA,CAAAC,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAJ,uBAAA,CAAAC,OAAA;AACA,IAAAI,WAAA,GAAAL,uBAAA,CAAAC,OAAA;AACA,IAAAK,MAAA,GAAAN,uBAAA,CAAAC,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AAEA,IAAAO,MAAA,GAAAR,uBAAA,CAAAC,OAAA;AAIA,IAAAQ,eAAA,GAAAT,uBAAA,CAAAC,OAAA;AAAuD,SAAAS,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAX,wBAAAW,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAA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,MAAM,GAAApE,OAAA,CAAAoE,MAAA,gBAAG,IAAA/D,cAAI,EAMvB2C,IAAI,IAAK7C,SAAS,CAAC6C,IAAI,CAAC,CAAC,CAAC,CAAC,EAC5B,CAACV,OAAO,EAAEC,QAAQ,KAChBpE,MAAM,CAACiD,OAAO,CAAC1C,eAAe,CAAC2C,eAAe,EAAGC,QAAQ,IAAKA,QAAQ,CAAC8C,MAAM,CAAC9B,OAAO,EAAEC,QAAQ,CAAC,CAAC,CACpG;AAED;AACO,MAAM8B,gBAAgB,GAAArE,OAAA,CAAAqE,gBAAA,gBAGzB,IAAAhE,cAAI,EAGN,CAAC,EAAE,CAACC,IAAI,EAAE4C,GAAG,KAAI;EACjB,QAAQ5C,IAAI,CAACE,IAAI;IACf,KAAK,iBAAiB;MAAE;QACtB,OAAOC,YAAY,CAAC;UAAE,GAAGH,IAAI;UAAE4C,GAAG,EAAE3E,MAAM,CAAC+F,IAAI,CAACpB,GAAG;QAAC,CAAE,CAAC;MACzD;IACA,KAAK,cAAc;MAAE;QACnB,OAAOlC,MAAM,CAACqD,gBAAgB,CAAC/D,IAAI,CAACW,IAAI,EAAEiC,GAAG,CAAC,EAAEmB,gBAAgB,CAAC/D,IAAI,CAACY,KAAK,EAAEgC,GAAG,CAAC,CAAC;MACpF;EACF;AACF,CAAC,CAAC","ignoreList":[]}
|
package/dist/dts/Command.d.ts
CHANGED
|
@@ -139,9 +139,9 @@ export declare const feed: {
|
|
|
139
139
|
/**
|
|
140
140
|
* Flatten this command to a non-empty array of standard commands.
|
|
141
141
|
*
|
|
142
|
-
*
|
|
143
|
-
*
|
|
144
|
-
*
|
|
142
|
+
* For a `StandardCommand`, this simply returns a `1` element array
|
|
143
|
+
* For a `PipedCommand`, all commands in the pipe will be extracted out into
|
|
144
|
+
* a array from left to right
|
|
145
145
|
*
|
|
146
146
|
* @since 1.0.0
|
|
147
147
|
* @category combinators
|
|
@@ -211,7 +211,7 @@ export declare const stream: (command: Command) => Stream<Uint8Array, PlatformEr
|
|
|
211
211
|
* @since 1.0.0
|
|
212
212
|
* @category execution
|
|
213
213
|
*/
|
|
214
|
-
export declare const streamLines: (command: Command) => Stream<string, PlatformError, CommandExecutor>;
|
|
214
|
+
export declare const streamLines: (command: Command, encoding?: string) => Stream<string, PlatformError, CommandExecutor>;
|
|
215
215
|
/**
|
|
216
216
|
* Runs the command returning the entire output as a string with the
|
|
217
217
|
* specified encoding.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Command.d.ts","sourceRoot":"","sources":["../../src/Command.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAA;AACzD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,KAAK,EAAE,eAAe,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAC9E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAG/C;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,OAAO,MAA+B,CAAA;AAElE;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,OAAO,aAAa,CAAA;AAEhD;;;GAGG;AACH,MAAM,MAAM,OAAO,GAAG,eAAe,GAAG,YAAY,CAAA;AAEpD;;GAEG;AACH,MAAM,CA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,EAAE;IAClB,CAAC,KAAK,EAAE,OAAO,CAAC,KAAK,GAAG,CAAC,IAAI,EAAE,OAAO,KAAK,OAAO,CAAA;IAClD,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,GAAG,OAAO,CAAA;CAC9B,CAAA;AAElB;;;;;GAKG;AACH,eAAO,MAAM,MAAM,EAAE;IACnB,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,OAAO,KAAK,OAAO,CAAA;IACpD,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,GAAG,OAAO,CAAA;CAC/B,CAAA;AAEnB;;;;;;;;GAQG;AACH,eAAO,MAAM,gBAAgB,EAAE;IAC7B,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,IAAI,EAAE,OAAO,KAAK,OAAO,CAAA;IACzC,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACV,CAAA"}
|
package/dist/esm/Command.js
CHANGED
|
@@ -36,9 +36,9 @@ export const feed = internal.feed;
|
|
|
36
36
|
/**
|
|
37
37
|
* Flatten this command to a non-empty array of standard commands.
|
|
38
38
|
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
39
|
+
* For a `StandardCommand`, this simply returns a `1` element array
|
|
40
|
+
* For a `PipedCommand`, all commands in the pipe will be extracted out into
|
|
41
|
+
* a array from left to right
|
|
42
42
|
*
|
|
43
43
|
* @since 1.0.0
|
|
44
44
|
* @category combinators
|
package/dist/esm/Command.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Command.js","names":["internal","CommandTypeId","isCommand","env","exitCode","feed","flatten","lines","make","pipeTo","runInShell","start","stream","streamLines","string","stderr","stdin","stdout","workingDirectory"],"sources":["../../src/Command.ts"],"sourcesContent":[null],"mappings":"AAcA,OAAO,KAAKA,QAAQ,MAAM,uBAAuB;AAEjD;;;AAGA,OAAO,MAAMC,aAAa,GAAkBD,QAAQ,CAACC,aAAa;AA6FlE;;;;;;;AAOA,OAAO,MAAMC,SAAS,GAAiCF,QAAQ,CAACE,SAAS;AAEzE;;;;;;AAMA,OAAO,MAAMC,GAAG,GAGZH,QAAQ,CAACG,GAAG;AAEhB;;;;;;;AAOA,OAAO,MAAMC,QAAQ,GAAwEJ,QAAQ,CAACI,QAAQ;AAE9G;;;;;;AAMA,OAAO,MAAMC,IAAI,GAGbL,QAAQ,CAACK,IAAI;AAEjB;;;;;;;;;;AAUA,OAAO,MAAMC,OAAO,GAA8DN,QAAQ,CAACM,OAAO;AAElG;;;;;;;AAOA,OAAO,MAAMC,KAAK,
|
|
1
|
+
{"version":3,"file":"Command.js","names":["internal","CommandTypeId","isCommand","env","exitCode","feed","flatten","lines","make","pipeTo","runInShell","start","stream","streamLines","string","stderr","stdin","stdout","workingDirectory"],"sources":["../../src/Command.ts"],"sourcesContent":[null],"mappings":"AAcA,OAAO,KAAKA,QAAQ,MAAM,uBAAuB;AAEjD;;;AAGA,OAAO,MAAMC,aAAa,GAAkBD,QAAQ,CAACC,aAAa;AA6FlE;;;;;;;AAOA,OAAO,MAAMC,SAAS,GAAiCF,QAAQ,CAACE,SAAS;AAEzE;;;;;;AAMA,OAAO,MAAMC,GAAG,GAGZH,QAAQ,CAACG,GAAG;AAEhB;;;;;;;AAOA,OAAO,MAAMC,QAAQ,GAAwEJ,QAAQ,CAACI,QAAQ;AAE9G;;;;;;AAMA,OAAO,MAAMC,IAAI,GAGbL,QAAQ,CAACK,IAAI;AAEjB;;;;;;;;;;AAUA,OAAO,MAAMC,OAAO,GAA8DN,QAAQ,CAACM,OAAO;AAElG;;;;;;;AAOA,OAAO,MAAMC,KAAK,GAChBP,QAAQ,CAACO,KAAK;AAEhB;;;;;;;AAOA,OAAO,MAAMC,IAAI,GAAyDR,QAAQ,CAACQ,IAAI;AAEvF;;;;;;;;;;;;AAYA,OAAO,MAAMC,MAAM,GAGfT,QAAQ,CAACS,MAAM;AAEnB;;;;;;;AAOA,OAAO,MAAMC,UAAU,GAGnBV,QAAQ,CAACU,UAAU;AAEvB;;;;;;AAMA,OAAO,MAAMC,KAAK,GAAkFX,QAAQ,CAACW,KAAK;AAElH;;;;;;AAMA,OAAO,MAAMC,MAAM,GAA6EZ,QAAQ,CAACY,MAAM;AAE/G;;;;;;;AAOA,OAAO,MAAMC,WAAW,GACtBb,QAAQ,CAACa,WAAW;AAEtB;;;;;;;;;AASA,OAAO,MAAMC,MAAM,GAGfd,QAAQ,CAACc,MAAM;AAEnB;;;;;;AAMA,OAAO,MAAMC,MAAM,GAGff,QAAQ,CAACe,MAAM;AAEnB;;;;;;AAMA,OAAO,MAAMC,KAAK,GAGdhB,QAAQ,CAACgB,KAAK;AAElB;;;;;;AAMA,OAAO,MAAMC,MAAM,GAGfjB,QAAQ,CAACiB,MAAM;AAEnB;;;;;;;;;AASA,OAAO,MAAMC,gBAAgB,GAGzBlB,QAAQ,CAACkB,gBAAgB","ignoreList":[]}
|
|
@@ -186,9 +186,9 @@ export const stdout = /*#__PURE__*/dual(2, (self, output) => {
|
|
|
186
186
|
/** @internal */
|
|
187
187
|
export const start = command => Effect.flatMap(commandExecutor.CommandExecutor, executor => executor.start(command));
|
|
188
188
|
/** @internal */
|
|
189
|
-
export const stream = command => Stream.flatMap(commandExecutor.CommandExecutor,
|
|
189
|
+
export const stream = command => Stream.flatMap(commandExecutor.CommandExecutor, executor => executor.stream(command));
|
|
190
190
|
/** @internal */
|
|
191
|
-
export const streamLines = command => Stream.flatMap(commandExecutor.CommandExecutor,
|
|
191
|
+
export const streamLines = (command, encoding) => Stream.flatMap(commandExecutor.CommandExecutor, executor => executor.streamLines(command, encoding));
|
|
192
192
|
/** @internal */
|
|
193
193
|
export const string = /*#__PURE__*/dual(args => isCommand(args[0]), (command, encoding) => Effect.flatMap(commandExecutor.CommandExecutor, executor => executor.string(command, encoding)));
|
|
194
194
|
/** @internal */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.js","names":["Chunk","Effect","dual","HashMap","Inspectable","Option","pipeArguments","Stream","commandExecutor","CommandTypeId","Symbol","for","isCommand","u","env","self","environment","_tag","makeStandard","union","fromIterable","Object","entries","filter","v","undefined","pipeTo","left","right","exitCode","flatMap","CommandExecutor","executor","feed","input","stdin","fromChunk","of","TextEncoder","encode","flatten","Array","from","flattenLoop","appendAll","runInShell","shell","lines","command","encoding","Proto","pipe","arguments","BaseProto","StandardProto","toJSON","_id","args","fromEntries","cwd","gid","uid","options","assign","create","PipedProto","makePiped","make","empty","none","stdout","stderr","into","output","start","stream","
|
|
1
|
+
{"version":3,"file":"command.js","names":["Chunk","Effect","dual","HashMap","Inspectable","Option","pipeArguments","Stream","commandExecutor","CommandTypeId","Symbol","for","isCommand","u","env","self","environment","_tag","makeStandard","union","fromIterable","Object","entries","filter","v","undefined","pipeTo","left","right","exitCode","flatMap","CommandExecutor","executor","feed","input","stdin","fromChunk","of","TextEncoder","encode","flatten","Array","from","flattenLoop","appendAll","runInShell","shell","lines","command","encoding","Proto","pipe","arguments","BaseProto","StandardProto","toJSON","_id","args","fromEntries","cwd","gid","uid","options","assign","create","PipedProto","makePiped","make","empty","none","stdout","stderr","into","output","start","stream","streamLines","string","workingDirectory","some"],"sources":["../../../src/internal/command.ts"],"sourcesContent":[null],"mappings":"AACA,OAAO,KAAKA,KAAK,MAAM,cAAc;AACrC,OAAO,KAAKC,MAAM,MAAM,eAAe;AACvC,SAASC,IAAI,QAAQ,iBAAiB;AACtC,OAAO,KAAKC,OAAO,MAAM,gBAAgB;AACzC,OAAO,KAAKC,WAAW,MAAM,oBAAoB;AACjD,OAAO,KAAKC,MAAM,MAAM,eAAe;AACvC,SAASC,aAAa,QAAQ,iBAAiB;AAE/C,OAAO,KAAKC,MAAM,MAAM,eAAe;AAIvC,OAAO,KAAKC,eAAe,MAAM,sBAAsB;AAEvD;AACA,OAAO,MAAMC,aAAa,gB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ACT,OAAO,EAAEC,QAAQ,KAChBhD,MAAM,CAAC6B,OAAO,CAACtB,eAAe,CAACuB,eAAe,EAAGC,QAAQ,IAAKA,QAAQ,CAAC6C,MAAM,CAAC7B,OAAO,EAAEC,QAAQ,CAAC,CAAC,CACpG;AAED;AACA,OAAO,MAAM6B,gBAAgB,gBAGzB5E,IAAI,CAGN,CAAC,EAAE,CAACa,IAAI,EAAE4C,GAAG,KAAI;EACjB,QAAQ5C,IAAI,CAACE,IAAI;IACf,KAAK,iBAAiB;MAAE;QACtB,OAAOC,YAAY,CAAC;UAAE,GAAGH,IAAI;UAAE4C,GAAG,EAAEtD,MAAM,CAAC0E,IAAI,CAACpB,GAAG;QAAC,CAAE,CAAC;MACzD;IACA,KAAK,cAAc;MAAE;QACnB,OAAOjC,MAAM,CAACoD,gBAAgB,CAAC/D,IAAI,CAACY,IAAI,EAAEgC,GAAG,CAAC,EAAEmB,gBAAgB,CAAC/D,IAAI,CAACa,KAAK,EAAE+B,GAAG,CAAC,CAAC;MACpF;EACF;AACF,CAAC,CAAC","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@effect/platform",
|
|
3
|
-
"version": "0.64.
|
|
3
|
+
"version": "0.64.1",
|
|
4
4
|
"description": "Unified interfaces for common platform-specific services",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
"multipasta": "^0.2.5"
|
|
15
15
|
},
|
|
16
16
|
"peerDependencies": {
|
|
17
|
-
"@effect/schema": "^0.72.
|
|
18
|
-
"effect": "^3.7.
|
|
17
|
+
"@effect/schema": "^0.72.4",
|
|
18
|
+
"effect": "^3.7.3"
|
|
19
19
|
},
|
|
20
20
|
"publishConfig": {
|
|
21
21
|
"provenance": true
|
package/src/Command.ts
CHANGED
|
@@ -153,9 +153,9 @@ export const feed: {
|
|
|
153
153
|
/**
|
|
154
154
|
* Flatten this command to a non-empty array of standard commands.
|
|
155
155
|
*
|
|
156
|
-
*
|
|
157
|
-
*
|
|
158
|
-
*
|
|
156
|
+
* For a `StandardCommand`, this simply returns a `1` element array
|
|
157
|
+
* For a `PipedCommand`, all commands in the pipe will be extracted out into
|
|
158
|
+
* a array from left to right
|
|
159
159
|
*
|
|
160
160
|
* @since 1.0.0
|
|
161
161
|
* @category combinators
|
|
@@ -169,10 +169,8 @@ export const flatten: (self: Command) => NonEmptyReadonlyArray<StandardCommand>
|
|
|
169
169
|
* @since 1.0.0
|
|
170
170
|
* @category execution
|
|
171
171
|
*/
|
|
172
|
-
export const lines: (
|
|
173
|
-
|
|
174
|
-
encoding?: string
|
|
175
|
-
) => Effect<Array<string>, PlatformError, CommandExecutor> = internal.lines
|
|
172
|
+
export const lines: (command: Command, encoding?: string) => Effect<Array<string>, PlatformError, CommandExecutor> =
|
|
173
|
+
internal.lines
|
|
176
174
|
|
|
177
175
|
/**
|
|
178
176
|
* Create a command with the specified process name and an optional list of
|
|
@@ -235,7 +233,8 @@ export const stream: (command: Command) => Stream<Uint8Array, PlatformError, Com
|
|
|
235
233
|
* @since 1.0.0
|
|
236
234
|
* @category execution
|
|
237
235
|
*/
|
|
238
|
-
export const streamLines: (command: Command) => Stream<string, PlatformError, CommandExecutor> =
|
|
236
|
+
export const streamLines: (command: Command, encoding?: string) => Stream<string, PlatformError, CommandExecutor> =
|
|
237
|
+
internal.streamLines
|
|
239
238
|
|
|
240
239
|
/**
|
|
241
240
|
* Runs the command returning the entire output as a string with the
|
package/src/internal/command.ts
CHANGED
|
@@ -241,13 +241,14 @@ export const start = (
|
|
|
241
241
|
export const stream = (
|
|
242
242
|
command: Command.Command
|
|
243
243
|
): Stream.Stream<Uint8Array, PlatformError, CommandExecutor.CommandExecutor> =>
|
|
244
|
-
Stream.flatMap(commandExecutor.CommandExecutor, (
|
|
244
|
+
Stream.flatMap(commandExecutor.CommandExecutor, (executor) => executor.stream(command))
|
|
245
245
|
|
|
246
246
|
/** @internal */
|
|
247
247
|
export const streamLines = (
|
|
248
|
-
command: Command.Command
|
|
248
|
+
command: Command.Command,
|
|
249
|
+
encoding?: string
|
|
249
250
|
): Stream.Stream<string, PlatformError, CommandExecutor.CommandExecutor> =>
|
|
250
|
-
Stream.flatMap(commandExecutor.CommandExecutor, (
|
|
251
|
+
Stream.flatMap(commandExecutor.CommandExecutor, (executor) => executor.streamLines(command, encoding))
|
|
251
252
|
|
|
252
253
|
/** @internal */
|
|
253
254
|
export const string = dual<
|