session replay updates. add clickhouse implementation, filters, tables
This commit is contained in:
1 parent
e9ac09ec5d
commit
5e68661c5d
23 files changed
+359
-150
No files matched your search
@@ -3,6 +3,7 @@ export * from './link';
|
||||
export * from './pixel';
|
||||
export * from './report';
|
||||
export * from './segment';
|
||||
export * from './sessionReplay';
|
||||
export * from './share';
|
||||
export * from './team';
|
||||
export * from './teamUser';
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
import { uuid } from '@/lib/crypto';
|
||||
import prisma from '@/lib/prisma';
|
||||
|
||||
export interface CreateReplayChunkArgs {
|
||||
websiteId: string;
|
||||
sessionId: string;
|
||||
chunkIndex: number;
|
||||
events: Uint8Array;
|
||||
eventCount: number;
|
||||
startedAt: Date;
|
||||
endedAt: Date;
|
||||
}
|
||||
|
||||
export async function getReplayChunks(websiteId: string, sessionId: string) {
|
||||
return prisma.client.sessionReplay.findMany({
|
||||
where: {
|
||||
websiteId,
|
||||
sessionId,
|
||||
},
|
||||
orderBy: {
|
||||
chunkIndex: 'asc',
|
||||
},
|
||||
select: {
|
||||
events: true,
|
||||
chunkIndex: true,
|
||||
eventCount: true,
|
||||
startedAt: true,
|
||||
endedAt: true,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export async function createReplayChunk({
|
||||
websiteId,
|
||||
sessionId,
|
||||
chunkIndex,
|
||||
events,
|
||||
eventCount,
|
||||
startedAt,
|
||||
endedAt,
|
||||
}: CreateReplayChunkArgs) {
|
||||
return prisma.client.sessionReplay.create({
|
||||
data: {
|
||||
id: uuid(),
|
||||
websiteId,
|
||||
sessionId,
|
||||
chunkIndex,
|
||||
events: new Uint8Array(events) as any,
|
||||
eventCount,
|
||||
startedAt,
|
||||
endedAt,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export async function deleteReplaysByWebsite(websiteId: string) {
|
||||
return prisma.client.sessionReplay.deleteMany({
|
||||
where: { websiteId },
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user