effect 4.0.0-beta.103 → 4.0.0-beta.104
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/Cache.js +1 -1
- package/dist/Cache.js.map +1 -1
- package/dist/Channel.d.ts +1 -1
- package/dist/Channel.d.ts.map +1 -1
- package/dist/Channel.js.map +1 -1
- package/dist/Config.d.ts.map +1 -1
- package/dist/Config.js +28 -7
- package/dist/Config.js.map +1 -1
- package/dist/ConfigProvider.d.ts.map +1 -1
- package/dist/ConfigProvider.js +2 -1
- package/dist/ConfigProvider.js.map +1 -1
- package/dist/Context.d.ts +2 -2
- package/dist/Context.d.ts.map +1 -1
- package/dist/Context.js.map +1 -1
- package/dist/Crypto.d.ts.map +1 -1
- package/dist/Crypto.js +13 -5
- package/dist/Crypto.js.map +1 -1
- package/dist/Duration.d.ts.map +1 -1
- package/dist/Duration.js +12 -1
- package/dist/Duration.js.map +1 -1
- package/dist/Effect.d.ts +132 -14
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +38 -0
- package/dist/Effect.js.map +1 -1
- package/dist/Equal.d.ts.map +1 -1
- package/dist/Equal.js +10 -2
- package/dist/Equal.js.map +1 -1
- package/dist/ExecutionPlan.d.ts +73 -0
- package/dist/ExecutionPlan.d.ts.map +1 -1
- package/dist/ExecutionPlan.js +1 -1
- package/dist/ExecutionPlan.js.map +1 -1
- package/dist/FiberSet.js +1 -1
- package/dist/FileSystem.d.ts +2 -2
- package/dist/Function.d.ts +4 -3
- package/dist/Function.d.ts.map +1 -1
- package/dist/Function.js +5 -5
- package/dist/Function.js.map +1 -1
- package/dist/Iterable.d.ts.map +1 -1
- package/dist/Iterable.js +11 -10
- package/dist/Iterable.js.map +1 -1
- package/dist/Layer.d.ts.map +1 -1
- package/dist/Layer.js +7 -5
- package/dist/Layer.js.map +1 -1
- package/dist/Schedule.d.ts +8 -8
- package/dist/Schedule.d.ts.map +1 -1
- package/dist/Schedule.js +4 -4
- package/dist/Schedule.js.map +1 -1
- package/dist/Schema.d.ts +32 -32
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +23 -18
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaAST.d.ts +3 -3
- package/dist/SchemaAST.d.ts.map +1 -1
- package/dist/SchemaAST.js +47 -31
- package/dist/SchemaAST.js.map +1 -1
- package/dist/SchemaParser.d.ts.map +1 -1
- package/dist/SchemaParser.js +35 -53
- package/dist/SchemaParser.js.map +1 -1
- package/dist/ScopedCache.js +1 -1
- package/dist/ScopedCache.js.map +1 -1
- package/dist/Sink.d.ts +1 -1
- package/dist/Sink.d.ts.map +1 -1
- package/dist/Stream.d.ts +27 -4
- package/dist/Stream.d.ts.map +1 -1
- package/dist/Stream.js +27 -2
- package/dist/Stream.js.map +1 -1
- package/dist/SynchronizedRef.js +1 -1
- package/dist/SynchronizedRef.js.map +1 -1
- package/dist/Terminal.js +1 -1
- package/dist/Terminal.js.map +1 -1
- package/dist/Tuple.d.ts +6 -4
- package/dist/Tuple.d.ts.map +1 -1
- package/dist/Tuple.js.map +1 -1
- package/dist/TxReentrantLock.d.ts +0 -56
- package/dist/TxReentrantLock.d.ts.map +1 -1
- package/dist/TxReentrantLock.js +8 -8
- package/dist/TxReentrantLock.js.map +1 -1
- package/dist/internal/dateTime.js +1 -1
- package/dist/internal/dateTime.js.map +1 -1
- package/dist/internal/executionPlan.js +51 -3
- package/dist/internal/executionPlan.js.map +1 -1
- package/dist/internal/hashMap.js +12 -8
- package/dist/internal/hashMap.js.map +1 -1
- package/dist/internal/matcher.js +1 -1
- package/dist/internal/matcher.js.map +1 -1
- package/dist/internal/schedule.js.map +1 -1
- package/dist/internal/schema/annotations.js +2 -0
- package/dist/internal/schema/annotations.js.map +1 -1
- package/dist/internal/schema/toArbitrary.js +1 -1
- package/dist/internal/schema/toArbitrary.js.map +1 -1
- package/dist/internal/trie.js +13 -3
- package/dist/internal/trie.js.map +1 -1
- package/dist/testing/TestClock.d.ts.map +1 -1
- package/dist/testing/TestClock.js +11 -1
- package/dist/testing/TestClock.js.map +1 -1
- package/dist/testing/TestSchema.d.ts +1 -1
- package/dist/testing/TestSchema.d.ts.map +1 -1
- package/dist/unstable/ai/AiError.js +19 -19
- package/dist/unstable/ai/AiError.js.map +1 -1
- package/dist/unstable/ai/Chat.js +1 -1
- package/dist/unstable/ai/Chat.js.map +1 -1
- package/dist/unstable/ai/LanguageModel.js +4 -2
- package/dist/unstable/ai/LanguageModel.js.map +1 -1
- package/dist/unstable/ai/McpSchema.d.ts +132 -132
- package/dist/unstable/ai/McpSchema.d.ts.map +1 -1
- package/dist/unstable/ai/McpSchema.js +8 -8
- package/dist/unstable/ai/McpSchema.js.map +1 -1
- package/dist/unstable/ai/McpServer.js +1 -1
- package/dist/unstable/ai/McpServer.js.map +1 -1
- package/dist/unstable/ai/Prompt.d.ts +15 -3
- package/dist/unstable/ai/Prompt.d.ts.map +1 -1
- package/dist/unstable/ai/Prompt.js +6 -3
- package/dist/unstable/ai/Prompt.js.map +1 -1
- package/dist/unstable/cli/CliError.d.ts +3 -3
- package/dist/unstable/cli/CliError.js +11 -11
- package/dist/unstable/cli/CliError.js.map +1 -1
- package/dist/unstable/cli/Command.d.ts +9 -9
- package/dist/unstable/cli/Command.d.ts.map +1 -1
- package/dist/unstable/cli/Command.js +8 -6
- package/dist/unstable/cli/Command.js.map +1 -1
- package/dist/unstable/cli/Param.d.ts +7 -5
- package/dist/unstable/cli/Param.d.ts.map +1 -1
- package/dist/unstable/cli/Param.js +15 -11
- 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 +31 -24
- 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 +31 -17
- package/dist/unstable/cli/Prompt.js.map +1 -1
- package/dist/unstable/cli/internal/ansi.js +2 -2
- package/dist/unstable/cli/internal/ansi.js.map +1 -1
- package/dist/unstable/cli/internal/command.d.ts +2 -2
- package/dist/unstable/cli/internal/command.d.ts.map +1 -1
- package/dist/unstable/cli/internal/command.js +10 -9
- package/dist/unstable/cli/internal/command.js.map +1 -1
- package/dist/unstable/cli/internal/completions/bash.js +69 -9
- package/dist/unstable/cli/internal/completions/bash.js.map +1 -1
- package/dist/unstable/cli/internal/completions/descriptor.js +24 -18
- package/dist/unstable/cli/internal/completions/descriptor.js.map +1 -1
- package/dist/unstable/cli/internal/completions/fish.js +5 -5
- package/dist/unstable/cli/internal/completions/fish.js.map +1 -1
- package/dist/unstable/cli/internal/help.d.ts.map +1 -1
- package/dist/unstable/cli/internal/help.js +4 -2
- package/dist/unstable/cli/internal/help.js.map +1 -1
- package/dist/unstable/cli/internal/parser.js +3 -3
- package/dist/unstable/cli/internal/parser.js.map +1 -1
- package/dist/unstable/cli/internal/wizard.js +2 -2
- package/dist/unstable/cli/internal/wizard.js.map +1 -1
- package/dist/unstable/cluster/ClusterError.js +7 -7
- package/dist/unstable/cluster/ClusterError.js.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.js +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.js.map +1 -1
- package/dist/unstable/cluster/MessageStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/MessageStorage.js +8 -1
- package/dist/unstable/cluster/MessageStorage.js.map +1 -1
- package/dist/unstable/cluster/Reply.d.ts +8 -0
- package/dist/unstable/cluster/Reply.d.ts.map +1 -1
- package/dist/unstable/cluster/Reply.js +12 -0
- package/dist/unstable/cluster/Reply.js.map +1 -1
- package/dist/unstable/cluster/RunnerServer.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerServer.js +4 -2
- package/dist/unstable/cluster/RunnerServer.js.map +1 -1
- package/dist/unstable/cluster/RunnerStorage.d.ts +1 -2
- package/dist/unstable/cluster/RunnerStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerStorage.js +7 -6
- package/dist/unstable/cluster/RunnerStorage.js.map +1 -1
- package/dist/unstable/cluster/Sharding.d.ts.map +1 -1
- package/dist/unstable/cluster/Sharding.js +22 -4
- package/dist/unstable/cluster/Sharding.js.map +1 -1
- package/dist/unstable/cluster/internal/entityManager.js +1 -1
- package/dist/unstable/cluster/internal/entityManager.js.map +1 -1
- package/dist/unstable/cluster/internal/resourceMap.js +2 -2
- package/dist/unstable/cluster/internal/resourceMap.js.map +1 -1
- package/dist/unstable/cluster/internal/resourceRef.js +17 -0
- package/dist/unstable/cluster/internal/resourceRef.js.map +1 -1
- package/dist/unstable/devtools/DevToolsClient.d.ts.map +1 -1
- package/dist/unstable/devtools/DevToolsClient.js +7 -2
- package/dist/unstable/devtools/DevToolsClient.js.map +1 -1
- package/dist/unstable/encoding/Ini.d.ts +20 -0
- package/dist/unstable/encoding/Ini.d.ts.map +1 -0
- package/dist/unstable/encoding/Ini.js +153 -0
- package/dist/unstable/encoding/Ini.js.map +1 -0
- package/dist/unstable/encoding/Msgpack.d.ts +2 -1
- package/dist/unstable/encoding/Msgpack.d.ts.map +1 -1
- package/dist/unstable/encoding/Msgpack.js +21 -7
- package/dist/unstable/encoding/Msgpack.js.map +1 -1
- package/dist/unstable/encoding/Ndjson.d.ts.map +1 -1
- package/dist/unstable/encoding/Ndjson.js +7 -1
- package/dist/unstable/encoding/Ndjson.js.map +1 -1
- package/dist/unstable/encoding/Sse.d.ts.map +1 -1
- package/dist/unstable/encoding/Sse.js +14 -23
- package/dist/unstable/encoding/Sse.js.map +1 -1
- package/dist/unstable/encoding/Toml.d.ts +19 -0
- package/dist/unstable/encoding/Toml.d.ts.map +1 -0
- package/dist/unstable/encoding/Toml.js +434 -0
- package/dist/unstable/encoding/Toml.js.map +1 -0
- package/dist/unstable/encoding/Yaml.d.ts +19 -0
- package/dist/unstable/encoding/Yaml.d.ts.map +1 -0
- package/dist/unstable/encoding/Yaml.js +461 -0
- package/dist/unstable/encoding/Yaml.js.map +1 -0
- package/dist/unstable/encoding/index.d.ts +12 -0
- package/dist/unstable/encoding/index.d.ts.map +1 -1
- package/dist/unstable/encoding/index.js +12 -0
- package/dist/unstable/encoding/index.js.map +1 -1
- package/dist/unstable/eventlog/EventJournal.d.ts +1 -1
- package/dist/unstable/eventlog/EventJournal.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventJournal.js +13 -5
- package/dist/unstable/eventlog/EventJournal.js.map +1 -1
- package/dist/unstable/eventlog/EventLogMessage.js +1 -1
- package/dist/unstable/eventlog/EventLogMessage.js.map +1 -1
- package/dist/unstable/eventlog/EventLogServerUnencrypted.js +1 -1
- package/dist/unstable/eventlog/EventLogServerUnencrypted.js.map +1 -1
- package/dist/unstable/eventlog/SqlEventJournal.d.ts.map +1 -1
- package/dist/unstable/eventlog/SqlEventJournal.js +1 -4
- package/dist/unstable/eventlog/SqlEventJournal.js.map +1 -1
- package/dist/unstable/http/FindMyWay/internal/queryString.d.ts +11 -0
- package/dist/unstable/http/FindMyWay/internal/queryString.d.ts.map +1 -0
- package/dist/unstable/http/FindMyWay/internal/queryString.js +259 -0
- package/dist/unstable/http/FindMyWay/internal/queryString.js.map +1 -0
- package/dist/unstable/http/FindMyWay/internal/router.d.ts +2 -0
- package/dist/unstable/http/FindMyWay/internal/router.d.ts.map +1 -0
- package/dist/unstable/http/FindMyWay/internal/router.js +665 -0
- package/dist/unstable/http/FindMyWay/internal/router.js.map +1 -0
- package/dist/unstable/http/FindMyWay.d.ts +33 -8
- package/dist/unstable/http/FindMyWay.d.ts.map +1 -1
- package/dist/unstable/http/FindMyWay.js +4 -7
- package/dist/unstable/http/FindMyWay.js.map +1 -1
- package/dist/unstable/http/HttpClientError.js +1 -1
- package/dist/unstable/http/HttpClientError.js.map +1 -1
- package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientRequest.js +2 -14
- package/dist/unstable/http/HttpClientRequest.js.map +1 -1
- package/dist/unstable/http/HttpClientResponse.js +1 -16
- package/dist/unstable/http/HttpClientResponse.js.map +1 -1
- package/dist/unstable/http/HttpPlatform.d.ts.map +1 -1
- package/dist/unstable/http/HttpPlatform.js +21 -3
- package/dist/unstable/http/HttpPlatform.js.map +1 -1
- package/dist/unstable/http/HttpServerRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerRequest.js +7 -6
- package/dist/unstable/http/HttpServerRequest.js.map +1 -1
- package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerResponse.js +8 -6
- package/dist/unstable/http/HttpServerResponse.js.map +1 -1
- package/dist/unstable/http/Multipart.d.ts +1 -1
- package/dist/unstable/http/Multipart.d.ts.map +1 -1
- package/dist/unstable/http/Multipart.js +9 -2
- package/dist/unstable/http/Multipart.js.map +1 -1
- package/dist/unstable/http/MultipartParser/HeadersParser.d.ts +53 -0
- package/dist/unstable/http/MultipartParser/HeadersParser.d.ts.map +1 -0
- package/dist/unstable/http/MultipartParser/HeadersParser.js +14 -0
- package/dist/unstable/http/MultipartParser/HeadersParser.js.map +1 -0
- package/dist/unstable/http/MultipartParser/Search.d.ts +11 -0
- package/dist/unstable/http/MultipartParser/Search.d.ts.map +1 -0
- package/dist/unstable/http/MultipartParser/Search.js +14 -0
- package/dist/unstable/http/MultipartParser/Search.js.map +1 -0
- package/dist/unstable/http/MultipartParser/internal/contentType.d.ts +5 -0
- package/dist/unstable/http/MultipartParser/internal/contentType.d.ts.map +1 -0
- package/dist/unstable/http/MultipartParser/internal/contentType.js +82 -0
- package/dist/unstable/http/MultipartParser/internal/contentType.js.map +1 -0
- package/dist/unstable/http/MultipartParser/internal/headers.d.ts +3 -0
- package/dist/unstable/http/MultipartParser/internal/headers.d.ts.map +1 -0
- package/dist/unstable/http/MultipartParser/internal/headers.js +194 -0
- package/dist/unstable/http/MultipartParser/internal/headers.js.map +1 -0
- package/dist/unstable/http/MultipartParser/internal/multipart.d.ts +8 -0
- package/dist/unstable/http/MultipartParser/internal/multipart.d.ts.map +1 -0
- package/dist/unstable/http/MultipartParser/internal/multipart.js +226 -0
- package/dist/unstable/http/MultipartParser/internal/multipart.js.map +1 -0
- package/dist/unstable/http/MultipartParser/internal/search.d.ts +5 -0
- package/dist/unstable/http/MultipartParser/internal/search.d.ts.map +1 -0
- package/dist/unstable/http/MultipartParser/internal/search.js +120 -0
- package/dist/unstable/http/MultipartParser/internal/search.js.map +1 -0
- package/dist/unstable/http/MultipartParser.d.ts +98 -0
- package/dist/unstable/http/MultipartParser.d.ts.map +1 -0
- package/dist/unstable/http/MultipartParser.js +23 -0
- package/dist/unstable/http/MultipartParser.js.map +1 -0
- package/dist/unstable/http/Template.d.ts.map +1 -1
- package/dist/unstable/http/Template.js +2 -2
- package/dist/unstable/http/Template.js.map +1 -1
- package/dist/unstable/http/index.d.ts +1 -1
- package/dist/unstable/http/index.d.ts.map +1 -1
- package/dist/unstable/http/index.js +1 -1
- package/dist/unstable/http/index.js.map +1 -1
- package/dist/unstable/http/internal/httpBody.d.ts +2 -0
- package/dist/unstable/http/internal/httpBody.d.ts.map +1 -0
- package/dist/unstable/http/internal/httpBody.js +10 -0
- package/dist/unstable/http/internal/httpBody.js.map +1 -0
- package/dist/unstable/httpapi/HttpApi.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApi.js +5 -5
- package/dist/unstable/httpapi/HttpApi.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.js +68 -15
- package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.d.ts +1 -1
- package/dist/unstable/httpapi/HttpApiClient.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.js +65 -25
- package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiEndpoint.d.ts +6 -4
- package/dist/unstable/httpapi/HttpApiEndpoint.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiEndpoint.js +73 -16
- package/dist/unstable/httpapi/HttpApiEndpoint.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiError.d.ts +5 -5
- package/dist/unstable/httpapi/HttpApiError.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiError.js +17 -17
- package/dist/unstable/httpapi/HttpApiError.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiMiddleware.d.ts +1 -1
- package/dist/unstable/httpapi/HttpApiMiddleware.js +1 -1
- package/dist/unstable/httpapi/HttpApiSchema.d.ts +219 -0
- package/dist/unstable/httpapi/HttpApiSchema.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiSchema.js +170 -0
- package/dist/unstable/httpapi/HttpApiSchema.js.map +1 -1
- package/dist/unstable/httpapi/OpenApi.d.ts +8 -0
- package/dist/unstable/httpapi/OpenApi.d.ts.map +1 -1
- package/dist/unstable/httpapi/OpenApi.js +45 -18
- package/dist/unstable/httpapi/OpenApi.js.map +1 -1
- package/dist/unstable/observability/OtlpExporter.d.ts +1 -1
- package/dist/unstable/observability/OtlpExporter.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpExporter.js +2 -1
- package/dist/unstable/observability/OtlpExporter.js.map +1 -1
- package/dist/unstable/observability/OtlpLogger.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpLogger.js +2 -2
- package/dist/unstable/observability/OtlpLogger.js.map +1 -1
- package/dist/unstable/observability/OtlpMetrics.d.ts +2 -2
- package/dist/unstable/observability/OtlpMetrics.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpMetrics.js +28 -15
- package/dist/unstable/observability/OtlpMetrics.js.map +1 -1
- package/dist/unstable/observability/OtlpTracer.js +1 -1
- package/dist/unstable/observability/OtlpTracer.js.map +1 -1
- package/dist/unstable/persistence/PersistedQueue.d.ts.map +1 -1
- package/dist/unstable/persistence/PersistedQueue.js +9 -9
- package/dist/unstable/persistence/PersistedQueue.js.map +1 -1
- package/dist/unstable/persistence/Persistence.d.ts.map +1 -1
- package/dist/unstable/persistence/Persistence.js +17 -7
- package/dist/unstable/persistence/Persistence.js.map +1 -1
- package/dist/unstable/persistence/RateLimiter.d.ts +22 -12
- package/dist/unstable/persistence/RateLimiter.d.ts.map +1 -1
- package/dist/unstable/persistence/RateLimiter.js +15 -42
- package/dist/unstable/persistence/RateLimiter.js.map +1 -1
- package/dist/unstable/persistence/Redis.js +1 -1
- package/dist/unstable/persistence/Redis.js.map +1 -1
- package/dist/unstable/rpc/RpcClient.d.ts +14 -0
- package/dist/unstable/rpc/RpcClient.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcClient.js +18 -9
- package/dist/unstable/rpc/RpcClient.js.map +1 -1
- package/dist/unstable/rpc/RpcClientError.js +2 -2
- package/dist/unstable/rpc/RpcClientError.js.map +1 -1
- package/dist/unstable/rpc/RpcSerialization.js +3 -1
- package/dist/unstable/rpc/RpcSerialization.js.map +1 -1
- package/dist/unstable/schema/Model.d.ts +1 -1
- package/dist/unstable/schema/Model.d.ts.map +1 -1
- package/dist/unstable/schema/VariantSchema.d.ts +5 -5
- package/dist/unstable/schema/VariantSchema.d.ts.map +1 -1
- package/dist/unstable/schema/VariantSchema.js +17 -9
- package/dist/unstable/schema/VariantSchema.js.map +1 -1
- package/dist/unstable/socket/Socket.d.ts.map +1 -1
- package/dist/unstable/socket/Socket.js +28 -12
- package/dist/unstable/socket/Socket.js.map +1 -1
- package/dist/unstable/sql/SqlClient.d.ts.map +1 -1
- package/dist/unstable/sql/SqlClient.js +7 -3
- package/dist/unstable/sql/SqlClient.js.map +1 -1
- package/dist/unstable/sql/SqlError.js +13 -13
- package/dist/unstable/sql/SqlError.js.map +1 -1
- package/dist/unstable/sql/SqlResolver.js +8 -6
- package/dist/unstable/sql/SqlResolver.js.map +1 -1
- package/dist/unstable/sql/Statement.d.ts.map +1 -1
- package/dist/unstable/sql/Statement.js +8 -6
- package/dist/unstable/sql/Statement.js.map +1 -1
- package/dist/unstable/workers/WorkerError.js +5 -5
- package/dist/unstable/workers/WorkerError.js.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.d.ts +1 -1
- package/dist/unstable/workflow/WorkflowEngine.d.ts.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.js +3 -3
- package/dist/unstable/workflow/WorkflowEngine.js.map +1 -1
- package/package.json +2 -8
- package/src/Cache.ts +1 -1
- package/src/Channel.ts +1 -1
- package/src/Config.ts +28 -7
- package/src/ConfigProvider.ts +4 -1
- package/src/Context.ts +5 -5
- package/src/Crypto.ts +17 -8
- package/src/Duration.ts +16 -2
- package/src/Effect.ts +141 -17
- package/src/Equal.ts +10 -2
- package/src/ExecutionPlan.ts +78 -1
- package/src/FiberSet.ts +1 -1
- package/src/FileSystem.ts +2 -2
- package/src/Function.ts +6 -6
- package/src/Iterable.ts +11 -10
- package/src/Layer.ts +7 -5
- package/src/Schedule.ts +13 -13
- package/src/Schema.ts +50 -41
- package/src/SchemaAST.ts +69 -37
- package/src/SchemaParser.ts +75 -69
- package/src/ScopedCache.ts +1 -1
- package/src/Sink.ts +1 -1
- package/src/Stream.ts +77 -10
- package/src/SynchronizedRef.ts +1 -1
- package/src/Terminal.ts +1 -1
- package/src/Tuple.ts +7 -4
- package/src/TxReentrantLock.ts +39 -35
- package/src/internal/dateTime.ts +1 -1
- package/src/internal/executionPlan.ts +105 -10
- package/src/internal/hashMap.ts +20 -14
- package/src/internal/matcher.ts +2 -2
- package/src/internal/schedule.ts +4 -4
- package/src/internal/schema/annotations.ts +3 -0
- package/src/internal/schema/toArbitrary.ts +3 -1
- package/src/internal/trie.ts +12 -2
- package/src/testing/TestClock.ts +13 -1
- package/src/testing/TestSchema.ts +1 -1
- package/src/unstable/ai/AiError.ts +19 -19
- package/src/unstable/ai/Chat.ts +1 -1
- package/src/unstable/ai/LanguageModel.ts +4 -2
- package/src/unstable/ai/McpSchema.ts +17 -16
- package/src/unstable/ai/McpServer.ts +1 -1
- package/src/unstable/ai/Prompt.ts +21 -6
- package/src/unstable/cli/CliError.ts +12 -12
- package/src/unstable/cli/Command.ts +12 -10
- package/src/unstable/cli/Param.ts +41 -19
- package/src/unstable/cli/Primitive.ts +11 -5
- package/src/unstable/cli/Prompt.ts +36 -20
- package/src/unstable/cli/internal/ansi.ts +2 -2
- package/src/unstable/cli/internal/command.ts +15 -10
- package/src/unstable/cli/internal/completions/bash.ts +59 -9
- package/src/unstable/cli/internal/completions/descriptor.ts +14 -20
- package/src/unstable/cli/internal/completions/fish.ts +5 -7
- package/src/unstable/cli/internal/help.ts +4 -2
- package/src/unstable/cli/internal/parser.ts +3 -3
- package/src/unstable/cli/internal/wizard.ts +2 -2
- package/src/unstable/cluster/ClusterError.ts +7 -7
- package/src/unstable/cluster/ClusterWorkflowEngine.ts +4 -1
- package/src/unstable/cluster/MessageStorage.ts +9 -5
- package/src/unstable/cluster/Reply.ts +21 -0
- package/src/unstable/cluster/RunnerServer.ts +4 -10
- package/src/unstable/cluster/RunnerStorage.ts +9 -7
- package/src/unstable/cluster/Sharding.ts +35 -7
- package/src/unstable/cluster/internal/entityManager.ts +1 -1
- package/src/unstable/cluster/internal/resourceMap.ts +5 -2
- package/src/unstable/cluster/internal/resourceRef.ts +27 -5
- package/src/unstable/devtools/DevToolsClient.ts +3 -2
- package/src/unstable/encoding/Ini.ts +174 -0
- package/src/unstable/encoding/Msgpack.ts +47 -28
- package/src/unstable/encoding/Ndjson.ts +9 -1
- package/src/unstable/encoding/Sse.ts +11 -21
- package/src/unstable/encoding/Toml.ts +504 -0
- package/src/unstable/encoding/Yaml.ts +541 -0
- package/src/unstable/encoding/index.ts +15 -0
- package/src/unstable/eventlog/EventJournal.ts +14 -6
- package/src/unstable/eventlog/EventLogMessage.ts +1 -1
- package/src/unstable/eventlog/EventLogServerUnencrypted.ts +1 -1
- package/src/unstable/eventlog/SqlEventJournal.ts +6 -4
- package/src/unstable/http/FindMyWay/internal/queryString.ts +420 -0
- package/src/unstable/http/FindMyWay/internal/router.ts +950 -0
- package/src/unstable/http/FindMyWay.ts +65 -6
- package/src/unstable/http/HttpClientError.ts +1 -1
- package/src/unstable/http/HttpClientRequest.ts +2 -14
- package/src/unstable/http/HttpClientResponse.ts +1 -17
- package/src/unstable/http/HttpPlatform.ts +34 -6
- package/src/unstable/http/HttpServerRequest.ts +14 -6
- package/src/unstable/http/HttpServerResponse.ts +9 -7
- package/src/unstable/http/Multipart.ts +9 -2
- package/src/unstable/http/MultipartParser/HeadersParser.ts +68 -0
- package/src/unstable/http/MultipartParser/Search.ts +17 -0
- package/src/unstable/http/MultipartParser/internal/contentType.ts +103 -0
- package/src/unstable/http/MultipartParser/internal/headers.ts +615 -0
- package/src/unstable/http/MultipartParser/internal/multipart.ts +262 -0
- package/src/unstable/http/MultipartParser/internal/search.ts +167 -0
- package/src/unstable/http/MultipartParser.ts +115 -0
- package/src/unstable/http/Template.ts +6 -5
- package/src/unstable/http/index.ts +1 -1
- package/src/unstable/http/internal/httpBody.ts +15 -0
- package/src/unstable/httpapi/HttpApi.ts +6 -7
- package/src/unstable/httpapi/HttpApiBuilder.ts +119 -21
- package/src/unstable/httpapi/HttpApiClient.ts +104 -41
- package/src/unstable/httpapi/HttpApiEndpoint.ts +117 -29
- package/src/unstable/httpapi/HttpApiError.ts +33 -39
- package/src/unstable/httpapi/HttpApiMiddleware.ts +1 -1
- package/src/unstable/httpapi/HttpApiSchema.ts +353 -0
- package/src/unstable/httpapi/OpenApi.ts +70 -20
- package/src/unstable/observability/OtlpExporter.ts +4 -2
- package/src/unstable/observability/OtlpLogger.ts +3 -1
- package/src/unstable/observability/OtlpMetrics.ts +32 -18
- package/src/unstable/observability/OtlpTracer.ts +1 -1
- package/src/unstable/persistence/PersistedQueue.ts +12 -9
- package/src/unstable/persistence/Persistence.ts +27 -7
- package/src/unstable/persistence/RateLimiter.ts +54 -31
- package/src/unstable/persistence/Redis.ts +1 -1
- package/src/unstable/rpc/RpcClient.ts +38 -12
- package/src/unstable/rpc/RpcClientError.ts +2 -2
- package/src/unstable/rpc/RpcSerialization.ts +1 -1
- package/src/unstable/schema/VariantSchema.ts +36 -18
- package/src/unstable/socket/Socket.ts +24 -14
- package/src/unstable/sql/SqlClient.ts +65 -56
- package/src/unstable/sql/SqlError.ts +13 -13
- package/src/unstable/sql/SqlResolver.ts +8 -6
- package/src/unstable/sql/Statement.ts +13 -8
- package/src/unstable/workers/WorkerError.ts +5 -5
- package/src/unstable/workflow/WorkflowEngine.ts +8 -3
- package/dist/unstable/http/Multipasta/HeadersParser.d.ts +0 -14
- package/dist/unstable/http/Multipasta/HeadersParser.d.ts.map +0 -1
- package/dist/unstable/http/Multipasta/HeadersParser.js +0 -14
- package/dist/unstable/http/Multipasta/HeadersParser.js.map +0 -1
- package/dist/unstable/http/Multipasta/Node.d.ts +0 -14
- package/dist/unstable/http/Multipasta/Node.d.ts.map +0 -1
- package/dist/unstable/http/Multipasta/Node.js +0 -14
- package/dist/unstable/http/Multipasta/Node.js.map +0 -1
- package/dist/unstable/http/Multipasta/Search.d.ts +0 -14
- package/dist/unstable/http/Multipasta/Search.d.ts.map +0 -1
- package/dist/unstable/http/Multipasta/Search.js +0 -14
- package/dist/unstable/http/Multipasta/Search.js.map +0 -1
- package/dist/unstable/http/Multipasta/Web.d.ts +0 -14
- package/dist/unstable/http/Multipasta/Web.d.ts.map +0 -1
- package/dist/unstable/http/Multipasta/Web.js +0 -14
- package/dist/unstable/http/Multipasta/Web.js.map +0 -1
- package/dist/unstable/http/Multipasta.d.ts +0 -15
- package/dist/unstable/http/Multipasta.d.ts.map +0 -1
- package/dist/unstable/http/Multipasta.js +0 -15
- package/dist/unstable/http/Multipasta.js.map +0 -1
- package/src/unstable/http/Multipasta/HeadersParser.ts +0 -14
- package/src/unstable/http/Multipasta/Node.ts +0 -14
- package/src/unstable/http/Multipasta/Search.ts +0 -14
- package/src/unstable/http/Multipasta/Web.ts +0 -14
- package/src/unstable/http/Multipasta.ts +0 -15
|
@@ -0,0 +1,665 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* MIT License
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2017-2019 Tomas Della Vedova
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
import * as QS from "./queryString.js";
|
|
25
|
+
const FULL_PATH_REGEXP = /^https?:\/\/.*?\//;
|
|
26
|
+
const OPTIONAL_PARAM_REGEXP = /(\/:[^/()]*?)\?(\/?)/;
|
|
27
|
+
/** @internal */
|
|
28
|
+
export const make = (options = {}) => new RouterImpl(options);
|
|
29
|
+
class RouterImpl {
|
|
30
|
+
constructor(options = {}) {
|
|
31
|
+
this.options = {
|
|
32
|
+
ignoreTrailingSlash: true,
|
|
33
|
+
ignoreDuplicateSlashes: true,
|
|
34
|
+
caseSensitive: false,
|
|
35
|
+
maxParamLength: 100,
|
|
36
|
+
...options
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
options;
|
|
40
|
+
routes = [];
|
|
41
|
+
trees = /*#__PURE__*/Object.create(null);
|
|
42
|
+
on(method, path, handler) {
|
|
43
|
+
const optionalParamMatch = path.match(OPTIONAL_PARAM_REGEXP);
|
|
44
|
+
if (optionalParamMatch && optionalParamMatch.index !== undefined) {
|
|
45
|
+
assert(path.length === optionalParamMatch.index + optionalParamMatch[0].length, "Optional Parameter needs to be the last parameter of the path");
|
|
46
|
+
const pathFull = path.replace(OPTIONAL_PARAM_REGEXP, "$1$2");
|
|
47
|
+
const pathOptional = path.replace(OPTIONAL_PARAM_REGEXP, "$2") || "/";
|
|
48
|
+
this.on(method, pathFull, handler);
|
|
49
|
+
this.on(method, pathOptional, handler);
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
if (this.options.ignoreDuplicateSlashes) {
|
|
53
|
+
path = removeDuplicateSlashes(path);
|
|
54
|
+
}
|
|
55
|
+
if (this.options.ignoreTrailingSlash) {
|
|
56
|
+
path = trimLastSlash(path);
|
|
57
|
+
}
|
|
58
|
+
const methods = typeof method === "string" ? [method] : method;
|
|
59
|
+
for (const method of methods) {
|
|
60
|
+
this._on(method, path, handler);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
all(path, handler) {
|
|
64
|
+
this.on(httpMethods, path, handler);
|
|
65
|
+
}
|
|
66
|
+
_on(method, path, handler) {
|
|
67
|
+
if (this.trees[method] === undefined) {
|
|
68
|
+
this.trees[method] = new StaticNode("/");
|
|
69
|
+
}
|
|
70
|
+
let pattern = path;
|
|
71
|
+
if (pattern === "*" && this.trees[method].prefix.length !== 0) {
|
|
72
|
+
const currentRoot = this.trees[method];
|
|
73
|
+
this.trees[method] = new StaticNode("");
|
|
74
|
+
this.trees[method].staticChildren["/"] = currentRoot;
|
|
75
|
+
}
|
|
76
|
+
let parentNodePathIndex = this.trees[method].prefix.length;
|
|
77
|
+
let currentNode = this.trees[method];
|
|
78
|
+
const params = [];
|
|
79
|
+
for (let i = 0; i <= pattern.length; i++) {
|
|
80
|
+
if (pattern.charCodeAt(i) === 58 && pattern.charCodeAt(i + 1) === 58) {
|
|
81
|
+
// It's a double colon
|
|
82
|
+
i++;
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
const isParametricNode = pattern.charCodeAt(i) === 58 && pattern.charCodeAt(i + 1) !== 58;
|
|
86
|
+
const isWildcardNode = pattern.charCodeAt(i) === 42;
|
|
87
|
+
if (isParametricNode || isWildcardNode || i === pattern.length && i !== parentNodePathIndex) {
|
|
88
|
+
let staticNodePath = pattern.slice(parentNodePathIndex, i);
|
|
89
|
+
if (!this.options.caseSensitive) {
|
|
90
|
+
staticNodePath = staticNodePath.toLowerCase();
|
|
91
|
+
}
|
|
92
|
+
staticNodePath = staticNodePath.split("::").join(":");
|
|
93
|
+
staticNodePath = staticNodePath.split("%").join("%25");
|
|
94
|
+
// add the static part of the route to the tree
|
|
95
|
+
currentNode = currentNode.createStaticChild(staticNodePath);
|
|
96
|
+
}
|
|
97
|
+
if (isParametricNode) {
|
|
98
|
+
let isRegexNode = false;
|
|
99
|
+
let isParamSafe = true;
|
|
100
|
+
let backtrack = "";
|
|
101
|
+
const regexps = [];
|
|
102
|
+
let nodePatternParts = "";
|
|
103
|
+
let lastParamStartIndex = i + 1;
|
|
104
|
+
for (let j = lastParamStartIndex;; j++) {
|
|
105
|
+
const charCode = pattern.charCodeAt(j);
|
|
106
|
+
const isRegexParam = charCode === 40;
|
|
107
|
+
const isStaticPart = charCode === 45 || charCode === 46;
|
|
108
|
+
const isEndOfNode = charCode === 47 || j === pattern.length;
|
|
109
|
+
if (isRegexParam || isStaticPart || isEndOfNode) {
|
|
110
|
+
const paramName = pattern.slice(lastParamStartIndex, j);
|
|
111
|
+
params.push(paramName);
|
|
112
|
+
isRegexNode = isRegexNode || isRegexParam || isStaticPart;
|
|
113
|
+
if (isRegexParam) {
|
|
114
|
+
const endOfRegexIndex = getClosingParenthensePosition(pattern, j);
|
|
115
|
+
const regexString = pattern.slice(j, endOfRegexIndex + 1);
|
|
116
|
+
regexps.push(trimRegExpStartAndEnd(regexString));
|
|
117
|
+
j = endOfRegexIndex + 1;
|
|
118
|
+
isParamSafe = true;
|
|
119
|
+
} else {
|
|
120
|
+
regexps.push(isParamSafe ? "(.*?)" : `(${backtrack}|(?:(?!${backtrack}).)*)`);
|
|
121
|
+
isParamSafe = false;
|
|
122
|
+
}
|
|
123
|
+
const staticPartStartIndex = j;
|
|
124
|
+
for (; j < pattern.length; j++) {
|
|
125
|
+
const charCode = pattern.charCodeAt(j);
|
|
126
|
+
if (charCode === 47) break;
|
|
127
|
+
if (charCode === 58) {
|
|
128
|
+
const nextCharCode = pattern.charCodeAt(j + 1);
|
|
129
|
+
if (nextCharCode === 58) j++;else break;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
let staticPart = pattern.slice(staticPartStartIndex, j);
|
|
133
|
+
if (staticPart) {
|
|
134
|
+
staticPart = staticPart.split("::").join(":");
|
|
135
|
+
staticPart = staticPart.split("%").join("%25");
|
|
136
|
+
regexps.push(backtrack = escapeRegExp(staticPart));
|
|
137
|
+
}
|
|
138
|
+
lastParamStartIndex = j + 1;
|
|
139
|
+
nodePatternParts += "()" + staticPart;
|
|
140
|
+
if (isEndOfNode || pattern.charCodeAt(j) === 47 || j === pattern.length) {
|
|
141
|
+
const nodePattern = isRegexNode ? nodePatternParts : staticPart;
|
|
142
|
+
const nodePath = pattern.slice(i, j);
|
|
143
|
+
pattern = pattern.slice(0, i + 1) + nodePattern + pattern.slice(j);
|
|
144
|
+
i += nodePattern.length;
|
|
145
|
+
const regex = isRegexNode ? new RegExp("^" + regexps.join("") + "$") : undefined;
|
|
146
|
+
currentNode = currentNode.createParametricChild(regex, staticPart, nodePath);
|
|
147
|
+
parentNodePathIndex = i + 1;
|
|
148
|
+
break;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
} else if (isWildcardNode) {
|
|
153
|
+
// add the wildcard parameter
|
|
154
|
+
params.push("*");
|
|
155
|
+
currentNode = currentNode.createWildcardChild();
|
|
156
|
+
parentNodePathIndex = i + 1;
|
|
157
|
+
if (i !== pattern.length - 1) {
|
|
158
|
+
throw new Error("Wildcard must be the last character in the route");
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
if (!this.options.caseSensitive) {
|
|
163
|
+
pattern = pattern.toLowerCase();
|
|
164
|
+
}
|
|
165
|
+
if (pattern === "*") {
|
|
166
|
+
pattern = "/*";
|
|
167
|
+
}
|
|
168
|
+
for (const existRoute of this.routes) {
|
|
169
|
+
if (existRoute.method === method && existRoute.pattern === pattern) {
|
|
170
|
+
throw new Error(`Method '${method}' already declared for route '${pattern}'`);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
const route = {
|
|
174
|
+
method,
|
|
175
|
+
path,
|
|
176
|
+
pattern,
|
|
177
|
+
params,
|
|
178
|
+
handler
|
|
179
|
+
};
|
|
180
|
+
this.routes.push(route);
|
|
181
|
+
currentNode.addRoute(route);
|
|
182
|
+
}
|
|
183
|
+
has(method, path) {
|
|
184
|
+
const node = this.trees[method];
|
|
185
|
+
if (node === undefined) {
|
|
186
|
+
return false;
|
|
187
|
+
}
|
|
188
|
+
const staticNode = node.getStaticChild(path);
|
|
189
|
+
if (staticNode === undefined) {
|
|
190
|
+
return false;
|
|
191
|
+
}
|
|
192
|
+
return staticNode.isLeafNode;
|
|
193
|
+
}
|
|
194
|
+
find(method, path) {
|
|
195
|
+
let currentNode = this.trees[method];
|
|
196
|
+
if (currentNode === undefined) return undefined;
|
|
197
|
+
if (path.charCodeAt(0) !== 47) {
|
|
198
|
+
// 47 is '/'
|
|
199
|
+
path = path.replace(FULL_PATH_REGEXP, "/");
|
|
200
|
+
}
|
|
201
|
+
// This must be run before sanitizeUrl as the resulting function
|
|
202
|
+
// .sliceParameter must be constructed with same URL string used
|
|
203
|
+
// throughout the rest of this function.
|
|
204
|
+
if (this.options.ignoreDuplicateSlashes) {
|
|
205
|
+
path = removeDuplicateSlashes(path);
|
|
206
|
+
}
|
|
207
|
+
let sanitizedUrl;
|
|
208
|
+
let querystring;
|
|
209
|
+
let shouldDecodeParam;
|
|
210
|
+
try {
|
|
211
|
+
sanitizedUrl = safeDecodeURI(path);
|
|
212
|
+
path = sanitizedUrl.path;
|
|
213
|
+
querystring = sanitizedUrl.querystring;
|
|
214
|
+
shouldDecodeParam = sanitizedUrl.shouldDecodeParam;
|
|
215
|
+
} catch (error) {
|
|
216
|
+
return undefined;
|
|
217
|
+
}
|
|
218
|
+
if (this.options.ignoreTrailingSlash) {
|
|
219
|
+
path = trimLastSlash(path);
|
|
220
|
+
}
|
|
221
|
+
const originPath = path;
|
|
222
|
+
if (this.options.caseSensitive === false) {
|
|
223
|
+
path = path.toLowerCase();
|
|
224
|
+
}
|
|
225
|
+
const maxParamLength = this.options.maxParamLength;
|
|
226
|
+
let pathIndex = currentNode.prefix.length;
|
|
227
|
+
const params = [];
|
|
228
|
+
const pathLen = path.length;
|
|
229
|
+
const brothersNodesStack = [];
|
|
230
|
+
while (true) {
|
|
231
|
+
if (pathIndex === pathLen && currentNode.isLeafNode) {
|
|
232
|
+
const handle = currentNode.handlerStorage?.find();
|
|
233
|
+
if (handle !== undefined) {
|
|
234
|
+
return {
|
|
235
|
+
handler: handle.handler,
|
|
236
|
+
params: handle.createParams(params),
|
|
237
|
+
searchParams: QS.parse(querystring)
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
let node = currentNode.getNextNode(path, pathIndex, brothersNodesStack, params.length);
|
|
242
|
+
if (node === undefined) {
|
|
243
|
+
if (brothersNodesStack.length === 0) {
|
|
244
|
+
return undefined;
|
|
245
|
+
}
|
|
246
|
+
const brotherNodeState = brothersNodesStack.pop();
|
|
247
|
+
pathIndex = brotherNodeState.brotherPathIndex;
|
|
248
|
+
params.splice(brotherNodeState.paramsCount);
|
|
249
|
+
node = brotherNodeState.brotherNode;
|
|
250
|
+
}
|
|
251
|
+
currentNode = node;
|
|
252
|
+
while (true) {
|
|
253
|
+
if (currentNode._tag === "StaticNode") {
|
|
254
|
+
pathIndex += currentNode.prefix.length;
|
|
255
|
+
break;
|
|
256
|
+
}
|
|
257
|
+
if (currentNode._tag === "WildcardNode") {
|
|
258
|
+
let param = originPath.slice(pathIndex);
|
|
259
|
+
if (shouldDecodeParam) {
|
|
260
|
+
param = safeDecodeURIComponent(param);
|
|
261
|
+
}
|
|
262
|
+
params.push(param);
|
|
263
|
+
pathIndex = pathLen;
|
|
264
|
+
break;
|
|
265
|
+
}
|
|
266
|
+
let paramEndIndex = originPath.indexOf("/", pathIndex);
|
|
267
|
+
if (paramEndIndex === -1) {
|
|
268
|
+
paramEndIndex = pathLen;
|
|
269
|
+
}
|
|
270
|
+
let param = originPath.slice(pathIndex, paramEndIndex);
|
|
271
|
+
if (shouldDecodeParam) {
|
|
272
|
+
param = safeDecodeURIComponent(param);
|
|
273
|
+
}
|
|
274
|
+
if (currentNode.regex !== undefined) {
|
|
275
|
+
const matchedParameters = currentNode.regex.exec(param);
|
|
276
|
+
if (matchedParameters === null) {
|
|
277
|
+
if (brothersNodesStack.length === 0) {
|
|
278
|
+
return undefined;
|
|
279
|
+
}
|
|
280
|
+
const brotherNodeState = brothersNodesStack.pop();
|
|
281
|
+
pathIndex = brotherNodeState.brotherPathIndex;
|
|
282
|
+
params.splice(brotherNodeState.paramsCount);
|
|
283
|
+
currentNode = brotherNodeState.brotherNode;
|
|
284
|
+
continue;
|
|
285
|
+
}
|
|
286
|
+
let maxParamLengthExceeded = false;
|
|
287
|
+
for (let i = 1; i < matchedParameters.length; i++) {
|
|
288
|
+
const matchedParam = matchedParameters[i] ?? "";
|
|
289
|
+
if (matchedParam.length > maxParamLength) {
|
|
290
|
+
maxParamLengthExceeded = true;
|
|
291
|
+
break;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
if (maxParamLengthExceeded) {
|
|
295
|
+
if (brothersNodesStack.length === 0) {
|
|
296
|
+
return undefined;
|
|
297
|
+
}
|
|
298
|
+
const brotherNodeState = brothersNodesStack.pop();
|
|
299
|
+
pathIndex = brotherNodeState.brotherPathIndex;
|
|
300
|
+
params.splice(brotherNodeState.paramsCount);
|
|
301
|
+
currentNode = brotherNodeState.brotherNode;
|
|
302
|
+
continue;
|
|
303
|
+
}
|
|
304
|
+
for (let i = 1; i < matchedParameters.length; i++) {
|
|
305
|
+
params.push(matchedParameters[i] ?? "");
|
|
306
|
+
}
|
|
307
|
+
} else {
|
|
308
|
+
if (param.length > maxParamLength) {
|
|
309
|
+
if (brothersNodesStack.length === 0) {
|
|
310
|
+
return undefined;
|
|
311
|
+
}
|
|
312
|
+
const brotherNodeState = brothersNodesStack.pop();
|
|
313
|
+
pathIndex = brotherNodeState.brotherPathIndex;
|
|
314
|
+
params.splice(brotherNodeState.paramsCount);
|
|
315
|
+
currentNode = brotherNodeState.brotherNode;
|
|
316
|
+
continue;
|
|
317
|
+
}
|
|
318
|
+
params.push(param);
|
|
319
|
+
}
|
|
320
|
+
pathIndex = paramEndIndex;
|
|
321
|
+
break;
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
class HandlerStorage {
|
|
327
|
+
handlers = [];
|
|
328
|
+
unconstrainedHandler;
|
|
329
|
+
find() {
|
|
330
|
+
return this.unconstrainedHandler;
|
|
331
|
+
}
|
|
332
|
+
add(route) {
|
|
333
|
+
const handler = {
|
|
334
|
+
params: route.params,
|
|
335
|
+
handler: route.handler,
|
|
336
|
+
createParams: compileCreateParams(route.params)
|
|
337
|
+
};
|
|
338
|
+
this.handlers.push(handler);
|
|
339
|
+
this.unconstrainedHandler = this.handlers[0];
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
class NodeBase {
|
|
343
|
+
isLeafNode = false;
|
|
344
|
+
routes;
|
|
345
|
+
handlerStorage;
|
|
346
|
+
addRoute(route) {
|
|
347
|
+
if (this.routes === undefined) {
|
|
348
|
+
this.routes = [route];
|
|
349
|
+
} else {
|
|
350
|
+
this.routes.push(route);
|
|
351
|
+
}
|
|
352
|
+
if (this.handlerStorage === undefined) {
|
|
353
|
+
this.handlerStorage = new HandlerStorage();
|
|
354
|
+
}
|
|
355
|
+
this.isLeafNode = true;
|
|
356
|
+
this.handlerStorage.add(route);
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
class ParentNode extends NodeBase {
|
|
360
|
+
staticChildren = /*#__PURE__*/Object.create(null);
|
|
361
|
+
findStaticMatchingChild(path, pathIndex) {
|
|
362
|
+
const staticChild = this.staticChildren[path.charAt(pathIndex)];
|
|
363
|
+
if (staticChild === undefined || !staticChild.matchPrefix(path, pathIndex)) {
|
|
364
|
+
return undefined;
|
|
365
|
+
}
|
|
366
|
+
return staticChild;
|
|
367
|
+
}
|
|
368
|
+
getStaticChild(path, pathIndex = 0) {
|
|
369
|
+
if (path.length === pathIndex) {
|
|
370
|
+
return this;
|
|
371
|
+
}
|
|
372
|
+
const staticChild = this.findStaticMatchingChild(path, pathIndex);
|
|
373
|
+
if (staticChild === undefined) {
|
|
374
|
+
return undefined;
|
|
375
|
+
}
|
|
376
|
+
return staticChild.getStaticChild(path, pathIndex + staticChild.prefix.length);
|
|
377
|
+
}
|
|
378
|
+
createStaticChild(path) {
|
|
379
|
+
if (path.length === 0) {
|
|
380
|
+
return this;
|
|
381
|
+
}
|
|
382
|
+
let staticChild = this.staticChildren[path.charAt(0)];
|
|
383
|
+
if (staticChild) {
|
|
384
|
+
let i = 1;
|
|
385
|
+
for (; i < staticChild.prefix.length; i++) {
|
|
386
|
+
if (path.charCodeAt(i) !== staticChild.prefix.charCodeAt(i)) {
|
|
387
|
+
staticChild = staticChild.split(this, i);
|
|
388
|
+
break;
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
return staticChild.createStaticChild(path.slice(i));
|
|
392
|
+
}
|
|
393
|
+
const label = path.charAt(0);
|
|
394
|
+
this.staticChildren[label] = new StaticNode(path);
|
|
395
|
+
return this.staticChildren[label];
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
class StaticNode extends ParentNode {
|
|
399
|
+
_tag = "StaticNode";
|
|
400
|
+
constructor(prefix) {
|
|
401
|
+
super();
|
|
402
|
+
this.setPrefix(prefix);
|
|
403
|
+
}
|
|
404
|
+
prefix;
|
|
405
|
+
matchPrefix;
|
|
406
|
+
parametricChildren = [];
|
|
407
|
+
wildcardChild;
|
|
408
|
+
setPrefix(prefix) {
|
|
409
|
+
this.prefix = prefix;
|
|
410
|
+
if (prefix.length === 1) {
|
|
411
|
+
this.matchPrefix = (_path, _pathIndex) => true;
|
|
412
|
+
} else {
|
|
413
|
+
const len = prefix.length;
|
|
414
|
+
this.matchPrefix = function (path, pathIndex) {
|
|
415
|
+
for (let i = 1; i < len; i++) {
|
|
416
|
+
if (path.charCodeAt(pathIndex + i) !== this.prefix.charCodeAt(i)) {
|
|
417
|
+
return false;
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
return true;
|
|
421
|
+
};
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
getParametricChild(regex) {
|
|
425
|
+
if (regex === undefined) {
|
|
426
|
+
return this.parametricChildren.find(child => child.isRegex === false);
|
|
427
|
+
}
|
|
428
|
+
const source = regex.source;
|
|
429
|
+
return this.parametricChildren.find(child => {
|
|
430
|
+
if (child.regex === undefined) {
|
|
431
|
+
return false;
|
|
432
|
+
}
|
|
433
|
+
return child.regex.source === source;
|
|
434
|
+
});
|
|
435
|
+
}
|
|
436
|
+
createParametricChild(regex, staticSuffix, nodePath) {
|
|
437
|
+
let child = this.getParametricChild(regex);
|
|
438
|
+
if (child !== undefined) {
|
|
439
|
+
child.nodePaths.add(nodePath);
|
|
440
|
+
return child;
|
|
441
|
+
}
|
|
442
|
+
child = new ParametricNode(regex, staticSuffix, nodePath);
|
|
443
|
+
this.parametricChildren.push(child);
|
|
444
|
+
this.parametricChildren.sort((child1, child2) => {
|
|
445
|
+
if (!child1.isRegex) return 1;
|
|
446
|
+
if (!child2.isRegex) return -1;
|
|
447
|
+
if (child1.staticSuffix === undefined) return 1;
|
|
448
|
+
if (child2.staticSuffix === undefined) return -1;
|
|
449
|
+
if (child2.staticSuffix.endsWith(child1.staticSuffix)) return 1;
|
|
450
|
+
if (child1.staticSuffix.endsWith(child2.staticSuffix)) return -1;
|
|
451
|
+
return 0;
|
|
452
|
+
});
|
|
453
|
+
return child;
|
|
454
|
+
}
|
|
455
|
+
createWildcardChild() {
|
|
456
|
+
if (this.wildcardChild === undefined) {
|
|
457
|
+
this.wildcardChild = new WildcardNode();
|
|
458
|
+
}
|
|
459
|
+
return this.wildcardChild;
|
|
460
|
+
}
|
|
461
|
+
split(parentNode, length) {
|
|
462
|
+
const parentPrefix = this.prefix.slice(0, length);
|
|
463
|
+
const childPrefix = this.prefix.slice(length);
|
|
464
|
+
this.setPrefix(childPrefix);
|
|
465
|
+
const staticNode = new StaticNode(parentPrefix);
|
|
466
|
+
staticNode.staticChildren[childPrefix.charAt(0)] = this;
|
|
467
|
+
parentNode.staticChildren[parentPrefix.charAt(0)] = staticNode;
|
|
468
|
+
return staticNode;
|
|
469
|
+
}
|
|
470
|
+
getNextNode(path, pathIndex, nodeStack, paramsCount) {
|
|
471
|
+
let node = this.findStaticMatchingChild(path, pathIndex);
|
|
472
|
+
let parametricBrotherNodeIndex = 0;
|
|
473
|
+
if (node === undefined) {
|
|
474
|
+
if (this.parametricChildren.length === 0) {
|
|
475
|
+
return this.wildcardChild;
|
|
476
|
+
}
|
|
477
|
+
node = this.parametricChildren[0];
|
|
478
|
+
parametricBrotherNodeIndex = 1;
|
|
479
|
+
}
|
|
480
|
+
if (this.wildcardChild !== undefined) {
|
|
481
|
+
nodeStack.push({
|
|
482
|
+
paramsCount,
|
|
483
|
+
brotherPathIndex: pathIndex,
|
|
484
|
+
brotherNode: this.wildcardChild
|
|
485
|
+
});
|
|
486
|
+
}
|
|
487
|
+
for (let i = this.parametricChildren.length - 1; i >= parametricBrotherNodeIndex; i--) {
|
|
488
|
+
nodeStack.push({
|
|
489
|
+
paramsCount,
|
|
490
|
+
brotherPathIndex: pathIndex,
|
|
491
|
+
brotherNode: this.parametricChildren[i]
|
|
492
|
+
});
|
|
493
|
+
}
|
|
494
|
+
return node;
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
class ParametricNode extends ParentNode {
|
|
498
|
+
_tag = "ParametricNode";
|
|
499
|
+
regex;
|
|
500
|
+
staticSuffix;
|
|
501
|
+
constructor(regex, staticSuffix, nodePath) {
|
|
502
|
+
super();
|
|
503
|
+
this.regex = regex;
|
|
504
|
+
this.staticSuffix = staticSuffix;
|
|
505
|
+
this.isRegex = !!regex;
|
|
506
|
+
this.nodePaths = new Set([nodePath]);
|
|
507
|
+
}
|
|
508
|
+
isRegex;
|
|
509
|
+
nodePaths;
|
|
510
|
+
getNextNode(path, pathIndex) {
|
|
511
|
+
return this.findStaticMatchingChild(path, pathIndex);
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
class WildcardNode extends NodeBase {
|
|
515
|
+
_tag = "WildcardNode";
|
|
516
|
+
getNextNode(_path, _pathIndex, _nodeStack, _paramsCount) {
|
|
517
|
+
return undefined;
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
const assert = (condition, message) => {
|
|
521
|
+
if (!condition) {
|
|
522
|
+
throw new Error(message);
|
|
523
|
+
}
|
|
524
|
+
};
|
|
525
|
+
function removeDuplicateSlashes(path) {
|
|
526
|
+
return path.replace(/\/\/+/g, "/");
|
|
527
|
+
}
|
|
528
|
+
function trimLastSlash(path) {
|
|
529
|
+
if (path.length > 1 && path.charCodeAt(path.length - 1) === 47) {
|
|
530
|
+
return path.slice(0, -1);
|
|
531
|
+
}
|
|
532
|
+
return path;
|
|
533
|
+
}
|
|
534
|
+
function compileCreateParams(params) {
|
|
535
|
+
const len = params.length;
|
|
536
|
+
return function (paramsArray) {
|
|
537
|
+
const paramsObject = Object.create(null);
|
|
538
|
+
for (let i = 0; i < len; i++) {
|
|
539
|
+
paramsObject[params[i]] = paramsArray[i];
|
|
540
|
+
}
|
|
541
|
+
return paramsObject;
|
|
542
|
+
};
|
|
543
|
+
}
|
|
544
|
+
function getClosingParenthensePosition(path, idx) {
|
|
545
|
+
// `path.indexOf()` will always return the first position of the closing parenthese,
|
|
546
|
+
// but it's inefficient for grouped or wrong regexp expressions.
|
|
547
|
+
// see issues #62 and #63 for more info
|
|
548
|
+
let parentheses = 1;
|
|
549
|
+
while (idx < path.length) {
|
|
550
|
+
idx++;
|
|
551
|
+
// ignore skipped chars
|
|
552
|
+
if (path[idx] === "\\") {
|
|
553
|
+
idx++;
|
|
554
|
+
continue;
|
|
555
|
+
}
|
|
556
|
+
if (path[idx] === ")") {
|
|
557
|
+
parentheses--;
|
|
558
|
+
} else if (path[idx] === "(") {
|
|
559
|
+
parentheses++;
|
|
560
|
+
}
|
|
561
|
+
if (!parentheses) return idx;
|
|
562
|
+
}
|
|
563
|
+
throw new TypeError("Invalid regexp expression in \"" + path + "\"");
|
|
564
|
+
}
|
|
565
|
+
function trimRegExpStartAndEnd(regexString) {
|
|
566
|
+
// removes chars that marks start "^" and end "$" of regexp
|
|
567
|
+
if (regexString.charCodeAt(1) === 94) {
|
|
568
|
+
regexString = regexString.slice(0, 1) + regexString.slice(2);
|
|
569
|
+
}
|
|
570
|
+
if (regexString.charCodeAt(regexString.length - 2) === 36) {
|
|
571
|
+
regexString = regexString.slice(0, regexString.length - 2) + regexString.slice(regexString.length - 1);
|
|
572
|
+
}
|
|
573
|
+
return regexString;
|
|
574
|
+
}
|
|
575
|
+
function escapeRegExp(string) {
|
|
576
|
+
return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
577
|
+
}
|
|
578
|
+
// It must spot all the chars where decodeURIComponent(x) !== decodeURI(x)
|
|
579
|
+
// The chars are: # $ & + , / : ; = ? @
|
|
580
|
+
function decodeComponentChar(highCharCode, lowCharCode) {
|
|
581
|
+
if (highCharCode === 50) {
|
|
582
|
+
if (lowCharCode === 53) return "%";
|
|
583
|
+
if (lowCharCode === 51) return "#";
|
|
584
|
+
if (lowCharCode === 52) return "$";
|
|
585
|
+
if (lowCharCode === 54) return "&";
|
|
586
|
+
if (lowCharCode === 66) return "+";
|
|
587
|
+
if (lowCharCode === 98) return "+";
|
|
588
|
+
if (lowCharCode === 67) return ",";
|
|
589
|
+
if (lowCharCode === 99) return ",";
|
|
590
|
+
if (lowCharCode === 70) return "/";
|
|
591
|
+
if (lowCharCode === 102) return "/";
|
|
592
|
+
return undefined;
|
|
593
|
+
}
|
|
594
|
+
if (highCharCode === 51) {
|
|
595
|
+
if (lowCharCode === 65) return ":";
|
|
596
|
+
if (lowCharCode === 97) return ":";
|
|
597
|
+
if (lowCharCode === 66) return ";";
|
|
598
|
+
if (lowCharCode === 98) return ";";
|
|
599
|
+
if (lowCharCode === 68) return "=";
|
|
600
|
+
if (lowCharCode === 100) return "=";
|
|
601
|
+
if (lowCharCode === 70) return "?";
|
|
602
|
+
if (lowCharCode === 102) return "?";
|
|
603
|
+
return undefined;
|
|
604
|
+
}
|
|
605
|
+
if (highCharCode === 52 && lowCharCode === 48) {
|
|
606
|
+
return "@";
|
|
607
|
+
}
|
|
608
|
+
return undefined;
|
|
609
|
+
}
|
|
610
|
+
function safeDecodeURI(path) {
|
|
611
|
+
let shouldDecode = false;
|
|
612
|
+
let shouldDecodeParam = false;
|
|
613
|
+
let querystring = "";
|
|
614
|
+
for (let i = 1; i < path.length; i++) {
|
|
615
|
+
const charCode = path.charCodeAt(i);
|
|
616
|
+
if (charCode === 37) {
|
|
617
|
+
const highCharCode = path.charCodeAt(i + 1);
|
|
618
|
+
const lowCharCode = path.charCodeAt(i + 2);
|
|
619
|
+
if (decodeComponentChar(highCharCode, lowCharCode) === undefined) {
|
|
620
|
+
shouldDecode = true;
|
|
621
|
+
} else {
|
|
622
|
+
shouldDecodeParam = true;
|
|
623
|
+
// %25 - encoded % char. We need to encode one more time to prevent double decoding
|
|
624
|
+
if (highCharCode === 50 && lowCharCode === 53) {
|
|
625
|
+
shouldDecode = true;
|
|
626
|
+
path = path.slice(0, i + 1) + "25" + path.slice(i + 1);
|
|
627
|
+
i += 2;
|
|
628
|
+
}
|
|
629
|
+
i += 2;
|
|
630
|
+
}
|
|
631
|
+
// Some systems do not follow RFC and separate the path and query
|
|
632
|
+
// string with a `;` character (code 59), e.g. `/foo;jsessionid=123456`.
|
|
633
|
+
// Thus, we need to split on `;` as well as `?` and `#`.
|
|
634
|
+
} else if (charCode === 63 || charCode === 59 || charCode === 35) {
|
|
635
|
+
querystring = path.slice(i + 1);
|
|
636
|
+
path = path.slice(0, i);
|
|
637
|
+
break;
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
const decodedPath = shouldDecode ? decodeURI(path) : path;
|
|
641
|
+
return {
|
|
642
|
+
path: decodedPath,
|
|
643
|
+
querystring,
|
|
644
|
+
shouldDecodeParam
|
|
645
|
+
};
|
|
646
|
+
}
|
|
647
|
+
function safeDecodeURIComponent(uriComponent) {
|
|
648
|
+
const startIndex = uriComponent.indexOf("%");
|
|
649
|
+
if (startIndex === -1) return uriComponent;
|
|
650
|
+
let decoded = "";
|
|
651
|
+
let lastIndex = startIndex;
|
|
652
|
+
for (let i = startIndex; i < uriComponent.length; i++) {
|
|
653
|
+
if (uriComponent.charCodeAt(i) === 37) {
|
|
654
|
+
if (i + 2 >= uriComponent.length) break;
|
|
655
|
+
const highCharCode = uriComponent.charCodeAt(i + 1);
|
|
656
|
+
const lowCharCode = uriComponent.charCodeAt(i + 2);
|
|
657
|
+
const decodedChar = decodeComponentChar(highCharCode, lowCharCode);
|
|
658
|
+
decoded += uriComponent.slice(lastIndex, i) + decodedChar;
|
|
659
|
+
lastIndex = i + 3;
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
return uriComponent.slice(0, startIndex) + decoded + uriComponent.slice(lastIndex);
|
|
663
|
+
}
|
|
664
|
+
const httpMethods = ["ACL", "BIND", "CHECKOUT", "CONNECT", "COPY", "DELETE", "GET", "HEAD", "LINK", "LOCK", "M-SEARCH", "MERGE", "MKACTIVITY", "MKCALENDAR", "MKCOL", "MOVE", "NOTIFY", "OPTIONS", "PATCH", "POST", "PROPFIND", "PROPPATCH", "PURGE", "PUT", "QUERY", "REBIND", "REPORT", "SEARCH", "SOURCE", "SUBSCRIBE", "TRACE", "UNBIND", "UNLINK", "UNLOCK", "UNSUBSCRIBE"];
|
|
665
|
+
//# sourceMappingURL=router.js.map
|