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
package/src/LayerRef.ts
ADDED
|
@@ -0,0 +1,379 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates refreshable references to a single layer-built service context.
|
|
3
|
+
*
|
|
4
|
+
* A `LayerRef<I, E>` builds one `Layer` into a cached `Context<I>`, exposes it
|
|
5
|
+
* back as a layer or scoped effect, and supports invalidation so later users can
|
|
6
|
+
* acquire a fresh context.
|
|
7
|
+
*
|
|
8
|
+
* @since 4.0.0
|
|
9
|
+
*/
|
|
10
|
+
import * as Context from "./Context.ts"
|
|
11
|
+
import type * as Duration from "./Duration.ts"
|
|
12
|
+
import * as Effect from "./Effect.ts"
|
|
13
|
+
import { identity } from "./Function.ts"
|
|
14
|
+
import { getStackTraceLimit, setStackTraceLimit } from "./internal/stackTraceLimit.ts"
|
|
15
|
+
import * as Layer from "./Layer.ts"
|
|
16
|
+
import * as RcRef from "./RcRef.ts"
|
|
17
|
+
import type * as Schedule from "./Schedule.ts"
|
|
18
|
+
import * as Scope from "./Scope.ts"
|
|
19
|
+
import type { Mutable } from "./Types.ts"
|
|
20
|
+
|
|
21
|
+
const TypeId = "~effect/LayerRef"
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* A refreshable reference to a single layer-built service context.
|
|
25
|
+
*
|
|
26
|
+
* **When to use**
|
|
27
|
+
*
|
|
28
|
+
* Use when you want to share one scoped layer resource across many users while
|
|
29
|
+
* retaining the ability to invalidate it and rebuild it later.
|
|
30
|
+
*
|
|
31
|
+
* **Details**
|
|
32
|
+
*
|
|
33
|
+
* A `LayerRef` is the unkeyed counterpart to a layer cache: it lazily builds the
|
|
34
|
+
* layer on first use, reuses the resulting context while it is borrowed or kept
|
|
35
|
+
* idle, and can invalidate the cached context so the next use rebuilds it.
|
|
36
|
+
*
|
|
37
|
+
* @see {@link make} for constructing a `LayerRef` from a layer
|
|
38
|
+
* @see {@link Service} for defining a `LayerRef` as a service class
|
|
39
|
+
*
|
|
40
|
+
* @category models
|
|
41
|
+
* @since 4.0.0
|
|
42
|
+
*/
|
|
43
|
+
export interface LayerRef<in out I, in out E = never> {
|
|
44
|
+
readonly [TypeId]: typeof TypeId
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* The underlying reference-counted cache that stores the built context.
|
|
48
|
+
*/
|
|
49
|
+
readonly rcRef: RcRef.RcRef<Context.Context<I>, E>
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Layer that provides the currently cached context, acquiring it if needed.
|
|
53
|
+
*/
|
|
54
|
+
readonly get: Layer.Layer<I, E>
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Scoped effect that retrieves the currently cached context, acquiring it if needed.
|
|
58
|
+
*/
|
|
59
|
+
readonly contextEffect: Effect.Effect<Context.Context<I>, E, Scope.Scope>
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Invalidates the cached context so the next use rebuilds the layer.
|
|
63
|
+
*/
|
|
64
|
+
readonly invalidate: Effect.Effect<void>
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Invalidates the cached context so the next use rebuilds the layer, and
|
|
68
|
+
* reacquires it.
|
|
69
|
+
*/
|
|
70
|
+
readonly refresh: Effect.Effect<void, E>
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Creates a `LayerRef` from a `Layer`.
|
|
75
|
+
*
|
|
76
|
+
* **When to use**
|
|
77
|
+
*
|
|
78
|
+
* Use when you have one layer-built resource that should be shared, optionally
|
|
79
|
+
* kept alive while idle, and refreshed on demand.
|
|
80
|
+
*
|
|
81
|
+
* **Details**
|
|
82
|
+
*
|
|
83
|
+
* The layer is built lazily on first use unless `preload` is `true`.
|
|
84
|
+
* `idleTimeToLive` keeps the context cached after it stops being used, and
|
|
85
|
+
* `invalidationSchedule` can periodically invalidate it. When `preload` is
|
|
86
|
+
* `true`, scheduled invalidation also reacquires the context.
|
|
87
|
+
*
|
|
88
|
+
* **Gotchas**
|
|
89
|
+
*
|
|
90
|
+
* Invalidation does not revoke contexts already borrowed by active scopes; those
|
|
91
|
+
* contexts remain usable until their scopes close.
|
|
92
|
+
*
|
|
93
|
+
* **Example** (Sharing one layer-built service)
|
|
94
|
+
*
|
|
95
|
+
* ```ts
|
|
96
|
+
* import { Context, Effect, Layer } from "effect"
|
|
97
|
+
* import { make } from "effect/LayerRef"
|
|
98
|
+
*
|
|
99
|
+
* class Database extends Context.Service<Database, {
|
|
100
|
+
* readonly query: Effect.Effect<string>
|
|
101
|
+
* }>()("Database") {}
|
|
102
|
+
*
|
|
103
|
+
* const databaseLayer = Layer.succeed(Database, {
|
|
104
|
+
* query: Effect.succeed("result")
|
|
105
|
+
* })
|
|
106
|
+
*
|
|
107
|
+
* const query = Effect.gen(function*() {
|
|
108
|
+
* const database = yield* Database
|
|
109
|
+
* return yield* database.query
|
|
110
|
+
* })
|
|
111
|
+
*
|
|
112
|
+
* const program = Effect.scoped(
|
|
113
|
+
* Effect.gen(function*() {
|
|
114
|
+
* const ref = yield* make(databaseLayer, {
|
|
115
|
+
* idleTimeToLive: "5 seconds"
|
|
116
|
+
* })
|
|
117
|
+
*
|
|
118
|
+
* const result = yield* Effect.provide(query, ref.get)
|
|
119
|
+
*
|
|
120
|
+
* yield* ref.invalidate
|
|
121
|
+
*
|
|
122
|
+
* return result
|
|
123
|
+
* })
|
|
124
|
+
* )
|
|
125
|
+
* ```
|
|
126
|
+
*
|
|
127
|
+
* @see {@link Service} for defining a reusable service class around a `LayerRef`
|
|
128
|
+
*
|
|
129
|
+
* @category constructors
|
|
130
|
+
* @since 4.0.0
|
|
131
|
+
*/
|
|
132
|
+
export const make = Effect.fnUntraced(
|
|
133
|
+
function*<I, E, R, X, const Preload extends boolean = never, SE = never, SR = never>(
|
|
134
|
+
layer: Layer.Layer<I, E, R>,
|
|
135
|
+
options?: {
|
|
136
|
+
/**
|
|
137
|
+
* Duration to keep the resource alive after it is no longer used.
|
|
138
|
+
*/
|
|
139
|
+
readonly idleTimeToLive?: Duration.Input | undefined
|
|
140
|
+
/**
|
|
141
|
+
* Whether to acquire the resource during creation.
|
|
142
|
+
*/
|
|
143
|
+
readonly preload?: Preload | undefined
|
|
144
|
+
/**
|
|
145
|
+
* Schedule used to invalidate the cached resource. When `preload` is
|
|
146
|
+
* `true`, each scheduled invalidation also reacquires the resource.
|
|
147
|
+
*/
|
|
148
|
+
readonly invalidationSchedule?: Schedule.Schedule<X, unknown, SE, SR> | undefined
|
|
149
|
+
} | undefined
|
|
150
|
+
): Effect.fn.Return<
|
|
151
|
+
LayerRef<I, E>,
|
|
152
|
+
[Preload] extends [true] ? E : never,
|
|
153
|
+
Scope.Scope | R | SR
|
|
154
|
+
> {
|
|
155
|
+
const context = yield* Effect.context<never>()
|
|
156
|
+
const memoMap = Layer.CurrentMemoMap.forkOrCreate(context)
|
|
157
|
+
|
|
158
|
+
const rcRef = yield* RcRef.make({
|
|
159
|
+
acquire: Effect.contextWith((_: Context.Context<Scope.Scope>) =>
|
|
160
|
+
Layer.buildWithMemoMap(layer, memoMap, Context.get(_, Scope.Scope))
|
|
161
|
+
),
|
|
162
|
+
idleTimeToLive: options?.idleTimeToLive
|
|
163
|
+
})
|
|
164
|
+
|
|
165
|
+
const refresh = RcRef.invalidate(rcRef).pipe(
|
|
166
|
+
Effect.andThen(Effect.scoped(RcRef.get(rcRef))),
|
|
167
|
+
Effect.asVoid
|
|
168
|
+
)
|
|
169
|
+
|
|
170
|
+
if (options?.preload) {
|
|
171
|
+
yield* refresh as Effect.Effect<void>
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
if (options?.invalidationSchedule) {
|
|
175
|
+
const onRefresh = options.preload ? refresh : RcRef.invalidate(rcRef)
|
|
176
|
+
yield* onRefresh.pipe(
|
|
177
|
+
Effect.ignoreCause,
|
|
178
|
+
Effect.schedule(options.invalidationSchedule),
|
|
179
|
+
Effect.forkScoped
|
|
180
|
+
)
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
return identity<LayerRef<I, any>>({
|
|
184
|
+
[TypeId]: TypeId,
|
|
185
|
+
rcRef,
|
|
186
|
+
get: Layer.effectContext(RcRef.get(rcRef)),
|
|
187
|
+
contextEffect: RcRef.get(rcRef),
|
|
188
|
+
invalidate: RcRef.invalidate(rcRef),
|
|
189
|
+
refresh
|
|
190
|
+
})
|
|
191
|
+
}
|
|
192
|
+
)
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Service class shape produced by `LayerRef.Service`.
|
|
196
|
+
*
|
|
197
|
+
* **When to use**
|
|
198
|
+
*
|
|
199
|
+
* Use as the public type for classes returned by `LayerRef.Service` when an API
|
|
200
|
+
* needs to accept, return, or alias the generated service class and its static
|
|
201
|
+
* helpers.
|
|
202
|
+
*
|
|
203
|
+
* **Details**
|
|
204
|
+
*
|
|
205
|
+
* It combines a `Context.Service` tag for the `LayerRef` with default layers and
|
|
206
|
+
* helper accessors for retrieving, using, and invalidating the cached resource.
|
|
207
|
+
*
|
|
208
|
+
* @see {@link Service} for creating concrete `LayerRef` service classes
|
|
209
|
+
*
|
|
210
|
+
* @category services
|
|
211
|
+
* @since 4.0.0
|
|
212
|
+
*/
|
|
213
|
+
export interface TagClass<
|
|
214
|
+
in out Self,
|
|
215
|
+
in out Id extends string,
|
|
216
|
+
in out I,
|
|
217
|
+
in out E,
|
|
218
|
+
in out R,
|
|
219
|
+
in out LE,
|
|
220
|
+
in out Deps extends Layer.Layer<any, any, any>
|
|
221
|
+
> extends Context.ServiceClass<Self, Id, LayerRef<I, E>> {
|
|
222
|
+
/**
|
|
223
|
+
* Default layer for the `LayerRef` service, with dependencies applied.
|
|
224
|
+
*/
|
|
225
|
+
readonly layer: Layer.Layer<
|
|
226
|
+
Self,
|
|
227
|
+
(Deps extends Layer.Layer<infer _A, infer _E, infer _R> ? _E : never) | LE,
|
|
228
|
+
| Exclude<R, (Deps extends Layer.Layer<infer _A, infer _E, infer _R> ? _A : never)>
|
|
229
|
+
| (Deps extends Layer.Layer<infer _A, infer _E, infer _R> ? _R : never)
|
|
230
|
+
>
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Default layer for the `LayerRef` service without provided dependencies.
|
|
234
|
+
*/
|
|
235
|
+
readonly layerNoDeps: Layer.Layer<Self, LE, R>
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* Layer that provides the currently cached context, requiring this service.
|
|
239
|
+
*/
|
|
240
|
+
readonly get: Layer.Layer<I, E, Self>
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* Scoped effect that retrieves the currently cached context through this service.
|
|
244
|
+
*/
|
|
245
|
+
readonly contextEffect: Effect.Effect<Context.Context<I>, E, Scope.Scope | Self>
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* Invalidates the cached context through this service.
|
|
249
|
+
*/
|
|
250
|
+
readonly invalidate: Effect.Effect<void, never, Self>
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* Invalidates the cached context through this service, and reacquires it.
|
|
254
|
+
*/
|
|
255
|
+
readonly refresh: Effect.Effect<void, E, Self>
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Creates a service class for a `LayerRef`.
|
|
260
|
+
*
|
|
261
|
+
* **When to use**
|
|
262
|
+
*
|
|
263
|
+
* Use when you want to name a shared layer reference as an application service
|
|
264
|
+
* and expose static helpers for providing, retrieving, and invalidating it.
|
|
265
|
+
*
|
|
266
|
+
* **Details**
|
|
267
|
+
*
|
|
268
|
+
* The returned class is a `Context.Service` whose value is a `LayerRef`. It also
|
|
269
|
+
* includes `.layer`, `.layerNoDeps`, `.get`, `.contextEffect`, and `.invalidate`
|
|
270
|
+
* helpers so callers do not need to access the `LayerRef` value directly.
|
|
271
|
+
*
|
|
272
|
+
* **Example** (Defining a refreshable service)
|
|
273
|
+
*
|
|
274
|
+
* ```ts
|
|
275
|
+
* import { Context, Effect, Layer } from "effect"
|
|
276
|
+
* import { Service } from "effect/LayerRef"
|
|
277
|
+
*
|
|
278
|
+
* class Database extends Context.Service<Database, {
|
|
279
|
+
* readonly query: Effect.Effect<string>
|
|
280
|
+
* }>()("Database") {}
|
|
281
|
+
*
|
|
282
|
+
* const databaseLayer = Layer.succeed(Database, {
|
|
283
|
+
* query: Effect.succeed("result")
|
|
284
|
+
* })
|
|
285
|
+
*
|
|
286
|
+
* class DatabaseRef extends Service<DatabaseRef>()("DatabaseRef", {
|
|
287
|
+
* layer: databaseLayer,
|
|
288
|
+
* preload: true
|
|
289
|
+
* }) {}
|
|
290
|
+
*
|
|
291
|
+
* const program = Effect.gen(function*() {
|
|
292
|
+
* const database = yield* Database
|
|
293
|
+
* return yield* database.query
|
|
294
|
+
* }).pipe(
|
|
295
|
+
* Effect.provide(DatabaseRef.get),
|
|
296
|
+
* Effect.provide(DatabaseRef.layer)
|
|
297
|
+
* )
|
|
298
|
+
* ```
|
|
299
|
+
*
|
|
300
|
+
* @see {@link make} for creating a `LayerRef` value without defining a service class
|
|
301
|
+
*
|
|
302
|
+
* @category services
|
|
303
|
+
* @since 4.0.0
|
|
304
|
+
*/
|
|
305
|
+
export const Service = <Self>() =>
|
|
306
|
+
<
|
|
307
|
+
const Id extends string,
|
|
308
|
+
I,
|
|
309
|
+
E,
|
|
310
|
+
R,
|
|
311
|
+
X,
|
|
312
|
+
const Deps extends ReadonlyArray<Layer.Layer<any, any, any>> = [],
|
|
313
|
+
const Preload extends boolean = never,
|
|
314
|
+
SE = never,
|
|
315
|
+
SR = never
|
|
316
|
+
>(
|
|
317
|
+
id: Id,
|
|
318
|
+
options: {
|
|
319
|
+
/**
|
|
320
|
+
* Layer used to build the cached context.
|
|
321
|
+
*/
|
|
322
|
+
readonly layer: Layer.Layer<I, E, R>
|
|
323
|
+
/**
|
|
324
|
+
* Layers used to satisfy dependencies of the `LayerRef` service layer.
|
|
325
|
+
*/
|
|
326
|
+
readonly dependencies?: Deps | undefined
|
|
327
|
+
/**
|
|
328
|
+
* Duration to keep the resource alive after it is no longer used.
|
|
329
|
+
*/
|
|
330
|
+
readonly idleTimeToLive?: Duration.Input | undefined
|
|
331
|
+
/**
|
|
332
|
+
* Whether to acquire the resource during creation.
|
|
333
|
+
*/
|
|
334
|
+
readonly preload?: Preload | undefined
|
|
335
|
+
/**
|
|
336
|
+
* Schedule used to invalidate the cached resource. When `preload` is
|
|
337
|
+
* `true`, each scheduled invalidation also reacquires the resource.
|
|
338
|
+
*/
|
|
339
|
+
readonly invalidationSchedule?: Schedule.Schedule<X, unknown, SE, SR> | undefined
|
|
340
|
+
}
|
|
341
|
+
): TagClass<
|
|
342
|
+
Self,
|
|
343
|
+
Id,
|
|
344
|
+
I,
|
|
345
|
+
E,
|
|
346
|
+
R | SR,
|
|
347
|
+
[Preload] extends [true] ? E : never,
|
|
348
|
+
Deps[number]
|
|
349
|
+
> => {
|
|
350
|
+
const Err = globalThis.Error as any
|
|
351
|
+
const limit = getStackTraceLimit()
|
|
352
|
+
setStackTraceLimit(2)
|
|
353
|
+
const creationError = new Err()
|
|
354
|
+
setStackTraceLimit(limit)
|
|
355
|
+
|
|
356
|
+
function TagClass() {}
|
|
357
|
+
const TagClass_ = TagClass as any as Mutable<TagClass<Self, Id, any, any, any, any, any>>
|
|
358
|
+
Object.setPrototypeOf(TagClass, Object.getPrototypeOf(Context.Service<Self, any>(id)))
|
|
359
|
+
TagClass.key = id
|
|
360
|
+
Object.defineProperty(TagClass, "stack", {
|
|
361
|
+
get() {
|
|
362
|
+
return creationError.stack
|
|
363
|
+
}
|
|
364
|
+
})
|
|
365
|
+
|
|
366
|
+
TagClass_.layerNoDeps = Layer.effect(TagClass_)(
|
|
367
|
+
make(options.layer, options)
|
|
368
|
+
)
|
|
369
|
+
TagClass_.layer = options.dependencies && options.dependencies.length > 0 ?
|
|
370
|
+
Layer.provide(TagClass_.layerNoDeps, options.dependencies as any) :
|
|
371
|
+
TagClass_.layerNoDeps
|
|
372
|
+
|
|
373
|
+
TagClass_.get = Layer.unwrap(TagClass_.useSync((ref) => ref.get))
|
|
374
|
+
TagClass_.contextEffect = TagClass_.use((ref) => ref.contextEffect)
|
|
375
|
+
TagClass_.invalidate = TagClass_.use((ref) => ref.invalidate)
|
|
376
|
+
TagClass_.refresh = TagClass_.use((ref) => ref.refresh)
|
|
377
|
+
|
|
378
|
+
return TagClass as any
|
|
379
|
+
}
|