effect 3.0.8 → 3.1.1
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/cjs/Channel.js.map +1 -1
- package/dist/cjs/Data.js +15 -1
- package/dist/cjs/Data.js.map +1 -1
- package/dist/cjs/Effect.js +43 -6
- package/dist/cjs/Effect.js.map +1 -1
- package/dist/cjs/Equal.js +26 -4
- package/dist/cjs/Equal.js.map +1 -1
- package/dist/cjs/Hash.js +29 -12
- package/dist/cjs/Hash.js.map +1 -1
- package/dist/cjs/Layer.js.map +1 -1
- package/dist/cjs/SortedMap.js +24 -1
- package/dist/cjs/SortedMap.js.map +1 -1
- package/dist/cjs/Stream.js +8 -3
- package/dist/cjs/Stream.js.map +1 -1
- package/dist/cjs/Tracer.js.map +1 -1
- package/dist/cjs/Utils.js +35 -1
- package/dist/cjs/Utils.js.map +1 -1
- package/dist/cjs/internal/channel.js.map +1 -1
- package/dist/cjs/internal/core-effect.js +1 -1
- package/dist/cjs/internal/core-effect.js.map +1 -1
- package/dist/cjs/internal/core.js +17 -4
- package/dist/cjs/internal/core.js.map +1 -1
- package/dist/cjs/internal/effect/circular.js +7 -1
- package/dist/cjs/internal/effect/circular.js.map +1 -1
- package/dist/cjs/internal/fiberRuntime.js +15 -1
- package/dist/cjs/internal/fiberRuntime.js.map +1 -1
- package/dist/cjs/internal/layer/circular.js.map +1 -1
- package/dist/cjs/internal/layer.js.map +1 -1
- package/dist/cjs/internal/stream.js +23 -3
- package/dist/cjs/internal/stream.js.map +1 -1
- package/dist/cjs/internal/tracer.js +4 -2
- package/dist/cjs/internal/tracer.js.map +1 -1
- package/dist/cjs/internal/version.js +1 -1
- package/dist/dts/Channel.d.ts +2 -14
- package/dist/dts/Channel.d.ts.map +1 -1
- package/dist/dts/Data.d.ts +20 -5
- package/dist/dts/Data.d.ts.map +1 -1
- package/dist/dts/Effect.d.ts +53 -52
- package/dist/dts/Effect.d.ts.map +1 -1
- package/dist/dts/Equal.d.ts.map +1 -1
- package/dist/dts/Hash.d.ts.map +1 -1
- package/dist/dts/Layer.d.ts +3 -18
- package/dist/dts/Layer.d.ts.map +1 -1
- package/dist/dts/SortedMap.d.ts +13 -0
- package/dist/dts/SortedMap.d.ts.map +1 -1
- package/dist/dts/Stream.d.ts +7 -14
- package/dist/dts/Stream.d.ts.map +1 -1
- package/dist/dts/Tracer.d.ts +19 -1
- package/dist/dts/Tracer.d.ts.map +1 -1
- package/dist/dts/Types.d.ts +18 -0
- package/dist/dts/Types.d.ts.map +1 -1
- package/dist/dts/Utils.d.ts +19 -0
- package/dist/dts/Utils.d.ts.map +1 -1
- package/dist/dts/internal/core.d.ts.map +1 -1
- package/dist/dts/internal/fiberRuntime.d.ts +6 -1
- package/dist/dts/internal/fiberRuntime.d.ts.map +1 -1
- package/dist/esm/Channel.js.map +1 -1
- package/dist/esm/Data.js +14 -0
- package/dist/esm/Data.js.map +1 -1
- package/dist/esm/Effect.js +39 -2
- package/dist/esm/Effect.js.map +1 -1
- package/dist/esm/Equal.js +26 -4
- package/dist/esm/Equal.js.map +1 -1
- package/dist/esm/Hash.js +30 -13
- package/dist/esm/Hash.js.map +1 -1
- package/dist/esm/Layer.js.map +1 -1
- package/dist/esm/SortedMap.js +22 -0
- package/dist/esm/SortedMap.js.map +1 -1
- package/dist/esm/Stream.js +5 -0
- package/dist/esm/Stream.js.map +1 -1
- package/dist/esm/Tracer.js.map +1 -1
- package/dist/esm/Utils.js +33 -0
- package/dist/esm/Utils.js.map +1 -1
- package/dist/esm/internal/channel.js.map +1 -1
- package/dist/esm/internal/core-effect.js +1 -1
- package/dist/esm/internal/core-effect.js.map +1 -1
- package/dist/esm/internal/core.js +17 -4
- package/dist/esm/internal/core.js.map +1 -1
- package/dist/esm/internal/effect/circular.js +6 -0
- package/dist/esm/internal/effect/circular.js.map +1 -1
- package/dist/esm/internal/fiberRuntime.js +13 -0
- package/dist/esm/internal/fiberRuntime.js.map +1 -1
- package/dist/esm/internal/layer/circular.js.map +1 -1
- package/dist/esm/internal/layer.js.map +1 -1
- package/dist/esm/internal/stream.js +19 -0
- package/dist/esm/internal/stream.js.map +1 -1
- package/dist/esm/internal/tracer.js +4 -2
- package/dist/esm/internal/tracer.js.map +1 -1
- package/dist/esm/internal/version.js +1 -1
- package/package.json +1 -1
- package/src/Channel.ts +2 -14
- package/src/Data.ts +39 -3
- package/src/Effect.ts +55 -52
- package/src/Equal.ts +30 -9
- package/src/Hash.ts +30 -13
- package/src/Layer.ts +3 -18
- package/src/SortedMap.ts +35 -0
- package/src/Stream.ts +12 -14
- package/src/Tracer.ts +22 -1
- package/src/Types.ts +21 -0
- package/src/Utils.ts +38 -0
- package/src/internal/channel.ts +2 -14
- package/src/internal/core-effect.ts +19 -43
- package/src/internal/core.ts +21 -4
- package/src/internal/effect/circular.ts +16 -0
- package/src/internal/fiberRuntime.ts +33 -21
- package/src/internal/layer/circular.ts +1 -6
- package/src/internal/layer.ts +17 -20
- package/src/internal/stream.ts +27 -14
- package/src/internal/tracer.ts +5 -3
- package/src/internal/version.ts +1 -1
|
@@ -31,6 +31,7 @@ export class NativeSpan {
|
|
|
31
31
|
context;
|
|
32
32
|
links;
|
|
33
33
|
startTime;
|
|
34
|
+
kind;
|
|
34
35
|
_tag = "Span";
|
|
35
36
|
spanId;
|
|
36
37
|
traceId = "native";
|
|
@@ -38,12 +39,13 @@ export class NativeSpan {
|
|
|
38
39
|
status;
|
|
39
40
|
attributes;
|
|
40
41
|
events = [];
|
|
41
|
-
constructor(name, parent, context, links, startTime) {
|
|
42
|
+
constructor(name, parent, context, links, startTime, kind) {
|
|
42
43
|
this.name = name;
|
|
43
44
|
this.parent = parent;
|
|
44
45
|
this.context = context;
|
|
45
46
|
this.links = links;
|
|
46
47
|
this.startTime = startTime;
|
|
48
|
+
this.kind = kind;
|
|
47
49
|
this.status = {
|
|
48
50
|
_tag: "Started",
|
|
49
51
|
startTime
|
|
@@ -69,7 +71,7 @@ export class NativeSpan {
|
|
|
69
71
|
}
|
|
70
72
|
/** @internal */
|
|
71
73
|
export const nativeTracer = /*#__PURE__*/make({
|
|
72
|
-
span: (name, parent, context, links, startTime) => new NativeSpan(name, parent, context, links, startTime),
|
|
74
|
+
span: (name, parent, context, links, startTime, kind) => new NativeSpan(name, parent, context, links, startTime, kind),
|
|
73
75
|
context: f => f()
|
|
74
76
|
});
|
|
75
77
|
/** @internal */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tracer.js","names":["Context","TracerTypeId","Symbol","for","make","options","tracerTag","GenericTag","spanTag","randomHexString","characters","charactersLength","length","result","i","charAt","Math","floor","random","NativeSpan","name","parent","context","links","startTime","_tag","spanId","traceId","sampled","status","attributes","events","constructor","Map","value","end","endTime","exit","attribute","key","set","event","push","nativeTracer","span","f","externalSpan","empty"],"sources":["../../../src/internal/tracer.ts"],"sourcesContent":[null],"mappings":"AAAA;;;AAGA,OAAO,KAAKA,OAAO,MAAM,eAAe;AAKxC;AACA,OAAO,MAAMC,YAAY,gBAAwBC,MAAM,CAACC,GAAG,CAAC,eAAe,CAAwB;AAEnG;AACA,OAAO,MAAMC,IAAI,GAAIC,OAAiD,KAAqB;EACzF,CAACJ,YAAY,GAAGA,YAAY;EAC5B,GAAGI;CACJ,CAAC;AAEF;AACA,OAAO,MAAMC,SAAS,gBAAGN,OAAO,CAACO,UAAU,CAAgB,eAAe,CAAC;AAE3E;AACA,OAAO,MAAMC,OAAO,gBAAGR,OAAO,CAACO,UAAU,CAAoC,mBAAmB,CAAC;AAEjG,MAAME,eAAe,gBAAI;EACvB,MAAMC,UAAU,GAAG,kBAAkB;EACrC,MAAMC,gBAAgB,GAAGD,UAAU,CAACE,MAAM;EAC1C,OAAO,UAASA,MAAc;IAC5B,IAAIC,MAAM,GAAG,EAAE;IACf,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGF,MAAM,EAAEE,CAAC,EAAE,EAAE;MAC/BD,MAAM,IAAIH,UAAU,CAACK,MAAM,CAACC,IAAI,CAACC,KAAK,CAACD,IAAI,CAACE,MAAM,EAAE,GAAGP,gBAAgB,CAAC,CAAC;IAC3E;IACA,OAAOE,MAAM;EACf,CAAC;AACH,CAAC,CAAC,CAAE;AAEJ;AACA,OAAM,MAAOM,UAAU;EAWVC,IAAA;EACAC,MAAA;EACAC,OAAA;EACAC,KAAA;EACAC,SAAA;
|
|
1
|
+
{"version":3,"file":"tracer.js","names":["Context","TracerTypeId","Symbol","for","make","options","tracerTag","GenericTag","spanTag","randomHexString","characters","charactersLength","length","result","i","charAt","Math","floor","random","NativeSpan","name","parent","context","links","startTime","kind","_tag","spanId","traceId","sampled","status","attributes","events","constructor","Map","value","end","endTime","exit","attribute","key","set","event","push","nativeTracer","span","f","externalSpan","empty"],"sources":["../../../src/internal/tracer.ts"],"sourcesContent":[null],"mappings":"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","ignoreList":[]}
|
package/package.json
CHANGED
package/src/Channel.ts
CHANGED
|
@@ -2107,26 +2107,14 @@ export const updateService: {
|
|
|
2107
2107
|
export const withSpan: {
|
|
2108
2108
|
(
|
|
2109
2109
|
name: string,
|
|
2110
|
-
options?:
|
|
2111
|
-
readonly attributes?: Record<string, unknown> | undefined
|
|
2112
|
-
readonly links?: ReadonlyArray<Tracer.SpanLink> | undefined
|
|
2113
|
-
readonly parent?: Tracer.AnySpan | undefined
|
|
2114
|
-
readonly root?: boolean | undefined
|
|
2115
|
-
readonly context?: Context.Context<never> | undefined
|
|
2116
|
-
} | undefined
|
|
2110
|
+
options?: Tracer.SpanOptions | undefined
|
|
2117
2111
|
): <OutElem, InElem, OutErr, InErr, OutDone, InDone, Env>(
|
|
2118
2112
|
self: Channel<OutElem, InElem, OutErr, InErr, OutDone, InDone, Env>
|
|
2119
2113
|
) => Channel<OutElem, InElem, OutErr, InErr, OutDone, InDone, Exclude<Env, Tracer.ParentSpan>>
|
|
2120
2114
|
<OutElem, InElem, OutErr, InErr, OutDone, InDone, Env>(
|
|
2121
2115
|
self: Channel<OutElem, InElem, OutErr, InErr, OutDone, InDone, Env>,
|
|
2122
2116
|
name: string,
|
|
2123
|
-
options?:
|
|
2124
|
-
readonly attributes?: Record<string, unknown> | undefined
|
|
2125
|
-
readonly links?: ReadonlyArray<Tracer.SpanLink> | undefined
|
|
2126
|
-
readonly parent?: Tracer.AnySpan | undefined
|
|
2127
|
-
readonly root?: boolean | undefined
|
|
2128
|
-
readonly context?: Context.Context<never> | undefined
|
|
2129
|
-
} | undefined
|
|
2117
|
+
options?: Tracer.SpanOptions | undefined
|
|
2130
2118
|
): Channel<OutElem, InElem, OutErr, InErr, OutDone, InDone, Exclude<Env, Tracer.ParentSpan>>
|
|
2131
2119
|
} = channel.withSpan
|
|
2132
2120
|
|
package/src/Data.ts
CHANGED
|
@@ -5,6 +5,7 @@ import type * as Cause from "./Cause.js"
|
|
|
5
5
|
import * as core from "./internal/core.js"
|
|
6
6
|
import * as internal from "./internal/data.js"
|
|
7
7
|
import { StructuralPrototype } from "./internal/effectable.js"
|
|
8
|
+
import * as Predicate from "./Predicate.js"
|
|
8
9
|
import type * as Types from "./Types.js"
|
|
9
10
|
|
|
10
11
|
/**
|
|
@@ -331,6 +332,23 @@ export declare namespace TaggedEnum {
|
|
|
331
332
|
A extends { readonly _tag: string },
|
|
332
333
|
K extends A["_tag"]
|
|
333
334
|
> = Extract<A, { readonly _tag: K }>
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* @since 3.1.0
|
|
338
|
+
*/
|
|
339
|
+
export type Constructor<A extends { readonly _tag: string }> = Types.Simplify<
|
|
340
|
+
& {
|
|
341
|
+
readonly [Tag in A["_tag"]]: Case.Constructor<Extract<A, { readonly _tag: Tag }>, "_tag">
|
|
342
|
+
}
|
|
343
|
+
& {
|
|
344
|
+
readonly $is: <Tag extends A["_tag"]>(tag: Tag) => (u: unknown) => u is Extract<A, { readonly _tag: Tag }>
|
|
345
|
+
readonly $match: <
|
|
346
|
+
Cases extends {
|
|
347
|
+
readonly [Tag in A["_tag"]]: (args: Extract<A, { readonly _tag: Tag }>) => any
|
|
348
|
+
}
|
|
349
|
+
>(cases: Cases) => (value: A) => ReturnType<Cases[A["_tag"]]>
|
|
350
|
+
}
|
|
351
|
+
>
|
|
334
352
|
}
|
|
335
353
|
|
|
336
354
|
/**
|
|
@@ -407,16 +425,34 @@ export const taggedEnum: {
|
|
|
407
425
|
) => TaggedEnum.Value<TaggedEnum.Kind<Z, A, B, C, D>, Tag>
|
|
408
426
|
}
|
|
409
427
|
|
|
410
|
-
<A extends { readonly _tag: string }>():
|
|
411
|
-
readonly [Tag in A["_tag"]]: Case.Constructor<Extract<A, { readonly _tag: Tag }>, "_tag">
|
|
412
|
-
}
|
|
428
|
+
<A extends { readonly _tag: string }>(): TaggedEnum.Constructor<A>
|
|
413
429
|
} = () =>
|
|
414
430
|
new Proxy({}, {
|
|
415
431
|
get(_target, tag, _receiver) {
|
|
432
|
+
if (tag === "$is") {
|
|
433
|
+
return taggedIs
|
|
434
|
+
} else if (tag === "$match") {
|
|
435
|
+
return taggedMatch
|
|
436
|
+
}
|
|
416
437
|
return tagged(tag as string)
|
|
417
438
|
}
|
|
418
439
|
}) as any
|
|
419
440
|
|
|
441
|
+
function taggedIs<A extends { readonly _tag: string }, Tag extends A["_tag"]>(tag: Tag) {
|
|
442
|
+
return Predicate.isTagged(tag)
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
function taggedMatch<
|
|
446
|
+
A extends { readonly _tag: string },
|
|
447
|
+
Cases extends {
|
|
448
|
+
readonly [K in A["_tag"]]: (args: Extract<A, { readonly _tag: K }>) => any
|
|
449
|
+
}
|
|
450
|
+
>(cases: Cases) {
|
|
451
|
+
return function(value: A): ReturnType<Cases[A["_tag"]]> {
|
|
452
|
+
return cases[value._tag as A["_tag"]](value as any)
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
|
|
420
456
|
/**
|
|
421
457
|
* Provides a constructor for a Case Class.
|
|
422
458
|
*
|
package/src/Effect.ts
CHANGED
|
@@ -2923,9 +2923,8 @@ export const timedWith: {
|
|
|
2923
2923
|
} = effect.timedWith
|
|
2924
2924
|
|
|
2925
2925
|
/**
|
|
2926
|
-
* Returns an effect that will timeout this effect,
|
|
2927
|
-
* timeout elapses before the effect has produced a value
|
|
2928
|
-
* `Some` of the produced value otherwise.
|
|
2926
|
+
* Returns an effect that will timeout this effect, failing with a `Cause.TimeoutException`
|
|
2927
|
+
* if the timeout elapses before the effect has produced a value.
|
|
2929
2928
|
*
|
|
2930
2929
|
* If the timeout elapses without producing a value, the running effect will
|
|
2931
2930
|
* be safely interrupted.
|
|
@@ -2946,6 +2945,30 @@ export const timeout: {
|
|
|
2946
2945
|
<A, E, R>(self: Effect<A, E, R>, duration: Duration.DurationInput): Effect<A, Cause.TimeoutException | E, R>
|
|
2947
2946
|
} = circular.timeout
|
|
2948
2947
|
|
|
2948
|
+
/**
|
|
2949
|
+
* Returns an effect that will timeout this effect, returning `None` if the
|
|
2950
|
+
* timeout elapses before the effect has produced a value; and returning
|
|
2951
|
+
* `Some` of the produced value otherwise.
|
|
2952
|
+
*
|
|
2953
|
+
* If the timeout elapses without producing a value, the running effect will
|
|
2954
|
+
* be safely interrupted.
|
|
2955
|
+
*
|
|
2956
|
+
* WARNING: The effect returned by this method will not itself return until
|
|
2957
|
+
* the underlying effect is actually interrupted. This leads to more
|
|
2958
|
+
* predictable resource utilization. If early return is desired, then instead
|
|
2959
|
+
* of using `effect.timeout(d)`, use `effect.disconnect.timeout(d)`, which
|
|
2960
|
+
* first disconnects the effect's interruption signal before performing the
|
|
2961
|
+
* timeout, resulting in earliest possible return, before an underlying effect
|
|
2962
|
+
* has been successfully interrupted.
|
|
2963
|
+
*
|
|
2964
|
+
* @since 3.1.0
|
|
2965
|
+
* @category delays & timeouts
|
|
2966
|
+
*/
|
|
2967
|
+
export const timeoutOption: {
|
|
2968
|
+
(duration: Duration.DurationInput): <A, E, R>(self: Effect<A, E, R>) => Effect<Option.Option<A>, E, R>
|
|
2969
|
+
<A, E, R>(self: Effect<A, E, R>, duration: Duration.DurationInput): Effect<Option.Option<A>, E, R>
|
|
2970
|
+
} = circular.timeoutOption
|
|
2971
|
+
|
|
2949
2972
|
/**
|
|
2950
2973
|
* The same as `timeout`, but instead of producing a `None` in the event of
|
|
2951
2974
|
* timeout, it will produce the specified error.
|
|
@@ -4429,6 +4452,28 @@ export const annotateLogs: {
|
|
|
4429
4452
|
<A, E, R>(effect: Effect<A, E, R>, values: Record<string, unknown>): Effect<A, E, R>
|
|
4430
4453
|
} = effect.annotateLogs
|
|
4431
4454
|
|
|
4455
|
+
/**
|
|
4456
|
+
* Annotates each log with the specified log annotation(s), until the Scope is closed.
|
|
4457
|
+
*
|
|
4458
|
+
* @since 3.1.0
|
|
4459
|
+
* @category logging
|
|
4460
|
+
* @example
|
|
4461
|
+
* import { Effect } from "effect"
|
|
4462
|
+
*
|
|
4463
|
+
* Effect.gen(function*() {
|
|
4464
|
+
* yield* Effect.log("no annotations")
|
|
4465
|
+
* yield* Effect.annotateLogsScoped({ foo: "bar" })
|
|
4466
|
+
* yield* Effect.log("annotated with foo=bar")
|
|
4467
|
+
* }).pipe(
|
|
4468
|
+
* Effect.scoped,
|
|
4469
|
+
* Effect.andThen(Effect.log("no annotations again"))
|
|
4470
|
+
* )
|
|
4471
|
+
*/
|
|
4472
|
+
export const annotateLogsScoped: {
|
|
4473
|
+
(key: string, value: unknown): Effect<void, never, Scope.Scope>
|
|
4474
|
+
(values: Record<string, unknown>): Effect<void, never, Scope.Scope>
|
|
4475
|
+
} = fiberRuntime.annotateLogsScoped
|
|
4476
|
+
|
|
4432
4477
|
/**
|
|
4433
4478
|
* Retrieves the log annotations associated with the current scope.
|
|
4434
4479
|
*
|
|
@@ -5174,13 +5219,7 @@ export const linkSpans: {
|
|
|
5174
5219
|
*/
|
|
5175
5220
|
export const makeSpan: (
|
|
5176
5221
|
name: string,
|
|
5177
|
-
options?:
|
|
5178
|
-
readonly attributes?: Record<string, unknown> | undefined
|
|
5179
|
-
readonly links?: ReadonlyArray<Tracer.SpanLink> | undefined
|
|
5180
|
-
readonly parent?: Tracer.AnySpan | undefined
|
|
5181
|
-
readonly root?: boolean | undefined
|
|
5182
|
-
readonly context?: Context.Context<never> | undefined
|
|
5183
|
-
}
|
|
5222
|
+
options?: Tracer.SpanOptions
|
|
5184
5223
|
) => Effect<Tracer.Span> = effect.makeSpan
|
|
5185
5224
|
|
|
5186
5225
|
/**
|
|
@@ -5195,13 +5234,7 @@ export const makeSpan: (
|
|
|
5195
5234
|
*/
|
|
5196
5235
|
export const makeSpanScoped: (
|
|
5197
5236
|
name: string,
|
|
5198
|
-
options?:
|
|
5199
|
-
readonly attributes?: Record<string, unknown> | undefined
|
|
5200
|
-
readonly links?: ReadonlyArray<Tracer.SpanLink> | undefined
|
|
5201
|
-
readonly parent?: Tracer.AnySpan | undefined
|
|
5202
|
-
readonly root?: boolean | undefined
|
|
5203
|
-
readonly context?: Context.Context<never> | undefined
|
|
5204
|
-
} | undefined
|
|
5237
|
+
options?: Tracer.SpanOptions | undefined
|
|
5205
5238
|
) => Effect<Tracer.Span, never, Scope.Scope> = fiberRuntime.makeSpanScoped
|
|
5206
5239
|
|
|
5207
5240
|
/**
|
|
@@ -5218,13 +5251,7 @@ export const useSpan: {
|
|
|
5218
5251
|
<A, E, R>(name: string, evaluate: (span: Tracer.Span) => Effect<A, E, R>): Effect<A, E, R>
|
|
5219
5252
|
<A, E, R>(
|
|
5220
5253
|
name: string,
|
|
5221
|
-
options:
|
|
5222
|
-
readonly attributes?: Record<string, unknown> | undefined
|
|
5223
|
-
readonly links?: ReadonlyArray<Tracer.SpanLink> | undefined
|
|
5224
|
-
readonly parent?: Tracer.AnySpan | undefined
|
|
5225
|
-
readonly root?: boolean | undefined
|
|
5226
|
-
readonly context?: Context.Context<never> | undefined
|
|
5227
|
-
},
|
|
5254
|
+
options: Tracer.SpanOptions,
|
|
5228
5255
|
evaluate: (span: Tracer.Span) => Effect<A, E, R>
|
|
5229
5256
|
): Effect<A, E, R>
|
|
5230
5257
|
} = effect.useSpan
|
|
@@ -5238,24 +5265,12 @@ export const useSpan: {
|
|
|
5238
5265
|
export const withSpan: {
|
|
5239
5266
|
(
|
|
5240
5267
|
name: string,
|
|
5241
|
-
options?:
|
|
5242
|
-
readonly attributes?: Record<string, unknown> | undefined
|
|
5243
|
-
readonly links?: ReadonlyArray<Tracer.SpanLink> | undefined
|
|
5244
|
-
readonly parent?: Tracer.AnySpan | undefined
|
|
5245
|
-
readonly root?: boolean | undefined
|
|
5246
|
-
readonly context?: Context.Context<never> | undefined
|
|
5247
|
-
} | undefined
|
|
5268
|
+
options?: Tracer.SpanOptions | undefined
|
|
5248
5269
|
): <A, E, R>(self: Effect<A, E, R>) => Effect<A, E, Exclude<R, Tracer.ParentSpan>>
|
|
5249
5270
|
<A, E, R>(
|
|
5250
5271
|
self: Effect<A, E, R>,
|
|
5251
5272
|
name: string,
|
|
5252
|
-
options?:
|
|
5253
|
-
readonly attributes?: Record<string, unknown> | undefined
|
|
5254
|
-
readonly links?: ReadonlyArray<Tracer.SpanLink> | undefined
|
|
5255
|
-
readonly parent?: Tracer.AnySpan | undefined
|
|
5256
|
-
readonly root?: boolean | undefined
|
|
5257
|
-
readonly context?: Context.Context<never> | undefined
|
|
5258
|
-
} | undefined
|
|
5273
|
+
options?: Tracer.SpanOptions | undefined
|
|
5259
5274
|
): Effect<A, E, Exclude<R, Tracer.ParentSpan>>
|
|
5260
5275
|
} = effect.withSpan
|
|
5261
5276
|
|
|
@@ -5270,24 +5285,12 @@ export const withSpan: {
|
|
|
5270
5285
|
export const withSpanScoped: {
|
|
5271
5286
|
(
|
|
5272
5287
|
name: string,
|
|
5273
|
-
options?:
|
|
5274
|
-
readonly attributes?: Record<string, unknown> | undefined
|
|
5275
|
-
readonly links?: ReadonlyArray<Tracer.SpanLink> | undefined
|
|
5276
|
-
readonly parent?: Tracer.AnySpan | undefined
|
|
5277
|
-
readonly root?: boolean | undefined
|
|
5278
|
-
readonly context?: Context.Context<never> | undefined
|
|
5279
|
-
}
|
|
5288
|
+
options?: Tracer.SpanOptions
|
|
5280
5289
|
): <A, E, R>(self: Effect<A, E, R>) => Effect<A, E, Exclude<R, Tracer.ParentSpan> | Scope.Scope>
|
|
5281
5290
|
<A, E, R>(
|
|
5282
5291
|
self: Effect<A, E, R>,
|
|
5283
5292
|
name: string,
|
|
5284
|
-
options?:
|
|
5285
|
-
readonly attributes?: Record<string, unknown> | undefined
|
|
5286
|
-
readonly links?: ReadonlyArray<Tracer.SpanLink> | undefined
|
|
5287
|
-
readonly parent?: Tracer.AnySpan | undefined
|
|
5288
|
-
readonly root?: boolean | undefined
|
|
5289
|
-
readonly context?: Context.Context<never> | undefined
|
|
5290
|
-
}
|
|
5293
|
+
options?: Tracer.SpanOptions
|
|
5291
5294
|
): Effect<A, E, Exclude<R, Tracer.ParentSpan> | Scope.Scope>
|
|
5292
5295
|
} = fiberRuntime.withSpanScoped
|
|
5293
5296
|
|
package/src/Equal.ts
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import type { Equivalence } from "./Equivalence.js"
|
|
5
5
|
import * as Hash from "./Hash.js"
|
|
6
6
|
import { hasProperty } from "./Predicate.js"
|
|
7
|
+
import { structuralRegionState } from "./Utils.js"
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* @since 2.0.0
|
|
@@ -32,7 +33,7 @@ export function equals(): any {
|
|
|
32
33
|
return compareBoth(arguments[0], arguments[1])
|
|
33
34
|
}
|
|
34
35
|
|
|
35
|
-
function compareBoth(self: unknown, that: unknown) {
|
|
36
|
+
function compareBoth(self: unknown, that: unknown): boolean {
|
|
36
37
|
if (self === that) {
|
|
37
38
|
return true
|
|
38
39
|
}
|
|
@@ -40,16 +41,36 @@ function compareBoth(self: unknown, that: unknown) {
|
|
|
40
41
|
if (selfType !== typeof that) {
|
|
41
42
|
return false
|
|
42
43
|
}
|
|
43
|
-
if (
|
|
44
|
-
(
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
44
|
+
if (selfType === "object" || selfType === "function") {
|
|
45
|
+
if (self !== null && that !== null) {
|
|
46
|
+
if (isEqual(self) && isEqual(that)) {
|
|
47
|
+
return Hash.hash(self) === Hash.hash(that) && self[symbol](that)
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
if (structuralRegionState.enabled) {
|
|
51
|
+
if (Array.isArray(self) && Array.isArray(that)) {
|
|
52
|
+
return self.length === that.length && self.every((v, i) => compareBoth(v, that[i]))
|
|
53
|
+
}
|
|
54
|
+
if (Object.getPrototypeOf(self) === Object.prototype && Object.getPrototypeOf(self) === Object.prototype) {
|
|
55
|
+
const keysSelf = Object.keys(self as any)
|
|
56
|
+
const keysThat = Object.keys(that as any)
|
|
57
|
+
if (keysSelf.length === keysThat.length) {
|
|
58
|
+
for (const key of keysSelf) {
|
|
59
|
+
// @ts-expect-error
|
|
60
|
+
if (!(key in that && compareBoth(self[key], that[key]))) {
|
|
61
|
+
return structuralRegionState.tester ? structuralRegionState.tester(self, that) : false
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return true
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return structuralRegionState.tester ? structuralRegionState.tester(self, that) : false
|
|
50
68
|
}
|
|
51
69
|
}
|
|
52
|
-
|
|
70
|
+
|
|
71
|
+
return structuralRegionState.enabled && structuralRegionState.tester
|
|
72
|
+
? structuralRegionState.tester(self, that)
|
|
73
|
+
: false
|
|
53
74
|
}
|
|
54
75
|
|
|
55
76
|
/**
|
package/src/Hash.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { pipe } from "./Function.js"
|
|
5
5
|
import { globalValue } from "./GlobalValue.js"
|
|
6
6
|
import { hasProperty } from "./Predicate.js"
|
|
7
|
-
import { PCGRandom } from "./Utils.js"
|
|
7
|
+
import { PCGRandom, structuralRegionState } from "./Utils.js"
|
|
8
8
|
|
|
9
9
|
/** @internal */
|
|
10
10
|
const randomHashCache = globalValue(
|
|
@@ -72,6 +72,9 @@ export const hash: <A>(self: A) => number = <A>(self: A) => {
|
|
|
72
72
|
* @category hashing
|
|
73
73
|
*/
|
|
74
74
|
export const random: <A extends object>(self: A) => number = (self) => {
|
|
75
|
+
if (structuralRegionState.enabled === true) {
|
|
76
|
+
return 0
|
|
77
|
+
}
|
|
75
78
|
if (!randomHashCache.has(self)) {
|
|
76
79
|
randomHashCache.set(self, number(pcgr.integer(Number.MAX_SAFE_INTEGER)))
|
|
77
80
|
}
|
|
@@ -168,22 +171,36 @@ export const cached: {
|
|
|
168
171
|
if (arguments.length === 1) {
|
|
169
172
|
const self = arguments[0] as object
|
|
170
173
|
return function(hash: number) {
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
174
|
+
// @ts-expect-error
|
|
175
|
+
const original = self[symbol].bind(self)
|
|
176
|
+
if (structuralRegionState.enabled === false) {
|
|
177
|
+
Object.defineProperty(self, symbol, {
|
|
178
|
+
value() {
|
|
179
|
+
if (structuralRegionState.enabled === true) {
|
|
180
|
+
return original()
|
|
181
|
+
}
|
|
182
|
+
return hash
|
|
183
|
+
},
|
|
184
|
+
enumerable: false
|
|
185
|
+
})
|
|
186
|
+
}
|
|
177
187
|
return hash
|
|
178
188
|
} as any
|
|
179
189
|
}
|
|
180
190
|
const self = arguments[0] as object
|
|
181
191
|
const hash = arguments[1] as number
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
192
|
+
// @ts-expect-error
|
|
193
|
+
const original = self[symbol].bind(self)
|
|
194
|
+
if (structuralRegionState.enabled === false) {
|
|
195
|
+
Object.defineProperty(self, symbol, {
|
|
196
|
+
value() {
|
|
197
|
+
if (structuralRegionState.enabled === true) {
|
|
198
|
+
return original()
|
|
199
|
+
}
|
|
200
|
+
return hash
|
|
201
|
+
},
|
|
202
|
+
enumerable: false
|
|
203
|
+
})
|
|
204
|
+
}
|
|
188
205
|
return hash
|
|
189
206
|
}
|
package/src/Layer.ts
CHANGED
|
@@ -959,12 +959,7 @@ export const setScheduler: (scheduler: Scheduler.Scheduler) => Layer<never> = (
|
|
|
959
959
|
*/
|
|
960
960
|
export const span: (
|
|
961
961
|
name: string,
|
|
962
|
-
options?: {
|
|
963
|
-
readonly attributes?: Record<string, unknown> | undefined
|
|
964
|
-
readonly links?: ReadonlyArray<Tracer.SpanLink> | undefined
|
|
965
|
-
readonly parent?: Tracer.AnySpan | undefined
|
|
966
|
-
readonly root?: boolean | undefined
|
|
967
|
-
readonly context?: Context.Context<never> | undefined
|
|
962
|
+
options?: Tracer.SpanOptions & {
|
|
968
963
|
readonly onEnd?:
|
|
969
964
|
| ((span: Tracer.Span, exit: Exit.Exit<unknown, unknown>) => Effect.Effect<void>)
|
|
970
965
|
| undefined
|
|
@@ -1015,12 +1010,7 @@ export const setUnhandledErrorLogLevel: (level: Option.Option<LogLevel>) => Laye
|
|
|
1015
1010
|
export const withSpan: {
|
|
1016
1011
|
(
|
|
1017
1012
|
name: string,
|
|
1018
|
-
options?: {
|
|
1019
|
-
readonly attributes?: Record<string, unknown> | undefined
|
|
1020
|
-
readonly links?: ReadonlyArray<Tracer.SpanLink> | undefined
|
|
1021
|
-
readonly parent?: Tracer.AnySpan | undefined
|
|
1022
|
-
readonly root?: boolean | undefined
|
|
1023
|
-
readonly context?: Context.Context<never> | undefined
|
|
1013
|
+
options?: Tracer.SpanOptions & {
|
|
1024
1014
|
readonly onEnd?:
|
|
1025
1015
|
| ((span: Tracer.Span, exit: Exit.Exit<unknown, unknown>) => Effect.Effect<void>)
|
|
1026
1016
|
| undefined
|
|
@@ -1029,12 +1019,7 @@ export const withSpan: {
|
|
|
1029
1019
|
<A, E, R>(
|
|
1030
1020
|
self: Layer<A, E, R>,
|
|
1031
1021
|
name: string,
|
|
1032
|
-
options?: {
|
|
1033
|
-
readonly attributes?: Record<string, unknown> | undefined
|
|
1034
|
-
readonly links?: ReadonlyArray<Tracer.SpanLink> | undefined
|
|
1035
|
-
readonly parent?: Tracer.AnySpan | undefined
|
|
1036
|
-
readonly root?: boolean | undefined
|
|
1037
|
-
readonly context?: Context.Context<never> | undefined
|
|
1022
|
+
options?: Tracer.SpanOptions & {
|
|
1038
1023
|
readonly onEnd?:
|
|
1039
1024
|
| ((span: Tracer.Span, exit: Exit.Exit<unknown, unknown>) => Effect.Effect<void>)
|
|
1040
1025
|
| undefined
|
package/src/SortedMap.ts
CHANGED
|
@@ -250,3 +250,38 @@ export const entries = <K, V>(self: SortedMap<K, V>): IterableIterator<[K, V]> =
|
|
|
250
250
|
iterator[Symbol.iterator] = () => entries(self)
|
|
251
251
|
return iterator
|
|
252
252
|
}
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* @since 3.1.0
|
|
256
|
+
* @category elements
|
|
257
|
+
*/
|
|
258
|
+
export const lastOption = <K, V>(self: SortedMap<K, V>): Option.Option<[K, V]> => RBT.last(self.tree)
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* @since 3.1.0
|
|
262
|
+
* @category filtering
|
|
263
|
+
*/
|
|
264
|
+
export const partition: {
|
|
265
|
+
<K, V>(
|
|
266
|
+
predicate: (a: Types.NoInfer<K>) => boolean
|
|
267
|
+
): (self: SortedMap<K, V>) => [excluded: SortedMap<K, V>, satisfying: SortedMap<K, V>]
|
|
268
|
+
<K, V>(self: SortedMap<K, V>, predicate: (a: K) => boolean): [excluded: SortedMap<K, V>, satisfying: SortedMap<K, V>]
|
|
269
|
+
} = Dual.dual(
|
|
270
|
+
2,
|
|
271
|
+
<K, V>(
|
|
272
|
+
self: SortedMap<K, V>,
|
|
273
|
+
predicate: (a: K) => boolean
|
|
274
|
+
): [excluded: SortedMap<K, V>, satisfying: SortedMap<K, V>] => {
|
|
275
|
+
const ord = RBT.getOrder(self.tree)
|
|
276
|
+
let right = empty<K, V>(ord)
|
|
277
|
+
let left = empty<K, V>(ord)
|
|
278
|
+
for (const value of self) {
|
|
279
|
+
if (predicate(value[0])) {
|
|
280
|
+
right = set(right, value[0], value[1])
|
|
281
|
+
} else {
|
|
282
|
+
left = set(left, value[0], value[1])
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
return [left, right]
|
|
286
|
+
}
|
|
287
|
+
)
|
package/src/Stream.ts
CHANGED
|
@@ -4025,24 +4025,12 @@ export const whenEffect: {
|
|
|
4025
4025
|
export const withSpan: {
|
|
4026
4026
|
(
|
|
4027
4027
|
name: string,
|
|
4028
|
-
options?:
|
|
4029
|
-
readonly attributes?: Record<string, unknown> | undefined
|
|
4030
|
-
readonly links?: ReadonlyArray<Tracer.SpanLink> | undefined
|
|
4031
|
-
readonly parent?: Tracer.AnySpan | undefined
|
|
4032
|
-
readonly root?: boolean | undefined
|
|
4033
|
-
readonly context?: Context.Context<never> | undefined
|
|
4034
|
-
} | undefined
|
|
4028
|
+
options?: Tracer.SpanOptions | undefined
|
|
4035
4029
|
): <A, E, R>(self: Stream<A, E, R>) => Stream<A, E, Exclude<R, Tracer.ParentSpan>>
|
|
4036
4030
|
<A, E, R>(
|
|
4037
4031
|
self: Stream<A, E, R>,
|
|
4038
4032
|
name: string,
|
|
4039
|
-
options?:
|
|
4040
|
-
readonly attributes?: Record<string, unknown> | undefined
|
|
4041
|
-
readonly links?: ReadonlyArray<Tracer.SpanLink> | undefined
|
|
4042
|
-
readonly parent?: Tracer.AnySpan | undefined
|
|
4043
|
-
readonly root?: boolean | undefined
|
|
4044
|
-
readonly context?: Context.Context<never> | undefined
|
|
4045
|
-
} | undefined
|
|
4033
|
+
options?: Tracer.SpanOptions | undefined
|
|
4046
4034
|
): Stream<A, E, Exclude<R, Tracer.ParentSpan>>
|
|
4047
4035
|
} = internal.withSpan
|
|
4048
4036
|
|
|
@@ -4558,3 +4546,13 @@ export const decodeText: {
|
|
|
4558
4546
|
* @category encoding
|
|
4559
4547
|
*/
|
|
4560
4548
|
export const encodeText: <E, R>(self: Stream<string, E, R>) => Stream<Uint8Array, E, R> = internal.encodeText
|
|
4549
|
+
|
|
4550
|
+
/**
|
|
4551
|
+
* Creates a `Stream` using addEventListener.
|
|
4552
|
+
* @since 3.1.0
|
|
4553
|
+
*/
|
|
4554
|
+
export const fromEventListener: <A = Event>(
|
|
4555
|
+
target: EventTarget,
|
|
4556
|
+
type: string,
|
|
4557
|
+
options?: boolean | Omit<AddEventListenerOptions, "signal">
|
|
4558
|
+
) => Stream<A> = internal.fromEventListener
|
package/src/Tracer.ts
CHANGED
|
@@ -29,7 +29,8 @@ export interface Tracer {
|
|
|
29
29
|
parent: Option.Option<AnySpan>,
|
|
30
30
|
context: Context.Context<never>,
|
|
31
31
|
links: ReadonlyArray<SpanLink>,
|
|
32
|
-
startTime: bigint
|
|
32
|
+
startTime: bigint,
|
|
33
|
+
kind: SpanKind
|
|
33
34
|
): Span
|
|
34
35
|
context<X>(f: () => X, fiber: Fiber.RuntimeFiber<any, any>): X
|
|
35
36
|
}
|
|
@@ -80,6 +81,25 @@ export interface ExternalSpan {
|
|
|
80
81
|
readonly context: Context.Context<never>
|
|
81
82
|
}
|
|
82
83
|
|
|
84
|
+
/**
|
|
85
|
+
* @since 3.1.0
|
|
86
|
+
* @category models
|
|
87
|
+
*/
|
|
88
|
+
export interface SpanOptions {
|
|
89
|
+
readonly attributes?: Record<string, unknown> | undefined
|
|
90
|
+
readonly links?: ReadonlyArray<SpanLink> | undefined
|
|
91
|
+
readonly parent?: AnySpan | undefined
|
|
92
|
+
readonly root?: boolean | undefined
|
|
93
|
+
readonly context?: Context.Context<never> | undefined
|
|
94
|
+
readonly kind?: SpanKind | undefined
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* @since 3.1.0
|
|
99
|
+
* @category models
|
|
100
|
+
*/
|
|
101
|
+
export type SpanKind = "internal" | "server" | "client" | "producer" | "consumer"
|
|
102
|
+
|
|
83
103
|
/**
|
|
84
104
|
* @since 2.0.0
|
|
85
105
|
* @category models
|
|
@@ -95,6 +115,7 @@ export interface Span {
|
|
|
95
115
|
readonly attributes: ReadonlyMap<string, unknown>
|
|
96
116
|
readonly links: ReadonlyArray<SpanLink>
|
|
97
117
|
readonly sampled: boolean
|
|
118
|
+
readonly kind: SpanKind
|
|
98
119
|
end(endTime: bigint, exit: Exit.Exit<unknown, unknown>): void
|
|
99
120
|
attribute(key: string, value: unknown): void
|
|
100
121
|
event(name: string, startTime: bigint, attributes?: Record<string, unknown>): void
|
package/src/Types.ts
CHANGED
|
@@ -170,6 +170,27 @@ export type Mutable<T> = {
|
|
|
170
170
|
-readonly [P in keyof T]: T[P]
|
|
171
171
|
}
|
|
172
172
|
|
|
173
|
+
/**
|
|
174
|
+
* Like `Types.Mutable`, but works recursively.
|
|
175
|
+
*
|
|
176
|
+
* @example
|
|
177
|
+
* import type * as Types from "effect/Types"
|
|
178
|
+
*
|
|
179
|
+
* type DeepMutableStruct = Types.DeepMutable<{
|
|
180
|
+
* readonly a: string;
|
|
181
|
+
* readonly b: readonly string[]
|
|
182
|
+
* }>
|
|
183
|
+
* // { a: string; b: string[] }
|
|
184
|
+
*
|
|
185
|
+
* @since 3.1.0
|
|
186
|
+
* @category types
|
|
187
|
+
*/
|
|
188
|
+
export type DeepMutable<T> = T extends ReadonlyMap<infer K, infer V> ? Map<DeepMutable<K>, DeepMutable<V>>
|
|
189
|
+
: T extends ReadonlySet<infer V> ? Set<DeepMutable<V>>
|
|
190
|
+
: T extends ReadonlyArray<infer V> ? Array<DeepMutable<V>>
|
|
191
|
+
: [keyof T] extends [never] ? T
|
|
192
|
+
: { -readonly [K in keyof T]: DeepMutable<T[K]> }
|
|
193
|
+
|
|
173
194
|
/**
|
|
174
195
|
* Avoid inference on a specific parameter
|
|
175
196
|
*
|