effect 4.0.4 → 4.0.5
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/ai-docs/src/52_graphql/10_basics.ts +19 -13
- package/ai-docs/src/52_graphql/30_batching.ts +6 -4
- package/ai-docs/src/52_graphql/40_aliased-batching.ts +6 -4
- package/dist/Array.d.ts +90 -6
- package/dist/Array.d.ts.map +1 -1
- package/dist/Array.js +4 -2
- package/dist/Array.js.map +1 -1
- package/dist/Channel.d.ts +6 -1
- package/dist/Channel.d.ts.map +1 -1
- package/dist/Channel.js +17 -3
- package/dist/Channel.js.map +1 -1
- package/dist/ConfigProvider.d.ts.map +1 -1
- package/dist/ConfigProvider.js +33 -32
- package/dist/ConfigProvider.js.map +1 -1
- package/dist/Duration.d.ts.map +1 -1
- package/dist/Duration.js +2 -5
- package/dist/Duration.js.map +1 -1
- package/dist/Effect.d.ts +61 -19
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +58 -39
- package/dist/Effect.js.map +1 -1
- package/dist/FileSystem.d.ts +23 -9
- package/dist/FileSystem.d.ts.map +1 -1
- package/dist/FileSystem.js.map +1 -1
- package/dist/Match.d.ts +20 -6
- package/dist/Match.d.ts.map +1 -1
- package/dist/Match.js +2 -2
- package/dist/Match.js.map +1 -1
- package/dist/Path.d.ts +37 -5
- package/dist/Path.d.ts.map +1 -1
- package/dist/Path.js +36 -5
- package/dist/Path.js.map +1 -1
- package/dist/Schema.d.ts +7 -2
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +9 -2
- package/dist/Schema.js.map +1 -1
- package/dist/String.d.ts +12 -0
- package/dist/String.d.ts.map +1 -1
- package/dist/String.js +17 -4
- package/dist/String.js.map +1 -1
- package/dist/TxRef.d.ts.map +1 -1
- package/dist/TxRef.js +3 -2
- package/dist/TxRef.js.map +1 -1
- package/dist/ai/AiError.d.ts +10 -10
- package/dist/ai/AiError.d.ts.map +1 -1
- package/dist/ai/AiError.js +1 -1
- package/dist/ai/AiError.js.map +1 -1
- package/dist/ai/Decision.d.ts +70 -19
- package/dist/ai/Decision.d.ts.map +1 -1
- package/dist/ai/Decision.js +37 -3
- package/dist/ai/Decision.js.map +1 -1
- package/dist/ai/DecisionModel.js +1 -1
- package/dist/ai/DecisionModel.js.map +1 -1
- package/dist/ai/LanguageModel.d.ts.map +1 -1
- package/dist/ai/LanguageModel.js +47 -35
- package/dist/ai/LanguageModel.js.map +1 -1
- package/dist/ai/McpServer.d.ts +6 -52
- package/dist/ai/McpServer.d.ts.map +1 -1
- package/dist/ai/McpServer.js +2 -28
- package/dist/ai/McpServer.js.map +1 -1
- package/dist/ai/Response.d.ts +1 -1
- package/dist/cli/Completions.d.ts +5 -0
- package/dist/cli/Completions.d.ts.map +1 -1
- package/dist/cli/Completions.js.map +1 -1
- package/dist/cli/Flag.d.ts +100 -0
- package/dist/cli/Flag.d.ts.map +1 -1
- package/dist/cli/Flag.js +33 -0
- package/dist/cli/Flag.js.map +1 -1
- package/dist/cli/Param.d.ts +87 -0
- package/dist/cli/Param.d.ts.map +1 -1
- package/dist/cli/Param.js +30 -0
- package/dist/cli/Param.js.map +1 -1
- package/dist/cli/internal/command.d.ts.map +1 -1
- package/dist/cli/internal/command.js +2 -1
- package/dist/cli/internal/command.js.map +1 -1
- package/dist/cli/internal/completions/bash.js +4 -3
- package/dist/cli/internal/completions/bash.js.map +1 -1
- package/dist/cli/internal/completions/descriptor.js +8 -1
- package/dist/cli/internal/completions/descriptor.js.map +1 -1
- package/dist/cli/internal/completions/fish.js +4 -4
- package/dist/cli/internal/completions/fish.js.map +1 -1
- package/dist/cli/internal/completions/powershell.js +3 -2
- package/dist/cli/internal/completions/powershell.js.map +1 -1
- package/dist/cli/internal/completions/zsh.js +7 -3
- package/dist/cli/internal/completions/zsh.js.map +1 -1
- package/dist/cli/internal/parser.js +11 -3
- package/dist/cli/internal/parser.js.map +1 -1
- package/dist/cli/internal/wizard.d.ts.map +1 -1
- package/dist/cli/internal/wizard.js +2 -1
- package/dist/cli/internal/wizard.js.map +1 -1
- package/dist/cluster/ClusterWorkflowEngine.d.ts +1 -0
- package/dist/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
- package/dist/cluster/ClusterWorkflowEngine.js +67 -13
- package/dist/cluster/ClusterWorkflowEngine.js.map +1 -1
- package/dist/cluster/MessageStorage.d.ts.map +1 -1
- package/dist/cluster/MessageStorage.js +20 -12
- package/dist/cluster/MessageStorage.js.map +1 -1
- package/dist/cluster/Runners.d.ts.map +1 -1
- package/dist/cluster/Runners.js +54 -34
- package/dist/cluster/Runners.js.map +1 -1
- package/dist/cluster/internal/entityManager.js +1 -1
- package/dist/cluster/internal/entityManager.js.map +1 -1
- package/dist/encoding/Sse.js +1 -1
- package/dist/encoding/Sse.js.map +1 -1
- package/dist/graphql/GraphQLClient.d.ts.map +1 -1
- package/dist/graphql/GraphQLClient.js +12 -5
- package/dist/graphql/GraphQLClient.js.map +1 -1
- package/dist/graphql/GraphQLProtocol.d.ts +249 -11
- package/dist/graphql/GraphQLProtocol.d.ts.map +1 -1
- package/dist/graphql/GraphQLProtocol.js +98 -8
- package/dist/graphql/GraphQLProtocol.js.map +1 -1
- package/dist/graphql/GraphQLResolver.d.ts +1 -1
- package/dist/graphql/GraphQLResolver.d.ts.map +1 -1
- package/dist/graphql/GraphQLResolver.js +46 -16
- package/dist/graphql/GraphQLResolver.js.map +1 -1
- package/dist/http/FetchHttpClient.d.ts +6 -3
- package/dist/http/FetchHttpClient.d.ts.map +1 -1
- package/dist/http/FetchHttpClient.js +6 -3
- package/dist/http/FetchHttpClient.js.map +1 -1
- package/dist/http/FindMyWay/internal/router.js +2 -1
- package/dist/http/FindMyWay/internal/router.js.map +1 -1
- package/dist/http/Headers.d.ts +3 -3
- package/dist/http/Headers.d.ts.map +1 -1
- package/dist/http/Headers.js +6 -5
- package/dist/http/Headers.js.map +1 -1
- package/dist/http/HttpClient.d.ts +12 -0
- package/dist/http/HttpClient.d.ts.map +1 -1
- package/dist/http/HttpClient.js +14 -1
- package/dist/http/HttpClient.js.map +1 -1
- package/dist/http/HttpClientError.d.ts.map +1 -1
- package/dist/http/HttpClientError.js +8 -6
- package/dist/http/HttpClientError.js.map +1 -1
- package/dist/http/HttpClientRequest.d.ts +147 -4
- package/dist/http/HttpClientRequest.d.ts.map +1 -1
- package/dist/http/HttpClientRequest.js +47 -1
- package/dist/http/HttpClientRequest.js.map +1 -1
- package/dist/http/HttpMiddleware.d.ts +60 -0
- package/dist/http/HttpMiddleware.d.ts.map +1 -1
- package/dist/http/HttpMiddleware.js +67 -5
- package/dist/http/HttpMiddleware.js.map +1 -1
- package/dist/http/HttpRouter.d.ts.map +1 -1
- package/dist/http/HttpRouter.js +52 -13
- package/dist/http/HttpRouter.js.map +1 -1
- package/dist/http/HttpServerError.d.ts.map +1 -1
- package/dist/http/HttpServerError.js +6 -4
- package/dist/http/HttpServerError.js.map +1 -1
- package/dist/http/HttpServerRequest.js +2 -2
- package/dist/http/HttpServerRequest.js.map +1 -1
- package/dist/http/HttpStaticServer.d.ts.map +1 -1
- package/dist/http/HttpStaticServer.js +4 -10
- package/dist/http/HttpStaticServer.js.map +1 -1
- package/dist/http/HttpTraceContext.js +1 -1
- package/dist/http/HttpTraceContext.js.map +1 -1
- package/dist/http/Url.d.ts.map +1 -1
- package/dist/http/Url.js +2 -1
- package/dist/http/Url.js.map +1 -1
- package/dist/http/UrlParams.d.ts +112 -8
- package/dist/http/UrlParams.d.ts.map +1 -1
- package/dist/http/UrlParams.js +141 -14
- package/dist/http/UrlParams.js.map +1 -1
- package/dist/http/internal/compression.d.ts +1 -1
- package/dist/http/internal/compression.d.ts.map +1 -1
- package/dist/http/internal/compression.js +2 -10
- package/dist/http/internal/compression.js.map +1 -1
- package/dist/http/internal/compressionBody.d.ts +2 -0
- package/dist/http/internal/compressionBody.d.ts.map +1 -0
- package/dist/http/internal/compressionBody.js +36 -0
- package/dist/http/internal/compressionBody.js.map +1 -0
- package/dist/http/internal/decompression.d.ts +2 -0
- package/dist/http/internal/decompression.d.ts.map +1 -0
- package/dist/http/internal/decompression.js +162 -0
- package/dist/http/internal/decompression.js.map +1 -0
- package/dist/http/internal/tracing.js +14 -4
- package/dist/http/internal/tracing.js.map +1 -1
- package/dist/http/internal/urlParams.d.ts +2 -0
- package/dist/http/internal/urlParams.d.ts.map +1 -0
- package/dist/http/internal/urlParams.js +4 -0
- package/dist/http/internal/urlParams.js.map +1 -0
- package/dist/http-api/HttpApiClient.d.ts.map +1 -1
- package/dist/http-api/HttpApiClient.js +2 -1
- package/dist/http-api/HttpApiClient.js.map +1 -1
- package/dist/internal/core.js +17 -1
- package/dist/internal/core.js.map +1 -1
- package/dist/internal/effect.js +5 -3
- package/dist/internal/effect.js.map +1 -1
- package/dist/internal/graphql.js +12 -2
- package/dist/internal/graphql.js.map +1 -1
- package/dist/internal/version.js +1 -1
- package/dist/observability/Otlp.d.ts +15 -0
- package/dist/observability/Otlp.d.ts.map +1 -1
- package/dist/observability/Otlp.js +3 -0
- package/dist/observability/Otlp.js.map +1 -1
- package/dist/observability/OtlpExporter.d.ts +8 -0
- package/dist/observability/OtlpExporter.d.ts.map +1 -1
- package/dist/observability/OtlpExporter.js +10 -1
- package/dist/observability/OtlpExporter.js.map +1 -1
- package/dist/observability/OtlpLogger.d.ts +17 -0
- package/dist/observability/OtlpLogger.d.ts.map +1 -1
- package/dist/observability/OtlpLogger.js +14 -1
- package/dist/observability/OtlpLogger.js.map +1 -1
- package/dist/observability/OtlpMetrics.d.ts +17 -0
- package/dist/observability/OtlpMetrics.d.ts.map +1 -1
- package/dist/observability/OtlpMetrics.js +13 -0
- package/dist/observability/OtlpMetrics.js.map +1 -1
- package/dist/observability/OtlpTracer.d.ts +17 -0
- package/dist/observability/OtlpTracer.d.ts.map +1 -1
- package/dist/observability/OtlpTracer.js +15 -2
- package/dist/observability/OtlpTracer.js.map +1 -1
- package/dist/reactivity/AsyncResult.d.ts +6 -0
- package/dist/reactivity/AsyncResult.d.ts.map +1 -1
- package/dist/reactivity/AsyncResult.js +27 -0
- package/dist/reactivity/AsyncResult.js.map +1 -1
- package/dist/reactivity/AtomRegistry.js +3 -1
- package/dist/reactivity/AtomRegistry.js.map +1 -1
- package/dist/rpc/RpcClient.d.ts.map +1 -1
- package/dist/rpc/RpcClient.js +6 -1
- package/dist/rpc/RpcClient.js.map +1 -1
- package/dist/sql/SqlClient.d.ts +8 -7
- package/dist/sql/SqlClient.d.ts.map +1 -1
- package/dist/sql/SqlClient.js +8 -7
- package/dist/sql/SqlClient.js.map +1 -1
- package/dist/testing/TestClock.d.ts +16 -3
- package/dist/testing/TestClock.d.ts.map +1 -1
- package/dist/testing/TestClock.js +112 -22
- package/dist/testing/TestClock.js.map +1 -1
- package/dist/workflow/Activity.js +1 -0
- package/dist/workflow/Activity.js.map +1 -1
- package/dist/workflow/Workflow.d.ts +22 -0
- package/dist/workflow/Workflow.d.ts.map +1 -1
- package/dist/workflow/Workflow.js +15 -3
- package/dist/workflow/Workflow.js.map +1 -1
- package/dist/workflow/WorkflowEngine.d.ts +20 -1
- package/dist/workflow/WorkflowEngine.d.ts.map +1 -1
- package/dist/workflow/WorkflowEngine.js +35 -21
- package/dist/workflow/WorkflowEngine.js.map +1 -1
- package/package.json +1 -1
- package/src/Array.ts +95 -6
- package/src/Channel.ts +24 -3
- package/src/ConfigProvider.ts +40 -44
- package/src/Duration.ts +4 -5
- package/src/Effect.ts +140 -53
- package/src/FileSystem.ts +23 -9
- package/src/Match.ts +65 -12
- package/src/Path.ts +52 -7
- package/src/Schema.ts +17 -4
- package/src/String.ts +17 -4
- package/src/TxRef.ts +4 -2
- package/src/ai/AiError.ts +3 -1
- package/src/ai/Decision.ts +70 -21
- package/src/ai/DecisionModel.ts +1 -1
- package/src/ai/LanguageModel.ts +57 -51
- package/src/ai/McpServer.ts +15 -55
- package/src/cli/Completions.ts +5 -0
- package/src/cli/Flag.ts +101 -0
- package/src/cli/Param.ts +96 -0
- package/src/cli/internal/command.ts +2 -1
- package/src/cli/internal/completions/bash.ts +4 -3
- package/src/cli/internal/completions/descriptor.ts +10 -1
- package/src/cli/internal/completions/fish.ts +4 -4
- package/src/cli/internal/completions/powershell.ts +5 -2
- package/src/cli/internal/completions/zsh.ts +7 -3
- package/src/cli/internal/parser.ts +12 -3
- package/src/cli/internal/wizard.ts +2 -1
- package/src/cluster/ClusterWorkflowEngine.ts +92 -24
- package/src/cluster/MessageStorage.ts +14 -3
- package/src/cluster/Runners.ts +88 -66
- package/src/cluster/internal/entityManager.ts +1 -1
- package/src/encoding/Sse.ts +1 -1
- package/src/graphql/GraphQLClient.ts +17 -5
- package/src/graphql/GraphQLProtocol.ts +274 -20
- package/src/graphql/GraphQLResolver.ts +45 -17
- package/src/http/FetchHttpClient.ts +6 -3
- package/src/http/FindMyWay/internal/router.ts +2 -1
- package/src/http/Headers.ts +6 -9
- package/src/http/HttpClient.ts +18 -1
- package/src/http/HttpClientError.ts +10 -6
- package/src/http/HttpClientRequest.ts +173 -7
- package/src/http/HttpMiddleware.ts +85 -5
- package/src/http/HttpRouter.ts +60 -13
- package/src/http/HttpServerError.ts +8 -4
- package/src/http/HttpServerRequest.ts +2 -2
- package/src/http/HttpStaticServer.ts +4 -10
- package/src/http/HttpTraceContext.ts +1 -1
- package/src/http/Url.ts +2 -1
- package/src/http/UrlParams.ts +225 -26
- package/src/http/internal/compression.ts +3 -17
- package/src/http/internal/compressionBody.ts +56 -0
- package/src/http/internal/decompression.ts +226 -0
- package/src/http/internal/tracing.ts +21 -4
- package/src/http/internal/urlParams.ts +5 -0
- package/src/http-api/HttpApiClient.ts +2 -1
- package/src/internal/core.ts +21 -1
- package/src/internal/effect.ts +5 -4
- package/src/internal/graphql.ts +30 -7
- package/src/internal/version.ts +1 -1
- package/src/observability/Otlp.ts +18 -0
- package/src/observability/OtlpExporter.ts +14 -3
- package/src/observability/OtlpLogger.ts +31 -2
- package/src/observability/OtlpMetrics.ts +30 -1
- package/src/observability/OtlpTracer.ts +32 -3
- package/src/reactivity/AsyncResult.ts +31 -0
- package/src/reactivity/AtomRegistry.ts +3 -1
- package/src/rpc/RpcClient.ts +6 -1
- package/src/sql/SqlClient.ts +9 -7
- package/src/testing/TestClock.ts +144 -29
- package/src/workflow/Activity.ts +1 -0
- package/src/workflow/Workflow.ts +31 -5
- package/src/workflow/WorkflowEngine.ts +60 -22
package/src/Array.ts
CHANGED
|
@@ -521,8 +521,10 @@ export const fromOption: <A>(self: Option.Option<A>) => Array<A> = Option.toArra
|
|
|
521
521
|
*
|
|
522
522
|
* **Details**
|
|
523
523
|
*
|
|
524
|
-
* `onNonEmpty` receives a `
|
|
525
|
-
*
|
|
524
|
+
* `onNonEmpty` receives a `NonEmptyArray` for mutable arrays and a
|
|
525
|
+
* `NonEmptyReadonlyArray` otherwise. Data-last calls default to the readonly
|
|
526
|
+
* callback, so the returned function still accepts `ReadonlyArray`. Supports
|
|
527
|
+
* both data-first and data-last usage.
|
|
526
528
|
*
|
|
527
529
|
* **Example** (Branching on emptiness)
|
|
528
530
|
*
|
|
@@ -555,8 +557,10 @@ export const match: {
|
|
|
555
557
|
*
|
|
556
558
|
* **Details**
|
|
557
559
|
*
|
|
558
|
-
* `onNonEmpty` receives a `
|
|
559
|
-
*
|
|
560
|
+
* `onNonEmpty` receives a `NonEmptyArray` for mutable arrays and a
|
|
561
|
+
* `NonEmptyReadonlyArray` otherwise. Data-last calls default to the readonly
|
|
562
|
+
* callback, so the returned function still accepts `ReadonlyArray`. Supports
|
|
563
|
+
* both data-first and data-last usage.
|
|
560
564
|
*
|
|
561
565
|
* **Example** (Branching on emptiness)
|
|
562
566
|
*
|
|
@@ -594,8 +598,93 @@ export const match: {
|
|
|
594
598
|
*
|
|
595
599
|
* **Details**
|
|
596
600
|
*
|
|
597
|
-
* `onNonEmpty` receives a `
|
|
598
|
-
*
|
|
601
|
+
* `onNonEmpty` receives a `NonEmptyArray` for mutable arrays and a
|
|
602
|
+
* `NonEmptyReadonlyArray` otherwise. Data-last calls default to the readonly
|
|
603
|
+
* callback, so the returned function still accepts `ReadonlyArray`. Supports
|
|
604
|
+
* both data-first and data-last usage.
|
|
605
|
+
*
|
|
606
|
+
* **Example** (Branching on emptiness)
|
|
607
|
+
*
|
|
608
|
+
* ```ts import.meta.vitest
|
|
609
|
+
* import { Array } from "effect"
|
|
610
|
+
*
|
|
611
|
+
* const describe = Array.match({
|
|
612
|
+
* onEmpty: () => "empty",
|
|
613
|
+
* onNonEmpty: ([head, ...tail]) => `head: ${head}, tail: ${tail.length}`
|
|
614
|
+
* })
|
|
615
|
+
*
|
|
616
|
+
* describe([]) // => "empty"
|
|
617
|
+
* describe([1, 2, 3]) // => "head: 1, tail: 2"
|
|
618
|
+
* ```
|
|
619
|
+
*
|
|
620
|
+
* @see {@link matchLeft} — destructures into head + tail
|
|
621
|
+
* @see {@link matchRight} — destructures into init + last
|
|
622
|
+
*
|
|
623
|
+
* @stability stable
|
|
624
|
+
* @category pattern matching
|
|
625
|
+
* @since 2.0.0
|
|
626
|
+
*/
|
|
627
|
+
<B, A, C = B>(
|
|
628
|
+
options: {
|
|
629
|
+
readonly onEmpty: LazyArg<B>
|
|
630
|
+
readonly onNonEmpty: (self: NonEmptyArray<A>) => C
|
|
631
|
+
}
|
|
632
|
+
): (self: Array<A>) => B | C
|
|
633
|
+
/**
|
|
634
|
+
* Pattern-matches on an array, handling empty and non-empty cases separately.
|
|
635
|
+
*
|
|
636
|
+
* **When to use**
|
|
637
|
+
*
|
|
638
|
+
* Use when you need to branch on whether an array is empty.
|
|
639
|
+
*
|
|
640
|
+
* **Details**
|
|
641
|
+
*
|
|
642
|
+
* `onNonEmpty` receives a `NonEmptyArray` for mutable arrays and a
|
|
643
|
+
* `NonEmptyReadonlyArray` otherwise. Data-last calls default to the readonly
|
|
644
|
+
* callback, so the returned function still accepts `ReadonlyArray`. Supports
|
|
645
|
+
* both data-first and data-last usage.
|
|
646
|
+
*
|
|
647
|
+
* **Example** (Branching on emptiness)
|
|
648
|
+
*
|
|
649
|
+
* ```ts import.meta.vitest
|
|
650
|
+
* import { Array } from "effect"
|
|
651
|
+
*
|
|
652
|
+
* const describe = Array.match({
|
|
653
|
+
* onEmpty: () => "empty",
|
|
654
|
+
* onNonEmpty: ([head, ...tail]) => `head: ${head}, tail: ${tail.length}`
|
|
655
|
+
* })
|
|
656
|
+
*
|
|
657
|
+
* describe([]) // => "empty"
|
|
658
|
+
* describe([1, 2, 3]) // => "head: 1, tail: 2"
|
|
659
|
+
* ```
|
|
660
|
+
*
|
|
661
|
+
* @see {@link matchLeft} — destructures into head + tail
|
|
662
|
+
* @see {@link matchRight} — destructures into init + last
|
|
663
|
+
*
|
|
664
|
+
* @stability stable
|
|
665
|
+
* @category pattern matching
|
|
666
|
+
* @since 2.0.0
|
|
667
|
+
*/
|
|
668
|
+
<A, B, C = B>(
|
|
669
|
+
self: Array<A>,
|
|
670
|
+
options: {
|
|
671
|
+
readonly onEmpty: LazyArg<B>
|
|
672
|
+
readonly onNonEmpty: (self: NonEmptyArray<A>) => C
|
|
673
|
+
}
|
|
674
|
+
): B | C
|
|
675
|
+
/**
|
|
676
|
+
* Pattern-matches on an array, handling empty and non-empty cases separately.
|
|
677
|
+
*
|
|
678
|
+
* **When to use**
|
|
679
|
+
*
|
|
680
|
+
* Use when you need to branch on whether an array is empty.
|
|
681
|
+
*
|
|
682
|
+
* **Details**
|
|
683
|
+
*
|
|
684
|
+
* `onNonEmpty` receives a `NonEmptyArray` for mutable arrays and a
|
|
685
|
+
* `NonEmptyReadonlyArray` otherwise. Data-last calls default to the readonly
|
|
686
|
+
* callback, so the returned function still accepts `ReadonlyArray`. Supports
|
|
687
|
+
* both data-first and data-last usage.
|
|
599
688
|
*
|
|
600
689
|
* **Example** (Branching on emptiness)
|
|
601
690
|
*
|
package/src/Channel.ts
CHANGED
|
@@ -1984,7 +1984,9 @@ const readableStreamToPullUnsafe = <A, E, E2 = never>(options: {
|
|
|
1984
1984
|
* Each yielded value is emitted as an output element. The iterator's return
|
|
1985
1985
|
* value becomes the channel's done value. Thrown or rejected iterator errors
|
|
1986
1986
|
* are converted with `onError`. If the channel scope closes early and the
|
|
1987
|
-
* iterator has a `return` method, that method is called.
|
|
1987
|
+
* iterator has a `return` method, that method is called. It is awaited unless
|
|
1988
|
+
* a `next()` call is still pending, in which case its result is ignored and an
|
|
1989
|
+
* async generator may not run its cleanup until that pull settles.
|
|
1988
1990
|
*
|
|
1989
1991
|
* @stability stable
|
|
1990
1992
|
* @category constructors
|
|
@@ -1996,12 +1998,28 @@ export const fromAsyncIterable = <A, D, E>(
|
|
|
1996
1998
|
): Channel<A, E, D> =>
|
|
1997
1999
|
fromTransform(Effect.fnUntraced(function*(_, scope) {
|
|
1998
2000
|
const iter = iterable[Symbol.asyncIterator]()
|
|
2001
|
+
let pulling = false
|
|
1999
2002
|
if (iter.return) {
|
|
2000
|
-
|
|
2003
|
+
// `return()` may not settle until a pending `next()` does, so only
|
|
2004
|
+
// await it when the iterator is idle.
|
|
2005
|
+
yield* Scope.addFinalizer(
|
|
2006
|
+
scope,
|
|
2007
|
+
Effect.suspend(() =>
|
|
2008
|
+
pulling
|
|
2009
|
+
? Effect.sync(() => void iter.return!().catch(constVoid))
|
|
2010
|
+
: Effect.promise(() => iter.return!())
|
|
2011
|
+
)
|
|
2012
|
+
)
|
|
2001
2013
|
}
|
|
2002
2014
|
return Effect.flatMap(
|
|
2003
2015
|
Effect.tryPromise({
|
|
2004
|
-
try: () =>
|
|
2016
|
+
try: () => {
|
|
2017
|
+
const promise = iter.next()
|
|
2018
|
+
pulling = true
|
|
2019
|
+
return promise.finally(() => {
|
|
2020
|
+
pulling = false
|
|
2021
|
+
})
|
|
2022
|
+
},
|
|
2005
2023
|
catch: onError
|
|
2006
2024
|
}),
|
|
2007
2025
|
(result) => result.done ? Cause.done(result.value) : Effect.succeed(result.value)
|
|
@@ -2017,6 +2035,9 @@ export const fromAsyncIterable = <A, D, E>(
|
|
|
2017
2035
|
* The iterator's return value becomes the channel's done value. Thrown or
|
|
2018
2036
|
* rejected iterator errors are converted with `onError`. If the channel scope
|
|
2019
2037
|
* closes early and the iterator has a `return` method, that method is called.
|
|
2038
|
+
* It is awaited unless a `next()` call is still pending, in which case its
|
|
2039
|
+
* result is ignored and an async generator may not run its cleanup until that
|
|
2040
|
+
* pull settles.
|
|
2020
2041
|
*
|
|
2021
2042
|
* @stability stable
|
|
2022
2043
|
* @category constructors
|
package/src/ConfigProvider.ts
CHANGED
|
@@ -1380,56 +1380,52 @@ function dotEnvExpand(parsed: Record<string, string>): Record<string, string> {
|
|
|
1380
1380
|
|
|
1381
1381
|
for (const configKey of Object.keys(parsed)) {
|
|
1382
1382
|
// resolve escape sequences
|
|
1383
|
-
newParsed[configKey] = interpolate(parsed[configKey], parsed).replace(/\\\$/g, "$")
|
|
1383
|
+
newParsed[configKey] = interpolate(parsed[configKey], parsed, new Set([configKey])).replace(/\\\$/g, "$")
|
|
1384
1384
|
}
|
|
1385
1385
|
|
|
1386
1386
|
return newParsed
|
|
1387
1387
|
}
|
|
1388
1388
|
|
|
1389
|
-
function interpolate(
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
)
|
|
1389
|
+
function interpolate(
|
|
1390
|
+
envValue: string,
|
|
1391
|
+
parsed: Record<string, string>,
|
|
1392
|
+
seen: ReadonlySet<string>
|
|
1393
|
+
): string {
|
|
1394
|
+
const reference = /(?<!\\)\${?(\w+)/g
|
|
1395
|
+
let result = ""
|
|
1396
|
+
let cursor = 0
|
|
1397
|
+
let match: RegExpExecArray | null
|
|
1398
|
+
while ((match = reference.exec(envValue)) != null) {
|
|
1399
|
+
const [, name] = match
|
|
1400
|
+
let end = reference.lastIndex
|
|
1401
|
+
let defaultValue = ""
|
|
1402
|
+
if (envValue.startsWith(":-", end)) {
|
|
1403
|
+
end += 2
|
|
1404
|
+
const start = end
|
|
1405
|
+
let depth = 0
|
|
1406
|
+
// Match default braces in the source, not in substituted values.
|
|
1407
|
+
for (; end < envValue.length; end++) {
|
|
1408
|
+
if (envValue.startsWith("${", end)) {
|
|
1409
|
+
depth++
|
|
1410
|
+
end++
|
|
1411
|
+
} else if (envValue[end] === "}") {
|
|
1412
|
+
if (depth === 0) break
|
|
1413
|
+
depth--
|
|
1414
|
+
}
|
|
1415
|
+
}
|
|
1416
|
+
defaultValue = envValue.slice(start, end)
|
|
1417
|
+
}
|
|
1418
|
+
if (envValue[end] === "}") end++
|
|
1419
|
+
|
|
1420
|
+
// References already being expanded resolve as unset.
|
|
1421
|
+
const expanded = Object.hasOwn(parsed, name) && !seen.has(name)
|
|
1422
|
+
? interpolate(parsed[name], parsed, new Set([...seen, name]))
|
|
1423
|
+
: ""
|
|
1424
|
+
result += envValue.slice(cursor, match.index) + (expanded || interpolate(defaultValue, parsed, seen))
|
|
1425
|
+
cursor = end
|
|
1426
|
+
reference.lastIndex = end
|
|
1425
1427
|
}
|
|
1426
|
-
|
|
1427
|
-
return envValue
|
|
1428
|
-
}
|
|
1429
|
-
|
|
1430
|
-
function searchLast(str: string, rgx: RegExp): number {
|
|
1431
|
-
const matches = Array.from(str.matchAll(rgx))
|
|
1432
|
-
return matches.length > 0 ? matches.slice(-1)[0].index : -1
|
|
1428
|
+
return result + envValue.slice(cursor)
|
|
1433
1429
|
}
|
|
1434
1430
|
|
|
1435
1431
|
/**
|
package/src/Duration.ts
CHANGED
|
@@ -38,7 +38,8 @@ const bigint1e9 = BigInt(1_000_000_000)
|
|
|
38
38
|
|
|
39
39
|
const roundTiesAwayFromZero = (input: number): bigint => BigInt(Math.sign(input) * Math.round(Math.abs(input)))
|
|
40
40
|
|
|
41
|
-
const roundMillisToNanos = (millis: number): bigint =>
|
|
41
|
+
const roundMillisToNanos = (millis: number): bigint =>
|
|
42
|
+
Number.isInteger(millis) ? BigInt(millis) * bigint1e6 : roundTiesAwayFromZero(millis * 1_000_000)
|
|
42
43
|
|
|
43
44
|
const fromNanosNumber = (nanos: number): Duration => make(Number.isFinite(nanos) ? roundTiesAwayFromZero(nanos) : nanos)
|
|
44
45
|
|
|
@@ -365,10 +366,8 @@ const DurationProto: Omit<Duration, "value"> = {
|
|
|
365
366
|
// Hash equal finite durations using the same canonical nanoseconds
|
|
366
367
|
// representation used by `equals`.
|
|
367
368
|
switch (this.value._tag) {
|
|
368
|
-
case "Millis":
|
|
369
|
-
|
|
370
|
-
return Number.isFinite(nanos) ? Hash.hash(roundTiesAwayFromZero(nanos)) : Hash.number(this.value.millis)
|
|
371
|
-
}
|
|
369
|
+
case "Millis":
|
|
370
|
+
return Hash.hash(roundMillisToNanos(this.value.millis))
|
|
372
371
|
case "Nanos":
|
|
373
372
|
return Hash.hash(this.value.nanos)
|
|
374
373
|
default:
|
package/src/Effect.ts
CHANGED
|
@@ -20,7 +20,7 @@ import type * as ExecutionPlan from "./ExecutionPlan.ts"
|
|
|
20
20
|
import * as Exit from "./Exit.ts"
|
|
21
21
|
import type { Fiber } from "./Fiber.ts"
|
|
22
22
|
import type * as Filter from "./Filter.ts"
|
|
23
|
-
import {
|
|
23
|
+
import { dual, type LazyArg } from "./Function.ts"
|
|
24
24
|
import type { TypeLambda } from "./HKT.ts"
|
|
25
25
|
import type { Inspectable } from "./Inspectable.ts"
|
|
26
26
|
import * as core from "./internal/core.ts"
|
|
@@ -25245,50 +25245,113 @@ export const trackDuration: {
|
|
|
25245
25245
|
// Transactions
|
|
25246
25246
|
// -----------------------------------------------------------------------------
|
|
25247
25247
|
|
|
25248
|
+
/**
|
|
25249
|
+
* Why the current transaction attempt started after a previous attempt did not commit.
|
|
25250
|
+
*
|
|
25251
|
+
* **Details**
|
|
25252
|
+
*
|
|
25253
|
+
* `"retry"` means the previous attempt called {@link txRetry}. `"conflict"`
|
|
25254
|
+
* means an accessed `TxRef` changed before commit. The first attempt has no
|
|
25255
|
+
* retry reason.
|
|
25256
|
+
*
|
|
25257
|
+
* @stability stable
|
|
25258
|
+
* @category models
|
|
25259
|
+
* @since 4.0.0
|
|
25260
|
+
*/
|
|
25261
|
+
export type TransactionRetryReason = "retry" | "conflict"
|
|
25262
|
+
|
|
25263
|
+
/**
|
|
25264
|
+
* Journal and attempt metadata for an Effect transaction.
|
|
25265
|
+
*
|
|
25266
|
+
* **When to use**
|
|
25267
|
+
*
|
|
25268
|
+
* Use to type the value provided by {@link Transaction}.
|
|
25269
|
+
*
|
|
25270
|
+
* **Details**
|
|
25271
|
+
*
|
|
25272
|
+
* `attempt` starts at `1` and counts each run of the outermost transaction body.
|
|
25273
|
+
* `retryReason` is `"retry"` after {@link txRetry} and `"conflict"` after an
|
|
25274
|
+
* accessed `TxRef` changes before commit; it is unset on the first attempt.
|
|
25275
|
+
* `start`, `now`, `elapsed`, and `elapsedSincePrevious` are millisecond
|
|
25276
|
+
* timestamps and durations for the current attempt, matching {@link Schedule}
|
|
25277
|
+
* metadata. Each journal entry stores the observed version and value of a
|
|
25278
|
+
* `TxRef`. `written` is true when this transaction has updated that ref.
|
|
25279
|
+
*
|
|
25280
|
+
* @see {@link Transaction} for the context service that provides this metadata
|
|
25281
|
+
* @see {@link TransactionRetryReason} for the retry-reason tags recorded on later attempts
|
|
25282
|
+
*
|
|
25283
|
+
* @stability stable
|
|
25284
|
+
* @category models
|
|
25285
|
+
* @since 4.0.0
|
|
25286
|
+
*/
|
|
25287
|
+
export interface TransactionMeta {
|
|
25288
|
+
readonly journal: ReadonlyMap<
|
|
25289
|
+
TxRef<any>,
|
|
25290
|
+
{
|
|
25291
|
+
readonly version: number
|
|
25292
|
+
readonly value: any
|
|
25293
|
+
readonly written: boolean
|
|
25294
|
+
}
|
|
25295
|
+
>
|
|
25296
|
+
readonly attempt: number
|
|
25297
|
+
readonly retryReason: TransactionRetryReason | undefined
|
|
25298
|
+
readonly start: number
|
|
25299
|
+
readonly now: number
|
|
25300
|
+
readonly elapsed: number
|
|
25301
|
+
readonly elapsedSincePrevious: number
|
|
25302
|
+
}
|
|
25303
|
+
|
|
25304
|
+
/** @internal */
|
|
25305
|
+
export interface TransactionMetaInner {
|
|
25306
|
+
retry: boolean
|
|
25307
|
+
journal: Map<
|
|
25308
|
+
TxRef<any>,
|
|
25309
|
+
{
|
|
25310
|
+
readonly version: number
|
|
25311
|
+
value: any
|
|
25312
|
+
written: boolean
|
|
25313
|
+
}
|
|
25314
|
+
>
|
|
25315
|
+
attempt: number
|
|
25316
|
+
retryReason: TransactionRetryReason | undefined
|
|
25317
|
+
start: number
|
|
25318
|
+
now: number
|
|
25319
|
+
elapsed: number
|
|
25320
|
+
elapsedSincePrevious: number
|
|
25321
|
+
}
|
|
25322
|
+
|
|
25248
25323
|
/**
|
|
25249
25324
|
* Service that holds the current transaction state.
|
|
25250
25325
|
*
|
|
25251
25326
|
* **Details**
|
|
25252
25327
|
*
|
|
25253
|
-
*
|
|
25254
|
-
*
|
|
25328
|
+
* Nested {@link tx} calls reuse this same service instance. Yield it inside a
|
|
25329
|
+
* transaction body to read {@link TransactionMeta} fields such as `attempt`
|
|
25330
|
+
* and `retryReason`.
|
|
25255
25331
|
*
|
|
25256
|
-
* **Example** (
|
|
25332
|
+
* **Example** (Reading transaction metadata)
|
|
25257
25333
|
*
|
|
25258
25334
|
* ```ts import.meta.vitest
|
|
25259
25335
|
* import { Effect } from "effect"
|
|
25260
25336
|
*
|
|
25261
|
-
*
|
|
25262
|
-
* const txEffect = Effect.gen(function*() {
|
|
25337
|
+
* const program = Effect.tx(Effect.gen(function*() {
|
|
25263
25338
|
* const tx = yield* Effect.Transaction
|
|
25264
|
-
*
|
|
25265
|
-
*
|
|
25266
|
-
* })
|
|
25339
|
+
* return [tx.attempt, tx.retryReason, tx.elapsed, tx.elapsedSincePrevious]
|
|
25340
|
+
* }))
|
|
25267
25341
|
*
|
|
25268
|
-
*
|
|
25269
|
-
* retry: false,
|
|
25270
|
-
* journal: new Map()
|
|
25271
|
-
* })
|
|
25272
|
-
* Effect.runSync(runnable) // => "Transaction complete"
|
|
25342
|
+
* Effect.runSync(program) // => [1, undefined, 0, 0]
|
|
25273
25343
|
* ```
|
|
25274
25344
|
*
|
|
25345
|
+
* @see {@link tx} for the outermost transaction boundary that creates this service
|
|
25346
|
+
* @see {@link TransactionMeta} for the journal and attempt metadata
|
|
25347
|
+
*
|
|
25275
25348
|
* @stability stable
|
|
25276
25349
|
* @category transactions
|
|
25277
25350
|
* @since 4.0.0
|
|
25278
25351
|
*/
|
|
25279
25352
|
export class Transaction extends Context.Service<
|
|
25280
25353
|
Transaction,
|
|
25281
|
-
|
|
25282
|
-
retry: boolean
|
|
25283
|
-
readonly journal: Map<
|
|
25284
|
-
TxRef<any>,
|
|
25285
|
-
{
|
|
25286
|
-
readonly version: number
|
|
25287
|
-
value: any
|
|
25288
|
-
written: boolean
|
|
25289
|
-
}
|
|
25290
|
-
>
|
|
25291
|
-
}
|
|
25354
|
+
TransactionMeta
|
|
25292
25355
|
>()("effect/Effect/Transaction") {}
|
|
25293
25356
|
|
|
25294
25357
|
/**
|
|
@@ -25342,52 +25405,75 @@ export const tx = <A, E, R>(
|
|
|
25342
25405
|
effect: Effect<A, E, R>
|
|
25343
25406
|
): Effect<A, E, Exclude<R, Transaction>> =>
|
|
25344
25407
|
withFiber((fiber) => {
|
|
25345
|
-
|
|
25408
|
+
const state = Context.getOrUndefined(fiber.context, Transaction)
|
|
25346
25409
|
if (state && !completedTransactions.has(state)) {
|
|
25347
25410
|
return effect as Effect<A, E, Exclude<R, Transaction>>
|
|
25348
25411
|
}
|
|
25412
|
+
const clock = fiber.getRef(internal.ClockRef)
|
|
25413
|
+
const now = clock.currentTimeMillisUnsafe()
|
|
25349
25414
|
// Create transaction state only at the outermost boundary
|
|
25350
|
-
|
|
25415
|
+
const mutable: TransactionMetaInner = {
|
|
25416
|
+
journal: new Map(),
|
|
25417
|
+
retry: false,
|
|
25418
|
+
attempt: 1,
|
|
25419
|
+
retryReason: undefined,
|
|
25420
|
+
start: now,
|
|
25421
|
+
now,
|
|
25422
|
+
elapsed: 0,
|
|
25423
|
+
elapsedSincePrevious: 0
|
|
25424
|
+
}
|
|
25351
25425
|
let result: Exit.Exit<A, E> | undefined
|
|
25352
|
-
return uninterruptibleMask((restore) =>
|
|
25353
|
-
|
|
25426
|
+
return uninterruptibleMask((restore) => {
|
|
25427
|
+
const run = restore(effect).pipe(
|
|
25428
|
+
provideService(Transaction, mutable),
|
|
25429
|
+
tapCause((cause) => {
|
|
25430
|
+
if (!mutable.retry) return void_
|
|
25431
|
+
// txRetry interrupts the body; any other reason in the cause is a real failure.
|
|
25432
|
+
// Roll back now so the step below fails instead of waiting or rerunning.
|
|
25433
|
+
if (!internal.hasInterruptsOnly(cause)) return sync(() => clearTransaction(mutable))
|
|
25434
|
+
return restore(awaitPendingTransaction(mutable))
|
|
25435
|
+
}),
|
|
25436
|
+
exit
|
|
25437
|
+
)
|
|
25438
|
+
return flatMap(
|
|
25354
25439
|
whileLoop({
|
|
25355
25440
|
while: () => !result,
|
|
25356
|
-
body:
|
|
25357
|
-
|
|
25358
|
-
|
|
25359
|
-
|
|
25360
|
-
|
|
25361
|
-
|
|
25362
|
-
// Roll back now so the step below fails instead of waiting or rerunning.
|
|
25363
|
-
if (!internal.hasInterruptsOnly(cause)) return sync(() => clearTransaction(state))
|
|
25364
|
-
return restore(awaitPendingTransaction(state))
|
|
25365
|
-
}),
|
|
25366
|
-
exit
|
|
25367
|
-
)
|
|
25368
|
-
),
|
|
25441
|
+
body: () => {
|
|
25442
|
+
if (mutable.attempt > 1) {
|
|
25443
|
+
stampTransaction(mutable, clock.currentTimeMillisUnsafe())
|
|
25444
|
+
}
|
|
25445
|
+
return run
|
|
25446
|
+
},
|
|
25369
25447
|
step(exit: Exit.Exit<A, E>) {
|
|
25370
|
-
if (
|
|
25371
|
-
|
|
25448
|
+
if (mutable.retry || !isTransactionConsistent(mutable)) {
|
|
25449
|
+
mutable.attempt++
|
|
25450
|
+
mutable.retryReason = mutable.retry ? "retry" : "conflict"
|
|
25451
|
+
return clearTransaction(mutable)
|
|
25372
25452
|
}
|
|
25373
25453
|
if (Exit.isSuccess(exit)) {
|
|
25374
|
-
commitTransaction(fiber,
|
|
25454
|
+
commitTransaction(fiber, mutable)
|
|
25375
25455
|
}
|
|
25376
|
-
clearTransaction(
|
|
25377
|
-
completedTransactions.add(
|
|
25456
|
+
clearTransaction(mutable)
|
|
25457
|
+
completedTransactions.add(mutable)
|
|
25378
25458
|
result = exit
|
|
25379
25459
|
}
|
|
25380
25460
|
}),
|
|
25381
25461
|
() => result!
|
|
25382
25462
|
)
|
|
25383
|
-
)
|
|
25463
|
+
})
|
|
25384
25464
|
})
|
|
25385
25465
|
|
|
25386
25466
|
// Child fibers inherit the boundary's state, so mark it completed once the
|
|
25387
25467
|
// boundary finishes and let later `tx` calls start a fresh boundary.
|
|
25388
25468
|
const completedTransactions = new WeakSet<Transaction["Service"]>()
|
|
25389
25469
|
|
|
25390
|
-
const
|
|
25470
|
+
const stampTransaction = (state: TransactionMetaInner, now: number) => {
|
|
25471
|
+
state.elapsedSincePrevious = now - state.now
|
|
25472
|
+
state.now = now
|
|
25473
|
+
state.elapsed = now - state.start
|
|
25474
|
+
}
|
|
25475
|
+
|
|
25476
|
+
const isTransactionConsistent = (state: TransactionMeta) => {
|
|
25391
25477
|
for (const [ref, { version }] of state.journal) {
|
|
25392
25478
|
if (ref.version !== version) {
|
|
25393
25479
|
return false
|
|
@@ -25396,7 +25482,7 @@ const isTransactionConsistent = (state: Transaction["Service"]) => {
|
|
|
25396
25482
|
return true
|
|
25397
25483
|
}
|
|
25398
25484
|
|
|
25399
|
-
const awaitPendingTransaction = (state:
|
|
25485
|
+
const awaitPendingTransaction = (state: TransactionMeta) =>
|
|
25400
25486
|
callback<void>((resume) => {
|
|
25401
25487
|
// Validate the read set and register the waiter in one synchronous step.
|
|
25402
25488
|
// A commit that landed after the reads has already signalled its waiters
|
|
@@ -25421,7 +25507,7 @@ const awaitPendingTransaction = (state: Transaction["Service"]) =>
|
|
|
25421
25507
|
return sync(clearPending)
|
|
25422
25508
|
})
|
|
25423
25509
|
|
|
25424
|
-
function commitTransaction(fiber: Fiber<unknown, unknown>, state:
|
|
25510
|
+
function commitTransaction(fiber: Fiber<unknown, unknown>, state: TransactionMeta) {
|
|
25425
25511
|
for (const [ref, { value, written }] of state.journal) {
|
|
25426
25512
|
if (!written) continue
|
|
25427
25513
|
if (!Object.is(value, ref.value)) {
|
|
@@ -25435,7 +25521,7 @@ function commitTransaction(fiber: Fiber<unknown, unknown>, state: Transaction["S
|
|
|
25435
25521
|
}
|
|
25436
25522
|
}
|
|
25437
25523
|
|
|
25438
|
-
function clearTransaction(state:
|
|
25524
|
+
function clearTransaction(state: TransactionMetaInner) {
|
|
25439
25525
|
state.retry = false
|
|
25440
25526
|
state.journal.clear()
|
|
25441
25527
|
}
|
|
@@ -25480,7 +25566,8 @@ function clearTransaction(state: Transaction["Service"]) {
|
|
|
25480
25566
|
export const txRetry: Effect<never, never, Transaction> = flatMap(
|
|
25481
25567
|
Transaction,
|
|
25482
25568
|
(state) => {
|
|
25483
|
-
|
|
25569
|
+
const mutable = state as TransactionMetaInner
|
|
25570
|
+
mutable.retry = true
|
|
25484
25571
|
return interrupt
|
|
25485
25572
|
}
|
|
25486
25573
|
)
|
package/src/FileSystem.ts
CHANGED
|
@@ -968,9 +968,17 @@ export declare namespace File {
|
|
|
968
968
|
* permissions, and size information. This structure is returned by file
|
|
969
969
|
* stat operations.
|
|
970
970
|
*
|
|
971
|
-
*
|
|
972
|
-
*
|
|
973
|
-
*
|
|
971
|
+
* `dev`, `ino`, `rdev`, `nlink`, and `blocks` are `bigint` values, so
|
|
972
|
+
* 64-bit device identifiers, inode numbers, and counts are not limited to
|
|
973
|
+
* the safe integer range. `mode`, `uid`, and `gid` are 32-bit values and
|
|
974
|
+
* remain `number`. Optional metadata is `Option.none()` only when the
|
|
975
|
+
* platform does not report it.
|
|
976
|
+
*
|
|
977
|
+
* Node and Bun report all fields exactly, with `dev`, `ino`, `rdev`, and
|
|
978
|
+
* `nlink` interpreted as unsigned 64-bit integers. Unsafe `mode` values fail
|
|
979
|
+
* the stat operation with `BadArgument`. Deno reports these fields as
|
|
980
|
+
* `number`, so on Deno values above `Number.MAX_SAFE_INTEGER` are already
|
|
981
|
+
* rounded before they are converted to `bigint`.
|
|
974
982
|
*
|
|
975
983
|
* **Example** (Inspecting file information)
|
|
976
984
|
*
|
|
@@ -982,7 +990,7 @@ export declare namespace File {
|
|
|
982
990
|
* mtime: Option.none(),
|
|
983
991
|
* atime: Option.none(),
|
|
984
992
|
* birthtime: Option.none(),
|
|
985
|
-
* dev:
|
|
993
|
+
* dev: 1n,
|
|
986
994
|
* ino: Option.none(),
|
|
987
995
|
* mode: 0o644,
|
|
988
996
|
* nlink: Option.none(),
|
|
@@ -1014,16 +1022,16 @@ export declare namespace File {
|
|
|
1014
1022
|
readonly mtime: Option.Option<Date>
|
|
1015
1023
|
readonly atime: Option.Option<Date>
|
|
1016
1024
|
readonly birthtime: Option.Option<Date>
|
|
1017
|
-
readonly dev:
|
|
1018
|
-
readonly ino: Option.Option<
|
|
1025
|
+
readonly dev: bigint
|
|
1026
|
+
readonly ino: Option.Option<bigint>
|
|
1019
1027
|
readonly mode: number
|
|
1020
|
-
readonly nlink: Option.Option<
|
|
1028
|
+
readonly nlink: Option.Option<bigint>
|
|
1021
1029
|
readonly uid: Option.Option<number>
|
|
1022
1030
|
readonly gid: Option.Option<number>
|
|
1023
|
-
readonly rdev: Option.Option<
|
|
1031
|
+
readonly rdev: Option.Option<bigint>
|
|
1024
1032
|
readonly size: ByteSize.ByteSize
|
|
1025
1033
|
readonly blksize: Option.Option<ByteSize.ByteSize>
|
|
1026
|
-
readonly blocks: Option.Option<
|
|
1034
|
+
readonly blocks: Option.Option<bigint>
|
|
1027
1035
|
}
|
|
1028
1036
|
}
|
|
1029
1037
|
|
|
@@ -1061,6 +1069,12 @@ export interface WatchOptions {
|
|
|
1061
1069
|
* When `true`, changes in subdirectories are also reported.
|
|
1062
1070
|
*/
|
|
1063
1071
|
readonly recursive?: boolean | undefined
|
|
1072
|
+
/**
|
|
1073
|
+
* Called once the underlying watcher is installed and can buffer events.
|
|
1074
|
+
* Stream construction alone does not install a watcher. Custom watch
|
|
1075
|
+
* backends must also call this callback after installation, when supplied.
|
|
1076
|
+
*/
|
|
1077
|
+
readonly onReady?: (() => void) | undefined
|
|
1064
1078
|
}
|
|
1065
1079
|
|
|
1066
1080
|
/**
|