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

Function makeETag

packages/infra/src/Store/utils.ts:12–19  ·  view source on GitHub ↗
(
  { _etag, ...e }: E
)

Source from the content-addressed store, hash-verified

10}
11
12export const makeETag = <E extends PersistenceModelType<{}>>(
13 { _etag, ...e }: E
14): E =>
15 ({
16 ...e,
17 // we have to hash the JSON, as hashing the object might contain elements that won't be serialized anyway
18 _etag: crypto.createHash("sha256").update(JSON.stringify(e)).digest("hex")
19 }) as any
20
21export const makeUpdateETag = (type: string) =>
22 Effect.fnUntraced(function*<IdKey extends keyof E, E extends PersistenceModelType<{}>>(

Callers 5

toRowFunction · 0.90
toRowFunction · 0.90
toRowFunction · 0.85
sql-store.test.tsFile · 0.85
makeUpdateETagFunction · 0.85

Calls 2

digestMethod · 0.80
updateMethod · 0.45

Tested by 1

toRowFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…