MCPcopy Index your code
hub / github.com/AnswerOverflow/AnswerOverflow / upsertManyChannels

Function upsertManyChannels

packages/core/src/channel.ts:323–344  ·  view source on GitHub ↗
(data: z.infer<typeof zChannelUpsertMany>)

Source from the content-addressed store, hash-verified

321}
322
323export function upsertManyChannels(data: z.infer<typeof zChannelUpsertMany>) {
324 return upsertMany({
325 input: data,
326 find: () => findManyChannelsById(data.map((c) => c.create.id)),
327 getInputId(input) {
328 return input.create.id;
329 },
330 getFetchedDataId(input) {
331 return input.id;
332 },
333 create: (toCreate) => createManyChannels(toCreate.map((c) => c.create)),
334 update: (toUpdate) =>
335 updateManyChannels(
336 toUpdate
337 .filter((c) => c.update)
338 .map((c) => ({
339 id: c.create.id,
340 ...c.update!,
341 })),
342 ),
343 });
344}
345
346export async function findChannelsBeforeId(input: {
347 serverId: string;

Callers 2

channel.test.tsFile · 0.90
syncServerFunction · 0.90

Calls 4

upsertManyFunction · 0.90
findManyChannelsByIdFunction · 0.85
createManyChannelsFunction · 0.85
updateManyChannelsFunction · 0.85

Tested by

no test coverage detected