effect 4.0.0-beta.93 → 4.0.0-beta.97
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/Array.d.ts.map +1 -1
- package/dist/BigDecimal.d.ts.map +1 -1
- package/dist/BigDecimal.js.map +1 -1
- package/dist/BigInt.d.ts.map +1 -1
- package/dist/Boolean.d.ts.map +1 -1
- package/dist/Brand.d.ts.map +1 -1
- package/dist/Cache.d.ts.map +1 -1
- package/dist/Cause.d.ts.map +1 -1
- package/dist/Channel.d.ts.map +1 -1
- package/dist/ChannelSchema.d.ts.map +1 -1
- package/dist/Chunk.d.ts.map +1 -1
- package/dist/Combiner.d.ts.map +1 -1
- package/dist/Config.d.ts +1 -1
- package/dist/Config.d.ts.map +1 -1
- package/dist/Config.js.map +1 -1
- package/dist/ConfigProvider.d.ts +44 -6
- package/dist/ConfigProvider.d.ts.map +1 -1
- package/dist/ConfigProvider.js +63 -24
- package/dist/ConfigProvider.js.map +1 -1
- package/dist/Console.d.ts.map +1 -1
- package/dist/Context.d.ts.map +1 -1
- package/dist/Cron.d.ts +4 -1
- package/dist/Cron.d.ts.map +1 -1
- package/dist/Cron.js +98 -53
- package/dist/Cron.js.map +1 -1
- package/dist/Crypto.d.ts.map +1 -1
- package/dist/Data.d.ts.map +1 -1
- package/dist/DateTime.d.ts +12 -12
- package/dist/DateTime.d.ts.map +1 -1
- package/dist/Deferred.d.ts.map +1 -1
- package/dist/Duration.d.ts.map +1 -1
- package/dist/Effect.d.ts +130 -0
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +43 -0
- package/dist/Effect.js.map +1 -1
- package/dist/Effectable.d.ts.map +1 -1
- package/dist/Encoding.d.ts.map +1 -1
- package/dist/Equal.d.ts.map +1 -1
- package/dist/Equivalence.d.ts.map +1 -1
- package/dist/ErrorReporter.d.ts.map +1 -1
- package/dist/ExecutionPlan.d.ts +2 -2
- package/dist/ExecutionPlan.d.ts.map +1 -1
- package/dist/Fiber.d.ts.map +1 -1
- package/dist/FiberHandle.d.ts +8 -8
- package/dist/FiberHandle.d.ts.map +1 -1
- package/dist/FiberMap.d.ts +8 -8
- package/dist/FiberMap.d.ts.map +1 -1
- package/dist/FiberSet.d.ts +4 -4
- package/dist/FiberSet.d.ts.map +1 -1
- package/dist/FileSystem.d.ts +7 -0
- package/dist/FileSystem.d.ts.map +1 -1
- package/dist/FileSystem.js +3 -0
- package/dist/FileSystem.js.map +1 -1
- package/dist/Filter.d.ts.map +1 -1
- package/dist/Function.d.ts.map +1 -1
- package/dist/Graph.d.ts.map +1 -1
- package/dist/Graph.js.map +1 -1
- package/dist/Hash.d.ts.map +1 -1
- package/dist/HashMap.d.ts.map +1 -1
- package/dist/HashRing.d.ts.map +1 -1
- package/dist/Inspectable.d.ts.map +1 -1
- package/dist/Inspectable.js.map +1 -1
- package/dist/Iterable.d.ts.map +1 -1
- package/dist/Latch.d.ts.map +1 -1
- package/dist/Layer.d.ts +1 -1
- package/dist/Layer.d.ts.map +1 -1
- package/dist/Layer.js +6 -3
- package/dist/Layer.js.map +1 -1
- package/dist/LayerMap.d.ts.map +1 -1
- package/dist/LayerMap.js +1 -1
- package/dist/LayerMap.js.map +1 -1
- package/dist/LayerRef.d.ts +252 -0
- package/dist/LayerRef.d.ts.map +1 -0
- package/dist/LayerRef.js +171 -0
- package/dist/LayerRef.js.map +1 -0
- package/dist/LogLevel.d.ts.map +1 -1
- package/dist/Logger.d.ts.map +1 -1
- package/dist/ManagedRuntime.d.ts.map +1 -1
- package/dist/Metric.d.ts.map +1 -1
- package/dist/MutableHashMap.d.ts.map +1 -1
- package/dist/MutableHashSet.d.ts.map +1 -1
- package/dist/MutableList.d.ts.map +1 -1
- package/dist/MutableRef.d.ts.map +1 -1
- package/dist/NonEmptyIterable.d.ts.map +1 -1
- package/dist/Number.d.ts.map +1 -1
- package/dist/Optic.d.ts.map +1 -1
- package/dist/Option.d.ts.map +1 -1
- package/dist/Order.d.ts.map +1 -1
- package/dist/Ordering.d.ts.map +1 -1
- package/dist/PartitionedSemaphore.d.ts.map +1 -1
- package/dist/Pipeable.d.ts.map +1 -1
- package/dist/PlatformError.d.ts.map +1 -1
- package/dist/Pool.d.ts.map +1 -1
- package/dist/PrimaryKey.d.ts.map +1 -1
- package/dist/PubSub.d.ts.map +1 -1
- package/dist/Pull.d.ts.map +1 -1
- package/dist/Queue.d.ts.map +1 -1
- package/dist/Random.d.ts.map +1 -1
- package/dist/RcMap.d.ts.map +1 -1
- package/dist/Record.d.ts.map +1 -1
- package/dist/Redactable.d.ts.map +1 -1
- package/dist/Redacted.d.ts.map +1 -1
- package/dist/Ref.d.ts.map +1 -1
- package/dist/RegExp.d.ts.map +1 -1
- package/dist/Request.d.ts +1 -1
- package/dist/Request.d.ts.map +1 -1
- package/dist/RequestResolver.d.ts.map +1 -1
- package/dist/Resource.d.ts.map +1 -1
- package/dist/Result.d.ts.map +1 -1
- package/dist/Runtime.d.ts.map +1 -1
- package/dist/Schedule.d.ts +1206 -4013
- package/dist/Schedule.d.ts.map +1 -1
- package/dist/Schedule.js +244 -1348
- package/dist/Schedule.js.map +1 -1
- package/dist/Scheduler.d.ts.map +1 -1
- package/dist/Scheduler.js.map +1 -1
- package/dist/Schema.d.ts +123 -30
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +40 -0
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaAST.d.ts.map +1 -1
- package/dist/SchemaAST.js.map +1 -1
- package/dist/SchemaGetter.d.ts.map +1 -1
- package/dist/SchemaIssue.d.ts.map +1 -1
- package/dist/SchemaIssue.js.map +1 -1
- package/dist/SchemaParser.d.ts +1 -1
- package/dist/SchemaParser.d.ts.map +1 -1
- package/dist/SchemaParser.js.map +1 -1
- package/dist/SchemaRepresentation.d.ts +106 -106
- package/dist/SchemaTransformation.d.ts +38 -2
- package/dist/SchemaTransformation.d.ts.map +1 -1
- package/dist/SchemaTransformation.js +38 -2
- package/dist/SchemaTransformation.js.map +1 -1
- package/dist/ScopedCache.d.ts.map +1 -1
- package/dist/ScopedRef.d.ts.map +1 -1
- package/dist/Semaphore.d.ts.map +1 -1
- package/dist/Sink.d.ts.map +1 -1
- package/dist/Stdio.d.ts.map +1 -1
- package/dist/Stream.d.ts +2 -2
- package/dist/Stream.d.ts.map +1 -1
- package/dist/Stream.js +1 -1
- package/dist/String.d.ts.map +1 -1
- package/dist/String.js.map +1 -1
- package/dist/Struct.d.ts.map +1 -1
- package/dist/SubscriptionRef.d.ts.map +1 -1
- package/dist/SynchronizedRef.d.ts.map +1 -1
- package/dist/Take.d.ts.map +1 -1
- package/dist/Terminal.d.ts.map +1 -1
- package/dist/Tracer.d.ts.map +1 -1
- package/dist/Trie.d.ts.map +1 -1
- package/dist/Tuple.d.ts.map +1 -1
- package/dist/TxChunk.d.ts.map +1 -1
- package/dist/TxDeferred.d.ts.map +1 -1
- package/dist/TxHashMap.d.ts.map +1 -1
- package/dist/TxHashSet.d.ts.map +1 -1
- package/dist/TxPriorityQueue.d.ts.map +1 -1
- package/dist/TxPubSub.d.ts.map +1 -1
- package/dist/TxQueue.d.ts.map +1 -1
- package/dist/TxReentrantLock.d.ts.map +1 -1
- package/dist/TxRef.d.ts.map +1 -1
- package/dist/TxSemaphore.d.ts.map +1 -1
- package/dist/TxSubscriptionRef.d.ts.map +1 -1
- package/dist/Types.d.ts +1 -1
- package/dist/Types.d.ts.map +1 -1
- package/dist/UndefinedOr.d.ts.map +1 -1
- package/dist/Utils.d.ts.map +1 -1
- package/dist/internal/effect.js +2 -0
- package/dist/internal/effect.js.map +1 -1
- package/dist/internal/schema/schema.d.ts.map +1 -1
- package/dist/testing/TestClock.d.ts.map +1 -1
- package/dist/testing/TestConsole.d.ts.map +1 -1
- package/dist/testing/TestSchema.d.ts +2 -2
- package/dist/testing/TestSchema.d.ts.map +1 -1
- package/dist/testing/TestSchema.js.map +1 -1
- package/dist/unstable/ai/AiError.d.ts +1 -1
- package/dist/unstable/ai/AiError.d.ts.map +1 -1
- package/dist/unstable/ai/Chat.d.ts +2 -2
- package/dist/unstable/ai/Chat.d.ts.map +1 -1
- package/dist/unstable/ai/IdGenerator.d.ts.map +1 -1
- package/dist/unstable/ai/LanguageModel.d.ts +2 -2
- package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
- package/dist/unstable/ai/McpSchema.d.ts +221 -221
- package/dist/unstable/ai/McpSchema.d.ts.map +1 -1
- package/dist/unstable/ai/McpServer.d.ts.map +1 -1
- package/dist/unstable/ai/Model.d.ts.map +1 -1
- package/dist/unstable/ai/Prompt.d.ts.map +1 -1
- package/dist/unstable/ai/Response.d.ts.map +1 -1
- package/dist/unstable/ai/Telemetry.d.ts.map +1 -1
- package/dist/unstable/ai/Tokenizer.d.ts.map +1 -1
- package/dist/unstable/ai/Tool.d.ts.map +1 -1
- package/dist/unstable/ai/Toolkit.d.ts.map +1 -1
- package/dist/unstable/cli/Argument.d.ts +2 -2
- package/dist/unstable/cli/Argument.d.ts.map +1 -1
- package/dist/unstable/cli/Argument.js.map +1 -1
- package/dist/unstable/cli/CliError.d.ts.map +1 -1
- package/dist/unstable/cli/CliOutput.d.ts.map +1 -1
- package/dist/unstable/cli/Command.d.ts.map +1 -1
- package/dist/unstable/cli/Completions.d.ts.map +1 -1
- package/dist/unstable/cli/Flag.d.ts +2 -2
- package/dist/unstable/cli/Flag.d.ts.map +1 -1
- package/dist/unstable/cli/Flag.js.map +1 -1
- package/dist/unstable/cli/GlobalFlag.d.ts.map +1 -1
- package/dist/unstable/cli/Param.d.ts +2 -2
- package/dist/unstable/cli/Param.d.ts.map +1 -1
- package/dist/unstable/cli/Param.js.map +1 -1
- package/dist/unstable/cli/Primitive.d.ts.map +1 -1
- package/dist/unstable/cli/Primitive.js.map +1 -1
- package/dist/unstable/cli/Prompt.d.ts.map +1 -1
- package/dist/unstable/cli/Prompt.js.map +1 -1
- package/dist/unstable/cli/internal/ansi.d.ts.map +1 -1
- package/dist/unstable/cli/internal/ansi.js.map +1 -1
- package/dist/unstable/cli/internal/command.d.ts.map +1 -1
- package/dist/unstable/cli/internal/help.d.ts.map +1 -1
- package/dist/unstable/cli/internal/parser.js.map +1 -1
- package/dist/unstable/cluster/ClusterCron.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterCron.js +1 -1
- package/dist/unstable/cluster/ClusterCron.js.map +1 -1
- package/dist/unstable/cluster/ClusterError.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterSchema.d.ts +1 -1
- package/dist/unstable/cluster/ClusterSchema.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.js +2 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.js.map +1 -1
- package/dist/unstable/cluster/DeliverAt.d.ts.map +1 -1
- package/dist/unstable/cluster/Entity.d.ts.map +1 -1
- package/dist/unstable/cluster/Entity.js +5 -3
- package/dist/unstable/cluster/Entity.js.map +1 -1
- package/dist/unstable/cluster/EntityAddress.d.ts.map +1 -1
- package/dist/unstable/cluster/EntityId.d.ts.map +1 -1
- package/dist/unstable/cluster/EntityProxy.d.ts.map +1 -1
- package/dist/unstable/cluster/EntityProxyServer.d.ts.map +1 -1
- package/dist/unstable/cluster/EntityType.d.ts.map +1 -1
- package/dist/unstable/cluster/Envelope.d.ts.map +1 -1
- package/dist/unstable/cluster/HttpRunner.d.ts.map +1 -1
- package/dist/unstable/cluster/MachineId.d.ts.map +1 -1
- package/dist/unstable/cluster/Message.d.ts.map +1 -1
- package/dist/unstable/cluster/MessageStorage.d.ts +25 -29
- package/dist/unstable/cluster/MessageStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/Reply.d.ts.map +1 -1
- package/dist/unstable/cluster/Runner.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerAddress.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerHealth.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerServer.d.ts +1 -1
- package/dist/unstable/cluster/RunnerStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/Runners.d.ts +8 -8
- package/dist/unstable/cluster/ShardId.d.ts.map +1 -1
- package/dist/unstable/cluster/Sharding.d.ts.map +1 -1
- package/dist/unstable/cluster/Sharding.js +6 -5
- package/dist/unstable/cluster/Sharding.js.map +1 -1
- package/dist/unstable/cluster/ShardingConfig.d.ts.map +1 -1
- package/dist/unstable/cluster/ShardingRegistrationEvent.d.ts +6 -8
- package/dist/unstable/cluster/ShardingRegistrationEvent.d.ts.map +1 -1
- package/dist/unstable/cluster/SingleRunner.d.ts.map +1 -1
- package/dist/unstable/cluster/Singleton.d.ts.map +1 -1
- package/dist/unstable/cluster/SingletonAddress.d.ts.map +1 -1
- package/dist/unstable/cluster/Snowflake.d.ts +1 -1
- package/dist/unstable/cluster/Snowflake.d.ts.map +1 -1
- package/dist/unstable/cluster/Snowflake.js +1 -1
- package/dist/unstable/cluster/Snowflake.js.map +1 -1
- package/dist/unstable/cluster/SqlMessageStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/SqlRunnerStorage.d.ts +1 -1
- package/dist/unstable/cluster/SqlRunnerStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/internal/entityManager.js +14 -14
- package/dist/unstable/cluster/internal/entityManager.js.map +1 -1
- package/dist/unstable/cluster/internal/resourceMap.js +39 -14
- package/dist/unstable/cluster/internal/resourceMap.js.map +1 -1
- package/dist/unstable/devtools/DevTools.d.ts.map +1 -1
- package/dist/unstable/encoding/Msgpack.d.ts.map +1 -1
- package/dist/unstable/encoding/Ndjson.d.ts.map +1 -1
- package/dist/unstable/encoding/Sse.d.ts +2 -2
- package/dist/unstable/encoding/Sse.d.ts.map +1 -1
- package/dist/unstable/eventlog/Event.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventGroup.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventJournal.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventJournal.js.map +1 -1
- package/dist/unstable/eventlog/EventLog.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLog.js +2 -2
- package/dist/unstable/eventlog/EventLog.js.map +1 -1
- package/dist/unstable/eventlog/EventLogEncryption.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogMessage.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogRemote.d.ts +21 -21
- package/dist/unstable/eventlog/EventLogServer.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts +1 -1
- package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts +3 -4
- package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogSessionAuth.d.ts.map +1 -1
- package/dist/unstable/eventlog/SqlEventJournal.d.ts.map +1 -1
- package/dist/unstable/eventlog/SqlEventLogServerEncrypted.d.ts.map +1 -1
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.d.ts.map +1 -1
- package/dist/unstable/http/Cookies.d.ts +1 -1
- package/dist/unstable/http/Cookies.d.ts.map +1 -1
- package/dist/unstable/http/Etag.d.ts.map +1 -1
- package/dist/unstable/http/Headers.d.ts.map +1 -1
- package/dist/unstable/http/HttpBody.d.ts.map +1 -1
- package/dist/unstable/http/HttpClient.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientError.d.ts +1 -1
- package/dist/unstable/http/HttpClientError.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientResponse.d.ts +1 -1
- package/dist/unstable/http/HttpClientResponse.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientResponse.js.map +1 -1
- package/dist/unstable/http/HttpEffect.d.ts.map +1 -1
- package/dist/unstable/http/HttpIncomingMessage.d.ts +2 -2
- package/dist/unstable/http/HttpIncomingMessage.d.ts.map +1 -1
- package/dist/unstable/http/HttpIncomingMessage.js.map +1 -1
- package/dist/unstable/http/HttpMethod.d.ts.map +1 -1
- package/dist/unstable/http/HttpMiddleware.d.ts +1 -1
- package/dist/unstable/http/HttpMiddleware.d.ts.map +1 -1
- package/dist/unstable/http/HttpRouter.d.ts +4 -4
- package/dist/unstable/http/HttpRouter.d.ts.map +1 -1
- package/dist/unstable/http/HttpRouter.js.map +1 -1
- package/dist/unstable/http/HttpServer.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerError.d.ts +1 -1
- package/dist/unstable/http/HttpServerError.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerRequest.d.ts +8 -8
- package/dist/unstable/http/HttpServerRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerRequest.js.map +1 -1
- package/dist/unstable/http/HttpServerRespondable.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerResponse.d.ts +1 -1
- package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerResponse.js.map +1 -1
- package/dist/unstable/http/HttpStaticServer.d.ts.map +1 -1
- package/dist/unstable/http/HttpTraceContext.d.ts.map +1 -1
- package/dist/unstable/http/Multipart.d.ts +4 -3
- package/dist/unstable/http/Multipart.d.ts.map +1 -1
- package/dist/unstable/http/Multipart.js.map +1 -1
- package/dist/unstable/http/Url.d.ts.map +1 -1
- package/dist/unstable/http/UrlParams.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApi.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApi.js +2 -4
- package/dist/unstable/httpapi/HttpApi.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiEndpoint.d.ts +26 -26
- package/dist/unstable/httpapi/HttpApiEndpoint.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiError.d.ts +1 -1
- package/dist/unstable/httpapi/HttpApiError.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiGroup.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiMiddleware.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiScalar.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiSchema.d.ts +1 -1
- package/dist/unstable/httpapi/HttpApiSchema.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiSecurity.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiSwagger.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiTest.d.ts +1 -1
- package/dist/unstable/observability/Otlp.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpExporter.js +3 -1
- package/dist/unstable/observability/OtlpExporter.js.map +1 -1
- package/dist/unstable/observability/OtlpLogger.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpMetrics.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpResource.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpTracer.d.ts.map +1 -1
- package/dist/unstable/observability/PrometheusMetrics.d.ts.map +1 -1
- package/dist/unstable/observability/internal/otlpEnv.d.ts.map +1 -1
- package/dist/unstable/persistence/KeyValueStore.d.ts.map +1 -1
- package/dist/unstable/persistence/KeyValueStore.js.map +1 -1
- package/dist/unstable/persistence/Persistable.d.ts.map +1 -1
- package/dist/unstable/persistence/PersistedQueue.d.ts +1 -1
- package/dist/unstable/persistence/PersistedQueue.d.ts.map +1 -1
- package/dist/unstable/persistence/Persistence.d.ts.map +1 -1
- package/dist/unstable/persistence/RateLimiter.d.ts.map +1 -1
- package/dist/unstable/persistence/Redis.d.ts.map +1 -1
- package/dist/unstable/process/ChildProcess.d.ts.map +1 -1
- package/dist/unstable/process/ChildProcess.js.map +1 -1
- package/dist/unstable/process/ChildProcessSpawner.d.ts.map +1 -1
- package/dist/unstable/reactivity/AsyncResult.d.ts +2 -2
- package/dist/unstable/reactivity/AsyncResult.d.ts.map +1 -1
- package/dist/unstable/reactivity/Atom.d.ts +4 -4
- package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
- package/dist/unstable/reactivity/Atom.js.map +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomRef.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomRegistry.d.ts +2 -2
- package/dist/unstable/reactivity/AtomRegistry.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomRegistry.js +28 -37
- package/dist/unstable/reactivity/AtomRegistry.js.map +1 -1
- package/dist/unstable/reactivity/AtomRpc.d.ts.map +1 -1
- package/dist/unstable/reactivity/Hydration.d.ts.map +1 -1
- package/dist/unstable/reactivity/Reactivity.d.ts.map +1 -1
- package/dist/unstable/rpc/Rpc.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcClient.d.ts +2 -1
- package/dist/unstable/rpc/RpcClient.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcClient.js +5 -5
- package/dist/unstable/rpc/RpcClient.js.map +1 -1
- package/dist/unstable/rpc/RpcGroup.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcMessage.d.ts +7 -7
- package/dist/unstable/rpc/RpcMessage.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcMessage.js +2 -2
- package/dist/unstable/rpc/RpcMessage.js.map +1 -1
- package/dist/unstable/rpc/RpcMiddleware.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcSchema.d.ts +1 -1
- package/dist/unstable/rpc/RpcSerialization.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcSerialization.js +8 -8
- package/dist/unstable/rpc/RpcSerialization.js.map +1 -1
- package/dist/unstable/rpc/RpcServer.d.ts +2 -2
- package/dist/unstable/rpc/RpcServer.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcServer.js +5 -5
- package/dist/unstable/rpc/RpcServer.js.map +1 -1
- package/dist/unstable/rpc/RpcWorker.d.ts.map +1 -1
- package/dist/unstable/rpc/Utils.d.ts.map +1 -1
- package/dist/unstable/schema/Model.d.ts +24 -38
- package/dist/unstable/schema/Model.d.ts.map +1 -1
- package/dist/unstable/schema/VariantSchema.d.ts +1 -1
- package/dist/unstable/schema/VariantSchema.d.ts.map +1 -1
- package/dist/unstable/socket/Socket.d.ts +1 -1
- package/dist/unstable/socket/Socket.d.ts.map +1 -1
- package/dist/unstable/socket/SocketServer.d.ts.map +1 -1
- package/dist/unstable/sql/Migrator.d.ts.map +1 -1
- package/dist/unstable/sql/SqlClient.d.ts.map +1 -1
- package/dist/unstable/sql/SqlError.d.ts +2 -2
- package/dist/unstable/sql/SqlError.d.ts.map +1 -1
- package/dist/unstable/sql/SqlError.js.map +1 -1
- package/dist/unstable/sql/SqlModel.d.ts.map +1 -1
- package/dist/unstable/sql/SqlResolver.d.ts.map +1 -1
- package/dist/unstable/sql/SqlSchema.d.ts.map +1 -1
- package/dist/unstable/sql/SqlStream.d.ts.map +1 -1
- package/dist/unstable/sql/Statement.d.ts.map +1 -1
- package/dist/unstable/workers/Transferable.d.ts.map +1 -1
- package/dist/unstable/workers/Worker.d.ts.map +1 -1
- package/dist/unstable/workers/WorkerError.d.ts.map +1 -1
- package/dist/unstable/workflow/Activity.d.ts +1 -1
- package/dist/unstable/workflow/Activity.d.ts.map +1 -1
- package/dist/unstable/workflow/Activity.js +1 -1
- package/dist/unstable/workflow/Activity.js.map +1 -1
- package/dist/unstable/workflow/DurableClock.d.ts.map +1 -1
- package/dist/unstable/workflow/DurableDeferred.d.ts.map +1 -1
- package/dist/unstable/workflow/DurableQueue.d.ts.map +1 -1
- package/dist/unstable/workflow/DurableQueue.js +1 -1
- package/dist/unstable/workflow/DurableQueue.js.map +1 -1
- package/dist/unstable/workflow/Workflow.d.ts.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.d.ts.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.js +1 -1
- package/dist/unstable/workflow/WorkflowEngine.js.map +1 -1
- package/dist/unstable/workflow/WorkflowProxy.d.ts.map +1 -1
- package/dist/unstable/workflow/WorkflowProxyServer.d.ts.map +1 -1
- package/package.json +11 -12
- package/src/Config.ts +1 -1
- package/src/ConfigProvider.ts +79 -27
- package/src/Cron.ts +109 -57
- package/src/Effect.ts +131 -0
- package/src/FileSystem.ts +13 -0
- package/src/Layer.ts +6 -6
- package/src/LayerMap.ts +1 -1
- package/src/LayerRef.ts +379 -0
- package/src/Schedule.ts +1437 -4445
- package/src/Schema.ts +133 -33
- package/src/SchemaParser.ts +2 -2
- package/src/SchemaTransformation.ts +42 -2
- package/src/Stream.ts +1 -1
- package/src/internal/effect.ts +19 -0
- package/src/testing/TestSchema.ts +2 -2
- package/src/unstable/ai/Chat.ts +1 -1
- package/src/unstable/ai/LanguageModel.ts +3 -3
- package/src/unstable/cli/Argument.ts +14 -7
- package/src/unstable/cli/Flag.ts +6 -3
- package/src/unstable/cli/Param.ts +6 -3
- package/src/unstable/cli/Primitive.ts +2 -2
- package/src/unstable/cluster/ClusterCron.ts +4 -3
- package/src/unstable/cluster/ClusterWorkflowEngine.ts +5 -3
- package/src/unstable/cluster/Entity.ts +13 -14
- package/src/unstable/cluster/Sharding.ts +137 -134
- package/src/unstable/cluster/Snowflake.ts +2 -2
- package/src/unstable/cluster/internal/entityManager.ts +27 -25
- package/src/unstable/cluster/internal/resourceMap.ts +59 -25
- package/src/unstable/encoding/Sse.ts +3 -3
- package/src/unstable/eventlog/EventLog.ts +4 -3
- package/src/unstable/http/HttpClientResponse.ts +2 -3
- package/src/unstable/http/HttpIncomingMessage.ts +4 -5
- package/src/unstable/http/HttpRouter.ts +8 -10
- package/src/unstable/http/HttpServerRequest.ts +20 -19
- package/src/unstable/http/HttpServerResponse.ts +2 -2
- package/src/unstable/http/Multipart.ts +3 -3
- package/src/unstable/httpapi/HttpApi.ts +2 -4
- package/src/unstable/httpapi/HttpApiClient.ts +2 -2
- package/src/unstable/httpapi/HttpApiEndpoint.ts +7 -7
- package/src/unstable/httpapi/HttpApiSchema.ts +1 -1
- package/src/unstable/observability/OtlpExporter.ts +1 -1
- package/src/unstable/reactivity/Atom.ts +10 -7
- package/src/unstable/reactivity/AtomRegistry.ts +35 -44
- package/src/unstable/rpc/RpcClient.ts +10 -9
- package/src/unstable/rpc/RpcMessage.ts +8 -9
- package/src/unstable/rpc/RpcSerialization.ts +16 -16
- package/src/unstable/rpc/RpcServer.ts +5 -5
- package/src/unstable/workflow/Activity.ts +6 -5
- package/src/unstable/workflow/DurableQueue.ts +4 -3
- package/src/unstable/workflow/WorkflowEngine.ts +4 -3
|
@@ -38,7 +38,7 @@ import * as Semaphore from "../../Semaphore.ts"
|
|
|
38
38
|
import * as Stream from "../../Stream.ts"
|
|
39
39
|
import type * as Rpc from "../rpc/Rpc.ts"
|
|
40
40
|
import * as RpcClient from "../rpc/RpcClient.ts"
|
|
41
|
-
import {
|
|
41
|
+
import type { FromServer } from "../rpc/RpcMessage.ts"
|
|
42
42
|
import type { MailboxFull, PersistenceError } from "./ClusterError.ts"
|
|
43
43
|
import { AlreadyProcessingMessage, EntityNotAssignedToRunner } from "./ClusterError.ts"
|
|
44
44
|
import * as ClusterMetrics from "./ClusterMetrics.ts"
|
|
@@ -1034,148 +1034,151 @@ const make = Effect.gen(function*() {
|
|
|
1034
1034
|
MailboxFull | AlreadyProcessingMessage
|
|
1035
1035
|
>,
|
|
1036
1036
|
never
|
|
1037
|
-
> = yield* ResourceMap.make(
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
rpc.annotations,
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1037
|
+
> = yield* ResourceMap.make(
|
|
1038
|
+
Effect.fnUntraced(function*(entity: Entity<string, any>) {
|
|
1039
|
+
const client = yield* RpcClient.makeNoSerialization(entity.protocol, {
|
|
1040
|
+
spanPrefix: `${entity.type}.client`,
|
|
1041
|
+
disableTracing: !Context.get(entity.protocol.annotations, ClusterSchema.ClientTracingEnabled),
|
|
1042
|
+
supportsAck: true,
|
|
1043
|
+
generateRequestId: () => snowflakeGen.nextUnsafe() as any,
|
|
1044
|
+
flatten: true,
|
|
1045
|
+
onFromClient(options): Effect.Effect<
|
|
1046
|
+
void,
|
|
1047
|
+
MailboxFull | AlreadyProcessingMessage | PersistenceError
|
|
1048
|
+
> {
|
|
1049
|
+
const address = Context.getUnsafe(options.context, ClientAddressTag)
|
|
1050
|
+
switch (options.message._tag) {
|
|
1051
|
+
case "Request": {
|
|
1052
|
+
const fiber = Fiber.getCurrent()!
|
|
1053
|
+
const id = Snowflake.Snowflake(options.message.id)
|
|
1054
|
+
const rpc = entity.protocol.requests.get(options.message.tag)!
|
|
1055
|
+
let respond: (reply: Reply.Reply<any>) => Effect.Effect<void>
|
|
1056
|
+
const envelope = Envelope.makeRequest<any>({
|
|
1057
|
+
requestId: id,
|
|
1058
|
+
address,
|
|
1059
|
+
tag: options.message.tag,
|
|
1060
|
+
payload: options.message.payload,
|
|
1061
|
+
headers: options.message.headers,
|
|
1062
|
+
traceId: options.message.traceId,
|
|
1063
|
+
spanId: options.message.spanId,
|
|
1064
|
+
sampled: options.message.sampled
|
|
1065
|
+
})
|
|
1066
|
+
const message = new Message.OutgoingRequest({
|
|
1067
|
+
envelope,
|
|
1068
|
+
lastReceivedReply: Option.none(),
|
|
1069
|
+
rpc,
|
|
1070
|
+
context: fiber.context as Context.Context<any>,
|
|
1071
|
+
respond: (reply) => respond(reply),
|
|
1072
|
+
annotations: Context.get(rpc.annotations, ClusterSchema.Dynamic)(
|
|
1073
|
+
rpc.annotations,
|
|
1074
|
+
envelope as any
|
|
1075
|
+
)
|
|
1076
|
+
})
|
|
1077
|
+
if (!options.discard) {
|
|
1078
|
+
const entry: ClientRequestEntry = {
|
|
1079
|
+
rpc: rpc as any,
|
|
1080
|
+
context: fiber.currentContext,
|
|
1081
|
+
message
|
|
1082
|
+
}
|
|
1083
|
+
clientRequests.set(id, entry)
|
|
1084
|
+
respond = makeClientRespond(entry, client.write)
|
|
1085
|
+
} else {
|
|
1086
|
+
respond = clientRespondDiscard
|
|
1081
1087
|
}
|
|
1082
|
-
|
|
1083
|
-
respond = makeClientRespond(entry, client.write)
|
|
1084
|
-
} else {
|
|
1085
|
-
respond = clientRespondDiscard
|
|
1088
|
+
return sendOutgoing(message, options.discard)
|
|
1086
1089
|
}
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1090
|
+
case "Ack": {
|
|
1091
|
+
const requestId = Snowflake.Snowflake(options.message.requestId)
|
|
1092
|
+
const entry = clientRequests.get(requestId)
|
|
1093
|
+
if (!entry) return Effect.void
|
|
1094
|
+
return sendOutgoing(
|
|
1095
|
+
new Message.OutgoingEnvelope({
|
|
1096
|
+
envelope: new Envelope.AckChunk({
|
|
1097
|
+
id: snowflakeGen.nextUnsafe(),
|
|
1098
|
+
address,
|
|
1099
|
+
requestId,
|
|
1100
|
+
replyId: entry.lastChunkId!
|
|
1101
|
+
}),
|
|
1102
|
+
rpc: entry.rpc
|
|
1100
1103
|
}),
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
false
|
|
1104
|
-
)
|
|
1105
|
-
}
|
|
1106
|
-
case "Interrupt": {
|
|
1107
|
-
const requestId = Snowflake.Snowflake(options.message.requestId)
|
|
1108
|
-
const entry = clientRequests.get(requestId)!
|
|
1109
|
-
if (!entry) return Effect.void
|
|
1110
|
-
clientRequests.delete(requestId)
|
|
1111
|
-
if (ClusterSchema.isUninterruptibleForClient(entry.message.annotations)) {
|
|
1112
|
-
return Effect.void
|
|
1113
|
-
}
|
|
1114
|
-
// for durable messages, we ignore interrupts on shutdown or as a
|
|
1115
|
-
// result of a shard being resassigned
|
|
1116
|
-
const isTransientInterrupt = MutableRef.get(isShutdown) ||
|
|
1117
|
-
options.message.interruptors.some((id) => internalInterruptors.has(id))
|
|
1118
|
-
if (isTransientInterrupt && Context.get(entry.message.annotations, Persisted)) {
|
|
1119
|
-
return Effect.void
|
|
1104
|
+
false
|
|
1105
|
+
)
|
|
1120
1106
|
}
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1107
|
+
case "Interrupt": {
|
|
1108
|
+
const requestId = Snowflake.Snowflake(options.message.requestId)
|
|
1109
|
+
const entry = clientRequests.get(requestId)!
|
|
1110
|
+
if (!entry) return Effect.void
|
|
1111
|
+
clientRequests.delete(requestId)
|
|
1112
|
+
if (ClusterSchema.isUninterruptibleForClient(entry.message.annotations)) {
|
|
1113
|
+
return Effect.void
|
|
1114
|
+
}
|
|
1115
|
+
// for durable messages, we ignore interrupts on shutdown or as a
|
|
1116
|
+
// result of a shard being resassigned
|
|
1117
|
+
const isTransientInterrupt = MutableRef.get(isShutdown) ||
|
|
1118
|
+
options.message.interruptors.some((id) => internalInterruptors.has(id))
|
|
1119
|
+
if (isTransientInterrupt && Context.get(entry.message.annotations, Persisted)) {
|
|
1120
|
+
return Effect.void
|
|
1121
|
+
}
|
|
1122
|
+
return Effect.ignore(sendOutgoing(
|
|
1123
|
+
new Message.OutgoingEnvelope({
|
|
1124
|
+
envelope: new Envelope.Interrupt({
|
|
1125
|
+
id: snowflakeGen.nextUnsafe(),
|
|
1126
|
+
address,
|
|
1127
|
+
requestId
|
|
1128
|
+
}),
|
|
1129
|
+
rpc: entry.rpc
|
|
1127
1130
|
}),
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
))
|
|
1131
|
+
false,
|
|
1132
|
+
3
|
|
1133
|
+
))
|
|
1134
|
+
}
|
|
1133
1135
|
}
|
|
1136
|
+
return Effect.void
|
|
1134
1137
|
}
|
|
1135
|
-
return Effect.void
|
|
1136
|
-
}
|
|
1137
|
-
})
|
|
1138
|
-
|
|
1139
|
-
yield* Scope.addFinalizer(
|
|
1140
|
-
yield* Effect.scope,
|
|
1141
|
-
Effect.withFiber((fiber) => {
|
|
1142
|
-
internalInterruptors.add(fiber.id)
|
|
1143
|
-
return Effect.void
|
|
1144
1138
|
})
|
|
1145
|
-
)
|
|
1146
1139
|
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
entityType: entity.type
|
|
1153
|
-
}))
|
|
1154
|
-
const clientFn = function(tag: string, payload: any, options?: {
|
|
1155
|
-
readonly context?: Context.Context<never>
|
|
1156
|
-
}) {
|
|
1157
|
-
const context = options?.context ? Context.merge(options.context, address) : address
|
|
1158
|
-
return client.client(tag, payload, {
|
|
1159
|
-
...options,
|
|
1160
|
-
context
|
|
1140
|
+
yield* Scope.addFinalizer(
|
|
1141
|
+
yield* Effect.scope,
|
|
1142
|
+
Effect.withFiber((fiber) => {
|
|
1143
|
+
internalInterruptors.add(fiber.id)
|
|
1144
|
+
return Effect.void
|
|
1161
1145
|
})
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
return
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1146
|
+
)
|
|
1147
|
+
|
|
1148
|
+
return (entityId: string) => {
|
|
1149
|
+
const id = makeEntityId(entityId)
|
|
1150
|
+
const address = ClientAddressTag.context(makeEntityAddress({
|
|
1151
|
+
shardId: getShardId(id, entity.getShardGroup(entityId as EntityId)),
|
|
1152
|
+
entityId: id,
|
|
1153
|
+
entityType: entity.type
|
|
1154
|
+
}))
|
|
1155
|
+
const clientFn = function(tag: string, payload: any, options?: {
|
|
1156
|
+
readonly context?: Context.Context<never>
|
|
1157
|
+
}) {
|
|
1158
|
+
const context = options?.context ? Context.merge(options.context, address) : address
|
|
1159
|
+
return client.client(tag, payload, {
|
|
1160
|
+
...options,
|
|
1161
|
+
context
|
|
1162
|
+
})
|
|
1175
1163
|
}
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1164
|
+
const proxyClient: any = {}
|
|
1165
|
+
return new Proxy(proxyClient, {
|
|
1166
|
+
has(_, p) {
|
|
1167
|
+
return entity.protocol.requests.has(p as string)
|
|
1168
|
+
},
|
|
1169
|
+
get(target, p) {
|
|
1170
|
+
if (p in target) {
|
|
1171
|
+
return target[p]
|
|
1172
|
+
} else if (!entity.protocol.requests.has(p as string)) {
|
|
1173
|
+
return undefined
|
|
1174
|
+
}
|
|
1175
|
+
return target[p] = (payload: any, options?: {}) => clientFn(p as string, payload, options)
|
|
1176
|
+
}
|
|
1177
|
+
})
|
|
1178
|
+
}
|
|
1179
|
+
}),
|
|
1180
|
+
{ referential: true }
|
|
1181
|
+
)
|
|
1179
1182
|
|
|
1180
1183
|
const makeClient = <Type extends string, Rpcs extends Rpc.Any>(entity: Entity<Type, Rpcs>): Effect.Effect<
|
|
1181
1184
|
(
|
|
@@ -1196,7 +1199,7 @@ const make = Effect.gen(function*() {
|
|
|
1196
1199
|
return write({
|
|
1197
1200
|
_tag: "Chunk",
|
|
1198
1201
|
clientId: 0,
|
|
1199
|
-
requestId:
|
|
1202
|
+
requestId: reply.requestId as any,
|
|
1200
1203
|
values: reply.values
|
|
1201
1204
|
})
|
|
1202
1205
|
}
|
|
@@ -1205,7 +1208,7 @@ const make = Effect.gen(function*() {
|
|
|
1205
1208
|
return write({
|
|
1206
1209
|
_tag: "Exit",
|
|
1207
1210
|
clientId: 0,
|
|
1208
|
-
requestId:
|
|
1211
|
+
requestId: reply.requestId as any,
|
|
1209
1212
|
exit: reply.exit
|
|
1210
1213
|
})
|
|
1211
1214
|
}
|
|
@@ -53,8 +53,8 @@ export type Snowflake = Brand.Branded<bigint, TypeId>
|
|
|
53
53
|
* @category constructors
|
|
54
54
|
* @since 4.0.0
|
|
55
55
|
*/
|
|
56
|
-
export const Snowflake = (input: string | bigint): Snowflake =>
|
|
57
|
-
typeof input === "
|
|
56
|
+
export const Snowflake = (input: string | number | bigint): Snowflake =>
|
|
57
|
+
typeof input === "bigint" ? input as Snowflake : BigInt(input) as Snowflake
|
|
58
58
|
|
|
59
59
|
/**
|
|
60
60
|
* Namespace containing support types for snowflake parts and generators.
|
|
@@ -18,7 +18,6 @@ import * as Schema from "../../../Schema.ts"
|
|
|
18
18
|
import * as SchemaIssue from "../../../SchemaIssue.ts"
|
|
19
19
|
import * as Scope from "../../../Scope.ts"
|
|
20
20
|
import type * as Rpc from "../../rpc/Rpc.ts"
|
|
21
|
-
import { RequestId } from "../../rpc/RpcMessage.ts"
|
|
22
21
|
import * as RpcServer from "../../rpc/RpcServer.ts"
|
|
23
22
|
import { AlreadyProcessingMessage, EntityNotAssignedToRunner, MailboxFull, MalformedMessage } from "../ClusterError.ts"
|
|
24
23
|
import * as ClusterMetrics from "../ClusterMetrics.ts"
|
|
@@ -67,7 +66,7 @@ export interface EntityManager {
|
|
|
67
66
|
export type EntityState = {
|
|
68
67
|
readonly address: EntityAddress
|
|
69
68
|
readonly scope: Scope.Scope
|
|
70
|
-
readonly activeRequests: Map<
|
|
69
|
+
readonly activeRequests: Map<Snowflake.Snowflake, {
|
|
71
70
|
readonly rpc: Rpc.AnyWithProps
|
|
72
71
|
readonly message: Message.IncomingRequestLocal<any>
|
|
73
72
|
sentReply: boolean
|
|
@@ -145,7 +144,7 @@ export const make = Effect.fnUntraced(function*<
|
|
|
145
144
|
)
|
|
146
145
|
|
|
147
146
|
const activeRequests: EntityState["activeRequests"] = new Map()
|
|
148
|
-
let defectRequestIds = new Set<
|
|
147
|
+
let defectRequestIds = new Set<Snowflake.Snowflake>()
|
|
149
148
|
let isRestartingDueToDefect = false
|
|
150
149
|
|
|
151
150
|
// the server is stored in a ref, so if there is a defect, we can
|
|
@@ -155,16 +154,18 @@ export const make = Effect.fnUntraced(function*<
|
|
|
155
154
|
Effect.fnUntraced(function*(scope) {
|
|
156
155
|
let isShuttingDown = false
|
|
157
156
|
|
|
157
|
+
const handlerContext = Context.mutate(context, (context) =>
|
|
158
|
+
context.pipe(
|
|
159
|
+
Context.add(CurrentAddress, address),
|
|
160
|
+
Context.add(CurrentRunnerAddress, options.runnerAddress),
|
|
161
|
+
Context.add(KeepAliveLatch, keepAliveLatch),
|
|
162
|
+
Context.add(Scope.Scope, scope),
|
|
163
|
+
Context.add(CurrentLogAnnotations, {})
|
|
164
|
+
))
|
|
165
|
+
|
|
158
166
|
// Initiate the behavior for the entity
|
|
159
167
|
const handlers = yield* (entity.protocol.toHandlers(buildHandlers as any).pipe(
|
|
160
|
-
Effect.
|
|
161
|
-
Effect.provideContext(Context.mutate(context, (context) =>
|
|
162
|
-
context.pipe(
|
|
163
|
-
Context.add(CurrentAddress, address),
|
|
164
|
-
Context.add(CurrentRunnerAddress, options.runnerAddress),
|
|
165
|
-
Context.add(KeepAliveLatch, keepAliveLatch),
|
|
166
|
-
Context.add(Scope.Scope, scope)
|
|
167
|
-
))),
|
|
168
|
+
Effect.setContext(handlerContext as Context.Context<any>),
|
|
168
169
|
Effect.sandbox,
|
|
169
170
|
Effect.tapError((cause) => Effect.logError("Defect building entity handlers", cause)),
|
|
170
171
|
Effect.retry(defectRetryPolicy)
|
|
@@ -182,7 +183,7 @@ export const make = Effect.fnUntraced(function*<
|
|
|
182
183
|
onFromServer(response): Effect.Effect<void> {
|
|
183
184
|
switch (response._tag) {
|
|
184
185
|
case "Exit": {
|
|
185
|
-
const request = activeRequests.get(response.requestId)
|
|
186
|
+
const request = activeRequests.get(Snowflake.Snowflake(response.requestId))
|
|
186
187
|
if (!request) return Effect.void
|
|
187
188
|
|
|
188
189
|
request.sentReply = true
|
|
@@ -190,7 +191,7 @@ export const make = Effect.fnUntraced(function*<
|
|
|
190
191
|
if (
|
|
191
192
|
isShuttingDown &&
|
|
192
193
|
Exit.hasInterrupts(response.exit) &&
|
|
193
|
-
defectRequestIds.has(response.requestId)
|
|
194
|
+
defectRequestIds.has(Snowflake.Snowflake(response.requestId))
|
|
194
195
|
) {
|
|
195
196
|
return Effect.void
|
|
196
197
|
}
|
|
@@ -208,7 +209,7 @@ export const make = Effect.fnUntraced(function*<
|
|
|
208
209
|
if (!isShuttingDown) {
|
|
209
210
|
return server.write(0, {
|
|
210
211
|
...request.message.envelope,
|
|
211
|
-
id:
|
|
212
|
+
id: request.message.envelope.requestId as any,
|
|
212
213
|
tag: request.message.envelope.tag as any,
|
|
213
214
|
payload: new Request({
|
|
214
215
|
...request.message.envelope,
|
|
@@ -218,7 +219,7 @@ export const make = Effect.fnUntraced(function*<
|
|
|
218
219
|
Effect.forkIn(scope)
|
|
219
220
|
)
|
|
220
221
|
}
|
|
221
|
-
activeRequests.delete(response.requestId)
|
|
222
|
+
activeRequests.delete(Snowflake.Snowflake(response.requestId))
|
|
222
223
|
return options.storage.unregisterReplyHandler(request.message.envelope.requestId)
|
|
223
224
|
}
|
|
224
225
|
return retryRespond(
|
|
@@ -235,7 +236,7 @@ export const make = Effect.fnUntraced(function*<
|
|
|
235
236
|
).pipe(
|
|
236
237
|
Effect.flatMap(() => {
|
|
237
238
|
processedRequestIds.add(request.message.envelope.requestId)
|
|
238
|
-
activeRequests.delete(response.requestId)
|
|
239
|
+
activeRequests.delete(Snowflake.Snowflake(response.requestId))
|
|
239
240
|
|
|
240
241
|
// ensure that the reaper does not remove the entity as we haven't
|
|
241
242
|
// been "idle" yet
|
|
@@ -249,7 +250,7 @@ export const make = Effect.fnUntraced(function*<
|
|
|
249
250
|
)
|
|
250
251
|
}
|
|
251
252
|
case "Chunk": {
|
|
252
|
-
const request = activeRequests.get(response.requestId)
|
|
253
|
+
const request = activeRequests.get(Snowflake.Snowflake(response.requestId))
|
|
253
254
|
if (!request) return Effect.void
|
|
254
255
|
const sequence = request.sequence
|
|
255
256
|
request.sequence++
|
|
@@ -280,7 +281,7 @@ export const make = Effect.fnUntraced(function*<
|
|
|
280
281
|
}
|
|
281
282
|
}).pipe(
|
|
282
283
|
Scope.provide(scope),
|
|
283
|
-
Effect.
|
|
284
|
+
Effect.setContext(Context.merge(handlerContext, handlers))
|
|
284
285
|
)
|
|
285
286
|
|
|
286
287
|
yield* Scope.addFinalizer(
|
|
@@ -297,7 +298,7 @@ export const make = Effect.fnUntraced(function*<
|
|
|
297
298
|
const { lastSentChunk, message } = request
|
|
298
299
|
yield* server.write(0, {
|
|
299
300
|
...message.envelope,
|
|
300
|
-
id:
|
|
301
|
+
id: message.envelope.requestId as any,
|
|
301
302
|
tag: message.envelope.tag as any,
|
|
302
303
|
payload: new Request({
|
|
303
304
|
...message.envelope,
|
|
@@ -473,7 +474,7 @@ export const make = Effect.fnUntraced(function*<
|
|
|
473
474
|
server.activeRequests.set(message.envelope.requestId, entry)
|
|
474
475
|
let write = server.write(0, {
|
|
475
476
|
...message.envelope,
|
|
476
|
-
id:
|
|
477
|
+
id: message.envelope.requestId as any,
|
|
477
478
|
payload: new Request({
|
|
478
479
|
...message.envelope,
|
|
479
480
|
lastSentChunk: Option.filter(
|
|
@@ -501,10 +502,10 @@ export const make = Effect.fnUntraced(function*<
|
|
|
501
502
|
return server.write(
|
|
502
503
|
0,
|
|
503
504
|
message.envelope._tag === "AckChunk"
|
|
504
|
-
? { _tag: "Ack", requestId:
|
|
505
|
+
? { _tag: "Ack", requestId: message.envelope.requestId as any }
|
|
505
506
|
: {
|
|
506
507
|
_tag: "Interrupt",
|
|
507
|
-
requestId:
|
|
508
|
+
requestId: message.envelope.requestId as any,
|
|
508
509
|
interruptors: []
|
|
509
510
|
}
|
|
510
511
|
)
|
|
@@ -609,9 +610,10 @@ export const make = Effect.fnUntraced(function*<
|
|
|
609
610
|
})
|
|
610
611
|
})
|
|
611
612
|
|
|
612
|
-
const defaultRetryPolicy = Schedule.
|
|
613
|
-
Schedule.
|
|
614
|
-
)
|
|
613
|
+
const defaultRetryPolicy = Schedule.min([
|
|
614
|
+
Schedule.exponential(500, 1.5),
|
|
615
|
+
Schedule.spaced("10 seconds")
|
|
616
|
+
])
|
|
615
617
|
|
|
616
618
|
const makeMessageDecode = <Type extends string, Rpcs extends Rpc.Any>(
|
|
617
619
|
entity: Entity<Type, Rpcs>,
|
|
@@ -4,23 +4,16 @@ import * as Effect from "../../../Effect.ts"
|
|
|
4
4
|
import * as Exit from "../../../Exit.ts"
|
|
5
5
|
import * as MutableHashMap from "../../../MutableHashMap.ts"
|
|
6
6
|
import * as MutableRef from "../../../MutableRef.ts"
|
|
7
|
-
import * as Option from "../../../Option.ts"
|
|
8
7
|
import * as Scope from "../../../Scope.ts"
|
|
9
8
|
|
|
10
9
|
/** @internal */
|
|
11
10
|
export class ResourceMap<K, A, E> {
|
|
12
11
|
readonly lookup: (key: K, scope: Scope.Scope) => Effect.Effect<A, E>
|
|
13
|
-
readonly entries:
|
|
14
|
-
readonly scope: Scope.Closeable
|
|
15
|
-
readonly deferred: Deferred.Deferred<A, E>
|
|
16
|
-
}>
|
|
12
|
+
readonly entries: BackingMap<K, A, E>
|
|
17
13
|
readonly isClosed: MutableRef.MutableRef<boolean>
|
|
18
14
|
constructor(
|
|
19
15
|
lookup: (key: K, scope: Scope.Scope) => Effect.Effect<A, E>,
|
|
20
|
-
entries:
|
|
21
|
-
readonly scope: Scope.Closeable
|
|
22
|
-
readonly deferred: Deferred.Deferred<A, E>
|
|
23
|
-
}>,
|
|
16
|
+
entries: BackingMap<K, A, E>,
|
|
24
17
|
isClosed: MutableRef.MutableRef<boolean>
|
|
25
18
|
) {
|
|
26
19
|
this.lookup = lookup
|
|
@@ -28,22 +21,29 @@ export class ResourceMap<K, A, E> {
|
|
|
28
21
|
this.isClosed = isClosed
|
|
29
22
|
}
|
|
30
23
|
|
|
31
|
-
static make = Effect.fnUntraced(function*<K, A, E, R>(lookup: (key: K) => Effect.Effect<A, E, R
|
|
24
|
+
static make = Effect.fnUntraced(function*<K, A, E, R>(lookup: (key: K) => Effect.Effect<A, E, R>, options?: {
|
|
25
|
+
readonly referential?: boolean | undefined
|
|
26
|
+
}) {
|
|
32
27
|
const scope = yield* Effect.scope
|
|
33
28
|
const services = yield* Effect.context<R>()
|
|
34
29
|
const isClosed = MutableRef.make(false)
|
|
35
30
|
|
|
36
|
-
const entries
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
31
|
+
const entries: BackingMap<K, A, E> = options?.referential ?
|
|
32
|
+
{
|
|
33
|
+
_tag: "Referential",
|
|
34
|
+
map: new Map()
|
|
35
|
+
} :
|
|
36
|
+
{
|
|
37
|
+
_tag: "Equal",
|
|
38
|
+
map: MutableHashMap.empty()
|
|
39
|
+
}
|
|
40
40
|
|
|
41
41
|
yield* Scope.addFinalizerExit(
|
|
42
42
|
scope,
|
|
43
43
|
(exit) => {
|
|
44
44
|
MutableRef.set(isClosed, true)
|
|
45
|
-
return Effect.forEach(entries, ([key, { scope }]) => {
|
|
46
|
-
|
|
45
|
+
return Effect.forEach(entries.map, ([key, { scope }]) => {
|
|
46
|
+
backingDelete(entries, key)
|
|
47
47
|
return Effect.exit(Scope.close(scope, exit))
|
|
48
48
|
}, { concurrency: "unbounded", discard: true })
|
|
49
49
|
}
|
|
@@ -61,18 +61,18 @@ export class ResourceMap<K, A, E> {
|
|
|
61
61
|
if (MutableRef.get(this.isClosed)) {
|
|
62
62
|
return Effect.interrupt
|
|
63
63
|
}
|
|
64
|
-
const existing =
|
|
65
|
-
if (
|
|
66
|
-
return Deferred.await(existing.
|
|
64
|
+
const existing = backingGet(this.entries, key)
|
|
65
|
+
if (existing) {
|
|
66
|
+
return Deferred.await(existing.deferred)
|
|
67
67
|
}
|
|
68
68
|
const scope = Effect.runSync(Scope.make())
|
|
69
69
|
const deferred = Deferred.makeUnsafe<A, E>()
|
|
70
|
-
|
|
70
|
+
backingSet(this.entries, key, { scope, deferred })
|
|
71
71
|
return Effect.onExit(this.lookup(key, scope), (exit) => {
|
|
72
72
|
if (exit._tag === "Success") {
|
|
73
73
|
return Deferred.done(deferred, exit)
|
|
74
74
|
}
|
|
75
|
-
|
|
75
|
+
backingDelete(this.entries, key)
|
|
76
76
|
return Deferred.done(deferred, exit)
|
|
77
77
|
})
|
|
78
78
|
})
|
|
@@ -80,12 +80,12 @@ export class ResourceMap<K, A, E> {
|
|
|
80
80
|
|
|
81
81
|
remove(key: K): Effect.Effect<void> {
|
|
82
82
|
return Effect.suspend(() => {
|
|
83
|
-
const entry =
|
|
84
|
-
if (
|
|
83
|
+
const entry = backingGet(this.entries, key)
|
|
84
|
+
if (!entry) {
|
|
85
85
|
return Effect.void
|
|
86
86
|
}
|
|
87
|
-
|
|
88
|
-
return Scope.close(entry.
|
|
87
|
+
backingDelete(this.entries, key)
|
|
88
|
+
return Scope.close(entry.scope, Exit.void)
|
|
89
89
|
})
|
|
90
90
|
}
|
|
91
91
|
|
|
@@ -98,3 +98,37 @@ export class ResourceMap<K, A, E> {
|
|
|
98
98
|
}))
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
|
+
|
|
102
|
+
type BackingMap<K, A, E> = {
|
|
103
|
+
readonly _tag: "Equal"
|
|
104
|
+
readonly map: MutableHashMap.MutableHashMap<K, Entry<A, E>>
|
|
105
|
+
} | {
|
|
106
|
+
readonly _tag: "Referential"
|
|
107
|
+
readonly map: Map<K, Entry<A, E>>
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
type Entry<A, E> = {
|
|
111
|
+
readonly scope: Scope.Closeable
|
|
112
|
+
readonly deferred: Deferred.Deferred<A, E>
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
const backingGet = <K, A, E>(map: BackingMap<K, A, E>, key: K): Entry<A, E> | undefined => {
|
|
116
|
+
if (map._tag === "Equal") {
|
|
117
|
+
return MutableHashMap.get(map.map, key).valueOrUndefined
|
|
118
|
+
}
|
|
119
|
+
return map.map.get(key)
|
|
120
|
+
}
|
|
121
|
+
const backingSet = <K, A, E>(map: BackingMap<K, A, E>, key: K, entry: Entry<A, E>): void => {
|
|
122
|
+
if (map._tag === "Equal") {
|
|
123
|
+
MutableHashMap.set(map.map, key, entry)
|
|
124
|
+
} else {
|
|
125
|
+
map.map.set(key, entry)
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
const backingDelete = <K, A, E>(map: BackingMap<K, A, E>, key: K): void => {
|
|
129
|
+
if (map._tag === "Equal") {
|
|
130
|
+
MutableHashMap.remove(map.map, key)
|
|
131
|
+
} else {
|
|
132
|
+
map.map.delete(key)
|
|
133
|
+
}
|
|
134
|
+
}
|
|
@@ -80,15 +80,15 @@ export const decode = <IE, Done>(): Channel.Channel<
|
|
|
80
80
|
* @since 4.0.0
|
|
81
81
|
*/
|
|
82
82
|
export interface EventCodec extends
|
|
83
|
-
Schema.
|
|
83
|
+
Schema.ConstraintCodec<
|
|
84
84
|
any,
|
|
85
85
|
{
|
|
86
86
|
readonly id?: string | undefined
|
|
87
87
|
readonly event?: string | undefined
|
|
88
88
|
readonly data: string
|
|
89
89
|
},
|
|
90
|
-
|
|
91
|
-
|
|
90
|
+
unknown,
|
|
91
|
+
unknown
|
|
92
92
|
>
|
|
93
93
|
{}
|
|
94
94
|
|
|
@@ -854,9 +854,10 @@ const make = Effect.gen(function*() {
|
|
|
854
854
|
Effect.scoped,
|
|
855
855
|
Effect.catchCause(Effect.logError),
|
|
856
856
|
Effect.repeat(
|
|
857
|
-
Schedule.
|
|
858
|
-
Schedule.
|
|
859
|
-
|
|
857
|
+
Schedule.min([
|
|
858
|
+
Schedule.exponential(200, 1.5),
|
|
859
|
+
Schedule.spaced({ seconds: 10 })
|
|
860
|
+
])
|
|
860
861
|
),
|
|
861
862
|
Effect.annotateLogs({
|
|
862
863
|
service: "EventLog",
|