effect-machine 0.15.0 → 0.15.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.
Files changed (2) hide show
  1. package/dist/schema.d.ts +9 -4
  2. package/package.json +1 -1
package/dist/schema.d.ts CHANGED
@@ -12,14 +12,19 @@ type ReplySchemaSymbol = typeof ReplySchemaSymbol;
12
12
  type ReplyFields<F extends Schema.Struct.Fields, RS extends Schema.Schema<unknown>> = F & {
13
13
  readonly [ReplySchemaSymbol]: RS;
14
14
  };
15
+ /**
16
+ * Payload fields that actually flow through constructors and runtime values.
17
+ * Reply schema metadata is type-only and must not leak into payload shapes.
18
+ */
19
+ type PayloadFields<F extends Schema.Struct.Fields> = { readonly [K in keyof F as K extends ReplySchemaSymbol ? never : K]: F[K] };
15
20
  /**
16
21
  * Extract the TypeScript type from a TaggedStruct schema
17
22
  */
18
- type TaggedStructType<Tag extends string, Fields extends Schema.Struct.Fields> = Schema.Schema.Type<Schema.TaggedStruct<Tag, Fields>>;
23
+ type TaggedStructType<Tag extends string, Fields extends Schema.Struct.Fields> = Schema.Schema.Type<Schema.TaggedStruct<Tag, PayloadFields<Fields>>>;
19
24
  /**
20
25
  * Build variant schemas type from definition
21
26
  */
22
- type VariantSchemas<D extends Record<string, Schema.Struct.Fields>> = { readonly [K in keyof D & string]: Schema.TaggedStruct<K, D[K]> };
27
+ type VariantSchemas<D extends Record<string, Schema.Struct.Fields>> = { readonly [K in keyof D & string]: Schema.TaggedStruct<K, PayloadFields<D[K]>> };
23
28
  /**
24
29
  * Build union type from variant schemas.
25
30
  * Reply-bearing variants carry ReplyTypeBrand<R> for ask() inference.
@@ -50,8 +55,8 @@ type VariantReplyBrand<Fields extends Schema.Struct.Fields> = Fields extends {
50
55
  */
51
56
  type VariantConstructors<D extends Record<string, Schema.Struct.Fields>, Brand> = { readonly [K in keyof D & string]: IsEmptyFields<D[K]> extends true ? TaggedStructType<K, D[K]> & Brand & VariantReplyBrand<D[K]> & {
52
57
  readonly derive: (source: object) => TaggedStructType<K, D[K]> & Brand;
53
- } : ((args: Schema.Struct.Type<D[K]>) => TaggedStructType<K, D[K]> & Brand & VariantReplyBrand<D[K]>) & {
54
- readonly derive: (source: object, partial?: Partial<Schema.Struct.Type<D[K]>>) => TaggedStructType<K, D[K]> & Brand;
58
+ } : ((args: Schema.Struct.Type<PayloadFields<D[K]>>) => TaggedStructType<K, D[K]> & Brand & VariantReplyBrand<D[K]>) & {
59
+ readonly derive: (source: object, partial?: Partial<Schema.Struct.Type<PayloadFields<D[K]>>>) => TaggedStructType<K, D[K]> & Brand;
55
60
  readonly _tag: K;
56
61
  } };
57
62
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "effect-machine",
3
- "version": "0.15.0",
3
+ "version": "0.15.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/cevr/effect-machine.git"