effect 4.1.5 → 4.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ai-docs/package.json +2 -2
- package/dist/Channel.d.ts +104 -7
- package/dist/Channel.d.ts.map +1 -1
- package/dist/Channel.js +73 -4
- package/dist/Channel.js.map +1 -1
- package/dist/Codegen.d.ts +7 -2
- package/dist/Codegen.d.ts.map +1 -1
- package/dist/Codegen.js +7 -2
- package/dist/Codegen.js.map +1 -1
- package/dist/Config.d.ts +1 -1
- package/dist/Config.d.ts.map +1 -1
- package/dist/Config.js +5 -3
- package/dist/Config.js.map +1 -1
- package/dist/Context.d.ts.map +1 -1
- package/dist/Context.js +79 -31
- package/dist/Context.js.map +1 -1
- package/dist/Cron.d.ts.map +1 -1
- package/dist/Cron.js +10 -9
- package/dist/Cron.js.map +1 -1
- package/dist/Effect.d.ts +139 -18
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +10 -2
- package/dist/Effect.js.map +1 -1
- package/dist/Equal.d.ts +4 -4
- package/dist/Equal.d.ts.map +1 -1
- package/dist/Equal.js +78 -66
- package/dist/Equal.js.map +1 -1
- package/dist/Formatter.js +4 -4
- package/dist/Formatter.js.map +1 -1
- package/dist/Hash.d.ts.map +1 -1
- package/dist/Hash.js +34 -41
- package/dist/Hash.js.map +1 -1
- package/dist/LayerRef.d.ts +1 -1
- package/dist/LayerRef.d.ts.map +1 -1
- package/dist/LayerRef.js +3 -3
- package/dist/LayerRef.js.map +1 -1
- package/dist/Logger.d.ts +37 -13
- package/dist/Logger.d.ts.map +1 -1
- package/dist/Logger.js +39 -10
- package/dist/Logger.js.map +1 -1
- package/dist/Match.d.ts +23 -23
- package/dist/Match.d.ts.map +1 -1
- package/dist/Match.js.map +1 -1
- package/dist/Metric.d.ts.map +1 -1
- package/dist/Metric.js +3 -4
- package/dist/Metric.js.map +1 -1
- package/dist/Order.js +1 -1
- package/dist/Order.js.map +1 -1
- package/dist/Pool.d.ts.map +1 -1
- package/dist/Pool.js +49 -21
- package/dist/Pool.js.map +1 -1
- package/dist/Predicate.d.ts.map +1 -1
- package/dist/Predicate.js +2 -1
- package/dist/Predicate.js.map +1 -1
- package/dist/Scheduler.d.ts.map +1 -1
- package/dist/Scheduler.js +15 -9
- package/dist/Scheduler.js.map +1 -1
- package/dist/Schema.d.ts +41 -0
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +51 -390
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaAST.d.ts +2 -2
- package/dist/SchemaAST.d.ts.map +1 -1
- package/dist/SchemaAST.js +199 -98
- package/dist/SchemaAST.js.map +1 -1
- package/dist/SchemaParser.d.ts.map +1 -1
- package/dist/SchemaParser.js +29 -50
- package/dist/SchemaParser.js.map +1 -1
- package/dist/ScopedCache.d.ts.map +1 -1
- package/dist/ScopedCache.js +6 -4
- package/dist/ScopedCache.js.map +1 -1
- package/dist/Stream.d.ts +128 -5
- package/dist/Stream.d.ts.map +1 -1
- package/dist/Stream.js +124 -29
- package/dist/Stream.js.map +1 -1
- package/dist/String.js +1 -1
- package/dist/String.js.map +1 -1
- package/dist/Tracer.d.ts +10 -0
- package/dist/Tracer.d.ts.map +1 -1
- package/dist/Tracer.js +3 -4
- package/dist/Tracer.js.map +1 -1
- package/dist/ai/McpClient.d.ts +68 -4
- package/dist/ai/McpClient.d.ts.map +1 -1
- package/dist/ai/McpClient.js +100 -17
- package/dist/ai/McpClient.js.map +1 -1
- package/dist/ai/McpClientError.d.ts +46 -4
- package/dist/ai/McpClientError.d.ts.map +1 -1
- package/dist/ai/McpClientError.js +38 -3
- package/dist/ai/McpClientError.js.map +1 -1
- package/dist/ai/McpServer.d.ts +158 -7
- package/dist/ai/McpServer.d.ts.map +1 -1
- package/dist/ai/McpServer.js +103 -49
- package/dist/ai/McpServer.js.map +1 -1
- package/dist/ai/Prompt.d.ts +3 -1
- package/dist/ai/Prompt.d.ts.map +1 -1
- package/dist/ai/Prompt.js +17 -3
- package/dist/ai/Prompt.js.map +1 -1
- package/dist/ai/Skill.d.ts +172 -0
- package/dist/ai/Skill.d.ts.map +1 -0
- package/dist/ai/Skill.js +209 -0
- package/dist/ai/Skill.js.map +1 -0
- package/dist/ai/index.d.ts +5 -0
- package/dist/ai/index.d.ts.map +1 -1
- package/dist/ai/index.js +5 -0
- package/dist/ai/index.js.map +1 -1
- package/dist/ai/internal/mcpProtocol/v2024_11_05.js +9 -7
- package/dist/ai/internal/mcpProtocol/v2024_11_05.js.map +1 -1
- package/dist/ai/internal/mcpProtocol/v2025_03_26.js +12 -11
- package/dist/ai/internal/mcpProtocol/v2025_03_26.js.map +1 -1
- package/dist/ai/internal/mcpProtocol/v2025_06_18.js +18 -17
- package/dist/ai/internal/mcpProtocol/v2025_06_18.js.map +1 -1
- package/dist/ai/internal/mcpProtocol/v2025_11_25.js +19 -18
- package/dist/ai/internal/mcpProtocol/v2025_11_25.js.map +1 -1
- package/dist/ai/internal/mcpProtocol/v2026_07_28.js +1 -1
- package/dist/ai/internal/mcpProtocol/v2026_07_28.js.map +1 -1
- package/dist/ai/internal/mcpProtocol.js +11 -0
- package/dist/ai/internal/mcpProtocol.js.map +1 -1
- package/dist/ai/internal/mcpRuntime.js +29 -17
- package/dist/ai/internal/mcpRuntime.js.map +1 -1
- package/dist/ai/internal/mcpSchema/v2024_11_05.js +2 -1
- package/dist/ai/internal/mcpSchema/v2024_11_05.js.map +1 -1
- package/dist/ai/internal/mcpSchema/v2025_03_26.js +1 -8
- package/dist/ai/internal/mcpSchema/v2025_03_26.js.map +1 -1
- package/dist/ai/internal/mcpSchema/v2025_06_18.js +5 -9
- package/dist/ai/internal/mcpSchema/v2025_06_18.js.map +1 -1
- package/dist/ai/internal/mcpSchema/v2025_11_25.js +1 -8
- package/dist/ai/internal/mcpSchema/v2025_11_25.js.map +1 -1
- package/dist/ai/internal/mcpSchema/v2026_07_28.js +4 -3
- package/dist/ai/internal/mcpSchema/v2026_07_28.js.map +1 -1
- package/dist/cluster/ClusterCron.d.ts +5 -20
- package/dist/cluster/ClusterCron.d.ts.map +1 -1
- package/dist/cluster/ClusterCron.js +16 -4
- package/dist/cluster/ClusterCron.js.map +1 -1
- package/dist/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
- package/dist/cluster/ClusterWorkflowEngine.js +155 -83
- package/dist/cluster/ClusterWorkflowEngine.js.map +1 -1
- package/dist/cluster/MessageStorage.d.ts +56 -0
- package/dist/cluster/MessageStorage.d.ts.map +1 -1
- package/dist/cluster/MessageStorage.js +18 -2
- package/dist/cluster/MessageStorage.js.map +1 -1
- package/dist/cluster/SqlMessageStorage.d.ts.map +1 -1
- package/dist/cluster/SqlMessageStorage.js +48 -23
- package/dist/cluster/SqlMessageStorage.js.map +1 -1
- package/dist/cluster/internal/entityActivation.js +2 -0
- package/dist/cluster/internal/entityActivation.js.map +1 -1
- package/dist/cluster/internal/entityManager.js +8 -5
- package/dist/cluster/internal/entityManager.js.map +1 -1
- package/dist/encoding/Base64.js +5 -1
- package/dist/encoding/Base64.js.map +1 -1
- package/dist/encoding/Base64Url.d.ts.map +1 -1
- package/dist/encoding/Base64Url.js +6 -1
- package/dist/encoding/Base64Url.js.map +1 -1
- package/dist/encoding/Hex.js +7 -5
- package/dist/encoding/Hex.js.map +1 -1
- package/dist/encoding/Xml.d.ts +38 -9
- package/dist/encoding/Xml.d.ts.map +1 -1
- package/dist/encoding/Xml.js +63 -31
- package/dist/encoding/Xml.js.map +1 -1
- package/dist/http/FetchHttpClient.d.ts +2 -1
- package/dist/http/FetchHttpClient.d.ts.map +1 -1
- package/dist/http/FetchHttpClient.js +14 -10
- package/dist/http/FetchHttpClient.js.map +1 -1
- package/dist/http/Headers.d.ts +201 -3
- package/dist/http/Headers.d.ts.map +1 -1
- package/dist/http/Headers.js +205 -3
- package/dist/http/Headers.js.map +1 -1
- package/dist/http/HttpClient.d.ts.map +1 -1
- package/dist/http/HttpClient.js +11 -7
- package/dist/http/HttpClient.js.map +1 -1
- package/dist/http/HttpClientError.d.ts +1 -0
- package/dist/http/HttpClientError.d.ts.map +1 -1
- package/dist/http/HttpClientError.js +32 -9
- package/dist/http/HttpClientError.js.map +1 -1
- package/dist/http/HttpClientRequest.d.ts +46 -0
- package/dist/http/HttpClientRequest.d.ts.map +1 -1
- package/dist/http/HttpClientRequest.js +15 -0
- package/dist/http/HttpClientRequest.js.map +1 -1
- package/dist/http/HttpClientResponse.d.ts +132 -0
- package/dist/http/HttpClientResponse.d.ts.map +1 -1
- package/dist/http/HttpClientResponse.js +83 -0
- package/dist/http/HttpClientResponse.js.map +1 -1
- package/dist/http/HttpEffect.d.ts.map +1 -1
- package/dist/http/HttpEffect.js +31 -2
- package/dist/http/HttpEffect.js.map +1 -1
- package/dist/http/HttpMiddleware.js +1 -1
- package/dist/http/HttpMiddleware.js.map +1 -1
- package/dist/http/HttpServerError.d.ts +1 -1
- package/dist/http/HttpServerError.js +1 -1
- package/dist/http/HttpServerResponse.d.ts +118 -0
- package/dist/http/HttpServerResponse.d.ts.map +1 -1
- package/dist/http/HttpServerResponse.js +43 -0
- package/dist/http/HttpServerResponse.js.map +1 -1
- package/dist/http/Multipart.d.ts.map +1 -1
- package/dist/http/Multipart.js +0 -5
- package/dist/http/Multipart.js.map +1 -1
- package/dist/http/MultipartParser/internal/contentType.d.ts +6 -0
- package/dist/http/MultipartParser/internal/contentType.d.ts.map +1 -1
- package/dist/http/MultipartParser/internal/contentType.js +1 -1
- package/dist/http/MultipartParser/internal/contentType.js.map +1 -1
- package/dist/http/internal/clientPath.d.ts +2 -0
- package/dist/http/internal/clientPath.d.ts.map +1 -0
- package/dist/http/internal/clientPath.js +24 -0
- package/dist/http/internal/clientPath.js.map +1 -0
- package/dist/http/internal/redactedPath.js +2 -0
- package/dist/http/internal/redactedPath.js.map +1 -1
- package/dist/http/internal/tracing.js +5 -3
- package/dist/http/internal/tracing.js.map +1 -1
- package/dist/http-api/HttpApi.d.ts +2 -2
- package/dist/http-api/HttpApi.d.ts.map +1 -1
- package/dist/http-api/HttpApi.js +30 -7
- package/dist/http-api/HttpApi.js.map +1 -1
- package/dist/http-api/HttpApiBuilder.d.ts.map +1 -1
- package/dist/http-api/HttpApiBuilder.js +5 -2
- package/dist/http-api/HttpApiBuilder.js.map +1 -1
- package/dist/http-api/HttpApiClient.d.ts.map +1 -1
- package/dist/http-api/HttpApiClient.js +23 -6
- package/dist/http-api/HttpApiClient.js.map +1 -1
- package/dist/http-api/internal/redactedKeys.d.ts +2 -0
- package/dist/http-api/internal/redactedKeys.d.ts.map +1 -0
- package/dist/http-api/internal/redactedKeys.js +37 -0
- package/dist/http-api/internal/redactedKeys.js.map +1 -0
- package/dist/internal/base64.js +34 -2
- package/dist/internal/base64.js.map +1 -1
- package/dist/internal/core.js +60 -43
- package/dist/internal/core.js.map +1 -1
- package/dist/internal/dateTime.js +35 -17
- package/dist/internal/dateTime.js.map +1 -1
- package/dist/internal/effect.js +60 -52
- package/dist/internal/effect.js.map +1 -1
- package/dist/internal/equal.js +44 -13
- package/dist/internal/equal.js.map +1 -1
- package/dist/internal/fiberCachedKeys.d.ts +2 -0
- package/dist/internal/fiberCachedKeys.d.ts.map +1 -0
- package/dist/internal/fiberCachedKeys.js +48 -0
- package/dist/internal/fiberCachedKeys.js.map +1 -0
- package/dist/internal/hashMap.js +1 -1
- package/dist/internal/hashMap.js.map +1 -1
- package/dist/internal/matcher.js +17 -17
- package/dist/internal/matcher.js.map +1 -1
- package/dist/internal/predicate.d.ts +2 -0
- package/dist/internal/predicate.d.ts.map +1 -0
- package/dist/internal/predicate.js +10 -0
- package/dist/internal/predicate.js.map +1 -0
- package/dist/internal/references.js +8 -11
- package/dist/internal/references.js.map +1 -1
- package/dist/internal/schema/schemaCodegen.js +3 -2
- package/dist/internal/schema/schemaCodegen.js.map +1 -1
- package/dist/internal/schema/schemaCodegenBuiltIns.d.ts +2 -0
- package/dist/internal/schema/schemaCodegenBuiltIns.d.ts.map +1 -0
- package/dist/internal/schema/schemaCodegenBuiltIns.js +425 -0
- package/dist/internal/schema/schemaCodegenBuiltIns.js.map +1 -0
- package/dist/internal/schema/toEquivalence.js +3 -4
- package/dist/internal/schema/toEquivalence.js.map +1 -1
- package/dist/internal/version.js +1 -1
- package/dist/jose/JoseError.d.ts +51 -1
- package/dist/jose/JoseError.d.ts.map +1 -1
- package/dist/jose/JoseError.js +25 -18
- package/dist/jose/JoseError.js.map +1 -1
- package/dist/jose/internal/compact.js +10 -5
- package/dist/jose/internal/compact.js.map +1 -1
- package/dist/observability/Otlp.d.ts +19 -0
- package/dist/observability/Otlp.d.ts.map +1 -1
- package/dist/observability/Otlp.js +10 -0
- package/dist/observability/Otlp.js.map +1 -1
- package/dist/observability/OtlpExporter.d.ts +49 -13
- package/dist/observability/OtlpExporter.d.ts.map +1 -1
- package/dist/observability/OtlpExporter.js +135 -54
- package/dist/observability/OtlpExporter.js.map +1 -1
- package/dist/observability/OtlpLogger.d.ts +14 -0
- package/dist/observability/OtlpLogger.d.ts.map +1 -1
- package/dist/observability/OtlpLogger.js +10 -2
- package/dist/observability/OtlpLogger.js.map +1 -1
- package/dist/observability/OtlpMetrics.d.ts.map +1 -1
- package/dist/observability/OtlpMetrics.js +2 -0
- package/dist/observability/OtlpMetrics.js.map +1 -1
- package/dist/observability/OtlpTracer.d.ts +14 -0
- package/dist/observability/OtlpTracer.d.ts.map +1 -1
- package/dist/observability/OtlpTracer.js +10 -2
- package/dist/observability/OtlpTracer.js.map +1 -1
- package/dist/persistence/KeyValueStore.d.ts.map +1 -1
- package/dist/persistence/KeyValueStore.js +6 -4
- package/dist/persistence/KeyValueStore.js.map +1 -1
- package/dist/reactivity/Atom.d.ts.map +1 -1
- package/dist/reactivity/Atom.js +10 -9
- package/dist/reactivity/Atom.js.map +1 -1
- package/dist/rpc/RpcClient.d.ts.map +1 -1
- package/dist/rpc/RpcClient.js +32 -1
- package/dist/rpc/RpcClient.js.map +1 -1
- package/dist/rpc/RpcGroup.d.ts +1 -1
- package/dist/rpc/RpcGroup.d.ts.map +1 -1
- package/dist/rpc/RpcGroup.js +4 -0
- package/dist/rpc/RpcGroup.js.map +1 -1
- package/dist/sql/Migrator.d.ts.map +1 -1
- package/dist/sql/Migrator.js +2 -5
- package/dist/sql/Migrator.js.map +1 -1
- package/dist/sql/SqlClient.d.ts.map +1 -1
- package/dist/sql/SqlClient.js +5 -1
- package/dist/sql/SqlClient.js.map +1 -1
- package/dist/sql/Statement.d.ts +23 -0
- package/dist/sql/Statement.d.ts.map +1 -1
- package/dist/sql/Statement.js +30 -5
- package/dist/sql/Statement.js.map +1 -1
- package/dist/workers/Worker.d.ts +21 -0
- package/dist/workers/Worker.d.ts.map +1 -1
- package/dist/workers/Worker.js +23 -0
- package/dist/workers/Worker.js.map +1 -1
- package/dist/workflow/Activity.d.ts +18 -0
- package/dist/workflow/Activity.d.ts.map +1 -1
- package/dist/workflow/Activity.js +13 -4
- package/dist/workflow/Activity.js.map +1 -1
- package/dist/workflow/Workflow.d.ts +10 -9
- package/dist/workflow/Workflow.d.ts.map +1 -1
- package/dist/workflow/Workflow.js +33 -22
- package/dist/workflow/Workflow.js.map +1 -1
- package/dist/workflow/WorkflowEngine.d.ts.map +1 -1
- package/dist/workflow/WorkflowEngine.js +26 -12
- package/dist/workflow/WorkflowEngine.js.map +1 -1
- package/dist/workflow/internal/retry.d.ts +2 -0
- package/dist/workflow/internal/retry.d.ts.map +1 -0
- package/dist/workflow/internal/retry.js +11 -0
- package/dist/workflow/internal/retry.js.map +1 -0
- package/dist/workflow/internal/scope.d.ts +2 -0
- package/dist/workflow/internal/scope.d.ts.map +1 -0
- package/dist/workflow/internal/scope.js +26 -0
- package/dist/workflow/internal/scope.js.map +1 -0
- package/package.json +3 -3
- package/src/Channel.ts +105 -8
- package/src/Codegen.ts +7 -2
- package/src/Config.ts +6 -3
- package/src/Context.ts +108 -50
- package/src/Cron.ts +11 -10
- package/src/Effect.ts +224 -48
- package/src/Equal.ts +93 -80
- package/src/Formatter.ts +4 -4
- package/src/Hash.ts +49 -48
- package/src/LayerRef.ts +6 -4
- package/src/Logger.ts +68 -25
- package/src/Match.ts +78 -50
- package/src/Metric.ts +4 -4
- package/src/Order.ts +1 -1
- package/src/Pool.ts +62 -33
- package/src/Predicate.ts +2 -5
- package/src/Scheduler.ts +27 -10
- package/src/Schema.ts +79 -296
- package/src/SchemaAST.ts +231 -157
- package/src/SchemaParser.ts +40 -57
- package/src/ScopedCache.ts +6 -4
- package/src/Stream.ts +167 -33
- package/src/String.ts +1 -1
- package/src/Tracer.ts +11 -2
- package/src/ai/McpClient.ts +157 -15
- package/src/ai/McpClientError.ts +55 -4
- package/src/ai/McpServer.ts +318 -91
- package/src/ai/Prompt.ts +20 -3
- package/src/ai/Skill.ts +236 -0
- package/src/ai/index.ts +6 -0
- package/src/ai/internal/mcpProtocol/v2024_11_05.ts +8 -13
- package/src/ai/internal/mcpProtocol/v2025_03_26.ts +13 -15
- package/src/ai/internal/mcpProtocol/v2025_06_18.ts +21 -23
- package/src/ai/internal/mcpProtocol/v2025_11_25.ts +22 -24
- package/src/ai/internal/mcpProtocol/v2026_07_28.ts +1 -1
- package/src/ai/internal/mcpProtocol.ts +15 -0
- package/src/ai/internal/mcpRuntime.ts +36 -13
- package/src/ai/internal/mcpSchema/v2024_11_05.ts +2 -1
- package/src/ai/internal/mcpSchema/v2025_03_26.ts +1 -9
- package/src/ai/internal/mcpSchema/v2025_06_18.ts +3 -10
- package/src/ai/internal/mcpSchema/v2025_11_25.ts +1 -9
- package/src/ai/internal/mcpSchema/v2026_07_28.ts +6 -8
- package/src/cluster/ClusterCron.ts +31 -20
- package/src/cluster/ClusterWorkflowEngine.ts +172 -96
- package/src/cluster/MessageStorage.ts +51 -2
- package/src/cluster/SqlMessageStorage.ts +88 -36
- package/src/cluster/internal/entityActivation.ts +6 -0
- package/src/cluster/internal/entityManager.ts +8 -4
- package/src/encoding/Base64.ts +5 -1
- package/src/encoding/Base64Url.ts +6 -1
- package/src/encoding/Hex.ts +5 -5
- package/src/encoding/Xml.ts +96 -26
- package/src/http/FetchHttpClient.ts +8 -5
- package/src/http/Headers.ts +309 -3
- package/src/http/HttpClient.ts +19 -7
- package/src/http/HttpClientError.ts +42 -9
- package/src/http/HttpClientRequest.ts +51 -0
- package/src/http/HttpClientResponse.ts +156 -0
- package/src/http/HttpEffect.ts +23 -3
- package/src/http/HttpMiddleware.ts +1 -1
- package/src/http/HttpServerError.ts +1 -1
- package/src/http/HttpServerResponse.ts +126 -0
- package/src/http/Multipart.ts +0 -5
- package/src/http/MultipartParser/internal/contentType.ts +1 -1
- package/src/http/internal/clientPath.ts +39 -0
- package/src/http/internal/redactedPath.ts +4 -0
- package/src/http/internal/tracing.ts +6 -3
- package/src/http-api/HttpApi.ts +29 -8
- package/src/http-api/HttpApiBuilder.ts +7 -2
- package/src/http-api/HttpApiClient.ts +30 -7
- package/src/http-api/internal/redactedKeys.ts +40 -0
- package/src/internal/base64.ts +57 -2
- package/src/internal/core.ts +80 -44
- package/src/internal/dateTime.ts +43 -24
- package/src/internal/effect.ts +115 -157
- package/src/internal/equal.ts +73 -17
- package/src/internal/fiberCachedKeys.ts +81 -0
- package/src/internal/hashMap.ts +1 -1
- package/src/internal/matcher.ts +34 -113
- package/src/internal/predicate.ts +10 -0
- package/src/internal/references.ts +21 -14
- package/src/internal/schema/schemaCodegen.ts +5 -4
- package/src/internal/schema/schemaCodegenBuiltIns.ts +343 -0
- package/src/internal/schema/toEquivalence.ts +3 -5
- package/src/internal/version.ts +1 -1
- package/src/jose/JoseError.ts +34 -0
- package/src/jose/internal/compact.ts +14 -5
- package/src/observability/Otlp.ts +29 -0
- package/src/observability/OtlpExporter.ts +206 -75
- package/src/observability/OtlpLogger.ts +24 -2
- package/src/observability/OtlpMetrics.ts +2 -0
- package/src/observability/OtlpTracer.ts +24 -3
- package/src/persistence/KeyValueStore.ts +17 -14
- package/src/reactivity/Atom.ts +12 -18
- package/src/rpc/RpcClient.ts +26 -1
- package/src/rpc/RpcGroup.ts +4 -1
- package/src/sql/Migrator.ts +2 -11
- package/src/sql/SqlClient.ts +14 -8
- package/src/sql/Statement.ts +48 -12
- package/src/workers/Worker.ts +25 -0
- package/src/workflow/Activity.ts +28 -4
- package/src/workflow/Workflow.ts +68 -44
- package/src/workflow/WorkflowEngine.ts +38 -15
- package/src/workflow/internal/retry.ts +12 -0
- package/src/workflow/internal/scope.ts +36 -0
- package/dist/internal/hash.d.ts +0 -2
- package/dist/internal/hash.d.ts.map +0 -1
- package/dist/internal/hash.js +0 -11
- package/dist/internal/hash.js.map +0 -1
- package/dist/internal/metric.d.ts +0 -2
- package/dist/internal/metric.d.ts.map +0 -1
- package/dist/internal/metric.js +0 -3
- package/dist/internal/metric.js.map +0 -1
- package/src/internal/hash.ts +0 -11
- package/src/internal/metric.ts +0 -2
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
import { format } from "../../Formatter.ts"
|
|
2
|
+
import { isObject } from "../../Predicate.ts"
|
|
3
|
+
import type { Json } from "../../Schema.ts"
|
|
4
|
+
import type * as Representation from "../../SchemaRepresentation.ts"
|
|
5
|
+
import { literal } from "../codegen.ts"
|
|
6
|
+
import { errorWithPath } from "../errors.ts"
|
|
7
|
+
|
|
8
|
+
type Path = ReadonlyArray<string | number>
|
|
9
|
+
type PrintArgument = (value: unknown) => string | undefined
|
|
10
|
+
|
|
11
|
+
const noArguments: PrintArgument = (payload) => payload === null ? "" : undefined
|
|
12
|
+
const string: PrintArgument = (value) => typeof value === "string" ? literal(value) : undefined
|
|
13
|
+
const number: PrintArgument = (value) =>
|
|
14
|
+
typeof value === "number" && Number.isFinite(value) ? literal(value) : undefined
|
|
15
|
+
const natural: PrintArgument = (value) =>
|
|
16
|
+
typeof value === "number" && Number.isInteger(value) && value >= 0 ? literal(value) : undefined
|
|
17
|
+
const bigint: PrintArgument = (value) =>
|
|
18
|
+
typeof value === "string" && /^-?(?:0|[1-9][0-9]*)$/.test(value) ? literal(BigInt(value)) : undefined
|
|
19
|
+
const date: PrintArgument = (value) => {
|
|
20
|
+
if (typeof value !== "string") return undefined
|
|
21
|
+
const ms = Date.parse(value)
|
|
22
|
+
return Number.isFinite(ms) && new Date(ms).toISOString() === value ? `new globalThis.Date(${ms})` : undefined
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function fields(render: PrintArgument, ...keys: ReadonlyArray<string>): PrintArgument {
|
|
26
|
+
return (payload) => {
|
|
27
|
+
if (!isObject(payload)) return undefined
|
|
28
|
+
const args: Array<string> = []
|
|
29
|
+
for (const key of keys) {
|
|
30
|
+
const arg = render(payload[key])
|
|
31
|
+
if (arg === undefined) return undefined
|
|
32
|
+
args.push(arg)
|
|
33
|
+
}
|
|
34
|
+
return args.join(", ")
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function between(render: PrintArgument): PrintArgument {
|
|
39
|
+
return (payload) => {
|
|
40
|
+
if (!isObject(payload)) return undefined
|
|
41
|
+
const minimum = render(payload.minimum)
|
|
42
|
+
const maximum = render(payload.maximum)
|
|
43
|
+
const { exclusiveMaximum, exclusiveMinimum } = payload
|
|
44
|
+
if (
|
|
45
|
+
minimum === undefined || maximum === undefined ||
|
|
46
|
+
exclusiveMinimum !== undefined && exclusiveMinimum !== true ||
|
|
47
|
+
exclusiveMaximum !== undefined && exclusiveMaximum !== true
|
|
48
|
+
) return undefined
|
|
49
|
+
return `{ minimum: ${minimum}, maximum: ${maximum}, exclusiveMinimum: ${exclusiveMinimum}, exclusiveMaximum: ${exclusiveMaximum} }`
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const checkArguments: Record<string, PrintArgument> = {
|
|
54
|
+
isTrimmed: noArguments,
|
|
55
|
+
isPattern: (payload) => {
|
|
56
|
+
if (!isObject(payload) || typeof payload.source !== "string" || typeof payload.flags !== "string") return undefined
|
|
57
|
+
const { source, flags } = payload
|
|
58
|
+
try {
|
|
59
|
+
const pattern = new RegExp(source, flags)
|
|
60
|
+
if (pattern.source !== source || pattern.flags !== flags) return undefined
|
|
61
|
+
} catch {
|
|
62
|
+
return undefined
|
|
63
|
+
}
|
|
64
|
+
return `new globalThis.RegExp(${literal(source)}${flags === "" ? "" : ", " + literal(flags)})`
|
|
65
|
+
},
|
|
66
|
+
isStringFinite: noArguments,
|
|
67
|
+
isStringBigInt: noArguments,
|
|
68
|
+
isStringSymbol: noArguments,
|
|
69
|
+
isUUID: (payload) => {
|
|
70
|
+
if (!isObject(payload)) return undefined
|
|
71
|
+
const { version } = payload
|
|
72
|
+
if (version === null) return ""
|
|
73
|
+
return typeof version === "number" && Number.isInteger(version) && version >= 1 && version <= 8
|
|
74
|
+
? literal(version)
|
|
75
|
+
: undefined
|
|
76
|
+
},
|
|
77
|
+
isGUID: noArguments,
|
|
78
|
+
isULID: noArguments,
|
|
79
|
+
isAscii: noArguments,
|
|
80
|
+
isBase64: noArguments,
|
|
81
|
+
isBase64Url: noArguments,
|
|
82
|
+
isStartingWith: fields(string, "startsWith"),
|
|
83
|
+
isEndingWith: fields(string, "endsWith"),
|
|
84
|
+
isIncluding: fields(string, "includes"),
|
|
85
|
+
isUppercased: noArguments,
|
|
86
|
+
isLowercased: noArguments,
|
|
87
|
+
isCapitalized: noArguments,
|
|
88
|
+
isUncapitalized: noArguments,
|
|
89
|
+
isFinite: noArguments,
|
|
90
|
+
isInt: noArguments,
|
|
91
|
+
isGreaterThan: fields(number, "exclusiveMinimum"),
|
|
92
|
+
isGreaterThanOrEqualTo: fields(number, "minimum"),
|
|
93
|
+
isLessThan: fields(number, "exclusiveMaximum"),
|
|
94
|
+
isLessThanOrEqualTo: fields(number, "maximum"),
|
|
95
|
+
isBetween: between(number),
|
|
96
|
+
isMultipleOf: fields((value) => typeof value === "number" && value > 0 ? number(value) : undefined, "divisor"),
|
|
97
|
+
isGreaterThanDate: fields(date, "exclusiveMinimum"),
|
|
98
|
+
isGreaterThanOrEqualToDate: fields(date, "minimum"),
|
|
99
|
+
isLessThanDate: fields(date, "exclusiveMaximum"),
|
|
100
|
+
isLessThanOrEqualToDate: fields(date, "maximum"),
|
|
101
|
+
isBetweenDate: between(date),
|
|
102
|
+
isGreaterThanBigInt: fields(bigint, "exclusiveMinimum"),
|
|
103
|
+
isGreaterThanOrEqualToBigInt: fields(bigint, "minimum"),
|
|
104
|
+
isLessThanBigInt: fields(bigint, "exclusiveMaximum"),
|
|
105
|
+
isLessThanOrEqualToBigInt: fields(bigint, "maximum"),
|
|
106
|
+
isBetweenBigInt: between(bigint),
|
|
107
|
+
isMinLength: fields(natural, "minLength"),
|
|
108
|
+
isMaxLength: fields(natural, "maxLength"),
|
|
109
|
+
isBetweenLength: fields(natural, "minimum", "maximum"),
|
|
110
|
+
isMinCodePoints: fields(natural, "minCodePoints"),
|
|
111
|
+
isMaxCodePoints: fields(natural, "maxCodePoints"),
|
|
112
|
+
isBetweenCodePoints: fields(natural, "minimum", "maximum"),
|
|
113
|
+
isMinSize: fields(natural, "minSize"),
|
|
114
|
+
isMaxSize: fields(natural, "maxSize"),
|
|
115
|
+
isBetweenSize: fields(natural, "minimum", "maximum"),
|
|
116
|
+
isMinProperties: fields(natural, "minProperties"),
|
|
117
|
+
isMaxProperties: fields(natural, "maxProperties"),
|
|
118
|
+
isBetweenProperties: fields(natural, "minimum", "maximum"),
|
|
119
|
+
isPropertyNames: noArguments,
|
|
120
|
+
isUnique: noArguments,
|
|
121
|
+
isUniqueKey: noArguments
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function invalidPayload(id: string, path: Path): never {
|
|
125
|
+
throw errorWithPath(`Invalid representation payload for ${id}`, [...path, "representation", "payload"])
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function checkArity(id: string, actual: number, expected: number, path: Path): void {
|
|
129
|
+
if (actual !== expected) {
|
|
130
|
+
throw errorWithPath(`Invalid number of schema arguments for ${id}: expected ${expected}, got ${actual}`, path)
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/** @internal */
|
|
135
|
+
export function resolveCheck(check: Representation.Check, path: Path): Representation.Generation.Check | undefined {
|
|
136
|
+
const { annotations, representation: repr } = check
|
|
137
|
+
if (annotations && "toCode" in annotations) return annotations.toCode as Representation.Generation.Check | undefined
|
|
138
|
+
if (check._tag !== "Filter" || !repr?.id.startsWith("effect/schema/")) return undefined
|
|
139
|
+
const name = repr.id.slice("effect/schema/".length)
|
|
140
|
+
if (!Object.hasOwn(checkArguments, name)) return undefined
|
|
141
|
+
const args = checkArguments[name](repr.payload) ?? invalidPayload(repr.id, path)
|
|
142
|
+
checkArity(repr.id, repr.schemas?.length ?? 0, name === "isPropertyNames" ? 1 : 0, [
|
|
143
|
+
...path,
|
|
144
|
+
"representation",
|
|
145
|
+
"schemas"
|
|
146
|
+
])
|
|
147
|
+
return ({ schemas }) => ({ runtime: `Schema.${name}(${schemas[0]?.runtime ?? args})` })
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
interface DeclarationRule {
|
|
151
|
+
readonly type: string
|
|
152
|
+
// An explicit zero distinguishes a call like ErrorInstance() from a constant like Date.
|
|
153
|
+
readonly arity?: number
|
|
154
|
+
readonly typeArity?: number
|
|
155
|
+
readonly module?: string
|
|
156
|
+
readonly runtime?: string
|
|
157
|
+
readonly argument?: PrintArgument
|
|
158
|
+
readonly crypto?: KeyAlgorithms
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
function options(accepts: (key: string, value: unknown) => boolean): PrintArgument {
|
|
162
|
+
return (payload) => {
|
|
163
|
+
if (payload === null) return ""
|
|
164
|
+
if (!isObject(payload)) return undefined
|
|
165
|
+
const entries = Object.entries(payload)
|
|
166
|
+
return entries.length > 0 && entries.every(([key, value]) => accepts(key, value)) ? format(payload) : undefined
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
interface KeyAlgorithms {
|
|
171
|
+
readonly withoutHash?: ReadonlyArray<string>
|
|
172
|
+
readonly withHash?: ReadonlyArray<string>
|
|
173
|
+
readonly rsa?: string
|
|
174
|
+
readonly rsaWithSalt?: string
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
const signature: KeyAlgorithms = {
|
|
178
|
+
withoutHash: ["ed25519"],
|
|
179
|
+
withHash: ["ecdsaP256", "ecdsaP384", "ecdsaP521"],
|
|
180
|
+
rsa: "rsaPkcs1v15",
|
|
181
|
+
rsaWithSalt: "rsaPss"
|
|
182
|
+
}
|
|
183
|
+
const keyAgreement: KeyAlgorithms = { withoutHash: ["x25519", "ecdhP256", "ecdhP384", "ecdhP521"] }
|
|
184
|
+
|
|
185
|
+
const declarations: Record<string, DeclarationRule> = {
|
|
186
|
+
"effect/schema/Json": { type: "Schema.Json" },
|
|
187
|
+
"effect/schema/MutableJson": { type: "Schema.MutableJson" },
|
|
188
|
+
"effect/schema/Error": {
|
|
189
|
+
type: "globalThis.Error",
|
|
190
|
+
runtime: "Schema.ErrorInstance",
|
|
191
|
+
arity: 0,
|
|
192
|
+
argument: options((key, value) => (key === "includeStack" || key === "excludeCause") && value === true)
|
|
193
|
+
},
|
|
194
|
+
"effect/schema/RegExp": { type: "globalThis.RegExp" },
|
|
195
|
+
"effect/schema/URL": { type: "globalThis.URL" },
|
|
196
|
+
"effect/schema/Date": { type: "globalThis.Date" },
|
|
197
|
+
"effect/schema/File": { type: "globalThis.File" },
|
|
198
|
+
"effect/schema/FormData": { type: "globalThis.FormData" },
|
|
199
|
+
"effect/schema/URLSearchParams": { type: "globalThis.URLSearchParams" },
|
|
200
|
+
"effect/schema/Uint8Array": { type: "globalThis.Uint8Array" },
|
|
201
|
+
"effect/schema/ReadonlyMap": { type: "globalThis.ReadonlyMap", arity: 2 },
|
|
202
|
+
"effect/schema/ReadonlySet": { type: "globalThis.ReadonlySet", arity: 1 },
|
|
203
|
+
"effect/schema/BigDecimal": { type: "BigDecimal.BigDecimal" },
|
|
204
|
+
"effect/schema/Rational": { type: "Rational.Rational" },
|
|
205
|
+
"effect/schema/ByteSize": { type: "ByteSize.ByteSize" },
|
|
206
|
+
"effect/schema/CauseReason": { type: "Cause.Reason", arity: 2, typeArity: 1 },
|
|
207
|
+
"effect/schema/Cause": { type: "Cause.Cause", arity: 2, typeArity: 1 },
|
|
208
|
+
"effect/schema/Chunk": { type: "Chunk.Chunk", arity: 1 },
|
|
209
|
+
"effect/schema/DateTimeUtc": { type: "DateTime.Utc" },
|
|
210
|
+
"effect/schema/TimeZoneOffset": { type: "DateTime.TimeZone.Offset" },
|
|
211
|
+
"effect/schema/TimeZoneNamed": { type: "DateTime.TimeZone.Named" },
|
|
212
|
+
"effect/schema/TimeZone": { type: "DateTime.TimeZone" },
|
|
213
|
+
"effect/schema/DateTimeZoned": { type: "DateTime.Zoned" },
|
|
214
|
+
"effect/schema/Duration": { type: "Duration.Duration" },
|
|
215
|
+
"effect/schema/Exit": { type: "Exit.Exit", arity: 3, typeArity: 2 },
|
|
216
|
+
"effect/schema/Graph": {
|
|
217
|
+
type: "Graph.Graph",
|
|
218
|
+
arity: 2,
|
|
219
|
+
argument: (kind) => kind === "directed" || kind === "undirected" ? literal(kind) : undefined
|
|
220
|
+
},
|
|
221
|
+
"effect/schema/HashMap": { type: "HashMap.HashMap", arity: 2 },
|
|
222
|
+
"effect/schema/HashSet": { type: "HashSet.HashSet", arity: 1 },
|
|
223
|
+
"effect/schema/Option": { type: "Option.Option", arity: 1 },
|
|
224
|
+
"effect/schema/Redacted": {
|
|
225
|
+
type: "Redacted.Redacted",
|
|
226
|
+
arity: 1,
|
|
227
|
+
argument: options((key, value) =>
|
|
228
|
+
key === "label" ? typeof value === "string" : key === "disallowJsonEncode" && value === true
|
|
229
|
+
)
|
|
230
|
+
},
|
|
231
|
+
"effect/schema/Result": { type: "Result.Result", arity: 2 },
|
|
232
|
+
"effect/schema/SemVer": { type: "SemVer.SemVer" },
|
|
233
|
+
"effect/schema/SemVerRange": { type: "SemVerRange.SemVerRange" },
|
|
234
|
+
"effect/http/Cookie": { type: "Cookies.Cookie", module: "effect/http/Cookies" },
|
|
235
|
+
"effect/http/Cookies": { type: "Cookies.Cookies", module: "effect/http/Cookies" },
|
|
236
|
+
"effect/http/Headers": { type: "Headers.Headers", module: "effect/http/Headers" },
|
|
237
|
+
"effect/http/UrlParams": { type: "UrlParams.UrlParams", module: "effect/http/UrlParams" },
|
|
238
|
+
"effect/http/PersistedFile": {
|
|
239
|
+
type: "Multipart.PersistedFile",
|
|
240
|
+
module: "effect/http/Multipart",
|
|
241
|
+
runtime: "Multipart.PersistedFileSchema"
|
|
242
|
+
},
|
|
243
|
+
"effect/crypto/MacKey": {
|
|
244
|
+
type: "Mac.Key",
|
|
245
|
+
crypto: { withHash: ["hmacSha1", "hmacSha256", "hmacSha384", "hmacSha512"] }
|
|
246
|
+
},
|
|
247
|
+
"effect/crypto/AeadKey": {
|
|
248
|
+
type: "Aead.Key",
|
|
249
|
+
crypto: { withoutHash: ["aes128Gcm", "aes256Gcm", "chacha20Poly1305", "xchacha20Poly1305"] }
|
|
250
|
+
},
|
|
251
|
+
"effect/crypto/CipherKey": {
|
|
252
|
+
type: "Cipher.Key",
|
|
253
|
+
crypto: { withoutHash: ["aes128Ctr", "aes256Ctr", "aes128Cbc", "aes256Cbc"] }
|
|
254
|
+
},
|
|
255
|
+
"effect/crypto/SignaturePublicKey": { type: "Signature.PublicKey", crypto: signature },
|
|
256
|
+
"effect/crypto/SignaturePrivateKey": { type: "Signature.PrivateKey", crypto: signature },
|
|
257
|
+
"effect/crypto/KeyAgreementPublicKey": { type: "KeyAgreement.PublicKey", crypto: keyAgreement },
|
|
258
|
+
"effect/crypto/KeyAgreementPrivateKey": { type: "KeyAgreement.PrivateKey", crypto: keyAgreement },
|
|
259
|
+
"effect/crypto/KeyWrapKey": { type: "KeyWrap.Key", crypto: { withoutHash: ["aes128Kw", "aes256Kw"] } },
|
|
260
|
+
"effect/crypto/KeyWrapPublicKey": { type: "KeyWrap.PublicKey", crypto: { rsa: "rsaOaep" } },
|
|
261
|
+
"effect/crypto/KeyWrapPrivateKey": { type: "KeyWrap.PrivateKey", crypto: { rsa: "rsaOaep" } }
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
const digestSuffixes = new Map([
|
|
265
|
+
["MD5", "Md5"],
|
|
266
|
+
["SHA-1", "Sha1"],
|
|
267
|
+
["SHA-256", "Sha256"],
|
|
268
|
+
["SHA-384", "Sha384"],
|
|
269
|
+
["SHA-512", "Sha512"]
|
|
270
|
+
])
|
|
271
|
+
|
|
272
|
+
function cryptoKey(
|
|
273
|
+
name: string,
|
|
274
|
+
type: string,
|
|
275
|
+
algorithms: KeyAlgorithms,
|
|
276
|
+
payload: Json
|
|
277
|
+
): Representation.Generation.DeclarationOutput | undefined {
|
|
278
|
+
if (!isObject(payload) || typeof payload.name !== "string") return undefined
|
|
279
|
+
const { hash, modulusLength, saltLength } = payload
|
|
280
|
+
const suffix = typeof hash === "string" ? digestSuffixes.get(hash) : undefined
|
|
281
|
+
if (hash !== undefined && suffix === undefined) return undefined
|
|
282
|
+
const digest = suffix === undefined ? undefined : `Digest.${suffix.toLowerCase()}`
|
|
283
|
+
const family = type.split(".")[0]
|
|
284
|
+
const imports = [`import * as ${family} from "effect/crypto/${family}"`]
|
|
285
|
+
if (digest !== undefined) imports.push("import * as Digest from \"effect/crypto/Digest\"")
|
|
286
|
+
let algorithm: string
|
|
287
|
+
if (modulusLength === undefined) {
|
|
288
|
+
const names = digest === undefined ? algorithms.withoutHash : algorithms.withHash
|
|
289
|
+
if (!names?.includes(payload.name) || saltLength !== undefined) return undefined
|
|
290
|
+
algorithm = `${family}.${payload.name}`
|
|
291
|
+
if (digest !== undefined) algorithm = `{ ...${algorithm}, hash: ${digest} }`
|
|
292
|
+
} else {
|
|
293
|
+
const factory = saltLength === undefined ? algorithms.rsa : algorithms.rsaWithSalt
|
|
294
|
+
if (
|
|
295
|
+
factory === undefined || digest === undefined || !Number.isFinite(modulusLength) ||
|
|
296
|
+
saltLength !== undefined && !Number.isFinite(saltLength)
|
|
297
|
+
) return undefined
|
|
298
|
+
const salt = saltLength === undefined ? "" : `, saltLength: ${saltLength}`
|
|
299
|
+
algorithm = `${family}.${factory}({ hash: ${digest}, modulusLength: ${modulusLength}${salt} })`
|
|
300
|
+
if (payload.name !== factory + suffix) algorithm = `{ ...${algorithm}, name: ${literal(payload.name)} }`
|
|
301
|
+
}
|
|
302
|
+
return { runtime: `Schema.${name}(${algorithm})`, Type: type, importDeclarations: imports }
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
/** @internal */
|
|
306
|
+
export function resolveDeclaration(
|
|
307
|
+
node: Representation.Declaration,
|
|
308
|
+
path: Path
|
|
309
|
+
): Representation.Generation.Declaration | undefined {
|
|
310
|
+
const { annotations, representation: repr } = node
|
|
311
|
+
if (annotations && "toCode" in annotations) {
|
|
312
|
+
return annotations.toCode as Representation.Generation.Declaration | undefined
|
|
313
|
+
}
|
|
314
|
+
if (!repr || !Object.hasOwn(declarations, repr.id)) return undefined
|
|
315
|
+
const { id, payload } = repr
|
|
316
|
+
const name = id.slice(id.lastIndexOf("/") + 1)
|
|
317
|
+
const rule = declarations[id]
|
|
318
|
+
checkArity(id, node.typeParameters.length, rule.arity ?? 0, [...path, "typeParameters"])
|
|
319
|
+
if (rule.crypto) {
|
|
320
|
+
const output = cryptoKey(name, rule.type, rule.crypto, payload) ?? invalidPayload(id, path)
|
|
321
|
+
return () => output
|
|
322
|
+
}
|
|
323
|
+
return ({ typeParameters }) => {
|
|
324
|
+
const args = typeParameters.map((p) => p.runtime)
|
|
325
|
+
const types = typeParameters.slice(0, rule.typeArity).map((p) => p.Type)
|
|
326
|
+
const argument = (rule.argument ?? noArguments)(payload) ?? invalidPayload(id, path)
|
|
327
|
+
if (id === "effect/schema/Graph") {
|
|
328
|
+
args.unshift(argument)
|
|
329
|
+
types.push(argument)
|
|
330
|
+
} else if (argument !== "") {
|
|
331
|
+
args.push(argument)
|
|
332
|
+
}
|
|
333
|
+
const runtime = rule.runtime ?? `Schema.${name}`
|
|
334
|
+
const namespace = rule.type.split(".")[0]
|
|
335
|
+
return {
|
|
336
|
+
runtime: rule.arity === undefined ? runtime : `${runtime}(${args.join(", ")})`,
|
|
337
|
+
Type: types.length > 0 ? `${rule.type}<${types.join(", ")}>` : rule.type,
|
|
338
|
+
importDeclarations: namespace === "globalThis" || namespace === "Schema" ? [] : [
|
|
339
|
+
`import * as ${namespace} from "${rule.module ?? "effect/" + namespace}"`
|
|
340
|
+
]
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
}
|
|
@@ -8,14 +8,12 @@ import * as SchemaAST from "../../SchemaAST.ts"
|
|
|
8
8
|
import * as SchemaParser from "../../SchemaParser.ts"
|
|
9
9
|
import * as InternalAnnotations from "./annotations.ts"
|
|
10
10
|
|
|
11
|
-
const recurMemo = memoize(recur)
|
|
12
|
-
|
|
13
11
|
/** @internal */
|
|
14
12
|
export const toEquivalence = (ast: SchemaAST.AST): Equivalence.Equivalence<any> => {
|
|
15
|
-
return
|
|
13
|
+
return recur(SchemaAST.toType(ast))
|
|
16
14
|
}
|
|
17
15
|
|
|
18
|
-
|
|
16
|
+
const recur = memoize((ast: SchemaAST.AST): Equivalence.Equivalence<any> => {
|
|
19
17
|
// ---------------------------------------------
|
|
20
18
|
// handle annotations
|
|
21
19
|
// ---------------------------------------------
|
|
@@ -156,7 +154,7 @@ function recur(ast: SchemaAST.AST): Equivalence.Equivalence<any> {
|
|
|
156
154
|
return Equivalence.make((a, b) => (equivalence ??= toEquivalence(ast.thunk()))(a, b))
|
|
157
155
|
}
|
|
158
156
|
}
|
|
159
|
-
}
|
|
157
|
+
})
|
|
160
158
|
|
|
161
159
|
function declarationEquivalence(ast: SchemaAST.Declaration): Equivalence.Equivalence<any> {
|
|
162
160
|
const representation = (ast.annotations as Schema.Annotations.Declaration<any> | undefined)?.representation
|
package/src/internal/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** @internal */
|
|
2
|
-
export const version = "4.1.
|
|
2
|
+
export const version = "4.1.7"
|
package/src/jose/JoseError.ts
CHANGED
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
* @stability unstable
|
|
17
17
|
* @since 4.1.1
|
|
18
18
|
*/
|
|
19
|
+
import type * as CryptoError from "../crypto/CryptoError.ts"
|
|
19
20
|
import * as Data from "../Data.ts"
|
|
20
21
|
import * as Predicate from "../Predicate.ts"
|
|
21
22
|
|
|
@@ -69,6 +70,38 @@ export class InvalidKey extends Data.TaggedError("InvalidKey")<{
|
|
|
69
70
|
}
|
|
70
71
|
}
|
|
71
72
|
|
|
73
|
+
/**
|
|
74
|
+
* Reason for a crypto backend failure other than a rejected key, such as an
|
|
75
|
+
* algorithm the provider does not support.
|
|
76
|
+
*
|
|
77
|
+
* **Details**
|
|
78
|
+
*
|
|
79
|
+
* `module`, `method`, and `reason` identify the failed backend operation and
|
|
80
|
+
* reason tag. The backend description and cause are omitted because they may
|
|
81
|
+
* contain secret material.
|
|
82
|
+
*
|
|
83
|
+
* @stability unstable
|
|
84
|
+
* @category errors
|
|
85
|
+
* @since 4.1.6
|
|
86
|
+
*/
|
|
87
|
+
export class CryptoFailed extends Data.TaggedError("CryptoFailed")<{
|
|
88
|
+
readonly description: string
|
|
89
|
+
readonly module: string
|
|
90
|
+
readonly method: string
|
|
91
|
+
readonly reason: CryptoError.CryptoErrorReason["_tag"]
|
|
92
|
+
}> {
|
|
93
|
+
/**
|
|
94
|
+
* Marks this value as a `JoseError` reason for runtime guards.
|
|
95
|
+
*
|
|
96
|
+
* @since 4.1.6
|
|
97
|
+
*/
|
|
98
|
+
readonly [ReasonTypeId] = ReasonTypeId
|
|
99
|
+
|
|
100
|
+
override get message(): string {
|
|
101
|
+
return `${this.description} (${this.module}.${this.method}: ${this.reason})`
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
72
105
|
/**
|
|
73
106
|
* Reason for an option or configuration value that the operation rejects
|
|
74
107
|
* before doing any work, such as a non-HTTPS key-set URL.
|
|
@@ -253,6 +286,7 @@ export class ClaimValidationFailed extends Data.TaggedError("ClaimValidationFail
|
|
|
253
286
|
export type JoseErrorReason =
|
|
254
287
|
| InvalidToken
|
|
255
288
|
| InvalidKey
|
|
289
|
+
| CryptoFailed
|
|
256
290
|
| InvalidArgument
|
|
257
291
|
| AlgorithmNotAllowed
|
|
258
292
|
| SignatureVerificationFailed
|
|
@@ -24,14 +24,23 @@ export const invalidArgument = (description: string, cause?: unknown) =>
|
|
|
24
24
|
fail(new JoseError.InvalidArgument({ description, cause }))
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
|
-
* Maps a failure
|
|
28
|
-
*
|
|
29
|
-
*
|
|
27
|
+
* Maps a backend failure without exposing its message or cause, which may
|
|
28
|
+
* describe secret material. `InvalidKey` stays `InvalidKey`; other reasons
|
|
29
|
+
* become `CryptoFailed`.
|
|
30
30
|
*
|
|
31
31
|
* @internal
|
|
32
32
|
*/
|
|
33
|
-
export const cryptoFailure = (description: string) => (
|
|
34
|
-
new JoseError.JoseError({
|
|
33
|
+
export const cryptoFailure = (description: string) => (error: CryptoError.CryptoError): JoseError.JoseError =>
|
|
34
|
+
new JoseError.JoseError({
|
|
35
|
+
reason: error.reason._tag === "InvalidKey"
|
|
36
|
+
? new JoseError.InvalidKey({ description })
|
|
37
|
+
: new JoseError.CryptoFailed({
|
|
38
|
+
description,
|
|
39
|
+
module: error.module,
|
|
40
|
+
method: error.method,
|
|
41
|
+
reason: error.reason._tag
|
|
42
|
+
})
|
|
43
|
+
})
|
|
35
44
|
|
|
36
45
|
/**
|
|
37
46
|
* Maps a public-key import failure, keeping the backend diagnostic.
|
|
@@ -16,6 +16,7 @@ import type * as HttpClient from "../http/HttpClient.ts"
|
|
|
16
16
|
import * as HttpClientRequest from "../http/HttpClientRequest.ts"
|
|
17
17
|
import * as Layer from "../Layer.ts"
|
|
18
18
|
import type * as Tracer from "../Tracer.ts"
|
|
19
|
+
import type { Concurrency } from "../Types.ts"
|
|
19
20
|
import type * as OtlpExporter from "./OtlpExporter.ts"
|
|
20
21
|
import * as OtlpLogger from "./OtlpLogger.ts"
|
|
21
22
|
import type { AggregationTemporality } from "./OtlpMetrics.ts"
|
|
@@ -53,6 +54,11 @@ export const layer = (options: {
|
|
|
53
54
|
*/
|
|
54
55
|
readonly compression?: "gzip" | "none" | undefined
|
|
55
56
|
readonly maxBatchSize?: number | undefined
|
|
57
|
+
/** Maximum pending queued spans/logs (does not include in-flight batches). */
|
|
58
|
+
readonly maxQueueSize?: number | undefined
|
|
59
|
+
/** Maximum concurrent export requests for spans/logs, or `"unbounded"`. Defaults to `4`. */
|
|
60
|
+
readonly concurrency?: Concurrency | undefined
|
|
61
|
+
readonly onDrop?: ((count: number) => void) | undefined
|
|
56
62
|
readonly tracerContext?: (<X>(primitive: Tracer.EffectPrimitive<X>, span: Tracer.AnySpan) => X) | undefined
|
|
57
63
|
readonly loggerExportInterval?: Duration.Input | undefined
|
|
58
64
|
readonly loggerExcludeLogSpans?: boolean | undefined
|
|
@@ -72,6 +78,9 @@ export const layer = (options: {
|
|
|
72
78
|
compression: options.compression,
|
|
73
79
|
exportInterval: options.loggerExportInterval,
|
|
74
80
|
maxBatchSize: options.maxBatchSize,
|
|
81
|
+
maxQueueSize: options.maxQueueSize,
|
|
82
|
+
concurrency: options.concurrency,
|
|
83
|
+
onDrop: options.onDrop,
|
|
75
84
|
shutdownTimeout: options.shutdownTimeout,
|
|
76
85
|
excludeLogSpans: options.loggerExcludeLogSpans,
|
|
77
86
|
mergeWithExisting: options.loggerMergeWithExisting
|
|
@@ -92,6 +101,9 @@ export const layer = (options: {
|
|
|
92
101
|
compression: options.compression,
|
|
93
102
|
exportInterval: options.tracerExportInterval,
|
|
94
103
|
maxBatchSize: options.maxBatchSize,
|
|
104
|
+
maxQueueSize: options.maxQueueSize,
|
|
105
|
+
concurrency: options.concurrency,
|
|
106
|
+
onDrop: options.onDrop,
|
|
95
107
|
context: options.tracerContext,
|
|
96
108
|
shutdownTimeout: options.shutdownTimeout
|
|
97
109
|
})
|
|
@@ -119,6 +131,9 @@ export const layerFromConfig = (options?: {
|
|
|
119
131
|
readonly attributes?: Record<string, unknown>
|
|
120
132
|
} | undefined
|
|
121
133
|
readonly headers?: Headers.Input | undefined
|
|
134
|
+
/** Maximum concurrent export requests for spans/logs, or `"unbounded"`. Defaults to `4`. */
|
|
135
|
+
readonly concurrency?: Concurrency | undefined
|
|
136
|
+
readonly onDrop?: ((count: number) => void) | undefined
|
|
122
137
|
readonly tracerContext?: (<X>(primitive: Tracer.EffectPrimitive<X>, span: Tracer.AnySpan) => X) | undefined
|
|
123
138
|
readonly loggerExcludeLogSpans?: boolean | undefined
|
|
124
139
|
readonly loggerMergeWithExisting?: boolean | undefined
|
|
@@ -127,6 +142,8 @@ export const layerFromConfig = (options?: {
|
|
|
127
142
|
OtlpLogger.layerFromConfig({
|
|
128
143
|
resource: options?.resource,
|
|
129
144
|
headers: options?.headers,
|
|
145
|
+
concurrency: options?.concurrency,
|
|
146
|
+
onDrop: options?.onDrop,
|
|
130
147
|
excludeLogSpans: options?.loggerExcludeLogSpans,
|
|
131
148
|
mergeWithExisting: options?.loggerMergeWithExisting
|
|
132
149
|
}),
|
|
@@ -137,6 +154,8 @@ export const layerFromConfig = (options?: {
|
|
|
137
154
|
OtlpTracer.layerFromConfig({
|
|
138
155
|
resource: options?.resource,
|
|
139
156
|
headers: options?.headers,
|
|
157
|
+
concurrency: options?.concurrency,
|
|
158
|
+
onDrop: options?.onDrop,
|
|
140
159
|
context: options?.tracerContext
|
|
141
160
|
})
|
|
142
161
|
)
|
|
@@ -163,6 +182,11 @@ export const layerJson: (options: {
|
|
|
163
182
|
*/
|
|
164
183
|
readonly compression?: "gzip" | "none" | undefined
|
|
165
184
|
readonly maxBatchSize?: number | undefined
|
|
185
|
+
/** Maximum pending queued spans/logs (does not include in-flight batches). */
|
|
186
|
+
readonly maxQueueSize?: number | undefined
|
|
187
|
+
/** Maximum concurrent export requests for spans/logs, or `"unbounded"`. Defaults to `4`. */
|
|
188
|
+
readonly concurrency?: Concurrency | undefined
|
|
189
|
+
readonly onDrop?: ((count: number) => void) | undefined
|
|
166
190
|
readonly tracerContext?: (<X>(primitive: Tracer.EffectPrimitive<X>, span: Tracer.AnySpan) => X) | undefined
|
|
167
191
|
readonly loggerExportInterval?: Duration.Input | undefined
|
|
168
192
|
readonly loggerExcludeLogSpans?: boolean | undefined
|
|
@@ -198,6 +222,11 @@ export const layerProtobuf: (options: {
|
|
|
198
222
|
*/
|
|
199
223
|
readonly compression?: "gzip" | "none" | undefined
|
|
200
224
|
readonly maxBatchSize?: number | undefined
|
|
225
|
+
/** Maximum pending queued spans/logs (does not include in-flight batches). */
|
|
226
|
+
readonly maxQueueSize?: number | undefined
|
|
227
|
+
/** Maximum concurrent export requests for spans/logs, or `"unbounded"`. Defaults to `4`. */
|
|
228
|
+
readonly concurrency?: Concurrency | undefined
|
|
229
|
+
readonly onDrop?: ((count: number) => void) | undefined
|
|
201
230
|
readonly tracerContext?: (<X>(primitive: Tracer.EffectPrimitive<X>, span: Tracer.AnySpan) => X) | undefined
|
|
202
231
|
readonly loggerExportInterval?: Duration.Input | undefined
|
|
203
232
|
readonly loggerExcludeLogSpans?: boolean | undefined
|