effect 4.0.0-beta.19 → 4.0.0-beta.20

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.
Files changed (141) hide show
  1. package/dist/Channel.d.ts +6 -6
  2. package/dist/Channel.d.ts.map +1 -1
  3. package/dist/Channel.js.map +1 -1
  4. package/dist/Config.d.ts +5 -6
  5. package/dist/Config.d.ts.map +1 -1
  6. package/dist/Config.js +3 -3
  7. package/dist/Config.js.map +1 -1
  8. package/dist/Effect.d.ts +22 -22
  9. package/dist/Effect.d.ts.map +1 -1
  10. package/dist/Effect.js +3 -3
  11. package/dist/Effect.js.map +1 -1
  12. package/dist/ErrorReporter.js +2 -2
  13. package/dist/ErrorReporter.js.map +1 -1
  14. package/dist/Layer.d.ts +9 -9
  15. package/dist/Layer.d.ts.map +1 -1
  16. package/dist/Layer.js.map +1 -1
  17. package/dist/Schedule.d.ts +14 -6
  18. package/dist/Schedule.d.ts.map +1 -1
  19. package/dist/Schedule.js +25 -9
  20. package/dist/Schedule.js.map +1 -1
  21. package/dist/Schema.d.ts +21 -0
  22. package/dist/Schema.d.ts.map +1 -1
  23. package/dist/Schema.js.map +1 -1
  24. package/dist/ServiceMap.d.ts +39 -30
  25. package/dist/ServiceMap.d.ts.map +1 -1
  26. package/dist/ServiceMap.js +3 -3
  27. package/dist/ServiceMap.js.map +1 -1
  28. package/dist/Sink.d.ts +2 -2
  29. package/dist/Sink.d.ts.map +1 -1
  30. package/dist/Sink.js.map +1 -1
  31. package/dist/Stream.d.ts +6 -6
  32. package/dist/Stream.d.ts.map +1 -1
  33. package/dist/Stream.js.map +1 -1
  34. package/dist/index.d.ts +1 -1
  35. package/dist/index.js +1 -1
  36. package/dist/internal/effect.js +2 -2
  37. package/dist/internal/effect.js.map +1 -1
  38. package/dist/testing/TestSchema.d.ts +2 -2
  39. package/dist/testing/TestSchema.d.ts.map +1 -1
  40. package/dist/testing/TestSchema.js.map +1 -1
  41. package/dist/unstable/ai/AiError.d.ts +90 -10
  42. package/dist/unstable/ai/AiError.d.ts.map +1 -1
  43. package/dist/unstable/ai/AiError.js +11 -12
  44. package/dist/unstable/ai/AiError.js.map +1 -1
  45. package/dist/unstable/ai/Model.d.ts +25 -7
  46. package/dist/unstable/ai/Model.d.ts.map +1 -1
  47. package/dist/unstable/ai/Model.js +22 -6
  48. package/dist/unstable/ai/Model.js.map +1 -1
  49. package/dist/unstable/ai/Tool.d.ts +3 -3
  50. package/dist/unstable/ai/Tool.d.ts.map +1 -1
  51. package/dist/unstable/ai/Tool.js.map +1 -1
  52. package/dist/unstable/ai/index.d.ts +1 -1
  53. package/dist/unstable/ai/index.js +1 -1
  54. package/dist/unstable/cli/Command.d.ts +6 -6
  55. package/dist/unstable/cli/Command.d.ts.map +1 -1
  56. package/dist/unstable/cli/Command.js.map +1 -1
  57. package/dist/unstable/cli/internal/command.d.ts +2 -2
  58. package/dist/unstable/cli/internal/command.d.ts.map +1 -1
  59. package/dist/unstable/cluster/Entity.d.ts +2 -2
  60. package/dist/unstable/cluster/Entity.d.ts.map +1 -1
  61. package/dist/unstable/cluster/Entity.js.map +1 -1
  62. package/dist/unstable/cluster/ShardingConfig.js +20 -20
  63. package/dist/unstable/cluster/ShardingConfig.js.map +1 -1
  64. package/dist/unstable/httpapi/HttpApi.d.ts +3 -3
  65. package/dist/unstable/httpapi/HttpApi.d.ts.map +1 -1
  66. package/dist/unstable/httpapi/HttpApi.js.map +1 -1
  67. package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
  68. package/dist/unstable/httpapi/HttpApiClient.d.ts +7 -2
  69. package/dist/unstable/httpapi/HttpApiClient.d.ts.map +1 -1
  70. package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
  71. package/dist/unstable/httpapi/HttpApiEndpoint.d.ts +3 -3
  72. package/dist/unstable/httpapi/HttpApiEndpoint.d.ts.map +1 -1
  73. package/dist/unstable/httpapi/HttpApiEndpoint.js.map +1 -1
  74. package/dist/unstable/httpapi/HttpApiGroup.d.ts +3 -3
  75. package/dist/unstable/httpapi/HttpApiGroup.d.ts.map +1 -1
  76. package/dist/unstable/httpapi/HttpApiGroup.js.map +1 -1
  77. package/dist/unstable/httpapi/HttpApiMiddleware.d.ts +4 -4
  78. package/dist/unstable/httpapi/HttpApiMiddleware.d.ts.map +1 -1
  79. package/dist/unstable/httpapi/HttpApiMiddleware.js.map +1 -1
  80. package/dist/unstable/httpapi/HttpApiSecurity.d.ts +2 -2
  81. package/dist/unstable/httpapi/HttpApiSecurity.d.ts.map +1 -1
  82. package/dist/unstable/httpapi/HttpApiSecurity.js.map +1 -1
  83. package/dist/unstable/httpapi/OpenApi.js.map +1 -1
  84. package/dist/unstable/process/ChildProcess.d.ts +3 -126
  85. package/dist/unstable/process/ChildProcess.d.ts.map +1 -1
  86. package/dist/unstable/process/ChildProcess.js +1 -65
  87. package/dist/unstable/process/ChildProcess.js.map +1 -1
  88. package/dist/unstable/process/ChildProcessSpawner.d.ts +39 -7
  89. package/dist/unstable/process/ChildProcessSpawner.d.ts.map +1 -1
  90. package/dist/unstable/process/ChildProcessSpawner.js +21 -1
  91. package/dist/unstable/process/ChildProcessSpawner.js.map +1 -1
  92. package/dist/unstable/rpc/Rpc.d.ts +1 -1
  93. package/dist/unstable/rpc/Rpc.d.ts.map +1 -1
  94. package/dist/unstable/rpc/Rpc.js.map +1 -1
  95. package/dist/unstable/rpc/RpcGroup.d.ts +2 -2
  96. package/dist/unstable/rpc/RpcGroup.d.ts.map +1 -1
  97. package/dist/unstable/rpc/RpcGroup.js.map +1 -1
  98. package/dist/unstable/rpc/RpcMiddleware.d.ts +3 -3
  99. package/dist/unstable/rpc/RpcMiddleware.d.ts.map +1 -1
  100. package/dist/unstable/rpc/RpcMiddleware.js.map +1 -1
  101. package/dist/unstable/sql/SqlClient.d.ts +1 -1
  102. package/dist/unstable/sql/SqlClient.d.ts.map +1 -1
  103. package/dist/unstable/workflow/Workflow.d.ts +1 -1
  104. package/dist/unstable/workflow/Workflow.d.ts.map +1 -1
  105. package/package.json +1 -1
  106. package/src/Channel.ts +9 -9
  107. package/src/Config.ts +9 -9
  108. package/src/Effect.ts +24 -32
  109. package/src/ErrorReporter.ts +2 -2
  110. package/src/Layer.ts +11 -15
  111. package/src/Schedule.ts +35 -19
  112. package/src/Schema.ts +21 -0
  113. package/src/ServiceMap.ts +47 -38
  114. package/src/Sink.ts +3 -3
  115. package/src/Stream.ts +9 -9
  116. package/src/index.ts +1 -1
  117. package/src/internal/effect.ts +24 -24
  118. package/src/testing/TestSchema.ts +2 -2
  119. package/src/unstable/ai/AiError.ts +95 -42
  120. package/src/unstable/ai/Model.ts +40 -9
  121. package/src/unstable/ai/Tool.ts +4 -4
  122. package/src/unstable/ai/index.ts +1 -1
  123. package/src/unstable/cli/Command.ts +9 -12
  124. package/src/unstable/cli/internal/command.ts +2 -2
  125. package/src/unstable/cluster/Entity.ts +4 -4
  126. package/src/unstable/cluster/ShardingConfig.ts +20 -20
  127. package/src/unstable/httpapi/HttpApi.ts +5 -5
  128. package/src/unstable/httpapi/HttpApiBuilder.ts +2 -2
  129. package/src/unstable/httpapi/HttpApiClient.ts +11 -3
  130. package/src/unstable/httpapi/HttpApiEndpoint.ts +7 -7
  131. package/src/unstable/httpapi/HttpApiGroup.ts +6 -6
  132. package/src/unstable/httpapi/HttpApiMiddleware.ts +4 -4
  133. package/src/unstable/httpapi/HttpApiSecurity.ts +3 -3
  134. package/src/unstable/httpapi/OpenApi.ts +2 -2
  135. package/src/unstable/process/ChildProcess.ts +4 -206
  136. package/src/unstable/process/ChildProcessSpawner.ts +69 -14
  137. package/src/unstable/rpc/Rpc.ts +2 -2
  138. package/src/unstable/rpc/RpcGroup.ts +4 -4
  139. package/src/unstable/rpc/RpcMiddleware.ts +3 -3
  140. package/src/unstable/sql/SqlClient.ts +1 -1
  141. package/src/unstable/workflow/Workflow.ts +1 -1
