| 12 | } |
| 13 | |
| 14 | export function attachWith<A, E, R>(effect: Effect.Effect<A, E, R>, refs: Refs): Effect.Effect<A, E, R> { |
| 15 | if (!refs.instance && !refs.workspace) return effect |
| 16 | if (!refs.instance) return effect.pipe(Effect.provideService(WorkspaceRef, refs.workspace)) |
| 17 | if (!refs.workspace) return effect.pipe(Effect.provideService(InstanceRef, refs.instance)) |
| 18 | return effect.pipe( |
| 19 | Effect.provideService(InstanceRef, refs.instance), |
| 20 | Effect.provideService(WorkspaceRef, refs.workspace), |
| 21 | ) |
| 22 | } |
| 23 | |
| 24 | export function attach<A, E, R>(effect: Effect.Effect<A, E, R>): Effect.Effect<A, E, R> { |
| 25 | const workspace = WorkspaceContext.workspaceID |