code
stringlengths
31
2.05k
label_name
stringclasses
5 values
label
int64
0
4
): Context => { const { db } = fastify.mongo; if (!db) { throw new Error("Database not connected"); } return { req, res, db, fastify }; };
Class
2
): Context => { const { db } = fastify.mongo; if (!db) { throw new Error("Database not connected"); } return { req, res, db, fastify }; };
Base
1
): Context => { const { db } = fastify.mongo; if (!db) { throw new Error("Database not connected"); } return { req, res, db, fastify }; };
Base
1
...(date && { date: new Date(date) }),
Class
2
...(date && { date: new Date(date) }),
Base
1
...(date && { date: new Date(date) }),
Base
1
...(tags && { tags: tags.map((tagId) => new ObjectId(tagId)) })
Class
2
...(tags && { tags: tags.map((tagId) => new ObjectId(tagId)) })
Base
1
...(tags && { tags: tags.map((tagId) => new ObjectId(tagId)) })
Base
1
process() { return Promise.resolve(""); },
Class
2
process() { return Promise.resolve(""); },
Base
1
process() { return Promise.resolve(""); },
Base
1
): Promise<OutputContentProcessor> => { if (gitData.provider === "github") { return await createOutputContentProcessorGitHub(ctx, gitData); } return { process() { return Promise.resolve(""); }, processBatch(input) { return Promise.resolve(input.map(() => "")); } }; };
Class
2
): Promise<OutputContentProcessor> => { if (gitData.provider === "github") { return await createOutputContentProcessorGitHub(ctx, gitData); } return { process() { return Promise.resolve(""); }, processBatch(input) { return Promise.resolve(input.map(() => "")); } }; };
Base
1
): Promise<OutputContentProcessor> => { if (gitData.provider === "github") { return await createOutputContentProcessorGitHub(ctx, gitData); } return { process() { return Promise.resolve(""); }, processBatch(input) { return Promise.resolve(input.map(() => "")); } }; };
Base
1
processBatch(input) { return Promise.resolve(input.map(() => "")); }
Class
2
processBatch(input) { return Promise.resolve(input.map(() => "")); }
Base
1
processBatch(input) { return Promise.resolve(input.map(() => "")); }
Base
1
const jsonToBuffer = (json: DocJSON): Buffer => { const doc = TiptapTransformer.toYdoc(json, "default", [ Document, Paragraph, Text, HardBreak, Bold, Italic, Strike, Code, Link, Highlight, Subscript, Superscript, Heading, BulletList, OrderedList, TaskLis...
Class
2
const jsonToBuffer = (json: DocJSON): Buffer => { const doc = TiptapTransformer.toYdoc(json, "default", [ Document, Paragraph, Text, HardBreak, Bold, Italic, Strike, Code, Link, Highlight, Subscript, Superscript, Heading, BulletList, OrderedList, TaskLis...
Base
1
const jsonToBuffer = (json: DocJSON): Buffer => { const doc = TiptapTransformer.toYdoc(json, "default", [ Document, Paragraph, Text, HardBreak, Bold, Italic, Strike, Code, Link, Highlight, Subscript, Superscript, Heading, BulletList, OrderedList, TaskLis...
Base
1
const htmlToJSON = (html: string): DocJSON => { return generateJSON(html, [ Document, Paragraph, Text, HardBreak, Bold, Italic, Strike, Code, Link, Highlight, Subscript, Superscript, Heading, BulletList, OrderedList, TaskList, Blockquote, Wrapper...
Class
2
const htmlToJSON = (html: string): DocJSON => { return generateJSON(html, [ Document, Paragraph, Text, HardBreak, Bold, Italic, Strike, Code, Link, Highlight, Subscript, Superscript, Heading, BulletList, OrderedList, TaskList, Blockquote, Wrapper...
Base
1
const htmlToJSON = (html: string): DocJSON => { return generateJSON(html, [ Document, Paragraph, Text, HardBreak, Bold, Italic, Strike, Code, Link, Highlight, Subscript, Superscript, Heading, BulletList, OrderedList, TaskList, Blockquote, Wrapper...
Base
1
...(webhook.extensionId && { headers: { "X-Vrite-Extension-ID": `${webhook.extensionId}` } }) }); } catch (error) { // eslint-disable-next-line no-console console.error("Failed to run webhook", error); } } };
Class
2
...(webhook.extensionId && { headers: { "X-Vrite-Extension-ID": `${webhook.extensionId}` } }) }); } catch (error) { // eslint-disable-next-line no-console console.error("Failed to run webhook", error); } } };
Base
1
...(webhook.extensionId && { headers: { "X-Vrite-Extension-ID": `${webhook.extensionId}` } }) }); } catch (error) { // eslint-disable-next-line no-console console.error("Failed to run webhook", error); } } };
Base
1
html: renderEmail(email.template, email.data), text: renderEmail(email.template, email.data, true) }); } catch (error) { // eslint-disable-next-line no-console console.error(error); throw errors.serverError(); } }; } return async () => { // e...
Class
2
html: renderEmail(email.template, email.data), text: renderEmail(email.template, email.data, true) }); } catch (error) { // eslint-disable-next-line no-console console.error(error); throw errors.serverError(); } }; } return async () => { // e...
Base
1
html: renderEmail(email.template, email.data), text: renderEmail(email.template, email.data, true) }); } catch (error) { // eslint-disable-next-line no-console console.error(error); throw errors.serverError(); } }; } return async () => { // e...
Base
1
text: renderEmail(email.template, email.data, true) }); } catch (error) { // eslint-disable-next-line no-console console.error(error); throw errors.serverError(); } };
Class
2
text: renderEmail(email.template, email.data, true) }); } catch (error) { // eslint-disable-next-line no-console console.error(error); throw errors.serverError(); } };
Base
1
text: renderEmail(email.template, email.data, true) }); } catch (error) { // eslint-disable-next-line no-console console.error(error); throw errors.serverError(); } };
Base
1
salt: await generateSalt(), external: { github: { id: userData.data.id } } }; await users.insertOne(newUser); const workspaceId = await createWorkspace(newUser, fastify, { defaultContent: true }); await userSettingsCollection...
Class
2
salt: await generateSalt(), external: { github: { id: userData.data.id } } }; await users.insertOne(newUser); const workspaceId = await createWorkspace(newUser, fastify, { defaultContent: true }); await userSettingsCollection...
Base
1
salt: await generateSalt(), external: { github: { id: userData.data.id } } }; await users.insertOne(newUser); const workspaceId = await createWorkspace(newUser, fastify, { defaultContent: true }); await userSettingsCollection...
Base
1
_id: new ObjectId(), userId: newUser._id, codeEditorTheme: "dark", uiTheme: "auto", accentColor: "energy", currentWorkspaceId: workspaceId }); await createSession({ req, res, db, fastify }, `${newUser._id}`); } return res.redirect(...
Class
2
_id: new ObjectId(), userId: newUser._id, codeEditorTheme: "dark", uiTheme: "auto", accentColor: "energy", currentWorkspaceId: workspaceId }); await createSession({ req, res, db, fastify }, `${newUser._id}`); } return res.redirect(...
Base
1
_id: new ObjectId(), userId: newUser._id, codeEditorTheme: "dark", uiTheme: "auto", accentColor: "energy", currentWorkspaceId: workspaceId }); await createSession({ req, res, db, fastify }, `${newUser._id}`); } return res.redirect(...
Base
1
_id: new ObjectId(input.id), workspaceId: ctx.auth.workspaceId }); if (!existingComment) throw errors.notFound("comment"); const existingThread = await commentThreadsCollection.findOne({ _id: existingComment.threadId, workspaceId: ctx.auth.workspaceId }); ...
Class
2
_id: new ObjectId(input.id), workspaceId: ctx.auth.workspaceId }); if (!existingComment) throw errors.notFound("comment"); const existingThread = await commentThreadsCollection.findOne({ _id: existingComment.threadId, workspaceId: ctx.auth.workspaceId }); ...
Base
1
_id: new ObjectId(input.id), workspaceId: ctx.auth.workspaceId }); if (!existingComment) throw errors.notFound("comment"); const existingThread = await commentThreadsCollection.findOne({ _id: existingComment.threadId, workspaceId: ctx.auth.workspaceId }); ...
Base
1
_id: new ObjectId(input.id) }); if (!contentGroup) throw errors.notFound("contentGroup"); if (contentGroup.ancestors.length > 0) { const ancestor = await contentGroupsCollection.findOne({ _id: contentGroup.ancestors[contentGroup.ancestors.length - 1] }); if...
Class
2
_id: new ObjectId(input.id) }); if (!contentGroup) throw errors.notFound("contentGroup"); if (contentGroup.ancestors.length > 0) { const ancestor = await contentGroupsCollection.findOne({ _id: contentGroup.ancestors[contentGroup.ancestors.length - 1] }); if...
Base
1
_id: new ObjectId(input.id) }); if (!contentGroup) throw errors.notFound("contentGroup"); if (contentGroup.ancestors.length > 0) { const ancestor = await contentGroupsCollection.findOne({ _id: contentGroup.ancestors[contentGroup.ancestors.length - 1] }); if...
Base
1
...(ancestorContentGroup && { ancestors: [...ancestorContentGroup.ancestors, ancestorContentGroup._id] }) } } ); if (ancestorContentGroup) { const descendants = await contentGroupsCollection .find({ ancestors: contentGrou...
Class
2
...(ancestorContentGroup && { ancestors: [...ancestorContentGroup.ancestors, ancestorContentGroup._id] }) } } ); if (ancestorContentGroup) { const descendants = await contentGroupsCollection .find({ ancestors: contentGrou...
Base
1
...(ancestorContentGroup && { ancestors: [...ancestorContentGroup.ancestors, ancestorContentGroup._id] }) } } ); if (ancestorContentGroup) { const descendants = await contentGroupsCollection .find({ ancestors: contentGrou...
Base
1
...(isId && { _id: new ObjectId(variantIdOrName) }), ...(!isId && { name: variantIdOrName }) });
Class
2
...(isId && { _id: new ObjectId(variantIdOrName) }), ...(!isId && { name: variantIdOrName }) });
Base
1
...(isId && { _id: new ObjectId(variantIdOrName) }), ...(!isId && { name: variantIdOrName }) });
Base
1
_id: new ObjectId(input.id), workspaceId: ctx.auth.workspaceId }); if (!contentPiece) throw errors.notFound("contentPiece"); await contentPiecesCollection.deleteOne({ _id: contentPiece._id }); await contentsCollection.deleteOne({ contentPieceId: contentPiece._id }); await...
Class
2
_id: new ObjectId(input.id), workspaceId: ctx.auth.workspaceId }); if (!contentPiece) throw errors.notFound("contentPiece"); await contentPiecesCollection.deleteOne({ _id: contentPiece._id }); await contentsCollection.deleteOne({ contentPieceId: contentPiece._id }); await...
Base
1
_id: new ObjectId(input.id), workspaceId: ctx.auth.workspaceId }); if (!contentPiece) throw errors.notFound("contentPiece"); await contentPiecesCollection.deleteOne({ _id: contentPiece._id }); await contentsCollection.deleteOne({ contentPieceId: contentPiece._id }); await...
Base
1
...(workspaceSettings?.metadata?.canonicalLinkPattern && typeof newContentPiece.canonicalLink !== "string" && { canonicalLink: getCanonicalLinkFromPattern( workspaceSettings.metadata.canonicalLinkPattern, { slug: newContentPiece.slug, variant: variantN...
Class
2
...(workspaceSettings?.metadata?.canonicalLinkPattern && typeof newContentPiece.canonicalLink !== "string" && { canonicalLink: getCanonicalLinkFromPattern( workspaceSettings.metadata.canonicalLinkPattern, { slug: newContentPiece.slug, variant: variantN...
Base
1
...(workspaceSettings?.metadata?.canonicalLinkPattern && typeof newContentPiece.canonicalLink !== "string" && { canonicalLink: getCanonicalLinkFromPattern( workspaceSettings.metadata.canonicalLinkPattern, { slug: newContentPiece.slug, variant: variantN...
Base
1
...(workspaceSettings?.metadata?.canonicalLinkPattern && typeof contentPiece.canonicalLink !== "string" && { canonicalLink: getCanonicalLinkFromPattern( workspaceSettings.metadata.canonicalLinkPattern, { slug: contentPiece.slug, variant: variantName } ...
Class
2
...(workspaceSettings?.metadata?.canonicalLinkPattern && typeof contentPiece.canonicalLink !== "string" && { canonicalLink: getCanonicalLinkFromPattern( workspaceSettings.metadata.canonicalLinkPattern, { slug: contentPiece.slug, variant: variantName } ...
Base
1
...(workspaceSettings?.metadata?.canonicalLinkPattern && typeof contentPiece.canonicalLink !== "string" && { canonicalLink: getCanonicalLinkFromPattern( workspaceSettings.metadata.canonicalLinkPattern, { slug: contentPiece.slug, variant: variantName } ...
Base
1
{ _id: new ObjectId(input.id) }, { $set: { config: input.config } } ); if (!matchedCount) { throw errors.notFound("extension"); } publishEvent(ctx, `${ctx.auth.workspaceId}`, { action: "update", data: { i...
Class
2
{ _id: new ObjectId(input.id) }, { $set: { config: input.config } } ); if (!matchedCount) { throw errors.notFound("extension"); } publishEvent(ctx, `${ctx.auth.workspaceId}`, { action: "update", data: { i...
Base
1
{ _id: new ObjectId(input.id) }, { $set: { config: input.config } } ); if (!matchedCount) { throw errors.notFound("extension"); } publishEvent(ctx, `${ctx.auth.workspaceId}`, { action: "update", data: { i...
Base
1
_id: new ObjectId(), workspaceId: ctx.auth.workspaceId, name: input.name, description: input.description, permissions: input.permissions }; await rolesCollection.insertOne(role); publishEvent(ctx, `${ctx.auth.workspaceId}`, { action: "create", d...
Class
2
_id: new ObjectId(), workspaceId: ctx.auth.workspaceId, name: input.name, description: input.description, permissions: input.permissions }; await rolesCollection.insertOne(role); publishEvent(ctx, `${ctx.auth.workspaceId}`, { action: "create", d...
Base
1
_id: new ObjectId(), workspaceId: ctx.auth.workspaceId, name: input.name, description: input.description, permissions: input.permissions }; await rolesCollection.insertOne(role); publishEvent(ctx, `${ctx.auth.workspaceId}`, { action: "create", d...
Base
1
_id: new ObjectId(input.id), workspaceId: ctx.auth.workspaceId }, { $set: { name: input.name, description: input.description, permissions: input.permissions } } ); updateSessionRole(ctx, input.id); publ...
Class
2
_id: new ObjectId(input.id), workspaceId: ctx.auth.workspaceId }, { $set: { name: input.name, description: input.description, permissions: input.permissions } } ); updateSessionRole(ctx, input.id); publ...
Base
1
_id: new ObjectId(input.id), workspaceId: ctx.auth.workspaceId }, { $set: { name: input.name, description: input.description, permissions: input.permissions } } ); updateSessionRole(ctx, input.id); publ...
Base
1
_id: new ObjectId(id) }, { $set: tagUpdate } ); if (!matchedCount) throw errors.notFound("tag"); publishEvent(ctx, `${ctx.auth.workspaceId}`, { action: "update", data: input }); }),
Class
2
_id: new ObjectId(id) }, { $set: tagUpdate } ); if (!matchedCount) throw errors.notFound("tag"); publishEvent(ctx, `${ctx.auth.workspaceId}`, { action: "update", data: input }); }),
Base
1
_id: new ObjectId(id) }, { $set: tagUpdate } ); if (!matchedCount) throw errors.notFound("tag"); publishEvent(ctx, `${ctx.auth.workspaceId}`, { action: "update", data: input }); }),
Base
1
value: (input.label || "").toLowerCase().replace(/\s/g, "_") }; await tagsCollection.insertOne(tag); publishEvent(ctx, `${ctx.auth.workspaceId}`, { action: "create", data: { ...input, id: `${tag._id}` } }); return { id: `${tag._id}` }; ...
Class
2
value: (input.label || "").toLowerCase().replace(/\s/g, "_") }; await tagsCollection.insertOne(tag); publishEvent(ctx, `${ctx.auth.workspaceId}`, { action: "create", data: { ...input, id: `${tag._id}` } }); return { id: `${tag._id}` }; ...
Base
1
value: (input.label || "").toLowerCase().replace(/\s/g, "_") }; await tagsCollection.insertOne(tag); publishEvent(ctx, `${ctx.auth.workspaceId}`, { action: "create", data: { ...input, id: `${tag._id}` } }); return { id: `${tag._id}` }; ...
Base
1
_id: new ObjectId(id), workspaceId: ctx.auth.workspaceId }, { $set: update } ); if (matchedCount === 0) throw errors.notFound("token"); publishEvent(ctx, `${ctx.auth.workspaceId}`, { action: "update", data: { id, ...
Class
2
_id: new ObjectId(id), workspaceId: ctx.auth.workspaceId }, { $set: update } ); if (matchedCount === 0) throw errors.notFound("token"); publishEvent(ctx, `${ctx.auth.workspaceId}`, { action: "update", data: { id, ...
Base
1
_id: new ObjectId(id), workspaceId: ctx.auth.workspaceId }, { $set: update } ); if (matchedCount === 0) throw errors.notFound("token"); publishEvent(ctx, `${ctx.auth.workspaceId}`, { action: "update", data: { id, ...
Base
1
const { deletedCount } = await tokensCollection.deleteOne({ _id: new ObjectId(input.id) }); if (deletedCount === 0) throw errors.notFound("token"); publishEvent(ctx, `${ctx.auth.workspaceId}`, { action: "delete", data: { id: input.id } }); }),
Class
2
const { deletedCount } = await tokensCollection.deleteOne({ _id: new ObjectId(input.id) }); if (deletedCount === 0) throw errors.notFound("token"); publishEvent(ctx, `${ctx.auth.workspaceId}`, { action: "delete", data: { id: input.id } }); }),
Base
1
const { deletedCount } = await tokensCollection.deleteOne({ _id: new ObjectId(input.id) }); if (deletedCount === 0) throw errors.notFound("token"); publishEvent(ctx, `${ctx.auth.workspaceId}`, { action: "delete", data: { id: input.id } }); }),
Base
1
_id: new ObjectId(), workspaceId: ctx.auth.workspaceId, ...input }; await transformersCollection.insertOne(transformer); publishEvent(ctx, `${ctx.auth.workspaceId}`, { action: "create", data: { ...input, id: `${transformer._id}` } }); return { id: ...
Class
2
_id: new ObjectId(), workspaceId: ctx.auth.workspaceId, ...input }; await transformersCollection.insertOne(transformer); publishEvent(ctx, `${ctx.auth.workspaceId}`, { action: "create", data: { ...input, id: `${transformer._id}` } }); return { id: ...
Base
1
_id: new ObjectId(), workspaceId: ctx.auth.workspaceId, ...input }; await transformersCollection.insertOne(transformer); publishEvent(ctx, `${ctx.auth.workspaceId}`, { action: "create", data: { ...input, id: `${transformer._id}` } }); return { id: ...
Base
1
_id: new ObjectId(input.id), workspaceId: ctx.auth.workspaceId }); if (!deletedCount) throw errors.notFound("transformer"); publishEvent(ctx, `${ctx.auth.workspaceId}`, { action: "delete", data: input }); }),
Class
2
_id: new ObjectId(input.id), workspaceId: ctx.auth.workspaceId }); if (!deletedCount) throw errors.notFound("transformer"); publishEvent(ctx, `${ctx.auth.workspaceId}`, { action: "delete", data: input }); }),
Base
1
_id: new ObjectId(input.id), workspaceId: ctx.auth.workspaceId }); if (!deletedCount) throw errors.notFound("transformer"); publishEvent(ctx, `${ctx.auth.workspaceId}`, { action: "delete", data: input }); }),
Base
1
{ _id: new ObjectId(id), workspaceId: ctx.auth.workspaceId }, { $set: update } ); if (!matchedCount) throw errors.notFound("variant"); publishEvent(ctx, `${ctx.auth.workspaceId}`, { action: "update", data: input }); }),
Class
2
{ _id: new ObjectId(id), workspaceId: ctx.auth.workspaceId }, { $set: update } ); if (!matchedCount) throw errors.notFound("variant"); publishEvent(ctx, `${ctx.auth.workspaceId}`, { action: "update", data: input }); }),
Base
1
{ _id: new ObjectId(id), workspaceId: ctx.auth.workspaceId }, { $set: update } ); if (!matchedCount) throw errors.notFound("variant"); publishEvent(ctx, `${ctx.auth.workspaceId}`, { action: "update", data: input }); }),
Base
1
_id: new ObjectId(), workspaceId: ctx.auth.workspaceId, ...input }; await variantsCollection.insertOne(variant); publishEvent(ctx, `${ctx.auth.workspaceId}`, { action: "create", data: { ...input, id: `${variant._id}` } }); return { id: `${variant._...
Class
2
_id: new ObjectId(), workspaceId: ctx.auth.workspaceId, ...input }; await variantsCollection.insertOne(variant); publishEvent(ctx, `${ctx.auth.workspaceId}`, { action: "create", data: { ...input, id: `${variant._id}` } }); return { id: `${variant._...
Base
1
_id: new ObjectId(), workspaceId: ctx.auth.workspaceId, ...input }; await variantsCollection.insertOne(variant); publishEvent(ctx, `${ctx.auth.workspaceId}`, { action: "create", data: { ...input, id: `${variant._id}` } }); return { id: `${variant._...
Base
1
_id: new ObjectId(), userId: user._id, codeEditorTheme: "dark", uiTheme: "auto", accentColor: "energy", currentWorkspaceId: workspaceId }); await createSession(ctx, `${user._id}`); } catch (error) { // eslint-disable-next-line no-...
Class
2
_id: new ObjectId(), userId: user._id, codeEditorTheme: "dark", uiTheme: "auto", accentColor: "energy", currentWorkspaceId: workspaceId }); await createSession(ctx, `${user._id}`); } catch (error) { // eslint-disable-next-line no-...
Base
1
_id: new ObjectId(), userId: user._id, codeEditorTheme: "dark", uiTheme: "auto", accentColor: "energy", currentWorkspaceId: workspaceId }); await createSession(ctx, `${user._id}`); } catch (error) { // eslint-disable-next-line no-...
Base
1
_id: new ObjectId(input.id), workspaceId: ctx.auth.workspaceId }); if (!deletedCount) throw errors.notFound("webhook"); publishEvent(ctx, `${ctx.auth.workspaceId}`, { action: "delete", data: input }); })
Class
2
_id: new ObjectId(input.id), workspaceId: ctx.auth.workspaceId }); if (!deletedCount) throw errors.notFound("webhook"); publishEvent(ctx, `${ctx.auth.workspaceId}`, { action: "delete", data: input }); })
Base
1
_id: new ObjectId(input.id), workspaceId: ctx.auth.workspaceId }); if (!deletedCount) throw errors.notFound("webhook"); publishEvent(ctx, `${ctx.auth.workspaceId}`, { action: "delete", data: input }); })
Base
1
roleId: new ObjectId(input.roleId) } } ); await updateSessionUser(ctx, `${membership.userId}`); publishEvent(ctx, `${ctx.auth.workspaceId}`, { action: "update", data: { id: input.id, userId: `${membership.userId}`, roleId: `${...
Class
2