package/dist/Effect.d.ts CHANGED
@@ -636,7 +636,7 @@ export declare const all: <const Arg extends Iterable<Effect<any, any, any>> | R
636
636
  readonly mode?: "default" | "result" | undefined;
637
637
  }>(arg: Arg, options?: O) => All.Return<Arg, O>;
638
638
  /**
639
- * Applies an effectful `Filter` to each element and partitions failures and
639
+ * Applies an effectful function to each element and partitions failures and
640
640
  * successes.
641
641
  *
642
642
  * The returned tuple is `[excluded, satisfying]`, where:
@@ -649,10 +649,10 @@ export declare const all: <const Arg extends Iterable<Effect<any, any, any>> | R
649
649
  *
650
650
  * @example
651
651
  * ```ts
652
- * import { Effect, Result } from "effect"
652
+ * import { Effect } from "effect"
653
653
  *
654
654
  * const program = Effect.partition([0, 1, 2, 3], (n) =>
655
- * Effect.succeed(n % 2 === 0 ? Result.fail(`${n} is even`) : Result.succeed(n))
655
+ * n % 2 === 0 ? Effect.fail(`${n} is even`) : Effect.succeed(n)
656
656
  * )
657
657
  *
658
658
  * Effect.runPromise(program).then(console.log)
@@ -664,7 +664,7 @@ export declare const all: <const Arg extends Iterable<Effect<any, any, any>> | R
664
664
  */
