effect 3.0.8 → 3.1.0
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/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/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 +1 -0
- 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/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/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/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/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 +1 -0
- 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/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/internal/channel.ts +2 -14
- package/src/internal/core-effect.ts +19 -43
- package/src/internal/core.ts +1 -0
- 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/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
|
*
|
package/src/internal/channel.ts
CHANGED
|
@@ -2313,26 +2313,14 @@ export const updateService = dual<
|
|
|
2313
2313
|
export const withSpan = dual<
|
|
2314
2314
|
(
|
|
2315
2315
|
name: string,
|
|
2316
|
-
options?:
|
|
2317
|
-
readonly attributes?: Record<string, unknown> | undefined
|
|
2318
|
-
readonly links?: ReadonlyArray<Tracer.SpanLink> | undefined
|
|
2319
|
-
readonly parent?: Tracer.AnySpan | undefined
|
|
2320
|
-
readonly root?: boolean | undefined
|
|
2321
|
-
readonly context?: Context.Context<never> | undefined
|
|
2322
|
-
}
|
|
2316
|
+
options?: Tracer.SpanOptions
|
|
2323
2317
|
) => <OutElem, InElem, OutErr, InErr, OutDone, InDone, Env>(
|
|
2324
2318
|
self: Channel.Channel<OutElem, InElem, OutErr, InErr, OutDone, InDone, Env>
|
|
2325
2319
|
) => Channel.Channel<OutElem, InElem, OutErr, InErr, OutDone, InDone, Exclude<Env, Tracer.ParentSpan>>,
|
|
2326
2320
|
<OutElem, InElem, OutErr, InErr, OutDone, InDone, Env>(
|
|
2327
2321
|
self: Channel.Channel<OutElem, InElem, OutErr, InErr, OutDone, InDone, Env>,
|
|
2328
2322
|
name: string,
|
|
2329
|
-
options?:
|
|
2330
|
-
readonly attributes?: Record<string, unknown> | undefined
|
|
2331
|
-
readonly links?: ReadonlyArray<Tracer.SpanLink> | undefined
|
|
2332
|
-
readonly parent?: Tracer.AnySpan | undefined
|
|
2333
|
-
readonly root?: boolean | undefined
|
|
2334
|
-
readonly context?: Context.Context<never> | undefined
|
|
2335
|
-
}
|
|
2323
|
+
options?: Tracer.SpanOptions
|
|
2336
2324
|
) => Channel.Channel<OutElem, InElem, OutErr, InErr, OutDone, InDone, Exclude<Env, Tracer.ParentSpan>>
|
|
2337
2325
|
>(3, (self, name, options) =>
|
|
2338
2326
|
unwrapScoped(
|
|
@@ -2027,13 +2027,7 @@ const bigint0 = BigInt(0)
|
|
|
2027
2027
|
export const unsafeMakeSpan = <XA, XE>(
|
|
2028
2028
|
fiber: FiberRuntime<XA, XE>,
|
|
2029
2029
|
name: string,
|
|
2030
|
-
options?:
|
|
2031
|
-
readonly attributes?: Record<string, unknown> | undefined
|
|
2032
|
-
readonly links?: ReadonlyArray<Tracer.SpanLink> | undefined
|
|
2033
|
-
readonly parent?: Tracer.AnySpan | undefined
|
|
2034
|
-
readonly root?: boolean | undefined
|
|
2035
|
-
readonly context?: Context.Context<never> | undefined
|
|
2036
|
-
}
|
|
2030
|
+
options?: Tracer.SpanOptions
|
|
2037
2031
|
) => {
|
|
2038
2032
|
const enabled = fiber.getFiberRef(core.currentTracerEnabled)
|
|
2039
2033
|
if (enabled === false) {
|
|
@@ -2071,7 +2065,8 @@ export const unsafeMakeSpan = <XA, XE>(
|
|
|
2071
2065
|
parent,
|
|
2072
2066
|
options?.context ?? Context.empty(),
|
|
2073
2067
|
links,
|
|
2074
|
-
timingEnabled ? clock.unsafeCurrentTimeNanos() : bigint0
|
|
2068
|
+
timingEnabled ? clock.unsafeCurrentTimeNanos() : bigint0,
|
|
2069
|
+
options?.kind ?? "internal"
|
|
2075
2070
|
)
|
|
2076
2071
|
|
|
2077
2072
|
if (annotationsFromEnv._tag === "Some") {
|
|
@@ -2087,13 +2082,7 @@ export const unsafeMakeSpan = <XA, XE>(
|
|
|
2087
2082
|
/** @internal */
|
|
2088
2083
|
export const makeSpan = (
|
|
2089
2084
|
name: string,
|
|
2090
|
-
options?:
|
|
2091
|
-
readonly attributes?: Record<string, unknown> | undefined
|
|
2092
|
-
readonly links?: ReadonlyArray<Tracer.SpanLink> | undefined
|
|
2093
|
-
readonly parent?: Tracer.AnySpan | undefined
|
|
2094
|
-
readonly root?: boolean | undefined
|
|
2095
|
-
readonly context?: Context.Context<never> | undefined
|
|
2096
|
-
}
|
|
2085
|
+
options?: Tracer.SpanOptions
|
|
2097
2086
|
): Effect.Effect<Tracer.Span> => core.withFiberRuntime((fiber) => core.succeed(unsafeMakeSpan(fiber, name, options)))
|
|
2098
2087
|
|
|
2099
2088
|
/* @internal */
|
|
@@ -2107,13 +2096,11 @@ export const spanLinks: Effect.Effect<Chunk.Chunk<Tracer.SpanLink>> = core
|
|
|
2107
2096
|
/** @internal */
|
|
2108
2097
|
export const useSpan: {
|
|
2109
2098
|
<A, E, R>(name: string, evaluate: (span: Tracer.Span) => Effect.Effect<A, E, R>): Effect.Effect<A, E, R>
|
|
2110
|
-
<A, E, R>(
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
readonly context?: Context.Context<never> | undefined
|
|
2116
|
-
}, evaluate: (span: Tracer.Span) => Effect.Effect<A, E, R>): Effect.Effect<A, E, R>
|
|
2099
|
+
<A, E, R>(
|
|
2100
|
+
name: string,
|
|
2101
|
+
options: Tracer.SpanOptions,
|
|
2102
|
+
evaluate: (span: Tracer.Span) => Effect.Effect<A, E, R>
|
|
2103
|
+
): Effect.Effect<A, E, R>
|
|
2117
2104
|
} = <A, E, R>(
|
|
2118
2105
|
name: string,
|
|
2119
2106
|
...args: [evaluate: (span: Tracer.Span) => Effect.Effect<A, E, R>] | [
|
|
@@ -2121,13 +2108,7 @@ export const useSpan: {
|
|
|
2121
2108
|
evaluate: (span: Tracer.Span) => Effect.Effect<A, E, R>
|
|
2122
2109
|
]
|
|
2123
2110
|
) => {
|
|
2124
|
-
const options:
|
|
2125
|
-
readonly attributes?: Record<string, unknown> | undefined
|
|
2126
|
-
readonly links?: ReadonlyArray<Tracer.SpanLink> | undefined
|
|
2127
|
-
readonly parent?: Tracer.AnySpan | undefined
|
|
2128
|
-
readonly root?: boolean | undefined
|
|
2129
|
-
readonly context?: Context.Context<never> | undefined
|
|
2130
|
-
} | undefined = args.length === 1 ? undefined : args[0]
|
|
2111
|
+
const options: Tracer.SpanOptions | undefined = args.length === 1 ? undefined : args[0]
|
|
2131
2112
|
const evaluate: (span: Tracer.Span) => Effect.Effect<A, E, R> = args[args.length - 1]
|
|
2132
2113
|
|
|
2133
2114
|
return core.withFiberRuntime<A, E, R>((fiber) => {
|
|
@@ -2154,20 +2135,15 @@ export const withParentSpan = dual<
|
|
|
2154
2135
|
|
|
2155
2136
|
/** @internal */
|
|
2156
2137
|
export const withSpan = dual<
|
|
2157
|
-
(
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
readonly links?: ReadonlyArray<Tracer.SpanLink> | undefined
|
|
2167
|
-
readonly parent?: Tracer.AnySpan | undefined
|
|
2168
|
-
readonly root?: boolean | undefined
|
|
2169
|
-
readonly context?: Context.Context<never> | undefined
|
|
2170
|
-
}) => Effect.Effect<A, E, Exclude<R, Tracer.ParentSpan>>
|
|
2138
|
+
(
|
|
2139
|
+
name: string,
|
|
2140
|
+
options?: Tracer.SpanOptions
|
|
2141
|
+
) => <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, Exclude<R, Tracer.ParentSpan>>,
|
|
2142
|
+
<A, E, R>(
|
|
2143
|
+
self: Effect.Effect<A, E, R>,
|
|
2144
|
+
name: string,
|
|
2145
|
+
options?: Tracer.SpanOptions
|
|
2146
|
+
) => Effect.Effect<A, E, Exclude<R, Tracer.ParentSpan>>
|
|
2171
2147
|
>(
|
|
2172
2148
|
(args) => typeof args[0] !== "string",
|
|
2173
2149
|
(self, name, options) =>
|