effect 4.0.0-beta.25 → 4.0.0-beta.27
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/dist/Cause.d.ts +1 -1
- package/dist/Config.js +4 -4
- package/dist/Config.js.map +1 -1
- package/dist/Data.d.ts +2 -2
- package/dist/Data.js +2 -2
- package/dist/Effect.d.ts +51 -35
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +16 -12
- package/dist/Effect.js.map +1 -1
- package/dist/ErrorReporter.d.ts +2 -4
- package/dist/ErrorReporter.d.ts.map +1 -1
- package/dist/ErrorReporter.js +1 -3
- package/dist/ErrorReporter.js.map +1 -1
- package/dist/Layer.d.ts +112 -117
- package/dist/Layer.d.ts.map +1 -1
- package/dist/Layer.js +43 -44
- package/dist/Layer.js.map +1 -1
- package/dist/LayerMap.d.ts +4 -4
- package/dist/LayerMap.js +3 -3
- package/dist/ManagedRuntime.d.ts +1 -1
- package/dist/ManagedRuntime.js +1 -1
- package/dist/Metric.d.ts +2 -4
- package/dist/Metric.d.ts.map +1 -1
- package/dist/Metric.js +2 -4
- package/dist/Metric.js.map +1 -1
- package/dist/Runtime.d.ts +66 -0
- package/dist/Runtime.d.ts.map +1 -1
- package/dist/Runtime.js +72 -5
- package/dist/Runtime.js.map +1 -1
- package/dist/Schedule.d.ts +36 -36
- package/dist/Schedule.js +14 -14
- package/dist/Schema.d.ts +15 -32
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +9 -17
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaAST.js +91 -2
- package/dist/SchemaAST.js.map +1 -1
- package/dist/SchemaGetter.d.ts +3 -3
- package/dist/SchemaRepresentation.d.ts.map +1 -1
- package/dist/SchemaRepresentation.js +12 -8
- package/dist/SchemaRepresentation.js.map +1 -1
- package/dist/Stdio.d.ts +10 -2
- package/dist/Stdio.d.ts.map +1 -1
- package/dist/Stdio.js +18 -0
- package/dist/Stdio.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/internal/schema/representation.js +7 -3
- package/dist/internal/schema/representation.js.map +1 -1
- package/dist/internal/schema/to-codec.js +7 -10
- package/dist/internal/schema/to-codec.js.map +1 -1
- package/dist/unstable/ai/AiError.d.ts +6 -3
- package/dist/unstable/ai/AiError.d.ts.map +1 -1
- package/dist/unstable/ai/AiError.js +8 -4
- package/dist/unstable/ai/AiError.js.map +1 -1
- package/dist/unstable/ai/LanguageModel.js +7 -5
- package/dist/unstable/ai/LanguageModel.js.map +1 -1
- package/dist/unstable/cli/CliError.d.ts +23 -56
- package/dist/unstable/cli/CliError.d.ts.map +1 -1
- package/dist/unstable/cli/CliError.js +25 -57
- package/dist/unstable/cli/CliError.js.map +1 -1
- package/dist/unstable/cli/Command.d.ts +117 -62
- package/dist/unstable/cli/Command.d.ts.map +1 -1
- package/dist/unstable/cli/Command.js +95 -32
- package/dist/unstable/cli/Command.js.map +1 -1
- package/dist/unstable/cli/GlobalFlag.d.ts +1 -1
- package/dist/unstable/cli/GlobalFlag.d.ts.map +1 -1
- package/dist/unstable/cli/Primitive.d.ts +1 -1
- package/dist/unstable/cli/Primitive.js +1 -1
- package/dist/unstable/cli/internal/command.d.ts +27 -10
- package/dist/unstable/cli/internal/command.d.ts.map +1 -1
- package/dist/unstable/cli/internal/command.js +40 -23
- package/dist/unstable/cli/internal/command.js.map +1 -1
- package/dist/unstable/cli/internal/config.js +42 -0
- package/dist/unstable/cli/internal/config.js.map +1 -1
- package/dist/unstable/cli/internal/help.d.ts +4 -4
- package/dist/unstable/cli/internal/help.d.ts.map +1 -1
- package/dist/unstable/cli/internal/help.js +25 -7
- package/dist/unstable/cli/internal/help.js.map +1 -1
- package/dist/unstable/cli/internal/parser.js +26 -6
- package/dist/unstable/cli/internal/parser.js.map +1 -1
- package/dist/unstable/http/Headers.d.ts +16 -0
- package/dist/unstable/http/Headers.d.ts.map +1 -1
- package/dist/unstable/http/Headers.js +11 -0
- package/dist/unstable/http/Headers.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.js +6 -7
- package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.d.ts +6 -6
- package/dist/unstable/httpapi/HttpApiClient.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiEndpoint.d.ts +10 -10
- package/dist/unstable/httpapi/HttpApiEndpoint.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiEndpoint.js +2 -2
- package/dist/unstable/httpapi/HttpApiEndpoint.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiError.d.ts +6 -15
- package/dist/unstable/httpapi/HttpApiError.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiError.js +16 -21
- package/dist/unstable/httpapi/HttpApiError.js.map +1 -1
- package/dist/unstable/reactivity/Atom.d.ts +56 -0
- package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
- package/dist/unstable/reactivity/Atom.js +66 -0
- package/dist/unstable/reactivity/Atom.js.map +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.d.ts +2 -2
- package/dist/unstable/reactivity/AtomHttpApi.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcServer.d.ts +3 -0
- package/dist/unstable/rpc/RpcServer.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcServer.js.map +1 -1
- package/dist/unstable/schema/Model.d.ts +21 -0
- package/dist/unstable/schema/Model.d.ts.map +1 -1
- package/dist/unstable/schema/Model.js +15 -0
- package/dist/unstable/schema/Model.js.map +1 -1
- package/dist/unstable/sql/SqlSchema.d.ts +2 -2
- package/dist/unstable/sql/SqlSchema.d.ts.map +1 -1
- package/dist/unstable/sql/SqlSchema.js.map +1 -1
- package/package.json +1 -1
- package/src/Cause.ts +1 -1
- package/src/Config.ts +4 -4
- package/src/Data.ts +2 -2
- package/src/Effect.ts +60 -31
- package/src/ErrorReporter.ts +2 -4
- package/src/Layer.ts +112 -117
- package/src/LayerMap.ts +4 -4
- package/src/ManagedRuntime.ts +1 -1
- package/src/Metric.ts +2 -4
- package/src/Runtime.ts +95 -5
- package/src/Schedule.ts +36 -36
- package/src/Schema.ts +20 -52
- package/src/SchemaAST.ts +127 -2
- package/src/SchemaGetter.ts +3 -3
- package/src/SchemaRepresentation.ts +12 -8
- package/src/Stdio.ts +21 -2
- package/src/index.ts +1 -1
- package/src/internal/schema/representation.ts +8 -4
- package/src/internal/schema/to-codec.ts +7 -17
- package/src/unstable/ai/AiError.ts +8 -4
- package/src/unstable/ai/LanguageModel.ts +8 -5
- package/src/unstable/cli/CliError.ts +47 -59
- package/src/unstable/cli/Command.ts +348 -180
- package/src/unstable/cli/GlobalFlag.ts +1 -1
- package/src/unstable/cli/Primitive.ts +1 -1
- package/src/unstable/cli/internal/command.ts +62 -32
- package/src/unstable/cli/internal/config.ts +49 -0
- package/src/unstable/cli/internal/help.ts +41 -16
- package/src/unstable/cli/internal/parser.ts +36 -10
- package/src/unstable/http/Headers.ts +34 -0
- package/src/unstable/httpapi/HttpApiBuilder.ts +4 -7
- package/src/unstable/httpapi/HttpApiClient.ts +6 -6
- package/src/unstable/httpapi/HttpApiEndpoint.ts +4 -4
- package/src/unstable/httpapi/HttpApiError.ts +23 -21
- package/src/unstable/reactivity/Atom.ts +132 -0
- package/src/unstable/reactivity/AtomHttpApi.ts +2 -2
- package/src/unstable/rpc/RpcServer.ts +5 -0
- package/src/unstable/schema/Model.ts +31 -0
- package/src/unstable/sql/SqlSchema.ts +2 -2
package/dist/Schedule.d.ts
CHANGED
|
@@ -31,7 +31,7 @@ declare const TypeId = "~effect/Schedule";
|
|
|
31
31
|
* const program = Effect.gen(function*() {
|
|
32
32
|
* // Using retry schedule
|
|
33
33
|
* const result1 = yield* Effect.retry(
|
|
34
|
-
* Effect.fail("temporary error"),
|
|
34
|
+
* Effect.suspend(() => Math.random() > 0.5 ? Effect.fail("temporary error") : Effect.succeed("Success")),
|
|
35
35
|
* retrySchedule
|
|
36
36
|
* )
|
|
37
37
|
*
|
|
@@ -143,7 +143,7 @@ export declare const CurrentMetadata: ServiceMap.Reference<Metadata<unknown, unk
|
|
|
143
143
|
* Effect.gen(function*() {
|
|
144
144
|
* attempt++
|
|
145
145
|
* if (attempt < 3) {
|
|
146
|
-
* yield* Effect.fail(`Attempt ${attempt} failed`)
|
|
146
|
+
* return yield* Effect.fail(`Attempt ${attempt} failed`)
|
|
147
147
|
* }
|
|
148
148
|
* return `Success on attempt ${attempt}`
|
|
149
149
|
* }),
|
|
@@ -463,7 +463,7 @@ export declare const toStepWithSleep: <Output, Input, Error, Env>(schedule: Sche
|
|
|
463
463
|
* Effect.gen(function*() {
|
|
464
464
|
* attempt++
|
|
465
465
|
* if (attempt < 5) {
|
|
466
|
-
* yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
466
|
+
* return yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
467
467
|
* }
|
|
468
468
|
* return `Success on attempt ${attempt}`
|
|
469
469
|
* }),
|
|
@@ -580,7 +580,7 @@ export declare const addDelay: {
|
|
|
580
580
|
* Effect.gen(function*() {
|
|
581
581
|
* attempt++
|
|
582
582
|
* if (attempt < 5) {
|
|
583
|
-
* yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
583
|
+
* return yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
584
584
|
* }
|
|
585
585
|
* return `Success on attempt ${attempt}`
|
|
586
586
|
* }),
|
|
@@ -697,7 +697,7 @@ export declare const addDelay: {
|
|
|
697
697
|
* Effect.gen(function*() {
|
|
698
698
|
* attempt++
|
|
699
699
|
* if (attempt < 5) {
|
|
700
|
-
* yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
700
|
+
* return yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
701
701
|
* }
|
|
702
702
|
* return `Success on attempt ${attempt}`
|
|
703
703
|
* }),
|
|
@@ -739,7 +739,7 @@ export declare const addDelay: {
|
|
|
739
739
|
* attempt++
|
|
740
740
|
* yield* Console.log(`Attempt ${attempt}`)
|
|
741
741
|
* if (attempt < 6) {
|
|
742
|
-
* yield* Effect.fail(new Error(`Failure ${attempt}`))
|
|
742
|
+
* return yield* Effect.fail(new Error(`Failure ${attempt}`))
|
|
743
743
|
* }
|
|
744
744
|
* return `Success on attempt ${attempt}`
|
|
745
745
|
* }),
|
|
@@ -778,7 +778,7 @@ export declare const andThen: {
|
|
|
778
778
|
* attempt++
|
|
779
779
|
* yield* Console.log(`Attempt ${attempt}`)
|
|
780
780
|
* if (attempt < 6) {
|
|
781
|
-
* yield* Effect.fail(new Error(`Failure ${attempt}`))
|
|
781
|
+
* return yield* Effect.fail(new Error(`Failure ${attempt}`))
|
|
782
782
|
* }
|
|
783
783
|
* return `Success on attempt ${attempt}`
|
|
784
784
|
* }),
|
|
@@ -817,7 +817,7 @@ export declare const andThen: {
|
|
|
817
817
|
* attempt++
|
|
818
818
|
* yield* Console.log(`Attempt ${attempt}`)
|
|
819
819
|
* if (attempt < 6) {
|
|
820
|
-
* yield* Effect.fail(new Error(`Failure ${attempt}`))
|
|
820
|
+
* return yield* Effect.fail(new Error(`Failure ${attempt}`))
|
|
821
821
|
* }
|
|
822
822
|
* return `Success on attempt ${attempt}`
|
|
823
823
|
* }),
|
|
@@ -1004,7 +1004,7 @@ export declare const andThenResult: {
|
|
|
1004
1004
|
* yield* Console.log(`Retry attempt ${attempt}`)
|
|
1005
1005
|
*
|
|
1006
1006
|
* if (attempt < 3) {
|
|
1007
|
-
* yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
1007
|
+
* return yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
1008
1008
|
* }
|
|
1009
1009
|
*
|
|
1010
1010
|
* return `Success on attempt ${attempt}`
|
|
@@ -1072,7 +1072,7 @@ export declare const both: {
|
|
|
1072
1072
|
* yield* Console.log(`Retry attempt ${attempt}`)
|
|
1073
1073
|
*
|
|
1074
1074
|
* if (attempt < 3) {
|
|
1075
|
-
* yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
1075
|
+
* return yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
1076
1076
|
* }
|
|
1077
1077
|
*
|
|
1078
1078
|
* return `Success on attempt ${attempt}`
|
|
@@ -1140,7 +1140,7 @@ export declare const both: {
|
|
|
1140
1140
|
* yield* Console.log(`Retry attempt ${attempt}`)
|
|
1141
1141
|
*
|
|
1142
1142
|
* if (attempt < 3) {
|
|
1143
|
-
* yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
1143
|
+
* return yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
1144
1144
|
* }
|
|
1145
1145
|
*
|
|
1146
1146
|
* return `Success on attempt ${attempt}`
|
|
@@ -1509,7 +1509,7 @@ export declare const bothWith: {
|
|
|
1509
1509
|
* yield* Console.log(`Attempt ${attempt}`)
|
|
1510
1510
|
*
|
|
1511
1511
|
* if (attempt < 7) { // Needs both phases to succeed
|
|
1512
|
-
* yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
1512
|
+
* return yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
1513
1513
|
* }
|
|
1514
1514
|
*
|
|
1515
1515
|
* return `Success on attempt ${attempt}`
|
|
@@ -1572,7 +1572,7 @@ export declare const compose: {
|
|
|
1572
1572
|
* yield* Console.log(`Attempt ${attempt}`)
|
|
1573
1573
|
*
|
|
1574
1574
|
* if (attempt < 7) { // Needs both phases to succeed
|
|
1575
|
-
* yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
1575
|
+
* return yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
1576
1576
|
* }
|
|
1577
1577
|
*
|
|
1578
1578
|
* return `Success on attempt ${attempt}`
|
|
@@ -1635,7 +1635,7 @@ export declare const compose: {
|
|
|
1635
1635
|
* yield* Console.log(`Attempt ${attempt}`)
|
|
1636
1636
|
*
|
|
1637
1637
|
* if (attempt < 7) { // Needs both phases to succeed
|
|
1638
|
-
* yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
1638
|
+
* return yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
1639
1639
|
* }
|
|
1640
1640
|
*
|
|
1641
1641
|
* return `Success on attempt ${attempt}`
|
|
@@ -2149,7 +2149,7 @@ export declare const collectWhile: {
|
|
|
2149
2149
|
* yield* Console.log("Complex scheduled task...")
|
|
2150
2150
|
* // Simulate occasional failures
|
|
2151
2151
|
* if (Math.random() < 0.3) {
|
|
2152
|
-
* yield* Effect.fail(new Error("Scheduled task failed"))
|
|
2152
|
+
* return yield* Effect.fail(new Error("Scheduled task failed"))
|
|
2153
2153
|
* }
|
|
2154
2154
|
* return "success"
|
|
2155
2155
|
* }),
|
|
@@ -2273,7 +2273,7 @@ export declare const cron: {
|
|
|
2273
2273
|
* yield* Console.log("Complex scheduled task...")
|
|
2274
2274
|
* // Simulate occasional failures
|
|
2275
2275
|
* if (Math.random() < 0.3) {
|
|
2276
|
-
* yield* Effect.fail(new Error("Scheduled task failed"))
|
|
2276
|
+
* return yield* Effect.fail(new Error("Scheduled task failed"))
|
|
2277
2277
|
* }
|
|
2278
2278
|
* return "success"
|
|
2279
2279
|
* }),
|
|
@@ -2397,7 +2397,7 @@ export declare const cron: {
|
|
|
2397
2397
|
* yield* Console.log("Complex scheduled task...")
|
|
2398
2398
|
* // Simulate occasional failures
|
|
2399
2399
|
* if (Math.random() < 0.3) {
|
|
2400
|
-
* yield* Effect.fail(new Error("Scheduled task failed"))
|
|
2400
|
+
* return yield* Effect.fail(new Error("Scheduled task failed"))
|
|
2401
2401
|
* }
|
|
2402
2402
|
* return "success"
|
|
2403
2403
|
* }),
|
|
@@ -2577,7 +2577,7 @@ export declare const duration: (durationInput: Duration.Input) => Schedule<Durat
|
|
|
2577
2577
|
* yield* Console.log(`Retry attempt ${attempt}`)
|
|
2578
2578
|
*
|
|
2579
2579
|
* if (Math.random() < 0.8) { // 80% failure rate
|
|
2580
|
-
* yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
2580
|
+
* return yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
2581
2581
|
* }
|
|
2582
2582
|
*
|
|
2583
2583
|
* return `Success on attempt ${attempt}`
|
|
@@ -2646,7 +2646,7 @@ export declare const during: (duration: Duration.Input) => Schedule<Duration.Dur
|
|
|
2646
2646
|
* yield* Console.log(`Retry attempt ${attempt}`)
|
|
2647
2647
|
*
|
|
2648
2648
|
* if (attempt < 6) {
|
|
2649
|
-
* yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
2649
|
+
* return yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
2650
2650
|
* }
|
|
2651
2651
|
*
|
|
2652
2652
|
* return `Success on attempt ${attempt}`
|
|
@@ -2716,7 +2716,7 @@ export declare const either: {
|
|
|
2716
2716
|
* yield* Console.log(`Retry attempt ${attempt}`)
|
|
2717
2717
|
*
|
|
2718
2718
|
* if (attempt < 6) {
|
|
2719
|
-
* yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
2719
|
+
* return yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
2720
2720
|
* }
|
|
2721
2721
|
*
|
|
2722
2722
|
* return `Success on attempt ${attempt}`
|
|
@@ -2786,7 +2786,7 @@ export declare const either: {
|
|
|
2786
2786
|
* yield* Console.log(`Retry attempt ${attempt}`)
|
|
2787
2787
|
*
|
|
2788
2788
|
* if (attempt < 6) {
|
|
2789
|
-
* yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
2789
|
+
* return yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
2790
2790
|
* }
|
|
2791
2791
|
*
|
|
2792
2792
|
* return `Success on attempt ${attempt}`
|
|
@@ -3199,7 +3199,7 @@ export declare const elapsed: Schedule<Duration.Duration>;
|
|
|
3199
3199
|
* attempt++
|
|
3200
3200
|
* if (attempt < 4) {
|
|
3201
3201
|
* yield* Console.log(`Attempt ${attempt} failed, retrying...`)
|
|
3202
|
-
* yield* Effect.fail(new Error(`Failure ${attempt}`))
|
|
3202
|
+
* return yield* Effect.fail(new Error(`Failure ${attempt}`))
|
|
3203
3203
|
* }
|
|
3204
3204
|
* return `Success on attempt ${attempt}`
|
|
3205
3205
|
* }),
|
|
@@ -3239,7 +3239,7 @@ export declare const exponential: (base: Duration.Input, factor?: number) => Sch
|
|
|
3239
3239
|
* yield* Console.log(`Attempt ${attempt}`)
|
|
3240
3240
|
*
|
|
3241
3241
|
* if (attempt < 5) {
|
|
3242
|
-
* yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
3242
|
+
* return yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
3243
3243
|
* }
|
|
3244
3244
|
*
|
|
3245
3245
|
* return `Success on attempt ${attempt}`
|
|
@@ -3693,7 +3693,7 @@ export declare const passthrough: <Output, Input, Error, Env>(self: Schedule<Out
|
|
|
3693
3693
|
* yield* Console.log(`Attempt ${attempt}`)
|
|
3694
3694
|
*
|
|
3695
3695
|
* if (attempt < 4) {
|
|
3696
|
-
* yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
3696
|
+
* return yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
3697
3697
|
* }
|
|
3698
3698
|
*
|
|
3699
3699
|
* return `Success on attempt ${attempt}`
|
|
@@ -4138,7 +4138,7 @@ export declare const spaced: (duration: Duration.Input) => Schedule<number>;
|
|
|
4138
4138
|
* Effect.gen(function*() {
|
|
4139
4139
|
* attempt++
|
|
4140
4140
|
* if (attempt < 4) {
|
|
4141
|
-
* yield* Effect.fail(new Error(`Network timeout on attempt ${attempt}`))
|
|
4141
|
+
* return yield* Effect.fail(new Error(`Network timeout on attempt ${attempt}`))
|
|
4142
4142
|
* }
|
|
4143
4143
|
* return `Success on attempt ${attempt}`
|
|
4144
4144
|
* }),
|
|
@@ -4209,7 +4209,7 @@ export declare const spaced: (duration: Duration.Input) => Schedule<number>;
|
|
|
4209
4209
|
* const errorType = isCritical
|
|
4210
4210
|
* ? "critical database failure"
|
|
4211
4211
|
* : "temporary network issue"
|
|
4212
|
-
* yield* Effect.fail(new Error(errorType))
|
|
4212
|
+
* return yield* Effect.fail(new Error(errorType))
|
|
4213
4213
|
* }),
|
|
4214
4214
|
* alertingSchedule
|
|
4215
4215
|
* ).pipe(
|
|
@@ -4261,7 +4261,7 @@ export declare const tapInput: {
|
|
|
4261
4261
|
* Effect.gen(function*() {
|
|
4262
4262
|
* attempt++
|
|
4263
4263
|
* if (attempt < 4) {
|
|
4264
|
-
* yield* Effect.fail(new Error(`Network timeout on attempt ${attempt}`))
|
|
4264
|
+
* return yield* Effect.fail(new Error(`Network timeout on attempt ${attempt}`))
|
|
4265
4265
|
* }
|
|
4266
4266
|
* return `Success on attempt ${attempt}`
|
|
4267
4267
|
* }),
|
|
@@ -4332,7 +4332,7 @@ export declare const tapInput: {
|
|
|
4332
4332
|
* const errorType = isCritical
|
|
4333
4333
|
* ? "critical database failure"
|
|
4334
4334
|
* : "temporary network issue"
|
|
4335
|
-
* yield* Effect.fail(new Error(errorType))
|
|
4335
|
+
* return yield* Effect.fail(new Error(errorType))
|
|
4336
4336
|
* }),
|
|
4337
4337
|
* alertingSchedule
|
|
4338
4338
|
* ).pipe(
|
|
@@ -4384,7 +4384,7 @@ export declare const tapInput: {
|
|
|
4384
4384
|
* Effect.gen(function*() {
|
|
4385
4385
|
* attempt++
|
|
4386
4386
|
* if (attempt < 4) {
|
|
4387
|
-
* yield* Effect.fail(new Error(`Network timeout on attempt ${attempt}`))
|
|
4387
|
+
* return yield* Effect.fail(new Error(`Network timeout on attempt ${attempt}`))
|
|
4388
4388
|
* }
|
|
4389
4389
|
* return `Success on attempt ${attempt}`
|
|
4390
4390
|
* }),
|
|
@@ -4455,7 +4455,7 @@ export declare const tapInput: {
|
|
|
4455
4455
|
* const errorType = isCritical
|
|
4456
4456
|
* ? "critical database failure"
|
|
4457
4457
|
* : "temporary network issue"
|
|
4458
|
-
* yield* Effect.fail(new Error(errorType))
|
|
4458
|
+
* return yield* Effect.fail(new Error(errorType))
|
|
4459
4459
|
* }),
|
|
4460
4460
|
* alertingSchedule
|
|
4461
4461
|
* ).pipe(
|
|
@@ -4506,7 +4506,7 @@ export declare const tapInput: {
|
|
|
4506
4506
|
* Effect.gen(function*() {
|
|
4507
4507
|
* attempt++
|
|
4508
4508
|
* if (attempt < 4) {
|
|
4509
|
-
* yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
4509
|
+
* return yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
4510
4510
|
* }
|
|
4511
4511
|
* return `Success on attempt ${attempt}`
|
|
4512
4512
|
* }),
|
|
@@ -4590,7 +4590,7 @@ export declare const tapOutput: {
|
|
|
4590
4590
|
* Effect.gen(function*() {
|
|
4591
4591
|
* attempt++
|
|
4592
4592
|
* if (attempt < 4) {
|
|
4593
|
-
* yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
4593
|
+
* return yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
4594
4594
|
* }
|
|
4595
4595
|
* return `Success on attempt ${attempt}`
|
|
4596
4596
|
* }),
|
|
@@ -4674,7 +4674,7 @@ export declare const tapOutput: {
|
|
|
4674
4674
|
* Effect.gen(function*() {
|
|
4675
4675
|
* attempt++
|
|
4676
4676
|
* if (attempt < 4) {
|
|
4677
|
-
* yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
4677
|
+
* return yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
4678
4678
|
* }
|
|
4679
4679
|
* return `Success on attempt ${attempt}`
|
|
4680
4680
|
* }),
|
|
@@ -4777,7 +4777,7 @@ export declare const tapOutput: {
|
|
|
4777
4777
|
* yield* Console.log(`Attempt ${attempt}`)
|
|
4778
4778
|
*
|
|
4779
4779
|
* if (attempt < 5) { // Will fail more than 3 times
|
|
4780
|
-
* yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
4780
|
+
* return yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
4781
4781
|
* }
|
|
4782
4782
|
*
|
|
4783
4783
|
* return `Success on attempt ${attempt}`
|
|
@@ -4856,7 +4856,7 @@ export declare const take: {
|
|
|
4856
4856
|
* yield* Console.log(`Attempt ${attempt}`)
|
|
4857
4857
|
*
|
|
4858
4858
|
* if (attempt < 5) { // Will fail more than 3 times
|
|
4859
|
-
* yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
4859
|
+
* return yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
4860
4860
|
* }
|
|
4861
4861
|
*
|
|
4862
4862
|
* return `Success on attempt ${attempt}`
|
|
@@ -4935,7 +4935,7 @@ export declare const take: {
|
|
|
4935
4935
|
* yield* Console.log(`Attempt ${attempt}`)
|
|
4936
4936
|
*
|
|
4937
4937
|
* if (attempt < 5) { // Will fail more than 3 times
|
|
4938
|
-
* yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
4938
|
+
* return yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
4939
4939
|
* }
|
|
4940
4940
|
*
|
|
4941
4941
|
* return `Success on attempt ${attempt}`
|
package/dist/Schedule.js
CHANGED
|
@@ -341,7 +341,7 @@ export const toStepWithSleep = schedule => effect.map(toStepWithMetadata(schedul
|
|
|
341
341
|
* Effect.gen(function*() {
|
|
342
342
|
* attempt++
|
|
343
343
|
* if (attempt < 5) {
|
|
344
|
-
* yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
344
|
+
* return yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
345
345
|
* }
|
|
346
346
|
* return `Success on attempt ${attempt}`
|
|
347
347
|
* }),
|
|
@@ -382,7 +382,7 @@ export const addDelay = /*#__PURE__*/dual(2, (self, f) => modifyDelay(self, (out
|
|
|
382
382
|
* attempt++
|
|
383
383
|
* yield* Console.log(`Attempt ${attempt}`)
|
|
384
384
|
* if (attempt < 6) {
|
|
385
|
-
* yield* Effect.fail(new Error(`Failure ${attempt}`))
|
|
385
|
+
* return yield* Effect.fail(new Error(`Failure ${attempt}`))
|
|
386
386
|
* }
|
|
387
387
|
* return `Success on attempt ${attempt}`
|
|
388
388
|
* }),
|
|
@@ -505,7 +505,7 @@ export const andThenResult = /*#__PURE__*/dual(2, (self, other) => fromStep(effe
|
|
|
505
505
|
* yield* Console.log(`Retry attempt ${attempt}`)
|
|
506
506
|
*
|
|
507
507
|
* if (attempt < 3) {
|
|
508
|
-
* yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
508
|
+
* return yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
509
509
|
* }
|
|
510
510
|
*
|
|
511
511
|
* return `Success on attempt ${attempt}`
|
|
@@ -664,7 +664,7 @@ export const bothWith = /*#__PURE__*/dual(3, (self, other, combine) => fromStep(
|
|
|
664
664
|
* yield* Console.log(`Attempt ${attempt}`)
|
|
665
665
|
*
|
|
666
666
|
* if (attempt < 7) { // Needs both phases to succeed
|
|
667
|
-
* yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
667
|
+
* return yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
668
668
|
* }
|
|
669
669
|
*
|
|
670
670
|
* return `Success on attempt ${attempt}`
|
|
@@ -969,7 +969,7 @@ export const collectWhile = /*#__PURE__*/dual(2, (self, predicate) => reduce(whi
|
|
|
969
969
|
* yield* Console.log("Complex scheduled task...")
|
|
970
970
|
* // Simulate occasional failures
|
|
971
971
|
* if (Math.random() < 0.3) {
|
|
972
|
-
* yield* Effect.fail(new Error("Scheduled task failed"))
|
|
972
|
+
* return yield* Effect.fail(new Error("Scheduled task failed"))
|
|
973
973
|
* }
|
|
974
974
|
* return "success"
|
|
975
975
|
* }),
|
|
@@ -1158,7 +1158,7 @@ export const duration = durationInput => {
|
|
|
1158
1158
|
* yield* Console.log(`Retry attempt ${attempt}`)
|
|
1159
1159
|
*
|
|
1160
1160
|
* if (Math.random() < 0.8) { // 80% failure rate
|
|
1161
|
-
* yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
1161
|
+
* return yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
1162
1162
|
* }
|
|
1163
1163
|
*
|
|
1164
1164
|
* return `Success on attempt ${attempt}`
|
|
@@ -1229,7 +1229,7 @@ export const during = duration => while_(elapsed, ({
|
|
|
1229
1229
|
* yield* Console.log(`Retry attempt ${attempt}`)
|
|
1230
1230
|
*
|
|
1231
1231
|
* if (attempt < 6) {
|
|
1232
|
-
* yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
1232
|
+
* return yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
1233
1233
|
* }
|
|
1234
1234
|
*
|
|
1235
1235
|
* return `Success on attempt ${attempt}`
|
|
@@ -1422,7 +1422,7 @@ export const elapsed = /*#__PURE__*/fromStepWithMetadata(/*#__PURE__*/effect.suc
|
|
|
1422
1422
|
* attempt++
|
|
1423
1423
|
* if (attempt < 4) {
|
|
1424
1424
|
* yield* Console.log(`Attempt ${attempt} failed, retrying...`)
|
|
1425
|
-
* yield* Effect.fail(new Error(`Failure ${attempt}`))
|
|
1425
|
+
* return yield* Effect.fail(new Error(`Failure ${attempt}`))
|
|
1426
1426
|
* }
|
|
1427
1427
|
* return `Success on attempt ${attempt}`
|
|
1428
1428
|
* }),
|
|
@@ -1468,7 +1468,7 @@ export const exponential = (base, factor = 2) => {
|
|
|
1468
1468
|
* yield* Console.log(`Attempt ${attempt}`)
|
|
1469
1469
|
*
|
|
1470
1470
|
* if (attempt < 5) {
|
|
1471
|
-
* yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
1471
|
+
* return yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
1472
1472
|
* }
|
|
1473
1473
|
*
|
|
1474
1474
|
* return `Success on attempt ${attempt}`
|
|
@@ -1766,7 +1766,7 @@ export const passthrough = self => fromStep(effect.map(toStep(self), step => (no
|
|
|
1766
1766
|
* yield* Console.log(`Attempt ${attempt}`)
|
|
1767
1767
|
*
|
|
1768
1768
|
* if (attempt < 4) {
|
|
1769
|
-
* yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
1769
|
+
* return yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
1770
1770
|
* }
|
|
1771
1771
|
*
|
|
1772
1772
|
* return `Success on attempt ${attempt}`
|
|
@@ -2011,7 +2011,7 @@ export const spaced = duration => {
|
|
|
2011
2011
|
* Effect.gen(function*() {
|
|
2012
2012
|
* attempt++
|
|
2013
2013
|
* if (attempt < 4) {
|
|
2014
|
-
* yield* Effect.fail(new Error(`Network timeout on attempt ${attempt}`))
|
|
2014
|
+
* return yield* Effect.fail(new Error(`Network timeout on attempt ${attempt}`))
|
|
2015
2015
|
* }
|
|
2016
2016
|
* return `Success on attempt ${attempt}`
|
|
2017
2017
|
* }),
|
|
@@ -2082,7 +2082,7 @@ export const spaced = duration => {
|
|
|
2082
2082
|
* const errorType = isCritical
|
|
2083
2083
|
* ? "critical database failure"
|
|
2084
2084
|
* : "temporary network issue"
|
|
2085
|
-
* yield* Effect.fail(new Error(errorType))
|
|
2085
|
+
* return yield* Effect.fail(new Error(errorType))
|
|
2086
2086
|
* }),
|
|
2087
2087
|
* alertingSchedule
|
|
2088
2088
|
* ).pipe(
|
|
@@ -2132,7 +2132,7 @@ export const tapInput = /*#__PURE__*/dual(2, (self, f) => fromStep(effect.map(to
|
|
|
2132
2132
|
* Effect.gen(function*() {
|
|
2133
2133
|
* attempt++
|
|
2134
2134
|
* if (attempt < 4) {
|
|
2135
|
-
* yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
2135
|
+
* return yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
2136
2136
|
* }
|
|
2137
2137
|
* return `Success on attempt ${attempt}`
|
|
2138
2138
|
* }),
|
|
@@ -2234,7 +2234,7 @@ export const tapOutput = /*#__PURE__*/dual(2, (self, f) => fromStep(effect.map(t
|
|
|
2234
2234
|
* yield* Console.log(`Attempt ${attempt}`)
|
|
2235
2235
|
*
|
|
2236
2236
|
* if (attempt < 5) { // Will fail more than 3 times
|
|
2237
|
-
* yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
2237
|
+
* return yield* Effect.fail(new Error(`Attempt ${attempt} failed`))
|
|
2238
2238
|
* }
|
|
2239
2239
|
*
|
|
2240
2240
|
* return `Success on attempt ${attempt}`
|
package/dist/Schema.d.ts
CHANGED
|
@@ -4556,22 +4556,22 @@ export interface ToJsonSchemaOptions {
|
|
|
4556
4556
|
*/
|
|
4557
4557
|
export declare function toJsonSchemaDocument(schema: Top, options?: ToJsonSchemaOptions): JsonSchema.Document<"draft-2020-12">;
|
|
4558
4558
|
/**
|
|
4559
|
-
* @category
|
|
4559
|
+
* @category Canonical Codecs
|
|
4560
4560
|
* @since 4.0.0
|
|
4561
4561
|
*/
|
|
4562
4562
|
export declare function toCodecJson<T, E, RD, RE>(schema: Codec<T, E, RD, RE>): Codec<T, unknown, RD, RE>;
|
|
4563
4563
|
/**
|
|
4564
|
-
* @category
|
|
4564
|
+
* @category Canonical Codecs
|
|
4565
4565
|
* @since 4.0.0
|
|
4566
4566
|
*/
|
|
4567
4567
|
export declare function toCodecIso<S extends Top>(schema: S): Codec<S["Type"], S["Iso"]>;
|
|
4568
4568
|
/**
|
|
4569
|
-
* @category
|
|
4569
|
+
* @category Canonical Codecs
|
|
4570
4570
|
* @since 4.0.0
|
|
4571
4571
|
*/
|
|
4572
4572
|
export type StringTree = Tree<string | undefined>;
|
|
4573
4573
|
/**
|
|
4574
|
-
* The StringTree
|
|
4574
|
+
* The StringTree canonical codec converts **every leaf value to a string**, while
|
|
4575
4575
|
* preserving the original structure.
|
|
4576
4576
|
*
|
|
4577
4577
|
* Declarations are converted to `undefined` (unless they have a
|
|
@@ -4585,7 +4585,7 @@ export type StringTree = Tree<string | undefined>;
|
|
|
4585
4585
|
*
|
|
4586
4586
|
* Defaults to `false`.
|
|
4587
4587
|
*
|
|
4588
|
-
* @category
|
|
4588
|
+
* @category Canonical Codecs
|
|
4589
4589
|
* @since 4.0.0
|
|
4590
4590
|
*/
|
|
4591
4591
|
export declare function toCodecStringTree<T, E, RD, RE>(schema: Codec<T, E, RD, RE>): Codec<T, StringTree, RD, RE>;
|
|
@@ -4605,7 +4605,7 @@ type XmlEncoderOptions = {
|
|
|
4605
4605
|
readonly sortKeys?: boolean | undefined;
|
|
4606
4606
|
};
|
|
4607
4607
|
/**
|
|
4608
|
-
* @category
|
|
4608
|
+
* @category Canonical Codecs
|
|
4609
4609
|
* @since 4.0.0
|
|
4610
4610
|
*/
|
|
4611
4611
|
export declare function toEncoderXml<T, E, RD, RE>(codec: Codec<T, E, RD, RE>, options?: XmlEncoderOptions): (t: T) => Effect.Effect<string, SchemaError, RE>;
|
|
@@ -4654,12 +4654,12 @@ export declare function toDifferJsonPatch<T, E>(schema: Codec<T, E>): Differ<T,
|
|
|
4654
4654
|
* @category Tree
|
|
4655
4655
|
* @since 4.0.0
|
|
4656
4656
|
*/
|
|
4657
|
-
export type Tree<Node> = Node |
|
|
4657
|
+
export type Tree<Node> = Node | TreeRecord<Node> | ReadonlyArray<Tree<Node>>;
|
|
4658
4658
|
/**
|
|
4659
4659
|
* @category Tree
|
|
4660
4660
|
* @since 4.0.0
|
|
4661
4661
|
*/
|
|
4662
|
-
export interface
|
|
4662
|
+
export interface TreeRecord<A> {
|
|
4663
4663
|
readonly [x: string]: Tree<A>;
|
|
4664
4664
|
}
|
|
4665
4665
|
/**
|
|
@@ -4667,33 +4667,11 @@ export interface TreeObject<A> {
|
|
|
4667
4667
|
* @since 4.0.0
|
|
4668
4668
|
*/
|
|
4669
4669
|
export declare function Tree<S extends Top>(node: S): Union<readonly [S, $Array<suspend<Codec<Tree<S["Type"]>, Tree<S["Encoded"]>, S["DecodingServices"], S["EncodingServices"]>>>, $Record<String, suspend<Codec<Tree<S["Type"]>, Tree<S["Encoded"]>, S["DecodingServices"], S["EncodingServices"]>>>]>;
|
|
4670
|
-
/**
|
|
4671
|
-
* @category Tree
|
|
4672
|
-
* @since 4.0.0
|
|
4673
|
-
*/
|
|
4674
|
-
export type MutableTree<A> = A | MutableTreeRecord<A> | Array<MutableTree<A>>;
|
|
4675
|
-
/**
|
|
4676
|
-
* @category Tree
|
|
4677
|
-
* @since 4.0.0
|
|
4678
|
-
*/
|
|
4679
|
-
export interface MutableTreeRecord<A> {
|
|
4680
|
-
[x: string]: MutableTree<A>;
|
|
4681
|
-
}
|
|
4682
|
-
/**
|
|
4683
|
-
* @category Tree
|
|
4684
|
-
* @since 4.0.0
|
|
4685
|
-
*/
|
|
4686
|
-
export declare function MutableTree<S extends Top>(node: S): Union<readonly [S, mutable<$Array<suspend<Codec<MutableTree<S["Type"]>, MutableTree<S["Encoded"]>, S["DecodingServices"], S["EncodingServices"]>>>>, $Record<String, mutableKey<suspend<Codec<MutableTree<S["Type"]>, MutableTree<S["Encoded"]>, S["DecodingServices"], S["EncodingServices"]>>>>]>;
|
|
4687
4670
|
/**
|
|
4688
4671
|
* @category JSON
|
|
4689
4672
|
* @since 4.0.0
|
|
4690
4673
|
*/
|
|
4691
4674
|
export type Json = null | number | boolean | string | JsonArray | JsonObject;
|
|
4692
|
-
/**
|
|
4693
|
-
* @category JSON
|
|
4694
|
-
* @since 4.0.0
|
|
4695
|
-
*/
|
|
4696
|
-
export declare const Json: Codec<Json>;
|
|
4697
4675
|
/**
|
|
4698
4676
|
* @category JSON
|
|
4699
4677
|
* @since 4.0.0
|
|
@@ -4711,12 +4689,12 @@ export interface JsonObject {
|
|
|
4711
4689
|
* @category JSON
|
|
4712
4690
|
* @since 4.0.0
|
|
4713
4691
|
*/
|
|
4714
|
-
export
|
|
4692
|
+
export declare const Json: Codec<Json>;
|
|
4715
4693
|
/**
|
|
4716
4694
|
* @category JSON
|
|
4717
4695
|
* @since 4.0.0
|
|
4718
4696
|
*/
|
|
4719
|
-
export
|
|
4697
|
+
export type MutableJson = null | number | boolean | string | MutableJsonArray | MutableJsonObject;
|
|
4720
4698
|
/**
|
|
4721
4699
|
* @category JSON
|
|
4722
4700
|
* @since 4.0.0
|
|
@@ -4730,6 +4708,11 @@ export interface MutableJsonArray extends Array<MutableJson> {
|
|
|
4730
4708
|
export interface MutableJsonObject {
|
|
4731
4709
|
[x: string]: MutableJson;
|
|
4732
4710
|
}
|
|
4711
|
+
/**
|
|
4712
|
+
* @category JSON
|
|
4713
|
+
* @since 4.0.0
|
|
4714
|
+
*/
|
|
4715
|
+
export declare const MutableJson: Codec<MutableJson>;
|
|
4733
4716
|
/**
|
|
4734
4717
|
* Return all the typed annotations from the schema.
|
|
4735
4718
|
*
|