( repo: Repository<T, Encoded, Evt, ItemType, IdKey, RSchema, RPublish, RProvided> )
| 32 | : undefined |
| 33 | |
| 34 | export const extendRepo = < |
| 35 | T, |
| 36 | Encoded extends FieldValues, |
| 37 | Evt, |
| 38 | ItemType extends string, |
| 39 | IdKey extends keyof T & keyof Encoded, |
| 40 | RSchema, |
| 41 | RPublish, |
| 42 | RProvided = never |
| 43 | >( |
| 44 | repo: Repository<T, Encoded, Evt, ItemType, IdKey, RSchema, RPublish, RProvided> |
| 45 | ) => { |
| 46 | const get = (id: T[IdKey]) => |
| 47 | repo.find(id).pipe( |
| 48 | Effect.flatMap(Option.match({ |
| 49 | onNone: () => Effect.fail(new NotFoundError<ItemType>({ type: repo.itemType, id })), |
| 50 | onSome: Effect.succeed |
| 51 | })) |
| 52 | ) |
| 53 | function saveManyWithPure_< |
| 54 | R, |
| 55 | A, |
| 56 | E, |
| 57 | S1 extends T, |
| 58 | S2 extends T |
| 59 | >( |
| 60 | items: Iterable<S1>, |
| 61 | pure: Effect.Effect<A, E, FixEnv<R, Evt, readonly S1[], readonly S2[]>> |
| 62 | ) { |
| 63 | return saveAllWithEffectInt( |
| 64 | runTerm(pure, [...items]) |
| 65 | ) |
| 66 | } |
| 67 | |
| 68 | function saveWithPure_< |
| 69 | R, |
| 70 | A, |
| 71 | E, |
| 72 | S1 extends T, |
| 73 | S2 extends T |
| 74 | >( |
| 75 | item: S1, |
| 76 | pure: Effect.Effect<A, E, FixEnv<R, Evt, S1, S2>> |
| 77 | ) { |
| 78 | return saveAllWithEffectInt( |
| 79 | runTerm(pure, item) |
| 80 | .pipe(Effect |
| 81 | .map(([item, events, a]) => [[item], events, a])) |
| 82 | ) |
| 83 | } |
| 84 | |
| 85 | function saveAllWithEffectInt< |
| 86 | P extends T, |
| 87 | R, |
| 88 | E, |
| 89 | A |
| 90 | >( |
| 91 | gen: Effect.Effect<readonly [Iterable<P>, Iterable<Evt>, A], E, R> |
no test coverage detected
searching dependent graphs…