effect 2.3.5 → 2.3.7
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/ModuleVersion/package.json +6 -0
- package/dist/cjs/Effect.js +18 -2
- package/dist/cjs/Effect.js.map +1 -1
- package/dist/cjs/FiberId.js.map +1 -1
- package/dist/cjs/Function.js +21 -2
- package/dist/cjs/Function.js.map +1 -1
- package/dist/cjs/GlobalValue.js +27 -2
- package/dist/cjs/GlobalValue.js.map +1 -1
- package/dist/cjs/ModuleVersion.js +49 -0
- package/dist/cjs/ModuleVersion.js.map +1 -0
- package/dist/cjs/Random.js +6 -1
- package/dist/cjs/Random.js.map +1 -1
- package/dist/cjs/RequestResolver.js +27 -1
- package/dist/cjs/RequestResolver.js.map +1 -1
- package/dist/cjs/Runtime.js +39 -1
- package/dist/cjs/Runtime.js.map +1 -1
- package/dist/cjs/TestAnnotation.js.map +1 -1
- package/dist/cjs/TestAnnotationMap.js +40 -15
- package/dist/cjs/TestAnnotationMap.js.map +1 -1
- package/dist/cjs/TestAnnotations.js.map +1 -1
- package/dist/cjs/index.js +4 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/internal/cache.js +1 -1
- package/dist/cjs/internal/cache.js.map +1 -1
- package/dist/cjs/internal/cause.js +6 -2
- package/dist/cjs/internal/cause.js.map +1 -1
- package/dist/cjs/internal/dataSource.js +6 -1
- package/dist/cjs/internal/dataSource.js.map +1 -1
- package/dist/cjs/internal/defaultServices.js +3 -1
- package/dist/cjs/internal/defaultServices.js.map +1 -1
- package/dist/cjs/internal/effectable.js +2 -2
- package/dist/cjs/internal/effectable.js.map +1 -1
- package/dist/cjs/internal/fiberId.js +2 -0
- package/dist/cjs/internal/fiberId.js.map +1 -1
- package/dist/cjs/internal/fiberRefs.js.map +1 -1
- package/dist/cjs/internal/fiberRuntime.js +8 -4
- package/dist/cjs/internal/fiberRuntime.js.map +1 -1
- package/dist/cjs/internal/option.js +2 -1
- package/dist/cjs/internal/option.js.map +1 -1
- package/dist/cjs/internal/runtime.js +15 -1
- package/dist/cjs/internal/runtime.js.map +1 -1
- package/dist/cjs/internal/tracer.js +12 -4
- package/dist/cjs/internal/tracer.js.map +1 -1
- package/dist/cjs/internal/version.js +8 -2
- package/dist/cjs/internal/version.js.map +1 -1
- package/dist/dts/Effect.d.ts +23 -4
- package/dist/dts/Effect.d.ts.map +1 -1
- package/dist/dts/FiberId.d.ts +11 -4
- package/dist/dts/FiberId.d.ts.map +1 -1
- package/dist/dts/FiberRefs.d.ts +14 -14
- package/dist/dts/FiberRefs.d.ts.map +1 -1
- package/dist/dts/Function.d.ts +18 -0
- package/dist/dts/Function.d.ts.map +1 -1
- package/dist/dts/ModuleVersion.d.ts +11 -0
- package/dist/dts/ModuleVersion.d.ts.map +1 -0
- package/dist/dts/Random.d.ts +6 -0
- package/dist/dts/Random.d.ts.map +1 -1
- package/dist/dts/RequestResolver.d.ts +29 -0
- package/dist/dts/RequestResolver.d.ts.map +1 -1
- package/dist/dts/Runtime.d.ts +48 -0
- package/dist/dts/Runtime.d.ts.map +1 -1
- package/dist/dts/TestAnnotation.d.ts.map +1 -1
- package/dist/dts/TestAnnotationMap.d.ts +2 -1
- package/dist/dts/TestAnnotationMap.d.ts.map +1 -1
- package/dist/dts/TestAnnotations.d.ts +3 -0
- package/dist/dts/TestAnnotations.d.ts.map +1 -1
- package/dist/dts/index.d.ts +6 -0
- package/dist/dts/index.d.ts.map +1 -1
- package/dist/dts/internal/version.d.ts +2 -1
- package/dist/dts/internal/version.d.ts.map +1 -1
- package/dist/esm/Effect.js +16 -0
- package/dist/esm/Effect.js.map +1 -1
- package/dist/esm/FiberId.js.map +1 -1
- package/dist/esm/Function.js +18 -0
- package/dist/esm/Function.js.map +1 -1
- package/dist/esm/GlobalValue.js +2 -2
- package/dist/esm/GlobalValue.js.map +1 -1
- package/dist/esm/ModuleVersion.js +17 -0
- package/dist/esm/ModuleVersion.js.map +1 -0
- package/dist/esm/Random.js +5 -0
- package/dist/esm/Random.js.map +1 -1
- package/dist/esm/RequestResolver.js +26 -0
- package/dist/esm/RequestResolver.js.map +1 -1
- package/dist/esm/Runtime.js +38 -0
- package/dist/esm/Runtime.js.map +1 -1
- package/dist/esm/TestAnnotation.js.map +1 -1
- package/dist/esm/TestAnnotationMap.js +16 -16
- package/dist/esm/TestAnnotationMap.js.map +1 -1
- package/dist/esm/TestAnnotations.js.map +1 -1
- package/dist/esm/index.js +6 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/internal/cache.js +1 -1
- package/dist/esm/internal/cache.js.map +1 -1
- package/dist/esm/internal/cause.js +6 -2
- package/dist/esm/internal/cause.js.map +1 -1
- package/dist/esm/internal/dataSource.js +5 -0
- package/dist/esm/internal/dataSource.js.map +1 -1
- package/dist/esm/internal/defaultServices.js +2 -0
- package/dist/esm/internal/defaultServices.js.map +1 -1
- package/dist/esm/internal/effectable.js +2 -2
- package/dist/esm/internal/effectable.js.map +1 -1
- package/dist/esm/internal/fiberId.js +2 -0
- package/dist/esm/internal/fiberId.js.map +1 -1
- package/dist/esm/internal/fiberRefs.js.map +1 -1
- package/dist/esm/internal/fiberRuntime.js +6 -3
- package/dist/esm/internal/fiberRuntime.js.map +1 -1
- package/dist/esm/internal/option.js +2 -1
- package/dist/esm/internal/option.js.map +1 -1
- package/dist/esm/internal/runtime.js +14 -0
- package/dist/esm/internal/runtime.js.map +1 -1
- package/dist/esm/internal/tracer.js +12 -4
- package/dist/esm/internal/tracer.js.map +1 -1
- package/dist/esm/internal/version.js +5 -1
- package/dist/esm/internal/version.js.map +1 -1
- package/package.json +9 -1
- package/src/Effect.ts +26 -4
- package/src/FiberId.ts +12 -4
- package/src/FiberRefs.ts +14 -14
- package/src/Function.ts +19 -0
- package/src/GlobalValue.ts +2 -2
- package/src/ModuleVersion.ts +18 -0
- package/src/Random.ts +7 -0
- package/src/RequestResolver.ts +37 -0
- package/src/Runtime.ts +51 -0
- package/src/TestAnnotation.ts +1 -0
- package/src/TestAnnotationMap.ts +19 -23
- package/src/TestAnnotations.ts +3 -0
- package/src/index.ts +7 -0
- package/src/internal/cache.ts +1 -1
- package/src/internal/cause.ts +11 -6
- package/src/internal/dataSource.ts +27 -0
- package/src/internal/defaultServices.ts +12 -2
- package/src/internal/effectable.ts +2 -2
- package/src/internal/fiberId.ts +6 -4
- package/src/internal/fiberRefs.ts +25 -25
- package/src/internal/fiberRuntime.ts +11 -4
- package/src/internal/option.ts +2 -1
- package/src/internal/runtime.ts +41 -0
- package/src/internal/tracer.ts +12 -4
- package/src/internal/version.ts +7 -1
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
* @since 2.0.0
|
|
3
3
|
*/
|
|
4
4
|
import * as Context from "../Context.js";
|
|
5
|
-
import { globalValue } from "../GlobalValue.js";
|
|
6
|
-
import * as MutableRef from "../MutableRef.js";
|
|
7
5
|
/** @internal */
|
|
8
6
|
export const TracerTypeId = /*#__PURE__*/Symbol.for("effect/Tracer");
|
|
9
7
|
/** @internal */
|
|
@@ -15,7 +13,17 @@ export const make = options => ({
|
|
|
15
13
|
export const tracerTag = /*#__PURE__*/Context.GenericTag("effect/Tracer");
|
|
16
14
|
/** @internal */
|
|
17
15
|
export const spanTag = /*#__PURE__*/Context.GenericTag("effect/ParentSpan");
|
|
18
|
-
const
|
|
16
|
+
const randomString = /*#__PURE__*/function () {
|
|
17
|
+
const characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
18
|
+
const charactersLength = characters.length;
|
|
19
|
+
return function (length) {
|
|
20
|
+
let result = "";
|
|
21
|
+
for (let i = 0; i < length; i++) {
|
|
22
|
+
result += characters.charAt(Math.floor(Math.random() * charactersLength));
|
|
23
|
+
}
|
|
24
|
+
return result;
|
|
25
|
+
};
|
|
26
|
+
}();
|
|
19
27
|
/** @internal */
|
|
20
28
|
export class NativeSpan {
|
|
21
29
|
name;
|
|
@@ -41,7 +49,7 @@ export class NativeSpan {
|
|
|
41
49
|
startTime
|
|
42
50
|
};
|
|
43
51
|
this.attributes = new Map();
|
|
44
|
-
this.spanId = `span${
|
|
52
|
+
this.spanId = `span${randomString(16)}`;
|
|
45
53
|
}
|
|
46
54
|
end = (endTime, exit) => {
|
|
47
55
|
this.status = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tracer.js","names":["Context","
|
|
1
|
+
{"version":3,"file":"tracer.js","names":["Context","TracerTypeId","Symbol","for","make","options","tracerTag","GenericTag","spanTag","randomString","characters","charactersLength","length","result","i","charAt","Math","floor","random","NativeSpan","name","parent","context","links","startTime","_tag","spanId","traceId","sampled","status","attributes","events","constructor","Map","end","endTime","exit","attribute","key","value","set","event","push","nativeTracer","span","f","externalSpan","empty"],"sources":["../../../src/internal/tracer.ts"],"sourcesContent":[null],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","names":["moduleVersion"],"sources":["../../../src/internal/version.ts"],"sourcesContent":[null],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"version.js","names":["moduleVersion","getCurrentVersion","setCurrentVersion","version"],"sources":["../../../src/internal/version.ts"],"sourcesContent":[null],"mappings":"AAAA,IAAIA,aAAa,GAAG,OAAO;AAE3B,OAAO,MAAMC,iBAAiB,GAAGA,CAAA,KAAMD,aAAa;AAEpD,OAAO,MAAME,iBAAiB,GAAIC,OAAe,IAAI;EACnDH,aAAa,GAAGG,OAAO;AACzB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "effect",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.7",
|
|
4
4
|
"description": "Functional programming in TypeScript",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -348,6 +348,11 @@
|
|
|
348
348
|
"import": "./dist/esm/MetricState.js",
|
|
349
349
|
"default": "./dist/cjs/MetricState.js"
|
|
350
350
|
},
|
|
351
|
+
"./ModuleVersion": {
|
|
352
|
+
"types": "./dist/dts/ModuleVersion.d.ts",
|
|
353
|
+
"import": "./dist/esm/ModuleVersion.js",
|
|
354
|
+
"default": "./dist/cjs/ModuleVersion.js"
|
|
355
|
+
},
|
|
351
356
|
"./MutableHashMap": {
|
|
352
357
|
"types": "./dist/dts/MutableHashMap.d.ts",
|
|
353
358
|
"import": "./dist/esm/MutableHashMap.js",
|
|
@@ -964,6 +969,9 @@
|
|
|
964
969
|
"MetricState": [
|
|
965
970
|
"./dist/dts/MetricState.d.ts"
|
|
966
971
|
],
|
|
972
|
+
"ModuleVersion": [
|
|
973
|
+
"./dist/dts/ModuleVersion.d.ts"
|
|
974
|
+
],
|
|
967
975
|
"MutableHashMap": [
|
|
968
976
|
"./dist/dts/MutableHashMap.d.ts"
|
|
969
977
|
],
|
package/src/Effect.ts
CHANGED
|
@@ -2817,8 +2817,8 @@ export const withClockScoped: <A extends Clock.Clock>(value: A) => Effect<void,
|
|
|
2817
2817
|
* @category clock
|
|
2818
2818
|
*/
|
|
2819
2819
|
export const withClock: {
|
|
2820
|
-
<
|
|
2821
|
-
<
|
|
2820
|
+
<X extends Clock.Clock>(value: X): <A, E, R>(effect: Effect<A, E, R>) => Effect<A, E, R>
|
|
2821
|
+
<X extends Clock.Clock, A, E, R>(effect: Effect<A, E, R>, value: X): Effect<A, E, R>
|
|
2822
2822
|
} = defaultServices.withClock
|
|
2823
2823
|
|
|
2824
2824
|
// -------------------------------------------------------------------------------------
|
|
@@ -4087,11 +4087,11 @@ export const schedule: {
|
|
|
4087
4087
|
export const scheduleForked: {
|
|
4088
4088
|
<R2, Out>(
|
|
4089
4089
|
schedule: Schedule.Schedule<R2, unknown, Out>
|
|
4090
|
-
): <A, E, R>(self: Effect<A, E, R>) => Effect<Scope.Scope | R2 | R
|
|
4090
|
+
): <A, E, R>(self: Effect<A, E, R>) => Effect<Fiber.RuntimeFiber<Out, E>, never, Scope.Scope | R2 | R>
|
|
4091
4091
|
<R, E, A, R2, Out>(
|
|
4092
4092
|
self: Effect<A, E, R>,
|
|
4093
4093
|
schedule: Schedule.Schedule<R2, unknown, Out>
|
|
4094
|
-
): Effect<Scope.Scope | R | R2
|
|
4094
|
+
): Effect<Fiber.RuntimeFiber<Out, E>, never, Scope.Scope | R | R2>
|
|
4095
4095
|
} = circular.scheduleForked
|
|
4096
4096
|
|
|
4097
4097
|
/**
|
|
@@ -4524,6 +4524,28 @@ export const random: Effect<Random.Random> = effect.random
|
|
|
4524
4524
|
export const randomWith: <A, E, R>(f: (random: Random.Random) => Effect<A, E, R>) => Effect<A, E, R> =
|
|
4525
4525
|
defaultServices.randomWith
|
|
4526
4526
|
|
|
4527
|
+
/**
|
|
4528
|
+
* Executes the specified workflow with the specified implementation of the
|
|
4529
|
+
* random service.
|
|
4530
|
+
*
|
|
4531
|
+
* @since 2.0.0
|
|
4532
|
+
* @category random
|
|
4533
|
+
*/
|
|
4534
|
+
export const withRandom: {
|
|
4535
|
+
<X extends Random.Random>(value: X): <A, E, R>(effect: Effect<A, E, R>) => Effect<A, E, R>
|
|
4536
|
+
<X extends Random.Random, A, E, R>(effect: Effect<A, E, R>, value: X): Effect<A, E, R>
|
|
4537
|
+
} = defaultServices.withRandom
|
|
4538
|
+
|
|
4539
|
+
/**
|
|
4540
|
+
* Sets the implementation of the random service to the specified value and
|
|
4541
|
+
* restores it to its original value when the scope is closed.
|
|
4542
|
+
*
|
|
4543
|
+
* @since 2.0.0
|
|
4544
|
+
* @category constructors
|
|
4545
|
+
*/
|
|
4546
|
+
export const withRandomScoped: <A extends Random.Random>(value: A) => Effect<void, never, Scope.Scope> =
|
|
4547
|
+
fiberRuntime.withRandomScoped
|
|
4548
|
+
|
|
4527
4549
|
// -------------------------------------------------------------------------------------
|
|
4528
4550
|
// runtime
|
|
4529
4551
|
// -------------------------------------------------------------------------------------
|
package/src/FiberId.ts
CHANGED
|
@@ -23,7 +23,13 @@ export type FiberIdTypeId = typeof FiberIdTypeId
|
|
|
23
23
|
* @since 2.0.0
|
|
24
24
|
* @category models
|
|
25
25
|
*/
|
|
26
|
-
export type
|
|
26
|
+
export type Single = None | Runtime
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* @since 2.0.0
|
|
30
|
+
* @category models
|
|
31
|
+
*/
|
|
32
|
+
export type FiberId = Single | Composite
|
|
27
33
|
|
|
28
34
|
/**
|
|
29
35
|
* @since 2.0.0
|
|
@@ -32,6 +38,8 @@ export type FiberId = None | Runtime | Composite
|
|
|
32
38
|
export interface None extends Equal.Equal, Inspectable {
|
|
33
39
|
readonly [FiberIdTypeId]: FiberIdTypeId
|
|
34
40
|
readonly _tag: "None"
|
|
41
|
+
readonly id: -1
|
|
42
|
+
readonly startTimeMillis: -1
|
|
35
43
|
}
|
|
36
44
|
|
|
37
45
|
/**
|
|
@@ -60,19 +68,19 @@ export interface Composite extends Equal.Equal, Inspectable {
|
|
|
60
68
|
* @since 2.0.0
|
|
61
69
|
* @category constructors
|
|
62
70
|
*/
|
|
63
|
-
export const none:
|
|
71
|
+
export const none: None = internal.none
|
|
64
72
|
|
|
65
73
|
/**
|
|
66
74
|
* @since 2.0.0
|
|
67
75
|
* @category constructors
|
|
68
76
|
*/
|
|
69
|
-
export const runtime: (id: number, startTimeMillis: number) =>
|
|
77
|
+
export const runtime: (id: number, startTimeMillis: number) => Runtime = internal.runtime
|
|
70
78
|
|
|
71
79
|
/**
|
|
72
80
|
* @since 2.0.0
|
|
73
81
|
* @category constructors
|
|
74
82
|
*/
|
|
75
|
-
export const composite: (left: FiberId, right: FiberId) =>
|
|
83
|
+
export const composite: (left: FiberId, right: FiberId) => Composite = internal.composite
|
|
76
84
|
|
|
77
85
|
/**
|
|
78
86
|
* Returns `true` if the specified unknown value is a `FiberId`, `false`
|
package/src/FiberRefs.ts
CHANGED
|
@@ -33,7 +33,7 @@ export type FiberRefsSym = typeof FiberRefsSym
|
|
|
33
33
|
*/
|
|
34
34
|
export interface FiberRefs extends Pipeable {
|
|
35
35
|
readonly [FiberRefsSym]: FiberRefsSym
|
|
36
|
-
readonly locals: Map<FiberRef.FiberRef<any>, Arr.NonEmptyReadonlyArray<readonly [FiberId.
|
|
36
|
+
readonly locals: Map<FiberRef.FiberRef<any>, Arr.NonEmptyReadonlyArray<readonly [FiberId.Single, any]>>
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
const delete_: {
|
|
@@ -68,8 +68,8 @@ export const fiberRefs: (self: FiberRefs) => HashSet.HashSet<FiberRef.FiberRef<a
|
|
|
68
68
|
* @category utils
|
|
69
69
|
*/
|
|
70
70
|
export const forkAs: {
|
|
71
|
-
(childId: FiberId.
|
|
72
|
-
(self: FiberRefs, childId: FiberId.
|
|
71
|
+
(childId: FiberId.Single): (self: FiberRefs) => FiberRefs
|
|
72
|
+
(self: FiberRefs, childId: FiberId.Single): FiberRefs
|
|
73
73
|
} = internal.forkAs
|
|
74
74
|
|
|
75
75
|
/**
|
|
@@ -105,8 +105,8 @@ export const getOrDefault: {
|
|
|
105
105
|
* @category utils
|
|
106
106
|
*/
|
|
107
107
|
export const joinAs: {
|
|
108
|
-
(fiberId: FiberId.
|
|
109
|
-
(self: FiberRefs, fiberId: FiberId.
|
|
108
|
+
(fiberId: FiberId.Single, that: FiberRefs): (self: FiberRefs) => FiberRefs
|
|
109
|
+
(self: FiberRefs, fiberId: FiberId.Single, that: FiberRefs): FiberRefs
|
|
110
110
|
} = internal.joinAs
|
|
111
111
|
|
|
112
112
|
/**
|
|
@@ -126,7 +126,7 @@ export const setAll: (self: FiberRefs) => Effect.Effect<void> = internal.setAll
|
|
|
126
126
|
export const updateAs: {
|
|
127
127
|
<A>(
|
|
128
128
|
options: {
|
|
129
|
-
readonly fiberId: FiberId.
|
|
129
|
+
readonly fiberId: FiberId.Single
|
|
130
130
|
readonly fiberRef: FiberRef.FiberRef<A>
|
|
131
131
|
readonly value: A
|
|
132
132
|
}
|
|
@@ -134,7 +134,7 @@ export const updateAs: {
|
|
|
134
134
|
<A>(
|
|
135
135
|
self: FiberRefs,
|
|
136
136
|
options: {
|
|
137
|
-
readonly fiberId: FiberId.
|
|
137
|
+
readonly fiberId: FiberId.Single
|
|
138
138
|
readonly fiberRef: FiberRef.FiberRef<A>
|
|
139
139
|
readonly value: A
|
|
140
140
|
}
|
|
@@ -150,16 +150,16 @@ export const updateAs: {
|
|
|
150
150
|
export const updateManyAs: {
|
|
151
151
|
(
|
|
152
152
|
options: {
|
|
153
|
-
readonly forkAs?: FiberId.
|
|
153
|
+
readonly forkAs?: FiberId.Single | undefined
|
|
154
154
|
readonly entries: readonly [
|
|
155
155
|
readonly [
|
|
156
156
|
FiberRef.FiberRef<any>,
|
|
157
|
-
readonly [readonly [FiberId.
|
|
157
|
+
readonly [readonly [FiberId.Single, any], ...Array<readonly [FiberId.Single, any]>]
|
|
158
158
|
],
|
|
159
159
|
...Array<
|
|
160
160
|
readonly [
|
|
161
161
|
FiberRef.FiberRef<any>,
|
|
162
|
-
readonly [readonly [FiberId.
|
|
162
|
+
readonly [readonly [FiberId.Single, any], ...Array<readonly [FiberId.Single, any]>]
|
|
163
163
|
]
|
|
164
164
|
>
|
|
165
165
|
]
|
|
@@ -168,16 +168,16 @@ export const updateManyAs: {
|
|
|
168
168
|
(
|
|
169
169
|
self: FiberRefs,
|
|
170
170
|
options: {
|
|
171
|
-
readonly forkAs?: FiberId.
|
|
171
|
+
readonly forkAs?: FiberId.Single | undefined
|
|
172
172
|
readonly entries: readonly [
|
|
173
173
|
readonly [
|
|
174
174
|
FiberRef.FiberRef<any>,
|
|
175
|
-
readonly [readonly [FiberId.
|
|
175
|
+
readonly [readonly [FiberId.Single, any], ...Array<readonly [FiberId.Single, any]>]
|
|
176
176
|
],
|
|
177
177
|
...Array<
|
|
178
178
|
readonly [
|
|
179
179
|
FiberRef.FiberRef<any>,
|
|
180
|
-
readonly [readonly [FiberId.
|
|
180
|
+
readonly [readonly [FiberId.Single, any], ...Array<readonly [FiberId.Single, any]>]
|
|
181
181
|
]
|
|
182
182
|
>
|
|
183
183
|
]
|
|
@@ -192,7 +192,7 @@ export const updateManyAs: {
|
|
|
192
192
|
* @category unsafe
|
|
193
193
|
*/
|
|
194
194
|
export const unsafeMake: (
|
|
195
|
-
fiberRefLocals: Map<FiberRef.FiberRef<any>, Arr.NonEmptyReadonlyArray<readonly [FiberId.
|
|
195
|
+
fiberRefLocals: Map<FiberRef.FiberRef<any>, Arr.NonEmptyReadonlyArray<readonly [FiberId.Single, any]>>
|
|
196
196
|
) => FiberRefs = internal.unsafeMake
|
|
197
197
|
|
|
198
198
|
/**
|
package/src/Function.ts
CHANGED
|
@@ -202,6 +202,25 @@ export interface FunctionN<A extends ReadonlyArray<unknown>, B> {
|
|
|
202
202
|
*/
|
|
203
203
|
export const identity = <A>(a: A): A => a
|
|
204
204
|
|
|
205
|
+
/**
|
|
206
|
+
* A function that ensures that the type of an expression matches some type,
|
|
207
|
+
* without changing the resulting type of that expression.
|
|
208
|
+
*
|
|
209
|
+
* @example
|
|
210
|
+
* import { satisfies } from "effect/Function"
|
|
211
|
+
*
|
|
212
|
+
* const test1 = satisfies<number>()(5 as const)
|
|
213
|
+
* //^? const test: 5
|
|
214
|
+
* // @ts-expect-error
|
|
215
|
+
* const test2 = satisfies<string>()(5)
|
|
216
|
+
* //^? Argument of type 'number' is not assignable to parameter of type 'string'
|
|
217
|
+
*
|
|
218
|
+
* assert.deepStrictEqual(satisfies<number>()(5), 5)
|
|
219
|
+
*
|
|
220
|
+
* @since 2.0.0
|
|
221
|
+
*/
|
|
222
|
+
export const satisfies = <A>() => <B extends A>(b: B) => b
|
|
223
|
+
|
|
205
224
|
/**
|
|
206
225
|
* Casts the result to the specified type.
|
|
207
226
|
*
|
package/src/GlobalValue.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @since 2.0.0
|
|
3
3
|
*/
|
|
4
|
-
import
|
|
4
|
+
import * as version from "./internal/version.js"
|
|
5
5
|
|
|
6
|
-
const globalStoreId = Symbol.for(`effect/GlobalValue/globalStoreId/${
|
|
6
|
+
const globalStoreId = Symbol.for(`effect/GlobalValue/globalStoreId/${version.getCurrentVersion()}`)
|
|
7
7
|
|
|
8
8
|
if (!(globalStoreId in globalThis)) {
|
|
9
9
|
;(globalThis as any)[globalStoreId] = new Map()
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @since 2.0.0
|
|
3
|
+
*
|
|
4
|
+
* Enables low level framework authors to run on their own isolated effect version
|
|
5
|
+
*/
|
|
6
|
+
import * as internal from "./internal/version.js"
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @since 2.0.0
|
|
10
|
+
* @category version
|
|
11
|
+
*/
|
|
12
|
+
export const getCurrentVersion: () => string = internal.getCurrentVersion
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @since 2.0.0
|
|
16
|
+
* @category version
|
|
17
|
+
*/
|
|
18
|
+
export const setCurrentVersion: (version: string) => void = internal.setCurrentVersion
|
package/src/Random.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* @since 2.0.0
|
|
3
3
|
*/
|
|
4
4
|
import type * as Chunk from "./Chunk.js"
|
|
5
|
+
import type * as Context from "./Context.js"
|
|
5
6
|
import type * as Effect from "./Effect.js"
|
|
6
7
|
import * as defaultServices from "./internal/defaultServices.js"
|
|
7
8
|
import * as internal from "./internal/random.js"
|
|
@@ -111,3 +112,9 @@ export const shuffle: <A>(elements: Iterable<A>) => Effect.Effect<Chunk.Chunk<A>
|
|
|
111
112
|
*/
|
|
112
113
|
export const randomWith: <A, E, R>(f: (random: Random) => Effect.Effect<A, E, R>) => Effect.Effect<A, E, R> =
|
|
113
114
|
defaultServices.randomWith
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* @since 2.0.0
|
|
118
|
+
* @category context
|
|
119
|
+
*/
|
|
120
|
+
export const Random: Context.Tag<Random, Random> = internal.randomTag
|
package/src/RequestResolver.ts
CHANGED
|
@@ -160,6 +160,43 @@ export const around: {
|
|
|
160
160
|
): RequestResolver<A, R | R2 | R3>
|
|
161
161
|
} = internal.around
|
|
162
162
|
|
|
163
|
+
/**
|
|
164
|
+
* A data source aspect that executes requests between two effects, `before`
|
|
165
|
+
* and `after`, where the result of `before` can be used by `after`.
|
|
166
|
+
*
|
|
167
|
+
* The `before` and `after` effects are provided with the requests being executed.
|
|
168
|
+
*
|
|
169
|
+
* @since 2.0.0
|
|
170
|
+
* @category combinators
|
|
171
|
+
* @example
|
|
172
|
+
* import { Effect, Request, RequestResolver } from "effect"
|
|
173
|
+
*
|
|
174
|
+
* interface GetUserById extends Request.Request<unknown> {
|
|
175
|
+
* readonly id: number
|
|
176
|
+
* }
|
|
177
|
+
*
|
|
178
|
+
* const resolver = RequestResolver.fromFunction(
|
|
179
|
+
* (request: GetUserById) => ({ id: request.id, name: "John" })
|
|
180
|
+
* )
|
|
181
|
+
*
|
|
182
|
+
* RequestResolver.aroundRequests(
|
|
183
|
+
* resolver,
|
|
184
|
+
* (requests) => Effect.log(`got ${requests.length} requests`),
|
|
185
|
+
* (requests, _) => Effect.log(`finised running ${requests.length} requests`)
|
|
186
|
+
* )
|
|
187
|
+
*/
|
|
188
|
+
export const aroundRequests: {
|
|
189
|
+
<A, R2, A2, R3, _>(
|
|
190
|
+
before: (requests: ReadonlyArray<Types.NoInfer<A>>) => Effect.Effect<A2, never, R2>,
|
|
191
|
+
after: (requests: ReadonlyArray<Types.NoInfer<A>>, _: A2) => Effect.Effect<_, never, R3>
|
|
192
|
+
): <R>(self: RequestResolver<A, R>) => RequestResolver<A, R2 | R3 | R>
|
|
193
|
+
<R, A, R2, A2, R3, _>(
|
|
194
|
+
self: RequestResolver<A, R>,
|
|
195
|
+
before: (requests: ReadonlyArray<Types.NoInfer<A>>) => Effect.Effect<A2, never, R2>,
|
|
196
|
+
after: (requests: ReadonlyArray<Types.NoInfer<A>>, _: A2) => Effect.Effect<_, never, R3>
|
|
197
|
+
): RequestResolver<A, R | R2 | R3>
|
|
198
|
+
} = internal.aroundRequests
|
|
199
|
+
|
|
163
200
|
/**
|
|
164
201
|
* Returns a data source that executes at most `n` requests in parallel.
|
|
165
202
|
*
|
package/src/Runtime.ts
CHANGED
|
@@ -7,6 +7,7 @@ import type * as Effect from "./Effect.js"
|
|
|
7
7
|
import type * as Exit from "./Exit.js"
|
|
8
8
|
import type * as Fiber from "./Fiber.js"
|
|
9
9
|
import type * as FiberId from "./FiberId.js"
|
|
10
|
+
import type * as FiberRef from "./FiberRef.js"
|
|
10
11
|
import type * as FiberRefs from "./FiberRefs.js"
|
|
11
12
|
import type { Inspectable } from "./Inspectable.js"
|
|
12
13
|
import * as internal from "./internal/runtime.js"
|
|
@@ -277,3 +278,53 @@ export const provideService: {
|
|
|
277
278
|
<I, S>(tag: Context.Tag<I, S>, service: S): <R>(self: Runtime<R>) => Runtime<I | R>
|
|
278
279
|
<R, I, S>(self: Runtime<R>, tag: Context.Tag<I, S>, service: S): Runtime<R | I>
|
|
279
280
|
} = internal.provideService
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* @since 2.0.0
|
|
284
|
+
* @category fiber refs
|
|
285
|
+
*/
|
|
286
|
+
export const updateFiberRefs: {
|
|
287
|
+
(f: (fiberRefs: FiberRefs.FiberRefs) => FiberRefs.FiberRefs): <R>(self: Runtime<R>) => Runtime<R>
|
|
288
|
+
<R>(self: Runtime<R>, f: (fiberRefs: FiberRefs.FiberRefs) => FiberRefs.FiberRefs): Runtime<R>
|
|
289
|
+
} = internal.updateFiberRefs
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* @since 2.0.0
|
|
293
|
+
* @category fiber refs
|
|
294
|
+
* @example
|
|
295
|
+
* import { Effect, FiberRef, Runtime } from "effect"
|
|
296
|
+
*
|
|
297
|
+
* const ref = FiberRef.unsafeMake(0)
|
|
298
|
+
*
|
|
299
|
+
* const updatedRuntime = Runtime.defaultRuntime.pipe(
|
|
300
|
+
* Runtime.setFiberRef(ref, 1)
|
|
301
|
+
* )
|
|
302
|
+
*
|
|
303
|
+
* // returns 1
|
|
304
|
+
* const result = Runtime.runSync(updatedRuntime)(FiberRef.get(ref))
|
|
305
|
+
*/
|
|
306
|
+
export const setFiberRef: {
|
|
307
|
+
<A>(fiberRef: FiberRef.FiberRef<A>, value: A): <R>(self: Runtime<R>) => Runtime<R>
|
|
308
|
+
<R, A>(self: Runtime<R>, fiberRef: FiberRef.FiberRef<A>, value: A): Runtime<R>
|
|
309
|
+
} = internal.setFiberRef
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* @since 2.0.0
|
|
313
|
+
* @category fiber refs
|
|
314
|
+
* @example
|
|
315
|
+
* import { Effect, FiberRef, Runtime } from "effect"
|
|
316
|
+
*
|
|
317
|
+
* const ref = FiberRef.unsafeMake(0)
|
|
318
|
+
*
|
|
319
|
+
* const updatedRuntime = Runtime.defaultRuntime.pipe(
|
|
320
|
+
* Runtime.setFiberRef(ref, 1),
|
|
321
|
+
* Runtime.deleteFiberRef(ref)
|
|
322
|
+
* )
|
|
323
|
+
*
|
|
324
|
+
* // returns 0
|
|
325
|
+
* const result = Runtime.runSync(updatedRuntime)(FiberRef.get(ref))
|
|
326
|
+
*/
|
|
327
|
+
export const deleteFiberRef: {
|
|
328
|
+
<A>(fiberRef: FiberRef.FiberRef<A>): <R>(self: Runtime<R>) => Runtime<R>
|
|
329
|
+
<R, A>(self: Runtime<R>, fiberRef: FiberRef.FiberRef<A>): Runtime<R>
|
|
330
|
+
} = internal.deleteFiberRef
|
package/src/TestAnnotation.ts
CHANGED
|
@@ -12,6 +12,7 @@ import type * as MutableRef from "./MutableRef.js"
|
|
|
12
12
|
import { hasProperty } from "./Predicate.js"
|
|
13
13
|
import type * as SortedSet from "./SortedSet.js"
|
|
14
14
|
import type * as Types from "./Types.js"
|
|
15
|
+
|
|
15
16
|
/** @internal */
|
|
16
17
|
const TestAnnotationSymbolKey = "effect/TestAnnotation"
|
|
17
18
|
|
package/src/TestAnnotationMap.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @since 2.0.0
|
|
3
3
|
*/
|
|
4
|
-
import { dual
|
|
4
|
+
import { dual } from "./Function.js"
|
|
5
|
+
import * as HashMap from "./HashMap.js"
|
|
5
6
|
import { hasProperty } from "./Predicate.js"
|
|
6
7
|
import type * as TestAnnotation from "./TestAnnotation.js"
|
|
7
8
|
|
|
@@ -23,13 +24,13 @@ export type TestAnnotationMapTypeId = typeof TestAnnotationMapTypeId
|
|
|
23
24
|
export interface TestAnnotationMap {
|
|
24
25
|
readonly [TestAnnotationMapTypeId]: TestAnnotationMapTypeId
|
|
25
26
|
/** @internal */
|
|
26
|
-
readonly map:
|
|
27
|
+
readonly map: HashMap.HashMap<TestAnnotation.TestAnnotation<any>, any>
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
/** @internal */
|
|
30
31
|
class TestAnnotationMapImpl implements TestAnnotationMap {
|
|
31
32
|
readonly [TestAnnotationMapTypeId]: TestAnnotationMapTypeId = TestAnnotationMapTypeId
|
|
32
|
-
constructor(readonly map:
|
|
33
|
+
constructor(readonly map: HashMap.HashMap<TestAnnotation.TestAnnotation<any>, any>) {
|
|
33
34
|
}
|
|
34
35
|
}
|
|
35
36
|
|
|
@@ -41,12 +42,12 @@ export const isTestAnnotationMap = (u: unknown): u is TestAnnotationMap => hasPr
|
|
|
41
42
|
/**
|
|
42
43
|
* @since 2.0.0
|
|
43
44
|
*/
|
|
44
|
-
export const empty: (_: void) => TestAnnotationMap = () => new TestAnnotationMapImpl(
|
|
45
|
+
export const empty: (_: void) => TestAnnotationMap = () => new TestAnnotationMapImpl(HashMap.empty())
|
|
45
46
|
|
|
46
47
|
/**
|
|
47
48
|
* @since 2.0.0
|
|
48
49
|
*/
|
|
49
|
-
export const make = (map:
|
|
50
|
+
export const make = (map: HashMap.HashMap<TestAnnotation.TestAnnotation<any>, any>): TestAnnotationMap => {
|
|
50
51
|
return new TestAnnotationMapImpl(map)
|
|
51
52
|
}
|
|
52
53
|
|
|
@@ -56,11 +57,7 @@ export const make = (map: ReadonlyMap<TestAnnotation.TestAnnotation<unknown>, un
|
|
|
56
57
|
export const overwrite = dual<
|
|
57
58
|
<A>(key: TestAnnotation.TestAnnotation<A>, value: A) => (self: TestAnnotationMap) => TestAnnotationMap,
|
|
58
59
|
<A>(self: TestAnnotationMap, key: TestAnnotation.TestAnnotation<A>, value: A) => TestAnnotationMap
|
|
59
|
-
>(3, (self, key, value) =>
|
|
60
|
-
make(
|
|
61
|
-
(self.map as Map<TestAnnotation.TestAnnotation<unknown>, unknown>)
|
|
62
|
-
.set(key as TestAnnotation.TestAnnotation<unknown>, value)
|
|
63
|
-
))
|
|
60
|
+
>(3, (self, key, value) => make(HashMap.set(self.map, key, value)))
|
|
64
61
|
|
|
65
62
|
/**
|
|
66
63
|
* @since 2.0.0
|
|
@@ -69,11 +66,11 @@ export const update = dual<
|
|
|
69
66
|
<A>(key: TestAnnotation.TestAnnotation<A>, f: (value: A) => A) => (self: TestAnnotationMap) => TestAnnotationMap,
|
|
70
67
|
<A>(self: TestAnnotationMap, key: TestAnnotation.TestAnnotation<A>, f: (value: A) => A) => TestAnnotationMap
|
|
71
68
|
>(3, <A>(self: TestAnnotationMap, key: TestAnnotation.TestAnnotation<A>, f: (value: A) => A) => {
|
|
72
|
-
let value =
|
|
73
|
-
if (
|
|
74
|
-
value = key.
|
|
69
|
+
let value = key.initial
|
|
70
|
+
if (HashMap.has(self.map, key.identifier)) {
|
|
71
|
+
value = HashMap.unsafeGet(self.map, key.identifier) as A
|
|
75
72
|
}
|
|
76
|
-
return
|
|
73
|
+
return overwrite(self, key, f(value))
|
|
77
74
|
})
|
|
78
75
|
|
|
79
76
|
/**
|
|
@@ -86,11 +83,10 @@ export const get = dual<
|
|
|
86
83
|
<A>(key: TestAnnotation.TestAnnotation<A>) => (self: TestAnnotationMap) => A,
|
|
87
84
|
<A>(self: TestAnnotationMap, key: TestAnnotation.TestAnnotation<A>) => A
|
|
88
85
|
>(2, <A>(self: TestAnnotationMap, key: TestAnnotation.TestAnnotation<A>) => {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
return key.initial as A
|
|
86
|
+
if (HashMap.has(self.map, key.identifier)) {
|
|
87
|
+
return HashMap.unsafeGet(self.map, key.identifier) as A
|
|
92
88
|
}
|
|
93
|
-
return
|
|
89
|
+
return key.initial
|
|
94
90
|
})
|
|
95
91
|
|
|
96
92
|
/**
|
|
@@ -110,13 +106,13 @@ export const combine = dual<
|
|
|
110
106
|
(that: TestAnnotationMap) => (self: TestAnnotationMap) => TestAnnotationMap,
|
|
111
107
|
(self: TestAnnotationMap, that: TestAnnotationMap) => TestAnnotationMap
|
|
112
108
|
>(2, (self, that) => {
|
|
113
|
-
|
|
109
|
+
let result = self.map
|
|
114
110
|
for (const entry of that.map) {
|
|
115
|
-
if (
|
|
116
|
-
const value =
|
|
117
|
-
result.set(entry[0], entry[0].combine(value, entry[1]))
|
|
111
|
+
if (HashMap.has(result, entry[0])) {
|
|
112
|
+
const value = HashMap.get(result, entry[0])!
|
|
113
|
+
result = HashMap.set(result, entry[0], entry[0].combine(value, entry[1]))
|
|
118
114
|
} else {
|
|
119
|
-
result.set(entry[0], entry[1])
|
|
115
|
+
result = HashMap.set(result, entry[0], entry[1])
|
|
120
116
|
}
|
|
121
117
|
}
|
|
122
118
|
return make(result)
|
package/src/TestAnnotations.ts
CHANGED
|
@@ -40,6 +40,9 @@ export type TestAnnotationsTypeId = typeof TestAnnotationsTypeId
|
|
|
40
40
|
export interface TestAnnotations {
|
|
41
41
|
readonly [TestAnnotationsTypeId]: TestAnnotationsTypeId
|
|
42
42
|
|
|
43
|
+
/**
|
|
44
|
+
* A ref containing the bacnking map for all annotations
|
|
45
|
+
*/
|
|
43
46
|
readonly ref: Ref.Ref<TestAnnotationMap.TestAnnotationMap>
|
|
44
47
|
|
|
45
48
|
/**
|
package/src/index.ts
CHANGED
|
@@ -455,6 +455,13 @@ export * as MetricRegistry from "./MetricRegistry.js"
|
|
|
455
455
|
*/
|
|
456
456
|
export * as MetricState from "./MetricState.js"
|
|
457
457
|
|
|
458
|
+
/**
|
|
459
|
+
* @since 2.0.0
|
|
460
|
+
*
|
|
461
|
+
* Enables low level framework authors to run on their own isolated effect version
|
|
462
|
+
*/
|
|
463
|
+
export * as ModuleVersion from "./ModuleVersion.js"
|
|
464
|
+
|
|
458
465
|
/**
|
|
459
466
|
* @since 2.0.0
|
|
460
467
|
*/
|
package/src/internal/cache.ts
CHANGED
|
@@ -551,11 +551,11 @@ class CacheImpl<in out Key, in out Error, in out Value> implements Cache.Cache<K
|
|
|
551
551
|
switch (value._tag) {
|
|
552
552
|
case "Complete": {
|
|
553
553
|
this.trackAccess(value.key)
|
|
554
|
-
this.trackHit()
|
|
555
554
|
if (this.hasExpired(clock, value.timeToLiveMillis)) {
|
|
556
555
|
MutableHashMap.remove(this.cacheState.map, value.key.current)
|
|
557
556
|
return core.succeed(Option.none<Value>())
|
|
558
557
|
}
|
|
558
|
+
this.trackHit()
|
|
559
559
|
return core.map(value.exit, Option.some)
|
|
560
560
|
}
|
|
561
561
|
case "Pending": {
|
package/src/internal/cause.ts
CHANGED
|
@@ -1040,12 +1040,17 @@ export const prettyErrorMessage = (u: unknown): string => {
|
|
|
1040
1040
|
return `Error: ${u}`
|
|
1041
1041
|
}
|
|
1042
1042
|
// 2)
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1043
|
+
try {
|
|
1044
|
+
if (
|
|
1045
|
+
hasProperty(u, "toString") &&
|
|
1046
|
+
isFunction(u["toString"]) &&
|
|
1047
|
+
u["toString"] !== Object.prototype.toString &&
|
|
1048
|
+
u["toString"] !== Array.prototype.toString
|
|
1049
|
+
) {
|
|
1050
|
+
return u["toString"]()
|
|
1051
|
+
}
|
|
1052
|
+
} catch {
|
|
1053
|
+
// something's off, rollback to json
|
|
1049
1054
|
}
|
|
1050
1055
|
// 3)
|
|
1051
1056
|
return `Error: ${JSON.stringify(u)}`
|