MCPcopy Create free account
hub / github.com/effect-app/libs / makeRepo

Function makeRepo

packages/effect-app/src/Model/Repository/makeRepo.ts:113–145  ·  view source on GitHub ↗
(
  itemType: ItemType,
  schema: S.Codec<T, Encoded, RSchema>,
  options: Omit<RepositoryOptions<IdKey, Encoded, T, ItemType, Evt, RPublish, E, RInitial, RCtx, RSchema>, "idKey"> & {
    idKey?: IdKey
  }
)

Source from the content-addressed store, hash-verified

111 Evt = never,
112 RInitial = never,
113 RPublish = never,
114 RCtx = never
115 >(
116 itemType: ItemType,
117 schema: S.Codec<T, Encoded, RSchema>,
118 options: Omit<RepositoryOptions<"id", Encoded, T, ItemType, Evt, RPublish, E, RInitial, RCtx, RSchema>, "idKey">
119 ): Effect.Effect<
120 ExtendedRepository<T, Encoded, Evt, ItemType, "id", Exclude<RSchema, RCtx>, RPublish, RCtx>,
121 E,
122 RInitial | StoreMaker | RepositoryRegistry | Scope.Scope
123 >
124} = <
125 ItemType extends string,
126 RSchema,
127 Encoded extends FieldValues,
128 T,
129 IdKey extends keyof T & keyof Encoded,
130 E = never,
131 RInitial = never,
132 RPublish = never,
133 Evt = never,
134 RCtx = never
135>(
136 itemType: ItemType,
137 schema: S.Codec<T, Encoded, RSchema>,
138 options: Omit<RepositoryOptions<IdKey, Encoded, T, ItemType, Evt, RPublish, E, RInitial, RCtx, RSchema>, "idKey"> & {
139 idKey?: IdKey
140 }
141) =>
142 Effect.gen(function*() {
143 const mkRepo = makeRepoInternal<Evt>()(
144 itemType,
145 schema,
146 options?.jitM ? (pm) => options.jitM!(pm) : (pm) => pm,
147 (e, _etag) => ({ ...e, _etag }),
148 options.idKey ?? "id" as any

Callers 11

SomethingRepoClass · 0.90
query.test.tsFile · 0.90
SomethingRepoClass · 0.90
OrderRepoClass · 0.90
RepoItemsClass · 0.90
OtherItemsClass · 0.90
SomethingRepoClass · 0.90
RepoItemsClass · 0.90
OtherItemsClass · 0.90

Calls 4

makeRepoInternalFunction · 0.90
extendRepoFunction · 0.90
registerMethod · 0.80
makeMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…