effect 3.5.8 → 3.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/DateTime/package.json +6 -0
- package/dist/cjs/Context.js.map +1 -1
- package/dist/cjs/DateTime.js +1514 -0
- package/dist/cjs/DateTime.js.map +1 -0
- package/dist/cjs/Effect.js +3 -3
- package/dist/cjs/Effect.js.map +1 -1
- package/dist/cjs/Either.js +3 -3
- package/dist/cjs/List.js.map +1 -1
- package/dist/cjs/Metric.js.map +1 -1
- package/dist/cjs/Micro.js +93 -41
- package/dist/cjs/Micro.js.map +1 -1
- package/dist/cjs/Option.js +3 -3
- package/dist/cjs/Predicate.js +8 -0
- package/dist/cjs/Predicate.js.map +1 -1
- package/dist/cjs/Random.js +16 -1
- package/dist/cjs/Random.js.map +1 -1
- package/dist/cjs/Stream.js +86 -7
- package/dist/cjs/Stream.js.map +1 -1
- package/dist/cjs/Struct.js +23 -1
- package/dist/cjs/Struct.js.map +1 -1
- package/dist/cjs/index.js +4 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/internal/configProvider.js.map +1 -1
- package/dist/cjs/internal/core.js +1 -1
- package/dist/cjs/internal/core.js.map +1 -1
- package/dist/cjs/internal/defaultServices.js +9 -2
- package/dist/cjs/internal/defaultServices.js.map +1 -1
- package/dist/cjs/internal/metric.js.map +1 -1
- package/dist/cjs/internal/stream/emit.js +73 -1
- package/dist/cjs/internal/stream/emit.js.map +1 -1
- package/dist/cjs/internal/stream.js +30 -22
- package/dist/cjs/internal/stream.js.map +1 -1
- package/dist/cjs/internal/version.js +1 -1
- package/dist/dts/ConfigProvider.d.ts +2 -2
- package/dist/dts/ConfigProvider.d.ts.map +1 -1
- package/dist/dts/Context.d.ts +3 -1
- package/dist/dts/Context.d.ts.map +1 -1
- package/dist/dts/DateTime.d.ts +1265 -0
- package/dist/dts/DateTime.d.ts.map +1 -0
- package/dist/dts/Effect.d.ts +18 -4
- package/dist/dts/Effect.d.ts.map +1 -1
- package/dist/dts/Either.d.ts +4 -4
- package/dist/dts/List.d.ts +2 -1
- package/dist/dts/List.d.ts.map +1 -1
- package/dist/dts/Metric.d.ts +1 -1
- package/dist/dts/Metric.d.ts.map +1 -1
- package/dist/dts/MetricRegistry.d.ts +1 -1
- package/dist/dts/MetricRegistry.d.ts.map +1 -1
- package/dist/dts/Micro.d.ts +60 -0
- package/dist/dts/Micro.d.ts.map +1 -1
- package/dist/dts/Option.d.ts +4 -4
- package/dist/dts/Predicate.d.ts +63 -2
- package/dist/dts/Predicate.d.ts.map +1 -1
- package/dist/dts/Random.d.ts +18 -0
- package/dist/dts/Random.d.ts.map +1 -1
- package/dist/dts/Stream.d.ts +95 -4
- package/dist/dts/Stream.d.ts.map +1 -1
- package/dist/dts/StreamEmit.d.ts +44 -0
- package/dist/dts/StreamEmit.d.ts.map +1 -1
- package/dist/dts/Struct.d.ts +21 -0
- package/dist/dts/Struct.d.ts.map +1 -1
- package/dist/dts/index.d.ts +4 -0
- package/dist/dts/index.d.ts.map +1 -1
- package/dist/dts/internal/core.d.ts.map +1 -1
- package/dist/dts/internal/defaultServices.d.ts.map +1 -1
- package/dist/dts/internal/stream.d.ts.map +1 -1
- package/dist/esm/Context.js.map +1 -1
- package/dist/esm/DateTime.js +1465 -0
- package/dist/esm/DateTime.js.map +1 -0
- package/dist/esm/Effect.js +4 -4
- package/dist/esm/Effect.js.map +1 -1
- package/dist/esm/Either.js +4 -4
- package/dist/esm/List.js.map +1 -1
- package/dist/esm/Metric.js.map +1 -1
- package/dist/esm/Micro.js +88 -38
- package/dist/esm/Micro.js.map +1 -1
- package/dist/esm/Option.js +4 -4
- package/dist/esm/Predicate.js +8 -0
- package/dist/esm/Predicate.js.map +1 -1
- package/dist/esm/Random.js +15 -0
- package/dist/esm/Random.js.map +1 -1
- package/dist/esm/Stream.js +84 -5
- package/dist/esm/Stream.js.map +1 -1
- package/dist/esm/Struct.js +21 -0
- package/dist/esm/Struct.js.map +1 -1
- package/dist/esm/index.js +4 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/internal/configProvider.js.map +1 -1
- package/dist/esm/internal/core.js +1 -1
- package/dist/esm/internal/core.js.map +1 -1
- package/dist/esm/internal/defaultServices.js +6 -0
- package/dist/esm/internal/defaultServices.js.map +1 -1
- package/dist/esm/internal/metric.js.map +1 -1
- package/dist/esm/internal/stream/emit.js +71 -0
- package/dist/esm/internal/stream/emit.js.map +1 -1
- package/dist/esm/internal/stream.js +24 -18
- package/dist/esm/internal/stream.js.map +1 -1
- package/dist/esm/internal/version.js +1 -1
- package/package.json +9 -1
- package/src/ConfigProvider.ts +2 -2
- package/src/Context.ts +3 -1
- package/src/DateTime.ts +2104 -0
- package/src/Effect.ts +28 -4
- package/src/Either.ts +4 -4
- package/src/List.ts +3 -2
- package/src/Metric.ts +1 -1
- package/src/MetricRegistry.ts +1 -1
- package/src/Micro.ts +117 -45
- package/src/Option.ts +4 -4
- package/src/Predicate.ts +68 -8
- package/src/Random.ts +24 -0
- package/src/Stream.ts +110 -5
- package/src/StreamEmit.ts +53 -0
- package/src/Struct.ts +22 -0
- package/src/index.ts +5 -0
- package/src/internal/configProvider.ts +20 -20
- package/src/internal/core.ts +37 -12
- package/src/internal/defaultServices.ts +14 -0
- package/src/internal/metric/registry.ts +1 -1
- package/src/internal/metric.ts +2 -2
- package/src/internal/stream/emit.ts +77 -0
- package/src/internal/stream.ts +86 -18
- package/src/internal/version.ts +1 -1
package/dist/dts/Stream.d.ts
CHANGED
|
@@ -322,6 +322,44 @@ export declare const asyncEffect: <A, E = never, R = never>(register: (emit: Emi
|
|
|
322
322
|
readonly bufferSize?: number | undefined;
|
|
323
323
|
readonly strategy?: "dropping" | "sliding" | "suspend" | undefined;
|
|
324
324
|
} | undefined) => Stream<A, E, R>;
|
|
325
|
+
/**
|
|
326
|
+
* Creates a stream from an external push-based resource.
|
|
327
|
+
*
|
|
328
|
+
* You can use the `emit` helper to emit values to the stream. The `emit` helper
|
|
329
|
+
* returns a boolean indicating whether the value was emitted or not.
|
|
330
|
+
*
|
|
331
|
+
* You can also use the `emit` helper to signal the end of the stream by
|
|
332
|
+
* using apis such as `emit.end` or `emit.fail`.
|
|
333
|
+
*
|
|
334
|
+
* By default it uses an "unbounded" buffer size.
|
|
335
|
+
* You can customize the buffer size and strategy by passing an object as the
|
|
336
|
+
* second argument with the `bufferSize` and `strategy` fields.
|
|
337
|
+
*
|
|
338
|
+
* @example
|
|
339
|
+
* import { Effect, Stream } from "effect"
|
|
340
|
+
*
|
|
341
|
+
* Stream.asyncPush<string>((emit) =>
|
|
342
|
+
* Effect.acquireRelease(
|
|
343
|
+
* Effect.gen(function*() {
|
|
344
|
+
* yield* Effect.log("subscribing")
|
|
345
|
+
* return setInterval(() => emit.single("tick"), 1000)
|
|
346
|
+
* }),
|
|
347
|
+
* (handle) =>
|
|
348
|
+
* Effect.gen(function*() {
|
|
349
|
+
* yield* Effect.log("unsubscribing")
|
|
350
|
+
* clearInterval(handle)
|
|
351
|
+
* })
|
|
352
|
+
* ), { bufferSize: 16, strategy: "dropping" })
|
|
353
|
+
*
|
|
354
|
+
* @since 3.6.0
|
|
355
|
+
* @category constructors
|
|
356
|
+
*/
|
|
357
|
+
export declare const asyncPush: <A, E = never, R = never>(register: (emit: Emit.EmitOpsPush<E, A>) => Effect.Effect<unknown, never, R | Scope.Scope>, options?: {
|
|
358
|
+
readonly bufferSize: "unbounded";
|
|
359
|
+
} | {
|
|
360
|
+
readonly bufferSize?: number | undefined;
|
|
361
|
+
readonly strategy?: "dropping" | "sliding" | undefined;
|
|
362
|
+
} | undefined) => Stream<A, E, Exclude<R, Scope.Scope>>;
|
|
325
363
|
/**
|
|
326
364
|
* Creates a stream from an asynchronous callback that can be called multiple
|
|
327
365
|
* times. The registration of the callback itself returns an a scoped
|
|
@@ -2437,6 +2475,32 @@ export declare const mkString: <E, R>(self: Stream<string, E, R>) => Effect.Effe
|
|
|
2437
2475
|
* @category constructors
|
|
2438
2476
|
*/
|
|
2439
2477
|
export declare const never: Stream<never>;
|
|
2478
|
+
/**
|
|
2479
|
+
* Adds an effect to be executed at the end of the stream.
|
|
2480
|
+
*
|
|
2481
|
+
* @example
|
|
2482
|
+
* import { Console, Effect, Stream } from "effect"
|
|
2483
|
+
*
|
|
2484
|
+
* const stream = Stream.make(1, 2, 3).pipe(
|
|
2485
|
+
* Stream.map((n) => n * 2),
|
|
2486
|
+
* Stream.tap((n) => Console.log(`after mapping: ${n}`)),
|
|
2487
|
+
* Stream.onEnd(Console.log("Stream ended"))
|
|
2488
|
+
* )
|
|
2489
|
+
*
|
|
2490
|
+
* Effect.runPromise(Stream.runCollect(stream)).then(console.log)
|
|
2491
|
+
* // after mapping: 2
|
|
2492
|
+
* // after mapping: 4
|
|
2493
|
+
* // after mapping: 6
|
|
2494
|
+
* // Stream ended
|
|
2495
|
+
* // { _id: 'Chunk', values: [ 2, 4, 6 ] }
|
|
2496
|
+
*
|
|
2497
|
+
* @since 3.6.0
|
|
2498
|
+
* @category sequencing
|
|
2499
|
+
*/
|
|
2500
|
+
export declare const onEnd: {
|
|
2501
|
+
<_, E2, R2>(effect: Effect.Effect<_, E2, R2>): <A, E, R>(self: Stream<A, E, R>) => Stream<A, E2 | E, R2 | R>;
|
|
2502
|
+
<A, E, R, _, E2, R2>(self: Stream<A, E, R>, effect: Effect.Effect<_, E2, R2>): Stream<A, E | E2, R | R2>;
|
|
2503
|
+
};
|
|
2440
2504
|
/**
|
|
2441
2505
|
* Runs the specified effect if this stream fails, providing the error to the
|
|
2442
2506
|
* effect if it exists.
|
|
@@ -2461,6 +2525,32 @@ export declare const onDone: {
|
|
|
2461
2525
|
<X, R2>(cleanup: () => Effect.Effect<X, never, R2>): <A, E, R>(self: Stream<A, E, R>) => Stream<A, E, R2 | R>;
|
|
2462
2526
|
<A, E, R, X, R2>(self: Stream<A, E, R>, cleanup: () => Effect.Effect<X, never, R2>): Stream<A, E, R | R2>;
|
|
2463
2527
|
};
|
|
2528
|
+
/**
|
|
2529
|
+
* Adds an effect to be executed at the start of the stream.
|
|
2530
|
+
*
|
|
2531
|
+
* @example
|
|
2532
|
+
* import { Console, Effect, Stream } from "effect"
|
|
2533
|
+
*
|
|
2534
|
+
* const stream = Stream.make(1, 2, 3).pipe(
|
|
2535
|
+
* Stream.onStart(Console.log("Stream started")),
|
|
2536
|
+
* Stream.map((n) => n * 2),
|
|
2537
|
+
* Stream.tap((n) => Console.log(`after mapping: ${n}`))
|
|
2538
|
+
* )
|
|
2539
|
+
*
|
|
2540
|
+
* // Effect.runPromise(Stream.runCollect(stream)).then(console.log)
|
|
2541
|
+
* // Stream started
|
|
2542
|
+
* // after mapping: 2
|
|
2543
|
+
* // after mapping: 4
|
|
2544
|
+
* // after mapping: 6
|
|
2545
|
+
* // { _id: 'Chunk', values: [ 2, 4, 6 ] }
|
|
2546
|
+
*
|
|
2547
|
+
* @since 3.6.0
|
|
2548
|
+
* @category sequencing
|
|
2549
|
+
*/
|
|
2550
|
+
export declare const onStart: {
|
|
2551
|
+
<_, E2, R2>(effect: Effect.Effect<_, E2, R2>): <A, E, R>(self: Stream<A, E, R>) => Stream<A, E2 | E, R2 | R>;
|
|
2552
|
+
<A, E, R, _, E2, R2>(self: Stream<A, E, R>, effect: Effect.Effect<_, E2, R2>): Stream<A, E | E2, R | R2>;
|
|
2553
|
+
};
|
|
2464
2554
|
/**
|
|
2465
2555
|
* Translates any failure into a stream termination, making the stream
|
|
2466
2556
|
* infallible and all failures unchecked.
|
|
@@ -4701,7 +4791,7 @@ export declare const zipWithPreviousAndNext: <A, E, R>(self: Stream<A, E, R>) =>
|
|
|
4701
4791
|
*/
|
|
4702
4792
|
export declare const zipWithIndex: <A, E, R>(self: Stream<A, E, R>) => Stream<[A, number], E, R>;
|
|
4703
4793
|
/**
|
|
4704
|
-
* The "do simulation" in allows you to write code in a more declarative style, similar to the "do notation" in other programming languages. It provides a way to define variables and perform operations on them using functions like `bind` and `let`.
|
|
4794
|
+
* The "do simulation" in Effect allows you to write code in a more declarative style, similar to the "do notation" in other programming languages. It provides a way to define variables and perform operations on them using functions like `bind` and `let`.
|
|
4705
4795
|
*
|
|
4706
4796
|
* Here's how the do simulation works:
|
|
4707
4797
|
*
|
|
@@ -4731,7 +4821,7 @@ export declare const zipWithIndex: <A, E, R>(self: Stream<A, E, R>) => Stream<[A
|
|
|
4731
4821
|
*/
|
|
4732
4822
|
export declare const Do: Stream<{}>;
|
|
4733
4823
|
/**
|
|
4734
|
-
* The "do simulation" in allows you to write code in a more declarative style, similar to the "do notation" in other programming languages. It provides a way to define variables and perform operations on them using functions like `bind` and `let`.
|
|
4824
|
+
* The "do simulation" in Effect allows you to write code in a more declarative style, similar to the "do notation" in other programming languages. It provides a way to define variables and perform operations on them using functions like `bind` and `let`.
|
|
4735
4825
|
*
|
|
4736
4826
|
* Here's how the do simulation works:
|
|
4737
4827
|
*
|
|
@@ -4799,7 +4889,7 @@ export declare const bindEffect: {
|
|
|
4799
4889
|
}, E | E2, R | R2>;
|
|
4800
4890
|
};
|
|
4801
4891
|
/**
|
|
4802
|
-
* The "do simulation" in allows you to write code in a more declarative style, similar to the "do notation" in other programming languages. It provides a way to define variables and perform operations on them using functions like `bind` and `let`.
|
|
4892
|
+
* The "do simulation" in Effect allows you to write code in a more declarative style, similar to the "do notation" in other programming languages. It provides a way to define variables and perform operations on them using functions like `bind` and `let`.
|
|
4803
4893
|
*
|
|
4804
4894
|
* Here's how the do simulation works:
|
|
4805
4895
|
*
|
|
@@ -4845,7 +4935,7 @@ declare const let_: {
|
|
|
4845
4935
|
};
|
|
4846
4936
|
export {
|
|
4847
4937
|
/**
|
|
4848
|
-
* The "do simulation" in allows you to write code in a more declarative style, similar to the "do notation" in other programming languages. It provides a way to define variables and perform operations on them using functions like `bind` and `let`.
|
|
4938
|
+
* The "do simulation" in Effect allows you to write code in a more declarative style, similar to the "do notation" in other programming languages. It provides a way to define variables and perform operations on them using functions like `bind` and `let`.
|
|
4849
4939
|
*
|
|
4850
4940
|
* Here's how the do simulation works:
|
|
4851
4941
|
*
|
|
@@ -4914,5 +5004,6 @@ export declare const fromEventListener: <A = unknown>(target: EventListener<A>,
|
|
|
4914
5004
|
readonly capture?: boolean;
|
|
4915
5005
|
readonly passive?: boolean;
|
|
4916
5006
|
readonly once?: boolean;
|
|
5007
|
+
readonly bufferSize?: number | "unbounded" | undefined;
|
|
4917
5008
|
} | undefined) => Stream<A>;
|
|
4918
5009
|
//# sourceMappingURL=Stream.d.ts.map
|