(event: Event)
| 339 | } |
| 340 | |
| 341 | private toUpsertRow(event: Event) { |
| 342 | const toJSON = (input: any) => JSON.stringify(input) |
| 343 | |
| 344 | return applySpec<DBEvent>({ |
| 345 | event_id: pipe(prop('id'), toBuffer), |
| 346 | event_pubkey: pipe(prop('pubkey'), toBuffer), |
| 347 | event_created_at: prop('created_at'), |
| 348 | event_kind: prop('kind'), |
| 349 | event_tags: pipe(prop('tags'), toJSON), |
| 350 | event_content: prop('content'), |
| 351 | event_signature: pipe(prop('sig'), toBuffer), |
| 352 | event_deduplication: ifElse( |
| 353 | propSatisfies(isNil, EventDeduplicationMetadataKey), |
| 354 | pipe(paths([['pubkey'], ['kind']]), toJSON), |
| 355 | pipe(prop(EventDeduplicationMetadataKey as any), toJSON), |
| 356 | ), |
| 357 | remote_address: path([ContextMetadataKey as any, 'remoteAddress', 'address']), |
| 358 | expires_at: ifElse( |
| 359 | propSatisfies(is(Number), EventExpirationTimeMetadataKey), |
| 360 | prop(EventExpirationTimeMetadataKey as any), |
| 361 | always(null), |
| 362 | ), |
| 363 | deleted_at: always(null), |
| 364 | })(event) |
| 365 | } |
| 366 | |
| 367 | public deleteByPubkeyAndIds(pubkey: string, eventIdsToDelete: EventId[]): Promise<number> { |
| 368 | logger('deleting events from %s: %o', pubkey, eventIdsToDelete) |
no outgoing calls
no test coverage detected