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

Function toRow

packages/infra/test/sql-store.test.ts:1573–1579  ·  view source on GitHub ↗
(e: any, idKey: IdKey)

Source from the content-addressed store, hash-verified

1571describe("toRow strips _etag and id from data", () => {
1572 // Replicate the toRow logic from SQL.ts to test in isolation
1573 const toRow = <IdKey extends PropertyKey>(e: any, idKey: IdKey) => {
1574 const newE = makeETag(e)
1575 const id = newE[idKey] as string
1576 const { _etag, [idKey]: _id, ...rest } = newE as any
1577 const data = JSON.stringify(rest)
1578 return { id, _etag: newE._etag!, data, item: newE }
1579 }
1580
1581 it("data JSON does not contain _etag", () => {
1582 const row = toRow({ id: "1", _etag: undefined, name: "Alice", age: 30 }, "id")

Callers 1

sql-store.test.tsFile · 0.70

Calls 1

makeETagFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…