665
665
  export declare const partition: {
666
666
  /**
667
- * Applies an effectful `Filter` to each element and partitions failures and
667
+ * Applies an effectful function to each element and partitions failures and
668
668
  * successes.
669
669
  *
670
670
  * The returned tuple is `[excluded, satisfying]`, where:
@@ -677,10 +677,10 @@ export declare const partition: {
677
677
  *
678
678
  * @example
679
679
  * ```ts
680
- * import { Effect, Result } from "effect"
680
+ * import { Effect } from "effect"
681
681
  *
682
682
  * const program = Effect.partition([0, 1, 2, 3], (n) =>
683
- * Effect.succeed(n % 2 === 0 ? Result.fail(`${n} is even`) : Result.succeed(n))
683
+ * n % 2 === 0 ? Effect.fail(`${n} is even`) : Effect.succeed(n)
684
684
  * )
685
685
  *
686
686
  * Effect.runPromise(program).then(console.log)
@@ -690,11 +690,11 @@ export declare const partition: {
690
690
  * @since 3.0.0
691
691
  * @category Collecting
692
692
  */
693
- <A, Pass, Fail, E, R>(filter: Filter.FilterEffect<NoInfer<A>, Pass, Fail, E, R, [i: number]>, options?: {
693
+ <A, B, E, R>(f: (a: A, i: number) => Effect<B, E, R>, options?: {
694
694
  readonly concurrency?: Concurrency | undefined;
695
- }): (elements: Iterable<A>) => Effect<[excluded: Array<Fail>, satisfying: Array<Pass>], E, R>;
695
+ }): (elements: Iterable<A>) => Effect<[excluded: Array<E>, satisfying: Array<B>], never, R>;
696
696
  /**
697
- * Applies an effectful `Filter` to each element and partitions failures and
697
+ * Applies an effectful function to each element and partitions failures and
698
698
  * successes.
699
699
  *
700
700
  * The returned tuple is `[excluded, satisfying]`, where:
@@ -707,10 +707,10 @@ export declare const partition: {
707
707
  *
708
708
  * @example
709
709
  * ```ts
710
- * import { Effect, Result } from "effect"
710
+ * import { Effect } from "effect"
711
711
  *
712
712
  * const program = Effect.partition([0, 1, 2, 3], (n) =>
713
- * Effect.succeed(n % 2 === 0 ? Result.fail(`${n} is even`) : Result.succeed(n))
713
+ * n % 2 === 0 ? Effect.fail(`${n} is even`) : Effect.succeed(n)
714
714
  * )
715
715
  *
716
716
  * Effect.runPromise(program).then(console.log)
@@ -720,9 +720,9 @@ export declare const partition: {
720
720
  * @since 3.0.0
721
721
  * @category Collecting
722
722
  */
723
- <A, Pass, Fail, E, R>(elements: Iterable<A>, filter: Filter.FilterEffect<NoInfer<A>, Pass, Fail, E, R, [i: number]>, options?: {
723
+ <A, B, E, R>(elements: Iterable<A>, f: (a: A, i: number) => Effect<B, E, R>, options?: {
724
724
  readonly concurrency?: Concurrency | undefined;
725
- }): Effect<[excluded: Array<Fail>, satisfying: Array<Pass>], E, R>;
725
+ }): Effect<[excluded: Array<E>, satisfying: Array<B>], never, R>;
726
726
  };
