MCPcopy Create free account
hub / github.com/cameri/nostream / toInsertRow

Method toInsertRow

src/repositories/event-repository.ts:252–268  ·  view source on GitHub ↗
(event: Event)

Source from the content-addressed store, hash-verified

250 }
251
252 private toInsertRow(event: Event) {
253 return applySpec({
254 event_id: pipe(prop('id'), toBuffer),
255 event_pubkey: pipe(prop('pubkey'), toBuffer),
256 event_created_at: prop('created_at'),
257 event_kind: prop('kind'),
258 event_tags: pipe(prop('tags'), toJSON),
259 event_content: prop('content'),
260 event_signature: pipe(prop('sig'), toBuffer),
261 remote_address: path([ContextMetadataKey as any, 'remoteAddress', 'address']),
262 expires_at: ifElse(
263 propSatisfies(is(Number), EventExpirationTimeMetadataKey),
264 prop(EventExpirationTimeMetadataKey as any),
265 always(null),
266 ),
267 })(event)
268 }
269
270 private insert(event: Event) {
271 logger('inserting event: %o', event)

Callers 2

createManyMethod · 0.95
insertMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected