@effect/cluster 0.40.0 → 0.41.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 (39) hide show
  1. package/dist/cjs/ClusterWorkflowEngine.js +12 -5
  2. package/dist/cjs/ClusterWorkflowEngine.js.map +1 -1
  3. package/dist/cjs/Entity.js.map +1 -1
  4. package/dist/cjs/EntityProxy.js +2 -3
  5. package/dist/cjs/EntityProxy.js.map +1 -1
  6. package/dist/cjs/EntityProxyServer.js +2 -3
  7. package/dist/cjs/EntityProxyServer.js.map +1 -1
  8. package/dist/cjs/Sharding.js +16 -8
  9. package/dist/cjs/Sharding.js.map +1 -1
  10. package/dist/cjs/internal/entityManager.js.map +1 -1
  11. package/dist/dts/ClusterWorkflowEngine.d.ts.map +1 -1
  12. package/dist/dts/Entity.d.ts +15 -15
  13. package/dist/dts/Entity.d.ts.map +1 -1
  14. package/dist/dts/EntityProxy.d.ts +3 -5
  15. package/dist/dts/EntityProxy.d.ts.map +1 -1
  16. package/dist/dts/EntityProxyServer.d.ts +3 -5
  17. package/dist/dts/EntityProxyServer.d.ts.map +1 -1
  18. package/dist/dts/Sharding.d.ts +2 -2
  19. package/dist/dts/Sharding.d.ts.map +1 -1
  20. package/dist/dts/ShardingRegistrationEvent.d.ts +1 -1
  21. package/dist/dts/ShardingRegistrationEvent.d.ts.map +1 -1
  22. package/dist/esm/ClusterWorkflowEngine.js +12 -5
  23. package/dist/esm/ClusterWorkflowEngine.js.map +1 -1
  24. package/dist/esm/Entity.js.map +1 -1
  25. package/dist/esm/EntityProxy.js +2 -3
  26. package/dist/esm/EntityProxy.js.map +1 -1
  27. package/dist/esm/EntityProxyServer.js +2 -3
  28. package/dist/esm/EntityProxyServer.js.map +1 -1
  29. package/dist/esm/Sharding.js +16 -8
  30. package/dist/esm/Sharding.js.map +1 -1
  31. package/dist/esm/internal/entityManager.js.map +1 -1
  32. package/package.json +5 -5
  33. package/src/ClusterWorkflowEngine.ts +18 -6
  34. package/src/Entity.ts +30 -26
  35. package/src/EntityProxy.ts +8 -12
  36. package/src/EntityProxyServer.ts +7 -9
  37. package/src/Sharding.ts +30 -22
  38. package/src/ShardingRegistrationEvent.ts +1 -1
  39. package/src/internal/entityManager.ts +3 -2
package/src/Entity.ts CHANGED
@@ -6,6 +6,7 @@ import * as RpcClient from "@effect/rpc/RpcClient"
6
6
  import * as RpcGroup from "@effect/rpc/RpcGroup"
7
7
  import * as RpcServer from "@effect/rpc/RpcServer"
8
8
  import * as Arr from "effect/Array"
9
+ import type { Brand } from "effect/Brand"
9
10
  import type * as Cause from "effect/Cause"
10
11
  import * as Context from "effect/Context"
11
12
  import * as Data from "effect/Data"
@@ -58,12 +59,15 @@ export type TypeId = typeof TypeId
58
59
  * @since 1.0.0
59
60
  * @category models
60
61
  */
61
- export interface Entity<in out Rpcs extends Rpc.Any> extends Equal.Equal {
62
+ export interface Entity<
63
+ in out Type extends string,
64
+ in out Rpcs extends Rpc.Any
65
+ > extends Equal.Equal {
62
66
  readonly [TypeId]: TypeId
63
67
  /**
64
68
  * The name of the entity type.
65
69
  */
66
- readonly type: EntityType
70
+ readonly type: Type & Brand<"EntityType">
67
71
 
68
72
  /**
69
73
  * A RpcGroup definition for messages which represents the messaging protocol
@@ -84,22 +88,22 @@ export interface Entity<in out Rpcs extends Rpc.Any> extends Equal.Equal {
84
88
  /**
85
89
  * Annotate the entity with a value.
86
90
  */
87
- annotate<I, S>(tag: Context.Tag<I, S>, value: S): Entity<Rpcs>
91
+ annotate<I, S>(tag: Context.Tag<I, S>, value: S): Entity<Type, Rpcs>
88
92
 
89
93
  /**
90
94
  * Annotate the Rpc's above this point with a value.
91
95
  */
92
- annotateRpcs<I, S>(tag: Context.Tag<I, S>, value: S): Entity<Rpcs>
96
+ annotateRpcs<I, S>(tag: Context.Tag<I, S>, value: S): Entity<Type, Rpcs>
93
97
 
94
98
  /**
95
99
  * Annotate the entity with a context object.
96
100
  */
97
- annotateContext<S>(context: Context.Context<S>): Entity<Rpcs>
101
+ annotateContext<S>(context: Context.Context<S>): Entity<Type, Rpcs>
98
102
 
99
103
  /**
100
104
  * Annotate the Rpc's above this point with a context object.
101
105
  */
102
- annotateRpcsContext<S>(context: Context.Context<S>): Entity<Rpcs>
106
+ annotateRpcsContext<S>(context: Context.Context<S>): Entity<Type, Rpcs>
103
107
 
104
108
  /**
105
109
  * Create a client for this entity.
@@ -188,7 +192,7 @@ export interface Entity<in out Rpcs extends Rpc.Any> extends Equal.Equal {
188
192
  * @since 1.0.0
189
193
  * @category models
190
194
  */
191
- export type Any = Entity<Rpc.Any>
195
+ export type Any = Entity<string, Rpc.Any>
192
196
 
193
197
  /**
194
198
  * @since 1.0.0
@@ -208,25 +212,25 @@ export const isEntity = (u: unknown): u is Any => Predicate.hasProperty(u, TypeI
208
212
 
209
213
  const Proto = {
210
214
  [TypeId]: TypeId,
211
- [Hash.symbol](this: Entity<any>): number {
215
+ [Hash.symbol](this: Entity<string, any>): number {
212
216
  return Hash.structure({ type: this.type })
213
217
  },
214
- [Equal.symbol](this: Entity<any>, that: Equal.Equal): boolean {
218
+ [Equal.symbol](this: Entity<string, any>, that: Equal.Equal): boolean {
215
219
  return isEntity(that) && this.type === that.type
216
220
  },
217
- annotate<I, S>(this: Entity<any>, tag: Context.Tag<I, S>, value: S) {
221
+ annotate<I, S>(this: Entity<string, any>, tag: Context.Tag<I, S>, value: S) {
218
222
  return fromRpcGroup(this.type, this.protocol.annotate(tag, value))
219
223
  },
220
- annotateRpcs<I, S>(this: Entity<any>, tag: Context.Tag<I, S>, value: S) {
224
+ annotateRpcs<I, S>(this: Entity<string, any>, tag: Context.Tag<I, S>, value: S) {
221
225
  return fromRpcGroup(this.type, this.protocol.annotateRpcs(tag, value))
222
226
  },
223
- annotateContext<S>(this: Entity<any>, context: Context.Context<S>) {
227
+ annotateContext<S>(this: Entity<string, any>, context: Context.Context<S>) {
224
228
  return fromRpcGroup(this.type, this.protocol.annotateContext(context))
225
229
  },
226
- annotateRpcsContext<S>(this: Entity<any>, context: Context.Context<S>) {
230
+ annotateRpcsContext<S>(this: Entity<string, any>, context: Context.Context<S>) {
227
231
  return fromRpcGroup(this.type, this.protocol.annotateRpcsContext(context))
228
232
  },
229
- getShardId(this: Entity<any>, entityId: EntityId) {
233
+ getShardId(this: Entity<string, any>, entityId: EntityId) {
230
234
  return Effect.map(shardingTag, (sharding) => sharding.getShardId(entityId, this.getShardGroup(entityId)))
231
235
  },
232
236
  get client() {
@@ -239,7 +243,7 @@ const Proto = {
239
243
  Handlers extends HandlersFrom<Rpcs>,
240
244
  RX = never
241
245
  >(
242
- this: Entity<Rpcs>,
246
+ this: Entity<string, Rpcs>,
243
247
  build: Handlers | Effect.Effect<Handlers, never, RX>,
244
248
  options?: {
245
249
  readonly maxIdleTime?: DurationInput | undefined
@@ -275,7 +279,7 @@ const Proto = {
275
279
  R,
276
280
  RX = never
277
281
  >(
278
- this: Entity<Rpcs>,
282
+ this: Entity<string, Rpcs>,
279
283
  build:
280
284
  | ((
281
285
  mailbox: Mailbox.ReadonlyMailbox<Envelope.Request<Rpcs>>,
@@ -360,17 +364,17 @@ const Proto = {
360
364
  * @since 1.0.0
361
365
  * @category constructors
362
366
  */
363
- export const fromRpcGroup = <Rpcs extends Rpc.Any>(
367
+ export const fromRpcGroup = <const Type extends string, Rpcs extends Rpc.Any>(
364
368
  /**
365
369
  * The entity type name.
366
370
  */
367
- type: string,
371
+ type: Type,
368
372
  /**
369
373
  * The schema definition for messages that the entity is capable of
370
374
  * processing.
371
375
  */
372
376
  protocol: RpcGroup.RpcGroup<Rpcs>
373
- ): Entity<Rpcs> => {
377
+ ): Entity<Type, Rpcs> => {
374
378
  const self = Object.create(Proto)
375
379
  self.type = EntityType.make(type)
376
380
  self.protocol = protocol
@@ -385,17 +389,17 @@ export const fromRpcGroup = <Rpcs extends Rpc.Any>(
385
389
  * @since 1.0.0
386
390
  * @category constructors
387
391
  */
388
- export const make = <Rpcs extends ReadonlyArray<Rpc.Any>>(
392
+ export const make = <const Type extends string, Rpcs extends ReadonlyArray<Rpc.Any>>(
389
393
  /**
390
394
  * The entity type name.
391
395
  */
392
- type: string,
396
+ type: Type,
393
397
  /**
394
398
  * The schema definition for messages that the entity is capable of
395
399
  * processing.
396
400
  */
397
401
  protocol: Rpcs
398
- ): Entity<Rpcs[number]> => fromRpcGroup(type, RpcGroup.make(...protocol))
402
+ ): Entity<Type, Rpcs[number]> => fromRpcGroup(type, RpcGroup.make(...protocol))
399
403
 
400
404
  /**
401
405
  * A Context.Tag to access the current entity address.
@@ -492,15 +496,15 @@ const shardingTag = Context.GenericTag<Sharding, Sharding["Type"]>("@effect/clus
492
496
  * @since 1.0.0
493
497
  * @category Testing
494
498
  */
495
- export const makeTestClient: <Rpcs extends Rpc.Any, LA, LE, LR>(
496
- entity: Entity<Rpcs>,
499
+ export const makeTestClient: <Type extends string, Rpcs extends Rpc.Any, LA, LE, LR>(
500
+ entity: Entity<Type, Rpcs>,
497
501
  layer: Layer.Layer<LA, LE, LR>
498
502
  ) => Effect.Effect<
499
503
  (entityId: string) => Effect.Effect<RpcClient.RpcClient<Rpcs>>,
500
504
  LE,
501
505
  Scope | ShardingConfig | Exclude<LR, Sharding> | Rpc.MiddlewareClient<Rpcs>
502
- > = Effect.fnUntraced(function*<Rpcs extends Rpc.Any, LA, LE, LR>(
503
- entity: Entity<Rpcs>,
506
+ > = Effect.fnUntraced(function*<Type extends string, Rpcs extends Rpc.Any, LA, LE, LR>(
507
+ entity: Entity<Type, Rpcs>,
504
508
  layer: Layer.Layer<LA, LE, LR>
505
509
  ) {
506
510
  const config = yield* ShardingConfig
@@ -45,13 +45,9 @@ const clientErrors = [
45
45
  * @since 1.0.0
46
46
  * @category Constructors
47
47
  */
48
- export const toRpcGroup = <Rpcs extends Rpc.Any, const Prefix extends string = "">(
49
- entity: Entity.Entity<Rpcs>,
50
- options?: {
51
- readonly prefix?: Prefix | undefined
52
- }
53
- ): RpcGroup.RpcGroup<ConvertRpcs<Rpcs, Prefix>> => {
54
- const prefix = options?.prefix ?? ""
48
+ export const toRpcGroup = <Type extends string, Rpcs extends Rpc.Any>(
49
+ entity: Entity.Entity<Type, Rpcs>
50
+ ): RpcGroup.RpcGroup<ConvertRpcs<Rpcs, Type>> => {
55
51
  const rpcs: Array<Rpc.Any> = []
56
52
  for (const parentRpc_ of entity.protocol.requests.values()) {
57
53
  const parentRpc = parentRpc_ as any as Rpc.AnyWithProps
@@ -66,14 +62,14 @@ export const toRpcGroup = <Rpcs extends Rpc.Any, const Prefix extends string = "
66
62
  payload: parentRpc.payloadSchema.make ? parentRpc.payloadSchema.make(input.payload, options) : input.payload
67
63
  }, options)
68
64
  }
69
- const rpc = Rpc.make(`${prefix}${parentRpc._tag}`, {
65
+ const rpc = Rpc.make(`${entity.type}.${parentRpc._tag}`, {
70
66
  payload: payloadSchema,
71
67
  error: Schema.Union(parentRpc.errorSchema, ...clientErrors),
72
68
  success: parentRpc.successSchema
73
69
  }).annotateContext(parentRpc.annotations)
74
70
  rpcs.push(rpc)
75
71
  }
76
- return RpcGroup.make(...rpcs) as any as RpcGroup.RpcGroup<ConvertRpcs<Rpcs, Prefix>>
72
+ return RpcGroup.make(...rpcs) as any as RpcGroup.RpcGroup<ConvertRpcs<Rpcs, Type>>
77
73
  }
78
74
 
79
75
  /**
@@ -86,7 +82,7 @@ export type ConvertRpcs<Rpcs extends Rpc.Any, Prefix extends string> = Rpcs exte
86
82
  infer _Error,
87
83
  infer _Middleware
88
84
  > ? Rpc.Rpc<
89
- `${Prefix}${_Tag}`,
85
+ `${Prefix}.${_Tag}`,
90
86
  Schema.Struct<{
91
87
  entityId: typeof Schema.String
92
88
  payload: _Payload
@@ -144,9 +140,9 @@ const entityIdPath = Schema.Struct({
144
140
  * @since 1.0.0
145
141
  * @category Constructors
146
142
  */
147
- export const toHttpApiGroup = <const Name extends string, Rpcs extends Rpc.Any>(
143
+ export const toHttpApiGroup = <const Name extends string, Type extends string, Rpcs extends Rpc.Any>(
148
144
  name: Name,
149
- entity: Entity.Entity<Rpcs>
145
+ entity: Entity.Entity<Type, Rpcs>
150
146
  ): HttpApiGroup.HttpApiGroup<Name, ConvertHttpApi<Rpcs>> => {
151
147
  let group = HttpApiGroup.make(name)
152
148
  for (const parentRpc_ of entity.protocol.requests.values()) {
@@ -21,11 +21,12 @@ export const layerHttpApi = <
21
21
  ApiE,
22
22
  ApiR,
23
23
  Name extends HttpApiGroup.Name<Groups>,
24
+ Type extends string,
24
25
  Rpcs extends Rpc.Any
25
26
  >(
26
27
  api: HttpApi.HttpApi<ApiId, Groups, ApiE, ApiR>,
27
28
  name: Name,
28
- entity: Entity.Entity<Rpcs>
29
+ entity: Entity.Entity<Type, Rpcs>
29
30
  ): Layer.Layer<ApiGroup<ApiId, Name>, never, Sharding | Rpc.Context<Rpcs>> =>
30
31
  HttpApiBuilder.group(
31
32
  api,
@@ -50,19 +51,16 @@ export const layerHttpApi = <
50
51
  * @category Layers
51
52
  */
52
53
  export const layerRpcHandlers = <
53
- Rpcs extends Rpc.Any,
54
- const Prefix extends string = ""
55
- >(entity: Entity.Entity<Rpcs>, options?: {
56
- readonly prefix?: Prefix
57
- }): Layer.Layer<RpcHandlers<Rpcs, Prefix>, never, Sharding | Rpc.Context<Rpcs>> =>
54
+ const Type extends string,
55
+ Rpcs extends Rpc.Any
56
+ >(entity: Entity.Entity<Type, Rpcs>): Layer.Layer<RpcHandlers<Rpcs, Type>, never, Sharding | Rpc.Context<Rpcs>> =>
58
57
  Layer.effectContext(Effect.gen(function*() {
59
58
  const context = yield* Effect.context<never>()
60
- const prefix = options?.prefix ?? ""
61
59
  const client = yield* entity.client
62
60
  const handlers = new Map<string, Rpc.Handler<string>>()
63
61
  for (const parentRpc_ of entity.protocol.requests.values()) {
64
62
  const parentRpc = parentRpc_ as any as Rpc.AnyWithProps
65
- const tag = `${prefix}${parentRpc._tag}` as const
63
+ const tag = `${entity.type}.${parentRpc._tag}` as const
66
64
  const key = `@effect/rpc/Rpc/${tag}`
67
65
  handlers.set(key, {
68
66
  context,
@@ -82,5 +80,5 @@ export type RpcHandlers<Rpcs extends Rpc.Any, Prefix extends string> = Rpcs exte
82
80
  infer _Success,
83
81
  infer _Error,
84
82
  infer _Middleware
85
- > ? Rpc.Handler<`${Prefix}${_Tag}`>
83
+ > ? Rpc.Handler<`${Prefix}.${_Tag}`>
86
84
  : never
package/src/Sharding.ts CHANGED
@@ -40,7 +40,6 @@ import { Persisted, Uninterruptible } from "./ClusterSchema.js"
40
40
  import type { CurrentAddress, CurrentRunnerAddress, Entity, HandlersFrom } from "./Entity.js"
41
41
  import { EntityAddress } from "./EntityAddress.js"
42
42
  import { EntityId } from "./EntityId.js"
43
- import type { EntityType } from "./EntityType.js"
44
43
  import * as Envelope from "./Envelope.js"
45
44
  import * as EntityManager from "./internal/entityManager.js"
46
45
  import { EntityReaper } from "./internal/entityReaper.js"
@@ -86,8 +85,8 @@ export class Sharding extends Context.Tag("@effect/cluster/Sharding")<Sharding,
86
85
  * Constructs a `RpcClient` which can be used to send messages to the
87
86
  * specified `Entity`.
88
87
  */
89
- readonly makeClient: <Rpcs extends Rpc.Any>(
90
- entity: Entity<Rpcs>
88
+ readonly makeClient: <Type extends string, Rpcs extends Rpc.Any>(
89
+ entity: Entity<Type, Rpcs>
91
90
  ) => Effect.Effect<
92
91
  (
93
92
  entityId: string
@@ -97,8 +96,8 @@ export class Sharding extends Context.Tag("@effect/cluster/Sharding")<Sharding,
97
96
  /**
98
97
  * Registers a new entity with the runner.
99
98
  */
100
- readonly registerEntity: <Rpcs extends Rpc.Any, Handlers extends HandlersFrom<Rpcs>, RX>(
101
- entity: Entity<Rpcs>,
99
+ readonly registerEntity: <Type extends string, Rpcs extends Rpc.Any, Handlers extends HandlersFrom<Rpcs>, RX>(
100
+ entity: Entity<Type, Rpcs>,
102
101
  handlers: Effect.Effect<Handlers, never, RX>,
103
102
  options?: {
104
103
  readonly maxIdleTime?: DurationInput | undefined
@@ -173,7 +172,7 @@ export class Sharding extends Context.Tag("@effect/cluster/Sharding")<Sharding,
173
172
  // -----------------------------------------------------------------------------
174
173
 
175
174
  interface EntityManagerState {
176
- readonly entity: Entity<any>
175
+ readonly entity: Entity<any, any>
177
176
  readonly scope: Scope.CloseableScope
178
177
  readonly manager: EntityManager.EntityManager
179
178
  }
@@ -191,7 +190,7 @@ const make = Effect.gen(function*() {
191
190
  const storageEnabled = storage !== MessageStorage.noop
192
191
  const shardStorage = yield* ShardStorage
193
192
 
194
- const entityManagers = new Map<EntityType, EntityManagerState>()
193
+ const entityManagers = new Map<string, EntityManagerState>()
195
194
 
196
195
  const shardAssignments = MutableHashMap.empty<ShardId, RunnerAddress>()
197
196
  const selfShards = MutableHashSet.empty<ShardId>()
@@ -939,13 +938,13 @@ const make = Effect.gen(function*() {
939
938
  const clientRequests = new Map<Snowflake.Snowflake, ClientRequestEntry>()
940
939
 
941
940
  const clients: ResourceMap<
942
- Entity<any>,
941
+ Entity<any, any>,
943
942
  (entityId: string) => RpcClient.RpcClient<
944
943
  any,
945
944
  MailboxFull | AlreadyProcessingMessage | EntityNotManagedByRunner
946
945
  >,
947
946
  never
948
- > = yield* ResourceMap.make(Effect.fnUntraced(function*(entity: Entity<any>) {
947
+ > = yield* ResourceMap.make(Effect.fnUntraced(function*(entity: Entity<string, any>) {
949
948
  const client = yield* RpcClient.makeNoSerialization(entity.protocol, {
950
949
  spanPrefix: `${entity.type}.client`,
951
950
  supportsAck: true,
@@ -1041,20 +1040,29 @@ const make = Effect.gen(function*() {
1041
1040
  }
1042
1041
  })
1043
1042
 
1044
- const wrappedClient: any = {}
1045
- for (const method of Object.keys(client.client)) {
1046
- wrappedClient[method] = function(this: any, payload: any, options?: {
1047
- readonly context?: Context.Context<never>
1048
- }) {
1049
- return (client as any).client[method](payload, {
1050
- ...options,
1051
- context: options?.context
1052
- ? Context.merge(options.context, this[currentClientAddress])
1053
- : this[currentClientAddress]
1054
- })
1043
+ function patchClient(client: any): any {
1044
+ const wrappedClient: any = {}
1045
+ for (const method of Object.keys(client.client)) {
1046
+ if (typeof client.client[method] === "object") {
1047
+ wrappedClient[method] = patchClient(client.client[method])
1048
+ continue
1049
+ }
1050
+ wrappedClient[method] = function(this: any, payload: any, options?: {
1051
+ readonly context?: Context.Context<never>
1052
+ }) {
1053
+ return (client as any).client[method](payload, {
1054
+ ...options,
1055
+ context: options?.context
1056
+ ? Context.merge(options.context, this[currentClientAddress])
1057
+ : this[currentClientAddress]
1058
+ })
1059
+ }
1055
1060
  }
1061
+ return wrappedClient
1056
1062
  }
1057
1063
 
1064
+ const wrappedClient = patchClient(client)
1065
+
1058
1066
  yield* Scope.addFinalizer(
1059
1067
  yield* Effect.scope,
1060
1068
  Effect.withFiberRuntime((fiber) => {
@@ -1076,9 +1084,9 @@ const make = Effect.gen(function*() {
1076
1084
  }
1077
1085
  }))
1078
1086
 
1079
- const makeClient = <Rpcs extends Rpc.Any>(entity: Entity<Rpcs>): Effect.Effect<
1087
+ const makeClient = <Type extends string, Rpcs extends Rpc.Any>(entity: Entity<Type, Rpcs>): Effect.Effect<
1080
1088
  (entityId: string) => RpcClient.RpcClient<Rpcs, MailboxFull | AlreadyProcessingMessage | EntityNotManagedByRunner>
1081
- > => clients.get(entity)
1089
+ > => clients.get(entity) as any
1082
1090
 
1083
1091
  const clientRespondDiscard = (_reply: Reply.Reply<any>) => Effect.void
1084
1092
 
@@ -23,7 +23,7 @@ export type ShardingRegistrationEvent =
23
23
  */
24
24
  export interface EntityRegistered {
25
25
  readonly _tag: "EntityRegistered"
26
- readonly entity: Entity<any>
26
+ readonly entity: Entity<any, any>
27
27
  }
28
28
 
29
29
  /**
@@ -75,11 +75,12 @@ export type EntityState = {
75
75
 
76
76
  /** @internal */
77
77
  export const make = Effect.fnUntraced(function*<
78
+ Type extends string,
78
79
  Rpcs extends Rpc.Any,
79
80
  Handlers extends HandlersFrom<Rpcs>,
80
81
  RX
81
82
  >(
82
- entity: Entity<Rpcs>,
83
+ entity: Entity<Type, Rpcs>,
83
84
  buildHandlers: Effect.Effect<Handlers, never, RX>,
84
85
  options: {
85
86
  readonly sharding: Sharding["Type"]
@@ -501,7 +502,7 @@ const defaultRetryPolicy = Schedule.exponential(500, 1.5).pipe(
501
502
  Schedule.union(Schedule.spaced("10 seconds"))
502
503
  )
503
504
 
504
- const makeMessageSchema = <Rpcs extends Rpc.Any>(entity: Entity<Rpcs>): Schema.Schema<
505
+ const makeMessageSchema = <Type extends string, Rpcs extends Rpc.Any>(entity: Entity<Type, Rpcs>): Schema.Schema<
505
506
  {
506
507
  readonly _tag: "IncomingRequest"
507
508
  readonly envelope: Envelope.Request.Any