727
727
  /**
728
728
  * Applies an effectful function to each element and accumulates all failures.
@@ -9950,7 +9950,7 @@ export declare const provideServices: {
9950
9950
  * @since 4.0.0
9951
9951
  * @category ServiceMap
9952
9952
  */
9953
- export declare const service: <I, S>(service: ServiceMap.Service<I, S>) => Effect<S, never, I>;
9953
+ export declare const service: <I, S>(service: ServiceMap.Key<I, S>) => Effect<S, never, I>;
9954
9954
  /**
9955
9955
  * Optionally accesses a service from the environment.
9956
9956
  *
@@ -9985,7 +9985,7 @@ export declare const service: <I, S>(service: ServiceMap.Service<I, S>) => Effec
9985
9985
  * @since 2.0.0
9986
9986
  * @category ServiceMap
9987
9987
  */
9988
- export declare const serviceOption: <I, S>(key: ServiceMap.Service<I, S>) => Effect<Option<S>>;
9988
+ export declare const serviceOption: <I, S>(key: ServiceMap.Key<I, S>) => Effect<Option<S>>;
9989
9989
  /**
9990
9990
  * Provides part of the required context while leaving the rest unchanged.
9991
9991
  *
@@ -10167,7 +10167,7 @@ export declare const updateService: {
10167
10167
  * @since 2.0.0
10168
10168
  * @category ServiceMap
10169
10169
  */
10170
- <I, A>(service: ServiceMap.Service<I, A>, f: (value: A) => A): <XA, E, R>(self: Effect<XA, E, R>) => Effect<XA, E, R | I>;
10170
+ <I, A>(service: ServiceMap.Key<I, A>, f: (value: A) => A): <XA, E, R>(self: Effect<XA, E, R>) => Effect<XA, E, R | I>;
10171
10171
  /**
10172
10172
  * Updates the service with the required service entry.
10173
10173
  *
@@ -10196,7 +10196,7 @@ export declare const updateService: {
10196
10196
  * @since 2.0.0
10197
10197
  * @category ServiceMap
10198
10198
  */
