effect 4.0.0-beta.83 → 4.0.0-beta.84
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/Array.d.ts +64 -64
- package/dist/Array.js +26 -26
- package/dist/Cache.d.ts +1 -1
- package/dist/Cache.js +1 -1
- package/dist/Cause.d.ts +68 -68
- package/dist/Cause.js +47 -47
- package/dist/Channel.d.ts +5 -5
- package/dist/Channel.js +3 -3
- package/dist/Clock.d.ts +1 -1
- package/dist/Clock.js +1 -1
- package/dist/Combiner.d.ts +9 -9
- package/dist/Combiner.js +8 -8
- package/dist/Config.d.ts +15 -94
- package/dist/Config.d.ts.map +1 -1
- package/dist/Config.js +22 -70
- package/dist/Config.js.map +1 -1
- package/dist/ConfigProvider.d.ts +58 -74
- package/dist/ConfigProvider.d.ts.map +1 -1
- package/dist/ConfigProvider.js +66 -41
- package/dist/ConfigProvider.js.map +1 -1
- package/dist/Console.d.ts +1 -1
- package/dist/Console.js +1 -1
- package/dist/Data.d.ts +15 -15
- package/dist/Data.js +3 -3
- package/dist/DateTime.d.ts +6 -6
- package/dist/DateTime.js +2 -2
- package/dist/Duration.d.ts +3 -3
- package/dist/Duration.js +3 -3
- package/dist/Effect.d.ts +84 -45
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +72 -33
- package/dist/Effect.js.map +1 -1
- package/dist/Equal.d.ts +7 -7
- package/dist/Equal.js +5 -5
- package/dist/Equivalence.d.ts +17 -17
- package/dist/Equivalence.js +13 -13
- package/dist/Exit.d.ts +3 -3
- package/dist/Exit.js +3 -3
- package/dist/Formatter.d.ts +5 -5
- package/dist/Formatter.js +4 -4
- package/dist/Function.d.ts +10 -10
- package/dist/Function.js +3 -3
- package/dist/HashMap.d.ts +3 -3
- package/dist/HashMap.js +1 -1
- package/dist/Iterable.d.ts +6 -6
- package/dist/Iterable.js +2 -2
- package/dist/JsonPatch.d.ts +2 -2
- package/dist/Layer.d.ts +1 -1
- package/dist/Layer.js +1 -1
- package/dist/Logger.d.ts +1 -1
- package/dist/Logger.js +1 -1
- package/dist/Match.d.ts +8 -8
- package/dist/Match.js +8 -8
- package/dist/Metric.d.ts +3 -3
- package/dist/Metric.js +3 -3
- package/dist/Optic.d.ts +30 -30
- package/dist/Optic.js +12 -12
- package/dist/Option.d.ts +7 -7
- package/dist/Option.js +7 -7
- package/dist/Order.d.ts +23 -23
- package/dist/Order.js +20 -20
- package/dist/Pool.d.ts +1 -1
- package/dist/Pool.js +1 -1
- package/dist/Predicate.d.ts +88 -88
- package/dist/Predicate.js +47 -47
- package/dist/PubSub.d.ts +3 -3
- package/dist/PubSub.js +3 -3
- package/dist/Reducer.d.ts +1 -1
- package/dist/Reducer.js +1 -1
- package/dist/Result.d.ts +18 -18
- package/dist/Result.js +8 -8
- package/dist/Runtime.d.ts +1 -1
- package/dist/Runtime.js +1 -1
- package/dist/Schema.d.ts +265 -120
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +285 -116
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaAST.d.ts +1 -1
- package/dist/SchemaAST.d.ts.map +1 -1
- package/dist/SchemaAST.js +13 -9
- package/dist/SchemaAST.js.map +1 -1
- package/dist/SchemaGetter.d.ts +48 -48
- package/dist/SchemaGetter.js +44 -44
- package/dist/SchemaIssue.d.ts +3 -3
- package/dist/SchemaIssue.js +3 -3
- package/dist/SchemaParser.d.ts +122 -22
- package/dist/SchemaParser.d.ts.map +1 -1
- package/dist/SchemaParser.js +186 -50
- package/dist/SchemaParser.js.map +1 -1
- package/dist/SchemaRepresentation.d.ts +1 -1
- package/dist/SchemaRepresentation.d.ts.map +1 -1
- package/dist/SchemaRepresentation.js +96 -2
- package/dist/SchemaRepresentation.js.map +1 -1
- package/dist/SchemaTransformation.d.ts +20 -20
- package/dist/SchemaTransformation.js +18 -18
- package/dist/Stream.d.ts +3 -3
- package/dist/Stream.js +2 -2
- package/dist/Stream.js.map +1 -1
- package/dist/String.d.ts +1 -1
- package/dist/String.js +1 -1
- package/dist/Struct.d.ts +1 -1
- package/dist/Struct.js +1 -1
- package/dist/Types.d.ts +13 -13
- package/dist/internal/effect.js +23 -10
- package/dist/internal/effect.js.map +1 -1
- package/dist/internal/schema/cause.d.ts +2 -0
- package/dist/internal/schema/cause.d.ts.map +1 -0
- package/dist/internal/schema/cause.js +24 -0
- package/dist/internal/schema/cause.js.map +1 -0
- package/dist/internal/schema/schema.d.ts +8 -4
- package/dist/internal/schema/schema.d.ts.map +1 -1
- package/dist/internal/schema/schema.js +21 -8
- package/dist/internal/schema/schema.js.map +1 -1
- package/dist/testing/TestSchema.d.ts +3 -3
- package/dist/testing/TestSchema.js +1 -1
- package/dist/unstable/ai/AiError.d.ts +1 -1
- package/dist/unstable/ai/AiError.js +1 -1
- package/dist/unstable/ai/Chat.d.ts +1 -1
- package/dist/unstable/ai/Chat.js +1 -1
- package/dist/unstable/cli/Prompt.js +2 -2
- package/dist/unstable/cli/Prompt.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiScalar.d.ts +2 -2
- package/dist/unstable/rpc/Rpc.d.ts +1 -1
- package/dist/unstable/rpc/Rpc.js +1 -1
- package/dist/unstable/rpc/RpcGroup.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcGroup.js +3 -4
- package/dist/unstable/rpc/RpcGroup.js.map +1 -1
- package/dist/unstable/sql/SqlResolver.d.ts.map +1 -1
- package/dist/unstable/sql/SqlResolver.js +15 -2
- package/dist/unstable/sql/SqlResolver.js.map +1 -1
- package/dist/unstable/workflow/Activity.d.ts +1 -0
- package/dist/unstable/workflow/Activity.d.ts.map +1 -1
- package/dist/unstable/workflow/Activity.js +1 -0
- package/dist/unstable/workflow/Activity.js.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.js +1 -1
- package/dist/unstable/workflow/WorkflowEngine.js.map +1 -1
- package/package.json +1 -1
- package/src/Array.ts +65 -65
- package/src/Cache.ts +1 -1
- package/src/Cause.ts +68 -68
- package/src/Channel.ts +5 -5
- package/src/Clock.ts +1 -1
- package/src/Combiner.ts +9 -9
- package/src/Config.ts +40 -108
- package/src/ConfigProvider.ts +139 -100
- package/src/Console.ts +1 -1
- package/src/Data.ts +15 -15
- package/src/DateTime.ts +6 -6
- package/src/Duration.ts +3 -3
- package/src/Effect.ts +89 -45
- package/src/Equal.ts +7 -7
- package/src/Equivalence.ts +17 -17
- package/src/Exit.ts +3 -3
- package/src/Formatter.ts +5 -5
- package/src/Function.ts +10 -10
- package/src/HashMap.ts +3 -3
- package/src/Iterable.ts +6 -6
- package/src/JsonPatch.ts +2 -2
- package/src/Layer.ts +1 -1
- package/src/Logger.ts +1 -1
- package/src/Match.ts +8 -8
- package/src/Metric.ts +3 -3
- package/src/Optic.ts +30 -30
- package/src/Option.ts +7 -7
- package/src/Order.ts +23 -23
- package/src/Pool.ts +1 -1
- package/src/Predicate.ts +88 -88
- package/src/PubSub.ts +3 -3
- package/src/Reducer.ts +1 -1
- package/src/Result.ts +20 -20
- package/src/Runtime.ts +1 -1
- package/src/Schema.ts +314 -131
- package/src/SchemaAST.ts +20 -11
- package/src/SchemaGetter.ts +48 -48
- package/src/SchemaIssue.ts +3 -3
- package/src/SchemaParser.ts +197 -58
- package/src/SchemaRepresentation.ts +73 -3
- package/src/SchemaTransformation.ts +20 -20
- package/src/Stream.ts +4 -4
- package/src/String.ts +1 -1
- package/src/Struct.ts +1 -1
- package/src/Types.ts +13 -13
- package/src/internal/effect.ts +29 -10
- package/src/internal/schema/cause.ts +26 -0
- package/src/internal/schema/schema.ts +36 -10
- package/src/testing/TestSchema.ts +3 -3
- package/src/unstable/ai/AiError.ts +1 -1
- package/src/unstable/ai/Chat.ts +1 -1
- package/src/unstable/cli/Prompt.ts +1 -1
- package/src/unstable/httpapi/HttpApiScalar.ts +2 -2
- package/src/unstable/rpc/Rpc.ts +1 -1
- package/src/unstable/rpc/RpcGroup.ts +3 -4
- package/src/unstable/sql/SqlResolver.ts +15 -2
- package/src/unstable/workflow/Activity.ts +2 -0
- package/src/unstable/workflow/WorkflowEngine.ts +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cause.d.ts","sourceRoot":"","sources":["../../../src/internal/schema/cause.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as Cause from "../../Cause.js";
|
|
2
|
+
import * as SchemaIssue from "../../SchemaIssue.js";
|
|
3
|
+
/** @internal */
|
|
4
|
+
export function getSchemaIssue(cause) {
|
|
5
|
+
let issue;
|
|
6
|
+
for (const reason of cause.reasons) {
|
|
7
|
+
if (!Cause.isFailReason(reason) || !SchemaIssue.isIssue(reason.error)) {
|
|
8
|
+
return undefined;
|
|
9
|
+
}
|
|
10
|
+
issue ??= reason.error;
|
|
11
|
+
}
|
|
12
|
+
return issue;
|
|
13
|
+
}
|
|
14
|
+
/** @internal */
|
|
15
|
+
export function getSchemaIssueOrThrow(cause, message) {
|
|
16
|
+
const issue = getSchemaIssue(cause);
|
|
17
|
+
if (issue === undefined) {
|
|
18
|
+
throw new Error(message, {
|
|
19
|
+
cause
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return issue;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=cause.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cause.js","names":["Cause","SchemaIssue","getSchemaIssue","cause","issue","reason","reasons","isFailReason","isIssue","error","undefined","getSchemaIssueOrThrow","message","Error"],"sources":["../../../src/internal/schema/cause.ts"],"sourcesContent":[null],"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,gBAAgB;AACvC,OAAO,KAAKC,WAAW,MAAM,sBAAsB;AAEnD;AACA,OAAM,SAAUC,cAAcA,CAACC,KAAqC;EAClE,IAAIC,KAAoC;EACxC,KAAK,MAAMC,MAAM,IAAIF,KAAK,CAACG,OAAO,EAAE;IAClC,IAAI,CAACN,KAAK,CAACO,YAAY,CAACF,MAAM,CAAC,IAAI,CAACJ,WAAW,CAACO,OAAO,CAACH,MAAM,CAACI,KAAK,CAAC,EAAE;MACrE,OAAOC,SAAS;IAClB;IACAN,KAAK,KAAKC,MAAM,CAACI,KAAK;EACxB;EACA,OAAOL,KAAK;AACd;AAEA;AACA,OAAM,SAAUO,qBAAqBA,CACnCR,KAAqC,EACrCS,OAAe;EAEf,MAAMR,KAAK,GAAGF,cAAc,CAACC,KAAK,CAAC;EACnC,IAAIC,KAAK,KAAKM,SAAS,EAAE;IACvB,MAAM,IAAIG,KAAK,CAACD,OAAO,EAAE;MAAET;IAAK,CAAE,CAAC;EACrC;EACA,OAAOC,KAAK;AACd","ignoreList":[]}
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
+
import * as Cause from "../../Cause.ts";
|
|
1
2
|
import type { Issue } from "../../SchemaIssue.ts";
|
|
2
|
-
|
|
3
|
-
readonly
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
declare const SchemaError_base: new <A extends Record<string, any> = {}>(args: import("../../Types.ts").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => Cause.YieldableError & {
|
|
4
|
+
readonly _tag: "SchemaError";
|
|
5
|
+
} & Readonly<A>;
|
|
6
|
+
export declare class SchemaError extends SchemaError_base<{
|
|
6
7
|
readonly issue: Issue;
|
|
8
|
+
}> {
|
|
9
|
+
readonly [SchemaErrorTypeId]: typeof SchemaErrorTypeId;
|
|
7
10
|
constructor(issue: Issue);
|
|
8
11
|
get message(): string;
|
|
9
12
|
toString(): string;
|
|
10
13
|
}
|
|
14
|
+
export {};
|
|
11
15
|
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/internal/schema/schema.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/internal/schema/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAA;AAOvC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;;;;AAyCjD,qBAAa,WAAY,SAAQ,iBAAgC;IAC/D,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAA;CACtB,CAAC;IACA,QAAQ,CAAC,CAAC,iBAAiB,CAAC,EAAE,OAAO,iBAAiB,CAAoB;gBAC9D,KAAK,EAAE,KAAK;IAGxB,IAAa,OAAO,WAEnB;IACQ,QAAQ;CAGlB"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import * as Cause from "../../Cause.js";
|
|
2
|
+
import * as Data from "../../Data.js";
|
|
1
3
|
import * as Effect from "../../Effect.js";
|
|
2
|
-
import
|
|
4
|
+
import * as Exit from "../../Exit.js";
|
|
3
5
|
import * as Pipeable from "../../Pipeable.js";
|
|
4
6
|
import * as SchemaAST from "../../SchemaAST.js";
|
|
5
7
|
import * as SchemaParser from "../../SchemaParser.js";
|
|
@@ -28,21 +30,20 @@ export function make(ast, options) {
|
|
|
28
30
|
}
|
|
29
31
|
self.ast = ast;
|
|
30
32
|
self.rebuild = ast => make(ast, options);
|
|
31
|
-
self.makeEffect =
|
|
33
|
+
self.makeEffect = (input, options) => mapSchemaIssueEffect(SchemaParser.makeEffect(self)(input, options));
|
|
32
34
|
self.make = SchemaParser.make(self);
|
|
33
35
|
self.makeOption = SchemaParser.makeOption(self);
|
|
34
36
|
return self;
|
|
35
37
|
}
|
|
36
38
|
/** @internal */
|
|
37
39
|
export const SchemaErrorTypeId = "~effect/Schema/SchemaError";
|
|
38
|
-
// not internal
|
|
39
|
-
export class SchemaError {
|
|
40
|
+
// purposefully not internal
|
|
41
|
+
export class SchemaError extends /*#__PURE__*/Data.TaggedError("SchemaError") {
|
|
40
42
|
[SchemaErrorTypeId] = SchemaErrorTypeId;
|
|
41
|
-
_tag = "SchemaError";
|
|
42
|
-
name = "SchemaError";
|
|
43
|
-
issue;
|
|
44
43
|
constructor(issue) {
|
|
45
|
-
|
|
44
|
+
super({
|
|
45
|
+
issue
|
|
46
|
+
});
|
|
46
47
|
}
|
|
47
48
|
get message() {
|
|
48
49
|
return this.issue.toString();
|
|
@@ -52,6 +53,18 @@ export class SchemaError {
|
|
|
52
53
|
}
|
|
53
54
|
}
|
|
54
55
|
/** @internal */
|
|
56
|
+
export function mapSchemaIssueEffect(self) {
|
|
57
|
+
return Effect.catchCause(self, cause => Effect.failCauseSync(() => Cause.map(cause, issue => new SchemaError(issue))));
|
|
58
|
+
}
|
|
59
|
+
/** @internal */
|
|
60
|
+
export function mapSchemaErrorEffect(self) {
|
|
61
|
+
return Effect.catchCause(self, cause => Effect.failCauseSync(() => Cause.map(cause, error => error.issue)));
|
|
62
|
+
}
|
|
63
|
+
/** @internal */
|
|
64
|
+
export function mapSchemaIssueExit(exit) {
|
|
65
|
+
return Exit.isSuccess(exit) ? Exit.succeed(exit.value) : Exit.failCause(Cause.map(exit.cause, issue => new SchemaError(issue)));
|
|
66
|
+
}
|
|
67
|
+
/** @internal */
|
|
55
68
|
export const jsonReorder = /*#__PURE__*/makeReorder(getJsonPriority);
|
|
56
69
|
function getJsonPriority(ast) {
|
|
57
70
|
switch (ast._tag) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","names":["Effect","
|
|
1
|
+
{"version":3,"file":"schema.js","names":["Cause","Data","Effect","Exit","Pipeable","SchemaAST","SchemaParser","TypeId","SchemaProto","pipe","pipeArguments","arguments","annotate","annotations","rebuild","ast","annotateKey","check","checks","appendChecks","make","options","self","Object","create","assign","makeEffect","input","mapSchemaIssueEffect","makeOption","SchemaErrorTypeId","SchemaError","TaggedError","constructor","issue","message","toString","catchCause","cause","failCauseSync","map","mapSchemaErrorEffect","error","mapSchemaIssueExit","exit","isSuccess","succeed","value","failCause","jsonReorder","makeReorder","getJsonPriority","_tag","getPriority","types","indexMap","Map","i","length","set","toEncoded","sortedTypes","sort","a","b","pa","pb","get","orderChanged","some","index"],"sources":["../../../src/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W,CAAC,CAAC;MACzB,IAAIC,EAAE,KAAKC,EAAE,EAAE,OAAOD,EAAE,GAAGC,EAAE;MAC7B;MACA,OAAOX,QAAQ,CAACY,GAAG,CAACJ,CAAC,CAAE,GAAGR,QAAQ,CAACY,GAAG,CAACH,CAAC,CAAE;IAC5C,CAAC,CAAC;IAEF;IACA,MAAMI,YAAY,GAAGP,WAAW,CAACQ,IAAI,CAAC,CAACtD,GAAG,EAAEuD,KAAK,KAAKvD,GAAG,KAAKuC,KAAK,CAACgB,KAAK,CAAC,CAAC;IAE3E,IAAI,CAACF,YAAY,EAAE,OAAOd,KAAK;IAC/B,OAAOO,WAAW;EACpB,CAAC;AACH","ignoreList":[]}
|
|
@@ -111,7 +111,7 @@ export declare class Asserts<S extends Schema.Top> {
|
|
|
111
111
|
*
|
|
112
112
|
* FastCheck generates arbitrary values matching the schema's `Type`. The assertion fails if any generated value does not round-trip. Pass `options.params` to control FastCheck parameters such as `numRuns`.
|
|
113
113
|
*
|
|
114
|
-
* **Example** (
|
|
114
|
+
* **Example** (Verifying round trips)
|
|
115
115
|
*
|
|
116
116
|
* ```ts
|
|
117
117
|
* import { Schema } from "effect"
|
|
@@ -258,7 +258,7 @@ export declare class Decoding<S extends Schema.Top> {
|
|
|
258
258
|
*
|
|
259
259
|
* Use to verify successful decoding for one input case.
|
|
260
260
|
*
|
|
261
|
-
* **Example** (
|
|
261
|
+
* **Example** (Testing identity and transformed decoding)
|
|
262
262
|
*
|
|
263
263
|
* ```ts
|
|
264
264
|
* import { Schema } from "effect"
|
|
@@ -349,7 +349,7 @@ export declare class Encoding<S extends Schema.Top> {
|
|
|
349
349
|
*
|
|
350
350
|
* Use to verify successful encoding for one input case.
|
|
351
351
|
*
|
|
352
|
-
* **Example** (
|
|
352
|
+
* **Example** (Testing identity and transformed encoding)
|
|
353
353
|
*
|
|
354
354
|
* ```ts
|
|
355
355
|
* import { Schema } from "effect"
|
|
@@ -138,7 +138,7 @@ export class Asserts {
|
|
|
138
138
|
*
|
|
139
139
|
* FastCheck generates arbitrary values matching the schema's `Type`. The assertion fails if any generated value does not round-trip. Pass `options.params` to control FastCheck parameters such as `numRuns`.
|
|
140
140
|
*
|
|
141
|
-
* **Example** (
|
|
141
|
+
* **Example** (Verifying round trips)
|
|
142
142
|
*
|
|
143
143
|
* ```ts
|
|
144
144
|
* import { Schema } from "effect"
|
|
@@ -101,7 +101,7 @@ export declare class NetworkError extends NetworkError_base {
|
|
|
101
101
|
* Provider-specific metadata is namespaced by provider name. Each provider
|
|
102
102
|
* value can contain arbitrary mutable JSON metadata or `null`.
|
|
103
103
|
*
|
|
104
|
-
* **Example** (
|
|
104
|
+
* **Example** (Inspecting metadata shape)
|
|
105
105
|
*
|
|
106
106
|
* ```ts
|
|
107
107
|
* const metadata = {
|
|
@@ -157,7 +157,7 @@ export class NetworkError extends /*#__PURE__*/Schema.ErrorClass("effect/ai/AiEr
|
|
|
157
157
|
* Provider-specific metadata is namespaced by provider name. Each provider
|
|
158
158
|
* value can contain arbitrary mutable JSON metadata or `null`.
|
|
159
159
|
*
|
|
160
|
-
* **Example** (
|
|
160
|
+
* **Example** (Inspecting metadata shape)
|
|
161
161
|
*
|
|
162
162
|
* ```ts
|
|
163
163
|
* const metadata = {
|
|
@@ -28,7 +28,7 @@ declare const Chat_base: Context.ServiceClass<Chat, "effect/ai/Chat", Service>;
|
|
|
28
28
|
* enabling persistent conversational AI interactions with full context
|
|
29
29
|
* management.
|
|
30
30
|
*
|
|
31
|
-
* **Example** (
|
|
31
|
+
* **Example** (Accessing the Chat service)
|
|
32
32
|
*
|
|
33
33
|
* ```ts
|
|
34
34
|
* import { Effect } from "effect"
|
package/dist/unstable/ai/Chat.js
CHANGED
|
@@ -41,7 +41,7 @@ import * as Prompt from "./Prompt.js";
|
|
|
41
41
|
* enabling persistent conversational AI interactions with full context
|
|
42
42
|
* management.
|
|
43
43
|
*
|
|
44
|
-
* **Example** (
|
|
44
|
+
* **Example** (Accessing the Chat service)
|
|
45
45
|
*
|
|
46
46
|
* ```ts
|
|
47
47
|
* import { Effect } from "effect"
|
|
@@ -662,9 +662,9 @@ const runLoop = /*#__PURE__*/Effect.fnUntraced(function* (loop, terminal, input)
|
|
|
662
662
|
const msg = yield* loop.render(state, action);
|
|
663
663
|
yield* Effect.orDie(terminal.display(msg));
|
|
664
664
|
if (loop.events) {
|
|
665
|
-
const takeInput = Queue.take(input).pipe(Effect.map(
|
|
665
|
+
const takeInput = Queue.take(input).pipe(Effect.map(input => ({
|
|
666
666
|
_tag: "Input",
|
|
667
|
-
|
|
667
|
+
input
|
|
668
668
|
})));
|
|
669
669
|
const result = yield* Effect.raceFirst(takeInput, Queue.take(loop.events).pipe(Effect.map(value => ({
|
|
670
670
|
_tag: "Event",
|