effect 4.0.0-rc.118 → 4.0.1
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/README.md +17 -4
- package/dist/Array.d.ts +25 -25
- package/dist/Array.d.ts.map +1 -1
- package/dist/Array.js +16 -16
- package/dist/Array.js.map +1 -1
- package/dist/Cache.d.ts.map +1 -1
- package/dist/Cache.js +20 -16
- package/dist/Cache.js.map +1 -1
- package/dist/Cause.d.ts.map +1 -1
- package/dist/Cause.js +1 -1
- package/dist/Cause.js.map +1 -1
- package/dist/Chunk.d.ts +26 -26
- package/dist/Chunk.d.ts.map +1 -1
- package/dist/Chunk.js +15 -15
- package/dist/Chunk.js.map +1 -1
- package/dist/Effect.d.ts +167 -39
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +16 -10
- package/dist/Effect.js.map +1 -1
- package/dist/HashRing.d.ts.map +1 -1
- package/dist/HashRing.js +13 -5
- package/dist/HashRing.js.map +1 -1
- package/dist/MutableHashMap.d.ts.map +1 -1
- package/dist/MutableHashMap.js +4 -22
- package/dist/MutableHashMap.js.map +1 -1
- package/dist/Option.d.ts +17 -17
- package/dist/Option.d.ts.map +1 -1
- package/dist/Option.js +6 -6
- package/dist/Option.js.map +1 -1
- package/dist/Pool.d.ts +9 -5
- package/dist/Pool.d.ts.map +1 -1
- package/dist/Pool.js +34 -41
- package/dist/Pool.js.map +1 -1
- package/dist/Queue.d.ts +19 -2
- package/dist/Queue.d.ts.map +1 -1
- package/dist/Queue.js +9 -4
- package/dist/Queue.js.map +1 -1
- package/dist/RcMap.d.ts.map +1 -1
- package/dist/RcMap.js +16 -1
- package/dist/RcMap.js.map +1 -1
- package/dist/Record.d.ts +14 -14
- package/dist/Record.d.ts.map +1 -1
- package/dist/Record.js +10 -10
- package/dist/Record.js.map +1 -1
- package/dist/Schema.d.ts +37 -21
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +29 -10
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaAST.d.ts.map +1 -1
- package/dist/SchemaAST.js +116 -97
- package/dist/SchemaAST.js.map +1 -1
- package/dist/SchemaRepresentation.d.ts +3 -1
- package/dist/SchemaRepresentation.d.ts.map +1 -1
- package/dist/SchemaRepresentation.js +3 -1
- package/dist/SchemaRepresentation.js.map +1 -1
- package/dist/ScopedCache.d.ts.map +1 -1
- package/dist/ScopedCache.js +24 -16
- package/dist/ScopedCache.js.map +1 -1
- package/dist/Stream.d.ts +45 -6
- package/dist/Stream.d.ts.map +1 -1
- package/dist/Stream.js +55 -44
- package/dist/Stream.js.map +1 -1
- package/dist/ai/LanguageModel.d.ts +8 -0
- package/dist/ai/LanguageModel.d.ts.map +1 -1
- package/dist/ai/LanguageModel.js +13 -2
- package/dist/ai/LanguageModel.js.map +1 -1
- package/dist/ai/McpSchema.d.ts +402 -402
- package/dist/ai/McpSchema.d.ts.map +1 -1
- package/dist/ai/McpSchema.js +1 -1
- package/dist/ai/McpSchema.js.map +1 -1
- package/dist/ai/McpServer.d.ts.map +1 -1
- package/dist/ai/McpServer.js +11 -3
- package/dist/ai/McpServer.js.map +1 -1
- package/dist/ai/Response.d.ts.map +1 -1
- package/dist/ai/Response.js +22 -12
- package/dist/ai/Response.js.map +1 -1
- package/dist/ai/internal/mcpProtocol/v2024_11_05.js +1 -0
- package/dist/ai/internal/mcpProtocol/v2024_11_05.js.map +1 -1
- package/dist/ai/internal/mcpProtocol/v2025_03_26.js +1 -0
- package/dist/ai/internal/mcpProtocol/v2025_03_26.js.map +1 -1
- package/dist/ai/internal/mcpProtocol/v2025_06_18.js +1 -0
- package/dist/ai/internal/mcpProtocol/v2025_06_18.js.map +1 -1
- package/dist/ai/internal/mcpProtocol/v2025_11_25.js +1 -0
- package/dist/ai/internal/mcpProtocol/v2025_11_25.js.map +1 -1
- package/dist/ai/internal/mcpSchema/v2024_11_05.js +3 -1
- package/dist/ai/internal/mcpSchema/v2024_11_05.js.map +1 -1
- package/dist/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
- package/dist/cluster/ClusterWorkflowEngine.js +16 -3
- package/dist/cluster/ClusterWorkflowEngine.js.map +1 -1
- package/dist/cluster/MessageStorage.d.ts +32 -8
- package/dist/cluster/MessageStorage.d.ts.map +1 -1
- package/dist/cluster/MessageStorage.js +2 -1
- package/dist/cluster/MessageStorage.js.map +1 -1
- package/dist/cluster/Sharding.d.ts +5 -2
- package/dist/cluster/Sharding.d.ts.map +1 -1
- package/dist/cluster/Sharding.js +15 -8
- package/dist/cluster/Sharding.js.map +1 -1
- package/dist/cluster/SqlMessageStorage.d.ts.map +1 -1
- package/dist/cluster/SqlMessageStorage.js +36 -16
- package/dist/cluster/SqlMessageStorage.js.map +1 -1
- package/dist/cluster/SqlRunnerStorage.d.ts.map +1 -1
- package/dist/cluster/SqlRunnerStorage.js +30 -44
- package/dist/cluster/SqlRunnerStorage.js.map +1 -1
- package/dist/cluster/internal/entityManager.js +63 -62
- package/dist/cluster/internal/entityManager.js.map +1 -1
- package/dist/cluster/internal/interruptors.js +8 -0
- package/dist/cluster/internal/interruptors.js.map +1 -1
- package/dist/cluster/internal/resourceMap.js +39 -14
- package/dist/cluster/internal/resourceMap.js.map +1 -1
- package/dist/cluster/internal/resourceRef.js +168 -87
- package/dist/cluster/internal/resourceRef.js.map +1 -1
- package/dist/http/HttpEffect.d.ts +1 -0
- package/dist/http/HttpEffect.d.ts.map +1 -1
- package/dist/http/HttpEffect.js +29 -22
- package/dist/http/HttpEffect.js.map +1 -1
- package/dist/http/HttpMiddleware.d.ts.map +1 -1
- package/dist/http/HttpMiddleware.js +3 -2
- package/dist/http/HttpMiddleware.js.map +1 -1
- package/dist/http/HttpStaticServer.d.ts.map +1 -1
- package/dist/http/HttpStaticServer.js +14 -0
- package/dist/http/HttpStaticServer.js.map +1 -1
- package/dist/http/HttpTraceContext.d.ts +1 -1
- package/dist/http/HttpTraceContext.d.ts.map +1 -1
- package/dist/http/HttpTraceContext.js +4 -4
- package/dist/http/HttpTraceContext.js.map +1 -1
- package/dist/http-api/HttpApiError.d.ts +1 -0
- package/dist/http-api/HttpApiError.d.ts.map +1 -1
- package/dist/http-api/HttpApiError.js +1 -0
- package/dist/http-api/HttpApiError.js.map +1 -1
- package/dist/internal/core.js +43 -2
- package/dist/internal/core.js.map +1 -1
- package/dist/internal/dateTime.js +1 -1
- package/dist/internal/dateTime.js.map +1 -1
- package/dist/internal/effect.js +138 -165
- package/dist/internal/effect.js.map +1 -1
- package/dist/internal/rcRef.js +59 -23
- package/dist/internal/rcRef.js.map +1 -1
- package/dist/internal/schema/annotations.js +1 -7
- package/dist/internal/schema/annotations.js.map +1 -1
- package/dist/internal/schema/codegen.js +56 -28
- package/dist/internal/schema/codegen.js.map +1 -1
- package/dist/internal/schema/fromJsonSchemaDocument.js +11 -8
- package/dist/internal/schema/fromJsonSchemaDocument.js.map +1 -1
- package/dist/internal/schema/toCodeDocument.js +10 -30
- package/dist/internal/schema/toCodeDocument.js.map +1 -1
- package/dist/internal/schema/toCodec.js +1 -15
- package/dist/internal/schema/toCodec.js.map +1 -1
- package/dist/internal/schema/toEquivalence.js +4 -3
- package/dist/internal/schema/toEquivalence.js.map +1 -1
- package/dist/internal/schema/toFormatter.js +4 -4
- package/dist/internal/schema/toFormatter.js.map +1 -1
- package/dist/reactivity/Atom.d.ts.map +1 -1
- package/dist/reactivity/Atom.js +6 -2
- package/dist/reactivity/Atom.js.map +1 -1
- package/dist/reactivity/AtomRpc.d.ts +3 -3
- package/dist/reactivity/AtomRpc.d.ts.map +1 -1
- package/dist/rpc/Rpc.d.ts +2 -2
- package/dist/rpc/Rpc.d.ts.map +1 -1
- package/dist/rpc/RpcClient.d.ts +7 -7
- package/dist/rpc/RpcClient.d.ts.map +1 -1
- package/dist/rpc/RpcClient.js +21 -16
- package/dist/rpc/RpcClient.js.map +1 -1
- package/dist/rpc/RpcMessage.d.ts +1 -1
- package/dist/rpc/RpcMessage.d.ts.map +1 -1
- package/dist/rpc/RpcServer.d.ts.map +1 -1
- package/dist/rpc/RpcServer.js +2 -2
- package/dist/rpc/RpcServer.js.map +1 -1
- package/dist/rpc/Utils.d.ts +2 -3
- package/dist/rpc/Utils.d.ts.map +1 -1
- package/dist/rpc/Utils.js +3 -4
- package/dist/rpc/Utils.js.map +1 -1
- package/dist/schema/SchemaCompiler/runtime.js +6 -1
- package/dist/schema/SchemaCompiler/runtime.js.map +1 -1
- package/dist/testing/TestSchema.d.ts +234 -6
- package/dist/testing/TestSchema.d.ts.map +1 -1
- package/dist/testing/TestSchema.js +244 -25
- package/dist/testing/TestSchema.js.map +1 -1
- package/dist/testing/index.d.ts +1 -0
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +1 -0
- package/dist/testing/index.js.map +1 -1
- package/dist/workflow/DurableDeferred.js +1 -1
- package/dist/workflow/DurableDeferred.js.map +1 -1
- package/dist/workflow/Workflow.js +1 -1
- package/dist/workflow/Workflow.js.map +1 -1
- package/dist/workflow/WorkflowEngine.d.ts +2 -0
- package/dist/workflow/WorkflowEngine.d.ts.map +1 -1
- package/dist/workflow/WorkflowEngine.js +1 -0
- package/dist/workflow/WorkflowEngine.js.map +1 -1
- package/package.json +1 -1
- package/src/Array.ts +31 -31
- package/src/Cache.ts +22 -16
- package/src/Cause.ts +1 -1
- package/src/Chunk.ts +29 -29
- package/src/Effect.ts +170 -39
- package/src/HashRing.ts +14 -5
- package/src/MutableHashMap.ts +4 -24
- package/src/Option.ts +19 -19
- package/src/Pool.ts +28 -36
- package/src/Queue.ts +26 -6
- package/src/RcMap.ts +26 -2
- package/src/Record.ts +20 -20
- package/src/Schema.ts +48 -24
- package/src/SchemaAST.ts +135 -115
- package/src/SchemaRepresentation.ts +3 -1
- package/src/ScopedCache.ts +27 -16
- package/src/Stream.ts +158 -88
- package/src/ai/LanguageModel.ts +27 -2
- package/src/ai/McpSchema.ts +3 -3
- package/src/ai/McpServer.ts +12 -3
- package/src/ai/Response.ts +27 -12
- package/src/ai/internal/mcpProtocol/v2024_11_05.ts +1 -0
- package/src/ai/internal/mcpProtocol/v2025_03_26.ts +1 -0
- package/src/ai/internal/mcpProtocol/v2025_06_18.ts +1 -0
- package/src/ai/internal/mcpProtocol/v2025_11_25.ts +1 -0
- package/src/ai/internal/mcpSchema/v2024_11_05.ts +4 -2
- package/src/cluster/ClusterWorkflowEngine.ts +26 -5
- package/src/cluster/MessageStorage.ts +22 -5
- package/src/cluster/Sharding.ts +32 -28
- package/src/cluster/SqlMessageStorage.ts +45 -21
- package/src/cluster/SqlRunnerStorage.ts +85 -113
- package/src/cluster/internal/entityManager.ts +68 -80
- package/src/cluster/internal/interruptors.ts +13 -0
- package/src/cluster/internal/resourceMap.ts +55 -17
- package/src/cluster/internal/resourceRef.ts +189 -96
- package/src/http/HttpEffect.ts +15 -9
- package/src/http/HttpMiddleware.ts +8 -2
- package/src/http/HttpStaticServer.ts +16 -0
- package/src/http/HttpTraceContext.ts +8 -4
- package/src/http-api/HttpApiError.ts +1 -0
- package/src/internal/core.ts +56 -2
- package/src/internal/dateTime.ts +3 -1
- package/src/internal/effect.ts +146 -173
- package/src/internal/rcRef.ts +83 -33
- package/src/internal/schema/annotations.ts +0 -9
- package/src/internal/schema/codegen.ts +90 -43
- package/src/internal/schema/fromJsonSchemaDocument.ts +5 -3
- package/src/internal/schema/toCodeDocument.ts +10 -47
- package/src/internal/schema/toCodec.ts +3 -16
- package/src/internal/schema/toEquivalence.ts +4 -5
- package/src/internal/schema/toFormatter.ts +4 -6
- package/src/reactivity/Atom.ts +6 -2
- package/src/reactivity/AtomRpc.ts +5 -5
- package/src/rpc/Rpc.ts +2 -2
- package/src/rpc/RpcClient.ts +35 -32
- package/src/rpc/RpcMessage.ts +1 -1
- package/src/rpc/RpcServer.ts +2 -1
- package/src/rpc/Utils.ts +4 -10
- package/src/schema/SchemaCompiler/runtime.ts +17 -1
- package/src/testing/TestSchema.ts +315 -63
- package/src/testing/index.ts +1 -0
- package/src/workflow/DurableDeferred.ts +1 -1
- package/src/workflow/Workflow.ts +1 -1
- package/src/workflow/WorkflowEngine.ts +4 -0
package/dist/Schema.d.ts
CHANGED
|
@@ -50,7 +50,7 @@ import type * as SchemaRepresentation from "./SchemaRepresentation.ts";
|
|
|
50
50
|
import type { StandardJSONSchemaV1, StandardSchemaV1 } from "./StandardSchema.ts";
|
|
51
51
|
import type { Assign, Lambda, Mutable, Simplify } from "./Struct.ts";
|
|
52
52
|
import * as Struct_ from "./Struct.ts";
|
|
53
|
-
import type {
|
|
53
|
+
import type { IsUnion, RequiredKeys } from "./Types.ts";
|
|
54
54
|
import type { Unify } from "./Unify.ts";
|
|
55
55
|
declare const TypeId = "~effect/Schema/Schema";
|
|
56
56
|
/**
|
|
@@ -4154,27 +4154,28 @@ export interface refine<T extends S["Type"], S extends Constraint> extends Botto
|
|
|
4154
4154
|
* @since 3.10.0
|
|
4155
4155
|
*/
|
|
4156
4156
|
export declare function refine<S extends Constraint, T extends S["Type"]>(refinement: (value: S["Type"]) => value is T, annotations?: Annotations.Filter): (schema: S) => refine<T, S>;
|
|
4157
|
-
type
|
|
4157
|
+
type EnsureSingleBrandKey<K extends PropertyKey> = IsUnion<K> extends false ? {} extends Record<K, unknown> ? never : unknown : never;
|
|
4158
|
+
type FromBrandKeys<A extends Brand.Brand<any>> = A extends unknown ? Brand.Brand.Keys<A> : never;
|
|
4158
4159
|
/**
|
|
4159
4160
|
* Type-level representation returned by {@link brand}.
|
|
4160
4161
|
*
|
|
4161
4162
|
* @category branding
|
|
4162
4163
|
* @since 3.10.0
|
|
4163
4164
|
*/
|
|
4164
|
-
export interface brand<S extends Constraint, B> extends BottomLazy<S["ast"], brand<S, B>, S["~type.parameters"], S["~type.mutability"], S["~type.optionality"], S["~type.constructor.default"], S["~encoded.mutability"], S["~encoded.optionality"]> {
|
|
4165
|
-
readonly "Type": S["Type"] &
|
|
4165
|
+
export interface brand<S extends Constraint, B extends string> extends BottomLazy<S["ast"], brand<S, B>, S["~type.parameters"], S["~type.mutability"], S["~type.optionality"], S["~type.constructor.default"], S["~encoded.mutability"], S["~encoded.optionality"]> {
|
|
4166
|
+
readonly "Type": S["Type"] & Brand.Brand<B>;
|
|
4166
4167
|
readonly "Encoded": S["Encoded"];
|
|
4167
4168
|
readonly "DecodingServices": S["DecodingServices"];
|
|
4168
4169
|
readonly "EncodingServices": S["EncodingServices"];
|
|
4169
4170
|
readonly "~type.make.in": S["~type.make.in"];
|
|
4170
|
-
readonly "~type.make": S["Type"] &
|
|
4171
|
-
readonly "Iso": S["Type"] &
|
|
4171
|
+
readonly "~type.make": S["Type"] & Brand.Brand<B>;
|
|
4172
|
+
readonly "Iso": S["Type"] & Brand.Brand<B>;
|
|
4172
4173
|
readonly schema: S;
|
|
4173
4174
|
readonly identifier: string;
|
|
4174
4175
|
}
|
|
4175
4176
|
/**
|
|
4176
|
-
*
|
|
4177
|
-
*
|
|
4177
|
+
* Intersects a schema's output type with `Brand.Brand<B>` to prevent accidental
|
|
4178
|
+
* mixing of structurally identical types.
|
|
4178
4179
|
*
|
|
4179
4180
|
* **When to use**
|
|
4180
4181
|
*
|
|
@@ -4183,25 +4184,42 @@ export interface brand<S extends Constraint, B> extends BottomLazy<S["ast"], bra
|
|
|
4183
4184
|
*
|
|
4184
4185
|
* **Gotchas**
|
|
4185
4186
|
*
|
|
4186
|
-
* `
|
|
4187
|
-
*
|
|
4187
|
+
* - `identifier` must be a single concrete string literal. Widened strings,
|
|
4188
|
+
* unions, and open template literal types are rejected.
|
|
4189
|
+
* - `brand` only narrows the TypeScript output type. It does not change the
|
|
4190
|
+
* schema's runtime AST or add runtime checks.
|
|
4191
|
+
* - Schema representations and generated schema code omit the brand. Reapply
|
|
4192
|
+
* `brand` after rebuilding or generating a schema when the nominal type is
|
|
4193
|
+
* still required.
|
|
4188
4194
|
*
|
|
4189
|
-
* @see {@link fromBrand} for applying a Brand constructor's checks along with
|
|
4195
|
+
* @see {@link fromBrand} for applying a Brand constructor's checks along with its branded type
|
|
4190
4196
|
*
|
|
4191
4197
|
* @category branding
|
|
4192
4198
|
* @since 3.10.0
|
|
4193
4199
|
*/
|
|
4194
|
-
export declare function brand<B extends string>(identifier: B): <S extends ConstraintRebuildable>(schema: S) => brand<S["Rebuild"], B>;
|
|
4200
|
+
export declare function brand<B extends string>(identifier: B & EnsureSingleBrandKey<B>): <S extends ConstraintRebuildable>(schema: S) => brand<S["Rebuild"], B>;
|
|
4195
4201
|
/**
|
|
4196
4202
|
* Creates a branded schema from a {@link Brand.Constructor}, applying the
|
|
4197
|
-
* constructor's checks and
|
|
4203
|
+
* constructor's checks and branded type to the underlying schema.
|
|
4204
|
+
*
|
|
4205
|
+
* **When to use**
|
|
4206
|
+
*
|
|
4207
|
+
* Use to reuse the checks from a constructor with one concrete brand key.
|
|
4208
|
+
*
|
|
4209
|
+
* **Gotchas**
|
|
4210
|
+
*
|
|
4211
|
+
* `identifier` must match the constructor's only brand key. Apply `fromBrand`
|
|
4212
|
+
* repeatedly to compose distinct brands, and use {@link Union} to represent
|
|
4213
|
+
* alternatives.
|
|
4214
|
+
*
|
|
4215
|
+
* @see {@link brand} for adding a brand without constructor checks
|
|
4198
4216
|
*
|
|
4199
4217
|
* @category branding
|
|
4200
4218
|
* @since 3.10.0
|
|
4201
4219
|
*/
|
|
4202
|
-
export declare function fromBrand<A extends Brand.Brand<any>>(identifier: string, ctor: Brand.Constructor<A>): <S extends Top & {
|
|
4220
|
+
export declare function fromBrand<A extends Brand.Brand<any>>(identifier: Brand.Brand.Keys<A> & string, ctor: Brand.Constructor<A> & EnsureSingleBrandKey<FromBrandKeys<A>>): <S extends Top & {
|
|
4203
4221
|
readonly "Type": Brand.Brand.Unbranded<A>;
|
|
4204
|
-
}>(self: S) => brand<S["Rebuild"], Brand
|
|
4222
|
+
}>(self: S) => brand<S["Rebuild"], keyof A["~effect/Brand"] & string>;
|
|
4205
4223
|
/**
|
|
4206
4224
|
* Type-level representation returned by {@link middlewareDecoding}.
|
|
4207
4225
|
*
|
|
@@ -10608,6 +10626,8 @@ export declare function toEquivalence<T>(schema: Schema<T>): Equivalence.Equival
|
|
|
10608
10626
|
* Use {@link toType} before this function to represent the type side instead.
|
|
10609
10627
|
* The optional reference policy controls which candidates are extracted into the document's reference table. By
|
|
10610
10628
|
* default, only candidates with a resolved identifier become references; recursive candidates always require one.
|
|
10629
|
+
* TypeScript-only distinctions such as those added by {@link brand} are not
|
|
10630
|
+
* part of the schema AST and are therefore omitted.
|
|
10611
10631
|
*
|
|
10612
10632
|
* @see {@link SchemaRepresentation.toRepresentation} for converting a `SchemaAST.AST` directly
|
|
10613
10633
|
*
|
|
@@ -11373,8 +11393,8 @@ export declare namespace Annotations {
|
|
|
11373
11393
|
}
|
|
11374
11394
|
/**
|
|
11375
11395
|
* Base annotations shared by all composite schema nodes. Extends
|
|
11376
|
-
* {@link Documentation} with error messages
|
|
11377
|
-
*
|
|
11396
|
+
* {@link Documentation} with error messages and arbitrary generation hooks.
|
|
11397
|
+
* {@link Declaration} and other annotation
|
|
11378
11398
|
* interfaces build on top of this.
|
|
11379
11399
|
*
|
|
11380
11400
|
* @category models
|
|
@@ -11412,10 +11432,6 @@ export declare namespace Annotations {
|
|
|
11412
11432
|
* filter/refinement instead.
|
|
11413
11433
|
*/
|
|
11414
11434
|
readonly identifier?: string | undefined;
|
|
11415
|
-
/**
|
|
11416
|
-
* Accumulated brands when multiple brands are added with `Schema.brand`.
|
|
11417
|
-
*/
|
|
11418
|
-
readonly brands?: ReadonlyArray<string> | undefined;
|
|
11419
11435
|
}
|
|
11420
11436
|
/**
|
|
11421
11437
|
* Helpers for projecting declaration type-parameter schemas into decoded or
|