10199
- <XA, E, R, I, A>(self: Effect<XA, E, R>, service: ServiceMap.Service<I, A>, f: (value: A) => A): Effect<XA, E, R | I>;
10199
+ <XA, E, R, I, A>(self: Effect<XA, E, R>, service: ServiceMap.Key<I, A>, f: (value: A) => A): Effect<XA, E, R | I>;
10200
10200
  };
10201
10201
  /**
10202
10202
  * The `provideService` function is used to provide an actual
@@ -10289,7 +10289,7 @@ export declare const provideService: {
10289
10289
  * @since 2.0.0
10290
10290
  * @category ServiceMap
10291
10291
  */
10292
- <I, S>(service: ServiceMap.Service<I, S>): {
10292
+ <I, S>(service: ServiceMap.Key<I, S>): {
10293
10293
  /**
10294
10294
  * The `provideService` function is used to provide an actual
10295
10295
  * implementation for a service in the context of an effect.
@@ -10428,7 +10428,7 @@ export declare const provideService: {
10428
10428
  * @since 2.0.0
10429
10429
  * @category ServiceMap
10430
10430
  */
10431
- <I, S>(service: ServiceMap.Service<I, S>, implementation: S): <A, E, R>(self: Effect<A, E, R>) => Effect<A, E, Exclude<R, I>>;
10431
+ <I, S>(service: ServiceMap.Key<I, S>, implementation: S): <A, E, R>(self: Effect<A, E, R>) => Effect<A, E, Exclude<R, I>>;
10432
10432
  /**
10433
10433
  * The `provideService` function is used to provide an actual
10434
10434
  * implementation for a service in the context of an effect.
@@ -10474,7 +10474,7 @@ export declare const provideService: {
10474
10474
  * @since 2.0.0
10475
10475
  * @category ServiceMap
10476
10476
  */
10477
- <A, E, R, I, S>(self: Effect<A, E, R>, service: ServiceMap.Service<I, S>, implementation: S): Effect<A, E, Exclude<R, I>>;
10477
+ <A, E, R, I, S>(self: Effect<A, E, R>, service: ServiceMap.Key<I, S>, implementation: S): Effect<A, E, Exclude<R, I>>;
10478
10478
  };
10479
10479
  /**
10480
10480
  * Provides the effect with the single service it requires. If the effect
@@ -10581,7 +10581,7 @@ export declare const provideServiceEffect: {
10581
10581
  * @since 2.0.0
10582
10582
  * @category ServiceMap
10583
10583
  */
10584
- <I, S, E2, R2>(service: ServiceMap.Service<I, S>, acquire: Effect<S, E2, R2>): <A, E, R>(self: Effect<A, E, R>) => Effect<A, E | E2, Exclude<R, I> | R2>;
10584
+ <I, S, E2, R2>(service: ServiceMap.Key<I, S>, acquire: Effect<S, E2, R2>): <A, E, R>(self: Effect<A, E, R>) => Effect<A, E | E2, Exclude<R, I> | R2>;
10585
10585
  /**
10586
10586
  * Provides the effect with the single service it requires. If the effect
10587
10587
  * requires more than one service use `provide` instead.
@@ -10634,7 +10634,7 @@ export declare const provideServiceEffect: {
10634
10634
  * @since 2.0.0
10635
10635
  * @category ServiceMap
10636
10636
  */
10637
- <A, E, R, I, S, E2, R2>(self: Effect<A, E, R>, service: ServiceMap.Service<I, S>, acquire: Effect<S, E2, R2>): Effect<A, E | E2, Exclude<R, I> | R2>;
10637
+ <A, E, R, I, S, E2, R2>(self: Effect<A, E, R>, service: ServiceMap.Key<I, S>, acquire: Effect<S, E2, R2>): Effect<A, E | E2, Exclude<R, I> | R2>;
10638
10638
  };
10639
10639
  /**
10640
10640
  * Sets the concurrency level for parallel operations within an effect.